diff --git a/iommu_ref_model/libiommu/src/iommu_translate.c b/iommu_ref_model/libiommu/src/iommu_translate.c index 869047f5..00163f44 100644 --- a/iommu_ref_model/libiommu/src/iommu_translate.c +++ b/iommu_ref_model/libiommu/src/iommu_translate.c @@ -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 @@ -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; diff --git a/iommu_ref_model/test/test_app.c b/iommu_ref_model/test/test_app.c index ffd706d6..b3fa0cdc 100644 --- a/iommu_ref_model/test/test_app.c +++ b/iommu_ref_model/test/test_app.c @@ -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 ) { @@ -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 ) ); @@ -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 ) { @@ -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 ) );