[PATCH v8 11/11] target/arm: gdbstub: Guard pauth code with CONFIG_TCG

Fabiano Rosas posted 11 patches 2 years, 11 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Cleber Rosa <crosa@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
There is a newer version of this series
[PATCH v8 11/11] target/arm: gdbstub: Guard pauth code with CONFIG_TCG
Posted by Fabiano Rosas 2 years, 11 months ago
We currently don't have the reading of pauth regs implemented for KVM
so wrap the pauth registration with CONFIG_TCG.

This avoids the build error when using --disable-tcg:

libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub64.c.o: in function
`aarch64_gdb_get_pauth_reg': ../target/arm/gdbstub64.c:233: undefined
reference to `pauth_ptr_mask'

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
Does this make sense? I seem to remember we had a rule that for KVM
register values should come from the ONE_REG interface.
---
 target/arm/gdbstub.c   | 2 ++
 target/arm/gdbstub64.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
index 2ecc362ac2..fc937580dd 100644
--- a/target/arm/gdbstub.c
+++ b/target/arm/gdbstub.c
@@ -521,11 +521,13 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
                                      aarch64_gdb_set_fpu_reg,
                                      34, "aarch64-fpu.xml", 0);
         }
+#ifdef CONFIG_TCG
         if (isar_feature_aa64_pauth(&cpu->isar)) {
             gdb_register_coprocessor(cs, aarch64_gdb_get_pauth_reg,
                                      aarch64_gdb_set_pauth_reg,
                                      4, "aarch64-pauth.xml", 0);
         }
+#endif /* CONFIG_TCG */
 #endif
     } else {
         if (arm_feature(env, ARM_FEATURE_NEON)) {
diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
index 3bee892fb7..67c7cbb63c 100644
--- a/target/arm/gdbstub64.c
+++ b/target/arm/gdbstub64.c
@@ -210,6 +210,7 @@ int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg)
     return 0;
 }
 
+#ifdef CONFIG_TCG
 int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg)
 {
     switch (reg) {
@@ -243,6 +244,7 @@ int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg)
     /* All pseudo registers are read-only. */
     return 0;
 }
+#endif
 
 static void output_vector_union_type(GString *s, int reg_width,
                                      const char *name)
-- 
2.35.3
Re: [PATCH v8 11/11] target/arm: gdbstub: Guard pauth code with CONFIG_TCG
Posted by Richard Henderson 2 years, 11 months ago
On 3/9/23 12:14, Fabiano Rosas wrote:
> We currently don't have the reading of pauth regs implemented for KVM
> so wrap the pauth registration with CONFIG_TCG.
> 
> This avoids the build error when using --disable-tcg:
> 
> libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub64.c.o: in function
> `aarch64_gdb_get_pauth_reg': ../target/arm/gdbstub64.c:233: undefined
> reference to `pauth_ptr_mask'
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> Does this make sense? I seem to remember we had a rule that for KVM
> register values should come from the ONE_REG interface.
> ---
>   target/arm/gdbstub.c   | 2 ++
>   target/arm/gdbstub64.c | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
> index 2ecc362ac2..fc937580dd 100644
> --- a/target/arm/gdbstub.c
> +++ b/target/arm/gdbstub.c
> @@ -521,11 +521,13 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
>                                        aarch64_gdb_set_fpu_reg,
>                                        34, "aarch64-fpu.xml", 0);
>           }
> +#ifdef CONFIG_TCG
>           if (isar_feature_aa64_pauth(&cpu->isar)) {
>               gdb_register_coprocessor(cs, aarch64_gdb_get_pauth_reg,
>                                        aarch64_gdb_set_pauth_reg,
>                                        4, "aarch64-pauth.xml", 0);

I think this should be tcg_enabled(), which should avoid the need for ifdef.


r~


>           }
> +#endif /* CONFIG_TCG */
>   #endif
>       } else {
>           if (arm_feature(env, ARM_FEATURE_NEON)) {
> diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
> index 3bee892fb7..67c7cbb63c 100644
> --- a/target/arm/gdbstub64.c
> +++ b/target/arm/gdbstub64.c
> @@ -210,6 +210,7 @@ int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg)
>       return 0;
>   }
>   
> +#ifdef CONFIG_TCG
>   int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg)
>   {
>       switch (reg) {
> @@ -243,6 +244,7 @@ int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg)
>       /* All pseudo registers are read-only. */
>       return 0;
>   }
> +#endif
>   
>   static void output_vector_union_type(GString *s, int reg_width,
>                                        const char *name)