From mboxrd@z Thu Jan 1 00:00:00 1970 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 19683C54746 for ; Wed, 28 Aug 2024 00:16:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sj6MD-0000MM-NI; Tue, 27 Aug 2024 20:16:18 -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 1sj6M8-0000LD-0g for qemu-riscv@nongnu.org; Tue, 27 Aug 2024 20:16:12 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sj6M4-0007Gs-V1 for qemu-riscv@nongnu.org; Tue, 27 Aug 2024 20:16:11 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso4414683a12.2 for ; Tue, 27 Aug 2024 17:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1724804166; x=1725408966; darn=nongnu.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=SbKurov/bfQdlfwss06QhJgoXFG6l9nTsHf44bvMfmY=; b=Q03nYiRKanfjLmtZT3Pk+Y9dzn2kh8bpDeCA91UZTTYUskdA/T6wfb5m6IV84XrQnn vW/sVDNe44HIWxEltX7gpNq6p3IRLlBYgGGu3SiBaBvgbcto3Zm1OJ/R2GX1uoMjonvc IvupyIG0L6bVHlPBli3Kw8+C6F8VNwI2b7DSax9V+uVYCaZXEUCubAeFRdpa0rb6FtHS VbBYvhMszSiGBqSmdZaLzlUoGmchS3eUcK7rzjv2IUhRlUW5gT2Yq+uiLG+d6PLEpiby gsQ6Nxy7hg4nEcoPpt2OqqAFp0+Z5t/BC+DinQJhyRPqOGwHRf43ddKf2KSUEfpKxpD1 jZ6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724804166; x=1725408966; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SbKurov/bfQdlfwss06QhJgoXFG6l9nTsHf44bvMfmY=; b=ka13rNLqp+tD05+wxseio5uyoN9wvdDkjOL9vJRai2cOmHhkYc3Ziz9d0yMk7d0EOi 7+/JijwaC4LqQBWIHqCJzWAqdvpw4ojJQJbUzLs52T4piFtv8z4gJW3Af25Md/47Axc2 0iZvfhvWJleE7NqYNidG9zAnLXMf2K4bPJlVIlNmtB5dwikxJQCbOCY3+TSa20d6RjHM FVQGd9Ka82Gy/IYZWQ1S5fcMjtVeRckrG3hx18RYJVvb4rWeCApjrbjC3GLHF+7WDsD+ YzSqGrHeAF3OiLUc7rOlwoRZhIlfDqzPlDmKEjNCNb+UKPSTv7RQPE8SFwHGf1XcVRGv aXhg== X-Gm-Message-State: AOJu0YxhK7QXZOa1wjqX2niRpoE21v3bf4VzEsNfa8FAD7X6SMS1ulDi WHwCEC+QisHp8y43P6ziCWD9nEN3P1LwBWg2z9K3tkkO0iKisgyUTP6l9uZbWww= X-Google-Smtp-Source: AGHT+IEJAycTpXc+XgVBrKng8Rv5Ugz7za452POvaOc5Y0UB9Y2MREB+ROHBnbeMDoDrYyXlkkepVQ== X-Received: by 2002:a17:903:32d2:b0:202:20bf:461c with SMTP id d9443c01a7336-2039e4a96demr186707435ad.31.1724804166052; Tue, 27 Aug 2024 17:16:06 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-203855df793sm88798285ad.155.2024.08.27.17.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 17:16:05 -0700 (PDT) Date: Tue, 27 Aug 2024 17:16:03 -0700 From: Deepak Gupta To: Alistair Francis Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, palmer@dabbelt.com, Alistair.Francis@wdc.com, laurent@vivier.eu, 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 Subject: Re: [PATCH v10 02/21] linux-user/riscv: set priv for qemu-user and defaults for *envcfg Message-ID: References: <20240827231906.553327-1-debug@rivosinc.com> <20240827231906.553327-3-debug@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=debug@rivosinc.com; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Wed, Aug 28, 2024 at 10:10:44AM +1000, Alistair Francis wrote: >On Wed, Aug 28, 2024 at 9:20 AM Deepak Gupta wrote: >> >> set priv to be PRV_U for qemu-user on riscv. And set default value for >> *envcfg CSR. >> >> Signed-off-by: Deepak Gupta > >You can probably just squash this with the previous patch > It's just that they are in different directories. One is target/riscv and another linux-user/riscv. That's why I kept them separate. >> --- >> linux-user/riscv/cpu_loop.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c >> index 52c49c2e42..7a68e8717b 100644 >> --- a/linux-user/riscv/cpu_loop.c >> +++ b/linux-user/riscv/cpu_loop.c >> @@ -32,6 +32,10 @@ void cpu_loop(CPURISCVState *env) >> int trapnr; >> target_ulong ret; >> >> + env->priv = PRV_U; >> + env->senvcfg = 0; >> + env->menvcfg = 0; > >I don't think this is the right place. > >This should be handled by a CPU reset, which is still called for linux >user mode. It is the right place for setting priv to PRV_U? or you want me to place it elsewhere ? Sure for reset values of *envcfg, I can rely on `riscv_cpu_reset_hold` > >Alistair > >> + >> for (;;) { >> cpu_exec_start(cs); >> trapnr = cpu_exec(cs); >> -- >> 2.44.0 >> >>