Re: [PATCH v2] arm: mach-k3: Refactor QoS settings
On Mon, Feb 12, 2024 at 03:36:35PM +0530, Aradhya Bhatia wrote: > Refactor common QoS code into a new common header file, and the soc > specific setup_qos functions into a common API. > > Rename $(soc)_qos_count and $(soc)_qos_data variables to qos_count and > qos_data. When QoS settings of more SoCs are added, only one pair will > be defined at a time, based on the config SOC_K3_$(soc). > > This refactoring has been done for 2 major purposes. > > - The auto-generated $(soc)_qos_data.c and $(soc)_qos.h files cannot > have any code that is specific to any bootloader. Those files have to > remain agnostic of different bootloader implementations and their > header files. > > - The existing implementation was less than ideal and would have enabled > multiple $(soc)_qos_count and $(soc)_qos_data variables for all SoC > variants. > > Signed-off-by: Aradhya Bhatia Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v2] arm: mach-k3: Refactor QoS settings
Hey Bryan! On 12/02/24 20:51, Bryan Brattlof wrote: > Hey Aradhya! > > On February 12, 2024 thus sayeth Aradhya Bhatia: >> Refactor common QoS code into a new common header file, and the soc >> specific setup_qos functions into a common API. >> >> Rename $(soc)_qos_count and $(soc)_qos_data variables to qos_count and >> qos_data. When QoS settings of more SoCs are added, only one pair will >> be defined at a time, based on the config SOC_K3_$(soc). >> >> This refactoring has been done for 2 major purposes. >> >> - The auto-generated $(soc)_qos_data.c and $(soc)_qos.h files cannot >> have any code that is specific to any bootloader. Those files have to >> remain agnostic of different bootloader implementations and their >> header files. >> >> - The existing implementation was less than ideal and would have enabled >> multiple $(soc)_qos_count and $(soc)_qos_data variables for all SoC >> variants. >> >> Signed-off-by: Aradhya Bhatia >> --- >> >> Change Log: >> >> - new in v2: >>- Move K3_QOS config to the r5/Kconfig. >> >> Previous versions: >> >> - v1: >> https://lore.kernel.org/all/20240206085610.3226136-1-a-bhat...@ti.com/ >> > > ... > >> diff --git a/arch/arm/mach-k3/r5/am62ax/Makefile >> b/arch/arm/mach-k3/r5/am62ax/Makefile >> index 02a941805e9a..e4e55ce5c7dd 100644 >> --- a/arch/arm/mach-k3/r5/am62ax/Makefile >> +++ b/arch/arm/mach-k3/r5/am62ax/Makefile >> @@ -4,4 +4,4 @@ >> >> obj-y += clk-data.o >> obj-y += dev-data.o >> -obj-y += am62a_qos_data.o >> +obj-y += am62a_qos_uboot.o > > No objections from me though I am curious about the name change. Was > there an issue with using the original am62a_qos_data.c > Yes! The previous version of the auto-generated file ($soc_qos_data.c) was the same for u-boot and SBL, which restricted us from making u-boot specific changes. We will now be creating 2 different files for each of them, and the name had to be changed to reflect that. Regards Aradhya
Re: [PATCH v2] arm: mach-k3: Refactor QoS settings
Hey Aradhya! On February 12, 2024 thus sayeth Aradhya Bhatia: > Refactor common QoS code into a new common header file, and the soc > specific setup_qos functions into a common API. > > Rename $(soc)_qos_count and $(soc)_qos_data variables to qos_count and > qos_data. When QoS settings of more SoCs are added, only one pair will > be defined at a time, based on the config SOC_K3_$(soc). > > This refactoring has been done for 2 major purposes. > > - The auto-generated $(soc)_qos_data.c and $(soc)_qos.h files cannot > have any code that is specific to any bootloader. Those files have to > remain agnostic of different bootloader implementations and their > header files. > > - The existing implementation was less than ideal and would have enabled > multiple $(soc)_qos_count and $(soc)_qos_data variables for all SoC > variants. > > Signed-off-by: Aradhya Bhatia > --- > > Change Log: > > - new in v2: >- Move K3_QOS config to the r5/Kconfig. > > Previous versions: > > - v1: https://lore.kernel.org/all/20240206085610.3226136-1-a-bhat...@ti.com/ > ... > diff --git a/arch/arm/mach-k3/r5/am62ax/Makefile > b/arch/arm/mach-k3/r5/am62ax/Makefile > index 02a941805e9a..e4e55ce5c7dd 100644 > --- a/arch/arm/mach-k3/r5/am62ax/Makefile > +++ b/arch/arm/mach-k3/r5/am62ax/Makefile > @@ -4,4 +4,4 @@ > > obj-y += clk-data.o > obj-y += dev-data.o > -obj-y += am62a_qos_data.o > +obj-y += am62a_qos_uboot.o No objections from me though I am curious about the name change. Was there an issue with using the original am62a_qos_data.c ~Bryan
[PATCH v2] arm: mach-k3: Refactor QoS settings
Refactor common QoS code into a new common header file, and the soc specific setup_qos functions into a common API. Rename $(soc)_qos_count and $(soc)_qos_data variables to qos_count and qos_data. When QoS settings of more SoCs are added, only one pair will be defined at a time, based on the config SOC_K3_$(soc). This refactoring has been done for 2 major purposes. - The auto-generated $(soc)_qos_data.c and $(soc)_qos.h files cannot have any code that is specific to any bootloader. Those files have to remain agnostic of different bootloader implementations and their header files. - The existing implementation was less than ideal and would have enabled multiple $(soc)_qos_count and $(soc)_qos_data variables for all SoC variants. Signed-off-by: Aradhya Bhatia --- Change Log: - new in v2: - Move K3_QOS config to the r5/Kconfig. Previous versions: - v1: https://lore.kernel.org/all/20240206085610.3226136-1-a-bhat...@ti.com/ --- arch/arm/mach-k3/am62a7_init.c| 14 arch/arm/mach-k3/common.c | 12 ++ arch/arm/mach-k3/common.h | 8 +++ arch/arm/mach-k3/include/mach/hardware.h | 9 arch/arm/mach-k3/include/mach/k3-qos.h| 22 +++ arch/arm/mach-k3/r5/Kconfig | 8 +++ arch/arm/mach-k3/r5/am62ax/Makefile | 2 +- .../{include/mach => r5/am62ax}/am62a_qos.h | 0 .../{am62a_qos_data.c => am62a_qos_uboot.c} | 9 9 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 arch/arm/mach-k3/include/mach/k3-qos.h rename arch/arm/mach-k3/{include/mach => r5/am62ax}/am62a_qos.h (100%) rename arch/arm/mach-k3/r5/am62ax/{am62a_qos_data.c => am62a_qos_uboot.c} (85%) diff --git a/arch/arm/mach-k3/am62a7_init.c b/arch/arm/mach-k3/am62a7_init.c index d72e19936b9b..080274e3af58 100644 --- a/arch/arm/mach-k3/am62a7_init.c +++ b/arch/arm/mach-k3/am62a7_init.c @@ -69,20 +69,6 @@ static void ctrl_mmr_unlock(void) mmr_unlock(PADCFG_MMR1_BASE, 1); } -#if (IS_ENABLED(CONFIG_CPU_V7R)) -static void setup_qos(void) -{ - u32 i; - - for (i = 0; i < am62a_qos_count; i++) - writel(am62a_qos_data[i].val, (uintptr_t)am62a_qos_data[i].reg); -} -#else -static void setup_qos(void) -{ -} -#endif - void board_init_f(ulong dummy) { struct udevice *dev; diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index f411366778f0..b54f2ddc4729 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -28,6 +28,8 @@ #include #include +#include + #if IS_ENABLED(CONFIG_SYS_K3_SPL_ATF) enum { IMAGE_ID_ATF, @@ -595,3 +597,13 @@ int misc_init_r(void) void __weak do_board_detect(void) { } + +#if (IS_ENABLED(CONFIG_K3_QOS)) +void setup_qos(void) +{ + u32 i; + + for (i = 0; i < qos_count; i++) + writel(qos_data[i].val, (uintptr_t)qos_data[i].reg); +} +#endif diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h index e9db9fbfb63d..53aa186b31a4 100644 --- a/arch/arm/mach-k3/common.h +++ b/arch/arm/mach-k3/common.h @@ -45,3 +45,11 @@ void ti_secure_image_post_process(void **p_image, size_t *p_size); struct ti_sci_handle *get_ti_sci_handle(void); void do_board_detect(void); void ti_secure_image_check_binary(void **p_image, size_t *p_size); + +#if (IS_ENABLED(CONFIG_K3_QOS)) +void setup_qos(void); +#else +static inline void setup_qos(void) +{ +} +#endif diff --git a/arch/arm/mach-k3/include/mach/hardware.h b/arch/arm/mach-k3/include/mach/hardware.h index a1a9dfbde66c..52ef82e70b07 100644 --- a/arch/arm/mach-k3/include/mach/hardware.h +++ b/arch/arm/mach-k3/include/mach/hardware.h @@ -30,7 +30,6 @@ #ifdef CONFIG_SOC_K3_AM62A7 #include "am62a_hardware.h" -#include "am62a_qos.h" #endif /* Assuming these addresses and definitions stay common across K3 devices */ @@ -97,12 +96,4 @@ struct rom_extended_boot_data { u32 num_components; }; -struct k3_qos_data { - u32 reg; - u32 val; -}; - -extern struct k3_qos_data am62a_qos_data[]; -extern u32 am62a_qos_count; - #endif /* _ASM_ARCH_HARDWARE_H_ */ diff --git a/arch/arm/mach-k3/include/mach/k3-qos.h b/arch/arm/mach-k3/include/mach/k3-qos.h new file mode 100644 index ..e00e1de5b9cb --- /dev/null +++ b/arch/arm/mach-k3/include/mach/k3-qos.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Quality of Service (QoS) Configuration Header File + * + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/ + */ +#ifndef _K3_QOS_H_ +#define _K3_QOS_H_ + +#include + +struct k3_qos_data { + u32 reg; + u32 val; +}; + +#if (IS_ENABLED(CONFIG_K3_QOS)) +extern struct k3_qos_data qos_data[]; +extern u32 qos_count; +#endif + +#endif /* _K3_QOS_H_ */ diff --git a/arch/arm/mach-k3/r5/Kconfig b/arch/arm/mach-k3/r5/Kconfig index ae79f8ff6cde..940a6dc4f4d0 100644 --- a/arch/arm/mach-k3/r5/Kconfig +++