From patchwork Wed Jun 7 17:11:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9772051 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 8D01A6034B for ; Wed, 7 Jun 2017 17:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FC5926785 for ; Wed, 7 Jun 2017 17:13:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3305127165; Wed, 7 Jun 2017 17:13:17 +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 0F4D9283B9 for ; Wed, 7 Jun 2017 17:13:16 +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=TDB6WIeA2E0VRu1kGoPr49UnUi N9d8/9o5wPu5qUdOoTRXDxQqp+fe5To+dnR4GIPuVr0tFdALogCU1cl9K5b+fk7KVeM/OZ1ocxM12 XIpZp5QYKHklMIl6IuP/ve1TYQxfAFl086ivuLHr1WFPH1tlhjum3zGGWvlHfO6bWjQc5zA1U3jHO iumfjzBU/X2lWLQVh1KPtQ96BrcjyynSYdGim9LjRhQhtufv7CmcrLcKh/F2KKRTlAbRHBIadYdMG oEGh8V9XD9QCAeabQSK8dO9EE3OslsDKyLXLGAyMT10xKv7lfZc5uUO4RVA6z7TF6XAX/QIxqaU24 yaFbvkow==; 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 1dIeWA-0005Qu-UG; Wed, 07 Jun 2017 17:13:14 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dIeVT-0004pI-52 for linux-arm-kernel@lists.infradead.org; Wed, 07 Jun 2017 17:12:33 +0000 Received: by mail-wm0-x22f.google.com with SMTP id d73so15625695wma.0 for ; Wed, 07 Jun 2017 10:12:09 -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=X2lfmgCfRZTX4PL030rc6rMQ6n6mZkXcLS3R9cStyToQpWKEyOcIa22vg0KZW+dxwQ uqwdAjpu75Y+7ewL/bHMoTu/1+PICi60CfXWZ1l1FiL+u7cvZRwV04doorQ0lnr4E0/6 3Ddne74E7P697N9ZQJrq7IylJcYhOQPs+g++Y= 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=sFECXFr67qPB2GwaEXR2DKrauOjjb6h2s/8ul8gVhWoJ7ZJoc3/OAB4TSZRlV9XjXQ jfIjqtfj9LxR0nOTn4GnSFUOy5V+S5SVoK5dMRilOkrt8GZKQkH9m401iGpRkE19dQ+p InR4YPn/YOYOaV877sNh5uYz5PQ1lKEDJClyg2IXdbYm37zniEQTdo/ThXHDaFW/EpJ8 MRsy6yRHlBnDTi8KAz0ixag5crw9HLH0JWVddNK1icKrJ5SzK81CsDnn/HuBilAZUE7V 3IKRTf4C4KLNJeO66XuUvnHq+UtYT0oDB97r5s+VEPiUnUuhGJ7Zn34w824LUW3Hv3az tjxQ== X-Gm-Message-State: AODbwcDlm3FQEs6tAUb2QXu3uI062ih+9b87++IgCyQ6YKDSSIqAojuT 0UMTP1ryeNt0fB2V X-Received: by 10.80.136.43 with SMTP id b40mr25982102edb.25.1496855528290; Wed, 07 Jun 2017 10:12:08 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id c2sm966244edc.34.2017.06.07.10.12.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 10:12:07 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL v2 2/6] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction Date: Wed, 7 Jun 2017 19:11:48 +0200 Message-Id: <20170607171152.21874-3-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170607171152.21874-1-cdall@linaro.org> References: <20170607171152.21874-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170607_101231_372164_E39053CF X-CRM114-Status: UNSURE ( 9.97 ) 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 , 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) {