From patchwork Sat Jan 23 09:20:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8096341 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 61628BEEE5 for ; Sat, 23 Jan 2016 09:28:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8595E205B5 for ; Sat, 23 Jan 2016 09:28:49 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A931F205B1 for ; Sat, 23 Jan 2016 09:28:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMuTD-0000l5-Fh; Sat, 23 Jan 2016 09:26:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMuTC-0000kU-0L for xen-devel@lists.xen.org; Sat, 23 Jan 2016 09:26:58 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 18/F5-13828-16743A65; Sat, 23 Jan 2016 09:26:57 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1453541202!17649769!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29797 invoked from network); 23 Jan 2016 09:26:54 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-10.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jan 2016 09:26:54 -0000 Received: from 172.24.1.49 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.49]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BVC82181; Sat, 23 Jan 2016 17:22:31 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Sat, 23 Jan 2016 17:22:22 +0800 From: Shannon Zhao To: Date: Sat, 23 Jan 2016 17:20:07 +0800 Message-ID: <1453540813-15764-16-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1453540813-15764-1-git-send-email-zhaoshenglong@huawei.com> References: <1453540813-15764-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.56A34657.009A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 36caa1236a291b9f027c7fe3828bf995 Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, peter.huangpeng@huawei.com, julien.grall@citrix.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v4 15/21] arm/gic: Add ACPI support for GIC preinit X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shannon Zhao Since ACPI 6.0 defines that GIC Distributor Structure contains the GIC version filed, it could get GIC version from that. Then call acpi device initializing function to preinit GIC device. Signed-off-by: Shannon Zhao --- V4: use ACPI_MADT_GIC_VERSION_V* instead of GICv* --- xen/arch/arm/gic.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 43e6fa2..840075f 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include #include #include +#include static void gic_restore_pending_irqs(struct vcpu *v); @@ -228,10 +230,7 @@ int gic_irq_xlate(const u32 *intspec, unsigned int intsize, return 0; } -/* Find the interrupt controller and set up the callback to translate - * device tree IRQ. - */ -void __init gic_preinit(void) +static void __init gic_dt_preinit(void) { int rc; struct dt_device_node *node; @@ -261,6 +260,36 @@ void __init gic_preinit(void) dt_device_set_used_by(node, DOMID_XEN); } +#ifdef CONFIG_ACPI +static void __init gic_acpi_preinit(void) +{ + struct acpi_subtable_header *header; + struct acpi_madt_generic_distributor *dist; + + header = acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, 0); + if ( !header ) + panic("No valid GICD entries exists"); + + dist = container_of(header, struct acpi_madt_generic_distributor, header); + + if ( acpi_device_init(DEVICE_GIC, NULL, dist->version) ) + panic("Unable to find compatible GIC in the ACPI table"); +} +#else +static void __init gic_acpi_preinit(void) {} +#endif + +/* Find the interrupt controller and set up the callback to translate + * device tree or ACPI IRQ. + */ +void __init gic_preinit(void) +{ + if ( acpi_disabled ) + gic_dt_preinit(); + else + gic_acpi_preinit(); +} + /* Set up the GIC */ void __init gic_init(void) {