浏览代码

drm/amdgpu: track whether the asic supports SR-IOV

Required to make desicions about certain code pathes.

Reviewed-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Alex Deucher 9 年之前
父节点
当前提交
7e471e6fba
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 7 0
      drivers/gpu/drm/amd/amdgpu/amdgpu.h
  2. 4 0
      drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+ 7 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu.h

@@ -1898,6 +1898,11 @@ void *amdgpu_cgs_create_device(struct amdgpu_device *adev);
 void amdgpu_cgs_destroy_device(void *cgs_device);
 void amdgpu_cgs_destroy_device(void *cgs_device);
 
 
 
 
+/* GPU virtualization */
+struct amdgpu_virtualization {
+	bool supports_sr_iov;
+};
+
 /*
 /*
  * Core structure, functions and helpers.
  * Core structure, functions and helpers.
  */
  */
@@ -2071,6 +2076,8 @@ struct amdgpu_device {
 
 
 	/* kernel conext for IB submission */
 	/* kernel conext for IB submission */
 	struct amdgpu_ctx	kernel_ctx;
 	struct amdgpu_ctx	kernel_ctx;
+
+	struct amdgpu_virtualization virtualization;
 };
 };
 
 
 bool amdgpu_device_is_px(struct drm_device *dev);
 bool amdgpu_device_is_px(struct drm_device *dev);

+ 4 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

@@ -1500,6 +1500,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		return r;
 		return r;
 	}
 	}
 
 
+	/* See if the asic supports SR-IOV */
+	adev->virtualization.supports_sr_iov =
+		amdgpu_atombios_has_gpu_virtualization_table(adev);
+
 	/* Post card if necessary */
 	/* Post card if necessary */
 	if (!amdgpu_card_posted(adev)) {
 	if (!amdgpu_card_posted(adev)) {
 		if (!adev->bios) {
 		if (!adev->bios) {