Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87B0CE65D10 for ; Fri, 22 Nov 2024 01:31:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEIVq-0002Dw-4N; Thu, 21 Nov 2024 20:31:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEIVp-0002Dg-12 for qemu-riscv@nongnu.org; Thu, 21 Nov 2024 20:31:09 -0500 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEIVj-00070Y-N6 for qemu-riscv@nongnu.org; Thu, 21 Nov 2024 20:31:08 -0500 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-720cb6ac25aso1288992b3a.3 for ; Thu, 21 Nov 2024 17:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1732239061; x=1732843861; darn=nongnu.org; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date:message-id:reply-to; bh=92YAmZw5ycp/h77RXNXa7Lv4KjKlLVQ4bfD0i3NvNdc=; b=qUDJ0OtxFqQdrkP8ZY+XjGY/Uw+I3GJKkE03ZeamjDIAw8+TiSNEYkhNnqe3HPzhIF CkWvJnQLvOTR7N1ib0FGAavTnSR05sRSXYB19DtfGIUju6uct8cBwLkonYLYSlCYZHVG aR7Rg59XwKKwz6uo8biEjCuKC/+IsjiAeZVPXPm/u2Wg1vgqpvMrz2QeHN3UXrUfzAAL pw/vpuGRHLvT3ok2QNnTs8NI3wPpN87bOxrsGtdfIBSw3wm+rfxYlrS5R2XwnbTHkeKu XS5r2MBhnx9mPSQ8eqmdrYO9E8NEwcolDDgYG40Rx1aoUWeIAlPzV1bnenG2EIPIdrUF LPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732239061; x=1732843861; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=92YAmZw5ycp/h77RXNXa7Lv4KjKlLVQ4bfD0i3NvNdc=; b=Ptcov+EsNQgddJ0V1IwVMiTgH3UrG47hf0hF6NlvcLZlBzCTTUSpxWC3gwMMGf/pP4 OTYE0v67V7woZzu3po6C/oWdnv5yK6+2ZJrZ9ZNuJTLCFriINdAnrltYevfn8/JoWikw Ol6p3iFK4lunWSToY+f8pl75udqBw2PtWGjZplUyiPJ3MkOa/rkUd8/UjusoHU+7dE7l Bnrhz87JU4Gh9Mz0EDVNiDbprALFeeU9zIzZMwIa4zSxGK/YJyhaMvCumvQ6Cp5Q1rCP bVLquhQkyfk/JM9pWwz1ZkdcJ2VYF17EzScO/V3OIpc+2gucZKRGERzKjgIiiDNCk4eB ywuQ== X-Forwarded-Encrypted: i=1; AJvYcCVCrVyas7uYCarmN/8UE/d63Pz1LXQ2w5dlNQQ0GAVfclGsIbloojS4Q3DnY5fM6cB6BD0qmBmnYT2e@nongnu.org X-Gm-Message-State: AOJu0YyEjSOPn1SWe62eLrRJ/FyQXDgcpH6ni2FOZB6yGQJJDhh5YyOn Y9Timh+IsPWTMh2s2T4F18SBtd5WE8tudIUbOsKJclIilRTW6oW7D65WLJ7QXIA= X-Gm-Gg: ASbGncuO4W9Mynv7sfCGvNA5/82usMipg270Mfvi9VLlI+IlMsAwc45aAa6M9XlAwHE 80wmiYEVO95T+Z04Rk7KFiW1rAA0bTZ+0nAmje8+/VfOcgy2azumo9dOQ6hSlIj6HqTIq/Jlvhd GWdDhImvn3JZEXdKBc8HhZLUNqL5TFh6ep6GXc+LlAW7SIsCq/4Ri8pIkjipS2bi+ssiIcXbC+E obCUzZDTyVLqrU7OFUE/Js3HuvhqM+1hmFWOkoOBFrvoUFK X-Google-Smtp-Source: AGHT+IEraRndVoO1zvu8MHa7qYvE/Qugp/gtQeTysZzb9dbUuE1lJ1SvzyreBMgx5juzR/eijjl3XQ== X-Received: by 2002:a05:6a00:4990:b0:724:e1bc:367e with SMTP id d2e1a72fcca58-724e1bc36admr646588b3a.23.1732239060802; Thu, 21 Nov 2024 17:31:00 -0800 (PST) Received: from localhost ([192.184.165.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724de5312fdsm439681b3a.125.2024.11.21.17.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 17:31:00 -0800 (PST) Subject: [PATCH] target/riscv: Don't start user-mode with VILL Date: Thu, 21 Nov 2024 16:32:47 -0800 Message-ID: <20241122003247.8955-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Palmer Dabbelt From: Palmer Dabbelt To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=palmer@rivosinc.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org This is still under discussion in the psABI, but it's looking like we're going to forbid VILL in userspace in order to maintain compatibility with binaries that don't expect implementations to trap whole register moves under VILL (as in QEMU before 4eff52cd46 ("target/riscv: Add vill check for whole vector register move instructions"), for example). Fixes: f8c1f36a2e ("target/riscv: Set vtype.vill on CPU reset") Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/454 Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f219f0c3b5..d19a44de99 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1022,7 +1022,11 @@ static void riscv_cpu_reset_hold(Object *obj, ResetType type) cs->exception_index = RISCV_EXCP_NONE; env->load_res = -1; set_default_nan_mode(1, &env->fp_status); +#ifdef CONFIG_USER_ONLY + env->vill = false; +#else env->vill = true; +#endif #ifndef CONFIG_USER_ONLY if (cpu->cfg.debug) { -- 2.45.2