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: 8662031 Return-Path: X-Original-To: patchwork-linux-arm@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 76629C0553 for ; Thu, 24 Mar 2016 14:55:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E1E1203A0 for ; Thu, 24 Mar 2016 14:55:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1D16202AE for ; Thu, 24 Mar 2016 14:54:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aj6dR-0003yw-Iy; Thu, 24 Mar 2016 14:53:17 +0000 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aj6YK-0006k4-6l for linux-arm-kernel@lists.infradead.org; Thu, 24 Mar 2016 14:48:03 +0000 Received: by mail-pa0-x236.google.com with SMTP id td3so23731268pab.2 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=EV0lIwVFU0HkVkuKXziujuBFKCO5O8zOpSWPfQFPOMbh/q1RkixaOnmZVYXt+U93fH 9g8Gmwkuk7jIoTp7rEVwpMtNsxeRirzErfZdsXCiZTVGvFXSzFKNfyaP+5eXNUzna7nX OpGCCZ695LN+Hh4XmQoujiEW7IahaYLSC87q2Ji0ruK1eXQW9mOqa4ysalnEPmdgdDux GoL2zSorAAmX4uX8Mri9Q/XLCST6aBiPZEJfXDD0+nfqOqujzcsqrog/keQU6Py32heo ft5JEZc4WxDsqtIHtTEUjicJoroHNx3vzBQKuHD2MmmpG9E4O6Z/sU7S/43mfIrikssk vWdw== X-Gm-Message-State: AD7BkJIp7QxWBUivpzXflTv0X3mIpffsVWkSBg0YPrSu2yuEYrFzun1dofnKj6cHcjgPfpDT 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 Subject: [PATCH v7 10/17] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160324_074800_840270_54A6A38E X-CRM114-Status: GOOD ( 13.57 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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;