From patchwork Tue Nov 17 09:40:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7635201 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 DB3C0BF90C for ; Tue, 17 Nov 2015 10:21:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09AAA204E0 for ; Tue, 17 Nov 2015 10:21:59 +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 4105F201C0 for ; Tue, 17 Nov 2015 10:21: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 1ZydLy-00065s-Ln; Tue, 17 Nov 2015 10:19:10 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zyct9-0003ti-Nk for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:49:30 +0000 Received: by wmec201 with SMTP id c201so218153350wme.0 for ; Tue, 17 Nov 2015 01:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zEuoHhsp2HA4541HqIHTwj8bTQeZ+3e/gdvAfW9FR9A=; b=mzHuxyhKqMe0pxW9cAMx3J0k2nKB2A67d5I5rRs71b68sZ77evkUhx2D9o4BCKb1hA sc2L6bQtKWM4gTcoK4jdiRnw2cSdbPxyBcGi58tWQdU9Ivr1IiXNleX+zzTv8MExoFbJ J0mQq1jAkq1oUbW/OZIOqGoNSfhWfSU6nXJd15xbIpTh1IPMEUoJn6coUGEorIb6ykPd UnG8YztX6ecd1UWtkpxcRvR1xd2pWJW5tCcr3GDRw3Uuc4oT2xzIodLt8+C46nSSzi0Y HPZ53Etm21tx9gCm2au+IfXAKO/uPHlO3zJHi+O40NzGM16quRUih0Qr+qKxuhOhnpLv glYQ== 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=zEuoHhsp2HA4541HqIHTwj8bTQeZ+3e/gdvAfW9FR9A=; b=jQU6ObXVjbJ2vhLgKWp7DL6318jC5qjfOo1HuyXwtYcCKsePpcQzeoE1KjaIBGi2sn ZjyoGfZ5Q6uV60dGin0JOULsK6rHd53/6LirZv/06qxha0EYp8z7AW7J99Pc0+SfUuLr ZDJSSdOTrw2IdXHY663L5eyfsQzfsF+rovFA67LQRody/Li6hAn4NH2RsXZcQgBrpY4v NZMBO20lSXC+01KxY61SHPuDf45kFaoz8GLv89Yb53Xxeb6bUr/zZmppCoqLje4Omkkq 4KaoutzhCAzLs77LWnjqQ1DZa+UzL46cTtDpRMmVIpRnJC8ek2J//E5qQtCNnjGxjYPX qDgA== X-Gm-Message-State: ALoCoQkMCjj4TGfZX2fbk/DPohTXR7xpFtbExppWr70mXzbOa9Y1c/LK/pNEWFwqOyrXkN4/6NmM X-Received: by 10.194.170.196 with SMTP id ao4mr31177869wjc.15.1447753742256; Tue, 17 Nov 2015 01:49:02 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id 186sm4474692wmv.9.2015.11.17.01.49.00 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:49:01 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Subject: [PATCH v3 55/62] arm/acpi: Route all Xen unused SPIs to Dom0 Date: Tue, 17 Nov 2015 17:40:54 +0800 Message-Id: <1447753261-7552-56-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014924_746242_A355693A X-CRM114-Status: GOOD ( 12.26 ) X-Spam-Score: -2.6 (--) 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: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com 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.7 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 From: Shannon Zhao Route all SPIs to Dom0 except the interrupts that Xen uses. Since Xen already uses the uart interrupt, the desc->action will not be NULL, so it will skip it. Signed-off-by: Shannon Zhao --- xen/arch/arm/domain_build.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 6d8536b..6945f89 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1360,6 +1360,35 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) #define XEN_HYPERVISOR_ID 0x000058656E564D4D /* "XenVMM" */ #define ACPI_DOM0_FDT_MIN_SIZE 4096 +static int acpi_route_spi(struct domain *d) +{ + int i, res; + struct irq_desc *desc; + + /* Don't route Xen used interrupt to Dom0. Since Xen already uses the uart + * interrupt, the desc->action will not be NULL, so it will skip it. + */ + for( i = NR_LOCAL_IRQS; i < vgic_num_irqs(d); i++ ) + { + /* Don't route uart interrupt to Dom0 */ + desc = irq_to_desc(i); + if( desc->action != NULL) + continue; + + vgic_reserve_virq(d, i); + irq_set_type(i, ACPI_IRQ_TYPE_NONE); + res = route_irq_to_guest(d, i, i, NULL); + if ( res ) + { + printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n", + i, d->domain_id); + continue; + } + } + + return 0; +} + static int make_chosen_node(const struct kernel_info *kinfo, struct membank tbl_add[]) { @@ -1897,6 +1926,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_route_spi(d); + if ( rc != 0 ) + return rc; + return 0; } #else