[PATCH 1/2] drm/amdgpu:add fw-vram-usage for atomfirmware

Liu, Monk Monk.Liu at amd.com
Wed Nov 1 03:40:25 UTC 2017


Yeah, I'll cleanup them before pushing 

-----Original Message-----
From: Deucher, Alexander 
Sent: 2017年10月31日 23:01
To: Liu, Monk <Monk.Liu at amd.com>; amd-gfx at lists.freedesktop.org
Cc: Liu, Monk <Monk.Liu at amd.com>
Subject: RE: [PATCH 1/2] drm/amdgpu:add fw-vram-usage for atomfirmware

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf 
> Of Monk Liu
> Sent: Tuesday, October 31, 2017 7:55 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Liu, Monk
> Subject: [PATCH 1/2] drm/amdgpu:add fw-vram-usage for atomfirmware
> 
> otherwise PF & VF exchange is broken
> 
> Change-Id: Icbb44e640ba1c6e61914cbd234e92de001496195
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 26
> ++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> index f9ffe8e..455ad63 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> @@ -71,19 +71,37 @@ int
> amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev)
>  	struct atom_context *ctx = adev->mode_info.atom_context;
>  	int index =
> get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
>  						vram_usagebyfirmware);
> +	struct vram_usagebyfirmware_v2_1 *	firmware_usage;
> +	uint32_t start_addr, size;
>  	uint16_t data_offset;
>  	int usage_bytes = 0;
> 
>  	if (amdgpu_atom_parse_data_header(ctx, index, NULL, NULL, NULL,
> &data_offset)) {
> -		struct vram_usagebyfirmware_v2_1 *firmware_usage =
> -			(struct vram_usagebyfirmware_v2_1 *)(ctx->bios +
> data_offset);
> +		printk("data_offset=%x\n", data_offset);

Drop this debugging leftover.

> +		firmware_usage = (struct vram_usagebyfirmware_v2_1
> *)(ctx->bios + data_offset);
> 
> -		DRM_DEBUG("atom firmware requested %08x %dkb fw
> %dkb drv\n",
> +		DRM_INFO("atom firmware requested %08x %dkb fw %dkb

Any reason to make this non-debug?

> drv\n",
>  			  le32_to_cpu(firmware_usage-
> >start_address_in_kb),
>  			  le16_to_cpu(firmware_usage-
> >used_by_firmware_in_kb),
>  			  le16_to_cpu(firmware_usage-
> >used_by_driver_in_kb));
> 
> -		usage_bytes = le16_to_cpu(firmware_usage-
> >used_by_driver_in_kb) * 1024;
> +		start_addr = le32_to_cpu(firmware_usage-
> >start_address_in_kb);
> +		size = le16_to_cpu(firmware_usage-
> >used_by_firmware_in_kb);
> +
> +		printk("start_addr = %x, size=%x\n", start_addr, size);

More debug leftovers.

With the above comments addressed, the patch is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> +
> +		if ((uint32_t)(start_addr &
> ATOM_VRAM_OPERATION_FLAGS_MASK) ==
> +
> 	(uint32_t)(ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATIO
> N <<
> +			ATOM_VRAM_OPERATION_FLAGS_SHIFT)) {
> +			/* Firmware request VRAM reservation for SR-IOV */
> +			adev->fw_vram_usage.start_offset = (start_addr &
> +
> 	(~ATOM_VRAM_OPERATION_FLAGS_MASK)) << 10;
> +			adev->fw_vram_usage.size = size << 10;
> +			/* Use the default scratch size */
> +			usage_bytes = 0;
> +		} else {
> +			usage_bytes = le16_to_cpu(firmware_usage-
> >used_by_driver_in_kb) << 10;
> +		}
>  	}
>  	ctx->scratch_size_bytes = 0;
>  	if (usage_bytes == 0)
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list