riscv-non-isa / riscv-iommu

RISC-V IOMMU Specification
https://jira.riscv.org/browse/RVG-55
Creative Commons Attribution 4.0 International
72 stars 14 forks source link

Why not add full condition such as DC.tc.PDTV check about handle_page_request ? #332

Closed baimengwei closed 1 month ago

baimengwei commented 1 month ago

EN_PRI is checked after get DC for page request message.

https://github.com/riscv-non-isa/riscv-iommu/blob/main/iommu_ref_model/libiommu/src/iommu_ats.c#L173

    if ( DC.tc.EN_PRI == 0 ) {
        // 7. if any of the following conditions hold then stop and report
        //    "Transaction type disallowed" (cause = 260).
        //   * Transaction type is a PCIe "Page Request" Message and `DC.tc.EN_PRI` is 0.
        report_fault(260, PAGE_REQ_MSG_CODE, 0, PCIE_MESSAGE_REQUEST, DC.tc.DTF,
                     device_id, pr->PV, pr->PID, pr->PRIV);
        response_code = INVALID_REQUEST;
        goto send_prgr;
    }

However, if a page request message is send with process_id, but the DC.tc.PDTV is 0, why not report fault to fault queue ? it seems that the cause 256-259 cause condition is covered, but cause 260 is not full covered.

ved-rivos commented 1 month ago

The IOMMU does not need any information from the process context to process the page request. The IOMMU verifies that the device is authorized by SW to generate page requests. The rest of the processing of the page request is in software.

baimengwei commented 1 month ago

thanks a lot.