Skip to contentSkip to conversation

x86: Attempt to parse ACPI tables only when needed

PATCH New Sean Christopherson 1 participant 1 message Aug 22, 2019 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Attempt to parse ACPI tables only when needed

Parsing the ACPI tables to find the PM timer port hits a #PF on 32-bit unit tests. Regardless of what is causing the #PF, move the parsing to the pmtimer test to unblock the other VM-Exit tests.

---
 x86/vmexit.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
x86/vmexit.c +7 -5
index fa72be7..66d3458 100644
@@ -196,6 +196,13 @@ static void ipi_halt(void)
 int pm_tmr_blk;
 static void inl_pmtimer(void)
 {
+    if (!pm_tmr_blk) {
+	struct fadt_descriptor_rev1 *fadt;
+
+	fadt = find_acpi_table_addr(FACP_SIGNATURE);
+	pm_tmr_blk = fadt->pm_tmr_blk;
+	printf("PM timer port is %x\n", pm_tmr_blk);
+    }
     inl(pm_tmr_blk);
 }
 
@@ -541,7 +548,6 @@ static bool test_wanted(struct test *test, char *wanted[], int nwanted)
 
 int main(int ac, char **av)
 {
-	struct fadt_descriptor_rev1 *fadt;
 	int i;
 	unsigned long membar = 0;
 	struct pci_dev pcidev;
@@ -555,10 +561,6 @@ int main(int ac, char **av)
 	irq_enable();
 	on_cpus(enable_nx, NULL);
 
-	fadt = find_acpi_table_addr(FACP_SIGNATURE);
-	pm_tmr_blk = fadt->pm_tmr_blk;
-	printf("PM timer port is %x\n", pm_tmr_blk);
-
 	ret = pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TEST);
 	if (ret != PCIDEVADDR_INVALID) {
 		pci_dev_init(&pcidev, ret);
Signature · 1 line
2.22.0