diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:59:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:59:18 -0500 |
commit | c7e15899d07c9813c1aa96b21699d2d9c8314c4b (patch) | |
tree | 16e9b4dceddf1b4d1dad05588d700c70cf8fcb88 /drivers | |
parent | f6a0b5cd34d6e922cc7258c5429fb0f17508ceb6 (diff) | |
parent | 78c06176466cbd1b3f0f67709d3023c40dbebcbd (diff) |
Merge branch 'x86-pci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-pci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Enable NMI on all cpus on UV
vgaarb: Add user selectability of the number of GPUS in a system
vgaarb: Fix VGA arbiter to accept PCI domains other than 0
x86, uv: Update UV arch to target Legacy VGA I/O correctly.
pci: Update pci_set_vga_state() to call arch functions
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/vga/Kconfig | 8 | ||||
-rw-r--r-- | drivers/gpu/vga/vgaarb.c | 27 | ||||
-rw-r--r-- | drivers/pci/pci.c | 25 |
3 files changed, 53 insertions, 7 deletions
diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig index 790e675b13eb..0920492cea0a 100644 --- a/drivers/gpu/vga/Kconfig +++ b/drivers/gpu/vga/Kconfig | |||
@@ -8,3 +8,11 @@ config VGA_ARB | |||
8 | are accessed at same time they need some kind of coordination. Please | 8 | are accessed at same time they need some kind of coordination. Please |
9 | see Documentation/vgaarbiter.txt for more details. Select this to | 9 | see Documentation/vgaarbiter.txt for more details. Select this to |
10 | enable VGA arbiter. | 10 | enable VGA arbiter. |
11 | |||
12 | config VGA_ARB_MAX_GPUS | ||
13 | int "Maximum number of GPUs" | ||
14 | default 16 | ||
15 | depends on VGA_ARB | ||
16 | help | ||
17 | Reserves space in the kernel to maintain resource locking for | ||
18 | multiple GPUS. The overhead for each GPU is very small. | ||
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 2f6cf69ecb39..8827814d0735 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -688,7 +688,7 @@ EXPORT_SYMBOL(vga_client_register); | |||
688 | * the arbiter. | 688 | * the arbiter. |
689 | */ | 689 | */ |
690 | 690 | ||
691 | #define MAX_USER_CARDS 16 | 691 | #define MAX_USER_CARDS CONFIG_VGA_ARB_MAX_GPUS |
692 | #define PCI_INVALID_CARD ((struct pci_dev *)-1UL) | 692 | #define PCI_INVALID_CARD ((struct pci_dev *)-1UL) |
693 | 693 | ||
694 | /* | 694 | /* |
@@ -954,6 +954,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
954 | } | 954 | } |
955 | 955 | ||
956 | } else if (strncmp(curr_pos, "target ", 7) == 0) { | 956 | } else if (strncmp(curr_pos, "target ", 7) == 0) { |
957 | struct pci_bus *pbus; | ||
957 | unsigned int domain, bus, devfn; | 958 | unsigned int domain, bus, devfn; |
958 | struct vga_device *vgadev; | 959 | struct vga_device *vgadev; |
959 | 960 | ||
@@ -969,18 +970,31 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
969 | ret_val = -EPROTO; | 970 | ret_val = -EPROTO; |
970 | goto done; | 971 | goto done; |
971 | } | 972 | } |
972 | 973 | pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos, | |
973 | pdev = pci_get_bus_and_slot(bus, devfn); | 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); | ||
974 | if (!pdev) { | 986 | if (!pdev) { |
975 | pr_info("vgaarb: invalid PCI address!\n"); | 987 | pr_err("vgaarb: invalid PCI address %x:%x\n", |
988 | bus, devfn); | ||
976 | ret_val = -ENODEV; | 989 | ret_val = -ENODEV; |
977 | goto done; | 990 | goto done; |
978 | } | 991 | } |
979 | } | 992 | } |
980 | 993 | ||
981 | vgadev = vgadev_find(pdev); | 994 | vgadev = vgadev_find(pdev); |
995 | pr_devel("vgaarb: vgadev %p\n", vgadev); | ||
982 | if (vgadev == NULL) { | 996 | 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"); |
984 | pci_dev_put(pdev); | 998 | pci_dev_put(pdev); |
985 | ret_val = -ENODEV; | 999 | ret_val = -ENODEV; |
986 | goto done; | 1000 | goto done; |
@@ -998,7 +1012,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
998 | } | 1012 | } |
999 | } | 1013 | } |
1000 | if (i == MAX_USER_CARDS) { | 1014 | 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); | ||
1002 | pci_dev_put(pdev); | 1017 | pci_dev_put(pdev); |
1003 | /* XXX: which value to return? */ | 1018 | /* XXX: which value to return? */ |
1004 | ret_val = -ENOMEM; | 1019 | ret_val = -ENOMEM; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2b9ac9e594af..5b548aee9cbc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2754,6 +2754,23 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) | |||
2754 | return 0; | 2754 | return 0; |
2755 | } | 2755 | } |
2756 | 2756 | ||
2757 | /* Some architectures require additional programming to enable VGA */ | ||
2758 | static arch_set_vga_state_t arch_set_vga_state; | ||
2759 | |||
2760 | void __init pci_register_set_vga_state(arch_set_vga_state_t func) | ||
2761 | { | ||
2762 | arch_set_vga_state = func; /* NULL disables */ | ||
2763 | } | ||
2764 | |||
2765 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, | ||
2766 | unsigned int command_bits, bool change_bridge) | ||
2767 | { | ||
2768 | if (arch_set_vga_state) | ||
2769 | return arch_set_vga_state(dev, decode, command_bits, | ||
2770 | change_bridge); | ||
2771 | return 0; | ||
2772 | } | ||
2773 | |||
2757 | /** | 2774 | /** |
2758 | * pci_set_vga_state - set VGA decode state on device and parents if requested | 2775 | * pci_set_vga_state - set VGA decode state on device and parents if requested |
2759 | * @dev: the PCI device | 2776 | * @dev: the PCI device |
@@ -2767,9 +2784,15 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, | |||
2767 | struct pci_bus *bus; | 2784 | struct pci_bus *bus; |
2768 | struct pci_dev *bridge; | 2785 | struct pci_dev *bridge; |
2769 | u16 cmd; | 2786 | u16 cmd; |
2787 | int rc; | ||
2770 | 2788 | ||
2771 | WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)); | 2789 | WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)); |
2772 | 2790 | ||
2791 | /* ARCH specific VGA enables */ | ||
2792 | rc = pci_set_vga_state_arch(dev, decode, command_bits, change_bridge); | ||
2793 | if (rc) | ||
2794 | return rc; | ||
2795 | |||
2773 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 2796 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
2774 | if (decode == true) | 2797 | if (decode == true) |
2775 | cmd |= command_bits; | 2798 | cmd |= command_bits; |
@@ -2984,6 +3007,7 @@ EXPORT_SYMBOL(pcim_pin_device); | |||
2984 | EXPORT_SYMBOL(pci_disable_device); | 3007 | EXPORT_SYMBOL(pci_disable_device); |
2985 | EXPORT_SYMBOL(pci_find_capability); | 3008 | EXPORT_SYMBOL(pci_find_capability); |
2986 | EXPORT_SYMBOL(pci_bus_find_capability); | 3009 | EXPORT_SYMBOL(pci_bus_find_capability); |
3010 | EXPORT_SYMBOL(pci_register_set_vga_state); | ||
2987 | EXPORT_SYMBOL(pci_release_regions); | 3011 | EXPORT_SYMBOL(pci_release_regions); |
2988 | EXPORT_SYMBOL(pci_request_regions); | 3012 | EXPORT_SYMBOL(pci_request_regions); |
2989 | EXPORT_SYMBOL(pci_request_regions_exclusive); | 3013 | EXPORT_SYMBOL(pci_request_regions_exclusive); |
@@ -3015,4 +3039,3 @@ EXPORT_SYMBOL(pci_target_state); | |||
3015 | EXPORT_SYMBOL(pci_prepare_to_sleep); | 3039 | EXPORT_SYMBOL(pci_prepare_to_sleep); |
3016 | EXPORT_SYMBOL(pci_back_from_sleep); | 3040 | EXPORT_SYMBOL(pci_back_from_sleep); |
3017 | EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); | 3041 | EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); |
3018 | |||