Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1231798ybh; Thu, 12 Mar 2020 20:15:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvI0UwSkQLkU8dljbEIRU7lcRAPV/0LuG4XfsLPvNA6rcWKCzwscPHNHmPZusllbTcbzftH X-Received: by 2002:aca:49d8:: with SMTP id w207mr5093302oia.85.1584069308287; Thu, 12 Mar 2020 20:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584069308; cv=none; d=google.com; s=arc-20160816; b=uihM9HRJgnrRLeFAQPHAQkJZ1XKWEidIGnKaqCyeylFqdBWEMsbVuxgIYPhh/5srMg xagNVZrxmYt19SrylLHahAuTTu/VzU90rl23PXHaeW1ut3ruq+1kEQs0iG3ChdATa+3W tQYVJIA5fOqWBV/rz5X0xPgOkt8OAfTPx6F6AOV9OcDpYzm13KfCL/XcghIvwK5Yc4Vg vkylpz2VJH+1tXyDvfquCZCE47cDmEigG/O2l4b6yPjGni2KncHU7vgyK5Vai4Jc5y5i /q7rTI5CkQZ2XreCfxPBAtDWRlI0CNvNK4PczsonhvBP2owOxT54sk+CmfEW6jnsx6/m BoGQ== 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=Mgc499aUDB/mt2y3DN/3xzICbE6SO4PDrbN31GHRIr0fExLmptoAlvtyFcgJJVUTCM ybpKaEambq8KPOLFU2G73h8Qxo5Wq6yHUFz6GYNhdvVk8WJOUY50wq7UAQnuSt8XOBES nB6NeAHTI05PmhpI7NiLaDsZb+YkR40XU2gOGHZwox0zLqRa9B6TH8eygKRo2SGHMgqK Gy4WcMWCc8uOEImYDoPhkpqS3GIoibvn2xYQEgpNaIv8HnxcNB4i0ZHEsoOr4b4ar29m YF5KnqtWkn8Djge2XsRSALNvNRgVCR2LieJcNszVPLUkCRtdONLxn+7V3k37iUw/dVhq Ay4w== 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 u63si1812447otb.49.2020.03.12.20.14.55; Thu, 12 Mar 2020 20:15:08 -0700 (PDT) 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 S1726582AbgCMDOc (ORCPT + 99 others); Thu, 12 Mar 2020 23:14:32 -0400 Received: from mail.loongson.cn ([114.242.206.163]:55508 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726310AbgCMDO3 (ORCPT ); Thu, 12 Mar 2020 23:14:29 -0400 Received: from localhost.localdomain.localdomain (unknown [125.69.47.232]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxn9uK+mpe1gcaAA--.45S3; Fri, 13 Mar 2020 11:14:20 +0800 (CST) From: Xing Li To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, maobibo@loongson.cn, chenhc@lemote.com, jiaxun.yang@flygoat.com Subject: [PATCH v2 Resend 2/3] KVM: MIPS: Fixup VPN2_MASK definition over 32bits virtual address Date: Fri, 13 Mar 2020 11:14:16 +0800 Message-Id: <1584069257-30896-2-git-send-email-lixing@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584069257-30896-1-git-send-email-lixing@loongson.cn> References: <1584069257-30896-1-git-send-email-lixing@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r0_Gr1lIxAIcVC2z2 80aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUjLSdPUUUUU== 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