Re: [PATCH] drm/amdkfd: replace trivial funcs with direct access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-11-05 2:43 p.m., Graham Sider wrote:
These get funcs simply return an adev field. Replace funcs/calls with
direct field accesses instead.

Signed-off-by: Graham Sider <Graham.Sider@xxxxxxx>

Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>


---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c    | 30 -------------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h    |  6 ----
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c      |  4 +--
  drivers/gpu/drm/amd/amdkfd/kfd_device.c       |  8 ++---
  .../amd/amdkfd/kfd_process_queue_manager.c    |  2 +-
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c     |  7 ++---
  6 files changed, 10 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index 83f863dca7af..46cf48b3904a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -521,16 +521,6 @@ uint64_t amdgpu_amdkfd_get_vram_usage(struct amdgpu_device *adev)
  	return amdgpu_vram_mgr_usage(vram_man);
  }
-uint64_t amdgpu_amdkfd_get_hive_id(struct amdgpu_device *adev)
-{
-	return adev->gmc.xgmi.hive_id;
-}
-
-uint64_t amdgpu_amdkfd_get_unique_id(struct amdgpu_device *adev)
-{
-	return adev->unique_id;
-}
-
  uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct amdgpu_device *dst,
  					  struct amdgpu_device *src)
  {
@@ -630,26 +620,6 @@ int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct amdgpu_device *adev, bool is_
  	return (num_lanes_factor * gen_speed_mbits_factor)/BITS_PER_BYTE;
  }
-uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct amdgpu_device *adev)
-{
-	return adev->rmmio_remap.bus_addr;
-}
-
-uint32_t amdgpu_amdkfd_get_num_gws(struct amdgpu_device *adev)
-{
-	return adev->gds.gws_size;
-}
-
-uint32_t amdgpu_amdkfd_get_asic_rev_id(struct amdgpu_device *adev)
-{
-	return adev->rev_id;
-}
-
-int amdgpu_amdkfd_get_noretry(struct amdgpu_device *adev)
-{
-	return adev->gmc.noretry;
-}
-
  int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
  				enum kgd_engine_type engine,
  				uint32_t vmid, uint64_t gpu_addr,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 5f658823a637..d00de575c541 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
@@ -224,12 +224,6 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd,
  				  size_t buffer_size, uint32_t *metadata_size,
  				  uint32_t *flags);
  uint64_t amdgpu_amdkfd_get_vram_usage(struct amdgpu_device *adev);
-uint64_t amdgpu_amdkfd_get_hive_id(struct amdgpu_device *adev);
-uint64_t amdgpu_amdkfd_get_unique_id(struct amdgpu_device *adev);
-uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct amdgpu_device *adev);
-uint32_t amdgpu_amdkfd_get_num_gws(struct amdgpu_device *adev);
-uint32_t amdgpu_amdkfd_get_asic_rev_id(struct amdgpu_device *adev);
-int amdgpu_amdkfd_get_noretry(struct amdgpu_device *adev);
  uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct amdgpu_device *dst,
  					  struct amdgpu_device *src);
  int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct amdgpu_device *dst,
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 8d5021e8c714..2e3d74f7fbfb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1313,7 +1313,7 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep,
  			err = -EINVAL;
  			goto err_unlock;
  		}
-		offset = amdgpu_amdkfd_get_mmio_remap_phys_addr(dev->adev);
+		offset = dev->adev->rmmio_remap.bus_addr;
  		if (!offset) {
  			err = -ENOMEM;
  			goto err_unlock;
@@ -2066,7 +2066,7 @@ static int kfd_mmio_mmap(struct kfd_dev *dev, struct kfd_process *process,
  	if (vma->vm_end - vma->vm_start != PAGE_SIZE)
  		return -EINVAL;
- address = amdgpu_amdkfd_get_mmio_remap_phys_addr(dev->adev);
+	address = dev->adev->rmmio_remap.bus_addr;
vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE |
  				VM_DONTDUMP | VM_PFNMAP;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index c8aade17efef..b752dc36a2cd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -892,7 +892,7 @@ static int kfd_gws_init(struct kfd_dev *kfd)
  		|| (kfd->device_info->asic_family == CHIP_ALDEBARAN
  			&& kfd->mec2_fw_version >= 0x28))
  		ret = amdgpu_amdkfd_alloc_gws(kfd->adev,
-				amdgpu_amdkfd_get_num_gws(kfd->adev), &kfd->gws);
+				kfd->adev->gds.gws_size, &kfd->gws);
return ret;
  }
@@ -994,9 +994,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
  		goto kfd_doorbell_error;
  	}
- kfd->hive_id = amdgpu_amdkfd_get_hive_id(kfd->adev);
+	kfd->hive_id = kfd->adev->gmc.xgmi.hive_id;
- kfd->noretry = amdgpu_amdkfd_get_noretry(kfd->adev);
+	kfd->noretry = kfd->adev->gmc.noretry;
if (kfd_interrupt_init(kfd)) {
  		dev_err(kfd_device, "Error initializing interrupts\n");
@@ -1014,7 +1014,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
  	 */
  	if (kfd_gws_init(kfd)) {
  		dev_err(kfd_device, "Could not allocate %d gws\n",
-			amdgpu_amdkfd_get_num_gws(kfd->adev));
+			kfd->adev->gds.gws_size);
  		goto gws_error;
  	}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 62dc41cf2cb9..4f8464658daf 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -118,7 +118,7 @@ int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
  		return ret;
pqn->q->gws = mem;
-	pdd->qpd.num_gws = gws ? amdgpu_amdkfd_get_num_gws(dev->adev) : 0;
+	pdd->qpd.num_gws = gws ? dev->adev->gds.gws_size : 0;
return pqn->q->device->dqm->ops.update_queue(pqn->q->device->dqm,
  							pqn->q, NULL);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 2e0006e22006..ae7c9944dc4a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -531,7 +531,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
  		sysfs_show_32bit_prop(buffer, offs, "sdma_fw_version",
  				      dev->gpu->sdma_fw_version);
  		sysfs_show_64bit_prop(buffer, offs, "unique_id",
-				      amdgpu_amdkfd_get_unique_id(dev->gpu->adev));
+				      dev->gpu->adev->unique_id);
} @@ -1381,8 +1381,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
  	dev->node_props.vendor_id = gpu->pdev->vendor;
  	dev->node_props.device_id = gpu->pdev->device;
  	dev->node_props.capability |=
-		((amdgpu_amdkfd_get_asic_rev_id(dev->gpu->adev) <<
-			HSA_CAP_ASIC_REVISION_SHIFT) &
+		((dev->gpu->adev->rev_id << HSA_CAP_ASIC_REVISION_SHIFT) &
  			HSA_CAP_ASIC_REVISION_MASK);
  	dev->node_props.location_id = pci_dev_id(gpu->pdev);
  	dev->node_props.domain = pci_domain_nr(gpu->pdev->bus);
@@ -1401,7 +1400,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
  				gpu->device_info->num_sdma_queues_per_engine;
  	dev->node_props.num_gws = (dev->gpu->gws &&
  		dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ?
-		amdgpu_amdkfd_get_num_gws(dev->gpu->adev) : 0;
+		dev->gpu->adev->gds.gws_size : 0;
  	dev->node_props.num_cp_queues = get_cp_queues_num(dev->gpu->dqm);
kfd_fill_mem_clk_max_info(dev);



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux