Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3530048ybl; Sun, 12 Jan 2020 20:40:31 -0800 (PST) X-Google-Smtp-Source: APXvYqx4BTDD+/wjctPZw0iZsR9qGbZehvoUI5AUI5jorgilp6KflAM8D2MkwyacmrABLJq6cdrW X-Received: by 2002:a05:6830:18ce:: with SMTP id v14mr7024074ote.36.1578890431486; Sun, 12 Jan 2020 20:40:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578890431; cv=none; d=google.com; s=arc-20160816; b=rS9ZDsjtB5GGD5QswoDJ3b2AsXH0sRIolxrk/uqQx4fOCOM+2ZYbfTcnocE36V2v7/ yg1JFXypdYkM7KJ1r99y0bXaB0hvvykLigugqkdAG7r9kqH2OgyYRIpO8BV3owqaCjPK a+ahcbIy6gGzAqlxj3lYwo/i60CybYN/EBGZTslMVAKolSI/Jl33dEu1XjeyFe3ylHSB Bit5WzSWmku/Tzg+6V6tPMzyMReuL2XV4E7HqaXlazBuzaatS0hh+S66QFEUQP3whVcd +JsJ2VU/7NwhU6/KBNrRnU+iLRHtZxEEZpZqMD/UhexbAXDQwOZXBLAOFS47hdgUSpR5 nSkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=rAgHPJzO86hhVtI8DWSN581bUtikgM/iVHomCekjios=; b=gsBSyCSxgk0M6rLr141GLfdM5cqQHkgqP3P5O2U3jLtxHNRHf4aFZ4IRHtM1+myQss EqHuvXDm0VrQf26nNZdp7mOfdC0OScbQ69GOfv3fE/8R86hm72YQhig0DiBfiS3Vcj2N 7/OZ1648J6Dx2x+lRFF2yWWLQ0InclGcC1iNg6KWisYzotpqx1N+5FPltJJDIlpkIu+5 1ZYG4sW+JksKFcPjKGKZb+2clH9iL65ww7sddm20+62Sqm9Iw6xOotG+hbJSclgyituA 7KQv4hp5nYHgGADBCYN2qAXxEC4Ylmobf0TjQlqSzsBOwR6erftu9MTY0o9CUrU/hfCo A7lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s128si5037617oig.204.2020.01.12.20.40.19; Sun, 12 Jan 2020 20:40:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387600AbgAMEj0 (ORCPT + 99 others); Sun, 12 Jan 2020 23:39:26 -0500 Received: from mail.loongson.cn ([114.242.206.163]:54798 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733103AbgAMEjY (ORCPT ); Sun, 12 Jan 2020 23:39:24 -0500 Received: from localhost.localdomain.localdomain (unknown [222.209.11.32]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxD91s9BteOV0EAA--.4S3; Mon, 13 Jan 2020 12:39:09 +0800 (CST) From: Xing Li To: Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] KVM: MIPS: Fixup VPN2_MASK definition over 32bits virtual address Date: Mon, 13 Jan 2020 12:39:07 +0800 Message-Id: <1578890348-2734-2-git-send-email-lixing@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1578890348-2734-1-git-send-email-lixing@loongson.cn> References: <1578890348-2734-1-git-send-email-lixing@loongson.cn> X-CM-TRANSID: AQAAf9DxD91s9BteOV0EAA--.4S3 X-Corem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07jwXo7UUUUU= X-CM-SenderInfo: pol0x03j6o00pqjv00gofq/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the cpu support more than 32bits vmbits, VPN2_MASK set to fixed 0xffffe000 will lead to wrong entryhi for _kvm_mips_host_tlb_inv The cpu_vmbits definition of 32bit in cpu-features.h is 31, so still use the old style for 32bits. Signed-off-by: Xing Li --- v2: Change VPN2_MASK definition according to Jiaxun Yang's comment arch/mips/include/asm/kvm_host.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index 6be70d5..ef8e606 100644 --- 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(¤t_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) -- 2.1.0