diff --git a/iommu_ref_model/test/test_app.c b/iommu_ref_model/test/test_app.c index c7c547d0..3666ef13 100644 --- a/iommu_ref_model/test/test_app.c +++ b/iommu_ref_model/test/test_app.c @@ -125,8 +125,8 @@ main(void) { exp_msg.MSGCODE = PRGR_MSG_CODE; exp_msg.TAG = 0; exp_msg.RID = 0x1234; - exp_msg.PV = 0; - exp_msg.PID = 0; + exp_msg.PV = 1; + exp_msg.PID = 0xbabec; exp_msg.PRIV = 0; exp_msg.EXEC_REQ = 0; exp_msg.DSV = 1; @@ -185,11 +185,86 @@ main(void) { send_translation_request(0x000145, 0, 0x99, 0, 0, 0, 0, UNTRANSLATED_REQUEST, 0, 1, READ, &req, &rsp); fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 260, 0) < 0 ) ); + pr.MSGCODE = PAGE_REQ_MSG_CODE; + pr.TAG = 0; + pr.RID = 0x1234; + pr.PV = 0; + pr.PID = 0; + pr.PRIV = 0; + pr.EXEC_REQ = 0; + pr.DSV = 1; + pr.DSEG = 0x43; + pr.PAYLOAD = 0xdeadbeef00000007; // Set last, PRG index = 0 + exp_msg.MSGCODE = PRGR_MSG_CODE; + exp_msg.TAG = 0; + exp_msg.RID = 0x1234; + exp_msg.PV = 0; + exp_msg.PID = 0; + exp_msg.PRIV = 0; + exp_msg.EXEC_REQ = 0; + exp_msg.DSV = 1; + exp_msg.DSEG = 0x43; + exp_msg.PAYLOAD = (0x1234UL << 48UL) | (RESPONSE_FAILURE << 44UL); + handle_page_request(&pr); + fail_if( ( exp_msg_received == 0 ) ); + fail_if( ( check_msg_faults(260, pr.PV, pr.PID, pr.PRIV, 0x431234, PAGE_REQ_MSG_CODE) < 0 ) ); + fail_if( ( enable_iommu(DDT_2LVL) < 0 ) ); send_translation_request(0x012345, 0, 0x99, 0, 0, 0, 0, UNTRANSLATED_REQUEST, 0, 1, READ, &req, &rsp); fail_if( ( check_rsp_and_faults(&req, &rsp, UNSUPPORTED_REQUEST, 260, 0) < 0 ) ); + pr.MSGCODE = PAGE_REQ_MSG_CODE; + pr.TAG = 0; + pr.RID = 0x1234; + pr.PV = 0; + pr.PID = 0; + pr.PRIV = 0; + pr.EXEC_REQ = 0; + pr.DSV = 1; + pr.DSEG = 0x43; + pr.PAYLOAD = 0xdeadbeef00000007; // Set last, PRG index = 0 + exp_msg.MSGCODE = PRGR_MSG_CODE; + exp_msg.TAG = 0; + exp_msg.RID = 0x1234; + exp_msg.PV = 0; + exp_msg.PID = 0; + exp_msg.PRIV = 0; + exp_msg.EXEC_REQ = 0; + exp_msg.DSV = 1; + exp_msg.DSEG = 0x43; + exp_msg.PAYLOAD = (0x1234UL << 48UL) | (RESPONSE_FAILURE << 44UL); + handle_page_request(&pr); + fail_if( ( exp_msg_received == 0 ) ); + fail_if( ( check_msg_faults(260, pr.PV, pr.PID, pr.PRIV, 0x431234, PAGE_REQ_MSG_CODE) < 0 ) ); + + // Change to MSI flat mode + g_reg_file.capabilities.msi_flat = 0; + pr.MSGCODE = PAGE_REQ_MSG_CODE; + pr.TAG = 0; + pr.RID = 0x1234; + pr.PV = 0; + pr.PID = 0; + pr.PRIV = 0; + pr.EXEC_REQ = 0; + pr.DSV = 1; + pr.DSEG = 0x43; + pr.PAYLOAD = 0xdeadbeef00000007; // Set last, PRG index = 0 + exp_msg.MSGCODE = PRGR_MSG_CODE; + exp_msg.TAG = 0; + exp_msg.RID = 0x1234; + exp_msg.PV = 0; + exp_msg.PID = 0; + exp_msg.PRIV = 0; + exp_msg.EXEC_REQ = 0; + exp_msg.DSV = 1; + exp_msg.DSEG = 0x43; + exp_msg.PAYLOAD = (0x1234UL << 48UL) | (RESPONSE_FAILURE << 44UL); + handle_page_request(&pr); + fail_if( ( exp_msg_received == 0 ) ); + fail_if( ( check_msg_faults(260, pr.PV, pr.PID, pr.PRIV, 0x431234, PAGE_REQ_MSG_CODE) < 0 ) ); + g_reg_file.capabilities.msi_flat = 1; + END_TEST(); // Enable IOMMU @@ -2893,8 +2968,8 @@ main(void) { exp_msg.MSGCODE = PRGR_MSG_CODE; exp_msg.TAG = 0; exp_msg.RID = 0x1234; - exp_msg.PV = 0; - exp_msg.PID = 0; + exp_msg.PV = 1; + exp_msg.PID = 0xbabec; exp_msg.PRIV = 0; exp_msg.EXEC_REQ = 0; exp_msg.DSV = 1;