drm/amd: Extend ROCt to surface UUID for devices that have them
authorDivya Shikre <DivyaUday.Shikre@amd.com>
Tue, 25 Feb 2020 22:17:37 +0000 (17:17 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 26 Feb 2020 19:18:17 +0000 (14:18 -0500)
Devices from Arcturus onwards will have their UUID exposed to Thunk.
Adding neccessary functions to the kernel to propagate the uuid.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
drivers/gpu/drm/amd/amdkfd/kfd_topology.h
drivers/gpu/drm/amd/include/kgd_kfd_interface.h

index c29e2cba8c681287eaa89a30c63102372b309206..2c5fa5e4d6f656710c6f1730c3c1871374c1892d 100644 (file)
@@ -525,6 +525,14 @@ uint64_t amdgpu_amdkfd_get_hive_id(struct kgd_dev *kgd)
 
        return adev->gmc.xgmi.hive_id;
 }
+
+uint64_t amdgpu_amdkfd_get_unique_id(struct kgd_dev *kgd)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+       return adev->unique_id;
+}
+
 uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *src)
 {
        struct amdgpu_device *peer_adev = (struct amdgpu_device *)src;
index 0ee8aae6c519cbe5ab0b180f33eda207dd34f9b4..b0ad3be0b03f10910559813d06ee24367c011431 100644 (file)
@@ -172,6 +172,7 @@ int amdgpu_amdkfd_get_dmabuf_info(struct kgd_dev *kgd, int dma_buf_fd,
                                  uint32_t *flags);
 uint64_t amdgpu_amdkfd_get_vram_usage(struct kgd_dev *kgd);
 uint64_t amdgpu_amdkfd_get_hive_id(struct kgd_dev *kgd);
+uint64_t amdgpu_amdkfd_get_unique_id(struct kgd_dev *kgd);
 uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct kgd_dev *kgd);
 uint32_t amdgpu_amdkfd_get_num_gws(struct kgd_dev *kgd);
 uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *src);
index a7b17c8deb00332a13571c61a4b42e1fd346763e..ca91fffb8a3622fba432648066ac8341e43f93e8 100644 (file)
@@ -808,4 +808,5 @@ const struct kfd2kgd_calls gfx_v10_kfd2kgd = {
        .get_tile_config = amdgpu_amdkfd_get_tile_config,
        .set_vm_context_page_table_base = set_vm_context_page_table_base,
        .get_hive_id = amdgpu_amdkfd_get_hive_id,
+       .get_unique_id = amdgpu_amdkfd_get_unique_id,
 };
index 8562afe5b761382c5492b230493c56998068bc1c..7f91feff7c4fda8d969305660cafbe97340dc23c 100644 (file)
@@ -739,4 +739,5 @@ const struct kfd2kgd_calls gfx_v9_kfd2kgd = {
        .get_tile_config = kgd_gfx_v9_get_tile_config,
        .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
        .get_hive_id = amdgpu_amdkfd_get_hive_id,
+       .get_unique_id = amdgpu_amdkfd_get_unique_id,
 };
index a3d7ec0424cfc7ad199445f1f6155dedc00d87ab..d5386f15c4a5f5c72d7e6c820de6a6009d059707 100644 (file)
@@ -648,6 +648,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
        if (kfd->kfd2kgd->get_hive_id)
                kfd->hive_id = kfd->kfd2kgd->get_hive_id(kfd->kgd);
 
+       if (kfd->kfd2kgd->get_unique_id)
+               kfd->unique_id = kfd->kfd2kgd->get_unique_id(kfd->kgd);
+
        if (kfd_interrupt_init(kfd)) {
                dev_err(kfd_device, "Error initializing interrupts\n");
                goto kfd_interrupt_error;
index f326e31624d73260fe26166cb29c9a67e481e547..4a3049841086d826ea8d798606a7af82dd44ffc1 100644 (file)
@@ -294,6 +294,9 @@ struct kfd_dev {
 
        /* xGMI */
        uint64_t hive_id;
+    
+       /* UUID */
+       uint64_t unique_id;
 
        bool pci_atomic_requested;
 
index 203c823d65f158bc6a211895273b6f33263feb49..034655544122cfdf3ca04f608a2cd41b041cea95 100644 (file)
@@ -490,6 +490,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
                        dev->node_props.num_sdma_queues_per_engine);
        sysfs_show_32bit_prop(buffer, "num_cp_queues",
                        dev->node_props.num_cp_queues);
+    sysfs_show_64bit_prop(buffer, "unique_id",
+                       dev->node_props.unique_id);
 
        if (dev->gpu) {
                log_max_watch_addr =
@@ -1319,6 +1321,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
                dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ?
                amdgpu_amdkfd_get_num_gws(dev->gpu->kgd) : 0;
        dev->node_props.num_cp_queues = get_queues_num(dev->gpu->dqm);
+       dev->node_props.unique_id = gpu->unique_id;
 
        kfd_fill_mem_clk_max_info(dev);
        kfd_fill_iolink_non_crat_info(dev);
index 74e9b1682af8a9cc4de04a30450f5aa761168bd6..46eeecaf1b68ee67506524c196a7c8c747b3e2aa 100644 (file)
@@ -54,6 +54,7 @@
 
 struct kfd_node_properties {
        uint64_t hive_id;
+       uint64_t unique_id;
        uint32_t cpu_cores_count;
        uint32_t simd_count;
        uint32_t mem_banks_count;
index a607b1034962902534a7ae6affbdab372eab3547..6910ff732b7c5a54dd43849c805f8e704d671a7e 100644 (file)
@@ -151,6 +151,7 @@ struct kgd2kfd_shared_resources {
 
        /* Minor device number of the render node */
        int drm_render_minor;
+
 };
 
 struct tile_config {
@@ -236,6 +237,8 @@ struct tile_config {
  *
  * @get_hive_id: Returns hive id of current  device,  0 if xgmi is not enabled
  *
+ * @get_unique_id: Returns uuid id of current  device
+ * 
  * This structure contains function pointers to services that the kgd driver
  * provides to amdkfd driver.
  *
@@ -313,6 +316,7 @@ struct kfd2kgd_calls {
                        uint32_t vmid, uint64_t page_table_base);
        uint32_t (*read_vmid_from_vmfault_reg)(struct kgd_dev *kgd);
        uint64_t (*get_hive_id)(struct kgd_dev *kgd);
+       uint64_t (*get_unique_id)(struct kgd_dev *kgd);
 
 };