VirtualBox

Changeset 107113 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Nov 22, 2024 10:48:00 AM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166080
Message:

VMM: bugref:10759 Restructure the APIC to allow different backends to be used.

Location:
trunk/src/VBox/VMM/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/APICInternal.h

    r106061 r107113  
    3434#include <VBox/apic.h>
    3535#include <VBox/sup.h>
    36 #include <VBox/vmm/pdmdev.h>
     36#include <VBox/vmm/pdmapic.h>
     37#include <VBox/vmm/stam.h>
    3738
    3839/** @defgroup grp_apic_int       Internal
     
    4142 * @{
    4243 */
     44
     45#ifdef VBOX_INCLUDED_vmm_pdmapic_h
     46/** The VirtualBox APIC backend table. */
     47extern const PDMAPICBACKEND g_ApicBackend;
     48#endif
    4349
    4450/** The APIC hardware version we are emulating. */
     
    11561162DECLCALLBACK(VBOXSTRICTRC)    apicReadMmio(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb);
    11571163DECLCALLBACK(VBOXSTRICTRC)    apicWriteMmio(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb);
    1158 
    1159 bool                          apicPostInterrupt(PVMCPUCC pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode, uint32_t uSrcTag);
     1164DECLCALLBACK(bool)            apicPostInterrupt(PVMCPUCC pVCpu, uint8_t uVector, XAPICTRIGGERMODE enmTriggerMode, bool fAutoEoi,
     1165                                                uint32_t uSrcTag);
     1166#ifdef IN_RING3
     1167DECLCALLBACK(int)             apicR3HvSetCompatMode(PVM pVM, bool fHyperVCompatMode);
     1168#endif
    11601169void                          apicStartTimer(PVMCPUCC pVCpu, uint32_t uInitialCount);
    11611170void                          apicClearInterruptFF(PVMCPUCC pVCpu, PDMAPICIRQ enmType);
    1162 void                          apicInitIpi(PVMCPUCC pVCpu);
    11631171void                          apicResetCpu(PVMCPUCC pVCpu, bool fResetApicBaseMsr);
    11641172
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r106061 r107113  
    4848#include <VBox/vmm/pdmcommon.h>
    4949#include <VBox/vmm/pdmtask.h>
     50#include <VBox/vmm/pdmapic.h>
    5051#include <VBox/sup.h>
    5152#include <VBox/msi.h>
     
    795796
    796797/**
    797  * PDM registered APIC device.
    798  */
    799 typedef struct PDMAPIC
    800 {
    801     /** Pointer to the APIC device instance - R3 Ptr. */
     798 * PDM IC (Interrupt Controller), shared ring-3.
     799 */
     800typedef struct PDMICR3
     801{
     802    /** Pointer to the interrupt controller instance - R3 Ptr. */
    802803    PPDMDEVINSR3                       pDevInsR3;
    803     /** Pointer to the APIC device instance - R0 Ptr. */
     804#ifndef VBOX_VMM_TARGET_ARMV8
     805    /** The type of APIC backend. */
     806    PDMAPICBACKENDTYPE                 enmKind;
     807    uint32_t                           uPadding;
     808    /** The APIC backend. */
     809    PDMAPICBACKENDR3                   ApicBackend;
     810#else
     811    /** @todo The GIC backend. Currently the padding helps keep alignment common
     812     *        between x86 and arm. */
     813    uint8_t                            auPadding[4+4+232];
     814#endif
     815} PDMICR3;
     816AssertCompileSizeAlignment(PDMICR3, 8);
     817
     818/**
     819 * PDM IC (Interrupt Controller), ring-0.
     820 */
     821typedef struct PDMICR0
     822{
     823    /** Pointer to the interrupt controller instance - R0 Ptr. */
    804824    PPDMDEVINSR0                       pDevInsR0;
    805     /** Pointer to the APIC device instance - RC Ptr. */
    806     PPDMDEVINSRC                       pDevInsRC;
    807     uint8_t                            Alignment[4];
    808 } PDMAPIC;
    809 
     825#ifndef VBOX_VMM_TARGET_ARMV8
     826    /** The APIC backend. */
     827    PDMAPICBACKENDR0                   ApicBackend;
     828#else
     829    /** @todo The GIC backend. Currently the padding helps keep alignment common
     830     *        between x86 and arm. */
     831    uint8_t                            auPadding[232];
     832#endif
     833} PDMICR0;
     834AssertCompileSizeAlignment(PDMICR0, 8);
     835
     836/**
     837 * PDM IC (Interrupt Controller), raw-mode context.
     838 */
     839typedef struct PDMICRC
     840{
     841    /** Pointer to the interrupt controller instance - R0 Ptr. */
     842    PPDMDEVINSRC                       pDevInsR0;
     843    RTRCPTR                            avPadding;
     844#ifndef VBOX_VMM_TARGET_ARMV8
     845    /** The APIC backend. */
     846    PDMAPICBACKENDRC                   ApicBackend;
     847#else
     848    /** @todo The GIC backend. Currently the padding helps keep alignment common
     849     *        between x86 and arm. */
     850    uint8_t                            auPadding[232];
     851#endif
     852} PDMICRC;
     853AssertCompileSizeAlignment(PDMICRC, 8);
    810854
    811855/**
     
    14851529    /** The register PIC device. */
    14861530    PDMPIC                          Pic;
    1487     /** The registered APIC device. */
    1488     PDMAPIC                         Apic;
     1531    /** The registered IC device. */
     1532    PDMICR3                         Ic;
    14891533    /** The registered I/O APIC device. */
    14901534    PDMIOAPIC                       IoApic;
     
    15901634    bool volatile                   fNsUnchokeTimerArmed;
    15911635    /** Align aNsGroups on a cacheline.   */
    1592     bool                            afPadding2[19+16];
     1636    bool                            afPadding2[19+16+25];
    15931637    /** Number of network shaper groups.
    15941638     * @note Marked volatile to prevent re-reading after validation. */
     
    16531697    /** Array of ring-0 queues. */
    16541698    PDMQUEUER0                      aQueues[16];
     1699    /** The interrupt-controller, ring-0 data. */
     1700    PDMICR0                         Ic;
    16551701} PDMR0PERVM;
    16561702
     
    17451791#endif
    17461792
     1793#ifndef VBOX_VMM_TARGET_ARMV8
     1794/** @def PDM_TO_APICBACKEND
     1795 * Gets the APIC backend given the VM cross-context structure.
     1796 */
     1797/** @def PDMCPU_TO_APICBACKEND
     1798 * Gets the APIC backend given VMCPU cross-context structure.
     1799 */
     1800# ifdef IN_RING3
     1801#  define PDM_TO_APICBACKEND(a_pVM)          (&((a_pVM)->pdm.s.Ic.ApicBackend))
     1802#  define PDMCPU_TO_APICBACKEND(a_pVCpu)     (&((a_pVCpu)->CTX_SUFF(pVM)->pdm.s.Ic.ApicBackend))
     1803#else
     1804#  define PDM_TO_APICBACKEND(a_pVM)          (&((a_pVM)->pdmr0.s.Ic.ApicBackend))
     1805#  define PDMCPU_TO_APICBACKEND(a_pVCpu)     (&((a_pVCpu)->CTX_SUFF(pVM)->pdmr0.s.Ic.ApicBackend))
     1806#endif
     1807#else
     1808/** @todo GIC backend. */
     1809#endif
    17471810
    17481811/*******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.

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