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 7794FCA0ED1 for ; Fri, 30 Aug 2024 02:11:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjr66-0004dj-RJ; Thu, 29 Aug 2024 22:10:46 -0400 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 1sjr64-0004ck-RD for qemu-riscv@nongnu.org; Thu, 29 Aug 2024 22:10:45 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjr60-0003G9-1D for qemu-riscv@nongnu.org; Thu, 29 Aug 2024 22:10:44 -0400 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3df04219e31so752631b6e.3 for ; Thu, 29 Aug 2024 19:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724983838; x=1725588638; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=86rrgtTasmcAG9isTT9JLQYWKDm2+3/+UxwghN5qvxw=; b=L7dXOJnkCq85LUC/UZYmRJEMgKEKaorl4vyNLMIvEaU3vU8zODM5e84C9SGIRFQX8u 45P1GKSRLqXZ2Z5RXnca4B+qs6kQZtcCzo9BeoZimHS4GhNMqxmOhHUiLsYtt/uHke5b ZeCzyOGeFeHhjAQLlSD9KdSJ6/jqOD+TmUCe5lClgv5xvYlgQc5czr/vERMohLyQeV+O bC7yriVjLc/JkA2b88GQ5T4HabjXj9QluB3VmKZd4AiQ+Xd5BHI9J718QPIuvVG/N1N6 shzMAIWZ4PsX3vL2gHm632y8iKzTklVt1iJwnkhq3/HcdpXUHwIYe6XN+yGyaXc/Nqbk MklA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724983838; x=1725588638; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=86rrgtTasmcAG9isTT9JLQYWKDm2+3/+UxwghN5qvxw=; b=p0wQcHB9e8W/mrXtcm/nqGNuvXyoPF0W2ZV5bq8pDKffL/KqiS5h+qJrHcLn3gK3jx OHBuFsJZhEqK4eO1Q38kWn2ZFRwaVSyO5aiSGig8NK+aYO7FzzQHWij4FFzsABlBzGYH X72PkdfZBVPYnB1QXh7AuF8gMn5GitTyr/1yrJrQ4bwx+BSBDzVivnU3TJoMFtxHOH38 lu+4F09qR/8fuZnoH0HfSbR4pIydkfCUHqybA/vMK8GXioBgyTqlsAWS8kNlTchZvVSU 23YTtLFuY4acpEsomk79Lz/Y4MzmKzDN8Y+1fiudjje6mnvnMfuip2DJzHicoWvtACua OPEQ== X-Forwarded-Encrypted: i=1; AJvYcCUgH2pFTyXJAcf7YG6xKWiWD4nrn0Ml0jUQ9xE2qokTQZcCjUsHJwkySUVBaNo0c8/MG6aOCqCdNQY0@nongnu.org X-Gm-Message-State: AOJu0YyE0NGYT0Ndwq9sXuAEmQcr57nL8Dh3jwwNUKpvkeT5Lk0fIBHt ycnDTSHRH9ZkOhxTmbGwpi7KMiVEZHd01TAkZyYTlx99CVyIPhEdOxmDW/R1sHw= X-Google-Smtp-Source: AGHT+IG4FF7GsrFkvqI2efwWRrgcrUHnfmEgZbRwP9b6aEMHUqo5Ei0KLKRJWnHOQ9RQPZuZha6pdg== X-Received: by 2002:a05:6870:d10c:b0:265:b32b:c45f with SMTP id 586e51a60fabf-2778fd683d3mr5270024fac.0.1724983838059; Thu, 29 Aug 2024 19:10:38 -0700 (PDT) Received: from ?IPV6:2001:8004:5100:1c02:35b7:18d3:3fc5:9f02? ([2001:8004:5100:1c02:35b7:18d3:3fc5:9f02]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-715e569edc9sm1778987b3a.138.2024.08.29.19.10.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Aug 2024 19:10:37 -0700 (PDT) Message-ID: <7e4ee645-41ba-4a6b-a004-df396faff65b@linaro.org> Date: Fri, 30 Aug 2024 12:10:29 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 01/20] target/riscv: expose *envcfg csr and priv to qemu-user as well To: Deepak Gupta , qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: palmer@dabbelt.com, Alistair.Francis@wdc.com, bmeng.cn@gmail.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, jim.shu@sifive.com, andy.chiu@sifive.com, kito.cheng@sifive.com References: <20240829233425.1005029-1-debug@rivosinc.com> <20240829233425.1005029-2-debug@rivosinc.com> Content-Language: en-US From: Richard Henderson In-Reply-To: <20240829233425.1005029-2-debug@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 On 8/30/24 09:34, Deepak Gupta wrote: > Execution environment config CSR controlling user env and current > privilege state shouldn't be limited to qemu-system only. *envcfg > CSRs control enabling of features in next lesser mode. In some cases > bits *envcfg CSR can be lit up by kernel as part of kernel policy or > software (user app) can choose to opt-in by issuing a system call > (e.g. prctl). In case of qemu-user, it should be no different because > qemu is providing underlying execution environment facility and thus > either should provide some default value in *envcfg CSRs or react to > system calls (prctls) initiated from application. priv is set to PRV_U > and menvcfg/senvcfg set to 0 for qemu-user on reest. > > `henvcfg` has been left for qemu-system only because it is not expected > that someone will use qemu-user where application is expected to have > hypervisor underneath which is controlling its execution environment. If > such a need arises then `henvcfg` could be exposed as well. > > Relevant discussion: > https://lore.kernel.org/all/ > CAKmqyKOTVWPFep2msTQVdUmJErkH+bqCcKEQ4hAnyDFPdWKe0Q@mail.gmail.com/ > > Signed-off-by: Deepak Gupta > Suggested-by: Richard Henderson > Reviewed-by: Alistair Francis > --- > target/riscv/cpu.c | 5 +++++ > target/riscv/cpu.h | 9 +++++---- > 2 files changed, 10 insertions(+), 4 deletions(-) Reviewed-by: Richard Henderson r~