From patchwork Thu Jan 29 18:25:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43967 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1A54224128 for ; Thu, 29 Jan 2015 18:28:51 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf23095374lbj.0 for ; Thu, 29 Jan 2015 10:28:49 -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=wN/1ovbyl7R+Lm5MEH9mmBi6xlIUyvefECrSQrZRD1I=; b=SsqMpSl36t4B4Vi/e4fNzxJQn72MhFh8GCVl/ZWw3Xx93aVgubhPBp3dAHrKi9C4Kl XrDQcALysK/3Egb8g9N0NDGI80Rt5nD5lov1g6Jzj+HyAcKbpxtw/Ck29RzqF84K25UC v+NjSsar1RjEeVxCRHI9yLF3i/gZAIP+XAJkSu0NK98fJxLOH68Cy8DagRR9raZc32jt 2+4bNZ7gdDw+6sSfJrNSfBysFdm6vZympb3shg0+Y6ynUgz60xJWmORc9zAntbLrdjDf vJs4ZAC+U94IFOoNfautnMUjnExoU8PgPQai4MoEhCscCQ/tD6Ag85l70oTb0hqqVEbZ MzVQ== X-Gm-Message-State: ALoCoQn9z9DJB0dmO7yGz0PBp8//Xa3nqweWTVIOilAQNmz1gV96lARD8YSRSWjn0LBNyv5WUxTx X-Received: by 10.112.213.72 with SMTP id nq8mr317684lbc.18.1422556129544; Thu, 29 Jan 2015 10:28:49 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.130 with SMTP id m2ls291455laf.87.gmail; Thu, 29 Jan 2015 10:28:49 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr2480643lbc.23.1422556129260; Thu, 29 Jan 2015 10:28:49 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id oa1si8158468lbb.100.2015.01.29.10.28.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 10:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so31300258lbv.4 for ; Thu, 29 Jan 2015 10:28:49 -0800 (PST) X-Received: by 10.112.52.229 with SMTP id w5mr2611676lbo.52.1422556128971; Thu, 29 Jan 2015 10:28:48 -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 h5csp34397lbj; Thu, 29 Jan 2015 10:28:48 -0800 (PST) X-Received: by 10.180.83.5 with SMTP id m5mr3716837wiy.74.1422556126631; Thu, 29 Jan 2015 10:28:46 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gg3si2448217wib.6.2015.01.29.10.28.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 10:28:46 -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 1YGtne-0004b6-F6; Thu, 29 Jan 2015 18:26:42 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGtnc-0004au-Ns for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 18:26:40 +0000 Received: from [85.158.143.35] by server-2.bemta-4.messagelabs.com id F4/E7-02749-06B7AC45; Thu, 29 Jan 2015 18:26:40 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1422555999!13337536!1 X-Originating-IP: [209.85.212.177] 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 24304 invoked from network); 29 Jan 2015 18:26:39 -0000 Received: from mail-wi0-f177.google.com (HELO mail-wi0-f177.google.com) (209.85.212.177) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 29 Jan 2015 18:26:39 -0000 Received: by mail-wi0-f177.google.com with SMTP id r20so28272128wiv.4 for ; Thu, 29 Jan 2015 10:26:39 -0800 (PST) X-Received: by 10.180.189.67 with SMTP id gg3mr3767590wic.4.1422555998945; Thu, 29 Jan 2015 10:26:38 -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.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 10:26:38 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 29 Jan 2015 18:25:37 +0000 Message-Id: <1422555950-31821-3-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 02/15] xen/arm: vgic-v3: Correctly set GICD_TYPER.CPUNumber 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.173 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: On GICv3, the value (CPUNumber + 1) indicates the number of processor that may be used as interrupts targets when ARE bit is zero. The maximum is 8 processors. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- The current code of the vGIC doesn't support ARE = 0. Nonetheless, the patch is a candidate for backporing to Xen 4.5 to have a consistent vGIC driver. Changes in v2: - Rebase after the change in patch #1 and the introduction of nr_spis/vgic_num_irqs. - Add Ian's ack. I keep the ack has the changes was only rebasing. --- xen/arch/arm/vgic-v3.c | 7 ++++++- xen/include/asm-arm/gic.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 72b22ee..e0a7d5b 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -685,10 +685,15 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info) * Stream Protocol Interface */ unsigned int irq_bits = get_count_order(vgic_num_irqs(v->domain)); + /* + * Number of processors that may be used as interrupt targets when ARE + * bit is zero. The maximum is 8. + */ + unsigned int ncpus = min_t(unsigned int, v->domain->max_vcpus, 8); if ( dabt.size != DABT_WORD ) goto bad_width; /* No secure world support for guests. */ - *r = (((v->domain->max_vcpus << 5) & GICD_TYPE_CPUS ) | + *r = ((ncpus - 1) << GICD_TYPE_CPUS_SHIFT | ((v->domain->arch.vgic.nr_spis / 32) & GICD_TYPE_LINES)); *r |= (irq_bits - 1) << GICD_TYPE_ID_BITS_SHIFT; diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 187dc46..0396a8e 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -93,6 +93,7 @@ #define GICD_CTL_ENABLE 0x1 #define GICD_TYPE_LINES 0x01f +#define GICD_TYPE_CPUS_SHIFT 5 #define GICD_TYPE_CPUS 0x0e0 #define GICD_TYPE_SEC 0x400