interconnect: intel: Add Keem Bay noc driver
PATCH v8 1/1 interconnect: intel: Add Keem Bay noc driver
From: Pandith N <[email protected]>
Add support for Network on Chip(NOC) counters. Enable features to configure and capture NOC probe counters, needed for DDR bandwidth measurement. NOC driver is specific to Intel Keem Bay SOC. NOC hardware counters are used for DDR statistics profiling, it is not related to timers. Interface details are provided in include/uapi/linux/noc_uapi.h
---
Changes in V2 :
NOC is class driver, platform driver not needed. Removed LINUX syscall note from noc_driver.c. Order variable from longest to shortest.
Using variable in sizeof parameter, rather than data type. Consistent project naming as Keem Bay
Changes in V3 :
Free noc device in failure case and module exit.
Remove platform device references.
Changes in V4 :
Rephrased commit description, added missing punctuation in Kconfig.
Changes in V5 :
Local variables are always initialized before use in all cases of capture function No need of counter 3 definition in enumeration
Changes in V6 :
Renaming noc driver as keembay-bwmon, moved to interconnect/intel. Added more description about DSS, NOC
Changes in V7 :
Removed unwanted parenthesis
Changes in V8 :
Corrected merge conflicts in MAINTAINERS
--- MAINTAINERS | 6 + drivers/interconnect/Kconfig | 1 + drivers/interconnect/Makefile | 1 + drivers/interconnect/intel/Kconfig | 19 ++ drivers/interconnect/intel/Makefile | 5 + drivers/interconnect/intel/keembay-bwmon.c | 310 +++++++++++++++++++++ drivers/interconnect/intel/keembay-bwmon.h | 110 ++++++++ include/uapi/linux/noc_uapi.h | 42 +++ 8 files changed, 494 insertions(+) create mode 100644 drivers/interconnect/intel/Kconfig create mode 100644 drivers/interconnect/intel/Makefile create mode 100644 drivers/interconnect/intel/keembay-bwmon.c create mode 100644 drivers/interconnect/intel/keembay-bwmon.h create mode 100644 include/uapi/linux/noc_uapi.h
MAINTAINERS +6 -0
@@ -9485,6 +9485,12 @@ L: [email protected] S: Supported F: arch/x86/include/asm/intel-family.h +INTEL KEEM BAY DDR SUBSYSTEM, NETWORK ON CHIP INTERCONNECT DRIVER +M: Pandith N <[email protected]> +S: Supported +F: drivers/interconnect/intel/ +F: include/uapi/linux/noc_uapi.h + INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) M: Jani Nikula <[email protected]> M: Joonas Lahtinen <[email protected]>
drivers/interconnect/Kconfig +1 -0
@@ -12,6 +12,7 @@ menuconfig INTERCONNECT if INTERCONNECT source "drivers/interconnect/imx/Kconfig" +source "drivers/interconnect/intel/Kconfig" source "drivers/interconnect/qcom/Kconfig" source "drivers/interconnect/samsung/Kconfig"
drivers/interconnect/Makefile +1 -0
@@ -5,5 +5,6 @@ icc-core-objs := core.o bulk.o obj-$(CONFIG_INTERCONNECT) += icc-core.o obj-$(CONFIG_INTERCONNECT_IMX) += imx/ +obj-$(CONFIG_INTERCONNECT_INTEL) += intel/ obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/ obj-$(CONFIG_INTERCONNECT_SAMSUNG) += samsung/
drivers/interconnect/intel/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ +# Copyright (C) 2019 Intel Corporation +# SPDX-License-Identifier: GPL-2.0-only +config INTERCONNECT_INTEL + bool "Intel Network-on-chip interconnect drivers" + help + Support for Intel's Network on chip interconnect hardware. + +config INTERCONNECT_INTEL_KEEMBAY + tristate "Intel Keem Bay Enable DDR profiling using NOC" + depends on INTERCONNECT_INTEL || ARCH_KEEMBAY || COMPILE_TEST + help + Enable this option for DDR bandwidth measurements using NOC. + + Add support for Network-on-chip (NOC) in DDR Subsystem(DSS). + DSS NOC has capabilities to enable and get statistics profiling. + NOC driver enables features to configure and capture NOC probe + counters, needed for DSS bandwidth measurement. + Say Y if using a processor that includes the Intel VPU such as + Keem Bay. If unsure, say N.
drivers/interconnect/intel/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# Copyright (C) 2019 Intel Corporation +# SPDX-License-Identifier: GPL-2.0-only +# Makefile for Keem Bay NOC +# +obj-$(CONFIG_INTERCONNECT_INTEL_KEEMBAY) += keembay-bwmon.o
drivers/interconnect/intel/keembay-bwmon.c new file +310 -0
310 lines not on this page · raw message
drivers/interconnect/intel/keembay-bwmon.h new file +110 -0
110 lines not on this page · raw message
include/uapi/linux/noc_uapi.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc3 next-20211129]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/pandith-n-intel-com/interconnect-intel-Add-Keem-Bay-noc-driver/20211129-235117 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d58071a8a76d779eedab38033ae4c821c30295a5 config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20211130/202111300127.TJsMMckG-lkp(a)intel.com/config) compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/724e8829a62d4ae6908d011f927e0c3ae5b0a80c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review pandith-n-intel-com/interconnect-intel-Add-Keem-Bay-noc-driver/20211129-235117 git checkout 724e8829a62d4ae6908d011f927e0c3ae5b0a80c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/interconnect/intel/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/interconnect/intel/keembay-bwmon.c:142: warning: expecting prototype for flexnoc_counterp_capture(). Prototype was for flexnoc_counter_capture() instead
vim +142 drivers/interconnect/intel/keembay-bwmon.c
122
123 /**
124 * flexnoc_counterp_capture() - Capture the counter statistic values
125 * @noc: NOC type to setup counters
126 * @counter: Counter number to capture statistics values for n and n+1
127 * @value: statistics values read are returned in this address passed
128 *
129 * This function will return the statistics value of started counters.
130 * When this function returns NOC_PROBE_COMPLETED, it is guaranteed that NOC
131 * counters are idle and finished probing.
132 * Algo : The values should not returned when counters are active/running.
133 * Once the counter is frozen, the values are good to read. There is an
134 * iteration logic implemented to check this. An maximum timeout config
135 * is provided to for capture timeout - NOC_CAPTURE_TIMEOUT_MSEC
136 *
137 * Returns NOC_PROBE_COMPLETED if the counters are stopped or
138 * NOC_PROBE_ERR_IN_PROGRESS if counters are still running
139 */
140 enum noc_status flexnoc_counter_capture(enum noc_ss_type noc,
141 enum noc_counter counter, u32 *value)
> 142 { 143 unsigned long timeout;
144 u32 c0_0, c0_1;
145
146 if (noc >= NOC_TYPE_MAX ||
147 counter >= NOC_COUNTER_MAX ||
148 !value)
149 return NOC_PROBE_ERR_INVALID_ARGS;
150
151 timeout = jiffies + msecs_to_jiffies(NOC_CAPTURE_TIMEOUT_MSEC);
152 do {
153 c0_0 = noc_readl((c_offset[counter] + C_VAL));
154 usleep_range(10000, 11000);
155 c0_1 = noc_readl((c_offset[counter] + C_VAL));
156 /* If mainctrl is zero , return error */
157 if (noc_readl(MAINCTL) == 0)
158 return NOC_PROBE_ERR_IN_PROGRESS;
159 /* If counters are zero, keep reading */
160 if (0 == c0_0 && 0 == c0_1) {
161 break;
162 } else if (c0_0 != c0_1) {
163 continue;
164 } else {
165 /* counters look good break the while */
166 break;
167 }
168 } while (time_before(jiffies, timeout));
169
170 if (c0_0 != c0_1)
171 return NOC_PROBE_ERR_IN_PROGRESS;
172
173 c0_0 = noc_readl((c_offset[counter] + C_VAL));
174 c0_1 = noc_readl((c_offset[counter + 1] + C_VAL));
175 *value = (c0_0 | (c0_1 << 16));
176
177 return NOC_PROBE_COMPLETED;
178 }
179
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc3 next-20211130]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/pandith-n-intel-com/interconnect-intel-Add-Keem-Bay-noc-driver/20211129-235117 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d58071a8a76d779eedab38033ae4c821c30295a5 config: i386-randconfig-c001-20211130 (https://download.01.org/0day-ci/archive/20211201/202112010223.Pb0XZMHN-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 25eb7fa01d7ebbe67648ea03841cda55b4239ab2)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/724e8829a62d4ae6908d011f927e0c3ae5b0a80c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review pandith-n-intel-com/interconnect-intel-Add-Keem-Bay-noc-driver/20211129-235117 git checkout 724e8829a62d4ae6908d011f927e0c3ae5b0a80c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/interconnect/intel/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/interconnect/intel/keembay-bwmon.c:142: warning: expecting prototype for flexnoc_counterp_capture(). Prototype was for flexnoc_counter_capture() instead
vim +142 drivers/interconnect/intel/keembay-bwmon.c
122
123 /**
124 * flexnoc_counterp_capture() - Capture the counter statistic values
125 * @noc: NOC type to setup counters
126 * @counter: Counter number to capture statistics values for n and n+1
127 * @value: statistics values read are returned in this address passed
128 *
129 * This function will return the statistics value of started counters.
130 * When this function returns NOC_PROBE_COMPLETED, it is guaranteed that NOC
131 * counters are idle and finished probing.
132 * Algo : The values should not returned when counters are active/running.
133 * Once the counter is frozen, the values are good to read. There is an
134 * iteration logic implemented to check this. An maximum timeout config
135 * is provided to for capture timeout - NOC_CAPTURE_TIMEOUT_MSEC
136 *
137 * Returns NOC_PROBE_COMPLETED if the counters are stopped or
138 * NOC_PROBE_ERR_IN_PROGRESS if counters are still running
139 */
140 enum noc_status flexnoc_counter_capture(enum noc_ss_type noc,
141 enum noc_counter counter, u32 *value)
> 142 { 143 unsigned long timeout;
144 u32 c0_0, c0_1;
145
146 if (noc >= NOC_TYPE_MAX ||
147 counter >= NOC_COUNTER_MAX ||
148 !value)
149 return NOC_PROBE_ERR_INVALID_ARGS;
150
151 timeout = jiffies + msecs_to_jiffies(NOC_CAPTURE_TIMEOUT_MSEC);
152 do {
153 c0_0 = noc_readl((c_offset[counter] + C_VAL));
154 usleep_range(10000, 11000);
155 c0_1 = noc_readl((c_offset[counter] + C_VAL));
156 /* If mainctrl is zero , return error */
157 if (noc_readl(MAINCTL) == 0)
158 return NOC_PROBE_ERR_IN_PROGRESS;
159 /* If counters are zero, keep reading */
160 if (0 == c0_0 && 0 == c0_1) {
161 break;
162 } else if (c0_0 != c0_1) {
163 continue;
164 } else {
165 /* counters look good break the while */
166 break;
167 }
168 } while (time_before(jiffies, timeout));
169
170 if (c0_0 != c0_1)
171 return NOC_PROBE_ERR_IN_PROGRESS;
172
173 c0_0 = noc_readl((c_offset[counter] + C_VAL));
174 c0_1 = noc_readl((c_offset[counter + 1] + C_VAL));
175 *value = (c0_0 | (c0_1 << 16));
176
177 return NOC_PROBE_COMPLETED;
178 }
179
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]