riscv-non-isa / iopmp-spec

This repository contains the specification source for the RISC-V IOPMP Specification. This document proposes a Physical Memory Protection Unit of Input/Output devices, IOPMP for short, to regulate the accesses issued from the bus masters.
https://jira.riscv.org/browse/RVG-56
Creative Commons Attribution 4.0 International
15 stars 4 forks source link

Questions about SRCMD table format 2 #13

Open leBsky opened 1 month ago

leBsky commented 1 month ago

The SRCMD table format 2 is added in the lastest IOPMP spec, which adds register SRCMD_PERM(m) and SRCMD_PERMH(m) to give extra check for transactions. I met two questions when tried to understand the format 2.

  1. The SRCMD table format 2 is indexed by MD, but how to determine if the RRID is associated with each MD is not clear. For example, assume SRCMD_PERM(0) and SRCMD_PERMH(0) are both all 0, then for MD0, the r/w/x permission for RRID 0~31 are all 0, but it cannot be found that which RRID is related with MD0. Therefore, we cannot find the related IOPMP entries for RRIDs. However, we still need IOPMP entries to check the transaction.

  2. Since the SRCMD_PERM and SRCMD_PERMH are both 32 bits, and one RRID needs 2 bits in SRCMD_PREM and SRCMD_PERMH to represent the r/w/x permissions, as a result, only (32+32)/2 = 32 RRIDs can be supported for SRCMD table format 2. Is it an expected behavior?

tyshyu commented 1 month ago
  1. It seems like there is a need for further clarification. Another discussion here: https://lists.riscv.org/g/tech-iopmp/message/321 https://lists.riscv.org/g/tech-iopmp/message/322

  2. Yes, 32 RRIDs is an expected behavior. AFAIK, another purpose of SRCMD format 2 is for WorldGuard Checker compatibility. WorldGuard Checker is non-ISA part of WorldGuard. The max number of WID (World Identifier) is 32 in WorldGuard Checker. Tagging RRIDs is implementation-dependent so the WID can be RRID of IOPMP. ISA part of WorldGuard will be a fast track extension of RISC-V.

leBsky commented 1 month ago
  1. It seems like there is a need for further clarification. Another discussion here: https://lists.riscv.org/g/tech-iopmp/message/321 https://lists.riscv.org/g/tech-iopmp/message/322 Thank you sir. I looked into the messages but still cannot get the relationship between input RRID and MDs. It seems that Paul would share some slides which may be helpful for this question but I cannot get access to these slides. Could you please help clarify the question if you have access to the slides.

  2. Yes, 32 RRIDs is an expected behavior. AFAIK, another purpose of SRCMD format 2 is for WorldGuard Checker compatibility. WorldGuard Checker is non-ISA part of WorldGuard. The max number of WID (World Identifier) is 32 in WorldGuard Checker. Tagging RRIDs is implementation-dependent so the WID can be RRID of IOPMP. ISA part of WorldGuard will be a fast track extension of RISC-V. Get it

tyshyu commented 1 week ago

Thank you sir. I looked into the messages but still cannot get the relationship between input RRID and MDs. It seems that Paul would share some slides which may be helpful for this question but I cannot get access to these slides. Could you please help clarify the question if you have access to the slides.

This is meeting minutes of the last IOPMP TG meeting: https://github.com/riscv-admin/iopmp/blob/main/meeting-minutes/2024-1107-IOPMP-meeting-minutes.pdf

The slides on page 5~7 shows the relationship between input RRID and MDs.

leBsky commented 1 week ago

Thank you sir. I looked into the messages but still cannot get the relationship between input RRID and MDs. It seems that Paul would share some slides which may be helpful for this question but I cannot get access to these slides. Could you please help clarify the question if you have access to the slides.

This is meeting minutes of the last IOPMP TG meeting: https://github.com/riscv-admin/iopmp/blob/main/meeting-minutes/2024-1107-IOPMP-meeting-minutes.pdf

The slides on page 5~7 shows the relationship between input RRID and MDs.

Page 7 of the slide shows that an RRID selects all the MDs and all entries. I want to confirm the meaning of “all entries” here. I have 2 understandings.

  1. all entries means all IOPMP entries so that it is not required to implement MDCFG table because we don't need to choose IOPMP entry for each MD according to MDCFG table.

  2. all entries means all MD's associated IOPMP entries. For those IOPMP entries that are not associated with any MD, we don't count them. In this case, we still need to implement a MDCFG table.

Please help clarify which understanding is the intent of the Spec. Thank you very much.

tyshyu commented 6 days ago

Both are not accurate. Your understanding 2 is close to the intent of the Spec but not only counts the IOPMP entries that are not associated with any MD. We still need the MDCFG table to know an IOPMP entry associates which memory domain and corresponding permissions of the memory domain.