From patchwork Mon Jan 19 16:29:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43323 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 346272034D for ; Mon, 19 Jan 2015 16:32:00 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id b57sf2409540eek.0 for ; Mon, 19 Jan 2015 08:31:59 -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=wXt8cZceoadqbQDGvA8kODJ9wGSU980Q5VshalH9Ato=; b=jjA0dpee+7EN9CfozatbpauAesgyIMItt0rF+nVmTaOGGyCSwpAbyWG0j3jzTV1H0+ Nm0TMaqynSpglastgr4woEuE5g0+cUyyk0o+nf5cXsTVZsJ78HTfsngq2+OH1EjI3zPg 8q2IrXQsPxjwnU5Qj6j+oz0hWQMUw+AH/yRY2yCvtfN/5Gy2fBQDKX4D9KHZNSMzZJnM sGR9YEZPgC4ttF2qm5X+R2F6CMpICBkD16cuWZ/+teIpFgg6wTeVRj1M9RRtjsfey6Fl TKIMbDJlPrYz/IPwsVU8JABXamIBows1YbL64t3N8ZuZNXpsUH36/jRxqi8BSKZ6rzP/ PAxg== X-Gm-Message-State: ALoCoQmCx8Gs9b7OdHmr4PU3GOoPLeWUxw3cYLzKqK9aKyLRezE9Qp5h4j6rIM5pGay8PYBVjlxP X-Received: by 10.180.108.197 with SMTP id hm5mr172904wib.4.1421685119303; Mon, 19 Jan 2015 08:31:59 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.1 with SMTP id s1ls629680lal.23.gmail; Mon, 19 Jan 2015 08:31:59 -0800 (PST) X-Received: by 10.152.163.100 with SMTP id yh4mr5686758lab.98.1421685119133; Mon, 19 Jan 2015 08:31:59 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id ln11si13778310lac.114.2015.01.19.08.31.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id s18so8865117lam.5 for ; Mon, 19 Jan 2015 08:31:59 -0800 (PST) X-Received: by 10.152.27.8 with SMTP id p8mr25903799lag.69.1421685118991; Mon, 19 Jan 2015 08:31:58 -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.9.200 with SMTP id c8csp1144660lbb; Mon, 19 Jan 2015 08:31:58 -0800 (PST) X-Received: by 10.140.85.100 with SMTP id m91mr45672770qgd.7.1421685115690; Mon, 19 Jan 2015 08:31:55 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id i47si17925721qgd.126.2015.01.19.08.31.54 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:31:55 -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 1YDFD7-0006Pc-C9; Mon, 19 Jan 2015 16:29:53 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YDFD6-0006Os-Ai for xen-devel@lists.xenproject.org; Mon, 19 Jan 2015 16:29:52 +0000 Received: from [193.109.254.147] by server-9.bemta-14.messagelabs.com id C8/E7-02712-EF03DB45; Mon, 19 Jan 2015 16:29:50 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1421684989!21518848!1 X-Originating-IP: [74.125.82.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 29908 invoked from network); 19 Jan 2015 16:29:49 -0000 Received: from mail-we0-f177.google.com (HELO mail-we0-f177.google.com) (74.125.82.177) by server-9.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 19 Jan 2015 16:29:49 -0000 Received: by mail-we0-f177.google.com with SMTP id l61so10702685wev.8 for ; Mon, 19 Jan 2015 08:29:49 -0800 (PST) X-Received: by 10.194.201.103 with SMTP id jz7mr50305560wjc.14.1421684989003; Mon, 19 Jan 2015 08:29:49 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id fw6sm14830368wib.1.2015.01.19.08.29.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jan 2015 08:29:48 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 19 Jan 2015 16:29:08 +0000 Message-Id: <1421684957-29884-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421684957-29884-1-git-send-email-julien.grall@linaro.org> References: <1421684957-29884-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 01/10] xen/arm: vgic-v3: Correctly set GICD_TYPER.IDbits 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.46 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: >From Linux 3.19, the GICv3 drivers is using GICD_TYPER.IDbits to check the validity of the hardware interrupt number. The field IDBits in the register GICD_TYPER is used to know the number of interrupt identifiers (SPI, PPIs, SGIs, LPIs) supported by GIC Stream Protocol Interface. This field contains the number of interrupt identifier bits minus one. Signed-off-by: Julien Grall --- This patch should be backported to Xen 4.5. Without it any Linux kernel > 3.19 won't boot as a Xen domain. I'm wondering if we should add a release note for this bug. --- xen/arch/arm/vgic-v3.c | 16 ++++++++++++++++ xen/include/asm-arm/gic_v3_defs.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index c738ca9..8420c09 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -671,11 +671,27 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info) vgic_unlock(v); return 1; case GICD_TYPER: + { + unsigned int irqs = v->domain->arch.vgic.nr_lines + 32; + unsigned int order; + if ( dabt.size != DABT_WORD ) goto bad_width; /* No secure world support for guests. */ *r = (((v->domain->max_vcpus << 5) & GICD_TYPE_CPUS ) | ((v->domain->arch.vgic.nr_lines / 32) & GICD_TYPE_LINES)); + + /* + * Calculate number of interrupt identifier bits supported by + * the GIC Stream Protocol Interface + */ + irqs--; + for ( order = 0; irqs; order++ ) + irqs >>= 1; + + *r |= ((order - 1) << GICD_TYPE_ID_BITS_SHIFT) & GICD_TYPE_ID_BITS_MASK; + return 1; + } case GICD_STATUSR: /* * Optional, Not implemented for now. diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h index 13adb53..6214663 100644 --- a/xen/include/asm-arm/gic_v3_defs.h +++ b/xen/include/asm-arm/gic_v3_defs.h @@ -18,6 +18,10 @@ #ifndef __ASM_ARM_GIC_V3_DEFS_H__ #define __ASM_ARM_GIC_V3_DEFS_H__ +/* Additional bits in GICD_TYPER defined by GICv3 */ +#define GICD_TYPE_ID_BITS_SHIFT 19 +#define GICD_TYPE_ID_BITS_MASK (0x1f << GICD_TYPE_ID_BITS_SHIFT) + /* * Additional registers defined in GIC v3. * Common GICD registers are defined in gic.h