[PATCH 1/3] drm/radeon: remove AGP support

Thomas Zimmermann tzimmermann at suse.de
Tue May 12 18:20:29 UTC 2020


Hi Christian

Am 11.05.20 um 19:17 schrieb Christian König:
> AGP is deprecated for 10+ years now and not used any more on modern hardware.
> 
> Old hardware should continue to work in PCI mode.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/radeon/Makefile        |   4 +-
>  drivers/gpu/drm/radeon/evergreen.c     |   7 -
>  drivers/gpu/drm/radeon/r100.c          |  10 +-
>  drivers/gpu/drm/radeon/r300.c          |   9 -
>  drivers/gpu/drm/radeon/r420.c          |   9 -
>  drivers/gpu/drm/radeon/r520.c          |   8 -
>  drivers/gpu/drm/radeon/r600.c          |   6 -
>  drivers/gpu/drm/radeon/radeon.h        |  11 -
>  drivers/gpu/drm/radeon/radeon_agp.c    | 290 -------------------------
>  drivers/gpu/drm/radeon/radeon_device.c |  23 +-
>  drivers/gpu/drm/radeon/radeon_drv.c    |   9 -

In radeon_drv.c, the field drm_device.agp is still being initialized in
radeon_pci_probe() and cleaned up in radeon_driver_unload_kms(). Is this
intentional?

Best regards
Thomas

>  drivers/gpu/drm/radeon/radeon_ttm.c    |  39 ----
>  drivers/gpu/drm/radeon/rv515.c         |   9 -
>  drivers/gpu/drm/radeon/rv770.c         |   7 -
>  14 files changed, 4 insertions(+), 437 deletions(-)
>  delete mode 100644 drivers/gpu/drm/radeon/radeon_agp.c
> 
> diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
> index c693b2ca0329..77429cfd303e 100644
> --- a/drivers/gpu/drm/radeon/Makefile
> +++ b/drivers/gpu/drm/radeon/Makefile
> @@ -61,8 +61,8 @@ radeon-y := radeon_drv.o
>  
>  # add KMS driver
>  radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
> -	radeon_atombios.o radeon_agp.o atombios_crtc.o radeon_combios.o \
> -	atom.o radeon_fence.o radeon_ttm.o radeon_object.o radeon_gart.o \
> +	radeon_atombios.o atombios_crtc.o radeon_combios.o atom.o \
> +	radeon_fence.o radeon_ttm.o radeon_object.o radeon_gart.o \
>  	radeon_legacy_crtc.o radeon_legacy_encoders.o radeon_connectors.o \
>  	radeon_encoders.o radeon_display.o radeon_cursor.o radeon_i2c.o \
>  	radeon_clocks.o radeon_fb.o radeon_gem.o radeon_ring.o radeon_irq_kms.o \
> diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
> index 14d90dc376e7..66b3d9a2c6dd 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -5216,12 +5216,6 @@ int evergreen_init(struct radeon_device *rdev)
>  	r = radeon_fence_driver_init(rdev);
>  	if (r)
>  		return r;
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r)
> -			radeon_agp_disable(rdev);
> -	}
>  	/* initialize memory controller */
>  	r = evergreen_mc_init(rdev);
>  	if (r)
> @@ -5315,7 +5309,6 @@ void evergreen_fini(struct radeon_device *rdev)
>  	r600_vram_scratch_fini(rdev);
>  	radeon_gem_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_bo_fini(rdev);
>  	radeon_atombios_fini(rdev);
>  	kfree(rdev->bios);
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index 24c8db673931..320b1b40a30a 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -3382,7 +3382,7 @@ void r100_bandwidth_update(struct radeon_device *rdev)
>  
>  	if (rdev->flags & RADEON_IS_AGP) {
>  		fixed20_12 agpmode_ff;
> -		agpmode_ff.full = dfixed_const(radeon_agpmode);
> +		agpmode_ff.full = dfixed_const(0);
>  		temp_ff.full = dfixed_const_666(16);
>  		sclk_eff_ff.full -= dfixed_mul(agpmode_ff, temp_ff);
>  	}
> @@ -3992,7 +3992,6 @@ void r100_fini(struct radeon_device *rdev)
>  	radeon_gem_fini(rdev);
>  	if (rdev->flags & RADEON_IS_PCI)
>  		r100_pci_gart_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_irq_kms_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
>  	radeon_bo_fini(rdev);
> @@ -4068,13 +4067,6 @@ int r100_init(struct radeon_device *rdev)
>  	r100_errata(rdev);
>  	/* Initialize clocks */
>  	radeon_get_clock_info(rdev->ddev);
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r) {
> -			radeon_agp_disable(rdev);
> -		}
> -	}
>  	/* initialize VRAM */
>  	r100_mc_init(rdev);
>  	/* Fence driver */
> diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
> index 3b7ead5be5bf..afd688629cf9 100644
> --- a/drivers/gpu/drm/radeon/r300.c
> +++ b/drivers/gpu/drm/radeon/r300.c
> @@ -1498,7 +1498,6 @@ void r300_fini(struct radeon_device *rdev)
>  		rv370_pcie_gart_fini(rdev);
>  	if (rdev->flags & RADEON_IS_PCI)
>  		r100_pci_gart_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_irq_kms_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
>  	radeon_bo_fini(rdev);
> @@ -1547,13 +1546,6 @@ int r300_init(struct radeon_device *rdev)
>  	r300_errata(rdev);
>  	/* Initialize clocks */
>  	radeon_get_clock_info(rdev->ddev);
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r) {
> -			radeon_agp_disable(rdev);
> -		}
> -	}
>  	/* initialize memory controller */
>  	r300_mc_init(rdev);
>  	/* Fence driver */
> @@ -1592,7 +1584,6 @@ int r300_init(struct radeon_device *rdev)
>  			rv370_pcie_gart_fini(rdev);
>  		if (rdev->flags & RADEON_IS_PCI)
>  			r100_pci_gart_fini(rdev);
> -		radeon_agp_fini(rdev);
>  		rdev->accel_working = false;
>  	}
>  	return 0;
> diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
> index 1d4c04e0a449..3cb337dacd56 100644
> --- a/drivers/gpu/drm/radeon/r420.c
> +++ b/drivers/gpu/drm/radeon/r420.c
> @@ -366,7 +366,6 @@ void r420_fini(struct radeon_device *rdev)
>  		rv370_pcie_gart_fini(rdev);
>  	if (rdev->flags & RADEON_IS_PCI)
>  		r100_pci_gart_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_irq_kms_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
>  	radeon_bo_fini(rdev);
> @@ -419,13 +418,6 @@ int r420_init(struct radeon_device *rdev)
>  
>  	/* Initialize clocks */
>  	radeon_get_clock_info(rdev->ddev);
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r) {
> -			radeon_agp_disable(rdev);
> -		}
> -	}
>  	/* initialize memory controller */
>  	r300_mc_init(rdev);
>  	r420_debugfs(rdev);
> @@ -470,7 +462,6 @@ int r420_init(struct radeon_device *rdev)
>  			rv370_pcie_gart_fini(rdev);
>  		if (rdev->flags & RADEON_IS_PCI)
>  			r100_pci_gart_fini(rdev);
> -		radeon_agp_fini(rdev);
>  		rdev->accel_working = false;
>  	}
>  	return 0;
> diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
> index fc78e64ae727..76ac87d72406 100644
> --- a/drivers/gpu/drm/radeon/r520.c
> +++ b/drivers/gpu/drm/radeon/r520.c
> @@ -288,13 +288,6 @@ int r520_init(struct radeon_device *rdev)
>  	}
>  	/* Initialize clocks */
>  	radeon_get_clock_info(rdev->ddev);
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r) {
> -			radeon_agp_disable(rdev);
> -		}
> -	}
>  	/* initialize memory controller */
>  	r520_mc_init(rdev);
>  	rv515_debugfs(rdev);
> @@ -324,7 +317,6 @@ int r520_init(struct radeon_device *rdev)
>  		radeon_ib_pool_fini(rdev);
>  		radeon_irq_kms_fini(rdev);
>  		rv370_pcie_gart_fini(rdev);
> -		radeon_agp_fini(rdev);
>  		rdev->accel_working = false;
>  	}
>  	return 0;
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index d9a33ca768f3..4a5ac15893c2 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -3286,11 +3286,6 @@ int r600_init(struct radeon_device *rdev)
>  	r = radeon_fence_driver_init(rdev);
>  	if (r)
>  		return r;
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r)
> -			radeon_agp_disable(rdev);
> -	}
>  	r = r600_mc_init(rdev);
>  	if (r)
>  		return r;
> @@ -3353,7 +3348,6 @@ void r600_fini(struct radeon_device *rdev)
>  	radeon_irq_kms_fini(rdev);
>  	r600_pcie_gart_fini(rdev);
>  	r600_vram_scratch_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_gem_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
>  	radeon_bo_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 30e32adc1fc6..377e1403b134 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -91,7 +91,6 @@ extern int radeon_no_wb;
>  extern int radeon_modeset;
>  extern int radeon_dynclks;
>  extern int radeon_r4xx_atom;
> -extern int radeon_agpmode;
>  extern int radeon_vram_limit;
>  extern int radeon_gart_size;
>  extern int radeon_benchmarking;
> @@ -1116,16 +1115,6 @@ typedef int (*radeon_packet0_check_t)(struct radeon_cs_parser *p,
>  typedef int (*radeon_packet3_check_t)(struct radeon_cs_parser *p,
>  				      struct radeon_cs_packet *pkt);
>  
> -
> -/*
> - * AGP
> - */
> -int radeon_agp_init(struct radeon_device *rdev);
> -void radeon_agp_resume(struct radeon_device *rdev);
> -void radeon_agp_suspend(struct radeon_device *rdev);
> -void radeon_agp_fini(struct radeon_device *rdev);
> -
> -
>  /*
>   * Writeback
>   */
> diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c
> deleted file mode 100644
> index 0aca7bdf54c7..000000000000
> --- a/drivers/gpu/drm/radeon/radeon_agp.c
> +++ /dev/null
> @@ -1,290 +0,0 @@
> -/*
> - * Copyright 2008 Red Hat Inc.
> - * Copyright 2009 Jerome Glisse.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the "Software"),
> - * to deal in the Software without restriction, including without limitation
> - * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be included in
> - * all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> - * OTHER DEALINGS IN THE SOFTWARE.
> - *
> - * Authors:
> - *    Dave Airlie
> - *    Jerome Glisse <glisse at freedesktop.org>
> - */
> -
> -#include <linux/pci.h>
> -
> -#include <drm/drm_agpsupport.h>
> -#include <drm/drm_device.h>
> -#include <drm/radeon_drm.h>
> -
> -#include "radeon.h"
> -
> -#if IS_ENABLED(CONFIG_AGP)
> -
> -struct radeon_agpmode_quirk {
> -	u32 hostbridge_vendor;
> -	u32 hostbridge_device;
> -	u32 chip_vendor;
> -	u32 chip_device;
> -	u32 subsys_vendor;
> -	u32 subsys_device;
> -	u32 default_mode;
> -};
> -
> -static struct radeon_agpmode_quirk radeon_agpmode_quirk_list[] = {
> -	/* Intel E7505 Memory Controller Hub / RV350 AR [Radeon 9600XT] Needs AGPMode 4 (deb #515326) */
> -	{ PCI_VENDOR_ID_INTEL, 0x2550, PCI_VENDOR_ID_ATI, 0x4152, 0x1458, 0x4038, 4},
> -	/* Intel 82865G/PE/P DRAM Controller/Host-Hub / Mobility 9800 Needs AGPMode 4 (deb #462590) */
> -	{ PCI_VENDOR_ID_INTEL, 0x2570, PCI_VENDOR_ID_ATI, 0x4a4e, PCI_VENDOR_ID_DELL, 0x5106, 4},
> -	/* Intel 82865G/PE/P DRAM Controller/Host-Hub / RV280 [Radeon 9200 SE] Needs AGPMode 4 (lp #300304) */
> -	{ PCI_VENDOR_ID_INTEL, 0x2570, PCI_VENDOR_ID_ATI, 0x5964,
> -		0x148c, 0x2073, 4},
> -	/* Intel 82855PM Processor to I/O Controller / Mobility M6 LY Needs AGPMode 1 (deb #467235) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c59,
> -		PCI_VENDOR_ID_IBM, 0x052f, 1},
> -	/* Intel 82855PM host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (lp #195051) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4e50,
> -		PCI_VENDOR_ID_IBM, 0x0550, 1},
> -	/* Intel 82855PM host bridge / RV250/M9 GL [Mobility FireGL 9000/Radeon 9000] needs AGPMode 1 (Thinkpad T40p) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c66,
> -		PCI_VENDOR_ID_IBM, 0x054d, 1},
> -	/* Intel 82855PM host bridge / Mobility M7 needs AGPMode 1 */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c57,
> -		PCI_VENDOR_ID_IBM, 0x0530, 1},
> -	/* Intel 82855PM host bridge / FireGL Mobility T2 RV350 Needs AGPMode 2 (fdo #20647) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4e54,
> -		PCI_VENDOR_ID_IBM, 0x054f, 2},
> -	/* Intel 82855PM host bridge / Mobility M9+ / VaioPCG-V505DX Needs AGPMode 2 (fdo #17928) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x5c61,
> -		PCI_VENDOR_ID_SONY, 0x816b, 2},
> -	/* Intel 82855PM Processor to I/O Controller / Mobility M9+ Needs AGPMode 8 (phoronix forum) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x5c61,
> -		PCI_VENDOR_ID_SONY, 0x8195, 8},
> -	/* Intel 82830 830 Chipset Host Bridge / Mobility M6 LY Needs AGPMode 2 (fdo #17360)*/
> -	{ PCI_VENDOR_ID_INTEL, 0x3575, PCI_VENDOR_ID_ATI, 0x4c59,
> -		PCI_VENDOR_ID_DELL, 0x00e3, 2},
> -	/* Intel 82852/82855 host bridge / Mobility FireGL 9000 RV250 Needs AGPMode 1 (lp #296617) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4c66,
> -		PCI_VENDOR_ID_DELL, 0x0149, 1},
> -	/* Intel 82855PM host bridge / Mobility FireGL 9000 RV250 Needs AGPMode 1 for suspend/resume */
> -	{ PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c66,
> -		PCI_VENDOR_ID_IBM, 0x0531, 1},
> -	/* Intel 82852/82855 host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (deb #467460) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50,
> -		0x1025, 0x0061, 1},
> -	/* Intel 82852/82855 host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (lp #203007) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50,
> -		0x1025, 0x0064, 1},
> -	/* Intel 82852/82855 host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (lp #141551) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50,
> -		PCI_VENDOR_ID_ASUSTEK, 0x1942, 1},
> -	/* Intel 82852/82855 host bridge / Mobility 9600/9700 Needs AGPMode 1 (deb #510208) */
> -	{ PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50,
> -		0x10cf, 0x127f, 1},
> -	/* ASRock K7VT4A+ AGP 8x / ATI Radeon 9250 AGP Needs AGPMode 4 (lp #133192) */
> -	{ 0x1849, 0x3189, PCI_VENDOR_ID_ATI, 0x5960,
> -		0x1787, 0x5960, 4},
> -	/* VIA K8M800 Host Bridge / RV280 [Radeon 9200 PRO] Needs AGPMode 4 (fdo #12544) */
> -	{ PCI_VENDOR_ID_VIA, 0x0204, PCI_VENDOR_ID_ATI, 0x5960,
> -		0x17af, 0x2020, 4},
> -	/* VIA KT880 Host Bridge / RV350 [Radeon 9550] Needs AGPMode 4 (fdo #19981) */
> -	{ PCI_VENDOR_ID_VIA, 0x0269, PCI_VENDOR_ID_ATI, 0x4153,
> -		PCI_VENDOR_ID_ASUSTEK, 0x003c, 4},
> -	/* VIA VT8363 Host Bridge / R200 QL [Radeon 8500] Needs AGPMode 2 (lp #141551) */
> -	{ PCI_VENDOR_ID_VIA, 0x0305, PCI_VENDOR_ID_ATI, 0x514c,
> -		PCI_VENDOR_ID_ATI, 0x013a, 2},
> -	/* VIA VT82C693A Host Bridge / RV280 [Radeon 9200 PRO] Needs AGPMode 2 (deb #515512) */
> -	{ PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_ATI, 0x5960,
> -		PCI_VENDOR_ID_ASUSTEK, 0x004c, 2},
> -	/* VIA VT82C693A Host Bridge / RV280 [Radeon 9200 PRO] Needs AGPMode 2 */
> -	{ PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_ATI, 0x5960,
> -		PCI_VENDOR_ID_ASUSTEK, 0x0054, 2},
> -	/* VIA VT8377 Host Bridge / R200 QM [Radeon 9100] Needs AGPMode 4 (deb #461144) */
> -	{ PCI_VENDOR_ID_VIA, 0x3189, PCI_VENDOR_ID_ATI, 0x514d,
> -		0x174b, 0x7149, 4},
> -	/* VIA VT8377 Host Bridge / RV280 [Radeon 9200 PRO] Needs AGPMode 4 (lp #312693) */
> -	{ PCI_VENDOR_ID_VIA, 0x3189, PCI_VENDOR_ID_ATI, 0x5960,
> -		0x1462, 0x0380, 4},
> -	/* VIA VT8377 Host Bridge / RV280 Needs AGPMode 4 (ati ML) */
> -	{ PCI_VENDOR_ID_VIA, 0x3189, PCI_VENDOR_ID_ATI, 0x5964,
> -		0x148c, 0x2073, 4},
> -	/* ATI Host Bridge / RV280 [M9+] Needs AGPMode 1 (phoronix forum) */
> -	{ PCI_VENDOR_ID_ATI, 0xcbb2, PCI_VENDOR_ID_ATI, 0x5c61,
> -		PCI_VENDOR_ID_SONY, 0x8175, 1},
> -	{ 0, 0, 0, 0, 0, 0, 0 },
> -};
> -#endif
> -
> -int radeon_agp_init(struct radeon_device *rdev)
> -{
> -#if IS_ENABLED(CONFIG_AGP)
> -	struct radeon_agpmode_quirk *p = radeon_agpmode_quirk_list;
> -	struct drm_agp_mode mode;
> -	struct drm_agp_info info;
> -	uint32_t agp_status;
> -	int default_mode;
> -	bool is_v3;
> -	int ret;
> -
> -	/* Acquire AGP. */
> -	ret = drm_agp_acquire(rdev->ddev);
> -	if (ret) {
> -		DRM_ERROR("Unable to acquire AGP: %d\n", ret);
> -		return ret;
> -	}
> -
> -	ret = drm_agp_info(rdev->ddev, &info);
> -	if (ret) {
> -		drm_agp_release(rdev->ddev);
> -		DRM_ERROR("Unable to get AGP info: %d\n", ret);
> -		return ret;
> -	}
> -
> -	if (rdev->ddev->agp->agp_info.aper_size < 32) {
> -		drm_agp_release(rdev->ddev);
> -		dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
> -			"need at least 32M, disabling AGP\n",
> -			rdev->ddev->agp->agp_info.aper_size);
> -		return -EINVAL;
> -	}
> -
> -	mode.mode = info.mode;
> -	/* chips with the agp to pcie bridge don't have the AGP_STATUS register
> -	 * Just use the whatever mode the host sets up.
> -	 */
> -	if (rdev->family <= CHIP_RV350)
> -		agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode;
> -	else
> -		agp_status = mode.mode;
> -	is_v3 = !!(agp_status & RADEON_AGPv3_MODE);
> -
> -	if (is_v3) {
> -		default_mode = (agp_status & RADEON_AGPv3_8X_MODE) ? 8 : 4;
> -	} else {
> -		if (agp_status & RADEON_AGP_4X_MODE) {
> -			default_mode = 4;
> -		} else if (agp_status & RADEON_AGP_2X_MODE) {
> -			default_mode = 2;
> -		} else {
> -			default_mode = 1;
> -		}
> -	}
> -
> -	/* Apply AGPMode Quirks */
> -	while (p && p->chip_device != 0) {
> -		if (info.id_vendor == p->hostbridge_vendor &&
> -		    info.id_device == p->hostbridge_device &&
> -		    rdev->pdev->vendor == p->chip_vendor &&
> -		    rdev->pdev->device == p->chip_device &&
> -		    rdev->pdev->subsystem_vendor == p->subsys_vendor &&
> -		    rdev->pdev->subsystem_device == p->subsys_device) {
> -			default_mode = p->default_mode;
> -		}
> -		++p;
> -	}
> -
> -	if (radeon_agpmode > 0) {
> -		if ((radeon_agpmode < (is_v3 ? 4 : 1)) ||
> -		    (radeon_agpmode > (is_v3 ? 8 : 4)) ||
> -		    (radeon_agpmode & (radeon_agpmode - 1))) {
> -			DRM_ERROR("Illegal AGP Mode: %d (valid %s), leaving at %d\n",
> -				  radeon_agpmode, is_v3 ? "4, 8" : "1, 2, 4",
> -				  default_mode);
> -			radeon_agpmode = default_mode;
> -		} else {
> -			DRM_INFO("AGP mode requested: %d\n", radeon_agpmode);
> -		}
> -	} else {
> -		radeon_agpmode = default_mode;
> -	}
> -
> -	mode.mode &= ~RADEON_AGP_MODE_MASK;
> -	if (is_v3) {
> -		switch (radeon_agpmode) {
> -		case 8:
> -			mode.mode |= RADEON_AGPv3_8X_MODE;
> -			break;
> -		case 4:
> -		default:
> -			mode.mode |= RADEON_AGPv3_4X_MODE;
> -			break;
> -		}
> -	} else {
> -		switch (radeon_agpmode) {
> -		case 4:
> -			mode.mode |= RADEON_AGP_4X_MODE;
> -			break;
> -		case 2:
> -			mode.mode |= RADEON_AGP_2X_MODE;
> -			break;
> -		case 1:
> -		default:
> -			mode.mode |= RADEON_AGP_1X_MODE;
> -			break;
> -		}
> -	}
> -
> -	mode.mode &= ~RADEON_AGP_FW_MODE; /* disable fw */
> -	ret = drm_agp_enable(rdev->ddev, mode);
> -	if (ret) {
> -		DRM_ERROR("Unable to enable AGP (mode = 0x%lx)\n", mode.mode);
> -		drm_agp_release(rdev->ddev);
> -		return ret;
> -	}
> -
> -	rdev->mc.agp_base = rdev->ddev->agp->agp_info.aper_base;

The field agp_base seems to be used to program HW registers. Yet I
cannot find its initialization after applying the patchset. Does some of
this removed setup code need to be moved elsewhere instead?

Best regards
Thomas

> -	rdev->mc.gtt_size = rdev->ddev->agp->agp_info.aper_size << 20;
> -	rdev->mc.gtt_start = rdev->mc.agp_base;
> -	rdev->mc.gtt_end = rdev->mc.gtt_start + rdev->mc.gtt_size - 1;
> -	dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n",
> -		rdev->mc.gtt_size >> 20, rdev->mc.gtt_start, rdev->mc.gtt_end);
> -
> -	/* workaround some hw issues */
> -	if (rdev->family < CHIP_R200) {
> -		WREG32(RADEON_AGP_CNTL, RREG32(RADEON_AGP_CNTL) | 0x000e0000);
> -	}
> -	return 0;
> -#else
> -	return 0;
> -#endif
> -}
> -
> -void radeon_agp_resume(struct radeon_device *rdev)
> -{
> -#if IS_ENABLED(CONFIG_AGP)
> -	int r;
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r)
> -			dev_warn(rdev->dev, "radeon AGP reinit failed\n");
> -	}
> -#endif
> -}
> -
> -void radeon_agp_fini(struct radeon_device *rdev)
> -{
> -#if IS_ENABLED(CONFIG_AGP)
> -	if (rdev->ddev->agp && rdev->ddev->agp->acquired) {
> -		drm_agp_release(rdev->ddev);
> -	}
> -#endif
> -}
> -
> -void radeon_agp_suspend(struct radeon_device *rdev)
> -{
> -	radeon_agp_fini(rdev);
> -}
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 266e3cbbd09b..12e5c5d81c47 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1145,22 +1145,6 @@ static void radeon_check_arguments(struct radeon_device *rdev)
>  	}
>  	rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20;
>  
> -	/* AGP mode can only be -1, 1, 2, 4, 8 */
> -	switch (radeon_agpmode) {
> -	case -1:
> -	case 0:
> -	case 1:
> -	case 2:
> -	case 4:
> -	case 8:
> -		break;
> -	default:
> -		dev_warn(rdev->dev, "invalid AGP mode %d (valid mode: "
> -				"-1, 0, 1, 2, 4, 8)\n", radeon_agpmode);
> -		radeon_agpmode = 0;
> -		break;
> -	}
> -
>  	if (!radeon_check_pot_argument(radeon_vm_size)) {
>  		dev_warn(rdev->dev, "VM size (%d) must be a power of 2\n",
>  			 radeon_vm_size);
> @@ -1348,9 +1332,8 @@ int radeon_device_init(struct radeon_device *rdev,
>  		rdev->flags &= ~RADEON_IS_AGP;
>  	}
>  
> -	if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) {
> +	if (rdev->flags & RADEON_IS_AGP)
>  		radeon_agp_disable(rdev);
> -	}
>  
>  	/* Set the internal MC address mask
>  	 * This is the max address of the GPU's
> @@ -1636,8 +1619,6 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>  	 */
>  	radeon_bo_evict_vram(rdev);
>  
> -	radeon_agp_suspend(rdev);
> -
>  	pci_save_state(dev->pdev);
>  	if (freeze && rdev->family >= CHIP_CEDAR && !(rdev->flags & RADEON_IS_IGP)) {
>  		rdev->asic->asic_reset(rdev, true);
> @@ -1687,8 +1668,6 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
>  			return -1;
>  		}
>  	}
> -	/* resume AGP if in use */
> -	radeon_agp_resume(rdev);
>  	radeon_resume(rdev);
>  
>  	r = radeon_ib_ring_tests(rdev);
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index bbb0883e8ce6..62a5dfaf990b 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -171,12 +171,6 @@ int radeon_no_wb;
>  int radeon_modeset = -1;
>  int radeon_dynclks = -1;
>  int radeon_r4xx_atom = 0;
> -#ifdef __powerpc__
> -/* Default to PCI on PowerPC (fdo #95017) */
> -int radeon_agpmode = -1;
> -#else
> -int radeon_agpmode = 0;
> -#endif
>  int radeon_vram_limit = 0;
>  int radeon_gart_size = -1; /* auto */
>  int radeon_benchmarking = 0;
> @@ -220,9 +214,6 @@ module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
>  MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
>  module_param_named(vramlimit, radeon_vram_limit, int, 0600);
>  
> -MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
> -module_param_named(agpmode, radeon_agpmode, int, 0444);
> -
>  MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 64, etc., -1 = auto)");
>  module_param_named(gartsize, radeon_gart_size, int, 0600);
>  
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 5d50c9edbe80..21bb3706c13c 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -86,20 +86,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
>  		man->available_caching = TTM_PL_MASK_CACHING;
>  		man->default_caching = TTM_PL_FLAG_CACHED;
>  		man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA;
> -#if IS_ENABLED(CONFIG_AGP)
> -		if (rdev->flags & RADEON_IS_AGP) {
> -			if (!rdev->ddev->agp) {
> -				DRM_ERROR("AGP is not enabled for memory type %u\n",
> -					  (unsigned)type);
> -				return -EINVAL;
> -			}
> -			if (!rdev->ddev->agp->cant_use_aperture)
> -				man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
> -			man->available_caching = TTM_PL_FLAG_UNCACHED |
> -						 TTM_PL_FLAG_WC;
> -			man->default_caching = TTM_PL_FLAG_WC;
> -		}
> -#endif
>  		break;
>  	case TTM_PL_VRAM:
>  		/* "On-card" video ram */
> @@ -411,14 +397,6 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>  		/* system memory */
>  		return 0;
>  	case TTM_PL_TT:
> -#if IS_ENABLED(CONFIG_AGP)
> -		if (rdev->flags & RADEON_IS_AGP) {
> -			/* RADEON_IS_AGP is set only if AGP is active */
> -			mem->bus.offset = mem->start << PAGE_SHIFT;
> -			mem->bus.base = rdev->mc.agp_base;
> -			mem->bus.is_iomem = !rdev->ddev->agp->cant_use_aperture;
> -		}
> -#endif
>  		break;
>  	case TTM_PL_VRAM:
>  		mem->bus.offset = mem->start << PAGE_SHIFT;
> @@ -631,12 +609,6 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,
>  	struct radeon_ttm_tt *gtt;
>  
>  	rdev = radeon_get_rdev(bo->bdev);
> -#if IS_ENABLED(CONFIG_AGP)
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		return ttm_agp_tt_create(bo, rdev->ddev->agp->bridge,
> -					 page_flags);
> -	}
> -#endif
>  
>  	gtt = kzalloc(sizeof(struct radeon_ttm_tt), GFP_KERNEL);
>  	if (gtt == NULL) {
> @@ -683,11 +655,6 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm,
>  	}
>  
>  	rdev = radeon_get_rdev(ttm->bdev);
> -#if IS_ENABLED(CONFIG_AGP)
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		return ttm_agp_tt_populate(ttm, ctx);
> -	}
> -#endif
>  
>  #ifdef CONFIG_SWIOTLB
>  	if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
> @@ -714,12 +681,6 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm)
>  		return;
>  
>  	rdev = radeon_get_rdev(ttm->bdev);
> -#if IS_ENABLED(CONFIG_AGP)
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		ttm_agp_tt_unpopulate(ttm);
> -		return;
> -	}
> -#endif
>  
>  #ifdef CONFIG_SWIOTLB
>  	if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
> diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
> index 147e5cf8348d..8a2f16320869 100644
> --- a/drivers/gpu/drm/radeon/rv515.c
> +++ b/drivers/gpu/drm/radeon/rv515.c
> @@ -622,7 +622,6 @@ void rv515_fini(struct radeon_device *rdev)
>  	radeon_ib_pool_fini(rdev);
>  	radeon_gem_fini(rdev);
>  	rv370_pcie_gart_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_irq_kms_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
>  	radeon_bo_fini(rdev);
> @@ -667,13 +666,6 @@ int rv515_init(struct radeon_device *rdev)
>  		return -EINVAL;
>  	/* Initialize clocks */
>  	radeon_get_clock_info(rdev->ddev);
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r) {
> -			radeon_agp_disable(rdev);
> -		}
> -	}
>  	/* initialize memory controller */
>  	rv515_mc_init(rdev);
>  	rv515_debugfs(rdev);
> @@ -703,7 +695,6 @@ int rv515_init(struct radeon_device *rdev)
>  		radeon_ib_pool_fini(rdev);
>  		radeon_irq_kms_fini(rdev);
>  		rv370_pcie_gart_fini(rdev);
> -		radeon_agp_fini(rdev);
>  		rdev->accel_working = false;
>  	}
>  	return 0;
> diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
> index 21f653ae1e1b..20bf54266f24 100644
> --- a/drivers/gpu/drm/radeon/rv770.c
> +++ b/drivers/gpu/drm/radeon/rv770.c
> @@ -1943,12 +1943,6 @@ int rv770_init(struct radeon_device *rdev)
>  	r = radeon_fence_driver_init(rdev);
>  	if (r)
>  		return r;
> -	/* initialize AGP */
> -	if (rdev->flags & RADEON_IS_AGP) {
> -		r = radeon_agp_init(rdev);
> -		if (r)
> -			radeon_agp_disable(rdev);
> -	}
>  	r = rv770_mc_init(rdev);
>  	if (r)
>  		return r;
> @@ -2015,7 +2009,6 @@ void rv770_fini(struct radeon_device *rdev)
>  	r600_vram_scratch_fini(rdev);
>  	radeon_gem_fini(rdev);
>  	radeon_fence_driver_fini(rdev);
> -	radeon_agp_fini(rdev);
>  	radeon_bo_fini(rdev);
>  	radeon_atombios_fini(rdev);
>  	kfree(rdev->bios);
> 

-- 
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200512/8bb8a484/attachment-0001.sig>


More information about the dri-devel mailing list