1 From 773a38dbdad03474c5ee235f7d9bf9f51c9e3c2b Mon Sep 17 00:00:00 2001
2 From: Mike Travis <travis@sgi.com>
3 Date: Tue, 2 Feb 2010 14:38:15 -0800
4 Subject: vgaarb: Fix VGA arbiter to accept PCI domains other than 0
6 From: Mike Travis <travis@sgi.com>
8 commit 773a38dbdad03474c5ee235f7d9bf9f51c9e3c2b upstream.
10 Update the VGA Arbiter to accept PCI Domains other than 0.
12 Signed-off-by: Mike Travis <travis@sgi.com>
13 LKML-Reference: <201002022238.o12McFe8018730@imap1.linux-foundation.org>
14 Cc: Thomas Gleixner <tglx@linutronix.de>
15 Cc: Robin Holt <holt@sgi.com>
16 Cc: Jack Steiner <steiner@sgi.com>
17 Cc: Ingo Molnar <mingo@elte.hu>
18 Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
19 Cc: David Airlie <airlied@linux.ie>
20 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
21 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
22 Cc: maximilian attems <max@stro.at>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26 drivers/gpu/vga/vgaarb.c | 23 +++++++++++++++++++----
27 1 file changed, 19 insertions(+), 4 deletions(-)
29 --- a/drivers/gpu/vga/vgaarb.c
30 +++ b/drivers/gpu/vga/vgaarb.c
31 @@ -954,6 +954,7 @@ static ssize_t vga_arb_write(struct file
34 } else if (strncmp(curr_pos, "target ", 7) == 0) {
35 + struct pci_bus *pbus;
36 unsigned int domain, bus, devfn;
37 struct vga_device *vgadev;
39 @@ -969,18 +970,31 @@ static ssize_t vga_arb_write(struct file
43 + pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos,
44 + domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
46 - pdev = pci_get_bus_and_slot(bus, devfn);
47 + pbus = pci_find_bus(domain, bus);
48 + pr_devel("vgaarb: pbus %p\n", pbus);
50 + pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n",
55 + pdev = pci_get_slot(pbus, devfn);
56 + pr_devel("vgaarb: pdev %p\n", pdev);
58 - pr_info("vgaarb: invalid PCI address!\n");
59 + pr_err("vgaarb: invalid PCI address %x:%x\n",
66 vgadev = vgadev_find(pdev);
67 + pr_devel("vgaarb: vgadev %p\n", vgadev);
69 - pr_info("vgaarb: this pci device is not a vga device\n");
70 + pr_err("vgaarb: this pci device is not a vga device\n");
74 @@ -998,7 +1012,8 @@ static ssize_t vga_arb_write(struct file
77 if (i == MAX_USER_CARDS) {
78 - pr_err("vgaarb: maximum user cards number reached!\n");
79 + pr_err("vgaarb: maximum user cards (%d) number reached!\n",
82 /* XXX: which value to return? */