Skip to content

Commit a7f2810

Browse files
Kevin Wangalexdeucher
authored andcommitted
drm/amdgpu: add amdgpu_virt_get_vf_mode helper function
the swsmu or powerplay(hwmgr) need to handle task according to different VF mode, this function to help query vf mode. vf mode: 1. SRIOV_VF_MODE_BARE_METAL: the driver work on host OS (PF) 2. SRIOV_VF_MODE_ONE_VF : the driver work on guest OS with one VF 3. SRIOV_VF_MODE_MULTI_VF : the driver work on guest OS with multi VF Signed-off-by: Kevin Wang <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 728e7e0 commit a7f2810

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,19 @@ void amdgpu_virt_disable_access_debugfs(struct amdgpu_device *adev)
370370
if (amdgpu_sriov_vf(adev))
371371
adev->virt.caps |= AMDGPU_SRIOV_CAPS_RUNTIME;
372372
}
373+
374+
enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *adev)
375+
{
376+
enum amdgpu_sriov_vf_mode mode;
377+
378+
if (amdgpu_sriov_vf(adev)) {
379+
if (amdgpu_sriov_is_pp_one_vf(adev))
380+
mode = SRIOV_VF_MODE_ONE_VF;
381+
else
382+
mode = SRIOV_VF_MODE_MULTI_VF;
383+
} else {
384+
mode = SRIOV_VF_MODE_BARE_METAL;
385+
}
386+
387+
return mode;
388+
}

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
/* tonga/fiji use this offset */
3636
#define mmBIF_IOV_FUNC_IDENTIFIER 0x1503
3737

38+
enum amdgpu_sriov_vf_mode {
39+
SRIOV_VF_MODE_BARE_METAL = 0,
40+
SRIOV_VF_MODE_ONE_VF,
41+
SRIOV_VF_MODE_MULTI_VF,
42+
};
43+
3844
struct amdgpu_mm_table {
3945
struct amdgpu_bo *bo;
4046
uint32_t *cpu_addr;
@@ -323,4 +329,6 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev);
323329
bool amdgpu_virt_can_access_debugfs(struct amdgpu_device *adev);
324330
int amdgpu_virt_enable_access_debugfs(struct amdgpu_device *adev);
325331
void amdgpu_virt_disable_access_debugfs(struct amdgpu_device *adev);
332+
333+
enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *adev);
326334
#endif

0 commit comments

Comments
 (0)