From patchwork Fri Feb 16 14:59:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 128597 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp654360ljc; Fri, 16 Feb 2018 07:02:36 -0800 (PST) X-Google-Smtp-Source: AH8x224KIaGA9bv8WIKoac4jvg6rYDnFgK1PTzBcC4e0l6WIfe9BRg5p2aBT9o1gwPL/OzLzllT8 X-Received: by 10.202.241.130 with SMTP id p124mr4224212oih.171.1518793356528; Fri, 16 Feb 2018 07:02:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518793356; cv=none; d=google.com; s=arc-20160816; b=n1ctlAjKj+mE/0oCNpdlfJDjNfQH4rinNuKewzprz2vrkRvIsG4q+XuR4zvDHSPnO0 PltrDo1e9iFT5VY1Tp0Dp2utVC45VongKlWC10KGSEGB6QLk/OB8zoV5j7GtM1WuArQh LOjCpxzC21nDlXCRGVocE4fqVDcSTPd58ez4aql7DzxqDRsbSrbS7vQudMoKvSacFhjb pyRFl6jdR8AsTr3m37UYPXhuLFe67JqMZ4eNTUl9JGAfFaPLndk7l52dUOuWiINfNUrJ Ol/hlpV0NxwiKbR6V/XP29OPakB+1/FIDf1jwQCI2dBchX3JPYJv1Gf7YbVneLApXq2Y RtuA== 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=BQgnp5gAeSfvVUCqglub7PDhNddBDGNZkfQnrcLTDvY=; b=TsqfCK4fMQHW6GZAEYzlyE8Yd4hYqDzcssJ5rQ/xfLzjF1F2H4jLsy2nQ9B++b0+De /GNOYlzQ2K79NoNQICGeQzKqQqhVy8CAcKXUnRfMs2hgOOJty3vdV6AYzQc7TJS5bRaF bEGBTpcWCnV7DQHLOT+Svaal4r09pVTMIN6KtZz7KqXlbGroavUCe0fsQWpJ2pbf0qMa RaLbvVxK3CQTpW6tVUXU8NzIftXhMlUcR+dy6GlIUW3CRHLTlumZJaoemBg06LX9YdI/ 1COuIGPuoh3fIIfzUp8BUqOVZ3YnBQqWv3EhQRA1QHIYIiEyGM/LKA0oj4AZYlZnut96 iabA== 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 137si10296102itl.103.2018.02.16.07.02.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 07:02:36 -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 1emhUm-0000HK-2Y; Fri, 16 Feb 2018 15:00:16 +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 1emhUk-0000HC-12 for xen-devel@lists.xen.org; Fri, 16 Feb 2018 15:00:14 +0000 X-Inumbo-ID: 43b6b043-132a-11e8-b9b1-635ca7ef6cff Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 43b6b043-132a-11e8-b9b1-635ca7ef6cff; Fri, 16 Feb 2018 15:01:28 +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 B25901435; Fri, 16 Feb 2018 07:00:06 -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 7FD8C3F53D; Fri, 16 Feb 2018 07:00:05 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 16 Feb 2018 14:59:56 +0000 Message-Id: <20180216145956.3271-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Cc: Julien Grall , sstabellini@kernel.org, Jeff Kubascik , andre.przywara@linaro.org, Jarvis Roach Subject: [Xen-devel] [PATCH v2] 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: Jeff Kubascik Signed-off-by: Julien Grall Cc: Jarvis Roach Reviewed-by: Stefano Stabellini --- This should be backported up to Xen 4.8. Changes in v2: - Update the Reported-by address --- 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;