From patchwork Fri Feb 16 14:35:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 128595 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp631671ljc; Fri, 16 Feb 2018 06:38:22 -0800 (PST) X-Google-Smtp-Source: AH8x226cLn6fsBIAHdnRhcEzz0fIkAF8JB36q5/g75n2gyMtKjo0+kcvVqqlSuffKZHwmAVAxnsI X-Received: by 10.36.105.17 with SMTP id e17mr8216167itc.84.1518791902519; Fri, 16 Feb 2018 06:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518791902; cv=none; d=google.com; s=arc-20160816; b=Vpo7KmLJT85Fur546Gte6zs8N/ZAuzV57i1bU+LoK1DEDA1a88DY7DlBp+3Vup++8Q dQsma79L6N63XJUQeUVGoQh71yu5sUwosU67wPs7LecRA5Cj0um/h6I46penDeYgmv7u YSWSf8G7VFdYQiLmEFyQMSGMfnj+y48uhN+rEdWsVYlUTF/X55cCjknzF6bzSeevSIUI R2ihhyAIjkzZdVQLi+HoAexVYMGuhsmHDaniodTGlKPhx1htAn/8d1tzCWQOwE8sM3hY KH8mNLvOfsVbedbDUsJF+1P/U5/nArtnNSiOdlAE8fflLKdTOn3vYNKfHhDp0g3dAsPf TXnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=ARSDAlsSoq+2y6xT1xVOmyjUSqLIJ+WVk63HjafZlWM=; b=k3grD2+9DgczUK14ggazLuv3kRw825KpoAs2F0CQI/MshqJkQXqtT8YBZV27SAgy0h Vu2cINguDjoSxQ/tBOYRQNJ5VkMFjuH6M9WgteIng6MU8H3uas6ZPoUrciUgcYGPVeyX 2c1s282uBs9WNCWxEHMoegT5erUW/qlQ85eoGDrbDeLDt7IQWEjxZ1x8xL8xCwW8GS2+ e2SfpB68aHgIrlj0c4GXTm+Mg1iPhtOFetvtZl27s7RhD+qtyR/csQv97DoIeHwyB7EF X9hb8UWDdFskvkXUgIqUHD/XG8kcuRiPiX5Z6OKBCdFauKPvE8bSO1qegOdjorlF92cB 6/WA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l6si6292343iog.344.2018.02.16.06.38.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 06:38:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.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 1emh77-0006Sl-Dn; Fri, 16 Feb 2018 14:35:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emh76-0006Rs-1k for xen-devel@lists.xen.org; Fri, 16 Feb 2018 14:35:48 +0000 X-Inumbo-ID: d984d34a-1326-11e8-b9b1-635ca7ef6cff Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id d984d34a-1326-11e8-b9b1-635ca7ef6cff; Fri, 16 Feb 2018 14:37:01 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4D1841435; Fri, 16 Feb 2018 06:35:40 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6082D3F53D; Fri, 16 Feb 2018 06:35:39 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 16 Feb 2018 14:35:33 +0000 Message-Id: <20180216143533.1671-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Cc: Julien Grall , sstabellini@kernel.org, andre.przywara@linaro.org Subject: [Xen-devel] [PATCH] xen/arm: vgic: Make sure the number of SPIs is a multiple of 32 X-BeenThere: xen-devel@lists.xenproject.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.xenproject.org Sender: "Xen-devel" The vGIC relies on having a pending_irq available for every IRQs described in the ranks. As each rank describes 32 interrupts, we need to make sure the number of SPIs is a multiple of 32. Reported-by: Jarvis Roach Signed-off-by: Julien Grall --- Jarvis, I don't have Jeff's e-mail address so I put you as the report. Let me know if you want to change that. This should be backported up to Xen 4.8. --- xen/arch/arm/vgic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 9921769b15..34269bcf27 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -123,6 +123,13 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis) d->arch.vgic.ctlr = 0; + /* + * The vGIC relies on having a pending_irq available for every IRQ + * described in the ranks. As each rank describes 32 interrupts, we + * need to make sure the number of SPIs is a multiple of 32. + */ + nr_spis = ROUNDUP(nr_spis, 32); + /* Limit the number of virtual SPIs supported to (1020 - 32) = 988 */ if ( nr_spis > (1020 - NR_LOCAL_IRQS) ) return -EINVAL;