This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Support Sinval extension and hypervisor memory management fence instructions
ClosedPublic

Authored by tangxingxin1008 on Jan 19 2022, 2:16 AM.

Details

Summary
According to Privileged spec version-20211203

Add Supervisor Memory-Management Instructions:
    - SINVAL.VMA, SFENCE.W.INVAL, SFENCE.INVAL.IR
Add Hypervisor Memory-Management Instructions:
    - HFENCE.VVMA, HFENCE.GVMA, HINVAL.VVMA, HINVAL.GVMA

Signed-off-by: eric.tang <eric.tang@starfivetech.com>

Diff Detail

Event Timeline

tangxingxin1008 requested review of this revision.Jan 19 2022, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2022, 2:16 AM
tangxingxin1008 retitled this revision from Update Privileged spec to version-20211203: Support Sinval Extention to [RISCV] Update Privileged spec to version-20211203: Support Sinval Extention.Jan 19 2022, 2:25 AM
asb added a comment.Jan 24 2022, 5:05 AM

Thanks for the patch. I'm not seeing any errors or major issues in this version, but I've suggested a slight cleanup that would reduce duplication across the different instruction definitions.

llvm/lib/Target/RISCV/RISCVInstrInfo.td
683

If you defined a Priv_rr class, you could use that for sfence.vma, sinval.vma, hfence.{v,g}vma and hinval.{v,g}vma.

697

I think these hfence instructions are technically not part of Sinval, but defined in the hypervisor extension. I understand there's a bit of a circular dependency here, so my suggestion would just be to modify the commit title to something like "Support Sinval extension and hypervisor memory management fence instructions"

Address asb's comment.

tangxingxin1008 retitled this revision from [RISCV] Update Privileged spec to version-20211203: Support Sinval Extention to [RISCV] Support Sinval extension and hypervisor memory management fence instructions.Feb 17 2022, 7:01 PM
tangxingxin1008 edited the summary of this revision. (Show Details)
llvm/lib/Target/RISCV/RISCVInstrInfo.td
683

done.

697

done.

asb accepted this revision.Feb 24 2022, 3:57 AM

Thanks, LGTM.

This revision is now accepted and ready to land.Feb 24 2022, 3:57 AM
This revision was landed with ongoing or failed builds.Feb 27 2022, 10:08 PM
This revision was automatically updated to reflect the committed changes.
craig.topper added inline comments.Mar 2 2022, 4:20 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
854

Should there be aliases for hfence.vvma?

Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 4:20 PM
tangxingxin1008 added inline comments.Mar 3 2022, 1:58 AM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
854

yes, I think so, but I miss it. I rise up a patch[D120878] to discuss this.