drm/amdgpu: Drop DRIVER_USE_AGP
Subsystems (3)
PATCH 1/3 drm/amdgpu: Drop DRIVER_USE_AGP
This doesn't do anything except auto-init drm_agp support when you call drm_get_pci_dev(). Which amdgpu stopped doing with
commit b58c11314a1706bf094c489ef5cb28f76478c704
Author: Alex Deucher <[email protected]> Date: Fri Jun 2 17:16:31 2017 -0400
drm/amdgpu: drop deprecated drm_get_pci_dev and drm_put_dev
No idea whether this was intentional or accidental breakage, but I guess anyone who manages to boot a this modern gpu behind an agp bridge deserves a price. A price I never expect anyone to ever collect :-)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -1379,7 +1379,7 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)static struct drm_driver kms_driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_ATOMIC | +DRIVER_ATOMIC |DRIVER_GEM |DRIVER_RENDER |DRIVER_MODESET |DRIVER_SYNCOBJ |DRIVER_SYNCOBJ_TIMELINE ,
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/radeon: Inline drm_get_pci_dev
It's the last user, and more importantly, it's the last non-legacy user of anything in drm_pci.c.
The only tricky bit is the agp initialization. But a close look shows that radeon does not use the drm_agp midlayer (the main use of that is drm_bufs for legacy drivers), and instead could use the agp subsystem directly (like nouveau does already). Hence we can just pull this in too.
A further step would be to entirely drop the use of drm_device->agp, but feels like too much churn just for this patch.
--- drivers/gpu/drm/radeon/radeon_drv.c | 43 +++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_kms.c | 6 ++++ 2 files changed, 47 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +41 -2
@@ -37,6 +37,7 @@#include <linux/vga_switcheroo.h> #include <linux/mmu_notifier.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h>
@@ -322,6 +323,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned long flags =0 ; +struct drm_device *dev;int ret;if (!ent)
@@ -362,7 +364,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,if (ret)return ret; -return drm_get_pci_dev (pdev, ent, &kms_driver); + dev =drm_dev_alloc (&kms_driver, &pdev->dev); +if (IS_ERR (dev)) +return PTR_ERR (dev); + + ret =pci_enable_device (pdev); +if (ret) + goto err_free; + + dev->pdev = pdev; +#ifdef __alpha__ + dev->hose = pdev->sysdata; +#endif + +pci_set_drvdata (pdev, dev); + +if (pci_find_capability (dev->pdev,PCI_CAP_ID_AGP )) + dev->agp =drm_agp_init (dev); +if (dev->agp) { + dev->agp->agp_mtrr =arch_phys_wc_add ( + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * +1024 *1024 ); + } + + ret =drm_dev_register (dev, ent->driver_data); +if (ret) + goto err_agp; + +return 0 ; + +err_agp: +if (dev->agp) +arch_phys_wc_del (dev->agp->agp_mtrr); +kfree (dev->agp); +pci_disable_device (pdev); +err_free: +drm_dev_put (dev); +return ret; } static void
@@ -562,7 +601,7 @@ static const struct file_operations radeon_driver_kms_fops = {static struct drm_driver kms_driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_GEM |DRIVER_RENDER , +DRIVER_GEM |DRIVER_RENDER , .load = radeon_driver_load_kms, .open = radeon_driver_open_kms, .postclose = radeon_driver_postclose_kms,
drivers/gpu/drm/radeon/radeon_kms.c +6 -0
@@ -32,6 +32,7 @@#include <linux/uaccess.h> #include <linux/vga_switcheroo.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_fb_helper.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h>
@@ -77,6 +78,11 @@ void radeon_driver_unload_kms(struct drm_device *dev)radeon_modeset_fini (rdev);radeon_device_fini (rdev); +if (dev->agp) +arch_phys_wc_del (dev->agp->agp_mtrr); +kfree (dev->agp); + dev->agp =NULL ; + done_free:kfree (rdev); dev->dev_private =NULL ;
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/3] drm/radeon: Inline drm_get_pci_dev
Quoted 62 lines · Daniel Vetter
It's the last user, and more importantly, it's the last non-legacy user of anything in
drm_pci.c.The only tricky bit is the agp initialization. But a close look shows that radeon does not use the
drm_agpmidlayer (the main use of that isdrm_bufsfor legacy drivers), and instead could use the agp subsystem directly (like nouveau does already). Hence we can just pull this in too.A further step would be to entirely drop the use of
drm_device->agp, but feels like too much churn just for this patch.Signed-off-by Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>--- drivers/gpu/drm/radeon/radeon_drv.c | 43 +++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_kms.c | 6 ++++ 2 files changed, 47 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_drv.c +16
-1@@ -37,6 +37,7 @@#include <linux/vga_switcheroo.h> #include <linux/mmu_notifier.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> @@ -322,6 +323,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned long flags =0 ; +struct drm_device *dev;int ret;if (!ent)@@ -362,7 +364,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,if (ret)return ret; -return drm_get_pci_dev (pdev, ent, &kms_driver); + dev =drm_dev_alloc (&kms_driver, &pdev->dev); +if (IS_ERR (dev)) +return PTR_ERR (dev); + + ret =pci_enable_device (pdev); +if (ret) + goto err_free; + + dev->pdev = pdev; +#ifdef __alpha__ + dev->hose = pdev->sysdata; +#endif + +pci_set_drvdata (pdev, dev);
drivers/gpu/drm/radeon/radeon_drv.c static int radeon_pci_probe(struct pci_dev *pdev, · line 390
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_drv.c +10
-0+ +if (pci_find_capability (dev->pdev,PCI_CAP_ID_AGP )) + dev->agp =drm_agp_init (dev); +if (dev->agp) { + dev->agp->agp_mtrr =arch_phys_wc_add ( + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * +1024 *1024 ); + } +
IMHO a better solution is kill off the drm_agpsupport.c dependency all together. As-is it's still used, making the legacy vs not line really moot.
Especially, since the AGP ioctl (in the legacy code) can manipulate the underlying state.
Off the top of my head, in radeon_agp_init():
- at the top agp_backend_acquire() + agp_copy_info()
- followed up by existing mode magic
- opencode the enable - agp_enable() + acquired = true;
- mtrr = arch_phys_wc_add() and the rest
In radeon_agp_fini()
- if !acquired { agp_backend_release(); acquired = false }
Something like ^^ should result in a net diffstat of around zero. All thanks to the interesting layer that drm_agp is ;-)
With this in place we can make move drm_device::agp and DRM_IOCTL_AGP_INFO behind CONFIG_DRM_LEGACY.
-EmilP.S. Watch out for radeon_ttm.c warnings/errors
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm/radeon: Inline drm_get_pci_dev
Quoted 90 lines · Emil Velikov
Quoted 62 lines · Daniel Vetter
It's the last user, and more importantly, it's the last non-legacy user of anything in
drm_pci.c.The only tricky bit is the agp initialization. But a close look shows that radeon does not use the
drm_agpmidlayer (the main use of that isdrm_bufsfor legacy drivers), and instead could use the agp subsystem directly (like nouveau does already). Hence we can just pull this in too.A further step would be to entirely drop the use of
drm_device->agp, but feels like too much churn just for this patch.Signed-off-by Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>--- drivers/gpu/drm/radeon/radeon_drv.c | 43 +++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_kms.c | 6 ++++ 2 files changed, 47 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_drv.c +16
-1@@ -37,6 +37,7 @@#include <linux/vga_switcheroo.h> #include <linux/mmu_notifier.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> @@ -322,6 +323,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned long flags =0 ; +struct drm_device *dev;int ret;if (!ent)@@ -362,7 +364,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,if (ret)return ret; -return drm_get_pci_dev (pdev, ent, &kms_driver); + dev =drm_dev_alloc (&kms_driver, &pdev->dev); +if (IS_ERR (dev)) +return PTR_ERR (dev); + + ret =pci_enable_device (pdev); +if (ret) + goto err_free; + + dev->pdev = pdev; +#ifdef __alpha__ + dev->hose = pdev->sysdata; +#endif + +pci_set_drvdata (pdev, dev);drivers/gpu/drm/radeon/radeon_drv.c static int radeon_pci_probe(struct pci_dev *pdev, · line 390
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_drv.c +10
-0+ +if (pci_find_capability (dev->pdev,PCI_CAP_ID_AGP )) + dev->agp =drm_agp_init (dev); +if (dev->agp) { + dev->agp->agp_mtrr =arch_phys_wc_add ( + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * +1024 *1024 ); + } +IMHO a better solution is kill off the
drm_agpsupport.cdependency all together. As-is it's still used, making the legacy vs not line really moot.Especially, since the AGP ioctl (in the legacy code) can manipulate the underlying state.
Off the top of my head, in
radeon_agp_init():
- at the topagp_backend_acquire()+agp_copy_info()
- followed up by existing mode magic
- opencode the enable -agp_enable()+ acquired = true;
- mtrr =arch_phys_wc_add()and the restIn
radeon_agp_fini()
- if !acquired {agp_backend_release(); acquired = false }
Quoted 5 lines
Something like ^^ should result in a net diffstat of around zero. All thanks to the interesting layer that
drm_agpis ;-)With this in place we can make move
drm_device::agpandDRM_IOCTL_AGP_INFObehindCONFIG_DRM_LEGACY.
Yeah could be done, but I was more out to get the drm_pci.c stuff, not the agp stuff. But I did realize that nouveau also just directly accesses the agp bridge stuff, so we could indeed nuke the midlayer here. The legacy agp stuff ioctl stuff should be behind DRIVER_LEGACY checks already, so no way to cause harm that way (I hope at least, if there's a gap we'd need to close it).
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm/radeon: Inline drm_get_pci_dev
Quoted 98 lines · Daniel Vetter
Quoted 90 lines · Emil Velikov
Quoted 62 lines · Daniel Vetter
It's the last user, and more importantly, it's the last non-legacy user of anything in
drm_pci.c.The only tricky bit is the agp initialization. But a close look shows that radeon does not use the
drm_agpmidlayer (the main use of that isdrm_bufsfor legacy drivers), and instead could use the agp subsystem directly (like nouveau does already). Hence we can just pull this in too.A further step would be to entirely drop the use of
drm_device->agp, but feels like too much churn just for this patch.Signed-off-by Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>--- drivers/gpu/drm/radeon/radeon_drv.c | 43 +++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_kms.c | 6 ++++ 2 files changed, 47 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_drv.c +16
-1@@ -37,6 +37,7 @@#include <linux/vga_switcheroo.h> #include <linux/mmu_notifier.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> @@ -322,6 +323,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned long flags =0 ; +struct drm_device *dev;int ret;if (!ent)@@ -362,7 +364,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,if (ret)return ret; -return drm_get_pci_dev (pdev, ent, &kms_driver); + dev =drm_dev_alloc (&kms_driver, &pdev->dev); +if (IS_ERR (dev)) +return PTR_ERR (dev); + + ret =pci_enable_device (pdev); +if (ret) + goto err_free; + + dev->pdev = pdev; +#ifdef __alpha__ + dev->hose = pdev->sysdata; +#endif + +pci_set_drvdata (pdev, dev);drivers/gpu/drm/radeon/radeon_drv.c static int radeon_pci_probe(struct pci_dev *pdev, · line 390
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_drv.c +10
-0+ +if (pci_find_capability (dev->pdev,PCI_CAP_ID_AGP )) + dev->agp =drm_agp_init (dev); +if (dev->agp) { + dev->agp->agp_mtrr =arch_phys_wc_add ( + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * +1024 *1024 ); + } +IMHO a better solution is kill off the
drm_agpsupport.cdependency all together. As-is it's still used, making the legacy vs not line really moot.Especially, since the AGP ioctl (in the legacy code) can manipulate the underlying state.
Off the top of my head, in
radeon_agp_init():
- at the topagp_backend_acquire()+agp_copy_info()
- followed up by existing mode magic
- opencode the enable -agp_enable()+ acquired = true;
- mtrr =arch_phys_wc_add()and the restIn
radeon_agp_fini()
- if !acquired {agp_backend_release(); acquired = false }Quoted 5 lines
Something like ^^ should result in a net diffstat of around zero. All thanks to the interesting layer that
drm_agpis ;-)With this in place we can make move
drm_device::agpandDRM_IOCTL_AGP_INFObehindCONFIG_DRM_LEGACY.
Quoted 6 lines
Yeah could be done, but I was more out to get the
drm_pci.cstuff, not the agp stuff. But I did realize that nouveau also just directly accesses the agp bridge stuff, so we could indeed nuke the midlayer here. The legacy agp stuff ioctl stuff should be behindDRIVER_LEGACYchecks already, so no way to cause harm that way (I hope at least, if there's a gap we'd need to close it).
Haha, I should read code before hitting send.
It's totally wide open root hole. I guess no one ever bothered to run a fuzzer on a radeon.ko or amdgpu.ko (before the patch to stop using drm_get_pci_dev at least) hw. And I never cared since we've killed the fake agp stuff that i915.ko used a long time ago.
So yeah I think at least sprinkling DRIVER_LEGACY checks over all this, and reviewing old radeon userspace, would be really good. Once we have that we can then do the second step and retire the agp midlayer. But first we need to add the uapi checks/changes. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedRe: [PATCH 2/3] drm/radeon: Inline drm_get_pci_dev
In reply to Daniel VetterQuoted 10 lines · Daniel Vetter
It's the last user, and more importantly, it's the last non-legacy user of anything in
drm_pci.c.The only tricky bit is the agp initialization. But a close look shows that radeon does not use the
drm_agpmidlayer (the main use of that isdrm_bufsfor legacy drivers), and instead could use the agp subsystem directly (like nouveau does already). Hence we can just pull this in too.
Quoted 8 lines
A further step would be to entirely drop the use of
drm_device->agp, but feels like too much churn just for this patch.Signed-off-by Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>
Applied. Thanks!
Alex
Quoted 107 lines
--- drivers/gpu/drm/radeon/radeon_drv.c | 43 +++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_kms.c | 6 ++++ 2 files changed, 47 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_drv.c +41
-2@@ -37,6 +37,7 @@#include <linux/vga_switcheroo.h> #include <linux/mmu_notifier.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> @@ -322,6 +323,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned long flags =0 ; +struct drm_device *dev;int ret;if (!ent)@@ -362,7 +364,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,if (ret)return ret; -return drm_get_pci_dev (pdev, ent, &kms_driver); + dev =drm_dev_alloc (&kms_driver, &pdev->dev); +if (IS_ERR (dev)) +return PTR_ERR (dev); + + ret =pci_enable_device (pdev); +if (ret) + goto err_free; + + dev->pdev = pdev; +#ifdef __alpha__ + dev->hose = pdev->sysdata; +#endif + +pci_set_drvdata (pdev, dev); + +if (pci_find_capability (dev->pdev,PCI_CAP_ID_AGP )) + dev->agp =drm_agp_init (dev); +if (dev->agp) { + dev->agp->agp_mtrr =arch_phys_wc_add ( + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * +1024 *1024 ); + } + + ret =drm_dev_register (dev, ent->driver_data); +if (ret) + goto err_agp; + +return 0 ; + +err_agp: +if (dev->agp) +arch_phys_wc_del (dev->agp->agp_mtrr); +kfree (dev->agp); +pci_disable_device (pdev); +err_free: +drm_dev_put (dev); +return ret; } static void@@ -562,7 +601,7 @@ static const struct file_operations radeon_driver_kms_fops = {static struct drm_driver kms_driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_GEM |DRIVER_RENDER , +DRIVER_GEM |DRIVER_RENDER , .load = radeon_driver_load_kms, .open = radeon_driver_open_kms, .postclose = radeon_driver_postclose_kms,drivers/gpu/drm/radeon/radeon_kms.c +6
-1@@ -32,6 +32,7 @@#include <linux/uaccess.h> #include <linux/vga_switcheroo.h> +#include <drm/drm_agpsupport.h> #include <drm/drm_fb_helper.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h> @@ -77,6 +78,11 @@ void radeon_driver_unload_kms(struct drm_device *dev)radeon_modeset_fini (rdev);radeon_device_fini (rdev); +if (dev->agp) +arch_phys_wc_del (dev->agp->agp_mtrr); +kfree (dev->agp); + dev->agp =NULL ; + done_free:kfree (rdev); dev->dev_private =NULL ; --2.24.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/pci: Unexport drm_get_pci_dev
In reply to Daniel VetterOnly user left is the shadow attach for legacy drivers.
--- drivers/gpu/drm/drm_pci.c | 22 +++------------------- include/drm/drm_pci.h | 11 ----------- 2 files changed, 3 insertions(+), 30 deletions(-)
drivers/gpu/drm/drm_pci.c +3 -19
@@ -75,7 +75,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t alireturn dmah; } -EXPORT_SYMBOL (drm_pci_alloc);/**
@@ -191,23 +190,9 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -/** -* drm_get_pci_dev - Register a PCI device with the DRM subsystem -* @pdev: PCI device -* @ent: entry from the PCI ID table that matches @pdev -* @driver: DRM device driver -* -* Attempt to gets inter module "drm" information. If we are first -* then register the character device and inter module information. -* Try and register, if we fail to register, backout previous work. -* -* NOTE: This function is deprecated, please use drm_dev_alloc() and -* drm_dev_register() instead and remove your &drm_driver.load callback. -* -* Return: 0 on success or a negative error code on failure. -*/ -int drm_get_pci_dev (struct pci_dev *pdev,const struct pci_device_id *ent, -struct drm_driver *driver) +static int drm_get_pci_dev (struct pci_dev *pdev, +const struct pci_device_id *ent, +struct drm_driver *driver) {struct drm_device *dev;int ret;
@@ -250,7 +235,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,drm_dev_put (dev);return ret; } -EXPORT_SYMBOL (drm_get_pci_dev);#ifdef CONFIG_DRM_LEGACY
include/drm/drm_pci.h +0 -11
@@ -45,10 +45,6 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, size_t align);void drm_pci_free (struct drm_device *dev,struct drm_dma_handle * dmah); -int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver); -#else static inline struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev,
@@ -62,13 +58,6 @@ static inline void drm_pci_free(struct drm_device *dev, { } -static inline int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver) -{ -return -ENOSYS ; -} -#endif #endif /* _DRM_PCI_H_ */
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/pci: Unexport drm_get_pci_dev
Quoted 4 lines · Daniel Vetter
Only user left is the shadow attach for legacy drivers.
Signed-off-by Daniel Vetter <[email protected]>
Going the extra step, as outlined in 2/3 would be great. But if the series goes as-is, 2/3 and 3/3 are:
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/pci: Unexport drm_get_pci_dev
In reply to Daniel VetterHi
Am 22.02.20 um 18:54 schrieb Daniel Vetter:
Quoted 48 lines
Only user left is the shadow attach for legacy drivers.
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_pci.c | 22 +++------------------- include/drm/drm_pci.h | 11 ----------- 2 files changed, 3 insertions(+), 30 deletions(-)drivers/gpu/drm/drm_pci.c +3
-18@@ -75,7 +75,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t alireturn dmah; } -EXPORT_SYMBOL (drm_pci_alloc);/** @@ -191,23 +190,9 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -/** -* drm_get_pci_dev - Register a PCI device with the DRM subsystem -* @pdev: PCI device -* @ent: entry from the PCI ID table that matches @pdev -* @driver: DRM device driver -* -* Attempt to gets inter module "drm" information. If we are first -* then register the character device and inter module information. -* Try and register, if we fail to register, backout previous work. -* -* NOTE: This function is deprecated, please use drm_dev_alloc() and -* drm_dev_register() instead and remove your &drm_driver.load callback. -* -* Return: 0 on success or a negative error code on failure. -*/ -int drm_get_pci_dev (struct pci_dev *pdev,const struct pci_device_id *ent, -struct drm_driver *driver) +static int drm_get_pci_dev (struct pci_dev *pdev, +const struct pci_device_id *ent, +struct drm_driver *driver) {struct drm_device *dev;int ret;
drivers/gpu/drm/drm_pci.c int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, · line 239
Quoted 6 lines
drivers/gpu/drm/drm_pci.c +0
-1@@ -250,7 +235,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,drm_dev_put (dev);return ret; } -EXPORT_SYMBOL (drm_get_pci_dev);#ifdef CONFIG_DRM_LEGACY
drm_get_pci_dev() is now only used by some legacy code. It should be protected by CONFIG_DRM_LEGACY. With this change
Quoted 31 lines
include/drm/drm_pci.h +0
-11@@ -45,10 +45,6 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, size_t align);void drm_pci_free (struct drm_device *dev,struct drm_dma_handle * dmah); -int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver); -#else static inline struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev,@@ -62,13 +58,6 @@ static inline void drm_pci_free(struct drm_device *dev, { } -static inline int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver) -{ -return -ENOSYS ; -} -#endif #endif /* _DRM_PCI_H_ */
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/pci: Unexport drm_get_pci_dev
In reply to Daniel VetterOnly user left is the shadow attach for legacy drivers.
v2: Shift the #ifdef CONFIG_DRM_LEGACY to now also include drm_get_pci_dev() (Thomas)
--- drivers/gpu/drm/drm_pci.c | 26 +++++--------------------- include/drm/drm_pci.h | 11 ----------- 2 files changed, 5 insertions(+), 32 deletions(-)
drivers/gpu/drm/drm_pci.c +5 -21
@@ -75,7 +75,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t alireturn dmah; } -EXPORT_SYMBOL (drm_pci_alloc);/**
@@ -191,23 +190,11 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -/** -* drm_get_pci_dev - Register a PCI device with the DRM subsystem -* @pdev: PCI device -* @ent: entry from the PCI ID table that matches @pdev -* @driver: DRM device driver -* -* Attempt to gets inter module "drm" information. If we are first -* then register the character device and inter module information. -* Try and register, if we fail to register, backout previous work. -* -* NOTE: This function is deprecated, please use drm_dev_alloc() and -* drm_dev_register() instead and remove your &drm_driver.load callback. -* -* Return: 0 on success or a negative error code on failure. -*/ -int drm_get_pci_dev (struct pci_dev *pdev,const struct pci_device_id *ent, -struct drm_driver *driver) +#ifdef CONFIG_DRM_LEGACY + +static int drm_get_pci_dev (struct pci_dev *pdev, +const struct pci_device_id *ent, +struct drm_driver *driver) {struct drm_device *dev;int ret;
@@ -250,9 +237,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,drm_dev_put (dev);return ret; } -EXPORT_SYMBOL (drm_get_pci_dev); - -#ifdef CONFIG_DRM_LEGACY /** * drm_legacy_pci_init - shadow-attach a legacy DRM PCI driver
include/drm/drm_pci.h +0 -11
@@ -45,10 +45,6 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, size_t align);void drm_pci_free (struct drm_device *dev,struct drm_dma_handle * dmah); -int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver); -#else static inline struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev,
@@ -62,13 +58,6 @@ static inline void drm_pci_free(struct drm_device *dev, { } -static inline int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver) -{ -return -ENOSYS ; -} -#endif #endif /* _DRM_PCI_H_ */
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedRe: [PATCH] drm/pci: Unexport drm_get_pci_dev
Quoted 11 lines · Daniel Vetter
Only user left is the shadow attach for legacy drivers.
v2: Shift the #ifdef
CONFIG_DRM_LEGACYto now also includedrm_get_pci_dev()(Thomas)Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Alex Deucher <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>Reviewed-by Emil Velikov <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Pushed to drm-misc-next now that the radeon/amdgpu patches have been backmerged.
-Daniel
Quoted 88 lines
--- drivers/gpu/drm/drm_pci.c | 26 +++++--------------------- include/drm/drm_pci.h | 11 ----------- 2 files changed, 5 insertions(+), 32 deletions(-)drivers/gpu/drm/drm_pci.c +5
-21@@ -75,7 +75,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t alireturn dmah; } -EXPORT_SYMBOL (drm_pci_alloc);/** @@ -191,23 +190,11 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -/** -* drm_get_pci_dev - Register a PCI device with the DRM subsystem -* @pdev: PCI device -* @ent: entry from the PCI ID table that matches @pdev -* @driver: DRM device driver -* -* Attempt to gets inter module "drm" information. If we are first -* then register the character device and inter module information. -* Try and register, if we fail to register, backout previous work. -* -* NOTE: This function is deprecated, please use drm_dev_alloc() and -* drm_dev_register() instead and remove your &drm_driver.load callback. -* -* Return: 0 on success or a negative error code on failure. -*/ -int drm_get_pci_dev (struct pci_dev *pdev,const struct pci_device_id *ent, -struct drm_driver *driver) +#ifdef CONFIG_DRM_LEGACY + +static int drm_get_pci_dev (struct pci_dev *pdev, +const struct pci_device_id *ent, +struct drm_driver *driver) {struct drm_device *dev;int ret;@@ -250,9 +237,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,drm_dev_put (dev);return ret; } -EXPORT_SYMBOL (drm_get_pci_dev); - -#ifdef CONFIG_DRM_LEGACY /** * drm_legacy_pci_init - shadow-attach a legacy DRM PCI driver include/drm/drm_pci.h +0
-11@@ -45,10 +45,6 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, size_t align);void drm_pci_free (struct drm_device *dev,struct drm_dma_handle * dmah); -int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver); -#else static inline struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev,@@ -62,13 +58,6 @@ static inline void drm_pci_free(struct drm_device *dev, { } -static inline int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -struct drm_driver *driver) -{ -return -ENOSYS ; -} -#endif #endif /* _DRM_PCI_H_ */ Signature · 1 line
2.24.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Daniel Vetter
This doesn't do anything except auto-init
drm_agpsupport when you calldrm_get_pci_dev(). Which amdgpu stopped doing withcommit
b58c11314a1706bf094c489ef5cb28f76478c704Author: Alex Deucher <[email protected]> Date: Fri Jun 2 17:16:31 2017 -0400drm/amdgpu: drop deprecated
drm_get_pci_devanddrm_put_devNo idea whether this was intentional or accidental breakage, but I guess anyone who manages to boot a this modern gpu behind an agp bridge deserves a price. A price I never expect anyone to ever collect :-)
Quoted 9 lines
Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc Hawking Zhang <[email protected]>Cc Xiaojie Yuan <[email protected]>Cc Evan Quan <[email protected]>Cc "Tianci.Yin" <[email protected]>Cc "Marek Olšák" <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
I've had this patch locally for ages, but never sent it out:
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Daniel Vetter
This doesn't do anything except auto-init
drm_agpsupport when you calldrm_get_pci_dev(). Which amdgpu stopped doing withcommit
b58c11314a1706bf094c489ef5cb28f76478c704Author: Alex Deucher <[email protected]> Date: Fri Jun 2 17:16:31 2017 -0400drm/amdgpu: drop deprecated
drm_get_pci_devanddrm_put_devNo idea whether this was intentional or accidental breakage, but I guess anyone who manages to boot a this modern gpu behind an agp bridge deserves a price. A price I never expect anyone to ever collect :-)
Quoted 9 lines
Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc Hawking Zhang <[email protected]>Cc Xiaojie Yuan <[email protected]>Cc Evan Quan <[email protected]>Cc "Tianci.Yin" <[email protected]>Cc "Marek Olšák" <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Series is:
I'm happy to take the patches through my tree or drm-misc.
Alex
Quoted 20 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2@@ -1379,7 +1379,7 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)static struct drm_driver kms_driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_ATOMIC | +DRIVER_ATOMIC |DRIVER_GEM |DRIVER_RENDER |DRIVER_MODESET |DRIVER_SYNCOBJ |DRIVER_SYNCOBJ_TIMELINE , --2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 27 lines · Alex Deucher
Quoted 15 lines · Daniel Vetter
This doesn't do anything except auto-init
drm_agpsupport when you calldrm_get_pci_dev(). Which amdgpu stopped doing withcommit
b58c11314a1706bf094c489ef5cb28f76478c704Author: Alex Deucher <[email protected]> Date: Fri Jun 2 17:16:31 2017 -0400drm/amdgpu: drop deprecated
drm_get_pci_devanddrm_put_devNo idea whether this was intentional or accidental breakage, but I guess anyone who manages to boot a this modern gpu behind an agp bridge deserves a price. A price I never expect anyone to ever collect :-)
Quoted 9 lines
Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc Hawking Zhang <[email protected]>Cc Xiaojie Yuan <[email protected]>Cc Evan Quan <[email protected]>Cc "Tianci.Yin" <[email protected]>Cc "Marek Olšák" <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 3 lines
Series is:
Reviewed-by Alex Deucher <[email protected]>I'm happy to take the patches through my tree or drm-misc.
I don't have anything building on top of this, just random things from my tree. Reason I sent it out is Laurent's series to make a const drm_driver possible, but I don't think they'll conflict. So amd trees for the series is perfectly fine and probably simplest. -Daniel
Quoted 28 lines
Alex
Quoted 24 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2@@ -1379,7 +1379,7 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)static struct drm_driver kms_driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_ATOMIC | +DRIVER_ATOMIC |DRIVER_GEM |DRIVER_RENDER |DRIVER_MODESET |DRIVER_SYNCOBJ |DRIVER_SYNCOBJ_TIMELINE , --2.24.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedQuoted 29 lines · Daniel Vetter
Quoted 27 lines · Alex Deucher
Quoted 24 lines · Daniel Vetter
This doesn't do anything except auto-init
drm_agpsupport when you calldrm_get_pci_dev(). Which amdgpu stopped doing withcommit
b58c11314a1706bf094c489ef5cb28f76478c704Author: Alex Deucher <[email protected]> Date: Fri Jun 2 17:16:31 2017 -0400drm/amdgpu: drop deprecated
drm_get_pci_devanddrm_put_devNo idea whether this was intentional or accidental breakage, but I guess anyone who manages to boot a this modern gpu behind an agp bridge deserves a price. A price I never expect anyone to ever collect :-)
Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc Hawking Zhang <[email protected]>Cc Xiaojie Yuan <[email protected]>Cc Evan Quan <[email protected]>Cc "Tianci.Yin" <[email protected]>Cc "Marek Olšák" <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 8 lines
Quoted 3 lines
Series is:
Reviewed-by Alex Deucher <[email protected]>I'm happy to take the patches through my tree or drm-misc.
I don't have anything building on top of this, just random things from my tree. Reason I sent it out is Laurent's series to make a const
drm_driverpossible, but I don't think they'll conflict. So amd trees for the series is perfectly fine and probably simplest.
Applied. thanks!
Alex
Quoted 26 lines
-Daniel
Quoted 24 lines
Alex
Quoted 20 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2@@ -1379,7 +1379,7 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)static struct drm_driver kms_driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_ATOMIC | +DRIVER_ATOMIC |DRIVER_GEM |DRIVER_RENDER |DRIVER_MODESET |DRIVER_SYNCOBJ |DRIVER_SYNCOBJ_TIMELINE , --2.24.1
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel