From patchwork Sun Jun 4 20:20:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9765251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1614D602B6 for ; Sun, 4 Jun 2017 20:21:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0910427F86 for ; Sun, 4 Jun 2017 20:21:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F23EA27F89; Sun, 4 Jun 2017 20:21:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 862D527F86 for ; Sun, 4 Jun 2017 20:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=3VYX6RfBn6cyz/oT25OI8bOG325/ffONYBqekhkGG2s=; b=UdJ VBR8RBtSH4S03m+zvl5H2BxZWvYU5vNUSCSRMdsQvUckaqrDrzwE2gQ3nwvaHspvRn1GJ4McRxJ2U k143sv8Y4JMkZetZMyTFftG4P3F4l9KzYGtwieqUICJ2sE5W0D+pVGHxVqcSFEpsBUTUQA/Qknkzw EIqFNYyHCdT+wirxIGXP4goHK9U83SC8H3CUefuJrHsr22cEQMaUy+CDG6fYdKltM4lw4z7iVlo6U qQMNlrcJb1MwkwI5rx5MdFGi5HUjA9SRsFdC49S6geaWXnuW+w9QloNT7ediQFUq1GIarQNYgI1wM PxUGg/9pWyeP53pHKSCoU+JAnLYaf8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHc1U-0004CG-Qm; Sun, 04 Jun 2017 20:21:16 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dHc1L-0003mp-Tc for linux-arm-kernel@lists.infradead.org; Sun, 04 Jun 2017 20:21:10 +0000 Received: by mail-wm0-x231.google.com with SMTP id d73so10125491wma.0 for ; Sun, 04 Jun 2017 13:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ovkMQSQBttNtBM1/rbaZVm+Sz6TiJ3qrCKJWNkzvDYo=; b=QtE7nS/Lyp3PAZKlZXG/xW5uBEkKXzLg+gOFcc7ErrCdctt6R9lTmPdRJDXsbIfHEG ncslaKNG12s4BAVb9XsVo7ZRJNYSPKaPV4bxpvUCNwCAimMyDUcq7smK6eXmbaX1G/0y 8zFiWuoRXny5CMoVOgOwMP4V82PHuKAmOA/yU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ovkMQSQBttNtBM1/rbaZVm+Sz6TiJ3qrCKJWNkzvDYo=; b=h4Ny0Atc0Aj2Bv+JOkACZ5Pe/UQJLNFR46jdzl5mo5zSgXJWVoqeqbr6KmTPVhMvT9 uW4vsu/yK1hKSUpl9z8nVSDvuVHX9dEHroGPHIDxtIQLKmdekSMGSKmLJ7fM+hWmcOjd U6yTlrbPZiBGZSxpg9lpb+TbFcGz46TTlisgVTkR9PsqZ6MV+UvBvcVdUzEZvz/K14Xh pIVp8dBX1xad84TBwmG0RoCleBBNO/UD146QWSzBN+mJr+bVAgdCVQN4RtKQ9EFu/jUu ZDuEBxHgSY1YkomUpB+bJmhLF4ZAR1oEvbsSG+VtNLypyXcuc3g49LkteAV+71fk9e+M shFQ== X-Gm-Message-State: AODbwcBTuTciC+k1DQUA6M2pxE7tEF3GjGq0VOSc1a3KaT41SIiZmtFz dUKPOKNchwiMFyhL X-Received: by 10.80.218.12 with SMTP id z12mr13695213edj.136.1496607646369; Sun, 04 Jun 2017 13:20:46 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id w26sm3643350edw.28.2017.06.04.13.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Jun 2017 13:20:45 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction Date: Sun, 4 Jun 2017 22:20:28 +0200 Message-Id: <20170604202028.13719-1-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170604_132108_207776_714EA055 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We used to extract PRIbits from the ICH_VT_EL2 which was the upper field in the register word, so a mask wasn't necessary, but as we switched to looking at PREbits, which is bits 26 through 28 with the PRIbits field being potentially non-zero, we really need to mask off the field value, otherwise fun things may happen. Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- virt/kvm/arm/hyp/vgic-v3-sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c index 32c3295..8794036 100644 --- a/virt/kvm/arm/hyp/vgic-v3-sr.c +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c @@ -22,7 +22,7 @@ #include #define vtr_to_max_lr_idx(v) ((v) & 0xf) -#define vtr_to_nr_pre_bits(v) (((u32)(v) >> 26) + 1) +#define vtr_to_nr_pre_bits(v) ((((u32)(v) >> 26) & 7) + 1) static u64 __hyp_text __gic_v3_get_lr(unsigned int lr) {