diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp')
-rw-r--r-- | src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp index 53dc1675..ba3a64cf 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -120,6 +120,18 @@ SYSFSCPUPATH g_aAcpiCpuPath[] = /** Level 4 */ {ACPI_CPU_PATH_NOT_PROBED, g_aAcpiCpuPathLvl4, RT_ELEMENTS(g_aAcpiCpuPathLvl4), NULL, NULL}, }; + +/** + * Possible directories to get to the topology directory for reading core and package id. + * + * @remark: This is not part of the path above because the eject file is not in one of the directories + * below and would make the hot unplug code fail. + */ +const char *g_apszTopologyPath[] = +{ + "sysdev", + "physical_node" +}; #endif #ifdef RT_OS_LINUX @@ -277,10 +289,25 @@ static int VBoxServiceCpuHotPlugGetACPIDevicePath(char **ppszPath, uint32_t idCp if (iLvlCurr == RT_ELEMENTS(g_aAcpiCpuPath) - 1) { /* Get the sysdev */ - uint32_t idCore = RTLinuxSysFsReadIntFile(10, "%s/sysdev/topology/core_id", - pszPathCurr); - uint32_t idPackage = RTLinuxSysFsReadIntFile(10, "%s/sysdev/topology/physical_package_id", - pszPathCurr); + uint32_t idCore = 0; + uint32_t idPackage = 0; + + for (unsigned i = 0; i < RT_ELEMENTS(g_apszTopologyPath); i++) + { + int64_t i64Core = RTLinuxSysFsReadIntFile(10, "%s/%s/topology/core_id", + pszPathCurr, g_apszTopologyPath[i]); + int64_t i64Package = RTLinuxSysFsReadIntFile(10, "%s/%s/topology/physical_package_id", + pszPathCurr, g_apszTopologyPath[i]); + + if ( i64Core != -1 + && i64Package != -1) + { + idCore = (uint32_t)i64Core; + idPackage = (uint32_t)i64Package; + break; + } + } + if ( idCore == idCpuCore && idPackage == idCpuPackage) { |