From patchwork Thu Mar 19 19:29:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46099 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8739B21515 for ; Thu, 19 Mar 2015 19:32:28 +0000 (UTC) Received: by wggy19 with SMTP id y19sf14079178wgg.2 for ; Thu, 19 Mar 2015 12:32:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=Rcn3ukEWH2ZApNcgxWjF/pEVWiyGUXZVzTuYVme0t3M=; b=mtoh+6Qgthv3LAC+eibZ+o+mnZjPnrgzne0Iz2lkWWzA+QPUWtVeu/gMc68gm1OLbO sArR5tFzrnvm5Zw05ckNw51zXf9FuTAwwcfFTSvU62D67zG27bcJJuWRsaeNfFygBMul oVwBK6UnaGFU9T0cFFADCrYOGcfjpRfRuTvcE8rnBlGEue+cFlViHQl1KhysjuBSMUXk 1SOnGFYf17X60K09Day3iOEYrfbKNnmR1jaiX9LKyAo1kdZkaU8KxzxoLy5XAPwAN8MR 15vKVdKpy43C2DT0y9JyrCi0FWPwrLBFvr+am4iLP1JJIxQamRisCi8b5BT7pSTpK/IU 1oPA== X-Gm-Message-State: ALoCoQnXx+zpNrOmvvusYrYIqeWH4i6viPPaFCQyFR9tERS53A5r/h8KB0bBDveEKliUkl+ajpZB X-Received: by 10.112.162.135 with SMTP id ya7mr12230511lbb.14.1426793547879; Thu, 19 Mar 2015 12:32:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.233 with SMTP id y9ls349503lae.9.gmail; Thu, 19 Mar 2015 12:32:27 -0700 (PDT) X-Received: by 10.112.8.101 with SMTP id q5mr64617442lba.19.1426793547537; Thu, 19 Mar 2015 12:32:27 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id os2si1599638lbb.177.2015.03.19.12.32.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 12:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbcgn8 with SMTP id gn8so60358801lbc.2 for ; Thu, 19 Mar 2015 12:32:27 -0700 (PDT) X-Received: by 10.152.121.33 with SMTP id lh1mr70278307lab.86.1426793547435; Thu, 19 Mar 2015 12:32:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp597591lbj; Thu, 19 Mar 2015 12:32:26 -0700 (PDT) X-Received: by 10.55.26.167 with SMTP id l39mr129244751qkh.63.1426793546087; Thu, 19 Mar 2015 12:32:26 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id i65si2199607qhc.54.2015.03.19.12.32.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 19 Mar 2015 12:32:26 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYg9l-0004Xq-U1; Thu, 19 Mar 2015 19:31:01 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYg9k-0004Tf-8e for xen-devel@lists.xenproject.org; Thu, 19 Mar 2015 19:31:00 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 6B/49-32332-3F32B055; Thu, 19 Mar 2015 19:30:59 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-15.tower-206.messagelabs.com!1426793458!8616762!1 X-Originating-IP: [74.125.82.54] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6699 invoked from network); 19 Mar 2015 19:30:58 -0000 Received: from mail-wg0-f54.google.com (HELO mail-wg0-f54.google.com) (74.125.82.54) by server-15.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 19 Mar 2015 19:30:58 -0000 Received: by wgbcc7 with SMTP id cc7so71236752wgb.0 for ; Thu, 19 Mar 2015 12:30:58 -0700 (PDT) X-Received: by 10.194.75.193 with SMTP id e1mr150790834wjw.126.1426793458478; Thu, 19 Mar 2015 12:30:58 -0700 (PDT) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id hl8sm3203005wjb.38.2015.03.19.12.30.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Mar 2015 12:30:57 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 19 Mar 2015 19:29:40 +0000 Message-Id: <1426793399-6283-15-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> References: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v4 14/33] xen/arm: vgic: Correctly calculate GICD_TYPER.ITLinesNumber X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: The formula of GICD_TYPER.ITLinesNumber is 32(N + 1). As the number of SPIs suppported by the domain may not be a multiple of 32, we have to round up the number before using it. At the same time remove the mask GICD_TYPE_LINES which is pointless. Signed-off-by: Julien Grall --- Changes in v4: - Patch added --- xen/arch/arm/vgic-v2.c | 2 +- xen/arch/arm/vgic-v3.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index 40619b2..b5a8f29 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -55,7 +55,7 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info) /* No secure world support for guests. */ vgic_lock(v); *r = ( ((v->domain->max_vcpus - 1) << GICD_TYPE_CPUS_SHIFT) ) - |( ((v->domain->arch.vgic.nr_spis / 32)) & GICD_TYPE_LINES ); + | DIV_ROUND_UP(v->domain->arch.vgic.nr_spis, 32); vgic_unlock(v); return 1; case GICD_IIDR: diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index ec79c2a..96c1be8 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -700,7 +700,7 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info) if ( dabt.size != DABT_WORD ) goto bad_width; /* No secure world support for guests. */ *r = ((ncpus - 1) << GICD_TYPE_CPUS_SHIFT | - ((v->domain->arch.vgic.nr_spis / 32) & GICD_TYPE_LINES)); + DIV_ROUND_UP(v->domain->arch.vgic.nr_spis, 32)); *r |= (irq_bits - 1) << GICD_TYPE_ID_BITS_SHIFT;