Changeset 25825 in vbox
- Timestamp:
- Jan 14, 2010 10:39:12 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/hwaccm.h
r25816 r25825 129 129 VMMR3DECL(int) HWACCMR3TermCPU(PVM pVM); 130 130 VMMR3DECL(void) HWACCMR3Reset(PVM pVM); 131 VMMR3DECL(void) HWACCMR3ResetCpu(PVMCPU pVCpu); 131 132 VMMR3DECL(void) HWACCMR3CheckError(PVM pVM, int iStatusCode); 132 133 VMMR3DECL(bool) HWACCMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx); … … 144 145 VMMR3DECL(int) HWACMMR3DisablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem); 145 146 VMMR3DECL(int) HWACCMR3PatchTprInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx); 146 VMMR3DECL(void) HWACCMR3ResetCPU(PVMCPU pVCpu);147 147 148 148 /** @} */ -
trunk/include/VBox/pgm.h
r25816 r25825 444 444 VMMR3DECL(int) PGMR3InitFinalize(PVM pVM); 445 445 VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 446 VMMR3DECL(void) PGMR3Reset Cpu(PVM pVM, PVMCPU pVCpu);446 VMMR3DECL(void) PGMR3ResetUnpluggedCpu(PVM pVM, PVMCPU pVCpu); 447 447 VMMR3DECL(void) PGMR3Reset(PVM pVM); 448 448 VMMR3DECL(int) PGMR3Term(PVM pVM); -
trunk/include/VBox/vmapi.h
r25816 r25825 407 407 VMMR3DECL(RTNATIVETHREAD) VMR3GetVMCPUNativeThread(PVM pVM); 408 408 VMMR3DECL(RTNATIVETHREAD) VMR3GetVMCPUNativeThreadU(PUVM pUVM); 409 410 409 VMMR3DECL(int) VMR3GetCPUCoreAndPackageIdFromCPUId(PVM pVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage); 411 410 VMMR3DECL(int) VMR3HotunplugCPU(PVM pVM, VMCPUID idCpu); -
trunk/src/VBox/Devices/Makefile.kmk
r25819 r25825 471 471 vboxaml.hex:: $$(PATH_DevicesR3)/vboxaml.hex 472 472 473 # CPU hot plug version473 # CPU hot-plug version 474 474 DevicesR3_CLEAN += $(PATH_DevicesR3)/vboxaml-cpuhotplug.hex $(PATH_DevicesR3)/vboxaml-cpuhotplug.hex.tmp $(PATH_DevicesR3)/vboxaml-cpuhotplug.aml 475 475 PC/ACPI/VBoxAcpi.cpp_DEPS += $(PATH_DevicesR3)/vboxaml-cpuhotplug.hex … … 477 477 $$(PATH_DevicesR3)/vboxaml-cpuhotplug.hex: $(PATH_SUB_CURRENT)/PC/vbox-cpuhotplug.dsl | $$(dir $$@) 478 478 $(call MSG_TOOL,iasl,DevicesR3,$<,$@) 479 $(QUIET)$(RM) -f $@ [email protected] 479 480 $(QUIET)$(VBOX_IASLCMD) -tc -vs -p $@ $< 480 $(QUIET)$(MV) $@ [email protected]481 $(QUIET)$(MV) -f $@ [email protected] 481 482 $(QUIET)$(SED) -e 's/AmlCode/AmlCodeCpuHotplug/' \ 482 483 --output $@ [email protected] 484 $(QUIET)$(RM) -f [email protected] 485 483 486 484 487 vboxaml-cpuhotplug.hex:: $$(PATH_DevicesR3)/vboxaml-cpuhotplug.hex -
trunk/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp
r25817 r25825 144 144 unsigned char *pbAmlCode = NULL; 145 145 size_t cbAmlCode = 0; 146 bool fCpuHot plug = false;147 int rc = CFGMR3QueryBoolDef(pDevIns->pCfgHandle, "CpuHotplug", &fCpuHot plug, false);146 bool fCpuHotPlug = false; 147 int rc = CFGMR3QueryBoolDef(pDevIns->pCfgHandle, "CpuHotplug", &fCpuHotPlug, false); /** @todo r=bird: Rename to CpuHotPlug. */ 148 148 if (RT_FAILURE(rc)) 149 149 return PDMDEV_SET_ERROR(pDevIns, rc, 150 150 N_("Configuration error: Failed to read \"CpuHotplug\"")); 151 151 152 if (fCpuHot plug)152 if (fCpuHotPlug) 153 153 { 154 154 pbAmlCode = AmlCodeCpuHotplug; -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r25820 r25825 238 238 uint32_t cbMADT; 239 239 /** Array of flags of attached CPUs */ 240 bool afCpuAttached[ 32]; /* Maximum we support atm*/240 bool afCpuAttached[VMM_MAX_CPU_COUNT]; /**< @todo use VMCPUSET. */ 241 241 /** Mask of locked CPUs (used by the guest) */ 242 uint32_t uCpusLocked; 243 /** Flag whether CPU hot plugging is enabled */244 bool fCpuHot plug;242 uint32_t uCpusLocked; /**< @todo use VMCPUSET. */ 243 /** Flag whether CPU hot plugging is enabled */ 244 bool fCpuHotPlug; 245 245 /** Aligning IBase. */ 246 246 bool afAlignment[4]; … … 731 731 732 732 /* We have to force physical APIC mode or Linux can't use more than 8 CPUs */ 733 if (s->fCpuHot plug)733 if (s->fCpuHotPlug) 734 734 fadt.u32Flags |= RT_H2LE_U32(FADT_FL_FORCE_APIC_PHYS_DEST_MODE); 735 735 … … 2095 2095 /* 2096 2096 * Lock the CPU because we don't know if the guest will use it or not. 2097 * Prevents ejection while the CPU is still used 2097 * Prevents ejection while the CPU is still used 2098 2098 */ 2099 2099 s->uCpusLocked |= RT_BIT(iLUN); … … 2195 2195 "ShowRtc\0" 2196 2196 "ShowCpu\0" 2197 "CpuHotplug\0" 2197 "CpuHotplug\0" /** @todo r=bird: Rename to CpuHotPlug. */ 2198 2198 )) 2199 2199 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 2242 2242 N_("Configuration error: Failed to read \"ShowCpu\"")); 2243 2243 2244 /* query whether we are allow CPU hot plugging */2245 rc = CFGMR3QueryBoolDef(pCfgHandle, "CpuHotplug", &s->fCpuHot plug, false);2244 /* query whether we are allow CPU hot plugging */ 2245 rc = CFGMR3QueryBoolDef(pCfgHandle, "CpuHotplug", &s->fCpuHotPlug, false); /** @todo r=bird: Rename to CpuHotPlug. */ 2246 2246 if (RT_FAILURE(rc)) 2247 2247 return PDMDEV_SET_ERROR(pDevIns, rc, … … 2281 2281 for (unsigned i = 1; i < s->cCpus; i++) 2282 2282 { 2283 if (s->fCpuHot plug)2283 if (s->fCpuHotPlug) 2284 2284 { 2285 2285 PPDMIBASE IBaseTmp; … … 2302 2302 else 2303 2303 { 2304 /* CPU is always attached if hot plug is not enabled. */2304 /* CPU is always attached if hot-plug is not enabled. */ 2305 2305 s->afCpuAttached[i] = true; 2306 2306 s->uCpusLocked |= RT_BIT(i); -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp
r25817 r25825 468 468 GEN_CHECK_OFF(ACPIState, afCpuAttached); 469 469 GEN_CHECK_OFF(ACPIState, uCpusLocked); 470 GEN_CHECK_OFF(ACPIState, fCpuHot plug);470 GEN_CHECK_OFF(ACPIState, fCpuHotPlug); 471 471 GEN_CHECK_OFF(ACPIState, IBase); 472 472 GEN_CHECK_OFF(ACPIState, IACPIPort); -
trunk/src/VBox/VMM/CPUM.cpp
r25814 r25825 870 870 } 871 871 872 873 /** 874 * Resets a virtual CPU. 875 * 876 * Used by CPUMR3Reset and CPU hot plugging. 877 * 878 * @param pVCpu The virtual CPU handle. 879 */ 872 880 VMMR3DECL(void) CPUMR3ResetCpu(PVMCPU pVCpu) 873 881 { 874 /* @todo anything different for VCPU > 0? */882 /** @todo anything different for VCPU > 0? */ 875 883 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 876 884 … … 947 955 pCtx->msrEFER = 0; 948 956 } 957 949 958 950 959 /** -
trunk/src/VBox/VMM/EM.cpp
r25816 r25825 437 437 } 438 438 439 440 /** 441 * Reset the EM state for a CPU. 442 * 443 * Called by EMR3Reset and hot plugging. 444 * 445 * @param pVCpu The virtual CPU. 446 */ 439 447 VMMR3DECL(void) EMR3ResetCpu(PVMCPU pVCpu) 440 448 { … … 442 450 443 451 /* VMR3Reset may return VINF_EM_RESET or VINF_EM_SUSPEND, so transition 444 445 452 out of the HALTED state here so that enmPrevState doesn't end up as 453 HALTED when EMR3Execute returns. */ 446 454 if (pVCpu->em.s.enmState == EMSTATE_HALTED) 447 455 { … … 451 459 } 452 460 461 453 462 /** 454 463 * Reset notification. 455 464 * 456 * @param pVM 465 * @param pVM The VM handle. 457 466 */ 458 467 VMMR3DECL(void) EMR3Reset(PVM pVM) … … 460 469 Log(("EMR3Reset: \n")); 461 470 for (VMCPUID i = 0; i < pVM->cCpus; i++) 462 { 463 PVMCPU pVCpu = &pVM->aCpus[i]; 464 EMR3ResetCpu(pVCpu); 465 } 471 EMR3ResetCpu(&pVM->aCpus[i]); 466 472 } 467 473 -
trunk/src/VBox/VMM/HWACCM.cpp
r25816 r25825 1460 1460 * Resets a virtual CPU. 1461 1461 * 1462 * @param pVCpu The CPu to reset. 1463 */ 1464 VMMR3DECL(void) HWACCMR3ResetCPU(PVMCPU pVCpu) 1462 * Used by HWACCMR3Reset and CPU hot plugging. 1463 * 1464 * @param pVCpu The CPU to reset. 1465 */ 1466 VMMR3DECL(void) HWACCMR3ResetCpu(PVMCPU pVCpu) 1465 1467 { 1466 1468 /* On first entry we'll sync everything. */ … … 1509 1511 PVMCPU pVCpu = &pVM->aCpus[i]; 1510 1512 1511 HWACCMR3ResetC PU(pVCpu);1513 HWACCMR3ResetCpu(pVCpu); 1512 1514 } 1513 1515 -
trunk/src/VBox/VMM/PDM.cpp
r25816 r25825 155 155 * table) which is used to construct, destruct, attach, detach,( ++,) and query 156 156 * other interfaces. A device will query the interfaces required for it's 157 * operation during init and hot plug. PDM may query some interfaces during157 * operation during init and hot-plug. PDM may query some interfaces during 158 158 * runtime mounting too. 159 159 * … … 1153 1153 } 1154 1154 1155 1156 /** 1157 * Resets a virtual CPU. 1158 * 1159 * Used by PDMR3Reset and CPU hot plugging. 1160 * 1161 * @param pVCpu The virtual CPU handle. 1162 */ 1155 1163 VMMR3DECL(void) PDMR3ResetCpu(PVMCPU pVCpu) 1156 1164 { … … 1160 1168 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_SMI); 1161 1169 } 1170 1162 1171 1163 1172 /** … … 1250 1259 */ 1251 1260 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) 1252 { 1253 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 1254 PDMR3ResetCpu(pVCpu); 1255 } 1261 PDMR3ResetCpu(&pVM->aCpus[idCpu]); 1256 1262 VM_FF_CLEAR(pVM, VM_FF_PDM_DMA); 1257 1263 -
trunk/src/VBox/VMM/PGM.cpp
r25816 r25825 2172 2172 } 2173 2173 2174 VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu) 2174 2175 /** 2176 * Resets a virtual CPU when unplugged. 2177 * 2178 * @param pVM The VM handle. 2179 * @param pVCpu The virtual CPU handle. 2180 */ 2181 VMMR3DECL(void) PGMR3ResetUnpluggedCpu(PVM pVM, PVMCPU pVCpu) 2175 2182 { 2176 2183 int rc = PGM_GST_PFN(Exit, pVCpu)(pVCpu); … … 2182 2189 STAM_REL_COUNTER_RESET(&pVCpu->pgm.s.cGuestModeChanges); 2183 2190 2184 pgmR3PoolReset Cpu(pVM, pVCpu);2191 pgmR3PoolResetUnpluggedCpu(pVM, pVCpu); 2185 2192 2186 2193 /* … … 2195 2202 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 2196 2203 } 2204 2197 2205 2198 2206 /** -
trunk/src/VBox/VMM/PGMInternal.h
r25816 r25825 3284 3284 int pgmR3PoolInit(PVM pVM); 3285 3285 void pgmR3PoolRelocate(PVM pVM); 3286 void pgmR3PoolResetUnpluggedCpu(PVM pVM, PVMCPU pVCpu); 3286 3287 void pgmR3PoolReset(PVM pVM); 3287 void pgmR3PoolResetCpu(PVM pVM, PVMCPU pVCpu);3288 3288 void pgmR3PoolClearAll(PVM pVM); 3289 3289 -
trunk/src/VBox/VMM/TRPM.cpp
r25816 r25825 713 713 } 714 714 715 716 /** 717 * Resets a virtual CPU. 718 * 719 * Used by TRPMR3Reset and CPU hot plugging. 720 * 721 * @param pVCpu The virtual CPU handle. 722 */ 715 723 VMMR3DECL(void) TRPMR3ResetCpu(PVMCPU pVCpu) 716 724 { … … 718 726 } 719 727 728 720 729 /** 721 730 * The VM is being reset. … … 748 757 */ 749 758 for (VMCPUID i = 0; i < pVM->cCpus; i++) 750 { 751 PVMCPU pVCpu = &pVM->aCpus[i]; 752 TRPMR3ResetCpu(pVCpu); 753 } 759 TRPMR3ResetCpu(&pVM->aCpus[i]); 754 760 memcpy(&pVM->trpm.s.aIdt[0], &g_aIdt[0], sizeof(pVM->trpm.s.aIdt)); 755 761 memset(pVM->trpm.s.aGuestTrapHandler, 0, sizeof(pVM->trpm.s.aGuestTrapHandler)); -
trunk/src/VBox/VMM/VM.cpp
r25816 r25825 4042 4042 } 4043 4043 4044 DECLCALLBACK(int) vmR3HotunplugCPU(PVM pVM, VMCPUID idCpu)4045 {4046 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu);4047 VMCPU_ASSERT_EMT(pVCpu);4048 4049 /*4050 * Reset per CPU resources.4051 * Actually only needed for VT-x because the CPU4052 * seems to be still in some paged mode and startup4053 * fails after a new hotplug event.4054 * SVM works fine even without this.4055 */4056 Log(("vmR3HotunplugCPU for VCPU %d\n", idCpu));4057 PGMR3ResetCpu(pVM, pVCpu);4058 PDMR3ResetCpu(pVCpu);4059 TRPMR3ResetCpu(pVCpu);4060 CPUMR3ResetCpu(pVCpu);4061 EMR3ResetCpu(pVCpu);4062 HWACCMR3ResetCPU(pVCpu);4063 return VINF_EM_WAIT_SIPI;4064 }4065 4044 4066 4045 /** … … 4072 4051 * @param pidCpuCore Where to store the core ID of the virtual CPU. 4073 4052 * @param pidCpuPackage Where to store the package ID of the virtual CPU. 4053 * 4054 * @todo r=bird: Rename to VMR3GetCpuCoreAndPackageIdFromCpuId. We currently 4055 * try avoid holding down the shift key, so 'Cpu' is favored over 'CPU' 4056 * now. 4074 4057 */ 4075 4058 VMMR3DECL(int) VMR3GetCPUCoreAndPackageIdFromCPUId(PVM pVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage) … … 4089 4072 } 4090 4073 4091 /** 4092 * Unplugs a CPU from the guest. 4074 4075 /** 4076 * Worker for VMR3HotUnplugCpu. 4077 * 4078 * @returns VINF_EM_WAIT_SPIP (strict status code). 4079 * @param pVM The VM handle. 4080 * @param idCpu The current CPU. 4081 */ 4082 static DECLCALLBACK(int) vmR3HotUnplugCpu(PVM pVM, VMCPUID idCpu) 4083 { 4084 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu); 4085 VMCPU_ASSERT_EMT(pVCpu); 4086 4087 /* 4088 * Reset per CPU resources. 4089 * 4090 * Actually only needed for VT-x because the CPU seems to be still in some 4091 * paged mode and startup fails after a new hot plug event. SVM works fine 4092 * even without this. 4093 */ 4094 Log(("vmR3HotUnplugCpu for VCPU %u\n", idCpu)); 4095 PGMR3ResetUnpluggedCpu(pVM, pVCpu); 4096 PDMR3ResetCpu(pVCpu); 4097 TRPMR3ResetCpu(pVCpu); 4098 CPUMR3ResetCpu(pVCpu); 4099 EMR3ResetCpu(pVCpu); 4100 HWACCMR3ResetCpu(pVCpu); 4101 return VINF_EM_WAIT_SIPI; 4102 } 4103 4104 4105 /** 4106 * Hot-unplugs a CPU from the guest. 4093 4107 * 4094 4108 * @returns VBox status code. 4095 4109 * @param pVM The VM to operate on. 4096 * @param idCpu Virtual CPU to perform the unplug operation on. 4110 * @param idCpu Virtual CPU to perform the hot unplugging operation on. 4111 * @todo r=bird: Rename to VMR3HotUnplugCpu. 4097 4112 */ 4098 4113 VMMR3DECL(int) VMR3HotunplugCPU(PVM pVM, VMCPUID idCpu) … … 4101 4116 4102 4117 /** @todo Destroy EMT and not needed resources. */ 4103 return VMR3ReqCallNoWaitU(pVM->pUVM, idCpu, (PFNRT)vmR3HotunplugCPU, 2, pVM, idCpu); 4104 } 4105 4106 /** 4107 * Hotplugs a CPU on the guest. 4118 /** @todo r=bird: Don't destroy the EMT, it'll break VMMR3EmtRendezvous and 4119 * broadcast requests. Just note down somewhere that the CPU is 4120 * offline and send it to SPIP wait. Maybe modify VMCPUSTATE and push 4121 * it out of the EM loops when offline. */ 4122 return VMR3ReqCallNoWaitU(pVM->pUVM, idCpu, (PFNRT)vmR3HotUnplugCpu, 2, pVM, idCpu); 4123 } 4124 4125 4126 /** 4127 * Hot-plugs a CPU on the guest. 4108 4128 * 4109 4129 * @returns VBox status code. 4110 4130 * @param pVM The VM to operate on. 4111 * @param idCpu Virtual CPU to perform the hotplug operation on. 4131 * @param idCpu Virtual CPU to perform the hot plugging operation on. 4132 * @todo r=bird: Rename to VMR3HotPlugCpu. 4112 4133 */ 4113 4134 VMMR3DECL(int) VMR3HotplugCPU(PVM pVM, VMCPUID idCpu) … … 4116 4137 4117 4138 /** @todo start EMT and allocate needed resources. */ 4139 /** @todo r-bird: Just mark it online and make sure it waits on SPIP. */ 4118 4140 return VINF_SUCCESS; 4119 4141 } -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r25816 r25825 1881 1881 /* 1882 1882 * Found a usable page, flush it and return. 1883 */ 1884 int rc = pgmPoolFlushPage(pPool, pPage); 1885 /* This flush was initiated by us and not the guest, so explicitly flush the TLB. */ 1883 */ 1884 int rc = pgmPoolFlushPage(pPool, pPage); 1885 /* This flush was initiated by us and not the guest, so explicitly flush the TLB. */ 1886 1886 /* todo: find out why this is necessary; pgmPoolFlushPage should trigger a flush if one is really needed. */ 1887 1887 if (rc == VINF_SUCCESS) 1888 PGM_INVL_ALL_VCPU_TLBS(pVM); 1888 PGM_INVL_ALL_VCPU_TLBS(pVM); 1889 1889 return rc; 1890 1890 } … … 4768 4768 #ifdef IN_RING3 4769 4769 4770 void pgmR3PoolResetCpu(PVM pVM, PVMCPU pVCpu) 4770 4771 /** 4772 * Reset CPU on hot plugging. 4773 * 4774 * @param pVM The VM handle. 4775 * @param pVCpu The virtual CPU. 4776 */ 4777 void pgmR3PoolResetUnpluggedCpu(PVM pVM, PVMCPU pVCpu) 4771 4778 { 4772 4779 pgmR3ExitShadowModeBeforePoolFlush(pVM, pVCpu); … … 4776 4783 VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH); 4777 4784 } 4785 4778 4786 4779 4787 /**
Note:
See TracChangeset
for help on using the changeset viewer.