target/riscv/cpu.h | 2 -- 1 file changed, 2 deletions(-)
MMU_USER_IDX is not used anywhere in the tree. Its value is also
incorrect: it is defined as 3, while the user-mode MMU index is
MMUIdx_U(0), as defined in target/riscv/internals.h.
Since the macro is both unused and wrong, remove it rather than
fix its value.
Signed-off-by: yechao-w <wang.yechao255@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
---
Changes in v2:
- Adjust the patch descriptions and rebased on riscv-to-apply.next.
- Link to v1: https://lore.kernel.org/qemu-devel/20260107161336108RbvgIEJ1pww_fKZtMreFp@zte.com.cn/
target/riscv/cpu.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index b65d631994..df7477fc5f 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -180,8 +180,6 @@ extern RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[];
#define RISCV_IMPLIED_EXTS_RULE_END -1
-#define MMU_USER_IDX 3
-
#if !defined(CONFIG_USER_ONLY)
#include "tcg/pmp.h"
#endif
--
2.27.0
On Mon, 2026-10-26 at 11:11 +0800, Wang Yechao wrote:
> MMU_USER_IDX is not used anywhere in the tree. Its value is also
> incorrect: it is defined as 3, while the user-mode MMU index is
> MMUIdx_U(0), as defined in target/riscv/internals.h.
>
> Since the macro is both unused and wrong, remove it rather than
> fix its value.
>
> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn>
> Reviewed-by: Daniel Henrique Barboza
> <daniel.barboza@oss.qualcomm.com>
> ---
> Changes in v2:
> - Adjust the patch descriptions and rebased on riscv-to-apply.next.
> - Link to v1:
> https://lore.kernel.org/qemu-devel/20260107161336108RbvgIEJ1pww_fKZtMreFp@zte.com.cn/
>
> target/riscv/cpu.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index b65d631994..df7477fc5f 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -180,8 +180,6 @@ extern RISCVCPUImpliedExtsRule
> *riscv_multi_ext_implied_rules[];
>
> #define RISCV_IMPLIED_EXTS_RULE_END -1
>
> -#define MMU_USER_IDX 3
> -
Fails to build:
In file included from
/var/mnt/scratch/alistair/software/qemu/include/accel/tcg/cpu-
ldst.h:70,
from ../linux-user/qemu.h:5,
from ../linux-user/riscv/cpu_loop.c:22:
/var/mnt/scratch/alistair/software/qemu/include/accel/tcg/cpu-mmu-
index.h: In function ‘cpu_mmu_index’:
/var/mnt/scratch/alistair/software/qemu/include/accel/tcg/cpu-mmu-
index.h:37:12: error: ‘MMU_USER_IDX’ undeclared (first use in this
function)
37 | return MMU_USER_IDX;
| ^~~~~~~~~~~~
/var/mnt/scratch/alistair/software/qemu/include/accel/tcg/cpu-mmu-
index.h:37:12: note: each undeclared identifier is reported only once
for each function it appears in
ninja: build stopped: subcommand failed.
make: *** [Makefile:170: run-ninja] Error 1
> #if !defined(CONFIG_USER_ONLY)
> #include "tcg/pmp.h"
> #endif
On Mon, 2026-10-26 at 11:11 +0800, Wang Yechao wrote: > MMU_USER_IDX is not used anywhere in the tree. Its value is also > incorrect: it is defined as 3, while the user-mode MMU index is > MMUIdx_U(0), as defined in target/riscv/internals.h. > > Since the macro is both unused and wrong, remove it rather than > fix its value. > > Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> > Reviewed-by: Daniel Henrique Barboza > <daniel.barboza@oss.qualcomm.com> Thanks! Applied to riscv-to-apply.next Alistair > --- > Changes in v2: > - Adjust the patch descriptions and rebased on riscv-to-apply.next. > - Link to v1: > https://lore.kernel.org/qemu-devel/20260107161336108RbvgIEJ1pww_fKZtMreFp@zte.com.cn/ > > target/riscv/cpu.h | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h > index b65d631994..df7477fc5f 100644 > --- a/target/riscv/cpu.h > +++ b/target/riscv/cpu.h > @@ -180,8 +180,6 @@ extern RISCVCPUImpliedExtsRule > *riscv_multi_ext_implied_rules[]; > > #define RISCV_IMPLIED_EXTS_RULE_END -1 > > -#define MMU_USER_IDX 3 > - > #if !defined(CONFIG_USER_ONLY) > #include "tcg/pmp.h" > #endif
On Mon, 2026-10-26 at 11:11 +0800, Wang Yechao wrote: > MMU_USER_IDX is not used anywhere in the tree. Its value is also > incorrect: it is defined as 3, while the user-mode MMU index is > MMUIdx_U(0), as defined in target/riscv/internals.h. > > Since the macro is both unused and wrong, remove it rather than > fix its value. > > Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> > Reviewed-by: Daniel Henrique Barboza > <daniel.barboza@oss.qualcomm.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > Changes in v2: > - Adjust the patch descriptions and rebased on riscv-to-apply.next. > - Link to v1: > https://lore.kernel.org/qemu-devel/20260107161336108RbvgIEJ1pww_fKZtMreFp@zte.com.cn/ > > target/riscv/cpu.h | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h > index b65d631994..df7477fc5f 100644 > --- a/target/riscv/cpu.h > +++ b/target/riscv/cpu.h > @@ -180,8 +180,6 @@ extern RISCVCPUImpliedExtsRule > *riscv_multi_ext_implied_rules[]; > > #define RISCV_IMPLIED_EXTS_RULE_END -1 > > -#define MMU_USER_IDX 3 > - > #if !defined(CONFIG_USER_ONLY) > #include "tcg/pmp.h" > #endif
© 2016 - 2026 Red Hat, Inc.