drm: Mark DRM's AGP code as legacy
Subsystems (3)
Thomas Zimmermann
maintainercover drm: Mark DRM's AGP code as legacy
This patch moves the DRM core's AGP code behind CONFIG_DRM_LEGACY. The only use besides legacy, UMS drivers is radeon, which can implement the required functionality by itself.
This patchset has no impact on the AGP support of existing drivers.
Patches 1 and 2 move some AGP code from DRM core into radeon. Radeon uses some of the AGP code for its internal purposes. But being a KMS driver, there's no reason why radeon should provide the rsp AGP ioctls. So duplicate the implementation in radeon and thus uncould it from the legacy code.
Patch 3 moves some AGP-related PCI helpers behind CONFIG_DRM_LEGACY.
Patch 4 moves DRM's AGP code behind CONFIG_DRM_LEGACY. The files are then only build when legacy drivers are active.
Built-tested with different config options selected.
Thomas Zimmermann (4):
drm/radeon: Move AGP helpers into radeon driver drm/radeon: Move AGP data structures into radeon
drm: Mark PCI AGP helpers as legacy
drm: Mark AGP implementation and ioctls as legacy
drivers/gpu/drm/Makefile | 6 +- drivers/gpu/drm/drm_agpsupport.c | 99 ++++++++++++----------- drivers/gpu/drm/drm_bufs.c | 1 - drivers/gpu/drm/drm_drv.c | 4 +- drivers/gpu/drm/drm_internal.h | 5 -- drivers/gpu/drm/drm_ioc32.c | 19 +++-- drivers/gpu/drm/drm_ioctl.c | 24 +++--- drivers/gpu/drm/drm_legacy.h | 30 +++++++ drivers/gpu/drm/drm_legacy_misc.c | 1 - drivers/gpu/drm/drm_memory.c | 1 - drivers/gpu/drm/drm_pci.c | 23 +++--- drivers/gpu/drm/drm_vm.c | 2 - drivers/gpu/drm/i810/i810_dma.c | 3 +- drivers/gpu/drm/mga/mga_dma.c | 16 ++-- drivers/gpu/drm/mga/mga_drv.h | 1 - drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 42 ++++++++++ drivers/gpu/drm/radeon/radeon_agp.c | 118 ++++++++++++++++++++++++---- drivers/gpu/drm/radeon/radeon_drv.c | 13 --- drivers/gpu/drm/radeon/radeon_kms.c | 18 +++-- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +- drivers/gpu/drm/via/via_dma.c | 1 - include/drm/drm_agpsupport.h | 117 --------------------------- include/drm/drm_device.h | 6 +- include/drm/drm_legacy.h | 82 +++++++++++++++++++ 25 files changed, 375 insertions(+), 265 deletions(-) delete mode 100644 include/drm/drm_agpsupport.h
--
2.31.1
Thomas Zimmermann
maintainerPATCH 1/4 drm/radeon: Move AGP helpers into radeon driver
Radeon calls DRMs core AGP helpers. These helpers are only required by legacy drivers. Reimplement the code in radeon to uncouple radeon from the legacy code.
--- drivers/gpu/drm/radeon/radeon.h | 8 +++ drivers/gpu/drm/radeon/radeon_agp.c | 102 ++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- 3 files changed, 104 insertions(+), 8 deletions(-)
drivers/gpu/drm/radeon/radeon.h +8 -0
@@ -1110,6 +1110,14 @@ typedef int (*radeon_packet0_check_t)(struct radeon_cs_parser *p,/* * AGP */ +#if IS_ENABLED (CONFIG_AGP ) +struct drm_agp_head *radeon_agp_head_init (struct drm_device *dev); +#else +static inline struct drm_agp_head *radeon_agp_head_init (struct drm_device *dev) +{ +return NULL ; +} +#endif int radeon_agp_init (struct radeon_device *rdev);void radeon_agp_resume (struct radeon_device *rdev);void radeon_agp_suspend (struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_agp.c +95 -7
139 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -346,7 +346,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, dev);if (pci_find_capability (pdev,PCI_CAP_ID_AGP )) - dev->agp =drm_agp_init (dev); + dev->agp =radeon_agp_head_init (dev);if (dev->agp) { dev->agp->agp_mtrr = arch_phys_wc_add( dev->agp->agp_info.aper_base,
Signature · 6 lines
2.31.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thomas Zimmermann
maintainerPATCH 2/4 drm/radeon: Move AGP data structures into radeon
In reply to Thomas ZimmermannWith the AGP code already duplicated, move over the AGP structures from the legacy code base in to radeon. The AGP data structures that are required by radeon are now declared within the driver. The AGP instance is stored in struct radeon_device.agp.
--- drivers/gpu/drm/radeon/radeon.h | 38 +++++++++++++++- drivers/gpu/drm/radeon/radeon_agp.c | 70 ++++++++++++++--------------- drivers/gpu/drm/radeon/radeon_drv.c | 13 ------ drivers/gpu/drm/radeon/radeon_kms.c | 18 +++++--- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +-- 5 files changed, 86 insertions(+), 59 deletions(-)
drivers/gpu/drm/radeon/radeon.h +36 -2
@@ -60,6 +60,7 @@* are considered as fatal) */ +#include <linux/agp_backend.h> #include <linux/atomic.h> #include <linux/wait.h> #include <linux/list.h>
@@ -1110,10 +1111,42 @@ typedef int (*radeon_packet0_check_t)(struct radeon_cs_parser *p,/* * AGP */ + +struct radeon_agp_mode { +unsigned long mode;/**< AGP mode */ +}; + +struct radeon_agp_info { +int agp_version_major; +int agp_version_minor; +unsigned long mode; +unsigned long aperture_base;/* physical address */ +unsigned long aperture_size;/* bytes */ +unsigned long memory_allowed;/* bytes */ +unsigned long memory_used; + +/* PCI information */ +unsigned short id_vendor; +unsigned short id_device; +}; + +struct radeon_agp_head { +struct agp_kern_info agp_info; +struct list_head memory; +unsigned long mode; +struct agp_bridge_data *bridge; +int enabled; +int acquired; +unsigned long base; +int agp_mtrr; +int cant_use_aperture; +unsigned long page_mask; +}; +#if IS_ENABLED (CONFIG_AGP ) -struct drm_agp_head *radeon_agp_head_init (struct drm_device *dev); +struct radeon_agp_head *radeon_agp_head_init (struct drm_device *dev);#else -static inline struct drm_agp_head *radeon_agp_head_init (struct drm_device *dev) +static inline struct radeon_agp_head *radeon_agp_head_init (struct drm_device *dev) {return NULL ; }
@@ -2310,6 +2343,7 @@ struct radeon_device {#ifdef __alpha__struct pci_controller *hose;#endif +struct radeon_agp_head *agp;struct rw_semaphore exclusive_lock;/* ASIC */ union radeon_asic_config config;
drivers/gpu/drm/radeon/radeon_agp.c +35 -35
156 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_drv.c +0 -13
@@ -39,7 +39,6 @@#include <linux/pci.h> #include <drm/drm_aperture.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h>
@@ -345,15 +344,6 @@ static int radeon_pci_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, dev); -if (pci_find_capability (pdev,PCI_CAP_ID_AGP )) - dev->agp =radeon_agp_head_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;
@@ -361,9 +351,6 @@ static int radeon_pci_probe(struct pci_dev *pdev,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);
drivers/gpu/drm/radeon/radeon_kms.c +13 -5
@@ -32,7 +32,6 @@#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>
@@ -80,10 +79,10 @@ 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 ; +if (rdev->agp) +arch_phys_wc_del (rdev->agp->agp_mtrr); +kfree (rdev->agp); + rdev->agp =NULL ; done_free:kfree (rdev);
@@ -119,6 +118,15 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) rdev->hose = pdev->sysdata;#endif +if (pci_find_capability (pdev,PCI_CAP_ID_AGP )) + rdev->agp =radeon_agp_head_init (rdev->ddev); +if (rdev->agp) { + rdev->agp->agp_mtrr =arch_phys_wc_add ( + rdev->agp->agp_info.aper_base, + rdev->agp->agp_info.aper_size * +1024 *1024 ); + } +/* update BUS flag */ if (pci_find_capability (pdev,PCI_CAP_ID_AGP )) { flags |=RADEON_IS_AGP ;
drivers/gpu/drm/radeon/radeon_ttm.c +2 -4
@@ -38,7 +38,6 @@#include <linux/swap.h> #include <linux/swiotlb.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_prime.h>
@@ -291,7 +290,7 @@ static int radeon_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resourc/* RADEON_IS_AGP is set only if AGP is active */ mem->bus.offset = (mem->start <<PAGE_SHIFT ) + rdev->mc.agp_base; - mem->bus.is_iomem = !rdev->ddev->agp->cant_use_aperture; + mem->bus.is_iomem = !rdev->agp->cant_use_aperture; mem->bus.caching = ttm_write_combined; }#endif
@@ -513,8 +512,7 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,struct radeon_device *rdev =radeon_get_rdev (bo->bdev);if (rdev->flags &RADEON_IS_AGP ) { -return ttm_agp_tt_create (bo, rdev->ddev->agp->bridge, - page_flags); +return ttm_agp_tt_create (bo, rdev->agp->bridge, page_flags); }#endif rbo = container_of(bo, struct radeon_bo, tbo);
Signature · 1 line
2.31.1
Thomas Zimmermann
maintainerPATCH 3/4 drm: Mark PCI AGP helpers as legacy
In reply to Thomas ZimmermannDRM's AGP helpers for PCI are only required by legacy drivers. Put them behind CONFIG_DRM_LEGACY and add the _legacy_ infix.
--- drivers/gpu/drm/drm_drv.c | 4 +--- drivers/gpu/drm/drm_internal.h | 5 ----- drivers/gpu/drm/drm_legacy.h | 6 ++++++ drivers/gpu/drm/drm_pci.c | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_drv.c +1 -3
@@ -941,9 +941,7 @@ void drm_dev_unregister(struct drm_device *dev)if (dev->driver->unload) dev->driver->unload (dev); -if (dev->agp) -drm_pci_agp_destroy (dev); - +drm_legacy_pci_agp_destroy (dev);drm_legacy_rmmaps (dev);remove_compat_control_link (dev);
drivers/gpu/drm/drm_internal.h +0 -5
@@ -56,7 +56,6 @@ void drm_lastclose(struct drm_device *dev);/* drm_pci.c */ int drm_legacy_irq_by_busid (struct drm_device *dev,void *data,struct drm_file *file_priv); -void drm_pci_agp_destroy (struct drm_device *dev);int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master);#else
@@ -67,10 +66,6 @@ static inline int drm_legacy_irq_by_busid(struct drm_device *dev, void *data,return -EINVAL ; } -static inline void drm_pci_agp_destroy (struct drm_device *dev) -{ -} -static inline int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) {
drivers/gpu/drm/drm_legacy.h +6 -0
@@ -211,4 +211,10 @@ void drm_master_legacy_init(struct drm_master *master);static inline void drm_master_legacy_init (struct drm_master *master) {}#endif +#if IS_ENABLED (CONFIG_DRM_LEGACY ) &&IS_ENABLED (CONFIG_PCI ) +void drm_legacy_pci_agp_destroy (struct drm_device *dev); +#else +static inline void drm_legacy_pci_agp_destroy (struct drm_device *dev) {} +#endif +#endif /* __DRM_LEGACY_H__ */
drivers/gpu/drm/drm_pci.c +10 -10
@@ -119,7 +119,9 @@ int drm_legacy_irq_by_busid(struct drm_device *dev, void *data,return drm_pci_irq_by_busid (dev, p); } -void drm_pci_agp_destroy (struct drm_device *dev) +#ifdef CONFIG_DRM_LEGACY + +void drm_legacy_pci_agp_destroy (struct drm_device *dev) {if (dev->agp) {arch_phys_wc_del (dev->agp->agp_mtrr);
@@ -129,9 +131,7 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -#ifdef CONFIG_DRM_LEGACY - -static void drm_pci_agp_init (struct drm_device *dev) +static void drm_legacy_pci_agp_init (struct drm_device *dev) {if (drm_core_check_feature (dev,DRIVER_USE_AGP )) {if (pci_find_capability (to_pci_dev (dev->dev),PCI_CAP_ID_AGP ))
@@ -145,9 +145,9 @@ static void drm_pci_agp_init(struct drm_device *dev) } } -static int drm_get_pci_dev (struct pci_dev *pdev, -const struct pci_device_id *ent, -const struct drm_driver *driver) +static int drm_legacy_get_pci_dev (struct pci_dev *pdev, +const struct pci_device_id *ent, +const struct drm_driver *driver) {struct drm_device *dev;int ret;
@@ -169,7 +169,7 @@ static int drm_get_pci_dev(struct pci_dev *pdev,if (drm_core_check_feature (dev,DRIVER_MODESET ))pci_set_drvdata (pdev, dev); -drm_pci_agp_init (dev); +drm_legacy_pci_agp_init (dev); ret =drm_dev_register (dev, ent->driver_data);if (ret)
@@ -184,7 +184,7 @@ static int drm_get_pci_dev(struct pci_dev *pdev,return 0 ; err_agp: -drm_pci_agp_destroy (dev); +drm_legacy_pci_agp_destroy (dev);pci_disable_device (pdev); err_free:drm_dev_put (dev);
@@ -231,7 +231,7 @@ int drm_legacy_pci_init(const struct drm_driver *driver,/* stealth mode requires a manual probe */ pci_dev_get (pdev); -drm_get_pci_dev (pdev, pid, driver); +drm_legacy_get_pci_dev (pdev, pid, driver); } }return 0 ;
Signature · 1 line
2.31.1
Thomas Zimmermann
maintainerPATCH 4/4 drm: Mark AGP implementation and ioctls as legacy
In reply to Thomas ZimmermannOnly UMs drivers use DRM's core AGP code and ioctls. Mark the icotls as legacy. Add the _legacy_ infix to all AGP functions. Move the declarations to the public and internal legacy header files. The agp field in struct drm_device is now located in the structure's legacy section. Adapt drivers to the changes.
AGP code now depends on CONFIG_DRM_LEGACY.
--- drivers/gpu/drm/Makefile | 6 +- drivers/gpu/drm/drm_agpsupport.c | 99 +++++++++++++------------ drivers/gpu/drm/drm_bufs.c | 1 - drivers/gpu/drm/drm_ioc32.c | 19 +++-- drivers/gpu/drm/drm_ioctl.c | 24 +++--- drivers/gpu/drm/drm_legacy.h | 24 ++++++ drivers/gpu/drm/drm_legacy_misc.c | 1 - drivers/gpu/drm/drm_memory.c | 1 - drivers/gpu/drm/drm_pci.c | 3 +- drivers/gpu/drm/drm_vm.c | 2 - drivers/gpu/drm/i810/i810_dma.c | 3 +- drivers/gpu/drm/mga/mga_dma.c | 16 ++-- drivers/gpu/drm/mga/mga_drv.h | 1 - drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/via/via_dma.c | 1 - include/drm/drm_agpsupport.h | 117 ------------------------------ include/drm/drm_device.h | 6 +- include/drm/drm_legacy.h | 82 +++++++++++++++++++++ 18 files changed, 198 insertions(+), 210 deletions(-) delete mode 100644 include/drm/drm_agpsupport.h
drivers/gpu/drm/Makefile +3 -3
@@ -20,15 +20,15 @@ drm-y := drm_aperture.o drm_auth.o drm_cache.o \ drm_client_modeset.o drm_atomic_uapi.o drm_hdcp.o \ drm_managed.o drm_vblank_work.o -drm-$(CONFIG_DRM_LEGACY) += drm_bufs.o drm_context.o drm_dma.o drm_legacy_misc.o drm_lock.o \ - drm_memory.o drm_scatter.o drm_vm.o +drm-$(CONFIG_DRM_LEGACY) += drm_agpsupport.o drm_bufs.o drm_context.o drm_dma.o \ + drm_legacy_misc.o drm_lock.o drm_memory.o drm_scatter.o \ + drm_vm.o drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_gem_shmem_helper.o drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-$(CONFIG_OF) += drm_of.o -drm-$(CONFIG_AGP) += drm_agpsupport.o drm-$(CONFIG_PCI) += drm_pci.o drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
drivers/gpu/drm/drm_agpsupport.c +51 -48
288 lines not on this page · raw message
drivers/gpu/drm/drm_bufs.c +0 -1
@@ -40,7 +40,6 @@#include <asm/shmparam.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_drv.h> #include <drm/drm_file.h>
drivers/gpu/drm/drm_ioc32.c +9 -10
@@ -31,7 +31,6 @@#include <linux/ratelimit.h> #include <linux/export.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_file.h> #include <drm/drm_print.h>
@@ -619,6 +618,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd, }#endif +#if IS_ENABLED(CONFIG_DRM_LEGACY) #if IS_ENABLED(CONFIG_AGP) typedef struct drm_agp_mode32 { u32 mode; /**< AGP mode */
@@ -633,7 +633,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd,if (get_user (mode.mode, &argp->mode))return -EFAULT ; -return drm_ioctl_kernel (file, drm_agp_enable_ioctl, &mode, +return drm_ioctl_kernel (file, drm_legacy_agp_enable_ioctl, &mode,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ); }
@@ -659,7 +659,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd,struct drm_agp_info info;int err; - err =drm_ioctl_kernel (file, drm_agp_info_ioctl, &info,DRM_AUTH ); + err =drm_ioctl_kernel (file, drm_legacy_agp_info_ioctl, &info,DRM_AUTH );if (err)return err;
@@ -698,7 +698,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd, request.size = req32.size; request.type = req32.type; - err =drm_ioctl_kernel (file, drm_agp_alloc_ioctl, &request, + err =drm_ioctl_kernel (file, drm_legacy_agp_alloc_ioctl, &request,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY );if (err)return err;
@@ -706,7 +706,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd, req32.handle = request.handle; req32.physical = request.physical;if (copy_to_user (argp, &req32,sizeof (req32))) { -drm_ioctl_kernel (file, drm_agp_free_ioctl, &request, +drm_ioctl_kernel (file, drm_legacy_agp_free_ioctl, &request,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY );return -EFAULT ; }
@@ -723,7 +723,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd,if (get_user (request.handle, &argp->handle))return -EFAULT ; -return drm_ioctl_kernel (file, drm_agp_free_ioctl, &request, +return drm_ioctl_kernel (file, drm_legacy_agp_free_ioctl, &request,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ); }
@@ -744,7 +744,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd, request.handle = req32.handle; request.offset = req32.offset; -return drm_ioctl_kernel (file, drm_agp_bind_ioctl, &request, +return drm_ioctl_kernel (file, drm_legacy_agp_bind_ioctl, &request,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ); }
@@ -757,12 +757,11 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,if (get_user (request.handle, &argp->handle))return -EFAULT ; -return drm_ioctl_kernel (file, drm_agp_unbind_ioctl, &request, +return drm_ioctl_kernel (file, drm_legacy_agp_unbind_ioctl, &request,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ); }#endif /* CONFIG_AGP */ -#if IS_ENABLED(CONFIG_DRM_LEGACY) typedef struct drm_scatter_gather32 { u32 size; /**< In bytes -- will round to page boundary */ u32 handle; /**< Used for mapping / unmapping */
@@ -935,7 +934,6 @@ static struct {DRM_IOCTL32_DEF (DRM_IOCTL_GET_SAREA_CTX , compat_drm_getsareactx),DRM_IOCTL32_DEF (DRM_IOCTL_RES_CTX , compat_drm_resctx),DRM_IOCTL32_DEF (DRM_IOCTL_DMA , compat_drm_dma), -#endif #if IS_ENABLED(CONFIG_AGP)DRM_IOCTL32_DEF (DRM_IOCTL_AGP_ENABLE , compat_drm_agp_enable), DRM_IOCTL32_DEF(DRM_IOCTL_AGP_INFO, compat_drm_agp_info),
@@ -944,6 +942,7 @@ static struct { DRM_IOCTL32_DEF(DRM_IOCTL_AGP_BIND, compat_drm_agp_bind), DRM_IOCTL32_DEF(DRM_IOCTL_AGP_UNBIND, compat_drm_agp_unbind),#endif +#endif #if IS_ENABLED (CONFIG_DRM_LEGACY )DRM_IOCTL32_DEF (DRM_IOCTL_SG_ALLOC , compat_drm_sg_alloc), DRM_IOCTL32_DEF(DRM_IOCTL_SG_FREE, compat_drm_sg_free),
drivers/gpu/drm/drm_ioctl.c +15 -9
@@ -33,7 +33,6 @@#include <linux/pci.h> #include <linux/uaccess.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_auth.h> #include <drm/drm_crtc.h> #include <drm/drm_drv.h>
@@ -627,14 +626,21 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_legacy_irq_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),#if IS_ENABLED (CONFIG_AGP ) -DRM_IOCTL_DEF (DRM_IOCTL_AGP_ACQUIRE , drm_agp_acquire_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_RELEASE , drm_agp_release_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_ENABLE , drm_agp_enable_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_INFO , drm_agp_info_ioctl,DRM_AUTH ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_ALLOC , drm_agp_alloc_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_FREE , drm_agp_free_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_BIND , drm_agp_bind_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_AGP_UNBIND , drm_agp_unbind_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_ACQUIRE , drm_legacy_agp_acquire_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_RELEASE , drm_legacy_agp_release_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_ENABLE , drm_legacy_agp_enable_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_INFO , drm_legacy_agp_info_ioctl,DRM_AUTH ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_ALLOC , drm_legacy_agp_alloc_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_FREE , drm_legacy_agp_free_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_BIND , drm_legacy_agp_bind_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_LEGACY_IOCTL_DEF (DRM_IOCTL_AGP_UNBIND , drm_legacy_agp_unbind_ioctl, +DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), #endif DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_SG_ALLOC, drm_legacy_sg_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
drivers/gpu/drm/drm_legacy.h +24 -0
@@ -148,6 +148,30 @@ struct drm_agp_mem {struct list_head head; }; +/* drm_agpsupport.c */ +#if IS_ENABLED (CONFIG_DRM_LEGACY ) &&IS_ENABLED (CONFIG_AGP ) +void drm_legacy_agp_clear (struct drm_device *dev); + +int drm_legacy_agp_acquire_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_release_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_enable_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_info_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_alloc_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_free_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_unbind_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int drm_legacy_agp_bind_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +#else +static inline void drm_legacy_agp_clear (struct drm_device *dev) {} +#endif +/* drm_lock.c */ #if IS_ENABLED (CONFIG_DRM_LEGACY )int drm_legacy_lock (struct drm_device *d,void *v,struct drm_file *f);
drivers/gpu/drm/drm_legacy_misc.c +0 -1
@@ -33,7 +33,6 @@* OTHER DEALINGS IN THE SOFTWARE. */ -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_drv.h> #include <drm/drm_irq.h>
drivers/gpu/drm/drm_memory.c +0 -1
@@ -38,7 +38,6 @@#include <linux/pci.h> #include <linux/vmalloc.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_cache.h> #include <drm/drm_device.h>
drivers/gpu/drm/drm_pci.c +1 -2
@@ -30,7 +30,6 @@#include <linux/slab.h> #include <drm/drm.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_drv.h> #include <drm/drm_print.h>
@@ -135,7 +134,7 @@ static void drm_legacy_pci_agp_init(struct drm_device *dev) {if (drm_core_check_feature (dev,DRIVER_USE_AGP )) {if (pci_find_capability (to_pci_dev (dev->dev),PCI_CAP_ID_AGP )) - dev->agp =drm_agp_init (dev); + dev->agp =drm_legacy_agp_init (dev);if (dev->agp) { dev->agp->agp_mtrr = arch_phys_wc_add( dev->agp->agp_info.aper_base,
drivers/gpu/drm/drm_vm.c +0 -2
@@ -45,8 +45,6 @@#endif #include <linux/mem_encrypt.h> - -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_drv.h> #include <drm/drm_file.h>
drivers/gpu/drm/i810/i810_dma.c +1 -2
@@ -34,7 +34,6 @@#include <linux/mman.h> #include <linux/pci.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_drv.h> #include <drm/drm_file.h>
@@ -1199,7 +1198,7 @@ int i810_driver_load(struct drm_device *dev, unsigned long flags) {struct pci_dev *pdev =to_pci_dev (dev->dev); - dev->agp =drm_agp_init (dev); + dev->agp =drm_legacy_agp_init (dev);if (dev->agp) { dev->agp->agp_mtrr = arch_phys_wc_add( dev->agp->agp_info.aper_base,
drivers/gpu/drm/mga/mga_dma.c +8 -8
@@ -469,20 +469,20 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,struct drm_agp_binding bind_req;/* Acquire AGP. */ - err =drm_agp_acquire (dev); + err =drm_legacy_agp_acquire (dev);if (err) {DRM_ERROR ("Unable to acquire AGP: %d\n" , err);return err; } - err =drm_agp_info (dev, &info); + err =drm_legacy_agp_info (dev, &info);if (err) {DRM_ERROR ("Unable to get AGP info: %d\n" , err);return err; } mode.mode = (info.mode & ~0x07 ) | dma_bs->agp_mode; - err =drm_agp_enable (dev, mode); + err =drm_legacy_agp_enable (dev, mode);if (err) {DRM_ERROR ("Unable to enable AGP (mode = 0x%lx)\n" , mode.mode);return err;
@@ -502,7 +502,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,/* Allocate and bind AGP memory. */ agp_req.size = agp_size; agp_req.type =0 ; - err =drm_agp_alloc (dev, &agp_req); + err =drm_legacy_agp_alloc (dev, &agp_req);if (err) { dev_priv->agp_size =0 ; DRM_ERROR("Unable to allocate %uMB AGP memory\n",
@@ -515,7 +515,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, bind_req.handle = agp_req.handle; bind_req.offset =0 ; - err =drm_agp_bind (dev, &bind_req); + err =drm_legacy_agp_bind (dev, &bind_req);if (err) {DRM_ERROR ("Unable to bind AGP memory: %d\n" , err);return err;
@@ -972,10 +972,10 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)struct drm_agp_buffer free_req; unbind_req.handle = dev_priv->agp_handle; -drm_agp_unbind (dev, &unbind_req); +drm_legacy_agp_unbind (dev, &unbind_req); free_req.handle = dev_priv->agp_handle; -drm_agp_free (dev, &free_req); +drm_legacy_agp_free (dev, &free_req); dev_priv->agp_textures =NULL ; dev_priv->agp_size =0 ;
@@ -983,7 +983,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup) }if ((dev->agp !=NULL ) && dev->agp->acquired) - err =drm_agp_release (dev); + err =drm_legacy_agp_release (dev);#endif }
drivers/gpu/drm/mga/mga_drv.h +0 -1
@@ -35,7 +35,6 @@#include <linux/pci.h> #include <linux/slab.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h>
drivers/gpu/drm/r128/r128_cce.c +1 -1
@@ -37,10 +37,10 @@#include <linux/slab.h> #include <linux/uaccess.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_irq.h> +#include <drm/drm_legacy.h> #include <drm/drm_print.h> #include <drm/r128_drm.h>
drivers/gpu/drm/via/via_dma.c +0 -1
@@ -38,7 +38,6 @@#include <linux/uaccess.h> #include <drm/drm.h> -#include <drm/drm_agpsupport.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/via_drm.h>
include/drm/drm_agpsupport.h deleted +0 -117
117 lines not on this page · raw message
include/drm/drm_device.h +3 -3
@@ -276,9 +276,6 @@ struct drm_device {*/ spinlock_t event_lock; -/** @agp: AGP data */ -struct drm_agp_head *agp; -/** @num_crtcs: Number of CRTCs on this device */ unsigned int num_crtcs;
@@ -326,6 +323,9 @@ struct drm_device {struct pci_controller *hose;#endif +/* AGP data */ +struct drm_agp_head *agp; +/* Context handle management - linked list of context handles */ struct list_head ctxlist;
include/drm/drm_legacy.h +82 -0
94 lines not on this page · raw message
Signature · 1 line
2.31.1
Am 07.05.21 um 20:57 schrieb Thomas Zimmermann:
Quoted 51 lines
This patch moves the DRM core's AGP code behind
CONFIG_DRM_LEGACY. The only use besides legacy, UMS drivers is radeon, which can implement the required functionality by itself.This patchset has no impact on the AGP support of existing drivers.
Patches 1 and 2 move some AGP code from DRM core into radeon. Radeon uses some of the AGP code for its internal purposes. But being a KMS driver, there's no reason why radeon should provide the rsp AGP ioctls. So duplicate the implementation in radeon and thus uncould it from the legacy code.
Patch 3 moves some AGP-related PCI helpers behind
CONFIG_DRM_LEGACY.Patch 4 moves DRM's AGP code behind
CONFIG_DRM_LEGACY. The files are then only build when legacy drivers are active.Built-tested with different config options selected.
Thomas Zimmermann (4):
drm/radeon: Move AGP helpers into radeon driver drm/radeon: Move AGP data structures into radeon
drm: Mark PCI AGP helpers as legacy
drm: Mark AGP implementation and ioctls as legacydrivers/gpu/drm/Makefile | 6 +- drivers/gpu/drm/drm_agpsupport.c | 99 ++++++++++++----------- drivers/gpu/drm/drm_bufs.c | 1 - drivers/gpu/drm/drm_drv.c | 4 +- drivers/gpu/drm/drm_internal.h | 5 -- drivers/gpu/drm/drm_ioc32.c | 19 +++-- drivers/gpu/drm/drm_ioctl.c | 24 +++--- drivers/gpu/drm/drm_legacy.h | 30 +++++++ drivers/gpu/drm/drm_legacy_misc.c | 1 - drivers/gpu/drm/drm_memory.c | 1 - drivers/gpu/drm/drm_pci.c | 23 +++--- drivers/gpu/drm/drm_vm.c | 2 - drivers/gpu/drm/i810/i810_dma.c | 3 +- drivers/gpu/drm/mga/mga_dma.c | 16 ++-- drivers/gpu/drm/mga/mga_drv.h | 1 - drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 42 ++++++++++ drivers/gpu/drm/radeon/radeon_agp.c | 118 ++++++++++++++++++++++++---- drivers/gpu/drm/radeon/radeon_drv.c | 13 --- drivers/gpu/drm/radeon/radeon_kms.c | 18 +++-- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +- drivers/gpu/drm/via/via_dma.c | 1 - include/drm/drm_agpsupport.h | 117 --------------------------- include/drm/drm_device.h | 6 +- include/drm/drm_legacy.h | 82 +++++++++++++++++++ 25 files changed, 375 insertions(+), 265 deletions(-)
Quoted 5 lines
delete mode 100644
include/drm/drm_agpsupport.h--
2.31.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 18 lines · Thomas Zimmermann
This patch moves the DRM core's AGP code behind
CONFIG_DRM_LEGACY. The only use besides legacy, UMS drivers is radeon, which can implement the required functionality by itself.This patchset has no impact on the AGP support of existing drivers.
Patches 1 and 2 move some AGP code from DRM core into radeon. Radeon uses some of the AGP code for its internal purposes. But being a KMS driver, there's no reason why radeon should provide the rsp AGP ioctls. So duplicate the implementation in radeon and thus uncould it from the legacy code.
Patch 3 moves some AGP-related PCI helpers behind
CONFIG_DRM_LEGACY.Patch 4 moves DRM's AGP code behind
CONFIG_DRM_LEGACY. The files are then only build when legacy drivers are active.
Quoted 7 lines
Built-tested with different config options selected.
Thomas Zimmermann (4):
drm/radeon: Move AGP helpers into radeon driver drm/radeon: Move AGP data structures into radeon
drm: Mark PCI AGP helpers as legacy
drm: Mark AGP implementation and ioctls as legacy
Series is:
I'm fine to have this merged through drm-misc.
Alex
Quoted 32 lines
drivers/gpu/drm/Makefile | 6 +- drivers/gpu/drm/drm_agpsupport.c | 99 ++++++++++++----------- drivers/gpu/drm/drm_bufs.c | 1 - drivers/gpu/drm/drm_drv.c | 4 +- drivers/gpu/drm/drm_internal.h | 5 -- drivers/gpu/drm/drm_ioc32.c | 19 +++-- drivers/gpu/drm/drm_ioctl.c | 24 +++--- drivers/gpu/drm/drm_legacy.h | 30 +++++++ drivers/gpu/drm/drm_legacy_misc.c | 1 - drivers/gpu/drm/drm_memory.c | 1 - drivers/gpu/drm/drm_pci.c | 23 +++--- drivers/gpu/drm/drm_vm.c | 2 - drivers/gpu/drm/i810/i810_dma.c | 3 +- drivers/gpu/drm/mga/mga_dma.c | 16 ++-- drivers/gpu/drm/mga/mga_drv.h | 1 - drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 42 ++++++++++ drivers/gpu/drm/radeon/radeon_agp.c | 118 ++++++++++++++++++++++++---- drivers/gpu/drm/radeon/radeon_drv.c | 13 --- drivers/gpu/drm/radeon/radeon_kms.c | 18 +++-- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +- drivers/gpu/drm/via/via_dma.c | 1 - include/drm/drm_agpsupport.h | 117 --------------------------- include/drm/drm_device.h | 6 +- include/drm/drm_legacy.h | 82 +++++++++++++++++++ 25 files changed, 375 insertions(+), 265 deletions(-) delete mode 100644 include/drm/drm_agpsupport.h--
2.31.1