public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: cluster mode broadcast does not work
@ 2014-07-30  7:03 Nadav Amit
  2014-07-31 17:46 ` Nadav Amit
  0 siblings, 1 reply; 2+ messages in thread
From: Nadav Amit @ 2014-07-30  7:03 UTC (permalink / raw)
  To: pbonzini
  Cc: gleb, tglx, mingo, hpa, x86, linux-kernel, nadav.amit, Nadav Amit

Local-apic enables cluster mode broadcast. As Intel SDM 10.6.2.2 says:
"Broadcast to all local APICs is achieved by setting all destination bits to
one." This patch enables cluster mode broadcast.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
 arch/x86/kvm/lapic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index efb1939..05c9a46 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -560,8 +560,8 @@ int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda)
 			result = 1;
 		break;
 	case APIC_DFR_CLUSTER:
-		if (((logical_id >> 4) == (mda >> 0x4))
-		    && (logical_id & mda & 0xf))
+		if ((((logical_id >> 4) == (mda >> 0x4))
+		    && (logical_id & mda & 0xf)) || mda == 0xff)
 			result = 1;
 		break;
 	default:
@@ -644,6 +644,10 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
 	} else {
 		u32 mda = irq->dest_id << (32 - map->ldr_bits);
 
+		if (irq->dest_id == 0xff &&
+		    kvm_apic_get_reg(src, APIC_DFR) == APIC_DFR_CLUSTER)
+			goto out; /* cluster mode broadcast */
+
 		dst = map->logical_map[apic_cluster_id(map, mda)];
 
 		bitmap = apic_logical_id(map, mda);
-- 
1.9.1


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

* Re: [PATCH] KVM: x86: cluster mode broadcast does not work
  2014-07-30  7:03 [PATCH] KVM: x86: cluster mode broadcast does not work Nadav Amit
@ 2014-07-31 17:46 ` Nadav Amit
  0 siblings, 0 replies; 2+ messages in thread
From: Nadav Amit @ 2014-07-31 17:46 UTC (permalink / raw)
  To: Nadav Amit, pbonzini; +Cc: gleb, tglx, mingo, hpa, x86, linux-kernel, kvm

cc'ing the kvm mailing list that was mistakenly omitted.

On 7/30/14 10:03 AM, Nadav Amit wrote:
> Local-apic enables cluster mode broadcast. As Intel SDM 10.6.2.2 says:
> "Broadcast to all local APICs is achieved by setting all destination bits to
> one." This patch enables cluster mode broadcast.
> 
> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
> ---
>  arch/x86/kvm/lapic.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index efb1939..05c9a46 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -560,8 +560,8 @@ int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda)
>  			result = 1;
>  		break;
>  	case APIC_DFR_CLUSTER:
> -		if (((logical_id >> 4) == (mda >> 0x4))
> -		    && (logical_id & mda & 0xf))
> +		if ((((logical_id >> 4) == (mda >> 0x4))
> +		    && (logical_id & mda & 0xf)) || mda == 0xff)
>  			result = 1;
>  		break;
>  	default:
> @@ -644,6 +644,10 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
>  	} else {
>  		u32 mda = irq->dest_id << (32 - map->ldr_bits);
>  
> +		if (irq->dest_id == 0xff &&
> +		    kvm_apic_get_reg(src, APIC_DFR) == APIC_DFR_CLUSTER)
> +			goto out; /* cluster mode broadcast */
> +
>  		dst = map->logical_map[apic_cluster_id(map, mda)];
>  
>  		bitmap = apic_logical_id(map, mda);
> 

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

end of thread, other threads:[~2014-07-31 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-30  7:03 [PATCH] KVM: x86: cluster mode broadcast does not work Nadav Amit
2014-07-31 17:46 ` Nadav Amit

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