From b897a4a417aafea4d88a0e10cee323176eb48b73 Mon Sep 17 00:00:00 2001 From: Ved Shanbhogue Date: Fri, 7 Mar 2025 07:57:26 -0600 Subject: [PATCH 1/2] Use PASID valid for ATS trans. resp --- iommu_ref_model/libiommu/src/iommu_translate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/iommu_ref_model/libiommu/src/iommu_translate.c b/iommu_ref_model/libiommu/src/iommu_translate.c index 7d52c6e..c4b8148 100644 --- a/iommu_ref_model/libiommu/src/iommu_translate.c +++ b/iommu_ref_model/libiommu/src/iommu_translate.c @@ -25,7 +25,7 @@ iommu_translate_iova( uint32_t DID, PID, GSCID, PSCID; pte_t vs_pte; gpte_t g_pte; - uint8_t ioatc_status, gst_fault, is_implicit; + uint8_t ioatc_status, gst_fault, is_implicit, pasid_valid; uint64_t napot_ppn, napot_iova, napot_gpa; // Classify transaction type @@ -33,6 +33,7 @@ iommu_translate_iova( iotval = req->tr.iova; DTF = 0; PSCID = 0; + pasid_valid = req->pid_valid; // Count events if ( req->tr.at == ADDR_TYPE_UNTRANSLATED ) @@ -465,12 +466,12 @@ iommu_translate_iova( // in MRIF mode then a Success response is generated with R, W, and U bit set to // 1. The U bit being set to 1 in the response instructs the device that it must // only use Untranslated requests to access the implied 4 KiB memory range - rsp_msg->trsp.Priv = (req->pid_valid && req->priv_req) ? 1 : 0; + rsp_msg->trsp.Priv = (pasid_valid && req->priv_req) ? 1 : 0; rsp_msg->trsp.CXL_IO = (req->is_cxl_dev && ((vs_pte.PBMT != PMA) || (is_msi == 1) || (DC.tc.T2GPA == 1))) ? 1 : 0; rsp_msg->trsp.N = 0; rsp_msg->trsp.AMA = 0; - rsp_msg->trsp.Global = req->pid_valid && (is_msi == 0) ? vs_pte.G : 0; + rsp_msg->trsp.Global = pasid_valid && (is_msi == 0) ? vs_pte.G : 0; 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); From 27c494fee78336e08a718532f361b598ffcf8582 Mon Sep 17 00:00:00 2001 From: Ved Shanbhogue Date: Fri, 7 Mar 2025 07:59:46 -0600 Subject: [PATCH 2/2] Use PASID valid for ATS trans. resp --- iommu_ref_model/test/test_app.c | 1 - 1 file changed, 1 deletion(-) diff --git a/iommu_ref_model/test/test_app.c b/iommu_ref_model/test/test_app.c index 8600ebb..39028dc 100644 --- a/iommu_ref_model/test/test_app.c +++ b/iommu_ref_model/test/test_app.c @@ -4323,7 +4323,6 @@ main(void) { g_reg_file.capabilities.ats = 1; write_register(ICVEC_OFFSET, 8, 0x0000000000005555); fail_if( ( read_register(ICVEC_OFFSET, 8) != 0x0000000000005555) ); - // test iommu_qosid g_reg_file.capabilities.qosid = 1; g_iommu_qosid_mask = 0x00FF00FF;