All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: Implement support for the RH bit
@ 2011-09-02  7:48 Sasha Levin
  2011-09-02 11:27 ` Jan Kiszka
  0 siblings, 1 reply; 16+ messages in thread
From: Sasha Levin @ 2011-09-02  7:48 UTC (permalink / raw)
  To: kvm; +Cc: Sasha Levin, Avi Kivity, Marcelo Tosatti

The RH bit exists in the message address register (lower 32 bits of
the address).

The bit indicates whether the message should go to the processor which was
indicated in the destination ID bits, or whether it should go to the
processor running at the lowest priority.

Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 virt/kvm/irq_comm.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 9f614b4..0ba3a3d 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -134,7 +134,22 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
 	irq.level = 1;
 	irq.shorthand = 0;
 
-	/* TODO Deal with RH bit of MSI message address */
+	/*
+	 * If the RH bit is set, we'll deliver to the processor running
+	 * at the lowest priority.
+	 */
+	if (e->msi.address_lo & MSI_ADDR_REDIRECTION_LOWPRI) {
+		irq.delivery_mode = MSI_DATA_DELIVERY_LOWPRI;
+	} else {
+		/*
+		 * If the RH bit is not set, we'll deliver to the specific
+		 * processor mentioned in destination ID, and ignore the DM
+		 * bit.
+		 */
+		irq.dest_mode = MSI_ADDR_DEST_MODE_PHYSICAL;
+		irq.delivery_mode = MSI_DATA_DELIVERY_FIXED;
+	}
+
 	return kvm_irq_delivery_to_apic(kvm, NULL, &irq);
 }
 
-- 
1.7.6.1


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

end of thread, other threads:[~2011-09-02 15:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02  7:48 [PATCH v2] KVM: Implement support for the RH bit Sasha Levin
2011-09-02 11:27 ` Jan Kiszka
2011-09-02 11:36   ` Jan Kiszka
2011-09-02 12:11     ` Jan Kiszka
2011-09-02 13:13       ` Sasha Levin
2011-09-02 14:00         ` Jan Kiszka
2011-09-02 14:11           ` Sasha Levin
2011-09-02 14:25             ` Jan Kiszka
2011-09-02 14:30               ` Sasha Levin
2011-09-02 14:36                 ` Jan Kiszka
2011-09-02 14:44                   ` Gleb Natapov
2011-09-02 14:52                     ` Jan Kiszka
2011-09-02 15:03                       ` Gleb Natapov
2011-09-02 12:25     ` Gleb Natapov
2011-09-02 13:00       ` Jan Kiszka
2011-09-02 14:22         ` Gleb Natapov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.