From patchwork Fri Apr 1 15:49:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8726321 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D12B39F3D1 for ; Fri, 1 Apr 2016 15:57:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00EBC202EC for ; Fri, 1 Apr 2016 15:57:02 +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 56C5920145 for ; Fri, 1 Apr 2016 15:56:57 +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 1am1Po-0007xO-LW; Fri, 01 Apr 2016 15:55:16 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1am1Lz-0003KO-Vb for linux-arm-kernel@lists.infradead.org; Fri, 01 Apr 2016 15:51:34 +0000 Received: by mail-pa0-x235.google.com with SMTP id td3so93489633pab.2 for ; Fri, 01 Apr 2016 08:51:02 -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=6qCEef/5GvchlerrC4hLaQZc6bibx2h2cFmf6+HesjQ=; b=gtpNEG6tAFJ+5lEb6A4mAy+TsEBFuY3EBYwxBEgv87x+TqzuH2baTCsep0N1BMgBVQ AhwQGZsSuANWfSFzaR2emg5teJezLXzCmWjNQemiae0jUePtbs5jL9kxDob/AXfdpn7G RHDpcYnOPCKKxyKs30WivoenYEusjd2uwfBEU= 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=6qCEef/5GvchlerrC4hLaQZc6bibx2h2cFmf6+HesjQ=; b=hMkXVbWKk5X7SJx7JBKAhzpx8kccaWO+IXXsBaAt3c7AXBedNNtwWUr3BDfd7pZkRT CBdKxpU5BXXQfMZ/tYAHHv1G0HISd+JmBy//nXKA+R2MArWVUysLwb7qvpU8E8NaC7m6 I9/pqTXgnysNUu+ox9pzJ5opf4EhenRJPlcw0xP9Uqn4dY4AXaE2L7FwjSpLlq7XIhM3 y7/Dmu+5fl6Je0BbpYHdBgJ3AA+RVSkKIawEDjJCQjp+IwqTkGEsmrcVyoGEEwQusAAI erLAvWz9D3jIY98nRZL6UeIMdcU1sVObKDYi2Gw/7k3bWOIMgbBU9bm3VQN8UkdfTWqU A3Lg== X-Gm-Message-State: AD7BkJI0Mp9fN/Rxkb5sT3Kwh+l7hojMyNnDityeWneeFihGH7/nREykMCG52MbAejM906xf X-Received: by 10.66.102.8 with SMTP id fk8mr32162825pab.12.1459525862043; Fri, 01 Apr 2016 08:51:02 -0700 (PDT) Received: from localhost.localdomain ([167.160.116.218]) by smtp.gmail.com with ESMTPSA id yj1sm22536791pac.16.2016.04.01.08.50.54 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Apr 2016 08:51:00 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com Subject: [PATCH v10 10/17] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI Date: Fri, 1 Apr 2016 23:49:08 +0800 Message-Id: <1459525755-36968-11-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> References: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160401_085120_683301_10B6825C X-CRM114-Status: GOOD ( 13.30 ) 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, david.vrabel@citrix.com, zhaoshenglong@huawei.com, xen-devel@lists.xen.org, shannon.zhao@linaro.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=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,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 The kernel will get the event-channel IRQ through HVM_PARAM_CALLBACK_IRQ. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini Reviewed-by: Julien Grall --- 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..06bd61a 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; + + if (HYPERVISOR_hvm_op(HVMOP_get_param, &a) + || (a.value >> 56) != HVM_PARAM_CALLBACK_TYPE_PPI) { + xen_events_irq = 0; + return; + } + + 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;