From nobody Mon Feb 9 23:45:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=wdc.com ARC-Seal: i=1; a=rsa-sha256; t=1558743114; cv=none; d=zoho.com; s=zohoarc; b=iYZ3+C124193XfhlIWNn7DIE/ZxQZqyXfLwx6e2T9fUpUbcWHpRgPPNlhCQeAca94ghpS3DqPhHdDcT7IsXQvDG9as/5jCKP6Ehgv8rdQQRf/0/KjNZve+yRFrv/EgTVEl/F+cDSkfsI4na960hN2Uqqoh1qsBGjW6eVse/y4e8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558743114; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6Th6sqWh3FPlv6zZ+F5Oa0iZlouwMWnwRmwRSObfCg0=; b=TcDteWYl4FTMYWerjp4YshuGCD5ALuul9ctKG52MhlgklNDHXrvMnIbblhSZ5scPubi6T8P1Boz4mF7gb00APpEPbNgYKazGvVFPM4EfxP1LWhR1i+2Or9tKHGlUPVR0NTc7HPO8RBq93zHjhpJXZIMljy2OpWUPNXFNiVTEjRs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail header.i=@wdc.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558743114201909.6269902648046; Fri, 24 May 2019 17:11:54 -0700 (PDT) Received: from localhost ([127.0.0.1]:33606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUKHp-0001GE-5l for importer@patchew.org; Fri, 24 May 2019 20:11:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUK42-0005Im-R8 for qemu-devel@nongnu.org; Fri, 24 May 2019 19:57:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUJut-0004SM-1T for qemu-devel@nongnu.org; Fri, 24 May 2019 19:48:03 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:23091) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hUJus-0004RV-P7; Fri, 24 May 2019 19:48:02 -0400 Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 May 2019 07:48:55 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 24 May 2019 16:23:20 -0700 Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip02.wdc.com with ESMTP; 24 May 2019 16:48:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1558741737; x=1590277737; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FOZ5qxSOFi83IoijU4WlSRPh1QAki9KyRu0FsUUmoos=; b=NQ5B0mwQpHh+WGXQciUMbwCjg5w9/m6V0Wfek4HuYZDTfyZJiZQ2SmPC kZos4ltGw4mPKJl5Lq5GbSqGQHEvHDfOZFSc3d0OMgDHB3LYrwhujjszA DX3v8nhQUQ8gx5tVjPEBLnvp4hco+3WInIYo6lhHbaTrwEGv5J/xx1FnY 6Q5BliIWWg6sTfryDSClrlYP1lpljfFG3b6WDGon/MhxkHY5kJd1Re/7D fewgW7JF6szP18m7ypsKlfUpG9I7yn1IWffX7VsrsLz/uBT9Dxk3kPHlJ qL2RivKoXIHBc/b7684Wz+aXXWNFtzrgeDHngHhS1gwVgIQpVghL+yS1k g==; X-IronPort-AV: E=Sophos;i="5.60,508,1549900800"; d="scan'208";a="208574746" IronPort-SDR: 0nrW5Y8716OjCMK6bwuQuFYuJ/TZWIiCiR1686wrdJEBUWRoFfzvMf5nDz1JQ4QTjGPeR/FYg5 l46gp9s93oDUZHEL5vjtCoOm/JqDwrru2qp99+t6CWh3FPiuYAFdp42BPL1wsq49ev8MvXFPCV JaPtQ0SuEbvi8+8i3hMwAKIyd7ebOHV+5Rpcrw3ost6/3/nypAjDVmKCy9LNhDKbjOubPRVFfN a7JWuboKkSMkI8A6oKljepBnI0Hr4oQpFe0GKFl5XpPLPoRcjLvZuohQzzsU2wCsxydAXtfR5j styanpQSWuWkH9sdsPQ07+u3 IronPort-SDR: H5y4FZT1AzMPJPTFs9NlXdoKraJXWK/8i9bCQRqmqpDKaUU9pSBUzY4bEVHjk7pRbyTFUxq39c FNu2u7VOj7fC81GdA9Qu1JhUBwkOajDqsg9+iD2rYFqC9a4/zUAZaPakXEEiH6b5KcUqcA8KYL cJy8uw566pKtnEzyLQ1buXAO8qiDXTdkrXx4aMqDFCknhkte47x1yu4Kl3HzEzHVHHepH7DLfP MykRPGVUoz1sQvQST2EawB/SEWuEOR7Geayou3QEXJarZSeB+QyBmQldCfmiQHqjKBJoe+/izE 40Q= From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Fri, 24 May 2019 16:46:06 -0700 Message-Id: <8f3c0035f813d1294c77aa58238853274f631feb.1558741334.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.143.124 Subject: [Qemu-devel] [RFC v1 12/23] target/ricsv: Flush the TLB on virtulisation mode changes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" To ensure our TLB isn't out-of-date we flush it on all virt mode changes. Unlike priv mode this isn't saved in the mmu_idx as all guests share V=3D1. The easiest option is just to flush on all changes. Signed-off-by: Alistair Francis --- target/riscv/cpu_helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 0128546e6a..81f1cc83e5 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -157,6 +157,11 @@ void riscv_cpu_set_virt_enabled(CPURISCVState *env, bo= ol enable) return; } =20 + /* Flush the TLB on all virt mode changes. */ + if (((env->virt & VIRT_MODE_MASK) >> VIRT_MODE_SHIFT) !=3D enable) { + tlb_flush(CPU(riscv_env_get_cpu(env))); + } + env->virt &=3D ~VIRT_MODE_MASK; env->virt |=3D enable << VIRT_MODE_SHIFT; } --=20 2.21.0