From patchwork Tue Sep 20 00:19:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 9340817 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 0B58F607D0 for ; Tue, 20 Sep 2016 00:28:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F38AF2844B for ; Tue, 20 Sep 2016 00:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8006285B6; Tue, 20 Sep 2016 00:28:24 +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 B1F1E28BBB for ; Tue, 20 Sep 2016 00:28:23 +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 1bm8sA-0007dZ-Vu; Tue, 20 Sep 2016 00:25:18 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bm8s9-0007cG-Qn for xen-devel@lists.xen.org; Tue, 20 Sep 2016 00:25:17 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 9F/0A-16745-DE180E75; Tue, 20 Sep 2016 00:25:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRWlGSWpSXmKPExsUyZ7p8oO6bxgf hBltviFss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkze9exFxxSqvhw+Tl7A2OjZBcjF4eQwEQm iZPPjzBDOL8ZJSZd288G4WxklPh2vZUdwulhlFhx4DRQhpODTcBI4uzR6YwgtoiAtMS1z5fBb GaBJ4wSO2+kg9jCAgESZ+5sAYuzCKhK7LnRCNbLK+AlMW/jErC4hICCxJSH75lBbE4Bb4mJV5 +wdjFyAC3zktjf7A1RYijxeeNS5gmMfAsYGVYxahSnFpWlFukameolFWWmZ5TkJmbm6BoamOr lphYXJ6an5iQmFesl5+duYgSGSj0DA+MOxl3tfocYJTmYlER55fgehAvxJeWnVGYkFmfEF5Xm pBYfYpTh4FCS4N3WAJQTLEpNT61Iy8wBBi1MWoKDR0mEdzVImre4IDG3ODMdInWKUVFKnPcdS EIAJJFRmgfXBouUS4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeQ+ATOHJzCuBm/4KaDET0G LGnvsgi0sSEVJSDYyTeczD+GafiH+7VeHBqwfLeqJVEyaEPuKdLr9mWeOSKQ6q2St1+2bKb/h 8oLbjwXEzgdfX5JzcZr5NFhP84KC1vsjLWqbEzTsrZV/J/B8XDUPlgs2Lp+glywX8uMBiEG7i U3p+l+hpaXHhCPG939+IP1f/Xjvb7cy7nT8n9pg0uPv27+k5/E6JpTgj0VCLuag4EQAc8oIPj wIAAA== X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1474331114!24004633!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: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7955 invoked from network); 20 Sep 2016 00:25:16 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-14.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Sep 2016 00:25:16 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8K0P69D020293 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Sep 2016 00:25:07 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u8K0P6YG007934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Sep 2016 00:25:06 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8K0P6AF023324; Tue, 20 Sep 2016 00:25:06 GMT Received: from ovs104.us.oracle.com (/10.149.76.204) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 19 Sep 2016 17:25:05 -0700 From: Boris Ostrovsky To: xen-devel@lists.xen.org Date: Mon, 19 Sep 2016 20:19:24 -0400 Message-Id: <1474330779-10645-7-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1474330779-10645-1-git-send-email-boris.ostrovsky@oracle.com> References: <1474330779-10645-1-git-send-email-boris.ostrovsky@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, julien.grall@arm.com, jbeulich@suse.com, zhaoshenglong@huawei.com, Boris Ostrovsky , roger.pau@citrix.com Subject: [Xen-devel] [PATCH v4 06/21] acpi/hvmloader: Make providing IOAPIC in MADT optional 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 Signed-off-by: Boris Ostrovsky Reviewed-by: Jan Beulich --- tools/firmware/hvmloader/acpi/build.c | 70 ++++++++++++++++++--------------- tools/firmware/hvmloader/acpi/libacpi.h | 1 + tools/firmware/hvmloader/util.c | 2 +- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/tools/firmware/hvmloader/acpi/build.c b/tools/firmware/hvmloader/acpi/build.c index c984e5a..dc489bb 100644 --- a/tools/firmware/hvmloader/acpi/build.c +++ b/tools/firmware/hvmloader/acpi/build.c @@ -100,43 +100,49 @@ static struct acpi_20_madt *construct_madt(const struct acpi_config *config, madt->lapic_addr = LAPIC_BASE_ADDRESS; madt->flags = ACPI_PCAT_COMPAT; - intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt + 1); - for ( i = 0; i < 16; i++ ) - { - memset(intsrcovr, 0, sizeof(*intsrcovr)); - intsrcovr->type = ACPI_INTERRUPT_SOURCE_OVERRIDE; - intsrcovr->length = sizeof(*intsrcovr); - intsrcovr->source = i; - - if ( i == 0 ) - { - /* ISA IRQ0 routed to IOAPIC GSI 2. */ - intsrcovr->gsi = 2; - intsrcovr->flags = 0x0; - } - else if ( PCI_ISA_IRQ_MASK & (1U << i) ) - { - /* PCI: active-low level-triggered. */ - intsrcovr->gsi = i; - intsrcovr->flags = 0xf; - } - else + if ( config->table_flags & ACPI_HAS_IOAPIC ) + { + intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt + 1); + for ( i = 0; i < 16; i++ ) { - /* No need for a INT source override structure. */ - continue; + memset(intsrcovr, 0, sizeof(*intsrcovr)); + intsrcovr->type = ACPI_INTERRUPT_SOURCE_OVERRIDE; + intsrcovr->length = sizeof(*intsrcovr); + intsrcovr->source = i; + + if ( i == 0 ) + { + /* ISA IRQ0 routed to IOAPIC GSI 2. */ + intsrcovr->gsi = 2; + intsrcovr->flags = 0x0; + } + else if ( PCI_ISA_IRQ_MASK & (1U << i) ) + { + /* PCI: active-low level-triggered. */ + intsrcovr->gsi = i; + intsrcovr->flags = 0xf; + } + else + { + /* No need for a INT source override structure. */ + continue; + } + + intsrcovr++; } - intsrcovr++; - } + io_apic = (struct acpi_20_madt_ioapic *)intsrcovr; + memset(io_apic, 0, sizeof(*io_apic)); + io_apic->type = ACPI_IO_APIC; + io_apic->length = sizeof(*io_apic); + io_apic->ioapic_id = IOAPIC_ID; + io_apic->ioapic_addr = ioapic_base_address; - io_apic = (struct acpi_20_madt_ioapic *)intsrcovr; - memset(io_apic, 0, sizeof(*io_apic)); - io_apic->type = ACPI_IO_APIC; - io_apic->length = sizeof(*io_apic); - io_apic->ioapic_id = IOAPIC_ID; - io_apic->ioapic_addr = ioapic_base_address; + lapic = (struct acpi_20_madt_lapic *)(io_apic + 1); + } + else + lapic = (struct acpi_20_madt_lapic *)(madt + 1); - lapic = (struct acpi_20_madt_lapic *)(io_apic + 1); info->nr_cpus = hvminfo->nr_vcpus; info->madt_lapic0_addr = (uint32_t)lapic; for ( i = 0; i < hvminfo->nr_vcpus; i++ ) diff --git a/tools/firmware/hvmloader/acpi/libacpi.h b/tools/firmware/hvmloader/acpi/libacpi.h index 70cf26b..b8f28a3 100644 --- a/tools/firmware/hvmloader/acpi/libacpi.h +++ b/tools/firmware/hvmloader/acpi/libacpi.h @@ -28,6 +28,7 @@ #define ACPI_HAS_SSDT_S3 (1<<5) #define ACPI_HAS_SSDT_S4 (1<<6) #define ACPI_HAS_TCPA (1<<7) +#define ACPI_HAS_IOAPIC (1<<8) struct xen_vmemrange; struct acpi_numa { diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index 8875675..aa5fc20 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -919,7 +919,7 @@ void hvmloader_acpi_build_tables(struct acpi_config *config, if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1) ) config->table_flags |= ACPI_HAS_SSDT_S4; - config->table_flags |= ACPI_HAS_TCPA; + config->table_flags |= (ACPI_HAS_TCPA | ACPI_HAS_IOAPIC); config->tis_hdr = (uint16_t *)ACPI_TIS_HDR_ADDRESS;