[PATCH] drm/amdgpu: enable AGP aperture on gmc10.x

Christian König ckoenig.leichtzumerken at gmail.com
Mon Nov 30 15:50:34 UTC 2020


Am 30.11.20 um 16:47 schrieb Alex Deucher:
> Just a small optimization for accessing system pages directly.
> Was missed for gmc v10 since the feature landed for older gmcs
> while we were still on the emulator or gmc10 and we use the AGP
> aperture for zfb on the emulator.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c | 6 +++---
>   drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c | 6 +++---
>   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c   | 1 +
>   drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c  | 6 +++---
>   drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c  | 4 ++--
>   5 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c
> index 456360bf58fa..51606d2c346c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c
> @@ -153,10 +153,10 @@ static void gfxhub_v2_0_init_system_aperture_regs(struct amdgpu_device *adev)
>   	uint64_t value;
>   
>   	if (!amdgpu_sriov_vf(adev)) {
> -		/* Disable AGP. */
> +		/* Program the AGP BAR */
>   		WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BASE, 0);
> -		WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_TOP, 0);
> -		WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BOT, 0x00FFFFFF);
> +		WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
> +		WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
>   
>   		/* Program the system aperture low logical page number. */
>   		WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_LOW_ADDR,
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
> index 724bb29e9bb4..95a50fadbd54 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
> @@ -152,10 +152,10 @@ static void gfxhub_v2_1_init_system_aperture_regs(struct amdgpu_device *adev)
>   {
>   	uint64_t value;
>   
> -	/* Disable AGP. */
> +	/* Program the AGP BAR */
>   	WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BASE, 0);
> -	WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_TOP, 0);
> -	WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BOT, 0x00FFFFFF);
> +	WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
> +	WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
>   
>   	/* Program the system aperture low logical page number. */
>   	WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_LOW_ADDR,
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> index 4f6e44e21691..518233d71e6d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> @@ -738,6 +738,7 @@ static void gmc_v10_0_vram_gtt_location(struct amdgpu_device *adev,
>   
>   	amdgpu_gmc_vram_location(adev, &adev->gmc, base);
>   	amdgpu_gmc_gart_location(adev, mc);
> +	amdgpu_gmc_agp_location(adev, mc);
>   
>   	/* base offset of vram pages */
>   	adev->vm_manager.vram_base_offset = adev->gfxhub.funcs->get_mc_fb_offset(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> index 4ac8ac0c56c8..c539685948de 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> @@ -195,10 +195,10 @@ static void mmhub_v2_0_init_system_aperture_regs(struct amdgpu_device *adev)
>   	uint64_t value;
>   	uint32_t tmp;
>   
> -	/* Disable AGP. */
> +	/* Program the AGP BAR */
>   	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BASE, 0);
> -	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_TOP, 0);
> -	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BOT, 0x00FFFFFF);
> +	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
> +	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
>   
>   	if (!amdgpu_sriov_vf(adev)) {
>   		/* Program the system aperture low logical page number. */
> diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c
> index 3a248c8cd0b9..5372704889cf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c
> @@ -152,8 +152,8 @@ static void mmhub_v2_3_init_system_aperture_regs(struct amdgpu_device *adev)
>   
>   	/* Disable AGP. */
>   	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BASE, 0);
> -	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_TOP, 0);
> -	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BOT, 0x00FFFFFF);
> +	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
> +	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
>   
>   	/* Program the system aperture low logical page number. */
>   	WREG32_SOC15(MMHUB, 0, mmMMMC_VM_SYSTEM_APERTURE_LOW_ADDR,



More information about the amd-gfx mailing list