From patchwork Tue Jun 6 13:56: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: 9768931 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 F080D60364 for ; Tue, 6 Jun 2017 13:57:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCB9F269A3 for ; Tue, 6 Jun 2017 13:57:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D12B4274D1; Tue, 6 Jun 2017 13:57:21 +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 6F9DA269A3 for ; Tue, 6 Jun 2017 13:57:21 +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:References: In-Reply-To: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:List-Owner; bh=nzqH+DkjbrYAXWz12I4cKmGU7KNc7TcvPGJHKVqPZlU=; b=QUyHEt59gNOWm/AroBATCSrOKH Wrx8FkO5PpX5uB2fZLu5tABl+VFJ0tCZtcsjAKaPR3c/kYGEOWoGJZFt1Os4P4/VQYkdHLuGcRy9P A2Bqn5D3bcDpMjKzqYFFaM6MeOFQpuRLZNxfBWow5Hfvy1oLnAUOtlBdiB1OpgRSphPlRBs/OUCyI p2ydUvi5cAsA+rIUOqHffJKpOrZIdrUMaHAIpffRY17Umucp1Rg0TWnOYgpm7IGnN6oBWmuMqJWWN YsK1fRFIoi8whaMGljl4XzC32bEyUbC0yvBcCVMXM0dF7NrBHEEUQ53QLVLhBnPnR3LZYBftfyemr lMmN2lqQ==; 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 1dIEz1-0005zo-R7; Tue, 06 Jun 2017 13:57:19 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dIEyp-0005l9-Mp for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2017 13:57:09 +0000 Received: by mail-wm0-x230.google.com with SMTP id x70so37753198wme.0 for ; Tue, 06 Jun 2017 06:56:48 -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:in-reply-to:references; bh=v++pkAawUB8XNrwnubcLnJngBVYNDXjXT+4slkYM6tY=; b=QsCy3yZiSTZIq3sqhGDKUSbgw1PLi0xP9NJb16odY2gJSyMWc2ia5axG0MXOQb7JBY 54VfQ76u39M5J1X4sjR6Hc5eGYmgZ2u9NDs/3iTu4YGhNfRgvqG/917JQ9uS+pz9u1FT SySn80DB8uKscrFyj33Yo3ZcTRLSaFbftusUQ= 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:in-reply-to :references; bh=v++pkAawUB8XNrwnubcLnJngBVYNDXjXT+4slkYM6tY=; b=t+C6f7M7rRWUiHSh4gl+WwFwuclR9o0ReSiR5sR3XNvjcTmTuXG5KltbgP0ddSOkLy cCSvB39pq/LNVHiLU1Kg8m7SRar0M5QbzDQAFQ7eV27Br4nZP5zRoKuC2x+p7GVn1vdE U3tQr2X01fu18iC8NI5Q7LTdjoKRonp7sFP+CabiqStKOYMlNMvbSNdYESnK+goydAXl rAMOa5pqa5SxPE2xmygcT8iZ5CLdFdyuvyTBgQvqVUa3DrFXFrKWB9hI/OGdBcb6hiAk 6Vkv0am7kVYD5aqk0iEhD3eRUSO17kK9YeY1cGINRJn/TuOViXoFCM4pZbpbI4i3o3JZ kzJA== X-Gm-Message-State: AODbwcDHv7IvEbMd7Evtm9WiGRpz2d4EDpILa7wnCz6Z8WgqFNGGw2jO eIAE4RM5aIKTNS1p X-Received: by 10.80.166.101 with SMTP id d92mr20454698edc.132.1496757407084; Tue, 06 Jun 2017 06:56:47 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id b30sm14791532edd.6.2017.06.06.06.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 06:56:46 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 2/3] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction Date: Tue, 6 Jun 2017 15:56:28 +0200 Message-Id: <20170606135629.31664-3-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170606135629.31664-1-cdall@linaro.org> References: <20170606135629.31664-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170606_065707_898868_4162ACF5 X-CRM114-Status: GOOD ( 10.23 ) 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 , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.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) {