Changeset 108909 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Apr 9, 2025 9:03:34 AM (4 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168377
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/GITSAll.cpp
r108907 r108909 60 60 61 61 /** Release the device critical section. */ 62 #define GITS_CRIT_SECT_LEAVE(a_pDevIns) PDMDevHlpCritSectLeave((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo))62 #define GITS_CRIT_SECT_LEAVE(a_pDevIns) PDMDevHlpCritSectLeave((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo)) 63 63 64 64 /** Returns whether the critical section is held. */ 65 #define GITS_CRIT_SECT_IS_OWNER(a_pDevIns) PDMDevHlpCritSectIsOwner((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo))65 #define GITS_CRIT_SECT_IS_OWNER(a_pDevIns) PDMDevHlpCritSectIsOwner((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo)) 66 66 67 67 /** GITS diagnostic enum description expansion. 68 68 * The below construct ensures typos in the input to this macro are caught 69 69 * during compile time. */ 70 #define GITSDIAG_DESC(a_Name) RT_CONCAT(kGitsDiag_, a_Name) < kGitsDiag_End ? RT_STR(a_Name) : "Ignored" 71 72 73 /********************************************************************************************************************************* 74 * Structures and Typedefs * 75 *********************************************************************************************************************************/ 76 /** 77 * Interrupt Table Entry (ITE). 78 */ 79 typedef struct GITSITE 80 { 81 bool fValid; 82 uint8_t uType; 83 uint16_t uIntrCollectId; 84 VMCPUID idTargetCpu; 85 } GITSITE; 86 AssertCompileSize(GITSITE, 8); 70 #define GITSDIAG_DESC(a_Name) RT_CONCAT(kGitsDiag_, a_Name) < kGitsDiag_End ? RT_STR(a_Name) : "Ignored" 71 /** @} */ 87 72 88 73 … … 94 79 { 95 80 GITSDIAG_DESC(None), 96 GITSDIAG_DESC(CmdQueue_PhysAddr_Invalid), 81 GITSDIAG_DESC(CmdQueue_Unknown_Cmd), 82 GITSDIAG_DESC(CmdQueue_Invalid_PhysAddr), 97 83 /* kGitsDiag_End */ 98 84 }; … … 172 158 static void gitsCmdQueueSetError(PPDMDEVINS pDevIns, PGITSDEV pGitsDev, GITSDIAG enmError, bool fStallQueue) 173 159 { 174 Assert(GITS_CRIT_SECT_IS_OWNER(pDevIns)); 175 NOREF(pDevIns); 160 GITS_CRIT_SECT_ENTER(pDevIns); 176 161 177 162 /* Record the error and stall the queue. */ … … 182 167 /* Since we don't support SEIs, so there should be nothing more to do here. */ 183 168 Assert(!RT_BF_GET(pGitsDev->uTypeReg.u, GITS_BF_CTRL_REG_TYPER_SEIS)); 169 170 GITS_CRIT_SECT_LEAVE(pDevIns); 184 171 } 185 172 … … 402 389 /*| RT_BF_MAKE(GITS_BF_CTRL_REG_TYPER_VIRTUAL, 0) */ /* Virtual LPIs not supported. */ 403 390 | RT_BF_MAKE(GITS_BF_CTRL_REG_TYPER_CCT, 0) /* Collections in memory not supported. */ 404 | RT_BF_MAKE(GITS_BF_CTRL_REG_TYPER_ITT_ENTRY_SIZE, sizeof(GITSITE)) /* ITE size in bytes. */391 | RT_BF_MAKE(GITS_BF_CTRL_REG_TYPER_ITT_ENTRY_SIZE, GITS_ITE_SIZE) /* ITE size in bytes. */ 405 392 | RT_BF_MAKE(GITS_BF_CTRL_REG_TYPER_ID_BITS, 31) /* 32-bit event IDs. */ 406 393 | RT_BF_MAKE(GITS_BF_CTRL_REG_TYPER_DEV_BITS, 31) /* 32-bit device IDs. */ … … 421 408 GITS_CTLR.Enabled and GITS_BASER<n>.Valid. */ 422 409 RT_ZERO(pGitsDev->aItsTableRegs); 410 //pGitsDev->aItsTableRegs[0].u = RT_BF_MAKE(GITS_BF_CTRL_REG_BASER_ENTRY_SIZE, ) 411 423 412 pGitsDev->uCmdBaseReg.u = 0; 424 413 pGitsDev->uCmdReadReg = 0; 425 414 pGitsDev->uCmdWriteReg = 0; 426 RT_ZERO(pGitsDev->a Ctes);415 RT_ZERO(pGitsDev->auCtes); 427 416 } 428 417 … … 507 496 pHlp->pfnPrintf(pHlp, " Collection Table:\n"); 508 497 bool fHasValidCtes = false; 509 for (unsigned i = 0; i < RT_ELEMENTS(pGitsDev->a Ctes); i++)498 for (unsigned i = 0; i < RT_ELEMENTS(pGitsDev->auCtes); i++) 510 499 { 511 if (pGitsDev->aCtes[i].fValid) 500 bool const fValid = RT_BF_GET(pGitsDev->auCtes[i], GITS_BF_CTE_VALID); 501 if (fValid) 512 502 { 513 AssertCompile(sizeof(pGitsDev->aCtes[i].idTargetCpu) == sizeof(uint16_t));514 pHlp->pfnPrintf(pHlp, " aCtes[%u].idTargetCpu = %#RX16\n", i, pGitsDev->aCtes[i].idTargetCpu);515 503 fHasValidCtes = true; 504 pHlp->pfnPrintf(pHlp, " Target CPUID = %#RX16\n", i, RT_BF_GET(pGitsDev->auCtes[i], GITS_BF_CTE_RDBASE)); 516 505 } 517 506 } … … 575 564 /* Indicate to the guest we've fetched all commands. */ 576 565 GITS_CRIT_SECT_ENTER(pDevIns); 577 pGitsDev->uCmdReadReg = offWrite; 566 pGitsDev->uCmdReadReg = offWrite; 567 pGitsDev->uCmdWriteReg &= ~GITS_BF_CTRL_REG_CWRITER_RETRY_MASK; 578 568 579 569 /* Don't hold the critical section while processing commands. */ … … 591 581 uint64_t const uDw2 = pCmd->au64[2].u; 592 582 bool const fValid = RT_BF_GET(uDw2, GITS_BF_CMD_MAPC_DW2_VALID); 593 uint 32_t const uTargetCpuId = RT_BF_GET(uDw2, GITS_BF_CMD_MAPC_DW2_RDBASE);583 uint16_t const uTargetCpuId = RT_BF_GET(uDw2, GITS_BF_CMD_MAPC_DW2_RDBASE); 594 584 uint16_t const uIntrCollectionId = RT_BF_GET(uDw2, GITS_BF_CMD_MAPC_DW2_IC_ID); 595 AssertRelease(uIntrCollectionId < RT_ELEMENTS(pGitsDev->a Ctes)); /** @todo later figure ideal/correct CT size. */585 AssertRelease(uIntrCollectionId < RT_ELEMENTS(pGitsDev->auCtes)); /** @todo later figure ideal/correct CT size. */ 596 586 597 587 GITS_CRIT_SECT_ENTER(pDevIns); 598 588 Assert(!RT_BF_GET(pGitsDev->uTypeReg.u, GITS_BF_CTRL_REG_TYPER_PTA)); 599 pGitsDev->a Ctes[uIntrCollectionId].fValid = fValid;600 pGitsDev->aCtes[uIntrCollectionId].idTargetCpu = uTargetCpuId;589 pGitsDev->auCtes[uIntrCollectionId] = RT_BF_MAKE(GITS_BF_CTE_VALID, fValid) 590 | RT_BF_MAKE(GITS_BF_CTE_RDBASE, uTargetCpuId); 601 591 GITS_CRIT_SECT_LEAVE(pDevIns); 602 592 STAM_COUNTER_INC(&pGitsDev->StatCmdMapc); … … 619 609 620 610 default: 611 { 612 gitsCmdQueueSetError(pDevIns, pGitsDev, kGitsDiag_CmdQueue_Unknown_Cmd, true /* fStall */); 621 613 AssertReleaseMsgFailed(("Cmd=%#x (%s) idxCmd=%u cCmds=%u offRead=%#RX32 offWrite=%#RX32\n", 622 614 uCmdId, gitsGetCommandName(uCmdId), idxCmd, cCmds, offRead, offWrite)); 623 615 break; 616 } 624 617 } 625 618 } … … 628 621 629 622 /* Failed to read command queue from the physical address specified by the guest, stall queue and retry later. */ 630 gitsCmdQueueSetError(pDevIns, pGitsDev, kGitsDiag_CmdQueue_PhysAddr_Invalid, true /* fStall */); 631 GITS_CRIT_SECT_LEAVE(pDevIns); 623 gitsCmdQueueSetError(pDevIns, pGitsDev, kGitsDiag_CmdQueue_Invalid_PhysAddr, true /* fStall */); 632 624 return VINF_TRY_AGAIN; 633 625 }
Note:
See TracChangeset
for help on using the changeset viewer.