Commit 56fc40ab authored by Yong Zhao's avatar Yong Zhao Committed by Alex Deucher

drm/amdkfd: Eliminate get_atc_vmid_pasid_mapping_valid

get_atc_vmid_pasid_mapping_valid() is very similar to
get_atc_vmid_pasid_mapping_pasid(), so they can be merged into a new
function get_atc_vmid_pasid_mapping_info() to reduce register access
times. More importantly, getting the PASID and the valid bit atomically
with a single read fixes some potential race conditions where the
mapping changes between the two reads.
Signed-off-by: default avatarYong Zhao <Yong.Zhao@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3fe023d4
...@@ -278,10 +278,8 @@ static const struct kfd2kgd_calls kfd2kgd = { ...@@ -278,10 +278,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
.address_watch_execute = kgd_gfx_v9_address_watch_execute, .address_watch_execute = kgd_gfx_v9_address_watch_execute,
.wave_control_execute = kgd_gfx_v9_wave_control_execute, .wave_control_execute = kgd_gfx_v9_wave_control_execute,
.address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset, .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,
.get_atc_vmid_pasid_mapping_pasid = .get_atc_vmid_pasid_mapping_info =
kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid, kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
.get_atc_vmid_pasid_mapping_valid =
kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid,
.get_tile_config = kgd_gfx_v9_get_tile_config, .get_tile_config = kgd_gfx_v9_get_tile_config,
.set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base, .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
.invalidate_tlbs = kgd_gfx_v9_invalidate_tlbs, .invalidate_tlbs = kgd_gfx_v9_invalidate_tlbs,
......
...@@ -98,10 +98,8 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd, ...@@ -98,10 +98,8 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd,
unsigned int watch_point_id, unsigned int watch_point_id,
unsigned int reg_offset); unsigned int reg_offset);
static bool get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, static bool get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid); uint8_t vmid, uint16_t *p_pasid);
static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid);
static void set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid, static void set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid,
uint64_t page_table_base); uint64_t page_table_base);
static int invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid); static int invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid);
...@@ -155,10 +153,8 @@ static const struct kfd2kgd_calls kfd2kgd = { ...@@ -155,10 +153,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
.address_watch_execute = kgd_address_watch_execute, .address_watch_execute = kgd_address_watch_execute,
.wave_control_execute = kgd_wave_control_execute, .wave_control_execute = kgd_wave_control_execute,
.address_watch_get_offset = kgd_address_watch_get_offset, .address_watch_get_offset = kgd_address_watch_get_offset,
.get_atc_vmid_pasid_mapping_pasid = .get_atc_vmid_pasid_mapping_info =
get_atc_vmid_pasid_mapping_pasid, get_atc_vmid_pasid_mapping_info,
.get_atc_vmid_pasid_mapping_valid =
get_atc_vmid_pasid_mapping_valid,
.get_tile_config = amdgpu_amdkfd_get_tile_config, .get_tile_config = amdgpu_amdkfd_get_tile_config,
.set_vm_context_page_table_base = set_vm_context_page_table_base, .set_vm_context_page_table_base = set_vm_context_page_table_base,
.invalidate_tlbs = invalidate_tlbs, .invalidate_tlbs = invalidate_tlbs,
...@@ -775,26 +771,17 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -775,26 +771,17 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static bool get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, static bool get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid) uint8_t vmid, uint16_t *p_pasid)
{ {
uint32_t reg; uint32_t value;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd; struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING) value = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING)
+ vmid); + vmid);
return reg & ATC_VMID0_PASID_MAPPING__VALID_MASK; *p_pasid = value & ATC_VMID0_PASID_MAPPING__PASID_MASK;
}
static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid)
{
uint32_t reg;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING) return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
+ vmid);
return reg & ATC_VMID0_PASID_MAPPING__PASID_MASK;
} }
static int invalidate_tlbs_with_kiq(struct amdgpu_device *adev, uint16_t pasid) static int invalidate_tlbs_with_kiq(struct amdgpu_device *adev, uint16_t pasid)
...@@ -826,6 +813,8 @@ static int invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid) ...@@ -826,6 +813,8 @@ static int invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *) kgd; struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
int vmid; int vmid;
uint16_t queried_pasid;
bool ret;
struct amdgpu_ring *ring = &adev->gfx.kiq.ring; struct amdgpu_ring *ring = &adev->gfx.kiq.ring;
if (amdgpu_emu_mode == 0 && ring->sched.ready) if (amdgpu_emu_mode == 0 && ring->sched.ready)
...@@ -834,13 +823,13 @@ static int invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid) ...@@ -834,13 +823,13 @@ static int invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid)
for (vmid = 0; vmid < 16; vmid++) { for (vmid = 0; vmid < 16; vmid++) {
if (!amdgpu_amdkfd_is_kfd_vmid(adev, vmid)) if (!amdgpu_amdkfd_is_kfd_vmid(adev, vmid))
continue; continue;
if (get_atc_vmid_pasid_mapping_valid(kgd, vmid)) {
if (get_atc_vmid_pasid_mapping_pasid(kgd, vmid) ret = get_atc_vmid_pasid_mapping_info(kgd, vmid,
== pasid) { &queried_pasid);
amdgpu_gmc_flush_gpu_tlb(adev, vmid, if (ret && queried_pasid == pasid) {
AMDGPU_GFXHUB_0, 0); amdgpu_gmc_flush_gpu_tlb(adev, vmid,
break; AMDGPU_GFXHUB_0, 0);
} break;
} }
} }
......
...@@ -133,9 +133,8 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd, ...@@ -133,9 +133,8 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd,
unsigned int watch_point_id, unsigned int watch_point_id,
unsigned int reg_offset); unsigned int reg_offset);
static bool get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, uint8_t vmid); static bool get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd, uint8_t vmid, uint16_t *p_pasid);
uint8_t vmid);
static void set_scratch_backing_va(struct kgd_dev *kgd, static void set_scratch_backing_va(struct kgd_dev *kgd,
uint64_t va, uint32_t vmid); uint64_t va, uint32_t vmid);
...@@ -186,8 +185,7 @@ static const struct kfd2kgd_calls kfd2kgd = { ...@@ -186,8 +185,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
.address_watch_execute = kgd_address_watch_execute, .address_watch_execute = kgd_address_watch_execute,
.wave_control_execute = kgd_wave_control_execute, .wave_control_execute = kgd_wave_control_execute,
.address_watch_get_offset = kgd_address_watch_get_offset, .address_watch_get_offset = kgd_address_watch_get_offset,
.get_atc_vmid_pasid_mapping_pasid = get_atc_vmid_pasid_mapping_pasid, .get_atc_vmid_pasid_mapping_info = get_atc_vmid_pasid_mapping_info,
.get_atc_vmid_pasid_mapping_valid = get_atc_vmid_pasid_mapping_valid,
.set_scratch_backing_va = set_scratch_backing_va, .set_scratch_backing_va = set_scratch_backing_va,
.get_tile_config = get_tile_config, .get_tile_config = get_tile_config,
.set_vm_context_page_table_base = set_vm_context_page_table_base, .set_vm_context_page_table_base = set_vm_context_page_table_base,
...@@ -753,24 +751,16 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd, ...@@ -753,24 +751,16 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd,
return watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX + reg_offset]; return watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX + reg_offset];
} }
static bool get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, static bool get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid) uint8_t vmid, uint16_t *p_pasid)
{ {
uint32_t reg; uint32_t value;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd; struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(mmATC_VMID0_PASID_MAPPING + vmid); value = RREG32(mmATC_VMID0_PASID_MAPPING + vmid);
return reg & ATC_VMID0_PASID_MAPPING__VALID_MASK; *p_pasid = value & ATC_VMID0_PASID_MAPPING__PASID_MASK;
}
static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid)
{
uint32_t reg;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(mmATC_VMID0_PASID_MAPPING + vmid); return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
return reg & ATC_VMID0_PASID_MAPPING__PASID_MASK;
} }
static void set_scratch_backing_va(struct kgd_dev *kgd, static void set_scratch_backing_va(struct kgd_dev *kgd,
......
...@@ -89,10 +89,8 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd, ...@@ -89,10 +89,8 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd,
unsigned int watch_point_id, unsigned int watch_point_id,
unsigned int reg_offset); unsigned int reg_offset);
static bool get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, static bool get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid); uint8_t vmid, uint16_t *p_pasid);
static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid);
static void set_scratch_backing_va(struct kgd_dev *kgd, static void set_scratch_backing_va(struct kgd_dev *kgd,
uint64_t va, uint32_t vmid); uint64_t va, uint32_t vmid);
static void set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid, static void set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid,
...@@ -141,10 +139,8 @@ static const struct kfd2kgd_calls kfd2kgd = { ...@@ -141,10 +139,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
.address_watch_execute = kgd_address_watch_execute, .address_watch_execute = kgd_address_watch_execute,
.wave_control_execute = kgd_wave_control_execute, .wave_control_execute = kgd_wave_control_execute,
.address_watch_get_offset = kgd_address_watch_get_offset, .address_watch_get_offset = kgd_address_watch_get_offset,
.get_atc_vmid_pasid_mapping_pasid = .get_atc_vmid_pasid_mapping_info =
get_atc_vmid_pasid_mapping_pasid, get_atc_vmid_pasid_mapping_info,
.get_atc_vmid_pasid_mapping_valid =
get_atc_vmid_pasid_mapping_valid,
.set_scratch_backing_va = set_scratch_backing_va, .set_scratch_backing_va = set_scratch_backing_va,
.get_tile_config = get_tile_config, .get_tile_config = get_tile_config,
.set_vm_context_page_table_base = set_vm_context_page_table_base, .set_vm_context_page_table_base = set_vm_context_page_table_base,
...@@ -667,24 +663,16 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -667,24 +663,16 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static bool get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, static bool get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid) uint8_t vmid, uint16_t *p_pasid)
{ {
uint32_t reg; uint32_t value;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd; struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(mmATC_VMID0_PASID_MAPPING + vmid); value = RREG32(mmATC_VMID0_PASID_MAPPING + vmid);
return reg & ATC_VMID0_PASID_MAPPING__VALID_MASK; *p_pasid = value & ATC_VMID0_PASID_MAPPING__PASID_MASK;
}
static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid)
{
uint32_t reg;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(mmATC_VMID0_PASID_MAPPING + vmid); return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
return reg & ATC_VMID0_PASID_MAPPING__PASID_MASK;
} }
static int kgd_address_watch_disable(struct kgd_dev *kgd) static int kgd_address_watch_disable(struct kgd_dev *kgd)
......
...@@ -612,26 +612,17 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -612,26 +612,17 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid) uint8_t vmid, uint16_t *p_pasid)
{ {
uint32_t reg; uint32_t value;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd; struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING) value = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING)
+ vmid); + vmid);
return reg & ATC_VMID0_PASID_MAPPING__VALID_MASK; *p_pasid = value & ATC_VMID0_PASID_MAPPING__PASID_MASK;
}
uint16_t kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid)
{
uint32_t reg;
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
reg = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING) return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
+ vmid);
return reg & ATC_VMID0_PASID_MAPPING__PASID_MASK;
} }
static int invalidate_tlbs_with_kiq(struct amdgpu_device *adev, uint16_t pasid, static int invalidate_tlbs_with_kiq(struct amdgpu_device *adev, uint16_t pasid,
...@@ -666,6 +657,8 @@ int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid) ...@@ -666,6 +657,8 @@ int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *) kgd; struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
int vmid, i; int vmid, i;
uint16_t queried_pasid;
bool ret;
struct amdgpu_ring *ring = &adev->gfx.kiq.ring; struct amdgpu_ring *ring = &adev->gfx.kiq.ring;
uint32_t flush_type = 0; uint32_t flush_type = 0;
...@@ -681,14 +674,14 @@ int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid) ...@@ -681,14 +674,14 @@ int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid)
for (vmid = 0; vmid < 16; vmid++) { for (vmid = 0; vmid < 16; vmid++) {
if (!amdgpu_amdkfd_is_kfd_vmid(adev, vmid)) if (!amdgpu_amdkfd_is_kfd_vmid(adev, vmid))
continue; continue;
if (kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid(kgd, vmid)) {
if (kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid(kgd, vmid) ret = kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(kgd, vmid,
== pasid) { &queried_pasid);
for (i = 0; i < adev->num_vmhubs; i++) if (ret && queried_pasid == pasid) {
amdgpu_gmc_flush_gpu_tlb(adev, vmid, for (i = 0; i < adev->num_vmhubs; i++)
i, flush_type); amdgpu_gmc_flush_gpu_tlb(adev, vmid,
break; i, flush_type);
} break;
} }
} }
...@@ -813,10 +806,8 @@ static const struct kfd2kgd_calls kfd2kgd = { ...@@ -813,10 +806,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
.address_watch_execute = kgd_gfx_v9_address_watch_execute, .address_watch_execute = kgd_gfx_v9_address_watch_execute,
.wave_control_execute = kgd_gfx_v9_wave_control_execute, .wave_control_execute = kgd_gfx_v9_wave_control_execute,
.address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset, .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,
.get_atc_vmid_pasid_mapping_pasid = .get_atc_vmid_pasid_mapping_info =
kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid, kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
.get_atc_vmid_pasid_mapping_valid =
kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid,
.get_tile_config = kgd_gfx_v9_get_tile_config, .get_tile_config = kgd_gfx_v9_get_tile_config,
.set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base, .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
.invalidate_tlbs = kgd_gfx_v9_invalidate_tlbs, .invalidate_tlbs = kgd_gfx_v9_invalidate_tlbs,
......
...@@ -55,10 +55,8 @@ uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd, ...@@ -55,10 +55,8 @@ uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd,
unsigned int watch_point_id, unsigned int watch_point_id,
unsigned int reg_offset); unsigned int reg_offset);
bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid(struct kgd_dev *kgd, bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
uint8_t vmid); uint8_t vmid, uint16_t *p_pasid);
uint16_t kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
uint8_t vmid);
void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid, void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid,
uint64_t page_table_base); uint64_t page_table_base);
int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid); int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid);
......
...@@ -33,7 +33,9 @@ static bool cik_event_interrupt_isr(struct kfd_dev *dev, ...@@ -33,7 +33,9 @@ static bool cik_event_interrupt_isr(struct kfd_dev *dev,
const struct cik_ih_ring_entry *ihre = const struct cik_ih_ring_entry *ihre =
(const struct cik_ih_ring_entry *)ih_ring_entry; (const struct cik_ih_ring_entry *)ih_ring_entry;
const struct kfd2kgd_calls *f2g = dev->kfd2kgd; const struct kfd2kgd_calls *f2g = dev->kfd2kgd;
unsigned int vmid, pasid; unsigned int vmid;
uint16_t pasid;
bool ret;
/* This workaround is due to HW/FW limitation on Hawaii that /* This workaround is due to HW/FW limitation on Hawaii that
* VMID and PASID are not written into ih_ring_entry * VMID and PASID are not written into ih_ring_entry
...@@ -48,13 +50,13 @@ static bool cik_event_interrupt_isr(struct kfd_dev *dev, ...@@ -48,13 +50,13 @@ static bool cik_event_interrupt_isr(struct kfd_dev *dev,
*tmp_ihre = *ihre; *tmp_ihre = *ihre;
vmid = f2g->read_vmid_from_vmfault_reg(dev->kgd); vmid = f2g->read_vmid_from_vmfault_reg(dev->kgd);
pasid = f2g->get_atc_vmid_pasid_mapping_pasid(dev->kgd, vmid); ret = f2g->get_atc_vmid_pasid_mapping_info(dev->kgd, vmid, &pasid);
tmp_ihre->ring_id &= 0x000000ff; tmp_ihre->ring_id &= 0x000000ff;
tmp_ihre->ring_id |= vmid << 8; tmp_ihre->ring_id |= vmid << 8;
tmp_ihre->ring_id |= pasid << 16; tmp_ihre->ring_id |= pasid << 16;
return (pasid != 0) && return ret && (pasid != 0) &&
vmid >= dev->vm_info.first_vmid_kfd && vmid >= dev->vm_info.first_vmid_kfd &&
vmid <= dev->vm_info.last_vmid_kfd; vmid <= dev->vm_info.last_vmid_kfd;
} }
......
...@@ -761,6 +761,7 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p) ...@@ -761,6 +761,7 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p)
{ {
int status = 0; int status = 0;
unsigned int vmid; unsigned int vmid;
uint16_t queried_pasid;
union SQ_CMD_BITS reg_sq_cmd; union SQ_CMD_BITS reg_sq_cmd;
union GRBM_GFX_INDEX_BITS reg_gfx_index; union GRBM_GFX_INDEX_BITS reg_gfx_index;
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
...@@ -782,14 +783,13 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p) ...@@ -782,14 +783,13 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p)
*/ */
for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) {
if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_valid status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info
(dev->kgd, vmid)) { (dev->kgd, vmid, &queried_pasid);
if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_pasid
(dev->kgd, vmid) == p->pasid) { if (status && queried_pasid == p->pasid) {
pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n", pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n",
vmid, p->pasid); vmid, p->pasid);
break; break;
}
} }
} }
......
...@@ -291,12 +291,10 @@ struct kfd2kgd_calls { ...@@ -291,12 +291,10 @@ struct kfd2kgd_calls {
uint32_t (*address_watch_get_offset)(struct kgd_dev *kgd, uint32_t (*address_watch_get_offset)(struct kgd_dev *kgd,
unsigned int watch_point_id, unsigned int watch_point_id,
unsigned int reg_offset); unsigned int reg_offset);
bool (*get_atc_vmid_pasid_mapping_valid)( bool (*get_atc_vmid_pasid_mapping_info)(
struct kgd_dev *kgd, struct kgd_dev *kgd,
uint8_t vmid); uint8_t vmid,
uint16_t (*get_atc_vmid_pasid_mapping_pasid)( uint16_t *p_pasid);
struct kgd_dev *kgd,
uint8_t vmid);
/* No longer needed from GFXv9 onward. The scratch base address is /* No longer needed from GFXv9 onward. The scratch base address is
* passed to the shader by the CP. It's the user mode driver's * passed to the shader by the CP. It's the user mode driver's
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment