diff mbox series

[3/3] target: Set `CF_PCREL` for arm and i386 frontends

Message ID 20230207104352.11055-4-anjo@rev.ng (mailing list archive)
State New, archived
Headers show
Series Replace TARGET_TB_PCREL with CF_PCREL | expand

Commit Message

Anton Johansson Feb. 7, 2023, 10:43 a.m. UTC
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 target/arm/cpu-param.h  | 2 --
 target/arm/cpu.c        | 5 +++++
 target/i386/cpu-param.h | 4 ----
 target/i386/cpu.c       | 5 +++++
 4 files changed, 10 insertions(+), 6 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 7, 2023, 11:27 a.m. UTC | #1
On 7/2/23 11:43, Anton Johansson via wrote:
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   target/arm/cpu-param.h  | 2 --
>   target/arm/cpu.c        | 5 +++++
>   target/i386/cpu-param.h | 4 ----
>   target/i386/cpu.c       | 5 +++++
>   4 files changed, 10 insertions(+), 6 deletions(-)

Better to split in 2 distinct patches since two different
subsystems are modified.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
shiju.jose--- via Feb. 8, 2023, 12:51 p.m. UTC | #2
On 2/7/23 12:27, Philippe Mathieu-Daudé wrote:
> Better to split in 2 distinct patches since two different
> subsystems are modified.

Will do, thanks! What do think you of the previous patch in terms of 
splitting
on subsystems? I was a bit torn between keeping it as giga-patch and
splitting it up.
Richard Henderson Feb. 8, 2023, 9:15 p.m. UTC | #3
On 2/7/23 00:43, Anton Johansson wrote:
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   target/arm/cpu-param.h  | 2 --
>   target/arm/cpu.c        | 5 +++++
>   target/i386/cpu-param.h | 4 ----
>   target/i386/cpu.c       | 5 +++++
>   4 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
> index 53cac9c89b..b7bde18986 100644
> --- a/target/arm/cpu-param.h
> +++ b/target/arm/cpu-param.h
> @@ -31,8 +31,6 @@
>   # define TARGET_PAGE_BITS_VARY
>   # define TARGET_PAGE_BITS_MIN  10
>   
> -# define TARGET_TB_PCREL 1
> -
>   /*
>    * Cache the attrs and shareability fields from the page table entry.
>    *
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 31dc595e11..62b876e0f0 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -1551,6 +1551,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>       Error *local_err = NULL;
>       bool no_aa32 = false;
>   
> +    /* Use pc-relative instructions in system-mode */
> +#ifndef CONFIG_USER_ONLY
> +    cs->tcg_cflags |= CF_PCREL;
> +#endif

To fix bisection problems, the hunks setting CF_PCREL need to precede removal of the 
TARGET_TB_PCREL tests.  The removal of TARGET_TB_PCREL can happen all at once at the end.


r~
diff mbox series

Patch

diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
index 53cac9c89b..b7bde18986 100644
--- a/target/arm/cpu-param.h
+++ b/target/arm/cpu-param.h
@@ -31,8 +31,6 @@ 
 # define TARGET_PAGE_BITS_VARY
 # define TARGET_PAGE_BITS_MIN  10
 
-# define TARGET_TB_PCREL 1
-
 /*
  * Cache the attrs and shareability fields from the page table entry.
  *
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 31dc595e11..62b876e0f0 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1551,6 +1551,11 @@  static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
     Error *local_err = NULL;
     bool no_aa32 = false;
 
+    /* Use pc-relative instructions in system-mode */
+#ifndef CONFIG_USER_ONLY
+    cs->tcg_cflags |= CF_PCREL;
+#endif
+
     /* If we needed to query the host kernel for the CPU features
      * then it's possible that might have failed in the initfn, but
      * this is the first point where we can report it.
diff --git a/target/i386/cpu-param.h b/target/i386/cpu-param.h
index f579b16bd2..abad52af20 100644
--- a/target/i386/cpu-param.h
+++ b/target/i386/cpu-param.h
@@ -25,8 +25,4 @@ 
 #define TARGET_PAGE_BITS 12
 #define NB_MMU_MODES 5
 
-#ifndef CONFIG_USER_ONLY
-# define TARGET_TB_PCREL 1
-#endif
-
 #endif
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 4d2b8d0444..5be294b122 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6404,6 +6404,11 @@  static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     static bool ht_warned;
     unsigned requested_lbr_fmt;
 
+    /* Use pc-relative instructions in system-mode */
+#ifndef CONFIG_USER_ONLY
+    cs->tcg_cflags |= CF_PCREL;
+#endif
+
     if (cpu->apic_id == UNASSIGNED_APIC_ID) {
         error_setg(errp, "apic-id property was not initialized properly");
         return;