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

Add hypervisor extension #2841

Merged
merged 52 commits into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5cad4b1
Add hypervisor extension
aswaterman May 26, 2021
7788654
maintain same width of MIP CSR bit positions 'lip'
ingallsj Jun 9, 2021
cb12a1a
CSR Decode: Expanded Instruction for c.ebreak
ingallsj Jun 9, 2021
c3f0be7
drop 'd' from TLBReq.dprv/dv also driven by instruction request
ingallsj Jun 9, 2021
cbe61d8
Object Model: useHypervisor param
ingallsj Jun 10, 2021
05f4681
PTW: pad request address in s1_ppns
ingallsj Jun 15, 2021
eb63dc5
guest XLen fixed static value
ingallsj Jun 25, 2021
41b48f9
GEILEN=0, so tie off HStatus.VGEIN
ingallsj Jun 28, 2021
1c4b1a5
GEILEN=0, so tie off HGEIE/HGEIP
ingallsj Jun 29, 2021
202aa69
GEILEN=0, so mask off SGEIP
ingallsj Jun 29, 2021
155498a
untie vsstatus.SXL [bit 35]
ingallsj Jul 16, 2021
4f83c2b
mstatus.GVA should be set by load/store fault with DV=1
ingallsj Jul 21, 2021
388c174
allow HSV in U-mode when hstatus.HU=1
ingallsj Aug 4, 2021
df7cbe1
Stage-1 PTW DV from VS-mode
ingallsj Aug 26, 2021
b387152
PTW: consider full GPA when indexing PTE cache
ingallsj Sep 4, 2021
d787b89
PTW: support GPAs larger than VA size
ingallsj Sep 13, 2021
b8bdcf0
TLB: support GPAs larger than VA size
ingallsj Sep 13, 2021
5039f8f
PTW: use correct indexing function for PTE cache
ingallsj Sep 13, 2021
7e7d2a7
Raise correct exception when VU-mode counter access is disabled
ingallsj Sep 15, 2021
8b53c2f
stage2 pte cache data entry width
ingallsj Sep 17, 2021
5f79178
flush guest TLB entries on guest Bare <-> SvXX transitions
ingallsj Sep 17, 2021
5dcdea4
ISA: Neither mstatus.TVM nor hstatus.VTVM causes HFENCE.VVMA to trap.
ingallsj Sep 20, 2021
725c171
Update the aux_count value to be 0 when vstage1 is disabled. RTL inc…
ingallsj Sep 27, 2021
ba6d279
DTS: add Hypervisor hgatp modes to mmu-type
ingallsj Oct 1, 2021
0299687
width of hcounteren should be controlled by nPerfCounters
ingallsj Oct 14, 2021
1714680
satp/vsatp/hgatp.MODE should reset to legal value (off)
ingallsj Oct 15, 2021
ebe27d6
TLB/PTW: add htval/mtval2 support
aswaterman Oct 15, 2021
20a73d1
CSRFile: add htval/mtval2 support
aswaterman Oct 15, 2021
ee11a33
D$: add htval/mtval2 support
aswaterman Oct 15, 2021
dbe291c
I$: add htval/mtval2 support
aswaterman Oct 15, 2021
1ae8eec
rocket: add htval/mtval2 support
aswaterman Oct 15, 2021
9d8d991
RoccBlackBox: add input rocc_mem_s2_gpa
ingallsj Oct 17, 2021
6810179
TLB vstage1_en usingHypervisor
ingallsj Oct 21, 2021
3c0a43a
PTW set stage2_final when !vstage1
ingallsj Oct 21, 2021
746a64b
don't populate htval for regular page fault or misaligned
ingallsj Oct 21, 2021
4db3e3e
TLB: optimize uses of (v)stage1_en
ingallsj Oct 22, 2021
e4f038e
invalidate fragmented TLB entry on hfence.vvma
ingallsj Oct 23, 2021
412c89f
CSRFileIO.htval same width as reg_htval/mtval2
ingallsj Oct 25, 2021
617fa92
PTW: optimize more uses of vsatp instead of muxed satp
ingallsj Oct 28, 2021
53bab37
L1TLB: pass-through requests should hit
ingallsj Nov 9, 2021
834c54a
RNMI: Add MPV field to capture virtualization mode upon NMI
ingallsj Nov 10, 2021
a87ef0d
do not take virtual instruction fault on write access to read-only CSR
ingallsj Nov 12, 2021
297e058
TLB: fix GPA-acquisition livelock
ingallsj Nov 14, 2021
2bb93eb
CSR: vstvec/stvec width = vaddrBitsExtended
ingallsj Nov 16, 2021
3c952ae
TLB: correctly propagate LSBs of GPA
ingallsj Nov 16, 2021
6b64fdc
L2TLB allocation should ignore G-stage PTE Global bit
ingallsj Nov 19, 2021
3ed2918
read_mideleg do not OR-on local interrupts always from hs_delegable_i…
ingallsj Nov 26, 2021
0e0ee81
L1TLB timing: superpage GPA miss invalidate
ingallsj Nov 30, 2021
96be395
PTW coverage: PTE cache hit level cover stage2 use aux_count
ingallsj Dec 7, 2021
27dc0e0
TLB GPA need not come back as a fragmented superpage entry
ingallsj Dec 14, 2021
f87dd6c
PTW: Stage-2 should check for a PPN-out-of-range access fault before …
ingallsj Dec 16, 2021
7dc906e
VS-disabled mtval2/htval should correspond exactly to mtval/stval>>2
ingallsj Dec 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/main/resources/vsrc/RoccBlackBox.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module RoccBlackBox
coreDataBits,
coreDataBytes,
paddrBits,
vaddrBitsExtended,
FPConstants_RM_SZ,
fLen,
FPConstants_FLAGS_SZ )
Expand All @@ -32,9 +33,15 @@ module RoccBlackBox
input rocc_cmd_bits_status_wfi,
input [31:0] rocc_cmd_bits_status_isa,
input [PRV_SZ-1:0] rocc_cmd_bits_status_dprv,
input rocc_cmd_bits_status_dv,
input [PRV_SZ-1:0] rocc_cmd_bits_status_prv,
input rocc_cmd_bits_status_v,
input rocc_cmd_bits_status_sd,
input [26:0] rocc_cmd_bits_status_zero2,
input [22:0] rocc_cmd_bits_status_zero2,
input rocc_cmd_bits_status_mpv,
input rocc_cmd_bits_status_gva,
input rocc_cmd_bits_status_mbe,
input rocc_cmd_bits_status_sbe,
input [1:0] rocc_cmd_bits_status_sxl,
input [1:0] rocc_cmd_bits_status_uxl,
input rocc_cmd_bits_status_sd_rv32,
Expand All @@ -51,7 +58,7 @@ module RoccBlackBox
input [1:0] rocc_cmd_bits_status_mpp,
input [0:0] rocc_cmd_bits_status_spp,
input rocc_cmd_bits_status_mpie,
input rocc_cmd_bits_status_hpie,
input rocc_cmd_bits_status_ube,
input rocc_cmd_bits_status_spie,
input rocc_cmd_bits_status_upie,
input rocc_cmd_bits_status_mie,
Expand All @@ -73,6 +80,7 @@ module RoccBlackBox
output rocc_mem_req_bits_no_alloc,
output rocc_mem_req_bits_no_xcpt,
output [1:0] rocc_mem_req_bits_dprv,
output rocc_mem_req_bits_dv,
output [coreDataBits-1:0] rocc_mem_req_bits_data,
output [coreDataBytes-1:0] rocc_mem_req_bits_mask,
output rocc_mem_s1_kill,
Expand All @@ -83,6 +91,8 @@ module RoccBlackBox
output rocc_mem_s2_kill,
input rocc_mem_s2_uncached,
input [paddrBits-1:0] rocc_mem_s2_paddr,
input [vaddrBitsExtended-1:0] rocc_mem_s2_gpa,
input rocc_mem_s2_gpa_is_pte,
input rocc_mem_resp_valid,
input [coreMaxAddrBits-1:0] rocc_mem_resp_bits_addr,
input [dcacheReqTagBits-1:0] rocc_mem_resp_bits_tag,
Expand All @@ -97,11 +107,14 @@ module RoccBlackBox
input [coreDataBits-1:0] rocc_mem_resp_bits_data_raw,
input [coreDataBits-1:0] rocc_mem_resp_bits_store_data,
input [1:0] rocc_mem_resp_bits_dprv,
input rocc_mem_resp_bits_dv,
input rocc_mem_replay_next,
input rocc_mem_s2_xcpt_ma_ld,
input rocc_mem_s2_xcpt_ma_st,
input rocc_mem_s2_xcpt_pf_ld,
input rocc_mem_s2_xcpt_pf_st,
input rocc_mem_s2_xcpt_gf_ld,
input rocc_mem_s2_xcpt_gf_st,
input rocc_mem_s2_xcpt_ae_ld,
input rocc_mem_s2_xcpt_ae_st,
input rocc_mem_ordered,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class RocketLogicalTreeNode(
def getOMInterruptTargets(): Seq[OMInterruptTarget] = {
Seq(OMInterruptTarget(
hartId = tile.rocketParams.hartId,
modes = OMModes.getModes(tile.rocketParams.core.hasSupervisorMode)
modes = OMModes.getModes(tile.rocketParams.core.hasSupervisorMode, tile.rocketParams.core.useHypervisor)
))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ package freechips.rocketchip.diplomaticobjectmodel.model

sealed trait PrivilegedArchitectureExtension extends OMEnum
case object MachineLevelISA extends PrivilegedArchitectureExtension
case object HypervisorLevelISA extends PrivilegedArchitectureExtension
case object SupervisorLevelISA extends PrivilegedArchitectureExtension

object PrivilegedArchitectureExtensions {
val specifications = Map[PrivilegedArchitectureExtension, String](
MachineLevelISA -> "Machine-Level ISA",
HypervisorLevelISA -> "Hypervisor-Level ISA",
SupervisorLevelISA -> "Supervisor-Level ISA"
)

Expand All @@ -36,7 +38,8 @@ object ISAExtensions {
C -> "C Standard Extension for Compressed Instruction",
B -> "B Standard Extension for Bit Manipulation",
U -> "The RISC‑V Instruction Set Manual, Volume II: Privileged Architecture",
S -> "Supervisor-Level ISA"
S -> "Supervisor-Level ISA",
H -> "H Standard Extension for Hypervisor",
)

def specVersion(extension: OMExtensionType, version: String): OMSpecification = OMSpecification(specifications(extension), version)
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/diplomaticobjectmodel/model/OMISA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ case object C extends OMExtensionType
case object B extends OMExtensionType
case object U extends OMExtensionType
case object S extends OMExtensionType
case object H extends OMExtensionType

trait OMAddressTranslationMode extends OMEnum
case object Bare extends OMAddressTranslationMode
Expand Down Expand Up @@ -44,6 +45,7 @@ case class OMISA(
v: Option[OMVectorExtension] = None,
u: Option[OMSpecification],
s: Option[OMSpecification],
h: Option[OMSpecification],
addressTranslationModes: Seq[OMAddressTranslationMode],
customExtensions: Seq[OMCustomExtensionSpecification],
_types: Seq[String] = Seq("OMISA", "OMCompoundType")
Expand Down Expand Up @@ -105,6 +107,7 @@ object OMISA {
c = coreParams.useCompressed.option(isaExtSpec(C, "2.0")),
u = (coreParams.hasSupervisorMode || coreParams.useUser).option(isaExtSpec(U, "1.10")),
s = coreParams.hasSupervisorMode.option(isaExtSpec(S, "1.10")),
h = coreParams.useHypervisor.option(isaExtSpec(H, "0.6")),
addressTranslationModes = Seq(addressTranslationModes),
customExtensions = customExtensions
)
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/diplomaticobjectmodel/model/OMPLIC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ package freechips.rocketchip.diplomaticobjectmodel.model

sealed trait OMPrivilegeMode extends OMEnum
case object OMMachineMode extends OMPrivilegeMode
case object OMHypervisorMode extends OMPrivilegeMode
case object OMSupervisorMode extends OMPrivilegeMode
case object OMUserMode extends OMPrivilegeMode

object OMModes {
def getModes(hasSupervisorMode: Boolean): Seq[OMPrivilegeMode] = {
hasSupervisorMode match {
case false => Seq(OMMachineMode)
case true => Seq(OMMachineMode, OMSupervisorMode)
}
def getModes(hasSupervisorMode: Boolean, hasHypervisorMode: Boolean): Seq[OMPrivilegeMode] = {
Seq(OMMachineMode) ++
(if (hasHypervisorMode) Seq(OMHypervisorMode) else Seq()) ++
(if (hasSupervisorMode) Seq(OMSupervisorMode) else Seq())
}
}

Expand Down
Loading