kvm tools, minor nits fixes, updated
cover kvm tools, minor nits fixes, updated
Here is an updated series, please review.
Thanks,
Cyrill
PATCH 1/2 kvm tools: Fix up PCI pin assignment to conform specification
Only 4 pins are allowed for every PCI compilant device. Mutlifunctional devices can use up to all INTA#,B#,C#,D# pins, for our sindle function devices pin INTA# is enough.
Signed-off-by Cyrill Gorcunov <[email protected]>
--- tools/kvm/irq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/kvm/irq.c +7 -2
@@ -7,7 +7,6 @@#include <stddef.h> #include <stdlib.h> -static u8 next_pin =1 ;static u8 next_line =3 ;static u8 next_dev =1 ;static struct rb_root pci_tree =RB_ROOT ;
@@ -71,7 +70,13 @@ int irq__register_device(u32 dev, u8 *nu *node = (struct pci_dev ) { .id = dev, - .pin = next_pin++, +/* +* PCI supports only INTA#,B#,C#,D# per device. +* A#,B#,C#,D# are allowed for multifunctional +* devices so stick with A# for our single +* function devices. +*/ + .pin =1 , };INIT_LIST_HEAD (&node->lines);
PATCH 2/2 kvm tools: mptable -- Fix up srcbusirq assignment for PCI devices
In reply to Cyrill GorcunovThe kernel expects srcbusirq follows MP specification and consists a tuple of PCI device number with pin encoded. Make it so, otherwise the kernel reports kind of "buggy MP table" found.
Signed-off-by Cyrill Gorcunov <[email protected]>
--- tools/kvm/mptable.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/kvm/mptable.c +7 -3
@@ -191,12 +191,16 @@ void mptable_setup(struct kvm *kvm, unsifor (pci_tree =irq__get_pci_tree (); pci_tree; pci_tree =rb_next (pci_tree)) { struct pci_dev *dev = rb_entry(pci_tree, struct pci_dev, node); -struct irq_line *tmp; +struct irq_line *irq_line; + +list_for_each_entry (irq_line, &dev->lines, node) { +unsigned char srcbusirq; + + srcbusirq = (dev->id <<2 ) | (dev->pin -1 ); -list_for_each_entry (tmp, &dev->lines, node) { mpc_intsrc = last_addr; -mptable_add_irq_src (mpc_intsrc, pcibusid, dev->pin, ioapicid, tmp->line); +mptable_add_irq_src (mpc_intsrc, pcibusid, srcbusirq, ioapicid, irq_line->line); last_addr = (void *)&mpc_intsrc[1 ]; nentries++; }