]> Git Repo - linux.git/commitdiff
drm/amdgpu/virt: add function to check MMIO (v2)
authorpding <[email protected]>
Tue, 24 Oct 2017 02:01:13 +0000 (10:01 +0800)
committerAlex Deucher <[email protected]>
Mon, 4 Dec 2017 21:33:13 +0000 (16:33 -0500)
MMIO space can be blocked on virtualised device. Add this
function to check if MMIO is blocked or not.

Todo: need a reliable method such like communation
with hypervisor.

v2:
 - add comments inline

Signed-off-by: pding <[email protected]>
Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h

index 6738df836a70eb45c3643593c3c03dc700ed67f1..0f227cf7a67c087c121744607113a3d825d68c5c 100644 (file)
 #include "amdgpu.h"
 #define MAX_KIQ_REG_WAIT       100000000 /* in usecs */
 
+bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev)
+{
+       /* By now all MMIO pages except mailbox are blocked */
+       /* if blocking is enabled in hypervisor. Choose the */
+       /* SCRATCH_REG0 to test. */
+       return RREG32_NO_KIQ(0xc040) == 0xffffffff;
+}
+
 int amdgpu_allocate_static_csa(struct amdgpu_device *adev)
 {
        int r;
index b89d37fc406f4cea88ada380c84158ac6d4cef98..81efb9d291c4e51bd113f4b05be488100f3a4ef1 100644 (file)
@@ -276,6 +276,7 @@ static inline bool is_virtual_machine(void)
 }
 
 struct amdgpu_vm;
+bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev);
 int amdgpu_allocate_static_csa(struct amdgpu_device *adev);
 int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                          struct amdgpu_bo_va **bo_va);
This page took 0.063775 seconds and 4 git commands to generate.