> -----Original Message----- > From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf > Of Pixel Ding > Sent: Monday, October 23, 2017 6:03 AM > To: amd-gfx@lists.freedesktop.org > Cc: Sun, Gary; Ding, Pixel; Li, Bingley > Subject: [PATCH 4/7] drm/amdgpu/virt: add function to check MMIO > accessing > > From: pding <pixel.d...@amd.com> > > 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. > > Signed-off-by: pding <pixel.d...@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 5 +++++ > drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c > index e97f80f..33dac7e 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c > @@ -24,6 +24,11 @@ > #include "amdgpu.h" > #define MAX_KIQ_REG_WAIT 100000000 /* in usecs */ > > +bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev) > +{ > + return RREG32_NO_KIQ(0xc040) == 0xffffffff; > +}
Is this safe? Won't accessing non-instanced registers cause a problem? Probably also worth commenting that register this is and a note for future asics in case the register map changes. Alex > + > int amdgpu_allocate_static_csa(struct amdgpu_device *adev) > { > int r; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h > index b89d37f..81efb9d 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) > } > > 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); > -- > 2.9.5 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx