public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Using macros instead of magic values
@ 2020-07-21  8:23 Haiwei Li
  2020-07-21  8:46 ` Vitaly Kuznetsov
  2020-07-27 14:40 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Haiwei Li @ 2020-07-21  8:23 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org
  Cc: pbonzini@redhat.com, Sean Christopherson, wanpengli@tencent.com,
	vkuznets@redhat.com, jmattson@google.com, joro@8bytes.org,
	tglx@linutronix.de, mingo, bp@alien8.de, hpa@zytor.com

From: Haiwei Li <lihaiwei@tencent.com>

Instead of using magic values, use macros.

Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
---
  arch/x86/kvm/lapic.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 47801a4..d5fb2ea 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2083,7 +2083,8 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, 
u32 reg, u32 val)

  	case APIC_SELF_IPI:
  		if (apic_x2apic_mode(apic)) {
-			kvm_lapic_reg_write(apic, APIC_ICR, 0x40000 | (val & 0xff));
+			kvm_lapic_reg_write(apic, APIC_ICR,
+					    APIC_DEST_SELF | (val & APIC_VECTOR_MASK));
  		} else
  			ret = 1;
  		break;
--
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: Using macros instead of magic values
  2020-07-21  8:23 [PATCH] KVM: Using macros instead of magic values Haiwei Li
@ 2020-07-21  8:46 ` Vitaly Kuznetsov
  2020-07-27 14:40 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2020-07-21  8:46 UTC (permalink / raw)
  To: Haiwei Li
  Cc: pbonzini@redhat.com, Sean Christopherson, wanpengli@tencent.com,
	jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo,
	bp@alien8.de, hpa@zytor.com, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, x86@kernel.org

Haiwei Li <lihaiwei.kernel@gmail.com> writes:

> From: Haiwei Li <lihaiwei@tencent.com>
>
> Instead of using magic values, use macros.
>
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
>   arch/x86/kvm/lapic.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 47801a4..d5fb2ea 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -2083,7 +2083,8 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, 
> u32 reg, u32 val)
>
>   	case APIC_SELF_IPI:
>   		if (apic_x2apic_mode(apic)) {
> -			kvm_lapic_reg_write(apic, APIC_ICR, 0x40000 | (val & 0xff));
> +			kvm_lapic_reg_write(apic, APIC_ICR,
> +					    APIC_DEST_SELF | (val & APIC_VECTOR_MASK));
>   		} else
>   			ret = 1;
>   		break;
> --
> 1.8.3.1
>

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: Using macros instead of magic values
  2020-07-21  8:23 [PATCH] KVM: Using macros instead of magic values Haiwei Li
  2020-07-21  8:46 ` Vitaly Kuznetsov
@ 2020-07-27 14:40 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-07-27 14:40 UTC (permalink / raw)
  To: Haiwei Li, linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	x86@kernel.org
  Cc: Sean Christopherson, wanpengli@tencent.com, vkuznets@redhat.com,
	jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo,
	bp@alien8.de, hpa@zytor.com

On 21/07/20 10:23, Haiwei Li wrote:
> From: Haiwei Li <lihaiwei@tencent.com>
> 
> Instead of using magic values, use macros.
> 
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
>  arch/x86/kvm/lapic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 47801a4..d5fb2ea 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -2083,7 +2083,8 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic,
> u32 reg, u32 val)
> 
>      case APIC_SELF_IPI:
>          if (apic_x2apic_mode(apic)) {
> -            kvm_lapic_reg_write(apic, APIC_ICR, 0x40000 | (val & 0xff));
> +            kvm_lapic_reg_write(apic, APIC_ICR,
> +                        APIC_DEST_SELF | (val & APIC_VECTOR_MASK));
>          } else
>              ret = 1;
>          break;
> -- 
> 1.8.3.1
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-27 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-21  8:23 [PATCH] KVM: Using macros instead of magic values Haiwei Li
2020-07-21  8:46 ` Vitaly Kuznetsov
2020-07-27 14:40 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox