From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7978CC433E2 for ; Tue, 16 Jun 2020 15:42:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57965214DB for ; Tue, 16 Jun 2020 15:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322125; bh=NBVUODQbI1T1MtGAlUTn/rshWC+w1j++5qEaRVUjYSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DrgPJLCVoEAPH0MRZ2YiR+KbqXO36zFhGfowCODaMoDOWgnYPSMxtlpBTrRIy9W9t nWF4+nmmhO8M3lBGLTBBYmpfZ21l/LRxPq+dYx0ZKzcDl1mLaHwPrglupdNaYl2s0H q6h7hMOmT53E+w6CDn39eQLYCvZ7/Ii8oyz7PYKM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731599AbgFPPmD (ORCPT ); Tue, 16 Jun 2020 11:42:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:58174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731573AbgFPPl7 (ORCPT ); Tue, 16 Jun 2020 11:41:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37C7720C56; Tue, 16 Jun 2020 15:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322118; bh=NBVUODQbI1T1MtGAlUTn/rshWC+w1j++5qEaRVUjYSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmGqvV/wEAH3fvmH4XQzvclCB6VVJe+m9zimiXs1ourjcfGzLHS0+uOx5hHPd8RvY ntpYs35+fvloW/r1uwMu33srHsz2Om3Ne7/M/J3gFgG/KGFwmlo+ZZXawcfKBzRn6U 0wVDO7y7xJa3qETp+12eHrU9RXF7oPrZ8uxwypc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksandar Markovic , Xing Li , Huacai Chen , Paolo Bonzini Subject: [PATCH 5.4 107/134] KVM: MIPS: Fix VPN2_MASK definition for variable cpu_vmbits Date: Tue, 16 Jun 2020 17:34:51 +0200 Message-Id: <20200616153105.911183925@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153100.633279950@linuxfoundation.org> References: <20200616153100.633279950@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xing Li commit 5816c76dea116a458f1932eefe064e35403248eb upstream. If a CPU support more than 32bit vmbits (which is true for 64bit CPUs), VPN2_MASK set to fixed 0xffffe000 will lead to a wrong EntryHi in some functions such as _kvm_mips_host_tlb_inv(). The cpu_vmbits definition of 32bit CPU in cpu-features.h is 31, so we still use the old definition. Cc: Stable Reviewed-by: Aleksandar Markovic Signed-off-by: Xing Li [Huacai: Improve commit messages] Signed-off-by: Huacai Chen Message-Id: <1590220602-3547-3-git-send-email-chenhc@lemote.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/mips/include/asm/kvm_host.h | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h @@ -274,7 +274,11 @@ enum emulation_result { #define MIPS3_PG_SHIFT 6 #define MIPS3_PG_FRAME 0x3fffffc0 +#if defined(CONFIG_64BIT) +#define VPN2_MASK GENMASK(cpu_vmbits - 1, 13) +#else #define VPN2_MASK 0xffffe000 +#endif #define KVM_ENTRYHI_ASID cpu_asid_mask(&boot_cpu_data) #define TLB_IS_GLOBAL(x) ((x).tlb_lo[0] & (x).tlb_lo[1] & ENTRYLO_G) #define TLB_VPN2(x) ((x).tlb_hi & VPN2_MASK)