Skip to content

Commit

Permalink
Merge pull request riscv-non-isa#292 from ved-rivos/0419
Browse files Browse the repository at this point in the history
grant exec only if requested
  • Loading branch information
ved-rivos authored Apr 19, 2024
2 parents 9fdfa0a + 1f9040d commit ebaa667
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions iommu_ref_model/libiommu/src/iommu_translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ iommu_translate_iova(
// no-write not requested and no write permission; no read permission) then a
// Success response is returned with the denied permission (R, W or X) set to 0
// and the other permission bits set to value determined from the page tables.
// The X permission is granted only if the R permission is also granted.
// The X permission is granted only if the R permission is also granted
// and execute permission was requested.
// Execute-only translations are not compatible with PCIe ATS as PCIe requires
// read permission to be granted if the execute permission is granted.
// When a Success response is generated for a ATS translation request, no fault
Expand All @@ -464,7 +465,7 @@ iommu_translate_iova(
rsp_msg->trsp.U = (is_msi & is_mrif);
rsp_msg->trsp.R = (vs_pte.R & g_pte.R);
rsp_msg->trsp.W = (vs_pte.W & g_pte.W & vs_pte.D & g_pte.D);
rsp_msg->trsp.Exe = (vs_pte.X & g_pte.X & vs_pte.R & g_pte.R);
rsp_msg->trsp.Exe = (vs_pte.X & g_pte.X & vs_pte.R & g_pte.R) & req->exec_req;
}
return;

Expand Down
8 changes: 4 additions & 4 deletions iommu_ref_model/test/test_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ main(void) {
fail_if( ( rsp.trsp.U != 0 ) );
fail_if( ( rsp.trsp.R != 1 ) );
fail_if( ( rsp.trsp.W != 0 ) );
fail_if( ( rsp.trsp.Exe != 1 ) );
fail_if( ( rsp.trsp.Exe != 0 ) );
fail_if( ( rsp.trsp.PBMT != PMA ) );
fail_if( ( rsp.trsp.is_msi != 0 ) );
if ( rsp.trsp.S == 1 ) {
Expand Down Expand Up @@ -1279,7 +1279,7 @@ main(void) {
fail_if( ( rsp.trsp.U != 0 ) );
fail_if( ( rsp.trsp.R != 1 ) );
fail_if( ( rsp.trsp.W != 1 ) );
fail_if( ( rsp.trsp.Exe != 1 ) );
fail_if( ( rsp.trsp.Exe != 0 ) );
fail_if( ( rsp.trsp.PBMT != PMA ) );
fail_if( ( rsp.trsp.is_msi != 0 ) );
fail_if( ( rsp.trsp.S != 1 ) );
Expand Down Expand Up @@ -1500,7 +1500,7 @@ main(void) {
fail_if( ( rsp.trsp.U != 0 ) );
fail_if( ( rsp.trsp.R != 1 ) );
fail_if( ( rsp.trsp.W != 0 ) );
fail_if( ( rsp.trsp.Exe != 1 ) );
fail_if( ( rsp.trsp.Exe != 0 ) );
fail_if( ( rsp.trsp.PBMT != PMA ) );
fail_if( ( rsp.trsp.is_msi != 0 ) );
if ( rsp.trsp.S == 1 ) {
Expand Down Expand Up @@ -1554,7 +1554,7 @@ main(void) {
fail_if( ( rsp.trsp.U != 0 ) );
fail_if( ( rsp.trsp.R != 1 ) );
fail_if( ( rsp.trsp.W != 1 ) );
fail_if( ( rsp.trsp.Exe != 1 ) );
fail_if( ( rsp.trsp.Exe != 0 ) );
fail_if( ( rsp.trsp.PBMT != PMA ) );
fail_if( ( rsp.trsp.is_msi != 0 ) );
fail_if( ( rsp.trsp.S != 1 ) );
Expand Down

0 comments on commit ebaa667

Please sign in to comment.