-
Notifications
You must be signed in to change notification settings - Fork 8.1k
riscv: pmp: Add macro to convert DT memory attributes to PMP permissions #97499
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
base: main
Are you sure you want to change the base?
Conversation
483a878
to
a0979ce
Compare
#define DT_MEM_RISCV_TO_PMP_PERM(dt_attr) ( \ | ||
(((dt_attr) & DT_MEM_RISCV_TYPE_IO_R) ? PMP_R : 0) | \ | ||
(((dt_attr) & DT_MEM_RISCV_TYPE_IO_W) ? PMP_W : 0) | \ | ||
(((dt_attr) & DT_MEM_RISCV_TYPE_IO_X) ? PMP_X : 0)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I added it into #96241
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this PR to be a standalone PR and updated the test folder to match memattr so technically I can rebase my #96241 on top on this if this merges first.
a0979ce
to
f7d8712
Compare
c0b6290
to
b4577da
Compare
Introduce the DT_MEM_RISCV_TO_PMP_PERM macro to translate Device Tree RISC-V memory attributes (DT_MEM_RISCV_TYPE_IO_R, DT_MEM_RISCV_TYPE_IO_W, DT_MEM_RISCV_TYPE_IO_X) into their corresponding RISC-V PMP permission bits (PMP_R, PMP_W, PMP_X). This allows for a clear and standardized way to define PMP regions based on Device Tree properties. Added a test suite for RISC-V PMP utilities, including a test case to verify the correctness of the DT_MEM_RISCV_TO_PMP_PERM macro across various attribute combinations. Signed-off-by: Firas Sammoura <[email protected]>
b4577da
to
363b3f7
Compare
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
Introduce the
DT_MEM_RISCV_TO_PMP_PERM
macro to translate Device TreeRISC-V
memory attributes (DT_MEM_RISCV_TYPE_IO_R
,DT_MEM_RISCV_TYPE_IO_W
,DT_MEM_RISCV_TYPE_IO_X
) into their corresponding RISC-V PMP permission bits (PMP_R
,PMP_W
,PMP_X
).This allows for a clear and standardized way to define PMP regions based on Device Tree properties.
Added a test suite for RISC-V PMP utilities, including a test case to verify the correctness of the
DT_MEM_RISCV_TO_PMP_PERM
macro across various attribute combinations.