From patchwork Mon Feb 16 14:50:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 44714 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3379921544 for ; Mon, 16 Feb 2015 14:53:21 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id c41sf11886203eek.1 for ; Mon, 16 Feb 2015 06:53:20 -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=ZCG+yNYqgM2lh5GmIFWevZF31fjgNUTisdHSDHYgefxOfzdAqheOgEslLutFzhTj8U u/oIVa/tGh3mkgFQTfuEQUaJlyqqtFSfnTIaSJB8iPKH2twxK96yidBBlrlaRwfmDq5v Sedc2iByzWdQhbUgHSgThhicd2WqR6pRaRhoxGxS+IDRwZWbIJUGncccjJy+rxXgBtKi eTUQm6jFaHDhd+ltLOYMd7EBbM+uk/twouPY+W9NlbVV77STNtJLg06ZCdi4/RHICVB1 L5YDa1JJmss276lTEgDhK1OY2i6ku7XdZlG45pq7ZPJxjz4o99b7cL7sztqBY7a4s7W8 M1mw== X-Gm-Message-State: ALoCoQmo1V1CCqgYLCEq0THdaazHvXSXOHsSnu8zV/32X/vFzmRn/Zzcd7FVxpbygsb9LPBI+4Nq X-Received: by 10.112.181.198 with SMTP id dy6mr3079889lbc.22.1424098400263; Mon, 16 Feb 2015 06:53:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.74 with SMTP id r10ls480313lag.17.gmail; Mon, 16 Feb 2015 06:53:20 -0800 (PST) X-Received: by 10.112.170.100 with SMTP id al4mr23230197lbc.42.1424098400081; Mon, 16 Feb 2015 06:53:20 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id z7si7563749laj.61.2015.02.16.06.53.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 06:53:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by labms9 with SMTP id ms9so23336986lab.10 for ; Mon, 16 Feb 2015 06:53:20 -0800 (PST) X-Received: by 10.112.85.68 with SMTP id f4mr1453696lbz.106.1424098399942; Mon, 16 Feb 2015 06:53:19 -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 h5csp1629729lbj; Mon, 16 Feb 2015 06:53:19 -0800 (PST) X-Received: by 10.52.29.148 with SMTP id k20mr13367152vdh.60.1424098398348; Mon, 16 Feb 2015 06:53:18 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id yr15si7268202vcb.75.2015.02.16.06.53.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Feb 2015 06:53:18 -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 1YNN1H-0001Pl-Ta; Mon, 16 Feb 2015 14:51:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YNN1H-0001M3-29 for xen-devel@lists.xenproject.org; Mon, 16 Feb 2015 14:51:31 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 8E/18-02999-2F302E45; Mon, 16 Feb 2015 14:51:30 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1424098289!11972453!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.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9114 invoked from network); 16 Feb 2015 14:51:29 -0000 Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 16 Feb 2015 14:51:29 -0000 Received: by mail-wi0-f176.google.com with SMTP id h11so26541690wiw.3 for ; Mon, 16 Feb 2015 06:51:29 -0800 (PST) X-Received: by 10.180.97.226 with SMTP id ed2mr13215950wib.4.1424098287780; Mon, 16 Feb 2015 06:51:27 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id dj5sm23172398wjb.28.2015.02.16.06.51.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Feb 2015 06:51:26 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Feb 2015 14:50:42 +0000 Message-Id: <1424098255-22490-3-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1424098255-22490-1-git-send-email-julien.grall@linaro.org> References: <1424098255-22490-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 v3 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.215.41 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