diff --git a/iommu_ref_model/libiommu/src/iommu_msi_trans.c b/iommu_ref_model/libiommu/src/iommu_msi_trans.c index 85e4e3a7..ec930fb9 100644 --- a/iommu_ref_model/libiommu/src/iommu_msi_trans.c +++ b/iommu_ref_model/libiommu/src/iommu_msi_trans.c @@ -109,7 +109,7 @@ msi_address_translation( // set within msipte, stop and report "MSI PTE misconfigured" (cause = 263). // b. Compute the translated address as `msipte.PPN << 12 | A[11:0]`. if ( msipte.M == 3 ) { - if ( msipte.translate_rw.reserved != 0 ) { + if ( msipte.translate_rw.reserved != 0 || msipte.translate_rw.reserved0 != 0 ) { *cause = 263; return 1; } @@ -136,7 +136,7 @@ msi_address_translation( } // b. If any bits or encoding that are reserved for future standard use are - // set within `msipte`, stop and report "MSI PTE misconfigured" (cause = 262). + // set within `msipte`, stop and report "MSI PTE misconfigured" (cause = 263). if ( msipte.mrif.reserved1 != 0 || msipte.mrif.reserved2 != 0 || msipte.mrif.reserved3 != 0 || msipte.mrif.reserved4 != 0 ) { *cause = 263; diff --git a/iommu_ref_model/test/test_app.c b/iommu_ref_model/test/test_app.c index 9a3b6170..ffd706d6 100644 --- a/iommu_ref_model/test/test_app.c +++ b/iommu_ref_model/test/test_app.c @@ -3244,8 +3244,54 @@ main(void) { 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0 ) ); + msipte.C = 0; + msipte.M = 0x3; + msipte.translate_rw.reserved = 0x1; + msipte.translate_rw.reserved0 = 0x0; + write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16); + send_translation_request(0x042874, 0, 0x0000, 0, + 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); + fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0) ); + msipte.translate_rw.reserved = 0x0; + msipte.translate_rw.reserved = 0x4; + write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16); + send_translation_request(0x042874, 0, 0x0000, 0, + 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); + fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0) ); + + msipte.C = 0; + msipte.M = 0x3; + msipte.translate_rw.reserved = 0x0; + msipte.translate_rw.reserved0 = 0x1; + write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16); + send_translation_request(0x042874, 0, 0x0000, 0, + 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); + fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0) ); + msipte.translate_rw.reserved = 0x0; + msipte.translate_rw.reserved = 0x4; + write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16); + send_translation_request(0x042874, 0, 0x0000, 0, + 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); + fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0) ); + + msipte.C = 0; + msipte.M = 0x3; + msipte.translate_rw.reserved = 0x1; + msipte.translate_rw.reserved0 = 0x1; + write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16); + send_translation_request(0x042874, 0, 0x0000, 0, + 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); + fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0) ); + msipte.translate_rw.reserved = 0x0; + msipte.translate_rw.reserved = 0x4; + write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16); + send_translation_request(0x042874, 0, 0x0000, 0, + 0, 0, 0, ADDR_TYPE_UNTRANSLATED, gpa, 4, WRITE, &req, &rsp); + fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 263, 0) < 0) ); + // Write through PTE msipte.translate_rw.reserved = 0x0; + msipte.translate_rw.reserved0 = 0x0; msipte.translate_rw.M = 0x3; msipte.translate_rw.PPN = 0xdeadbeef; write_memory((char *)&msipte, ((DC.msiptp.PPN * PAGESIZE) + 3 * 16), 16);