2
0

libhsakmt: Use a better name doorbell_mmap_offset

The previous name doorbell_offset is used too extensively throughout
the code and did not reflect the true usage.

Change-Id: I50d33f5c00e82c46cdf4264a78b8f925705bed6a
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Este cometimento está contido em:
Yong Zhao
2019-01-15 16:21:31 -05:00
ascendente 7cd7830182
cometimento 776077fe65
2 ficheiros modificados com 10 adições e 10 eliminações
+2 -2
Ver ficheiro
@@ -1369,7 +1369,7 @@ void *fmm_allocate_device(uint32_t gpu_id, void *address, uint64_t MemorySizeInB
} }
void *fmm_allocate_doorbell(uint32_t gpu_id, uint64_t MemorySizeInBytes, void *fmm_allocate_doorbell(uint32_t gpu_id, uint64_t MemorySizeInBytes,
uint64_t doorbell_offset) uint64_t doorbell_mmap_offset)
{ {
manageable_aperture_t *aperture; manageable_aperture_t *aperture;
int32_t gpu_mem_id; int32_t gpu_mem_id;
@@ -1410,7 +1410,7 @@ void *fmm_allocate_doorbell(uint32_t gpu_id, uint64_t MemorySizeInBytes,
void *ret = mmap(mem, MemorySizeInBytes, void *ret = mmap(mem, MemorySizeInBytes,
PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, kfd_fd, MAP_SHARED | MAP_FIXED, kfd_fd,
doorbell_offset); doorbell_mmap_offset);
if (ret == MAP_FAILED) { if (ret == MAP_FAILED) {
__fmm_release(vm_obj, aperture); __fmm_release(vm_obj, aperture);
return NULL; return NULL;
+8 -8
Ver ficheiro
@@ -263,12 +263,12 @@ void clear_process_doorbells(void)
} }
static HSAKMT_STATUS map_doorbell_apu(HSAuint32 NodeId, HSAuint32 gpu_id, static HSAKMT_STATUS map_doorbell_apu(HSAuint32 NodeId, HSAuint32 gpu_id,
HSAuint64 doorbell_offset) HSAuint64 doorbell_mmap_offset)
{ {
void *ptr; void *ptr;
ptr = mmap(0, doorbells[NodeId].size, PROT_READ|PROT_WRITE, ptr = mmap(0, doorbells[NodeId].size, PROT_READ|PROT_WRITE,
MAP_SHARED, kfd_fd, doorbell_offset); MAP_SHARED, kfd_fd, doorbell_mmap_offset);
if (ptr == MAP_FAILED) if (ptr == MAP_FAILED)
return HSAKMT_STATUS_ERROR; return HSAKMT_STATUS_ERROR;
@@ -279,12 +279,12 @@ static HSAKMT_STATUS map_doorbell_apu(HSAuint32 NodeId, HSAuint32 gpu_id,
} }
static HSAKMT_STATUS map_doorbell_dgpu(HSAuint32 NodeId, HSAuint32 gpu_id, static HSAKMT_STATUS map_doorbell_dgpu(HSAuint32 NodeId, HSAuint32 gpu_id,
HSAuint64 doorbell_offset) HSAuint64 doorbell_mmap_offset)
{ {
void *ptr; void *ptr;
ptr = fmm_allocate_doorbell(gpu_id, doorbells[NodeId].size, ptr = fmm_allocate_doorbell(gpu_id, doorbells[NodeId].size,
doorbell_offset); doorbell_mmap_offset);
if (!ptr) if (!ptr)
return HSAKMT_STATUS_ERROR; return HSAKMT_STATUS_ERROR;
@@ -301,7 +301,7 @@ static HSAKMT_STATUS map_doorbell_dgpu(HSAuint32 NodeId, HSAuint32 gpu_id,
} }
static HSAKMT_STATUS map_doorbell(HSAuint32 NodeId, HSAuint32 gpu_id, static HSAKMT_STATUS map_doorbell(HSAuint32 NodeId, HSAuint32 gpu_id,
HSAuint64 doorbell_offset) HSAuint64 doorbell_mmap_offset)
{ {
HSAKMT_STATUS status = HSAKMT_STATUS_SUCCESS; HSAKMT_STATUS status = HSAKMT_STATUS_SUCCESS;
@@ -315,16 +315,16 @@ static HSAKMT_STATUS map_doorbell(HSAuint32 NodeId, HSAuint32 gpu_id,
&doorbells[NodeId]); &doorbells[NodeId]);
if (doorbells[NodeId].use_gpuvm) { if (doorbells[NodeId].use_gpuvm) {
status = map_doorbell_dgpu(NodeId, gpu_id, doorbell_offset); status = map_doorbell_dgpu(NodeId, gpu_id, doorbell_mmap_offset);
if (status != HSAKMT_STATUS_SUCCESS) { if (status != HSAKMT_STATUS_SUCCESS) {
/* Fall back to the old method if KFD doesn't /* Fall back to the old method if KFD doesn't
* support doorbells in GPUVM * support doorbells in GPUVM
*/ */
doorbells[NodeId].use_gpuvm = false; doorbells[NodeId].use_gpuvm = false;
status = map_doorbell_apu(NodeId, gpu_id, doorbell_offset); status = map_doorbell_apu(NodeId, gpu_id, doorbell_mmap_offset);
} }
} else } else
status = map_doorbell_apu(NodeId, gpu_id, doorbell_offset); status = map_doorbell_apu(NodeId, gpu_id, doorbell_mmap_offset);
if (status != HSAKMT_STATUS_SUCCESS) if (status != HSAKMT_STATUS_SUCCESS)
doorbells[NodeId].size = 0; doorbells[NodeId].size = 0;