Changeset 108716 in vbox
- Timestamp:
- Mar 24, 2025 12:43:36 PM (3 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168133
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmgic.h
r108695 r108716 127 127 * Cannot be NIL_PCIBDF. 128 128 * @param pMsi The MSI to send. 129 * @param uEventId T ODO129 * @param uEventId The event ID specified by the device. 130 130 * @param uTagSrc The IRQ tag and source (for tracing). 131 131 */ -
trunk/src/VBox/VMM/VMMAll/GICAll.cpp
r108694 r108716 2012 2012 Assert(pGicDev->fAffRoutingEnabled); 2013 2013 *puValue = GIC_DIST_REG_TYPER_NUM_ITLINES_SET(pGicDev->uMaxSpi) 2014 | GIC_DIST_REG_TYPER_NUM_PES_SET(0) /* Affinity routing is always enabled, hence this MBZ. */2015 /*| GIC_DIST_REG_TYPER_NMI*/ /** @todo Support non-maskable interrupts */2016 /*| GIC_DIST_REG_TYPER_SECURITY_EXTN*/ /** @todo Support dual security states. */2014 | GIC_DIST_REG_TYPER_NUM_PES_SET(0) /* Affinity routing is always enabled, hence this MBZ. */ 2015 /*| GIC_DIST_REG_TYPER_NMI*/ /** @todo Support non-maskable interrupts */ 2016 /*| GIC_DIST_REG_TYPER_SECURITY_EXTN*/ /** @todo Support dual security states. */ 2017 2017 | (pGicDev->fMbi ? GIC_DIST_REG_TYPER_MBIS : 0) 2018 /*| GIC_DIST_REG_TYPER_LPIS*/ /** @todo Support LPIs */2019 2018 | (pGicDev->fRangeSel ? GIC_DIST_REG_TYPER_RSS : 0) 2020 | GIC_DIST_REG_TYPER_IDBITS_SET(16) /* We only support 16-bit interrupt IDs. */2019 | GIC_DIST_REG_TYPER_IDBITS_SET(16) /* We only support 16-bit interrupt IDs. */ 2021 2020 | (pGicDev->fAff3Levels ? GIC_DIST_REG_TYPER_A3V : 0); 2022 2021 if (pGicDev->fExtSpi) 2023 2022 *puValue |= GIC_DIST_REG_TYPER_ESPI 2024 2023 | GIC_DIST_REG_TYPER_ESPI_RANGE_SET(pGicDev->uMaxExtSpi); 2024 if (pGicDev->fLpi) 2025 { 2026 Assert(pGicDev->uMaxLpi - 2 < 13); 2027 Assert(GIC_INTID_RANGE_LPI_START + (UINT32_C(2) << pGicDev->uMaxLpi) <= UINT16_MAX); 2028 *puValue |= GIC_DIST_REG_TYPER_LPIS 2029 | GIC_DIST_REG_TYPER_NUM_LPIS_SET(pGicDev->uMaxLpi); 2030 } 2025 2031 break; 2026 2032 } … … 2319 2325 | GIC_REDIST_REG_TYPER_CPU_NUMBER_SET(idRedist) 2320 2326 | GIC_REDIST_REG_TYPER_CMN_LPI_AFF_SET(GIC_REDIST_REG_TYPER_CMN_LPI_AFF_ALL) 2321 | (pGicDev->fExtPpi ? GIC_REDIST_REG_TYPER_PPI_NUM_SET(pGicDev->uMaxExtPpi) : 0); 2327 | (pGicDev->fExtPpi ? GIC_REDIST_REG_TYPER_PPI_NUM_SET(pGicDev->uMaxExtPpi) : 0) 2328 | (pGicDev->fLpi ? GIC_REDIST_REG_TYPER_PLPIS : 0); 2322 2329 Assert(!pGicDev->fExtPpi || pGicDev->uMaxExtPpi > 0); 2323 2330 break; … … 3071 3078 { 3072 3079 LogFlowFunc(("\n")); 3073 PGICDEV pGicDev = PDMDEVINS_2_DATA(pDevIns, PGICDEV); 3080 PGICDEV pGicDev = PDMDEVINS_2_DATA(pDevIns, PGICDEV); 3081 PGITSDEV pGitsDev = &pGicDev->Gits; 3082 3074 3083 RT_ZERO(pGicDev->bmIntrGroup); 3075 3084 RT_ZERO(pGicDev->bmIntrConfig); … … 3083 3092 pGicDev->fIntrGroup1Enabled = false; 3084 3093 pGicDev->fAffRoutingEnabled = true; /* GICv2 backwards compatibility is not implemented, so this is RA1/WI. */ 3094 RT_ZERO(pGicDev->bmLpiPending); 3095 RT_ZERO(pGicDev->abLpiConfig); 3096 gitsInit(pGitsDev); 3085 3097 } 3086 3098 … … 3135 3147 { 3136 3148 LogFlowFunc(("\n")); 3137 PGICDEV pGicDev = PDMDEVINS_2_DATA(pDevIns, PGICDEV);3138 PGITSDEV pGitsDev = &pGicDev->Gits;3139 3140 3149 gicInit(pDevIns); 3141 gitsInit(pGitsDev);3142 3150 } 3143 3151 -
trunk/src/VBox/VMM/VMMAll/GITSAll.cpp
r108694 r108716 135 135 { 136 136 Log4Func(("\n")); 137 138 137 pGitsDev->fEnabled = false; 139 138 pGitsDev->fUnmappedMsiReporting = false; … … 147 146 { 148 147 RT_NOREF(pGitsDev, pHlp, pszArgs); 148 /** @todo Debug info dump. */ 149 149 } 150 150 #endif /* IN_RING3 */ -
trunk/src/VBox/VMM/VMMR3/GICR3.cpp
r108682 r108716 51 51 *********************************************************************************************************************************/ 52 52 /** GIC saved state version. */ 53 #define GIC_SAVED_STATE_VERSION 653 #define GIC_SAVED_STATE_VERSION 7 54 54 55 55 # define GIC_SYSREGRANGE(a_uFirst, a_uLast, a_szName) \ … … 102 102 pHlp->pfnPrintf(pHlp, " fMbi = %RTbool\n", pGicDev->fMbi); 103 103 pHlp->pfnPrintf(pHlp, " fAff3Levels = %RTbool\n", pGicDev->fAff3Levels); 104 pHlp->pfnPrintf(pHlp, " fLpi = %RTbool\n", pGicDev->fLpi); 104 105 } 105 106 … … 319 320 pHlp->pfnSSMPutBool(pSSM, pGicDev->fMbi); 320 321 pHlp->pfnSSMPutBool(pSSM, pGicDev->fAff3Levels); 322 pHlp->pfnSSMPutBool(pSSM, pGicDev->fLpi); 321 323 322 324 /* Distributor state. */ … … 333 335 pHlp->pfnSSMPutMem(pSSM, &pGicDev->bmIntrRoutingMode[0], sizeof(pGicDev->bmIntrRoutingMode)); 334 336 337 /* We store the size followed by the data because we currently do not support the full LPI range. */ 338 pHlp->pfnSSMPutU32(pSSM, sizeof(pGicDev->abLpiConfig)); 339 pHlp->pfnSSMPutMem(pSSM, &pGicDev->abLpiConfig[0], sizeof(pGicDev->abLpiConfig)); 340 pHlp->pfnSSMPutU32(pSSM, sizeof(pGicDev->bmLpiPending)); 341 pHlp->pfnSSMPutMem(pSSM, &pGicDev->bmLpiPending[0], sizeof(pGicDev->bmLpiPending)); 342 343 /** @todo GITS data. */ 344 335 345 /* 336 346 * Save per-VCPU data. … … 403 413 pHlp->pfnSSMGetBool(pSSM, &pGicDev->fMbi); 404 414 pHlp->pfnSSMGetBool(pSSM, &pGicDev->fAff3Levels); 415 pHlp->pfnSSMGetBool(pSSM, &pGicDev->fLpi); 405 416 406 417 /* Distributor state. */ … … 417 428 pHlp->pfnSSMGetMem(pSSM, &pGicDev->bmIntrRoutingMode[0], sizeof(pGicDev->bmIntrRoutingMode)); 418 429 430 /* LPI config. */ 431 { 432 uint32_t cbData = 0; 433 int const rc = pHlp->pfnSSMGetU32(pSSM, &cbData); 434 AssertRCReturn(rc, rc); 435 if (cbData <= sizeof(pGicDev->abLpiConfig)) 436 pHlp->pfnSSMGetMem(pSSM, &pGicDev->abLpiConfig[0], cbData); 437 else 438 return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch: LPI config table size: got=%u expected=%u"), 439 cbData, sizeof(pGicDev->abLpiConfig)); 440 } 441 /* LPI pending. */ 442 { 443 uint32_t cbData = 0; 444 int const rc = pHlp->pfnSSMGetU32(pSSM, &cbData); 445 AssertRCReturn(rc, rc); 446 if (cbData <= sizeof(pGicDev->bmLpiPending)) 447 pHlp->pfnSSMGetMem(pSSM, &pGicDev->bmLpiPending[0], cbData); 448 else 449 return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch: LPI pending bitmap size: got=%u expected=%u"), 450 cbData, sizeof(pGicDev->bmLpiPending)); 451 } 452 453 /** @todo GITS data. */ 454 419 455 /* 420 456 * Load per-VCPU data. … … 481 517 else 482 518 return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("Invalid MaxExtPpi, got %u expected range [1,2]"), pGicDev->uMaxExtPpi); 519 bool const fIsGitsEnabled = RT_BOOL(pGicDev->hMmioGits != NIL_IOMMMIOHANDLE); 520 if (fIsGitsEnabled == pGicDev->fLpi) 521 { /* likely */ } 522 else 523 return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch: LPIs are %s when ITS is %s"), 524 fIsGitsEnabled ? "enabled" : "disabled", pGicDev->fLpi ? "enabled" : "disabled"); 483 525 return rc; 484 526 } … … 587 629 * most guests would assume support for SPIs. */ 588 630 AssertCompile(GIC_DIST_REG_TYPER_NUM_ITLINES == 31); 631 /** @todo This currently isn't implemented and the full range is always 632 * supported. */ 589 633 rc = pHlp->pfnCFGMQueryU8Def(pCfg, "MaxSpi", &pGicDev->uMaxSpi, 31 /* Upto and incl. IntId 1023 */); 590 634 AssertLogRelRCReturn(rc, rc); … … 609 653 * disabled. */ 610 654 AssertCompile(GIC_DIST_REG_TYPER_ESPI_RANGE >> GIC_DIST_REG_TYPER_ESPI_RANGE_BIT == 31); 655 /** @todo This currently isn't implemented and the full range is always 656 * supported. */ 611 657 rc = pHlp->pfnCFGMQueryU8Def(pCfg, "MaxExtSpi", &pGicDev->uMaxExtSpi, 31); 612 658 AssertLogRelRCReturn(rc, rc); … … 628 674 * supported. Valid values are [1,2] which equates to extended PPI IntIds 629 675 * [1087,1119]. This is unused when extended PPIs are disabled. */ 676 /** @todo This currently isn't implemented and the full range is always 677 * supported. */ 630 678 rc = pHlp->pfnCFGMQueryU8Def(pCfg, "MaxExtPpi", &pGicDev->uMaxExtPpi, 2); 631 679 AssertLogRelRCReturn(rc, rc); … … 657 705 /** @devcfgm{gic, Aff3Levels, bool, true} 658 706 * Configures whether non-zero affinity 3 levels (A3V) are supported 659 * (GICD_TYPER.A3V ) and (ICC_CTLR.A3V). */707 * (GICD_TYPER.A3V and ICC_CTLR.A3V). */ 660 708 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "Aff3Levels", &pGicDev->fAff3Levels, true); 661 709 AssertLogRelRCReturn(rc, rc); 710 711 /** @devcfgm{gic, Lpi, bool, true} 712 * Configures whether physical LPIs are supported (GICD_TYPER.LPIS and 713 * GICR_TYPER.PLPIS). */ 714 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "Lpi", &pGicDev->fLpi, true); 715 AssertLogRelRCReturn(rc, rc); 716 717 /** @devcfgm{gic, MaxLpi, uint8_t, 14} 718 * Configures GICD_TYPER.num_LPIs. 719 * 720 * For the physical LPI range [8192,65535], configures the number of physical LPI 721 * supported. Valid values are [3,14] which equates to LPI IntIds 8192 to 722 * [8207,40959]. A value of 15 or higher would exceed the maximum INTID size of 723 * 16-bits since 8192 + 2^(NumLpi+1) is >= 73727. A value of 2 or lower support 724 * fewer than 15 LPIs which seem pointless and is hence disallowed. This value is 725 * ignored (set to 0 in the register) when LPIs are disabled. */ 726 rc = pHlp->pfnCFGMQueryU8Def(pCfg, "MaxLpi", &pGicDev->uMaxLpi, 10); 727 AssertLogRelRCReturn(rc, rc); 728 729 /* We currently support 2048 LPIs until we need to support more. */ 730 if (pGicDev->uMaxLpi == 10) 731 { /* likely */ } 732 else 733 return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS, 734 N_("Configuration error: \"MaxLpi\" must be in the range [3,14]")); 735 AssertRelease(UINT32_C(2) << pGicDev->uMaxLpi <= RT_ELEMENTS(pGicDev->abLpiConfig)); 662 736 663 737 /* … … 723 797 &pGicDev->hMmioGits); 724 798 AssertRCReturn(rc, rc); 799 800 /* When the ITS is enabled we must support LPIs. */ 801 if (!pGicDev->fLpi) 802 return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS, 803 N_("Configuration error: \"Lpi\" must be enabled when ITS is enabled\n")); 725 804 } 726 805 else … … 794 873 bool const fMbi = pGicDev->fMbi; 795 874 bool const fAff3Levels = pGicDev->fAff3Levels; 875 bool const fLpi = pGicDev->fLpi; 796 876 uint16_t const uExtPpiLast = uMaxExtPpi == GIC_REDIST_REG_TYPER_PPI_NUM_MAX_1087 ? 1087 : GIC_INTID_RANGE_EXT_PPI_LAST; 797 LogRel(("GIC: ArchRev=%u RangeSel=%RTbool Nmi=%RTbool Mbi=%RTbool Aff3Levels=%RTbool \n",798 uArchRev, fRangeSel, fNmi, fMbi, fAff3Levels ));877 LogRel(("GIC: ArchRev=%u RangeSel=%RTbool Nmi=%RTbool Mbi=%RTbool Aff3Levels=%RTbool Lpi=%RTbool\n", 878 uArchRev, fRangeSel, fNmi, fMbi, fAff3Levels, fLpi)); 799 879 LogRel(("GIC: SPIs=true (%u:32..%u) ExtSPIs=%RTbool (%u:4095..%u) ExtPPIs=%RTbool (%u:1056..%u)\n", 800 880 uMaxSpi, 32 * (uMaxSpi + 1), -
trunk/src/VBox/VMM/include/GICInternal.h
r108682 r108716 127 127 * (ICC_CTLR.A3V). */ 128 128 bool fAff3Levels; 129 /** Alignment. */ 130 bool afPadding[2]; 129 /** Whether LPIs are supported (GICD_TYPER.PLPIS). */ 130 bool fLpi; 131 /** The maximum LPI supported (GICD_TYPER.num_LPI). */ 132 uint8_t uMaxLpi; 133 /** Padding. */ 134 bool afPadding[4]; 131 135 /** @} */ 132 136 133 137 /** @name GITS device data and LPIs. 134 138 * @{ */ 139 /** ITS device state. */ 135 140 GITSDEV Gits; 136 uint8_t abLpiPriority[8192]; 141 /** LPI configuration table (priority + enabled bit). */ 142 uint8_t abLpiConfig[2048]; 143 /** LPI pending bitmap. */ 144 uint32_t bmLpiPending[64]; 137 145 /** @} */ 138 146
Note:
See TracChangeset
for help on using the changeset viewer.