Hi Shahyan, in this case we need to sync up with Alex on the team meeting tomorrow.
It would be greate if you can rebase the patches and just leave out this one my moving it to a separate branch. Please give "git rebase -i" a try, it should make this pretty easy, just make sure that everything still compiles. Thanks, Christian. On 6/24/26 17:04, Soltani, Shahyan wrote: > AMD General > > On 6/23/2026 04:55, Christian Koenig wrote: >> I think we should really just move the defines in a new file called >> amdgpu_device.h. >> >> The uid is something device specific and it is a bit overkill to have a >> separate C file for it. > > Hi Christian, > > I made a amdgpu_device.h file in v1 of the patch however I was asked by Alex > to drop it > to keep core structures within amdgpu.h. > > I'm not entirely sure if it would be better to create amdgpu_device.h file > with only the uid > struct and helpers or keep it within amdgpu.h (dropping this patch). Any > clarification on the > this matter will be greatly appreciated. > > Thanks, > Shahyan. > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > *From:* Koenig, Christian <[email protected]> > *Sent:* Tuesday, June 23, 2026 4:55 AM > *To:* Soltani, Shahyan <[email protected]>; > [email protected] <[email protected]> > *Cc:* Deucher, Alexander <[email protected]> > *Subject:* Re: [PATCH v3 2/8] drm/amdgpu: move struct amdgpu_uid and helpers > into separate files > > On 6/22/26 21:57, Shahyan Soltani wrote: >> Move struct amdgpu_uid and helpers from the monolithic amdgpu.h file into a >> new amdgpu_uid.h file. >> >> Move functions amdgpu_device_set_uid() and amdgpu_device_get_uid() out of >> amdgpu_device.c into new dedicated amdgpu_uid.c file. >> >> Update amdgpu/Makefile to build amdgpu_uid.o >> >> This is part of the ongoing effort to reduce the size of amdgpu.h into their >> own respective >> separate headers. >> >> Signed-off-by: Shahyan Soltani <[email protected]> >> >> --- >> This patch and patch 7 can be dropped if moving amdgpu_uid out of >> amdgpu.h is not desirable. > > I think we should really just move the defines in a new file called > amdgpu_device.h. > > The uid is something device specific and it is a bit overkill to have a > separate C file for it. > > Regards, > Christian. > >> --- >> drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 22 +------ >> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 50 --------------- >> drivers/gpu/drm/amd/amdgpu/amdgpu_uid.c | 75 ++++++++++++++++++++++ >> drivers/gpu/drm/amd/amdgpu/amdgpu_uid.h | 50 +++++++++++++++ >> 5 files changed, 127 insertions(+), 72 deletions(-) >> create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_uid.c >> create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_uid.h >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile >> b/drivers/gpu/drm/amd/amdgpu/Makefile >> index 10dc7cfd607e..ab5fdbb5e4b4 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/Makefile >> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile >> @@ -72,7 +72,7 @@ amdgpu-y += amdgpu_device.o amdgpu_reg_access.o >> amdgpu_doorbell_mgr.o amdgpu_kms >> amdgpu_eeprom.o amdgpu_mca.o amdgpu_psp_ta.o amdgpu_lsdma.o >>amdgpu_lockdep.o \ >> amdgpu_ring_mux.o amdgpu_xcp.o amdgpu_seq64.o amdgpu_aca.o >>amdgpu_dev_coredump.o \ >> amdgpu_cper.o amdgpu_userq_fence.o amdgpu_eviction_fence.o >>amdgpu_ip.o \ >> - amdgpu_wb.o >> + amdgpu_wb.o amdgpu_uid.o >> >> amdgpu-$(CONFIG_PROC_FS) += amdgpu_fdinfo.o >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> index 4ffcc0cc6404..fe951a901d20 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> @@ -116,6 +116,7 @@ >> #include "amdgpu_wb.h" >> #include "amdgpu_ip.h" >> #include "amdgpu_sa.h" >> +#include "amdgpu_uid.h" >> #if defined(CONFIG_DRM_AMD_ISP) >> #include "amdgpu_isp.h" >> #endif >> @@ -551,21 +552,6 @@ struct amdgpu_mmio_remap { >> struct amdgpu_bo *bo; >> }; >> >> -enum amdgpu_uid_type { >> - AMDGPU_UID_TYPE_XCD, >> - AMDGPU_UID_TYPE_AID, >> - AMDGPU_UID_TYPE_SOC, >> - AMDGPU_UID_TYPE_MID, >> - AMDGPU_UID_TYPE_MAX >> -}; >> - >> -#define AMDGPU_UID_INST_MAX 8 /* max number of instances for each UID type >> */ >> - >> -struct amdgpu_uid { >> - uint64_t uid[AMDGPU_UID_TYPE_MAX][AMDGPU_UID_INST_MAX]; >> - struct amdgpu_device *adev; >> -}; >> - >> #define MAX_UMA_OPTION_NAME 28 >> #define MAX_UMA_OPTION_ENTRIES 19 >> >> @@ -1530,10 +1516,4 @@ static inline int >> amdgpu_device_bus_status_check(struct amdgpu_device *adev) >> >> return 0; >> } >> - >> -void amdgpu_device_set_uid(struct amdgpu_uid *uid_info, >> - enum amdgpu_uid_type type, uint8_t inst, >> - uint64_t uid); >> -uint64_t amdgpu_device_get_uid(struct amdgpu_uid *uid_info, >> - enum amdgpu_uid_type type, uint8_t inst); >> #endif >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >> index d6931e1184d0..8d55658ecb31 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >> @@ -6717,53 +6717,3 @@ ssize_t amdgpu_show_reset_mask(char *buf, uint32_t >> supported_reset) >> size += sysfs_emit_at(buf, size, "\n"); >> return size; >> } >> - >> -void amdgpu_device_set_uid(struct amdgpu_uid *uid_info, >> - enum amdgpu_uid_type type, uint8_t inst, >> - uint64_t uid) >> -{ >> - if (!uid_info) >> - return; >> - >> - if (type >= AMDGPU_UID_TYPE_MAX) { >> - dev_err_once(uid_info->adev->dev, "Invalid UID type %d\n", >> - type); >> - return; >> - } >> - >> - if (inst >= AMDGPU_UID_INST_MAX) { >> - dev_err_once(uid_info->adev->dev, "Invalid UID instance %d\n", >> - inst); >> - return; >> - } >> - >> - if (uid_info->uid[type][inst] != 0) { >> - dev_warn_once( >> - uid_info->adev->dev, >> - "Overwriting existing UID %llu for type %d instance >> %d\n", >> - uid_info->uid[type][inst], type, inst); >> - } >> - >> - uid_info->uid[type][inst] = uid; >> -} >> - >> -u64 amdgpu_device_get_uid(struct amdgpu_uid *uid_info, >> - enum amdgpu_uid_type type, uint8_t inst) >> -{ >> - if (!uid_info) >> - return 0; >> - >> - if (type >= AMDGPU_UID_TYPE_MAX) { >> - dev_err_once(uid_info->adev->dev, "Invalid UID type %d\n", >> - type); >> - return 0; >> - } >> - >> - if (inst >= AMDGPU_UID_INST_MAX) { >> - dev_err_once(uid_info->adev->dev, "Invalid UID instance %d\n", >> - inst); >> - return 0; >> - } >> - >> - return uid_info->uid[type][inst]; >> -} >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uid.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uid.c >> new file mode 100644 >> index 000000000000..6cf6b3f12271 >> --- /dev/null >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uid.c >> @@ -0,0 +1,75 @@ >> +// SPDX-License-Identifier: GPL-2.0 OR MIT >> +/* >> + * Copyright 2026 Advanced Micro Devices, Inc. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included >> in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR >> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR >> + * OTHER DEALINGS IN THE SOFTWARE. >> + */ >> +#include "amdgpu_uid.h" >> +#include <linux/dev_printk.h> >> +#include "amdgpu.h" >> + >> +void amdgpu_device_set_uid(struct amdgpu_uid *uid_info, >> + enum amdgpu_uid_type type, uint8_t inst, >> + uint64_t uid) >> +{ >> + if (!uid_info) >> + return; >> + >> + if (type >= AMDGPU_UID_TYPE_MAX) { >> + dev_err_once(uid_info->adev->dev, "Invalid UID type %d\n", >> + type); >> + return; >> + } >> + >> + if (inst >= AMDGPU_UID_INST_MAX) { >> + dev_err_once(uid_info->adev->dev, "Invalid UID instance %d\n", >> + inst); >> + return; >> + } >> + >> + if (uid_info->uid[type][inst] != 0) { >> + dev_warn_once( >> + uid_info->adev->dev, >> + "Overwriting existing UID %llu for type %d instance >> %d\n", >> + uid_info->uid[type][inst], type, inst); >> + } >> + >> + uid_info->uid[type][inst] = uid; >> +} >> + >> +u64 amdgpu_device_get_uid(struct amdgpu_uid *uid_info, >> + enum amdgpu_uid_type type, uint8_t inst) >> +{ >> + if (!uid_info) >> + return 0; >> + >> + if (type >= AMDGPU_UID_TYPE_MAX) { >> + dev_err_once(uid_info->adev->dev, "Invalid UID type %d\n", >> + type); >> + return 0; >> + } >> + >> + if (inst >= AMDGPU_UID_INST_MAX) { >> + dev_err_once(uid_info->adev->dev, "Invalid UID instance %d\n", >> + inst); >> + return 0; >> + } >> + >> + return uid_info->uid[type][inst]; >> +} >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uid.h >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uid.h >> new file mode 100644 >> index 000000000000..d92ddcce9f58 >> --- /dev/null >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uid.h >> @@ -0,0 +1,50 @@ >> +/* SPDX-License-Identifier: GPL-2.0 OR MIT >> + * >> + * Copyright 2026 Advanced Micro Devices, Inc. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included >> in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR >> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR >> + * OTHER DEALINGS IN THE SOFTWARE. >> + */ >> +#ifndef __AMDGPU_UID_H__ >> +#define __AMDGPU_UID_H__ >> + >> +#include <linux/types.h> >> + >> +#define AMDGPU_UID_INST_MAX 8 /* max number of instances for each UID type >> */ >> + >> +struct amdgpu_device; >> + >> +enum amdgpu_uid_type { >> + AMDGPU_UID_TYPE_XCD, >> + AMDGPU_UID_TYPE_AID, >> + AMDGPU_UID_TYPE_SOC, >> + AMDGPU_UID_TYPE_MID, >> + AMDGPU_UID_TYPE_MAX >> +}; >> + >> +struct amdgpu_uid { >> + uint64_t uid[AMDGPU_UID_TYPE_MAX][AMDGPU_UID_INST_MAX]; >> + struct amdgpu_device *adev; >> +}; >> + >> +void amdgpu_device_set_uid(struct amdgpu_uid *uid_info, >> + enum amdgpu_uid_type type, uint8_t inst, >> + uint64_t uid); >> +uint64_t amdgpu_device_get_uid(struct amdgpu_uid *uid_info, >> + enum amdgpu_uid_type type, uint8_t inst); >> +#endif >
