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: 8726131 Return-Path: X-Original-To: patchwork-xen-devel@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 E1C8D9F3D1 for ; Fri, 1 Apr 2016 15:52:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04129202EC for ; Fri, 1 Apr 2016 15:52:52 +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 AF97820109 for ; Fri, 1 Apr 2016 15:52:50 +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 1am1Ll-0004rD-HA; Fri, 01 Apr 2016 15:51:05 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1am1Lk-0004qR-NA for xen-devel@lists.xen.org; Fri, 01 Apr 2016 15:51:04 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id E0/37-22144-8E89EF65; Fri, 01 Apr 2016 15:51:04 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-4.tower-206.messagelabs.com!1459525862!32558922!1 X-Originating-IP: [209.85.220.41] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47954 invoked from network); 1 Apr 2016 15:51:03 -0000 Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 1 Apr 2016 15:51:03 -0000 Received: by mail-pa0-f41.google.com with SMTP id fe3so93908050pab.1 for ; Fri, 01 Apr 2016 08:51:03 -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=KuAGGQoj9A8v0JBQEtuzolrgZ0xm4n6DzR8XJjMHceryGcueJwtkJGREXWkDp43qDw bhJ6RkUOtPeAnpnCbkTlKuPKQsWz7tfTd/VVQKfeDfzu8zIrGOyA48x+02JCwat/Eek3 UCZtPPuC8I7v1sfa1LWJ7hE3S8bzZnNC1xdi9advcKSKsjZwCWg0tO+o/6n7M9oUbuSm 4b+VFWhk1EAgQRjDQBij1T5/eih8cEih5hJnxQZ0VB7Z04FrJsSU0pebhLxfijypHtKT izTqgnBbOOyq5Ytn/sV/DQ3VXlWDiwrFyvOKAjJrc8fus4gHPf1TPmHidJWSl08c/HUP zL2w== X-Gm-Message-State: AD7BkJIuzLCh7u9UrEzqiRFt+ix44Djqqh9QmZ7MiTAkNt/fZUHbdxfNEqFEzjToLDmTElgz 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 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> 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 Subject: [Xen-devel] [PATCH v10 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 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;