Skip to contentSkip to conversation

whpx: i386: small random fixes

PATCH Superseded Mohamed Mediouni 1 participant 4 messages Mar 2

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover whpx: i386: small random fixes

And this continues...

From doing testing on a Sapphire Rapids box, saw that there was a stack overflow in the page table walker code when the guest is using 57-bit VAs.

And saw that nested virt is incompatible with kernel-irqchip=off so made them exclusive to each other.

Also enabled some more enlightenments because why not...

Mohamed Mediouni (3):
whpx: i386: do not enable nested virt when kernel-irqchip=off target/i386: emulate: LA57 fix
whpx: i386: enable some more enlightenments

 target/i386/emulate/x86_mmu.c | 2 +-
 target/i386/whpx/whpx-all.c   | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw

PATCH 1/3 whpx: i386: do not enable nested virt when kernel-irqchip=off

This combination is not allowed as of build 26300.7939 and results in:

qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005 qemu-system-x86_64.exe: failed to initialize whpx: Invalid argument

---
 target/i386/whpx/whpx-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/whpx/whpx-all.c +1 -1
index bb1afb9cd1..99c4d03f42 100644
@@ -2145,7 +2145,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
         goto error;
     }
 
-    if (processor_features.Bank1.NestedVirtSupport) {
+    if (whpx_irqchip_in_kernel() && processor_features.Bank1.NestedVirtSupport) {
         memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY));
         prop.NestedVirtualization = 1;
         hr = whp_dispatch.WHvSetPartitionProperty(
Signature · 1 line
2.50.1 (Apple Git-155)
#2 lore raw

PATCH 2/3 target/i386: emulate: LA57 fix

In reply to Mohamed Mediouni

Seen on a Sapphire Rapids box with LA57.

---
 target/i386/emulate/x86_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/emulate/x86_mmu.c +1 -1
index d30f6c4a3e..3546609a90 100644
@@ -56,7 +56,7 @@ static bool is_user(CPUState *cpu)
 struct gpt_translation {
     target_ulong  gva;
     uint64_t gpa;
-    uint64_t pte[5];
+    uint64_t pte[6];
 };
 
 static int gpt_top_level(CPUState *cpu, bool pae)
Signature · 1 line
2.50.1 (Apple Git-155)
#3 lore raw

PATCH 3/3 whpx: i386: enable some more enlightenments

In reply to Mohamed Mediouni
---
 target/i386/whpx/whpx-all.c | 3 +++
 1 file changed, 3 insertions(+)
target/i386/whpx/whpx-all.c +3 -0
index 99c4d03f42..84fa980d35 100644
@@ -2199,9 +2199,12 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
 
     synthetic_features.Bank0.HypervisorPresent = 1;
     synthetic_features.Bank0.Hv1 = 1;
+    synthetic_features.Bank0.AccessVpRunTimeReg = 1;
     synthetic_features.Bank0.AccessPartitionReferenceCounter = 1;
     synthetic_features.Bank0.AccessPartitionReferenceTsc = 1;
+    synthetic_features.Bank0.AccessHypercallRegs = 1;
     synthetic_features.Bank0.AccessFrequencyRegs = 1;
+    synthetic_features.Bank0.EnableExtendedGvaRangesForFlushVirtualAddressList = 1;
     synthetic_features.Bank0.AccessVpIndex = 1;
     synthetic_features.Bank0.AccessHypercallRegs = 1;
     synthetic_features.Bank0.TbFlushHypercalls = 1;
Signature · 1 line
2.50.1 (Apple Git-155)