Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIA: Implement Smaia/Ssaia extension #1635

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Commits on Oct 6, 2024

  1. Configuration menu
    Copy the full SHA
    66a4ab4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    62e0699 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9231043 View commit details
    Browse the repository at this point in the history
  4. AIA: Add RV32-only mieh, miph, and midelegh CSRs

    Existing CSRs mie, mip, and mideleg are widended to 64 bits to support a
    total of 64 interrupt causes.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    83128ea View commit details
    Browse the repository at this point in the history
  5. AIA: Enable Smcsrind/Sscsrind if supporting Smaia/Ssaia

    Smaia/Ssaia allocates indirect CSRs 0x30~0x3f for major interrupt
    priorities and 0x70~0xff for external interrupts (only with an IMSIC).
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    8d1e172 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6c3a60e View commit details
    Browse the repository at this point in the history
  7. AIA: Add mtopi CSR

    All bytes of the machine-level iprio array are read-only 0s, and
    mtopi.IPRIO is always 1 whenever mtopi is not 0.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    d104423 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8c1bfd9 View commit details
    Browse the repository at this point in the history
  9. AIA: Add mvip CSR, where mvip.SEIP, (sometimes) mvip.STIP, and mvip.S…

    …SIP are aliases of the bits in mip
    
    When mvien is read-only 0, mvip.SEIP and mvip.SSIP are aliases of
    mip.SEIP and mip.SSIP. Accessing mvip.SEIP and mvip.SSIP reads from and
    writes to mip.SEIP and mip.SSIP.
    
    Accessing mvip.STIP reads from and writes to mip.STIP if menvcfg.STCE=1;
    otherwise, mvip.STIP is read-only 0.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    dad58b3 View commit details
    Browse the repository at this point in the history
  10. AIA: Let mvien.SSIP be writable

    When mvien.SSIP=0, mvip.SSIP is an alias of mip.SSIP. Accessing
    mvip.SSIP reads from and writes to mip.SSIP.
    
    When mvien.SSIP=1, mvip.SSIP is a separate writable bit independent of
    mip.SSIP. Accessing mvip.SSIP reads from and writes to the separate,
    writable, independent bit normally.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    af0be26 View commit details
    Browse the repository at this point in the history
  11. AIA: refactor: Let mvip.SEIP be the software-writable bit of mip.SEIP

    The mip.SEIP is the logical-OR of a software-writable bit and signal
    from an external interrupt controller (e.g., APLIC or IMSIC). The AIA
    spec lets the software-writable bit be the mvip.SEIP.
    
    This commit follows the concept that the mvip.SEIP is a sub-component of
    mip.SEIP. Writing mip.SEIP actually updates the software-writable bit,
    i.e., mvip.SEIP. Reading mip.SEIP returns a value consisting of the
    software-writable bit, i.e., mvip.SEIP. The SEIP bit in mip::val becomes
    a placeholder for the external interrupt controller.
    
    Accessing mvip.SEIP reads from and writes to mvip.SEIP normally.
    
    Reference: riscv/riscv-aia#64
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    3a2fd53 View commit details
    Browse the repository at this point in the history
  12. AIA: Let mvien.SEIP be writable

    When mvien.SEIP=0, mip.SEIP includes the software-writable bit, i.e.,
    mvip.SEIP.
    
    When mvien.SEIP=1, mip.SEIP is read-only and does not include the value
    of mvip.SEIP.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    a466721 View commit details
    Browse the repository at this point in the history
  13. AIA: Alias sip[n] to mvip[n] when mideleg[n]=0 and mvien[n]=1

    The AIA spec specifies the sip[n] behavior conditionally:
    (1) When mideleg[n]=0 and mvien[n]=0, sip[n] is read-only 0.
    (2) When mideleg[n]=0 and mvien[n]=1, sip[n] is an alias of mvip[n].
    (3) When mideleg[n]=1, sip[n] is an alias of mip[n].
    
    Points (1) and (3) describe the same behavior without AIA. This commit
    provides the behavior of point (2).
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    e424405 View commit details
    Browse the repository at this point in the history
  14. AIA: Let sie[n] be writable when mideleg[n]=0 and mvien[n]=1

    The AIA spec specifies the sie[n] behavior conditionally:
    (1) When mideleg[n]=0 and mvien[n]=0, sie[n] is read-only 0.
    (2) When mideleg[n]=0 and mvien[n]=1, sie[n] is writable.
    (3) When mideleg[n]=1, sie[n] is an alias of mie[n].
    
    Points (1) and (3) describe the same behavior without AIA. This commit
    provides the behavior of point (2).
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    f387588 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e7a6027 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    56adf18 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    1e0f3f5 View commit details
    Browse the repository at this point in the history
  18. AIA: Add stopi CSR

    All bytes of the supervisor-level iprio array are read-only 0s, and
    stopi.IPRIO is always 1 whenever stopi is not 0.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    6cf0f2b View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    243b2e1 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    c4b02ad View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    5346076 View commit details
    Browse the repository at this point in the history
  22. AIA: Add inaccessible vstopei CSR

    AIA introduces the concept of inaccessible CSR, where accessing from
    M-mode or HS-mode raises an illegal instruction exception, but doing so
    from VS-mode or VU-mode raises a virtual instruction exception.
    
    Without IMSIC, mtopei and stopei do not exist. In contrast, vstopei is
    an inaccessible CSR even without IMSIC, i.e., exits and is HS-qualified.
    
    In summary, accessing stopei from M-mode or HS-mode (v=0) raises illegal
    instruction, and accessing stopei (actually vstopei) from VS-mode or
    VU-mode (v=1) raises virtual instruction.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    c214ff4 View commit details
    Browse the repository at this point in the history
  23. AIA: Add hvictl CSR (no interrupt)

    The pair hvictl.IID=9 and hvictl.IPRIO=0 generally represent no
    interrupt in hvictl.
    
    While zeroing also signifies no interrupt, this intermediate commit in
    the AIA series aims to explicitly state the absence of an interrupt
    condition to prevent confusion in subsequent intermediate commits.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    6d8504c View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    74e42c0 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    e3612d6 View commit details
    Browse the repository at this point in the history
  26. AIA: Raise virtual instruction exception on acessing sie or sip (sieh…

    … or siph) from VS-mode when hvictl.VTI=1
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    5ea18ad View commit details
    Browse the repository at this point in the history
  27. AIA: Raise virtual instruction exception on writing stimecmp (stimecm…

    …ph) from VS-mode when hvictl.VTI=1
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    db5dce7 View commit details
    Browse the repository at this point in the history
  28. AIA: Add vstopi CSR

    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    5460369 View commit details
    Browse the repository at this point in the history
  29. AIA: Implement hvictl.VTI behavior in vstopi CSR

    If hvictl.VTI=0, vstopi returns information about the highest-priority
    pending-and-enabled major interrupt indicated by vsip and vsie.
    
    If hvictl.VTI=1, vstopi return information about a supervisor extenal
    interrupt if bit 9 is one in both vsip and vsie.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    e14574b View commit details
    Browse the repository at this point in the history
  30. AIA: Implement hvictl.IID and hvictl.DPR behavior in vstopi CSR

    If hvictl.VTI=1, there are two interrupt candidates for VS level. One is
    a supervisor extenal interrupt if bit 9 is one in both vsip and vsie.
    The other one is specified by hvictl.IID if hvictl.IID is not 9. The
    hvictl.DPR determines the priority order between two interrupts.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    511d7e1 View commit details
    Browse the repository at this point in the history
  31. AIA: Implement hvictl.IPRIOM and hvictl.IPRIO behavior in vstopi CSR

    If hvictl.IPRIOM=1, vstopi.IPRIO indicates the priority of the
    highest-priority interrupt if vstopi is nonzero.
    
    For a supervisor external interrupt, vstopi.IPRIO is hvictl.IPRIO if
    hvictl.IID=9 and hvictl.IPRIO!=0; otherwise, vstopi.IPRIO is 255.
    
    For other interrupts under hvictl.VTI=1, vstopi.IPRIO is 0 if
    hvictl.iprio=0 and hvictl.dpr=0; vstopi.IPRIO is hvictl.iprio if
    hvictl.iprio!=0; vstopi.IPRIO is 255 if hvictl.iprio=0 and hvictl.dpr=1.
    
    For other interrupts under hvictl.VTI=0, vstopi.IPRIO is 255 (lowest
    priority). That is because other interrupts have the same priority value
    0 due to hviprio1=hviprio2=0. In other words, the hvictl.IPRIO of other
    interrupts is determined by the default priority, which is lower than
    the SEI with the lowest priority value 255.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    f574b32 View commit details
    Browse the repository at this point in the history
  32. AIA: Permit supervisor-level interrupts even while corresponding bits…

    … in mideleg remain 0s (interrupt filtering)
    
    The modification is backward compatible because mvien is implicitly 0
    without AIA.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    62b05b6 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    c774289 View commit details
    Browse the repository at this point in the history
  34. AIA: Take interrupts at VS level through vstopi instead of vsip and vsie

    An interrupt is pending at VS level if and only if vstopi is not 0.
    
    The modification is backward compatible because hvictl is implicitly 0
    without AIA.
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    ad7c922 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    d854584 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    f07a39b View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    4fe9c8e View commit details
    Browse the repository at this point in the history
  38. Smstateen: Implement *stateen0[59] controlling CSRs hvien(h), hvictl,…

    … hviprio[12](h), and supervisor-level iprio array
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    7471db2 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    e70ef4f View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    4dcaff0 View commit details
    Browse the repository at this point in the history
  41. Smstateen: Implement *stateen0[59] controlling RV32-only CSRs (v)siph…

    …, (v)sieh, hidelegh, and hviph
    YenHaoChen committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    d50bf54 View commit details
    Browse the repository at this point in the history