Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MsvmPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
gMsvmPkgTokenSpaceGuid.PcdHmatSize ## CONSUMES
gMsvmPkgTokenSpaceGuid.PcdTpmEnabled ## CONSUMES
gMsvmPkgTokenSpaceGuid.PcdVirtualBatteryEnabled ## CONSUMES
gMsvmPkgTokenSpaceGuid.PcdVmbusEnabled ## CONSUMES
gMsvmPkgTokenSpaceGuid.PcdWatchdogEnabled ## CONSUMES

[Pcd.X64]
Expand Down
2 changes: 2 additions & 0 deletions MsvmPkg/AcpiPlatformDxe/Dsdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ typedef struct _DSDT_AML_DATA
UINT8 ProcIdleEnabled;
UINT8 CxlMemoryEnabled;
UINT16 NvdimmCount;
UINT8 VmbusEnabled;
} DSDT_AML_DATA;

typedef struct _DSDT_AML_DESCRIPTOR
Expand Down Expand Up @@ -138,6 +139,7 @@ Return Value:
data->ProcIdleEnabled = PcdGetBool(PcdProcIdleEnabled);
data->CxlMemoryEnabled = PcdGetBool(PcdCxlMemoryEnabled);
data->NvdimmCount = PcdGet16(PcdNvdimmCount);
data->VmbusEnabled = PcdGetBool(PcdVmbusEnabled);

DEBUG((DEBUG_VERBOSE, "--- %a: Mmio1Start 0x%lx\n", __func__, data->Mmio1Start));
DEBUG((DEBUG_VERBOSE, "--- %a: Mmio1Length 0x%lx\n", __func__, data->Mmio1Length));
Expand Down
149 changes: 81 additions & 68 deletions MsvmPkg/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ DefinitionBlock (
PADE,8, // Processor Aggregator Device enabled/disabled
CCFG,8, // CXL memory support enabled/disabled
NCNT,16, // NVDIMM count
VCFG,8, // VMBus enabled/disabled
Comment thread
jstarks marked this conversation as resolved.
}

// Supported machine sleep states =========================================
Expand Down Expand Up @@ -140,6 +141,7 @@ DefinitionBlock (
{
Name(_HID, "ACPI0004")
Name(_UID, 0)

Name(_CRS,
ResourceTemplate()
{
Expand All @@ -166,19 +168,27 @@ DefinitionBlock (

Method(_INI, 0)
{
// Update the DWORDMemory resource descriptor with the low MMIO region.
Store(MG2B, MIN6)
Store(MG2L, LEN6)
Store(MG2L, Local0)
Add(MIN6, Decrement(Local0), MAX6)
// Update the DWORDMemory descriptor with the low MMIO region
// only if the region has nonzero size.
If(LGreater(MG2L, 0))
{
Store(MG2B, MIN6)
Store(MG2L, LEN6)
Store(MG2L, Local0)
Add(MIN6, Decrement(Local0), MAX6)
}

// Update the QWORDMemory resource descriptor with the high MMIO region.
ShiftLeft (HMIB, 20, Local1)
ShiftLeft (HMIL, 20, Local2)
Store(Local1, MIN7)
Store(Local2, LEN7)
Store(Local2, Local0)
Add(MIN7, Decrement(Local0), MAX7)
// Update the QWORDMemory descriptor with the high MMIO region
// only if the region has nonzero size.
If(LGreater(HMIL, 0))
{
ShiftLeft (HMIB, 20, Local1)
ShiftLeft (HMIL, 20, Local2)
Store(Local1, MIN7)
Store(Local2, LEN7)
Store(Local2, Local0)
Add(MIN7, Decrement(Local0), MAX7)
}
}
}

Expand Down Expand Up @@ -306,74 +316,77 @@ DefinitionBlock (

// VMBus ==================================================================

Device(\_SB.VMOD.VMBS)
If(LGreater(VCFG, 0))
{
Name(STA, 0xF)
Name(_ADR, 0x00)
Device(\_SB.VMOD.VMBS)
{
Name(STA, 0xF)
Name(_ADR, 0x00)
#if defined(_DSDT_ARM_)
Name(_CCA, One)
Name(_CCA, One)
#endif
Name(_DDN, "VMBUS")
Name(_HID, "MSFT1000")
Name(_CID, "VMBus")
Name(_UID, 0)
Method(_DIS, 0) { And(STA, 0xD, STA) }
Method(_PS0, 0) { Or(STA, 0xF, STA) }
Method(_STA, 0)
{
return(STA)
}

// Older versions of this DSDT implemented _PS3 improperly, as:
// Name(_PS3, 0)
// This is intentionally a do-nothing method in case any version of Windows requires _PS3 to be implemented

Method(_PS3, 0) { return(STA) }

// TODO: SPIs are not available to the guest on AARCH64, which is what
// PcdVmbusVector is currently defined as. Supposedly it should use a PPI,
// but those are strange because they're reserved for hypervisor devices.
//
// Windows doesn't boot when VmBus is given an SPI, since it's unable to
// allocate any since none exist in guests. Thus, leave it out on AARCH64
// for now.
//
// Linux may need this field if it's not hardcoded, unsure.
//
// Additionally, no Interrupt-Signaled event devices currently work either,
// due to SPIs not being available to guests.
Name(_CRS,
Name(_DDN, "VMBUS")
Name(_HID, "MSFT1000")
Name(_CID, "VMBus")
Name(_UID, 0)
Method(_DIS, 0) { And(STA, 0xD, STA) }
Method(_PS0, 0) { Or(STA, 0xF, STA) }
Method(_STA, 0)
{
return(STA)
}

// Include an interrupt resource so that Linux VMs can get IDT
// entries.
//
// N.B. All Windows VMs that support UEFI also support
// getting IDT entries via other mechanisms, so this is not
// necessary for Windows.
// Older versions of this DSDT implemented _PS3 improperly, as:
// Name(_PS3, 0)
// This is intentionally a do-nothing method in case any version of Windows requires _PS3 to be implemented

ResourceTemplate()
{
Method(_PS3, 0) { return(STA) }

// TODO: SPIs are not available to the guest on AARCH64, which is what
// PcdVmbusVector is currently defined as. Supposedly it should use a PPI,
// but those are strange because they're reserved for hypervisor devices.
//
// Windows doesn't boot when VmBus is given an SPI, since it's unable to
// allocate any since none exist in guests. Thus, leave it out on AARCH64
// for now.
//
// Linux may need this field if it's not hardcoded, unsure.
//
// Additionally, no Interrupt-Signaled event devices currently work either,
// due to SPIs not being available to guests.
Name(_CRS,

// Include an interrupt resource so that Linux VMs can get IDT
// entries.
//
// N.B. All Windows VMs that support UEFI also support
// getting IDT entries via other mechanisms, so this is not
// necessary for Windows.

ResourceTemplate()
{

#if defined(_DSDT_INTEL_)

// Older Linux kernels like RHEL/CentOS don't seem to be able to
// parse the new Extended Interrupt Descriptor resource type (see ACPI Section 6.4.3.6),
// so we instead use the old legacy IRQ description which
// becomes the short form of Interrupt Descriptor (ACPI Section 5.4.2.1)
// which only supports legacy PIC devices to describe up to 15
// interrupts. VMBUS is interrupt 5 on X64, so this is okay.
IRQ(Edge,ActiveHigh,Exclusive)
{FixedPcdGet8(PcdVmbusVector)}
// Older Linux kernels like RHEL/CentOS don't seem to be able to
// parse the new Extended Interrupt Descriptor resource type (see ACPI Section 6.4.3.6),
// so we instead use the old legacy IRQ description which
// becomes the short form of Interrupt Descriptor (ACPI Section 5.4.2.1)
// which only supports legacy PIC devices to describe up to 15
// interrupts. VMBUS is interrupt 5 on X64, so this is okay.
IRQ(Edge,ActiveHigh,Exclusive)
{FixedPcdGet8(PcdVmbusVector)}

#else
// On AArch64, we select a PPI (16) because Linux expects it to
// be available to all CPUs.
Interrupt(ResourceConsumer, Edge, ActiveHigh, Exclusive)
{FixedPcdGet8(PcdVmbusVector)}
// On AArch64, we select a PPI (16) because Linux expects it to
// be available to all CPUs.
Interrupt(ResourceConsumer, Edge, ActiveHigh, Exclusive)
{FixedPcdGet8(PcdVmbusVector)}

#endif
}
)
}
)
}
}

// TPM ====================================================================
Expand Down
4 changes: 3 additions & 1 deletion MsvmPkg/Include/BiosInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,9 @@ typedef struct _UEFI_CONFIG_FLAGS
UINT64 Dhcp6DuidTypeLlt : 1;
UINT64 CxlMemoryEnabled : 1;
UINT64 MtrrsInitializedAtLoad : 1;
UINT64 Reserved:35;
UINT64 HvSintEnabled : 1; // Reserved; used by other codebase.
UINT64 VmbusDisabled : 1;
UINT64 Reserved:33;
} Flags;
} UEFI_CONFIG_FLAGS;

Expand Down
4 changes: 4 additions & 0 deletions MsvmPkg/Library/DeviceBootManagerLib/DeviceBootManagerLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ DeviceBootManagerBeforeConsole (
*DevicePath = NULL;
*PlatformConsoles = NULL;

if (!PcdGetBool(PcdVmbusEnabled)) {
goto Exit;
}

Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiVmbusProtocolGuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ CONSTRUCTOR = DeviceBootManagerConstructor
gMsvmPkgTokenSpaceGuid.PcdIsVmbfsBoot
gMsvmPkgTokenSpaceGuid.PcdLogoFile
gMsvmPkgTokenSpaceGuid.PcdPxeIpV6
gMsvmPkgTokenSpaceGuid.PcdVmbusEnabled
gMsvmPkgTokenSpaceGuid.PcdVpciBootEnabled

[Depex]
Expand Down
1 change: 1 addition & 0 deletions MsvmPkg/MsvmPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
gMsvmPkgTokenSpaceGuid.PcdHostEmulatorsWhenHardwareIsolated|FALSE|BOOLEAN|0x6064
gMsvmPkgTokenSpaceGuid.PcdTpmLocalityRegsEnabled|FALSE|BOOLEAN|0x6065
gMsvmPkgTokenSpaceGuid.PcdMtrrsInitializedAtLoad|FALSE|BOOLEAN|0x6067
gMsvmPkgTokenSpaceGuid.PcdVmbusEnabled|TRUE|BOOLEAN|0x6068

# UEFI_CONFIG_PROCESSOR_INFORMATION
gMsvmPkgTokenSpaceGuid.PcdProcessorCount|0x0|UINT32|0x6032
Expand Down
1 change: 1 addition & 0 deletions MsvmPkg/MsvmPkgAARCH64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@
gMsvmPkgTokenSpaceGuid.PcdWatchdogEnabled|FALSE
gMsvmPkgTokenSpaceGuid.PcdHostEmulatorsWhenHardwareIsolated|FALSE
gMsvmPkgTokenSpaceGuid.PcdTpmLocalityRegsEnabled|FALSE
gMsvmPkgTokenSpaceGuid.PcdVmbusEnabled|TRUE

# UEFI_CONFIG_PROCESSOR_INFORMATION
gMsvmPkgTokenSpaceGuid.PcdProcessorCount|0x0
Expand Down
1 change: 1 addition & 0 deletions MsvmPkg/MsvmPkgX64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@
gMsvmPkgTokenSpaceGuid.PcdWatchdogEnabled|FALSE
gMsvmPkgTokenSpaceGuid.PcdHostEmulatorsWhenHardwareIsolated|FALSE
gMsvmPkgTokenSpaceGuid.PcdTpmLocalityRegsEnabled|FALSE
gMsvmPkgTokenSpaceGuid.PcdVmbusEnabled|TRUE

# UEFI_CONFIG_PROCESSOR_INFORMATION
gMsvmPkgTokenSpaceGuid.PcdProcessorCount|0x0
Expand Down
Loading
Loading