From patchwork Fri Mar 25 13:48:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64483 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp183645lbc; Fri, 25 Mar 2016 06:51:42 -0700 (PDT) X-Received: by 10.140.42.39 with SMTP id b36mr17321856qga.4.1458913881408; Fri, 25 Mar 2016 06:51:21 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z8si10785183qhc.58.2016.03.25.06.51.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Mar 2016 06:51:21 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS84-0001yp-0C; Fri, 25 Mar 2016 13:50:20 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS82-0001vU-OU for xen-devel@lists.xen.org; Fri, 25 Mar 2016 13:50:18 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 79/98-09532-A1245F65; Fri, 25 Mar 2016 13:50:18 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-13.tower-21.messagelabs.com!1458913816!6003863!1 X-Originating-IP: [209.85.220.49] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8119 invoked from network); 25 Mar 2016 13:50:17 -0000 Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by server-13.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Mar 2016 13:50:17 -0000 Received: by mail-pa0-f49.google.com with SMTP id fl4so46878611pad.0 for ; Fri, 25 Mar 2016 06:50:17 -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=00RjiU8c3PsvszX5Pjn3Tx60TF4Yk0i6Xsyn8xDqEKY=; b=DXAvitWSQRSpslB85uoQSM+J5Th9uR7iVkPMrdib3NI9J/IfxYOWZUqf8U6e55mtJE BtFhxZvfdRUP7ci4gVKIW70WiqsvTk/x4CHMIfLYRj+4cUloMnADwMAkLxd3opEBx/lt a4TmkyxEd8JzKO2IcHNKhCIJKBgnFyxB5Skyk= 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=00RjiU8c3PsvszX5Pjn3Tx60TF4Yk0i6Xsyn8xDqEKY=; b=G7omIJ9NRUgK60NFFjDv1rzdNQR0+cfNsBZHHxiLSzj4/9PSUjH6fAwPffRqQwwV1I xMAI+3H5CjgpTeiOryT2yuXhYyMH1Az8a1Bw9K1Uocu+Id0amlzcY2kNWmXwUuuXCvK1 j5tO4d5NcEckBHPThTifK94WvK4JUvTBTgi3P7aiaLF2QE7q+kCZOA4vAgRvpm0N4SDC Vn1Kb4ZSwdXN+GdOrxJxPpCo0xm35u9D+azRuaDMhc0u+cOGhF8/mpFUoirZggSG0Hbd QAZJggR532aqv9l6uDe2jL3eoqv5Ke1ddcPB/TRtd+El/yXF94xUErOPRmrz23y4BCxy qGsg== X-Gm-Message-State: AD7BkJJ5XQWOGzZIYuRjJsi4ykmTnNeGMvpMhWwZPPUiSbMpa/hosNVbXchNkOGHXm82fKjL X-Received: by 10.66.193.131 with SMTP id ho3mr21043757pac.154.1458913816005; Fri, 25 Mar 2016 06:50:16 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.2]) by smtp.gmail.com with ESMTPSA id w20sm16744178pfi.31.2016.03.25.06.50.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2016 06:50:15 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Fri, 25 Mar 2016 21:48:48 +0800 Message-Id: <1458913735-2678-16-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> References: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> Cc: julien.grall@arm.com, shannon.zhao@linaro.org, stefano.stabellini@citrix.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Xen-devel] [PATCH v7 15/22] arm/acpi: Permit access all Xen unused SPIs for Dom0 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" Allow DOM0 to use all SPIs but the ones used by Xen. Then when Dom0 configures the interrupt, it could set the interrupt type and route it to Dom0. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini Acked-by: Julien Grall --- v7: add a TODO for SMMU used SPIs --- xen/arch/arm/domain_build.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 58a44ff..28b85e5 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1359,6 +1359,37 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) #ifdef CONFIG_ACPI #define ACPI_DOM0_FDT_MIN_SIZE 4096 +static int acpi_permit_spi_access(struct domain *d) +{ + int i, res; + struct irq_desc *desc; + + /* + * Here just permit Dom0 to access the SPIs which Xen doesn't use. Then when + * Dom0 configures the interrupt, set the interrupt type and route it to + * Dom0. + */ + for( i = NR_LOCAL_IRQS; i < vgic_num_irqs(d); i++ ) + { + /* + * TODO: Exclude the SPIs SMMU uses which should not be routed to Dom0. + */ + desc = irq_to_desc(i); + if ( desc->action != NULL) + continue; + + res = irq_permit_access(d, i); + if ( res ) + { + printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n", + d->domain_id, i); + return res; + } + } + + return 0; +} + static int acpi_make_chosen_node(const struct kernel_info *kinfo) { int res; @@ -1884,6 +1915,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_permit_spi_access(d); + if ( rc != 0 ) + return rc; + return 0; } #else