Skip to content

Commit

Permalink
Merge pull request #521 from ved-rivos/0307
Browse files Browse the repository at this point in the history
Use PASID valid for ATS trans. resp
  • Loading branch information
ved-rivos authored Mar 7, 2025
2 parents 23337e5 + 27c494f commit 0c8b3ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 4 additions & 3 deletions iommu_ref_model/libiommu/src/iommu_translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ 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
iotval2 = 0;
iotval = req->tr.iova;
DTF = 0;
PSCID = 0;
pasid_valid = req->pid_valid;

// Count events
if ( req->tr.at == ADDR_TYPE_UNTRANSLATED )
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion iommu_ref_model/test/test_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0c8b3ce

Please sign in to comment.