qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 02/21] linux-user/riscv: set priv for qemu-user and defau


From: Richard Henderson
Subject: Re: [PATCH v10 02/21] linux-user/riscv: set priv for qemu-user and defaults for *envcfg
Date: Wed, 28 Aug 2024 21:36:48 +1000
User-agent: Mozilla Thunderbird

On 8/28/24 10:16, Deepak Gupta wrote:
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`

Doing this in reset_hold seems correct to me.

Compare target/arm/cpu.c, arm_cpu_reset_hold:

    if (arm_feature(env, ARM_FEATURE_AARCH64)) {
        /* 64 bit CPUs always start in 64 bit mode */
        env->aarch64 = true;
#if defined(CONFIG_USER_ONLY)
        env->pstate = PSTATE_MODE_EL0t;
        /* Userspace expects access to DC ZVA, CTL_EL0 and the cache ops */
        env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE;
        /* Enable all PAC keys.  */
        env->cp15.sctlr_el[1] |= (SCTLR_EnIA | SCTLR_EnIB |
                                  SCTLR_EnDA | SCTLR_EnDB);
...

That assignment to pstate is equivalent to "priv = PRV_U", and sctlr_el[] fills roughly the same role as [ms]envcfg.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]