]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.12/vgaarb-fix-vga-arbiter-to-accept-pci-domains-other-than-0.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / vgaarb-fix-vga-arbiter-to-accept-pci-domains-other-than-0.patch
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
5
6 From: Mike Travis <travis@sgi.com>
7
8 commit 773a38dbdad03474c5ee235f7d9bf9f51c9e3c2b upstream.
9
10 Update the VGA Arbiter to accept PCI Domains other than 0.
11
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>
24
25 ---
26 drivers/gpu/vga/vgaarb.c | 23 +++++++++++++++++++----
27 1 file changed, 19 insertions(+), 4 deletions(-)
28
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
32 }
33
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;
38
39 @@ -969,18 +970,31 @@ static ssize_t vga_arb_write(struct file
40 ret_val = -EPROTO;
41 goto done;
42 }
43 + pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos,
44 + domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
45
46 - pdev = pci_get_bus_and_slot(bus, devfn);
47 + pbus = pci_find_bus(domain, bus);
48 + pr_devel("vgaarb: pbus %p\n", pbus);
49 + if (pbus == NULL) {
50 + pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n",
51 + domain, bus);
52 + ret_val = -ENODEV;
53 + goto done;
54 + }
55 + pdev = pci_get_slot(pbus, devfn);
56 + pr_devel("vgaarb: pdev %p\n", pdev);
57 if (!pdev) {
58 - pr_info("vgaarb: invalid PCI address!\n");
59 + pr_err("vgaarb: invalid PCI address %x:%x\n",
60 + bus, devfn);
61 ret_val = -ENODEV;
62 goto done;
63 }
64 }
65
66 vgadev = vgadev_find(pdev);
67 + pr_devel("vgaarb: vgadev %p\n", vgadev);
68 if (vgadev == NULL) {
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");
71 pci_dev_put(pdev);
72 ret_val = -ENODEV;
73 goto done;
74 @@ -998,7 +1012,8 @@ static ssize_t vga_arb_write(struct file
75 }
76 }
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",
80 + MAX_USER_CARDS);
81 pci_dev_put(pdev);
82 /* XXX: which value to return? */
83 ret_val = -ENOMEM;