From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: [patch 2/2] kvm tools: mptable -- Fix up srcbusirq assignment for PCI devices Date: Sat, 07 May 2011 19:02:58 +0400 Message-ID: <20110507150520.407115109@gmail.com> References: <20110507150256.898160753@gmail.com> Cc: kvm@vger.kernel.org, mingo@elte.hu, levinsasha928@gmail.com, asias.hejun@gmail.com, prasadjoshi124@gmail.com, Cyrill Gorcunov To: penberg@kernel.org Return-path: Received: from mail-ey0-f174.google.com ([209.85.215.174]:51236 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755498Ab1EGPFZ (ORCPT ); Sat, 7 May 2011 11:05:25 -0400 Received: by eyx24 with SMTP id 24so1212755eyx.19 for ; Sat, 07 May 2011 08:05:24 -0700 (PDT) Content-Disposition: inline; filename=kvm-tools-fix-srcbusirq Sender: kvm-owner@vger.kernel.org List-ID: The 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 --- tools/kvm/mptable.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Index: linux-2.6.git/tools/kvm/mptable.c ===================================================================== --- linux-2.6.git.orig/tools/kvm/mptable.c +++ linux-2.6.git/tools/kvm/mptable.c @@ -191,12 +191,16 @@ void mptable_setup(struct kvm *kvm, unsi for (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++; }