Re: [PATCH v3 05/19] target/arm: Restrict Virtualization Host Extensions instructions to TCG

2020-04-20 Thread Philippe Mathieu-Daudé

On 3/16/20 9:17 PM, Richard Henderson wrote:

On 3/16/20 9:06 AM, Philippe Mathieu-Daudé wrote:

Under KVM the ARMv8.1-VHE instruction will trap.

Signed-off-by: Philippe Mathieu-Daudé 
---
  target/arm/helper.c | 22 --
  1 file changed, 12 insertions(+), 10 deletions(-)


What happened to the uses of these functions?


Sincerely I don't remember... I got this branch working again without 
this patch, so I'll just drop it.




r~



diff --git a/target/arm/helper.c b/target/arm/helper.c
index a5280c091b..ce6778283d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -2897,16 +2897,6 @@ static void gt_virt_ctl_write(CPUARMState *env, const 
ARMCPRegInfo *ri,
  gt_ctl_write(env, ri, GTIMER_VIRT, value);
  }
  
-static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,

-  uint64_t value)
-{
-ARMCPU *cpu = env_archcpu(env);
-
-trace_arm_gt_cntvoff_write(value);
-raw_write(env, ri, value);
-gt_recalc_timer(cpu, GTIMER_VIRT);
-}
-
  static uint64_t gt_virt_redir_cval_read(CPUARMState *env,
  const ARMCPRegInfo *ri)
  {
@@ -2949,6 +2939,17 @@ static void gt_virt_redir_ctl_write(CPUARMState *env, 
const ARMCPRegInfo *ri,
  gt_ctl_write(env, ri, timeridx, value);
  }
  
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)

+static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,
+  uint64_t value)
+{
+ARMCPU *cpu = env_archcpu(env);
+
+trace_arm_gt_cntvoff_write(value);
+raw_write(env, ri, value);
+gt_recalc_timer(cpu, GTIMER_VIRT);
+}
+
  static void gt_hyp_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri)
  {
  gt_timer_reset(env, ri, GTIMER_HYP);
@@ -2976,6 +2977,7 @@ static void gt_hyp_ctl_write(CPUARMState *env, const 
ARMCPRegInfo *ri,
  {
  gt_ctl_write(env, ri, GTIMER_HYP, value);
  }
+#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
  
  static void gt_sec_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri)

  {








Re: [PATCH v3 05/19] target/arm: Restrict Virtualization Host Extensions instructions to TCG

2020-03-16 Thread Richard Henderson
On 3/16/20 9:06 AM, Philippe Mathieu-Daudé wrote:
> Under KVM the ARMv8.1-VHE instruction will trap.
> 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  target/arm/helper.c | 22 --
>  1 file changed, 12 insertions(+), 10 deletions(-)

What happened to the uses of these functions?


r~

> 
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index a5280c091b..ce6778283d 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -2897,16 +2897,6 @@ static void gt_virt_ctl_write(CPUARMState *env, const 
> ARMCPRegInfo *ri,
>  gt_ctl_write(env, ri, GTIMER_VIRT, value);
>  }
>  
> -static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,
> -  uint64_t value)
> -{
> -ARMCPU *cpu = env_archcpu(env);
> -
> -trace_arm_gt_cntvoff_write(value);
> -raw_write(env, ri, value);
> -gt_recalc_timer(cpu, GTIMER_VIRT);
> -}
> -
>  static uint64_t gt_virt_redir_cval_read(CPUARMState *env,
>  const ARMCPRegInfo *ri)
>  {
> @@ -2949,6 +2939,17 @@ static void gt_virt_redir_ctl_write(CPUARMState *env, 
> const ARMCPRegInfo *ri,
>  gt_ctl_write(env, ri, timeridx, value);
>  }
>  
> +#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
> +static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,
> +  uint64_t value)
> +{
> +ARMCPU *cpu = env_archcpu(env);
> +
> +trace_arm_gt_cntvoff_write(value);
> +raw_write(env, ri, value);
> +gt_recalc_timer(cpu, GTIMER_VIRT);
> +}
> +
>  static void gt_hyp_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri)
>  {
>  gt_timer_reset(env, ri, GTIMER_HYP);
> @@ -2976,6 +2977,7 @@ static void gt_hyp_ctl_write(CPUARMState *env, const 
> ARMCPRegInfo *ri,
>  {
>  gt_ctl_write(env, ri, GTIMER_HYP, value);
>  }
> +#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
>  
>  static void gt_sec_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri)
>  {
> 




[PATCH v3 05/19] target/arm: Restrict Virtualization Host Extensions instructions to TCG

2020-03-16 Thread Philippe Mathieu-Daudé
Under KVM the ARMv8.1-VHE instruction will trap.

Signed-off-by: Philippe Mathieu-Daudé 
---
 target/arm/helper.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index a5280c091b..ce6778283d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -2897,16 +2897,6 @@ static void gt_virt_ctl_write(CPUARMState *env, const 
ARMCPRegInfo *ri,
 gt_ctl_write(env, ri, GTIMER_VIRT, value);
 }
 
-static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,
-  uint64_t value)
-{
-ARMCPU *cpu = env_archcpu(env);
-
-trace_arm_gt_cntvoff_write(value);
-raw_write(env, ri, value);
-gt_recalc_timer(cpu, GTIMER_VIRT);
-}
-
 static uint64_t gt_virt_redir_cval_read(CPUARMState *env,
 const ARMCPRegInfo *ri)
 {
@@ -2949,6 +2939,17 @@ static void gt_virt_redir_ctl_write(CPUARMState *env, 
const ARMCPRegInfo *ri,
 gt_ctl_write(env, ri, timeridx, value);
 }
 
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
+static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,
+  uint64_t value)
+{
+ARMCPU *cpu = env_archcpu(env);
+
+trace_arm_gt_cntvoff_write(value);
+raw_write(env, ri, value);
+gt_recalc_timer(cpu, GTIMER_VIRT);
+}
+
 static void gt_hyp_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri)
 {
 gt_timer_reset(env, ri, GTIMER_HYP);
@@ -2976,6 +2977,7 @@ static void gt_hyp_ctl_write(CPUARMState *env, const 
ARMCPRegInfo *ri,
 {
 gt_ctl_write(env, ri, GTIMER_HYP, value);
 }
+#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
 
 static void gt_sec_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri)
 {
-- 
2.21.1