From patchwork Thu Mar 24 14:44:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64381 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp698139lbc; Thu, 24 Mar 2016 07:49:36 -0700 (PDT) X-Received: by 10.140.175.136 with SMTP id v130mr11691773qhv.74.1458830924419; Thu, 24 Mar 2016 07:48:44 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f68si6782934qge.89.2016.03.24.07.48.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Mar 2016 07:48:44 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj6Y3-0003J0-7y; Thu, 24 Mar 2016 14:47:43 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj6Y2-0003IT-Fw for xen-devel@lists.xen.org; Thu, 24 Mar 2016 14:47:42 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 0D/0D-22144-D0EF3F65; Thu, 24 Mar 2016 14:47:41 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-11.tower-206.messagelabs.com!1458830860!18974234!1 X-Originating-IP: [209.85.220.48] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59648 invoked from network); 24 Mar 2016 14:47:41 -0000 Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by server-11.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Mar 2016 14:47:41 -0000 Received: by mail-pa0-f48.google.com with SMTP id tt10so24002619pab.3 for ; Thu, 24 Mar 2016 07:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AEc4AbTRFpm7oBZrZuJ7NJ7ci5kFpUSdBniAFPuDtBA=; b=j4ZP7c6+4k+VxyTboRg30xWdiX31v+Kuk7xfwBhHgu33eynUo7cWS7RFH84tVx/03U QMiy9osU7mOYGiyGXPcKPmWTpl35S35NdYyuQdpENeLAStC9gbRx89DgcTRst7oaXD+9 TsbhNYQ1FaBZZ/ONkh8+T9GovfeIO4gRSzidU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AEc4AbTRFpm7oBZrZuJ7NJ7ci5kFpUSdBniAFPuDtBA=; b=NnGioS24hFGC/GETtzCVe1VWqOVvHTtSO9AcqZBOWzkUzGH1K8AmIekCoVjQIGx7/Z ZaKdsXqM/Y/ycDm80SV7ydzBhqfuXToLJvXl2QaZ6UbeyOnznGqAEQ0AbjVrftQQre2O 1arSub6tCv2x2Ceh30vs7ZFyqtHUBxLIowvpJUq7Ft05hVeNh0WFy3Mkd7JOaKvaZDav nQDLfDn6eEjDd6WFKiwHqbk9/OHhq/l7Yqznx9rnGA4fO4Z+PvnhqTiSjc8SaMxYUSJK CMU8PWXWz0Q+5iKjGoKCgyA6Reh5UL10A3KCOxtv5TbZYeUQ5AqVY9zFq0ycJXjsNGsE /GYA== X-Gm-Message-State: AD7BkJIlMgOl0KrYIICDV+dMRiN8AyCW5jiAWvXIB+sf3307LET/OMCB5ayUdneB2ez2M8CG X-Received: by 10.66.248.198 with SMTP id yo6mr13280347pac.54.1458830859864; Thu, 24 Mar 2016 07:47:39 -0700 (PDT) Received: from localhost.localdomain ([104.238.45.135]) by smtp.gmail.com with ESMTPSA id lq10sm10780673pab.36.2016.03.24.07.47.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Mar 2016 07:47:38 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com, david.vrabel@citrix.com Date: Thu, 24 Mar 2016 22:44:29 +0800 Message-Id: <1458830676-27075-11-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458830676-27075-1-git-send-email-shannon.zhao@linaro.org> References: <1458830676-27075-1-git-send-email-shannon.zhao@linaro.org> Cc: devicetree@vger.kernel.org, linux-efi@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, peter.huangpeng@huawei.com, julien.grall@arm.com, shannon.zhao@linaro.org, zhaoshenglong@huawei.com, xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v7 10/17] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI 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" When booting with ACPI, it could get the event-channel irq through HVM_PARAM_CALLBACK_IRQ. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- arch/arm/xen/enlighten.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index d94f726..680aae0 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -278,6 +279,35 @@ void __init xen_early_init(void) add_preferred_console("hvc", 0, NULL); } +static void __init xen_acpi_guest_init(void) +{ +#ifdef CONFIG_ACPI + struct xen_hvm_param a; + int interrupt, trigger, polarity; + + a.domid = DOMID_SELF; + a.index = HVM_PARAM_CALLBACK_IRQ; + xen_events_irq = 0; + + if (!HYPERVISOR_hvm_op(HVMOP_get_param, &a)) { + if ((a.value >> 56) == HVM_PARAM_CALLBACK_TYPE_PPI) { + interrupt = a.value & 0xff; + trigger = ((a.value >> 8) & 0x1) ? ACPI_EDGE_SENSITIVE + : ACPI_LEVEL_SENSITIVE; + polarity = ((a.value >> 8) & 0x2) ? ACPI_ACTIVE_LOW + : ACPI_ACTIVE_HIGH; + xen_events_irq = acpi_register_gsi(NULL, interrupt, + trigger, polarity); + } + } +#endif +} + +static void __init xen_dt_guest_init(void) +{ + xen_events_irq = irq_of_parse_and_map(xen_node, 0); +} + static int __init xen_guest_init(void) { struct xen_add_to_physmap xatp; @@ -286,7 +316,11 @@ static int __init xen_guest_init(void) if (!xen_domain()) return 0; - xen_events_irq = irq_of_parse_and_map(xen_node, 0); + if (!acpi_disabled) + xen_acpi_guest_init(); + else + xen_dt_guest_init(); + if (!xen_events_irq) { pr_err("Xen event channel interrupt not found\n"); return -ENODEV;