[2/5] drm/amdgpu: make sriov bios detection generic

Submitted by Alex Deucher on Sept. 19, 2016, 6:35 p.m.

Details

Message ID 1474310162-21802-2-git-send-email-alexander.deucher@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Alex Deucher Sept. 19, 2016, 6:35 p.m.
It's not asic specific.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 drivers/gpu/drm/amd/amdgpu/vi.c            | 7 -------
 3 files changed, 7 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index ff6e683..f3d4bf6 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);
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,