From patchwork Thu Jan 29 18:25:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43960 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A57F424128 for ; Thu, 29 Jan 2015 18:28:08 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf22920641lbv.1 for ; Thu, 29 Jan 2015 10:28:07 -0800 (PST) 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=OlwtIakVu0Gt2258eCDi6PwoP6UUBE+S91CPPXRLwjA=; b=cMc+TgPWIEYnXEBEaAB4gNXD0xzLjTOU6iOXXuA/vno5sIVjaivMFY4HyqdKxD/qR8 z1bowU9/L1r0hJmqx912ZTGM0uSct/DB6Zc8x+H8hXRSx8yLZ6s2k2CpIiD0djCcM1Te GTm/1K/XwaS3LRQBpTyDpmUL4VZphpWLWn2C9z7ixxFfhEoOYqEqM5QDXZWAvMeO0yYN 1vGchsGC4TJbmd08gog63Ibl9oEgLkf5Dyi7cfrYb/uAOBf8eUq7zb9ughbzVrWHSZlg 8wzWr9MIc4KnpYfyEf0X3j3VzwS6MVDExV7+1bg7ksRkIznvzc1TDMyfsKQLIjYGsuaC 2yUg== X-Gm-Message-State: ALoCoQmkZUsFc27TC+n89fLIy0JGhgHYNjFIO6/cqTEAv4ckSn5o29hVU2bT8DX7X1S+RPPiLcQ3 X-Received: by 10.112.143.167 with SMTP id sf7mr310306lbb.0.1422556087666; Thu, 29 Jan 2015 10:28:07 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.42 with SMTP id g10ls340282laa.51.gmail; Thu, 29 Jan 2015 10:28:07 -0800 (PST) X-Received: by 10.112.151.228 with SMTP id ut4mr2439032lbb.77.1422556087389; Thu, 29 Jan 2015 10:28:07 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id ud9si8171944lac.84.2015.01.29.10.28.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 10:28:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id l4so31293296lbv.3 for ; Thu, 29 Jan 2015 10:28:07 -0800 (PST) X-Received: by 10.112.243.12 with SMTP id wu12mr2456298lbc.91.1422556087262; Thu, 29 Jan 2015 10:28:07 -0800 (PST) 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 h5csp34203lbj; Thu, 29 Jan 2015 10:28:06 -0800 (PST) X-Received: by 10.194.84.105 with SMTP id x9mr3755898wjy.17.1422556081606; Thu, 29 Jan 2015 10:28:01 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id f1si2206409wiy.64.2015.01.29.10.28.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 10:28:01 -0800 (PST) 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 1YGtnl-0004cx-96; Thu, 29 Jan 2015 18:26:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGtni-0004cC-Nl for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 18:26:46 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id B9/94-03710-56B7AC45; Thu, 29 Jan 2015 18:26:45 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-2.tower-31.messagelabs.com!1422556005!23339735!1 X-Originating-IP: [209.85.212.176] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12562 invoked from network); 29 Jan 2015 18:26:45 -0000 Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 29 Jan 2015 18:26:45 -0000 Received: by mail-wi0-f176.google.com with SMTP id bs8so21124715wib.3 for ; Thu, 29 Jan 2015 10:26:45 -0800 (PST) X-Received: by 10.194.61.65 with SMTP id n1mr4032620wjr.36.1422556004899; Thu, 29 Jan 2015 10:26:44 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id x18sm3518503wia.12.2015.01.29.10.26.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 10:26:44 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 29 Jan 2015 18:25:41 +0000 Message-Id: <1422555950-31821-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1422555950-31821-1-git-send-email-julien.grall@linaro.org> References: <1422555950-31821-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Vijaya.Kumar@caviumnetworks.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v2 06/15] xen/arm: vgic-v3: Set stride during domain initialization 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.172 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 stride may not be set if the hardware GIC is using the default layout. It happens on the Foundation model. On GICv3, the default stride is 2 * 64K. Therefore it's possible to avoid checking at every redistributor MMIO access if the stride is not set. This is only happening for DOM0, so we can move this code in gicv_v3_init. Take the opportunity to move the stride setting a bit ealier because the loop to set regions will require the stride. Also, use 2 * 64K rather than 128K and explain the reason. Signed-off-by: Julien Grall --- I wasn't not sure where to move this code. I find very confusion the splitting between vgic and gicv. Maybe we should introduce a hwdom_gicv_init and giccc_map callbacks. Then move most of the initialization in the vgic one. Changes in v2: - Patch added --- xen/arch/arm/gic-v3.c | 11 ++++++++++- xen/arch/arm/vgic-v3.c | 6 +----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 47452ca..7b33ff7 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -897,12 +897,21 @@ static int gicv_v3_init(struct domain *d) { d->arch.vgic.dbase = gicv3.dbase; d->arch.vgic.dbase_size = gicv3.dbase_size; + + d->arch.vgic.rdist_stride = gicv3.rdist_stride; + /* + * If the stride is not set, the default stride for GICv3 is 2 * 64K: + * - first 64k page for Control and Physical LPIs + * - second 64k page for Control and Generation of SGIs + */ + if ( !d->arch.vgic.rdist_stride ) + d->arch.vgic.rdist_stride = 2 * SZ_64K; + for ( i = 0; i < gicv3.rdist_count; i++ ) { d->arch.vgic.rbase[i] = gicv3.rdist_regions[i].base; d->arch.vgic.rbase_size[i] = gicv3.rdist_regions[i].size; } - d->arch.vgic.rdist_stride = gicv3.rdist_stride; d->arch.vgic.rdist_count = gicv3.rdist_count; } else diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 2c14717..db6b514 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -625,11 +625,7 @@ static int vgic_v3_rdistr_mmio_read(struct vcpu *v, mmio_info_t *info) perfc_incr(vgicr_reads); - if ( v->domain->arch.vgic.rdist_stride != 0 ) - offset = info->gpa & (v->domain->arch.vgic.rdist_stride - 1); - else - /* If stride is not set. Default 128K */ - offset = info->gpa & (SZ_128K - 1); + offset = info->gpa & (v->domain->arch.vgic.rdist_stride - 1); if ( offset < SZ_64K ) return __vgic_v3_rdistr_rd_mmio_read(v, info, offset);