drm/amdgpu: implement smuio callback to query socket id
authorHawking Zhang <Hawking.Zhang@amd.com>
Fri, 23 Apr 2021 06:37:10 +0000 (14:37 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 29 Apr 2021 03:35:49 +0000 (23:35 -0400)
get_socket_id is used to query socket id

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: John Clements <John.Clements@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h
drivers/gpu/drm/amd/amdgpu/smuio_v13_0.c

index b860ec913ac5c1e5cb0781f9fb869c9ed321d5d8..484bb3dcec473eb2defd036692fc745caa91bf5f 100644 (file)
@@ -29,6 +29,7 @@ struct amdgpu_smuio_funcs {
        void (*update_rom_clock_gating)(struct amdgpu_device *adev, bool enable);
        void (*get_clock_gating_state)(struct amdgpu_device *adev, u32 *flags);
        u32 (*get_die_id)(struct amdgpu_device *adev);
+       u32 (*get_socket_id)(struct amdgpu_device *adev);
        bool (*is_host_gpu_xgmi_supported)(struct amdgpu_device *adev);
 };
 
index 079b094c48ad7fdd0a173c30a80b1d0b65f2234f..3c47c94846d6d11685b07a606fb9bff3f9358184 100644 (file)
@@ -88,6 +88,23 @@ static u32 smuio_v13_0_get_die_id(struct amdgpu_device *adev)
        return die_id;
 }
 
+/**
+ * smuio_v13_0_get_socket_id - query socket id from FCH
+ *
+ * @adev: amdgpu device pointer
+ *
+ * Returns socket id
+ */
+static u32 smuio_v13_0_get_socket_id(struct amdgpu_device *adev)
+{
+       u32 data, socket_id;
+
+       data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
+       socket_id = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, SOCKET_ID);
+
+       return socket_id;
+}
+
 /**
  * smuio_v13_0_supports_host_gpu_xgmi - detect xgmi interface between cpu and gpu/s.
  *
@@ -115,6 +132,7 @@ const struct amdgpu_smuio_funcs smuio_v13_0_funcs = {
        .get_rom_index_offset = smuio_v13_0_get_rom_index_offset,
        .get_rom_data_offset = smuio_v13_0_get_rom_data_offset,
        .get_die_id = smuio_v13_0_get_die_id,
+       .get_socket_id = smuio_v13_0_get_socket_id,
        .is_host_gpu_xgmi_supported = smuio_v13_0_is_host_gpu_xgmi_supported,
        .update_rom_clock_gating = smuio_v13_0_update_rom_clock_gating,
        .get_clock_gating_state = smuio_v13_0_get_clock_gating_state,