提交 585f0e6c 编写于 作者: E Edward O'Callaghan 提交者: Oded Gabbay

drm/amdkfd: Tidy up kfd_generate_gpu_id() uint64_t bitshift unpack

Dereference the one time and unpack the lower and upper 32bit
portions with the proper kernel helper macros.
Signed-off-by: NEdward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: NOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: NOded Gabbay <oded.gabbay@gmail.com>
上级 9f8cf165
...@@ -1090,19 +1090,21 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev *gpu) ...@@ -1090,19 +1090,21 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev *gpu)
{ {
uint32_t hashout; uint32_t hashout;
uint32_t buf[7]; uint32_t buf[7];
uint64_t local_mem_size;
int i; int i;
if (!gpu) if (!gpu)
return 0; return 0;
local_mem_size = gpu->kfd2kgd->get_vmem_size(gpu->kgd);
buf[0] = gpu->pdev->devfn; buf[0] = gpu->pdev->devfn;
buf[1] = gpu->pdev->subsystem_vendor; buf[1] = gpu->pdev->subsystem_vendor;
buf[2] = gpu->pdev->subsystem_device; buf[2] = gpu->pdev->subsystem_device;
buf[3] = gpu->pdev->device; buf[3] = gpu->pdev->device;
buf[4] = gpu->pdev->bus->number; buf[4] = gpu->pdev->bus->number;
buf[5] = (uint32_t)(gpu->kfd2kgd->get_vmem_size(gpu->kgd) buf[5] = lower_32_bits(local_mem_size);
& 0xffffffff); buf[6] = upper_32_bits(local_mem_size);
buf[6] = (uint32_t)(gpu->kfd2kgd->get_vmem_size(gpu->kgd) >> 32);
for (i = 0, hashout = 0; i < 7; i++) for (i = 0, hashout = 0; i < 7; i++)
hashout ^= hash_32(buf[i], KFD_GPU_ID_HASH_WIDTH); hashout ^= hash_32(buf[i], KFD_GPU_ID_HASH_WIDTH);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册