diff options
author | pding <Pixel.Ding@amd.com> | 2017-10-23 22:01:13 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-04 16:33:13 -0500 |
commit | a16f8f11c599cdec16e77020d56d230fedabe922 (patch) | |
tree | b0a48a1f5025351549fcaee4a5363131d99c82c8 | |
parent | 1366b2d01654d2028cba64109ad1bffb8afbef73 (diff) |
drm/amdgpu/virt: add function to check MMIO (v2)
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 <Pixel.Ding@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index 6738df836a70..0f227cf7a67c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | |||
@@ -24,6 +24,14 @@ | |||
24 | #include "amdgpu.h" | 24 | #include "amdgpu.h" |
25 | #define MAX_KIQ_REG_WAIT 100000000 /* in usecs */ | 25 | #define MAX_KIQ_REG_WAIT 100000000 /* in usecs */ |
26 | 26 | ||
27 | bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev) | ||
28 | { | ||
29 | /* By now all MMIO pages except mailbox are blocked */ | ||
30 | /* if blocking is enabled in hypervisor. Choose the */ | ||
31 | /* SCRATCH_REG0 to test. */ | ||
32 | return RREG32_NO_KIQ(0xc040) == 0xffffffff; | ||
33 | } | ||
34 | |||
27 | int amdgpu_allocate_static_csa(struct amdgpu_device *adev) | 35 | int amdgpu_allocate_static_csa(struct amdgpu_device *adev) |
28 | { | 36 | { |
29 | int r; | 37 | int r; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h index b89d37fc406f..81efb9d291c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | |||
@@ -276,6 +276,7 @@ static inline bool is_virtual_machine(void) | |||
276 | } | 276 | } |
277 | 277 | ||
278 | struct amdgpu_vm; | 278 | struct amdgpu_vm; |
279 | bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev); | ||
279 | int amdgpu_allocate_static_csa(struct amdgpu_device *adev); | 280 | int amdgpu_allocate_static_csa(struct amdgpu_device *adev); |
280 | int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 281 | int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
281 | struct amdgpu_bo_va **bo_va); | 282 | struct amdgpu_bo_va **bo_va); |