Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp775053ybt; Fri, 19 Jun 2020 13:26:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZy1PoDTA3McNpDflx7qdt6FoSqPvwlCE43u2iVzDt5m6UGa8vxb+cwLWEGyIwOTYu7CKu X-Received: by 2002:a05:6402:3c1:: with SMTP id t1mr5262612edw.350.1592598390368; Fri, 19 Jun 2020 13:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592598390; cv=none; d=google.com; s=arc-20160816; b=cRmIciGKjtnY4g+mWZYPr4JmSMjczORnH+mYee+sIiRN7/uj9x9HKIVSGbbj5THFmZ 4lyGDR4fOCP4OMG/PG/VpQhoe5RilcFY1N6s+EwgZklchdIRPzGlN9jWWc49qJfWvfO7 p0B/voeHphLdSjpm8q+9sDnMf2gkqsE1F7NhUBWOtYkCbqrAzjTpYN/lmlURV+MADR/+ gYAGzCXNM8Zv2qSFcFcsEFz4U79NPmnmwgU+DDSetRodsfjOl3ZJRTQp8bb14wjyCmiZ LWx2yho7bWc2IZybZqqZ35z491hQMXENw+sTuKB5I6wmNcPaVFKiCtwkmlugBgpsSZM4 DEcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=omoGSLPxKYv2UMnbw3DtJyhTRas0/+A3EM0bA5QTYEY=; b=iomUA6Pqf2HvbJxEuVCeRe624/VybNXJQFwAYSK3qq0h3PLLwZmDeRoM9XY0JpPqNn igurywnwN2NpGO2t8SSwcnZlBEGdfgjUUK5rtHYQBRCZxPJNWoW0FPCD6hc3kcn+Vqtc m2grB8X/uLiCW/J4hEbiLPv3wz5ohLSsVC+RtK/zZ7pCY9xYBB0B7wUszU1GRH9IbyG6 4ts99HzRYXFEzeYeMb98VlJhjW/qAiLUrRE8hxfYj+I6lazS4RdOSACaOjC7NQ15u80J m0MqtXlxjg/ngLBO9NEdcb/qKnvHsv7O26EoP4sy6RtEqdIHiq/eze7j3eM7wSfy9FIy A1/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UinJH23+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si4668897eju.219.2020.06.19.13.26.08; Fri, 19 Jun 2020 13:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UinJH23+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390097AbgFSO4g (ORCPT + 99 others); Fri, 19 Jun 2020 10:56:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:51276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389392AbgFSO4S (ORCPT ); Fri, 19 Jun 2020 10:56:18 -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 DBF802158C; Fri, 19 Jun 2020 14:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578578; bh=NBVUODQbI1T1MtGAlUTn/rshWC+w1j++5qEaRVUjYSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UinJH23+5k9vWTENHDz/2sb8okp0HErAMdsfi1OA0GN1sj+ddbTV8R/UBnpW5JFpn QeoAouLY5Vp3Iln1CldhXtzOje2SOpzym0Re3M7F5KGbALA+e9do5GAsN5dZ5gjwlX HU4u1Gc+uqE6VByq3IFtQX0c2i5Rs2Eg9IphoiNM= 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 4.19 075/267] KVM: MIPS: Fix VPN2_MASK definition for variable cpu_vmbits Date: Fri, 19 Jun 2020 16:31:00 +0200 Message-Id: <20200619141652.500182542@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@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)