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: 8661711 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 8658FC0554 for ; Thu, 24 Mar 2016 14:50:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF002203C2 for ; Thu, 24 Mar 2016 14:49:59 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id C7634203B4 for ; Thu, 24 Mar 2016 14:49:57 +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 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" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 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;