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

Rebase rvh squash 0912 #171

Merged
merged 44 commits into from
Oct 8, 2024
Merged

Rebase rvh squash 0912 #171

merged 44 commits into from
Oct 8, 2024

Conversation

jueshiwenli
Copy link
Collaborator

No description provided.

shinezyy and others added 30 commits September 12, 2024 21:02
Change-Id: I26add7336e515658b0bbdaebeb00bb2848826715
Change-Id: I5369768610a052299a3351b31677969d6a5d2f90
- add mcountinhibit
- add mhpmcounter
- update mcounteren config
- add menvcfg
Change-Id: I6fe28f5654b5312eb7a3d77013f6f99fd006fa93
Change-Id: Ibffd33bff95044db9ec4f7e28c2c60ff874a0bb8
Change-Id: Ib4b056c41e166ac374077b26567b31e9b681cfc6
Change-Id: I88ccd869c7b33d64aef57d3e84fdc8e947d1c770
Change-Id: I88f5910c6da05630eebd05cfcbe51ccffb376c92
In h-checkpoint ,we don't need to designate gcpt-restore

Change-Id: I3433139c7e6b7f2774f3d9a1f7f0a5dbb874ea9e
make pmp read with different mask

Change-Id: If82e1f518e32c6e7da78d39664c124773930e9e8
- add hstatus
- fix bug of vsstatus
- add h difftest
- add hie
- open virtualization mode
- fix bugs of mstatus & vir mode
- fix bugs of mastatus mask
- fix bugs of hstatus & virt mode
- fix bugs of write h csr
- when cpu.v =1 sret need update vsstatus
- else need update v & hstatus

Change-Id: Ie7af67adae3c2fe337306517d0bec99ac4587056
- when in s mode judge whether is in hs
- when in hs,update vsstatus v vscause vsepc

Change-Id: I49f790f565fba928c751590084420b24f3a1caff
- fix bugs of write vsscratch
- fix bugs of pc state

Change-Id: I692366a494d2aeaff0e7f56035a6440e51ea550a
when need translate tlb will check translate mode
two stage translate mode :
- VSstage
- Gstage

Change-Id: I18a70651bf1a89a821609b417940fea5e5559bf7
Change-Id: Idf45d80dde0450227a087ee14b1f2fa0680e3787
- use g_trap update htval/mtval2 only g-stage
- when vmode need to update vsstatus instead of sstatus
- when write sstatus ,sometimes need to update vsstatus

Change-Id: I33edbb6ab81a82f65267878447e64e27b4e3a24a
Change-Id: I1baf3d38986371b3319cb3524d066c81929fe07b
Change-Id: I919f19814fe3ecf58de7ca551264dcdadc1d6bdc
when fault in vsstage need to endwalk and return
fix wrong of paddr

Change-Id: I707f14fb8ab57416dd6fb49d6c799ba70580fa24
- fix bugs of write vsstatus
- fix bugs of satp & hie & sie
- fix bugs of hcountern
- fix bugs of hip & hvip

Change-Id: I16e0bb4bec13c66b7ab814d2522db1009451dfdc
- when vsatp mode = 0 gstage need change translate level
- add misalign data addr check

Change-Id: Iabafd8726e8623f8ae0347f58490a43d7a879b29
- support h-csr update
- fix bugs of status vmode=1
- fix bugs of sepc stval scause

Change-Id: Id56a083364550f1165c4f4f2413cf7b6c491ee3c
Change-Id: I6347d4ffd8dfca2c54b92e0573cf63dd0480367f
- when v = 1 , npc = vsepc
- initstate need set virt
- update pte.a & pte.d by pagefault
- fix bugs of update vsstatus
- fix bugs of update mstatus
- rvh wfi need check hvfault
- fix bugs of update mstatus
- fix bugs of stvec satp stvec
- fix bugs of scountern
- fix bugs of read sie

Change-Id: I8e4d339eebf1bf80c2fe5337a9d9f4abbcc54262
- hgatp.mode == 8 || vsatp.mode == 8 need translate
- judge address before start g_ptw
- vsatpmode0, gpaddr == vaddr
- when coalesce, need to return different gpaddr

Change-Id: Ic8210e97a689e47bd457fc4cc2638550694f33b4
Change-Id: I3b0f7858d4a27a23533628a3c38c50f41b5e9305
Change-Id: If3b3d3af7df6d460c7e6e106f87f5348927ab3d3
- all stage entry need put highest level in vs & g stage
- fix bugs of vsatp0mode gpaddr
- fix bugs of hit in l1tln gstage gPaddr
- allstsge hit need to check vsPte
- hfence.gvma will flush tlb with addr & hgatp
- hfence.vvma will flush tlb with addr & vsatp

Change-Id: I341eb4c17497c41660352e51cae57c0294e26f6b
- add h-difftest when pagefault
- add stats of pagefault times

Change-Id: I51bcd1ebf3d0e7eda91ab335e775e829ec030382
Change-Id: Ifdd38b47f6222c1ab6e285f46644b837dc80eb39
- support hfence
- when hit in h-l2tlb the result will be send after set cycle
- check tlb before ptw send request
Change-Id: Ibf39612734e9ec64bfef3231c4732989a910ff9c
Change-Id: I842f48f4c78bd1f1b4dbe7b591a466beb924e167
@@ -851,7 +851,8 @@ const RegVal MSTATUS_MASK = STATUS_SD_MASK | STATUS_SXL_MASK |
STATUS_SPP_MASK | STATUS_MPIE_MASK |
STATUS_SPIE_MASK | STATUS_UPIE_MASK |
STATUS_MIE_MASK | STATUS_SIE_MASK |
STATUS_UIE_MASK;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete old code?

@@ -345,7 +345,8 @@ def template CSRExecute {{
RegVal data, olddata;
auto lowestAllowedMode = (PrivilegeMode)bits(csr, 9, 8);
auto pm = (PrivilegeMode)xc->readMiscReg(MISCREG_PRV);
if (pm < lowestAllowedMode) {
if ((pm < lowestAllowedMode)&&
((csr <CSR_HSTATUS) ||(csr >CSR_HGATP)) && ((csr <CSR_VSSTATUS) ||(csr > CSR_VSATP))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format thiese two line of code?

csr <CSR_HSTATUS --> csr < CSR_HSTATUS
) ||( --> ) || (

diffAllStates->gem5RegFile.vsscratch = gem5_val;
if (!diff_at)
diff_at = ValueDiff;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rewrite this chunk of code with a function, a template function, or a macro?

It looks too redundant

src/cpu/base.hh Outdated
@@ -743,7 +743,7 @@ class BaseCPU : public ClockedObject
uint64_t amoOldGoldenValue;
// Register address causing difftest error
bool errorRegsValue[96];// 32 regs + 32fprs +32 vprs
bool errorCsrsValue[32];// CsrRegIndex
bool errorCsrsValue[36];// CsrRegIndex
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a enum or macro here?

status.spp = PRV_U;
xc->setMiscReg(MISCREG_STATUS, status);
NPC = xc->readMiscReg(MISCREG_SEPC);
bool writeSign = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local_variable should use snake_case

if (pp != PRV_M && (tc->readMiscReg(MISCREG_VIRMODE) == 1) &&
bits(tc->readMiscReg(MISCREG_HEDELEG), _code) != 0) {
prvh = PRV_HS;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the if block and else block seems to be the same?

Copy link
Contributor

@shinezyy shinezyy Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundancy has not resolved yet @jueshiwenli ?

if ((translateMode == twoStageMode) && (inGstage)){
mainFault = twoStageStepWalk(write);
}
else if ((translateMode == twoStageMode) && (!inGstage)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else if {

else if ((translateMode == twoStageMode) && (!inGstage)){
mainFault = twoStageWalk(write);
}
else{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else if {

code = ExceptionCode::STORE_PAGE;
else
code = ExceptionCode::INST_PAGE;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are if block and else block the same?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not resolved yet @jueshiwenli

}
if (virt != 0) {
if (vsatp.mode == 0)
assert(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert (vsatp.mode != 0);

if (vsatp.mode == 0)
assert(0);
} else {
assert(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asssert (virt != 0);

lookupL2TLB(vpn + step * i, entry.vmid, BaseMMU::Read, true, choose, false, translateMode);
else
newEntry =
lookupL2TLB(vpn + step * i, entry.asid, BaseMMU::Read, true, choose, false, translateMode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add { }

for (i = 0; i < l2TlbSpSize * l2tlbLineSize; i = i + l2tlbLineSize) {
if (tlbL2Sp[i].trieHandle)
l2TLBRemove(i, L_L2sp1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a function, and call this function 4 times

for (i = 0; i < l2TlbSpSize * l2tlbLineSize; i = i + l2tlbLineSize) {
if (tlbL2Sp[i].trieHandle)
l2TLBRemove(i, L_L2sp1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a function, and call this function 4 times

l2TLBRemove(i, L_L2L3);
DPRINTF(TLBVerbose3, "l2l3 remove vaddr %#x vpn %#x vpnl2l3\n", tlbL2L3[i].vaddr, vpn, vpnl2l3);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a function, and call this function x times.

if (isStage2)
l2tlb = this;
else
l2tlb = static_cast<TLB *>(nextLevel());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add { }

- Only check misalignDataAddr in two stage translate
- fix bugs of remove l2tlb
Change-Id: I27cdfd1370d1e702c69cc68ba395f4ef1de82dc8
- default off h csr diff
- add switch to enable enabledifftesInstTrace

Change-Id: I91433e72310c8311dace7064ae0c0c3f6c71ed34
Change-Id: Ifcb9a9982b93db26e3e37df4332f433452f8e762
- fix bug of difftest, when valuediff need panic
- use DiffValue flag enable difftest trace
- clean difftest code

Change-Id: Ie5409ea04a892d7f7a878345db37df482d2e68f1
@shinezyy shinezyy merged commit 546142b into xs-dev Oct 8, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants