Skip to content

Commit c17c2f8

Browse files
ozbenhairlied
authored andcommitted
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 <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent c3b6ef8 commit c17c2f8

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

drivers/gpu/drm/drm_ioctl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_pri
392392
if (sv->drm_di_minor >= 1) {
393393
/*
394394
* Version 1.1 includes tying of DRM to specific device
395+
* Version 1.4 has proper PCI domain support
395396
*/
396397
retcode = drm_set_busid(dev, file_priv);
397398
if (retcode)

include/drm/drmP.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
10751075
return ((dev->driver->driver_features & feature) ? 1 : 0);
10761076
}
10771077

1078-
10791078
static inline int drm_dev_to_irq(struct drm_device *dev)
10801079
{
10811080
if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
@@ -1084,11 +1083,22 @@ static inline int drm_dev_to_irq(struct drm_device *dev)
10841083
return dev->pdev->irq;
10851084
}
10861085

1087-
#ifdef __alpha__
1088-
#define drm_get_pci_domain(dev) dev->hose->index
1089-
#else
1090-
#define drm_get_pci_domain(dev) 0
1091-
#endif
1086+
static inline int drm_get_pci_domain(struct drm_device *dev)
1087+
{
1088+
if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1089+
return 0;
1090+
1091+
#ifndef __alpha__
1092+
/* For historical reasons, drm_get_pci_domain() is busticated
1093+
* on most archs and has to remain so for userspace interface
1094+
* < 1.4, except on alpha which was right from the beginning
1095+
*/
1096+
if (dev->if_version < 0x10004)
1097+
return 0;
1098+
#endif /* __alpha__ */
1099+
1100+
return pci_domain_nr(dev->pdev->bus);
1101+
}
10921102

10931103
#if __OS_HAS_AGP
10941104
static inline int drm_core_has_AGP(struct drm_device *dev)

include/drm/drm_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define CORE_DATE "20060810"
2828

2929
#define DRM_IF_MAJOR 1
30-
#define DRM_IF_MINOR 3
30+
#define DRM_IF_MINOR 4
3131

3232
#define CORE_MAJOR 1
3333
#define CORE_MINOR 1

0 commit comments

Comments
 (0)