From patchwork Fri Aug 23 07:17:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2848581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6FF05BF546 for ; Fri, 23 Aug 2013 07:18:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59E18202AC for ; Fri, 23 Aug 2013 07:17:59 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70E1520258 for ; Fri, 23 Aug 2013 07:17:55 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VCld3-0004CJ-1E; Fri, 23 Aug 2013 07:17:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VCld0-0002tJ-U8; Fri, 23 Aug 2013 07:17:50 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VClcu-0002sf-4x for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2013 07:17:48 +0000 Received: by mail-pd0-f169.google.com with SMTP id r10so334718pdi.14 for ; Fri, 23 Aug 2013 00:17:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JNUBXCA8eIIu1PfMQt2LPTP0xcqpIB32fK39lOGlNx0=; b=J8z96onvQt7cYV4nZuZnWTHYdXpfsdL43PAjl4Af8LAcaYD6VRlNiqcBY31e8m4lBK U/9r682OpcrCovV/sU6bNRdAUesBduhWXi1YwyIgTdZPOxPCPChC2ct4pW36HUOSVf43 9tVbsZtisDkHRuuezc5jfu306vG+nkwf3rzOq/HtPgU+Faywsb4LuoVXw7VqPrVScjV4 GGUomS+aw1Xzrt7rhQnBruHaXXKCSAD7jXY1FDFZtvOhPPO3S4YiXWspCHT1wZYnwRWK AZzNrQ+BLe6rkC2vySgVw3bnTK9GO8mMSPwShgI65S7y+FpLTQTTv9Bu8haQiES9QcU4 7iBw== X-Gm-Message-State: ALoCoQnKif/FJ0Sc+Ke0hT4dVQZYWeuj13gJRhnpWkKR/8eHj193AVkp5tv8bFLbX6YAdfOjcOw5 X-Received: by 10.67.1.228 with SMTP id bj4mr9464688pad.157.1377242241687; Fri, 23 Aug 2013 00:17:21 -0700 (PDT) Received: from localhost.localdomain (c-67-169-183-77.hsd1.ca.comcast.net. [67.169.183.77]) by mx.google.com with ESMTPSA id y6sm19591485pbl.23.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 00:17:20 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu Subject: [PATCH] ARM: KVM: Bugfix: vgic_bytemap_get_reg per cpu regs Date: Fri, 23 Aug 2013 00:17:17 -0700 Message-Id: <1377242237-29930-1-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130823_031744_280730_17E54587 X-CRM114-Status: GOOD ( 10.37 ) X-Spam-Score: 0.6 (/) Cc: Christoffer Dall , linaro-kernel@lists.linaro.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SUSPICIOUS_RECIPS, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For bytemaps each IRQ field is 1 byte wide, so we pack 4 irq fields in one word and since there are 32 private (per cpu) irqs, we have 8 private u32 fields on the vgic_bytemap struct. We shift the offset from the base of the register group right by 2, giving us the word index instead of the field index. But then there are 8 private words, not 4, which is also why we subtract 8 words from the offset of the shared words. Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 17c5ac7..96d7aa4 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -149,7 +149,7 @@ static u32 *vgic_bytemap_get_reg(struct vgic_bytemap *x, int cpuid, u32 offset) { offset >>= 2; BUG_ON(offset > (VGIC_NR_IRQS / 4)); - if (offset < 4) + if (offset < 8) return x->percpu[cpuid] + offset; else return x->shared + offset - 8;