drm/amdgpu: Move package type enum to amdgpu_smuio
Subsystems (4)
PATCH v2 1/5 drm/amdgpu: Move package type enum to amdgpu_smuio
Move definition of package type to amdgpu_smuio header and add new package types for CEM and OAM.
---
v2: Move definition to amdgpu_smuio.h instead of amdgpu.h (Christian/Hawking)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ----- drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -5
@@ -69,11 +69,6 @@ enum amdgpu_gfx_partition {#define NUM_XCC (x) hweight16(x) -enum amdgpu_pkg_type { -AMDGPU_PKG_TYPE_APU =2 , -AMDGPU_PKG_TYPE_UNKNOWN , -}; -enum amdgpu_gfx_ras_mem_id_type {AMDGPU_GFX_CP_MEM =0 ,AMDGPU_GFX_GCEA_MEM ,
drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h +7 -0
@@ -23,6 +23,13 @@ #ifndef __AMDGPU_SMUIO_H__ #define __AMDGPU_SMUIO_H__ +enum amdgpu_pkg_type { + AMDGPU_PKG_TYPE_APU = 2, + AMDGPU_PKG_TYPE_CEM = 3, + AMDGPU_PKG_TYPE_OAM = 4, + AMDGPU_PKG_TYPE_UNKNOWN, +}; + struct amdgpu_smuio_funcs { u32 (*get_rom_index_offset)(struct amdgpu_device *adev); u32 (*get_rom_data_offset)(struct amdgpu_device *adev);
Signature · 1 line
2.25.1
PATCH v2 2/5 drm/amdgpu: Add more smuio v13.0.3 package types
Expand support to get other board types like OAM or CEM.
--- drivers/gpu/drm/amd/amdgpu/smuio_v13_0_3.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/smuio_v13_0_3.c +6 -0
@@ -84,6 +84,12 @@ static enum amdgpu_pkg_type smuio_v13_0_3_get_pkg_type(struct amdgpu_device *ade* b0100 - b1111 - Reserved */ switch (data &PKG_TYPE_MASK ) { +case 0x0 : + pkg_type =AMDGPU_PKG_TYPE_CEM ; +break ; +case 0x1 : + pkg_type =AMDGPU_PKG_TYPE_OAM ; +break ;case 0x2 : pkg_type =AMDGPU_PKG_TYPE_APU ;break ;
Signature · 1 line
2.25.1
PATCH v2 3/5 drm/amdgpu: Get package types for smuio v13.0
In reply to Lijo LazarAdd support to query package types supported in smuio v13.0 ASICs.
--- drivers/gpu/drm/amd/amdgpu/smuio_v13_0.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/smuio_v13_0.c +22 -0
@@ -128,6 +128,27 @@ static bool smuio_v13_0_is_host_gpu_xgmi_supported(struct amdgpu_device *adev)return data ? true : false; } +static enum amdgpu_pkg_type smuio_v13_0_get_pkg_type (struct amdgpu_device *adev) +{ +enum amdgpu_pkg_type pkg_type; +u32 data; + + data =RREG32_SOC15 (SMUIO ,0 , regSMUIO_MCM_CONFIG); + data =REG_GET_FIELD (data,SMUIO_MCM_CONFIG ,TOPOLOGY_ID ); + +switch (data) { +case 0x4 : +case 0xC : + pkg_type =AMDGPU_PKG_TYPE_CEM ; +break ; +default : + pkg_type =AMDGPU_PKG_TYPE_OAM ; +break ; + } + +return pkg_type; +} +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,
@@ -136,4 +157,5 @@ const struct amdgpu_smuio_funcs smuio_v13_0_funcs = { .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, + .get_pkg_type = smuio_v13_0_get_pkg_type, };
Signature · 1 line
2.25.1
PATCH v2 4/5 drm/amdgpu: Add sysfs attribute to get board info
In reply to Lijo LazarAdd a sysfs attribute which shows the board form factor like OAM or CEM.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +57 -0
@@ -162,6 +162,58 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev, static DEVICE_ATTR(pcie_replay_count, 0444, amdgpu_device_get_pcie_replay_count, NULL); +static ssize_t amdgpu_device_get_board_info (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (ddev); +enum amdgpu_pkg_type pkg_type =AMDGPU_PKG_TYPE_CEM ; +const char *pkg; + +if (adev->smuio.funcs && adev->smuio.funcs->get_pkg_type) + pkg_type = adev->smuio.funcs->get_pkg_type (adev); + +switch (pkg_type) { +case AMDGPU_PKG_TYPE_CEM : + pkg ="cem" ; +break ; +case AMDGPU_PKG_TYPE_OAM : + pkg ="oam" ; +break ; +default : + pkg ="unknown" ; +break ; + } + +return sysfs_emit (buf,"%s : %s\n" ,"type" , pkg); +} + +static DEVICE_ATTR(board_info, 0444, amdgpu_device_get_board_info, NULL); + +static struct attribute *amdgpu_board_attrs[] = { + &dev_attr_board_info.attr, +NULL , +}; + +static umode_t amdgpu_board_attrs_is_visible (struct kobject *kobj, +struct attribute *attr,int n) +{ +struct device *dev =kobj_to_dev (kobj); +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (ddev); + +if (adev->flags &AMD_IS_APU ) +return 0 ; + +return attr->mode; +} + +static const struct attribute_group amdgpu_board_attrs_group = { + .attrs = amdgpu_board_attrs, + .is_visible = amdgpu_board_attrs_is_visible +}; +static void amdgpu_device_get_pcie_info (struct amdgpu_device *adev);
@@ -4038,6 +4090,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)dev_err (adev->dev,"Could not create amdgpu device attr\n" ); + r =devm_device_add_group (adev->dev, &amdgpu_board_attrs_group); +if (r) +dev_err (adev->dev, +"Could not create amdgpu board attributes\n" ); +amdgpu_fru_sysfs_init (adev);if (IS_ENABLED (CONFIG_PERF_EVENTS ))
Signature · 1 line
2.25.1
PATCH v2 5/5 Documentation/amdgpu: Add board info details
In reply to Lijo LazarAdd documentation for board info sysfs attribute.
--- Documentation/gpu/amdgpu/driver-misc.rst | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+)
Documentation/gpu/amdgpu/driver-misc.rst +6 -0
@@ -32,6 +32,12 @@ unique_id .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c :doc: unique_id +board_info +---------- + +.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c + :doc: board_info + Accelerated Processing Units (APU) Info ---------------------------------------
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +16 -0
@@ -162,6 +162,22 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev, static DEVICE_ATTR(pcie_replay_count, 0444, amdgpu_device_get_pcie_replay_count, NULL); +/** +* DOC: board_info +* +* The amdgpu driver provides a sysfs API for giving board related information. +* It provides the form factor information in the format +* +* type : form factor +* +* Possible form factor values +* +* - "cem" - PCIE CEM card +* - "oam" - Open Compute Accelerator Module +* - "unknown" - Not known +* +*/ +static ssize_t amdgpu_device_get_board_info (struct device *dev,struct device_attribute *attr,char *buf)
Signature · 1 line
2.25.1
RE: [PATCH v2 5/5] Documentation/amdgpu: Add board info details
[AMD Official Use Only - General]
Series is
Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 4, 2023 15:40
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH v2 5/5] Documentation/amdgpu: Add board info details
Add documentation for board info sysfs attribute.
--- Documentation/gpu/amdgpu/driver-misc.rst | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+)
Documentation/gpu/amdgpu/driver-misc.rst +6 -0
@@ -32,6 +32,12 @@ unique_id .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c :doc: unique_id +board_info +---------- + +.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c + :doc: board_info + Accelerated Processing Units (APU) Info ---------------------------------------
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +16 -1
@@ -162,6 +162,22 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev, static DEVICE_ATTR(pcie_replay_count, 0444, amdgpu_device_get_pcie_replay_count, NULL); +/** +* DOC: board_info +* +* The amdgpu driver provides a sysfs API for giving board related information. +* It provides the form factor information in the format +* +* type : form factor +* +* Possible form factor values +* +* - "cem" - PCIE CEM card +* - "oam" - Open Compute Accelerator Module +* - "unknown" - Not known +* +*/ +static ssize_t amdgpu_device_get_board_info (struct device *dev,struct device_attribute *attr,char *buf) --
2.25.1
[AMD Official Use Only - General]
Series is:
________________________________
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 4, 2023 3:39 AM
To: [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH v2 1/5] drm/amdgpu: Move package type enum to amdgpu_smuio
Move definition of package type to amdgpu_smuio header and add new package types for CEM and OAM.
---
v2: Move definition to amdgpu_smuio.h instead of amdgpu.h (Christian/Hawking)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ----- drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -5
@@ -69,11 +69,6 @@ enum amdgpu_gfx_partition {#define NUM_XCC (x) hweight16(x) -enum amdgpu_pkg_type { -AMDGPU_PKG_TYPE_APU =2 , -AMDGPU_PKG_TYPE_UNKNOWN , -}; -enum amdgpu_gfx_ras_mem_id_type {AMDGPU_GFX_CP_MEM =0 ,AMDGPU_GFX_GCEA_MEM ,
drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h +7 -0
@@ -23,6 +23,13 @@ #ifndef __AMDGPU_SMUIO_H__ #define __AMDGPU_SMUIO_H__ +enum amdgpu_pkg_type { + AMDGPU_PKG_TYPE_APU = 2, + AMDGPU_PKG_TYPE_CEM = 3, + AMDGPU_PKG_TYPE_OAM = 4, + AMDGPU_PKG_TYPE_UNKNOWN, +}; + struct amdgpu_smuio_funcs { u32 (*get_rom_index_offset)(struct amdgpu_device *adev); u32 (*get_rom_data_offset)(struct amdgpu_device *adev);
--
2.25.1
Am 04.10.23 um 09:39 schrieb Lijo Lazar:
Quoted 4 lines
Move definition of package type to
amdgpu_smuioheader and add new package types for CEM and OAM.Signed-off-by Lijo Lazar <[email protected]>
Quoted 42 lines
---
v2: Move definition to
amdgpu_smuio.hinstead ofamdgpu.h(Christian/Hawking)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ----- drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-5@@ -69,11 +69,6 @@ enum amdgpu_gfx_partition {#define NUM_XCC (x) hweight16(x) -enum amdgpu_pkg_type { -AMDGPU_PKG_TYPE_APU =2 , -AMDGPU_PKG_TYPE_UNKNOWN , -}; -enum amdgpu_gfx_ras_mem_id_type {AMDGPU_GFX_CP_MEM =0 ,AMDGPU_GFX_GCEA_MEM ,drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h +7
-0@@ -23,6 +23,13 @@ #ifndef __AMDGPU_SMUIO_H__ #define __AMDGPU_SMUIO_H__ +enum amdgpu_pkg_type { + AMDGPU_PKG_TYPE_APU = 2, + AMDGPU_PKG_TYPE_CEM = 3, + AMDGPU_PKG_TYPE_OAM = 4, + AMDGPU_PKG_TYPE_UNKNOWN, +}; + struct amdgpu_smuio_funcs { u32 (*get_rom_index_offset)(struct amdgpu_device *adev); u32 (*get_rom_data_offset)(struct amdgpu_device *adev);