Skip to content

Commit 773a38d

Browse files
Mike TravisH. Peter Anvin
authored andcommitted
vgaarb: Fix VGA arbiter to accept PCI domains other than 0
Update the VGA Arbiter to accept PCI Domains other than 0. Signed-off-by: Mike Travis <travis@sgi.com> LKML-Reference: <201002022238.o12McFe8018730@imap1.linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Robin Holt <holt@sgi.com> Cc: Jack Steiner <steiner@sgi.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: David Airlie <airlied@linux.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1 parent 841582e commit 773a38d

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

‎drivers/gpu/vga/vgaarb.c‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
954954
}
955955

956956
} else if (strncmp(curr_pos, "target ", 7) == 0) {
957+
struct pci_bus *pbus;
957958
unsigned int domain, bus, devfn;
958959
struct vga_device *vgadev;
959960

@@ -969,18 +970,31 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
969970
ret_val = -EPROTO;
970971
goto done;
971972
}
972-
973-
pdev = pci_get_bus_and_slot(bus, devfn);
973+
pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos,
974+
domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
975+
976+
pbus = pci_find_bus(domain, bus);
977+
pr_devel("vgaarb: pbus %p\n", pbus);
978+
if (pbus == NULL) {
979+
pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n",
980+
domain, bus);
981+
ret_val = -ENODEV;
982+
goto done;
983+
}
984+
pdev = pci_get_slot(pbus, devfn);
985+
pr_devel("vgaarb: pdev %p\n", pdev);
974986
if (!pdev) {
975-
pr_info("vgaarb: invalid PCI address!\n");
987+
pr_err("vgaarb: invalid PCI address %x:%x\n",
988+
bus, devfn);
976989
ret_val = -ENODEV;
977990
goto done;
978991
}
979992
}
980993

981994
vgadev = vgadev_find(pdev);
995+
pr_devel("vgaarb: vgadev %p\n", vgadev);
982996
if (vgadev == NULL) {
983-
pr_info("vgaarb: this pci device is not a vga device\n");
997+
pr_err("vgaarb: this pci device is not a vga device\n");
984998
pci_dev_put(pdev);
985999
ret_val = -ENODEV;
9861000
goto done;
@@ -998,7 +1012,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
9981012
}
9991013
}
10001014
if (i == MAX_USER_CARDS) {
1001-
pr_err("vgaarb: maximum user cards number reached!\n");
1015+
pr_err("vgaarb: maximum user cards (%d) number reached!\n",
1016+
MAX_USER_CARDS);
10021017
pci_dev_put(pdev);
10031018
/* XXX: which value to return? */
10041019
ret_val = -ENOMEM;

0 commit comments

Comments
 (0)