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

2023-03-09 Thread Richard Henderson

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 
---
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(>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)





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

2023-03-09 Thread Fabiano Rosas
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 
---
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(>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