From patchwork Mon Nov 21 21:00:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 9440047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2751A606DB for ; Mon, 21 Nov 2016 21:03:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B31E28897 for ; Mon, 21 Nov 2016 21:03:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FC442889C; Mon, 21 Nov 2016 21:03:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6FE6288B5 for ; Mon, 21 Nov 2016 21:03:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8vi8-0003VI-IF; Mon, 21 Nov 2016 21:01:08 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8vi7-0003Ty-DN for xen-devel@lists.xen.org; Mon, 21 Nov 2016 21:01:07 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 43/D3-24885-29063385; Mon, 21 Nov 2016 21:01:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeJIrShJLcpLzFFi42KZM10+UHdSgnG EwclPfBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8b9/rlMBeukK/4uXsvSwNgt2sXIxSEkMJlJ onnWYiYI5xujxNU1bcxdjJxAzkZGiTPHYiASExgl7lyaDJZgEzCSOHt0OiOILSIgLXHt82Uwm 1ngCaPE//92ILawQJjEsUt/wOpZBFQldnTcYgKxeQW8JL42PGMDsSUE5CRunusEq+EU8JaYcv 4NO8RiL4kLz88zQdQYS7S/vcg2gZFvASPDKkaN4tSistQiXSNTvaSizPSMktzEzBxdQwNjvdz U4uLE9NScxKRiveT83E2MwFCpZ2Bg3MHYesLvEKMkB5OSKO/hpUYRQnxJ+SmVGYnFGfFFpTmp xYcYZTg4lCR4p8UbRwgJFqWmp1akZeYAgxYmLcHBoyTCexokzVtckJhbnJkOkTrFqMvxZtfLB 0xCLHn5ealS4rznQIoEQIoySvPgRsAi6BKjrJQwLyMDA4MQT0FqUW5mCar8K0ZxDkYlYd4ZIF N4MvNK4Da9AjqCCegIJVYDkCNKEhFSUg2M6Q8vNgVPeSY6yfLcRI3Hf7ck2t1+7l/wWG7HHGn BFqbS9VFTxRv6Qv933dEUYF1tf3H5VqYsoStRc+LvsBw4aPol692ZcL8fNd6CvCn7bgrtObvX Z3OG6mHVeKML18/8Fbspcrj4ReFC7am3pqUZOkwJFF3rLNGsxXbRddLOfVwV8onBm2YwK7EUZ yQaajEXFScCAAzmLn2bAgAA X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1479762064!41251596!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23540 invoked from network); 21 Nov 2016 21:01:05 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 21 Nov 2016 21:01:05 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uALL11ZF005769 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Nov 2016 21:01:02 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id uALL11T7029180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Nov 2016 21:01:01 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id uALL0xSA026667; Mon, 21 Nov 2016 21:01:00 GMT Received: from ostr-laptop.us.oracle.com (/10.152.23.90) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Nov 2016 13:00:59 -0800 From: Boris Ostrovsky To: xen-devel@lists.xen.org Date: Mon, 21 Nov 2016 16:00:43 -0500 Message-Id: <1479762047-29431-8-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479762047-29431-1-git-send-email-boris.ostrovsky@oracle.com> References: <1479762047-29431-1-git-send-email-boris.ostrovsky@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, Paul Durrant , jbeulich@suse.com, Boris Ostrovsky , roger.pau@citrix.com Subject: [Xen-devel] [PATCH v3 07/11] pvh/ioreq: Install handlers for ACPI-related PVH IO accesses X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP PVH guests will have ACPI accesses emulated by the hypervisor as opposed to QEMU (as is the case for HVM guests) Support for IOREQ server emulation of CPU hotplug is indicated by XEN_X86_EMU_IOREQ_CPUHP flag. Logic for the handler will be provided by a later patch. Signed-off-by: Boris Ostrovsky --- CC: Paul Durrant --- Changes in v3: * acpi_ioaccess() returns X86EMUL_UNHANDLEABLE * Renamed XEN_X86_EMU_IOREQ_CPUHP to XEN_X86_EMU_ACPI_FF (together with corresponding has_*()) xen/arch/x86/hvm/ioreq.c | 18 ++++++++++++++++++ xen/include/asm-x86/domain.h | 1 + xen/include/public/arch-x86/xen.h | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index d2245e2..51bb399 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -1380,6 +1380,12 @@ static int hvm_access_cf8( return X86EMUL_UNHANDLEABLE; } +static int acpi_ioaccess( + int dir, unsigned int port, unsigned int bytes, uint32_t *val) +{ + return X86EMUL_UNHANDLEABLE; +} + void hvm_ioreq_init(struct domain *d) { spin_lock_init(&d->arch.hvm_domain.ioreq_server.lock); @@ -1387,6 +1393,18 @@ void hvm_ioreq_init(struct domain *d) if ( !is_pvh_domain(d) ) register_portio_handler(d, 0xcf8, 4, hvm_access_cf8); + + if ( !has_acpi_ff(d) ) + { + /* Online CPU map, see DSDT's PRST region. */ + register_portio_handler(d, XEN_ACPI_CPU_MAP, + XEN_ACPI_CPU_MAP_LEN, acpi_ioaccess); + + register_portio_handler(d, ACPI_GPE0_BLK_ADDRESS_V1, + ACPI_GPE0_BLK_LEN_V1, acpi_ioaccess); + register_portio_handler(d, ACPI_PM1A_EVT_BLK_ADDRESS_V1, + ACPI_PM1A_EVT_BLK_LEN, acpi_ioaccess); + } } /* diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index f6a40eb..33f862f 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -425,6 +425,7 @@ struct arch_domain #define has_vvga(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_VGA)) #define has_viommu(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_IOMMU)) #define has_vpit(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_PIT)) +#define has_acpi_ff(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_ACPI_FF)) #define has_arch_pdevs(d) (!list_empty(&(d)->arch.pdev_list)) diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index cdd93c1..04c78ec 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -283,12 +283,14 @@ struct xen_arch_domainconfig { #define XEN_X86_EMU_IOMMU (1U<<_XEN_X86_EMU_IOMMU) #define _XEN_X86_EMU_PIT 8 #define XEN_X86_EMU_PIT (1U<<_XEN_X86_EMU_PIT) +#define _XEN_X86_EMU_ACPI_FF 9 +#define XEN_X86_EMU_ACPI_FF (1U<<_XEN_X86_EMU_ACPI_FF) #define XEN_X86_EMU_ALL (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET | \ XEN_X86_EMU_PM | XEN_X86_EMU_RTC | \ XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC | \ XEN_X86_EMU_VGA | XEN_X86_EMU_IOMMU | \ - XEN_X86_EMU_PIT) + XEN_X86_EMU_PIT | XEN_X86_EMU_ACPI_FF) uint32_t emulation_flags; }; #endif