From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79B49C3A5A1 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 522BB233A0 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?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= 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 Content-Transfer-Encoding: 8bit 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); -- 2.22.0