Re: [Xen-devel] [PATCH 03/16] x86/HVM: switch virtual_intr_delivery_enabled() hook to simple boolean

2018-07-19 Thread Tian, Kevin
> From: Jan Beulich [mailto:jbeul...@suse.com]
> Sent: Thursday, July 19, 2018 2:16 PM
> 
> >>> On 19.07.18 at 03:56,  wrote:
> >>  From: Jan Beulich [mailto:jbeul...@suse.com]
> >> Sent: Wednesday, July 11, 2018 9:25 PM
> >>
> >> From: Suravee Suthikulpanit 
> >>
> >> This patch modifies the hvm_funcs.virtual_intr_delivery_enabled()
> >> to become a bool variable as VMX does and SVM will simply return a
> >> static value.
> >>
> >> Signed-off-by: Suravee Suthikulpanit 
> >> Signed-off-by: Jan Beulich 
> >> ---
> >> Extracted from an SVM/AVIC series patch.
> >>
> >> --- a/xen/arch/x86/hvm/vlapic.c
> >> +++ b/xen/arch/x86/hvm/vlapic.c
> >> @@ -1258,14 +1258,6 @@ void vlapic_adjust_i8259_target(struct d
> >>  pt_adjust_global_vcpu_target(v);
> >>  }
> >>
> >> -int vlapic_virtual_intr_delivery_enabled(void)
> >> -{
> >> -if ( hvm_funcs.virtual_intr_delivery_enabled )
> >> -return hvm_funcs.virtual_intr_delivery_enabled();
> >> -else
> >> -return 0;
> >> -}
> >> -
> >>  int vlapic_has_pending_irq(struct vcpu *v)
> >>  {
> >>  struct vlapic *vlapic = vcpu_vlapic(v);
> >> @@ -1278,7 +1270,7 @@ int vlapic_has_pending_irq(struct vcpu *
> >>  if ( irr == -1 )
> >>  return -1;
> >>
> >> -if ( vlapic_virtual_intr_delivery_enabled() &&
> >> +if ( hvm_funcs.virtual_intr_delivery_enabled &&
> >>   !nestedhvm_vcpu_in_guestmode(v) )
> >>  return irr;
> >>
> >
> > above is another functional change. Can you explain and if making sense
> > then put the fix in separate patch?
> 
> I'm afraid I don't understand: What functional change? All the patch
> does is change from a hook based approach to a flag based one, as
> said in the description.
> 

forget it. I don't know why I thought nestedhvm check was added by your
patch. :/

Reviewed-by: Kevin Tian 

Thanks
Kevin

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 03/16] x86/HVM: switch virtual_intr_delivery_enabled() hook to simple boolean

2018-07-19 Thread Jan Beulich
>>> On 19.07.18 at 03:56,  wrote:
>>  From: Jan Beulich [mailto:jbeul...@suse.com]
>> Sent: Wednesday, July 11, 2018 9:25 PM
>> 
>> From: Suravee Suthikulpanit 
>> 
>> This patch modifies the hvm_funcs.virtual_intr_delivery_enabled()
>> to become a bool variable as VMX does and SVM will simply return a
>> static value.
>> 
>> Signed-off-by: Suravee Suthikulpanit 
>> Signed-off-by: Jan Beulich 
>> ---
>> Extracted from an SVM/AVIC series patch.
>> 
>> --- a/xen/arch/x86/hvm/vlapic.c
>> +++ b/xen/arch/x86/hvm/vlapic.c
>> @@ -1258,14 +1258,6 @@ void vlapic_adjust_i8259_target(struct d
>>  pt_adjust_global_vcpu_target(v);
>>  }
>> 
>> -int vlapic_virtual_intr_delivery_enabled(void)
>> -{
>> -if ( hvm_funcs.virtual_intr_delivery_enabled )
>> -return hvm_funcs.virtual_intr_delivery_enabled();
>> -else
>> -return 0;
>> -}
>> -
>>  int vlapic_has_pending_irq(struct vcpu *v)
>>  {
>>  struct vlapic *vlapic = vcpu_vlapic(v);
>> @@ -1278,7 +1270,7 @@ int vlapic_has_pending_irq(struct vcpu *
>>  if ( irr == -1 )
>>  return -1;
>> 
>> -if ( vlapic_virtual_intr_delivery_enabled() &&
>> +if ( hvm_funcs.virtual_intr_delivery_enabled &&
>>   !nestedhvm_vcpu_in_guestmode(v) )
>>  return irr;
>> 
> 
> above is another functional change. Can you explain and if making sense
> then put the fix in separate patch?

I'm afraid I don't understand: What functional change? All the patch
does is change from a hook based approach to a flag based one, as
said in the description.

Jan



___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 03/16] x86/HVM: switch virtual_intr_delivery_enabled() hook to simple boolean

2018-07-18 Thread Tian, Kevin
> From: Jan Beulich [mailto:jbeul...@suse.com]
> Sent: Wednesday, July 11, 2018 9:25 PM
> 
> From: Suravee Suthikulpanit 
> 
> This patch modifies the hvm_funcs.virtual_intr_delivery_enabled()
> to become a bool variable as VMX does and SVM will simply return a
> static value.
> 
> Signed-off-by: Suravee Suthikulpanit 
> Signed-off-by: Jan Beulich 
> ---
> Extracted from an SVM/AVIC series patch.
> 
> --- a/xen/arch/x86/hvm/vlapic.c
> +++ b/xen/arch/x86/hvm/vlapic.c
> @@ -1258,14 +1258,6 @@ void vlapic_adjust_i8259_target(struct d
>  pt_adjust_global_vcpu_target(v);
>  }
> 
> -int vlapic_virtual_intr_delivery_enabled(void)
> -{
> -if ( hvm_funcs.virtual_intr_delivery_enabled )
> -return hvm_funcs.virtual_intr_delivery_enabled();
> -else
> -return 0;
> -}
> -
>  int vlapic_has_pending_irq(struct vcpu *v)
>  {
>  struct vlapic *vlapic = vcpu_vlapic(v);
> @@ -1278,7 +1270,7 @@ int vlapic_has_pending_irq(struct vcpu *
>  if ( irr == -1 )
>  return -1;
> 
> -if ( vlapic_virtual_intr_delivery_enabled() &&
> +if ( hvm_funcs.virtual_intr_delivery_enabled &&
>   !nestedhvm_vcpu_in_guestmode(v) )
>  return irr;
> 

above is another functional change. Can you explain and if making sense
then put the fix in separate patch?

Thanks
Kevin

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 03/16] x86/HVM: switch virtual_intr_delivery_enabled() hook to simple boolean

2018-07-13 Thread Andrew Cooper
On 11/07/18 14:24, Jan Beulich wrote:
> From: Suravee Suthikulpanit 
>
> This patch modifies the hvm_funcs.virtual_intr_delivery_enabled()
> to become a bool variable as VMX does and SVM will simply return a
> static value.
>
> Signed-off-by: Suravee Suthikulpanit 
> Signed-off-by: Jan Beulich 

Reviewed-by: Andrew Cooper 

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH 03/16] x86/HVM: switch virtual_intr_delivery_enabled() hook to simple boolean

2018-07-11 Thread Jan Beulich
From: Suravee Suthikulpanit 

This patch modifies the hvm_funcs.virtual_intr_delivery_enabled()
to become a bool variable as VMX does and SVM will simply return a
static value.

Signed-off-by: Suravee Suthikulpanit 
Signed-off-by: Jan Beulich 
---
Extracted from an SVM/AVIC series patch.

--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1258,14 +1258,6 @@ void vlapic_adjust_i8259_target(struct d
 pt_adjust_global_vcpu_target(v);
 }
 
-int vlapic_virtual_intr_delivery_enabled(void)
-{
-if ( hvm_funcs.virtual_intr_delivery_enabled )
-return hvm_funcs.virtual_intr_delivery_enabled();
-else
-return 0;
-}
-
 int vlapic_has_pending_irq(struct vcpu *v)
 {
 struct vlapic *vlapic = vcpu_vlapic(v);
@@ -1278,7 +1270,7 @@ int vlapic_has_pending_irq(struct vcpu *
 if ( irr == -1 )
 return -1;
 
-if ( vlapic_virtual_intr_delivery_enabled() &&
+if ( hvm_funcs.virtual_intr_delivery_enabled &&
  !nestedhvm_vcpu_in_guestmode(v) )
 return irr;
 
@@ -1316,7 +1308,7 @@ int vlapic_ack_pending_irq(struct vcpu *
 int isr;
 
 if ( !force_ack &&
- vlapic_virtual_intr_delivery_enabled() )
+ hvm_funcs.virtual_intr_delivery_enabled )
 return 1;
 
 /* If there's no chance of using APIC assist then bail now. */
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1948,11 +1948,6 @@ static void vmx_update_eoi_exit_bitmap(s
 vmx_clear_eoi_exit_bitmap(v, vector);
 }
 
-static int vmx_virtual_intr_delivery_enabled(void)
-{
-return cpu_has_vmx_virtual_intr_delivery;
-}
-
 static void vmx_process_isr(int isr, struct vcpu *v)
 {
 unsigned long status;
@@ -2331,7 +2326,6 @@ static struct hvm_function_table __initd
 .nhvm_intr_blocked= nvmx_intr_blocked,
 .nhvm_domain_relinquish_resources = nvmx_domain_relinquish_resources,
 .update_eoi_exit_bitmap = vmx_update_eoi_exit_bitmap,
-.virtual_intr_delivery_enabled = vmx_virtual_intr_delivery_enabled,
 .process_isr  = vmx_process_isr,
 .deliver_posted_intr  = vmx_deliver_posted_intr,
 .sync_pir_to_irr  = vmx_sync_pir_to_irr,
@@ -2470,6 +2464,8 @@ const struct hvm_function_table * __init
 vmx_function_table.process_isr = NULL;
 vmx_function_table.handle_eoi = NULL;
 }
+else
+vmx_function_table.virtual_intr_delivery_enabled = true;
 
 if ( cpu_has_vmx_posted_intr_processing )
 {
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -97,6 +97,9 @@ struct hvm_function_table {
 /* Necessary hardware support for alternate p2m's? */
 bool altp2m_supported;
 
+/* Hardware virtual interrupt delivery enable? */
+bool virtual_intr_delivery_enabled;
+
 /* Indicate HAP capabilities. */
 unsigned int hap_capabilities;
 
@@ -195,7 +198,6 @@ struct hvm_function_table {
 
 /* Virtual interrupt delivery */
 void (*update_eoi_exit_bitmap)(struct vcpu *v, u8 vector, u8 trig);
-int (*virtual_intr_delivery_enabled)(void);
 void (*process_isr)(int isr, struct vcpu *v);
 void (*deliver_posted_intr)(struct vcpu *v, u8 vector);
 void (*sync_pir_to_irr)(struct vcpu *v);





___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel