Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Fix support for PCI domains

(For some reason I thought that went in ages ago ...)

This fixes support for PCI domains in what should hopefully be a backward
compatible way along with a change to libdrm.

When the interface version is set to 1.4, we assume userspace understands
domains and the world is at peace. We thus pass proper domain numbers
instead of 0 to userspace.

The newer libdrm will then try 1.4 first, and fallback to 1.1, along with
ignoring domains in the later case (well, except on alpha of course)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Benjamin Herrenschmidt and committed by
Dave Airlie
c17c2f89 c3b6ef86

+18 -7
+1
drivers/gpu/drm/drm_ioctl.c
··· 392 392 if (sv->drm_di_minor >= 1) { 393 393 /* 394 394 * Version 1.1 includes tying of DRM to specific device 395 + * Version 1.4 has proper PCI domain support 395 396 */ 396 397 retcode = drm_set_busid(dev, file_priv); 397 398 if (retcode)
+16 -6
include/drm/drmP.h
··· 1075 1075 return ((dev->driver->driver_features & feature) ? 1 : 0); 1076 1076 } 1077 1077 1078 - 1079 1078 static inline int drm_dev_to_irq(struct drm_device *dev) 1080 1079 { 1081 1080 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) ··· 1083 1084 return dev->pdev->irq; 1084 1085 } 1085 1086 1086 - #ifdef __alpha__ 1087 - #define drm_get_pci_domain(dev) dev->hose->index 1088 - #else 1089 - #define drm_get_pci_domain(dev) 0 1090 - #endif 1087 + static inline int drm_get_pci_domain(struct drm_device *dev) 1088 + { 1089 + if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1090 + return 0; 1091 + 1092 + #ifndef __alpha__ 1093 + /* For historical reasons, drm_get_pci_domain() is busticated 1094 + * on most archs and has to remain so for userspace interface 1095 + * < 1.4, except on alpha which was right from the beginning 1096 + */ 1097 + if (dev->if_version < 0x10004) 1098 + return 0; 1099 + #endif /* __alpha__ */ 1100 + 1101 + return pci_domain_nr(dev->pdev->bus); 1102 + } 1091 1103 1092 1104 #if __OS_HAS_AGP 1093 1105 static inline int drm_core_has_AGP(struct drm_device *dev)
+1 -1
include/drm/drm_core.h
··· 27 27 #define CORE_DATE "20060810" 28 28 29 29 #define DRM_IF_MAJOR 1 30 - #define DRM_IF_MINOR 3 30 + #define DRM_IF_MINOR 4 31 31 32 32 #define CORE_MAJOR 1 33 33 #define CORE_MINOR 1