VirtualBox

source: vbox/trunk/src/VBox/Main/include/ResourceAssignmentManager.h@ 107437

Last change on this file since 107437 was 107123, checked in by vboxsync, 2 months ago

Main: Fix running VMs with less than 2GiB of RAM (r165896 regression)

Having too little RAM caused the pci-mmio region to be created below 4GiB,
which made queryMmioRegion return 0 and the page table setup code in the UEFI
fail because it would get confused by the entry having a 0 address and size and
leaving the page tables in a broken state.
Fixing that however doesn't work as the PCI MMIO space needs to be above 4GiB, so
ensure that the region will always be above 4GiB.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: ResourceAssignmentManager.h 107123 2024-11-22 15:46:26Z vboxsync $ */
2/** @file
3 * VirtualBox resource assignment (Address ranges, interrupts) manager.
4 */
5
6/*
7 * Copyright (C) 2023-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_ResourceAssignmentManager_h
29#define MAIN_INCLUDED_ResourceAssignmentManager_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "VBox/types.h"
35#include "VirtualBoxBase.h"
36
37class ResourceAssignmentManager
38{
39private:
40 struct State;
41 State *m_pState;
42 RTGCPHYS m_GCPhysMmioHint;
43
44 ResourceAssignmentManager();
45
46public:
47 static ResourceAssignmentManager *createInstance(PCVMMR3VTABLE pVMM, ChipsetType_T chipsetType, IommuType_T iommuType,
48 uint32_t cInterrupts, RTGCPHYS GCPhysMmioHint);
49
50 ~ResourceAssignmentManager();
51
52 /*
53 * The allocation order for memory regions should be:
54 * 1. All regions which require a fixed address (including RAM regions).
55 * 2. The 32-bit MMIO regions.
56 * 3. All the other MMIO regions.
57 */
58 HRESULT assignFixedRomRegion(const char *pszName, RTGCPHYS GCPhysStart, RTGCPHYS cbRegion);
59 HRESULT assignFixedRamRegion(const char *pszName, RTGCPHYS GCPhysStart, RTGCPHYS cbRegion);
60 HRESULT assignFixedMmioRegion(const char *pszName, RTGCPHYS GCPhysStart, RTGCPHYS cbRegion);
61
62 HRESULT assignMmioRegionAligned(const char *pszName, RTGCPHYS cbRegion, RTGCPHYS cbAlignment, PRTGCPHYS pGCPhysStart, PRTGCPHYS pcbRegion,
63 bool fOnly32Bit);
64 HRESULT assignMmioRegion(const char *pszName, RTGCPHYS cbRegion, PRTGCPHYS pGCPhysStart, PRTGCPHYS pcbRegion);
65 HRESULT assignMmio32Region(const char *pszName, RTGCPHYS cbRegion, PRTGCPHYS pGCPhysStart, PRTGCPHYS pcbRegion);
66 HRESULT assignMmio64Region(const char *pszName, RTGCPHYS cbRegion, PRTGCPHYS pGCPhysStart, PRTGCPHYS pcbRegion);
67
68 HRESULT assignInterrupts(const char *pszName, uint32_t cInterrupts, uint32_t *piInterruptFirst);
69 HRESULT assignSingleInterrupt(const char *pszName, uint32_t *piInterrupt);
70
71 HRESULT queryMmioRegion(PRTGCPHYS pGCPhysMmioStart, PRTGCPHYS pcbMmio);
72 HRESULT queryMmio32Region(PRTGCPHYS pGCPhysMmioStart, PRTGCPHYS pcbMmio);
73
74 void dumpMemoryRegionsToReleaseLog(void);
75};
76
77#endif /* !MAIN_INCLUDED_ResourceAssignmentManager_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette