From patchwork Thu Aug 22 23:48:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11110245 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72E5613A4 for ; Thu, 22 Aug 2019 23:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B0CB23401 for ; Thu, 22 Aug 2019 23:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727373AbfHVXsj (ORCPT ); Thu, 22 Aug 2019 19:48:39 -0400 Received: from mga14.intel.com ([192.55.52.115]:39466 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726970AbfHVXsj (ORCPT ); Thu, 22 Aug 2019 19:48:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Aug 2019 16:48:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,419,1559545200"; d="scan'208";a="179009470" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.41]) by fmsmga008.fm.intel.com with ESMTP; 22 Aug 2019 16:48:38 -0700 From: Sean Christopherson To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: kvm@vger.kernel.org Subject: [kvm-unit-tests PATCH] x86: Attempt to parse ACPI tables only when needed Date: Thu, 22 Aug 2019 16:48:37 -0700 Message-Id: <20190822234837.3500-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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. Signed-off-by: Sean Christopherson --- x86/vmexit.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/x86/vmexit.c b/x86/vmexit.c index fa72be7..66d3458 100644 --- a/x86/vmexit.c +++ b/x86/vmexit.c @@ -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);