[PATCH 2/5] drm/amdgpu: make sriov bios detection generic (v2)

Edward O'Callaghan funfunctor at folklore1984.net
Mon Sep 19 23:32:24 UTC 2016


Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

as with the rest of the respective series.

On 09/20/2016 04:44 AM, Alex Deucher wrote:
> It's not asic specific.
> 
> v2: drop asic macro
> 
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 2 --
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
>  drivers/gpu/drm/amd/amdgpu/vi.c            | 7 -------
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index ff6e683..fb8d603 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1828,7 +1828,6 @@ struct amdgpu_asic_funcs {
>  	bool (*read_bios_from_rom)(struct amdgpu_device *adev,
>  				   u8 *bios, u32 length_bytes);
>  	void (*detect_hw_virtualization) (struct amdgpu_device *adev);
> -	void (*detect_sriov_bios)(struct amdgpu_device *adev);
>  	int (*read_register)(struct amdgpu_device *adev, u32 se_num,
>  			     u32 sh_num, u32 reg_offset, u32 *value);
>  	void (*set_vga_state)(struct amdgpu_device *adev, bool state);
> @@ -2287,7 +2286,6 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
>  #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev))
>  #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
>  #define amdgpu_asic_detect_hw_virtualization(adev) (adev)->asic_funcs->detect_hw_virtualization((adev))
> -#define amdgpu_asic_detect_sriov_bios(adev) (adev)->asic_funcs->detect_sriov_bios((adev))
>  #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))
>  #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid))
>  #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags))
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index ca161e9..76f8298 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1535,6 +1535,12 @@ static bool amdgpu_device_is_virtual(void)
>  #endif
>  }
>  
> +static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)
> +{
> +	if (amdgpu_atombios_has_gpu_virtualization_table(adev))
> +		adev->virtualization.virtual_caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS;
> +}
> +
>  /**
>   * amdgpu_device_init - initialize the driver
>   *
> @@ -1690,8 +1696,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>  	}
>  
>  	/* detect if we are with an SRIOV vbios */
> -	if (adev->asic_funcs->detect_sriov_bios)
> -		amdgpu_asic_detect_sriov_bios(adev);
> +	amdgpu_device_detect_sriov_bios(adev);
>  
>  	/* Post card if necessary */
>  	if (amdgpu_vpost_needed(adev)) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
> index 81780f1..a8154d0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vi.c
> @@ -462,12 +462,6 @@ static void vi_detect_hw_virtualization(struct amdgpu_device *adev)
>  	}
>  }
>  
> -static void vi_detect_sriov_bios(struct amdgpu_device *adev)
> -{
> -	if (amdgpu_atombios_has_gpu_virtualization_table(adev))
> -		adev->virtualization.virtual_caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS;
> -}
> -
>  static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = {
>  	{mmGB_MACROTILE_MODE7, true},
>  };
> @@ -1531,7 +1525,6 @@ static const struct amdgpu_asic_funcs vi_asic_funcs =
>  	.read_disabled_bios = &vi_read_disabled_bios,
>  	.read_bios_from_rom = &vi_read_bios_from_rom,
>  	.detect_hw_virtualization = vi_detect_hw_virtualization,
> -	.detect_sriov_bios = vi_detect_sriov_bios,
>  	.read_register = &vi_read_register,
>  	.reset = &vi_asic_reset,
>  	.set_vga_state = &vi_vga_set_state,
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160920/a8b80a81/attachment.sig>


More information about the amd-gfx mailing list