Re: [PATCH 0/3] tracing: Fix some selftest issues

2024-06-09 Thread Google
On Fri, 31 May 2024 03:24:25 -0400
Steven Rostedt  wrote:

> On Fri, 31 May 2024 11:37:21 +0900
> Masami Hiramatsu (Google)  wrote:
> 
> > So, in summary, it is designed to be a module. Steve, I think these tests
> > should be kept as modules. There are many reason to do so.
> > 
> >  - This test is designed to be used as module.
> >  - This can conflict with other boot time selftest if it is embedded.
> >  - We can make these tests and boot time selftest mutable exclusive but
> >if we make these tests as modules, we can build and run both tests
> >safely.
> >  - Embedding these tests leave new events when the kernel boot, which
> >user must be cleaned up by manual.
> > 
> > What would you think?
> 
> I was mostly following what Ingo told me long ago, where having it
> built in is just one more way to test it ;-)
> 
> But that said, from your first patch, you show the stack dump and
> mention:
> 
> > Since the kprobes and synth event generation tests adds and enable
> > generated events in init_module() and delete it in exit_module(),
> > if we make it as built-in, those events are left in kernel and cause
> > kprobe event self-test failure.
> 
> But you don't explain what exactly the conflict is. What about those
> events causes kprobe selftests to fail?

I also found another problem on these modules. These modules get trace
event file references to prevent removing probes. Therefore, if we
embed these modules, we can not remove these events forever!

/*
 * Now get the gen_kprobe_test event file.  We need to prevent
 * the instance and event from disappearing from underneath
 * us, which trace_get_event_file() does (though in this case
 * we're using the top-level instance which never goes away).
 */
gen_kprobe_test = trace_get_event_file(NULL, "kprobes",
   "gen_kprobe_test");
if (IS_ERR(gen_kprobe_test)) {
ret = PTR_ERR(gen_kprobe_test);
goto delete;
}

This means most ftracetest fails because we can not clean up the
tracing state by removing dynamic events, which are installed while
booting.
Note that these references (locks) will be removed when the module
is unloaded.

Thanks,

> 
> 
> -- Steve


-- 
Masami Hiramatsu (Google) 



[PATCH 7/7] dt-bindings: interconnect: qcom: msm8939: Fix example

2024-06-09 Thread Adam Skladowski
For now example list snoc_mm as children of bimc which is obviously
not valid, change example and include rest of nocs in it.

Fixes: 462baaf4c628 ("dt-bindings: interconnect: qcom: Fix and separate out 
MSM8939")
Signed-off-by: Adam Skladowski 
---
 .../bindings/interconnect/qcom,msm8939.yaml   | 22 ---
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/interconnect/qcom,msm8939.yaml 
b/Documentation/devicetree/bindings/interconnect/qcom,msm8939.yaml
index fd15ab5014fb..a77e6aa2fbee 100644
--- a/Documentation/devicetree/bindings/interconnect/qcom,msm8939.yaml
+++ b/Documentation/devicetree/bindings/interconnect/qcom,msm8939.yaml
@@ -56,19 +56,25 @@ examples:
   - |
 #include 
 
-snoc: interconnect@58 {
-compatible = "qcom,msm8939-snoc";
-reg = <0x0058 0x14000>;
-#interconnect-cells = <1>;
-};
-
 bimc: interconnect@40 {
 compatible = "qcom,msm8939-bimc";
 reg = <0x0040 0x62000>;
-#interconnect-cells = <1>;
+#interconnect-cells = <2>;
+};
+
+pcnoc: interconnect@50 {
+compatible = "qcom,msm8939-pcnoc";
+reg = <0x0050 0x11000>;
+#interconnect-cells = <2>;
+};
+
+snoc: interconnect@58 {
+compatible = "qcom,msm8939-snoc";
+reg = <0x0058 0x14080>;
+#interconnect-cells = <2>;
 
   snoc_mm: interconnect-snoc {
   compatible = "qcom,msm8939-snoc-mm";
-  #interconnect-cells = <1>;
+  #interconnect-cells = <2>;
   };
 };
-- 
2.45.1




[PATCH 6/7] interconnect: qcom: qcs404: Add regmaps and more bus descriptions

2024-06-09 Thread Adam Skladowski
Currently we are lacking descriptions of regmaps and buses,
provide them.

Signed-off-by: Adam Skladowski 
---
 drivers/interconnect/qcom/qcs404.c | 41 +++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/interconnect/qcom/qcs404.c 
b/drivers/interconnect/qcom/qcs404.c
index 91b2ccc56a33..f9b508a56588 100644
--- a/drivers/interconnect/qcom/qcs404.c
+++ b/drivers/interconnect/qcom/qcs404.c
@@ -1067,10 +1067,22 @@ static struct qcom_icc_node * const qcs404_bimc_nodes[] 
= {
[SLAVE_BIMC_SNOC] = _bimc_snoc,
 };
 
+static const struct regmap_config qcs404_bimc_regmap_config = {
+   .reg_bits = 32,
+   .reg_stride = 4,
+   .val_bits = 32,
+   .max_register = 0x8,
+   .fast_io = true,
+};
+
 static const struct qcom_icc_desc qcs404_bimc = {
-   .bus_clk_desc = _clk,
+   .type = QCOM_ICC_BIMC,
.nodes = qcs404_bimc_nodes,
.num_nodes = ARRAY_SIZE(qcs404_bimc_nodes),
+   .bus_clk_desc = _clk,
+   .regmap_cfg = _bimc_regmap_config,
+   .qos_offset = 0x8000,
+   .ab_coeff = 153,
 };
 
 static struct qcom_icc_node * const qcs404_pcnoc_nodes[] = {
@@ -1122,10 +1134,22 @@ static struct qcom_icc_node * const 
qcs404_pcnoc_nodes[] = {
[SLAVE_PCNOC_SNOC] = _pcnoc_snoc,
 };
 
+static const struct regmap_config qcs404_pcnoc_regmap_config = {
+   .reg_bits = 32,
+   .reg_stride = 4,
+   .val_bits = 32,
+   .max_register = 0x15080,
+   .fast_io = true,
+};
+
 static const struct qcom_icc_desc qcs404_pcnoc = {
-   .bus_clk_desc = _0_clk,
+   .type = QCOM_ICC_NOC,
.nodes = qcs404_pcnoc_nodes,
.num_nodes = ARRAY_SIZE(qcs404_pcnoc_nodes),
+   .bus_clk_desc = _0_clk,
+   .qos_offset = 0x7000,
+   .keep_alive = true,
+   .regmap_cfg = _pcnoc_regmap_config,
 };
 
 static struct qcom_icc_node * const qcs404_snoc_nodes[] = {
@@ -1151,10 +1175,21 @@ static struct qcom_icc_node * const qcs404_snoc_nodes[] 
= {
[SLAVE_LPASS] = _lpass,
 };
 
+static const struct regmap_config qcs404_snoc_regmap_config = {
+   .reg_bits = 32,
+   .reg_stride = 4,
+   .val_bits = 32,
+   .max_register = 0x23080,
+   .fast_io = true,
+};
+
 static const struct qcom_icc_desc qcs404_snoc = {
-   .bus_clk_desc = _1_clk,
+   .type = QCOM_ICC_NOC,
.nodes = qcs404_snoc_nodes,
.num_nodes = ARRAY_SIZE(qcs404_snoc_nodes),
+   .bus_clk_desc = _1_clk,
+   .qos_offset = 0x11000,
+   .regmap_cfg = _snoc_regmap_config,
 };
 
 
-- 
2.45.1




[PATCH 5/7] interconnect: qcom: qcs404: Introduce AP-owned nodes

2024-06-09 Thread Adam Skladowski
When driver was first sent it seems ap_owned nodes were not available,
bring them now.

Signed-off-by: Adam Skladowski 
---
 drivers/interconnect/qcom/qcs404.c | 85 ++
 1 file changed, 85 insertions(+)

diff --git a/drivers/interconnect/qcom/qcs404.c 
b/drivers/interconnect/qcom/qcs404.c
index 11b49a89c03d..91b2ccc56a33 100644
--- a/drivers/interconnect/qcom/qcs404.c
+++ b/drivers/interconnect/qcom/qcs404.c
@@ -101,6 +101,11 @@ static struct qcom_icc_node mas_apps_proc = {
.buswidth = 8,
.mas_rpm_id = 0,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 0,
+   .qos.prio_level = 0,
+   .qos.qos_port = 0,
.num_links = ARRAY_SIZE(mas_apps_proc_links),
.links = mas_apps_proc_links,
 };
@@ -116,6 +121,11 @@ static struct qcom_icc_node mas_oxili = {
.buswidth = 8,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 0,
+   .qos.prio_level = 0,
+   .qos.qos_port = 2,
.num_links = ARRAY_SIZE(mas_oxili_links),
.links = mas_oxili_links,
 };
@@ -131,6 +141,11 @@ static struct qcom_icc_node mas_mdp = {
.buswidth = 8,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 0,
+   .qos.prio_level = 1,
+   .qos.qos_port = 4,
.num_links = ARRAY_SIZE(mas_mdp_links),
.links = mas_mdp_links,
 };
@@ -145,6 +160,10 @@ static struct qcom_icc_node mas_snoc_bimc_1 = {
.buswidth = 8,
.mas_rpm_id = 76,
.slv_rpm_id = -1,
+   .qos.qos_mode = NOC_QOS_MODE_BYPASS,
+   .qos.areq_prio = 0,
+   .qos.prio_level = 0,
+   .qos.qos_port = 5,
.num_links = ARRAY_SIZE(mas_snoc_bimc_1_links),
.links = mas_snoc_bimc_1_links,
 };
@@ -160,6 +179,11 @@ static struct qcom_icc_node mas_tcu_0 = {
.buswidth = 8,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 0,
+   .qos.prio_level = 2,
+   .qos.qos_port = 6,
.num_links = ARRAY_SIZE(mas_tcu_0_links),
.links = mas_tcu_0_links,
 };
@@ -174,6 +198,8 @@ static struct qcom_icc_node mas_spdm = {
.buswidth = 4,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_INVALID,
.num_links = ARRAY_SIZE(mas_spdm_links),
.links = mas_spdm_links,
 };
@@ -231,6 +257,11 @@ static struct qcom_icc_node mas_crypto = {
.buswidth = 8,
.mas_rpm_id = 23,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 1,
+   .qos.prio_level = 1,
+   .qos.qos_port = 0,
.num_links = ARRAY_SIZE(mas_crypto_links),
.links = mas_crypto_links,
 };
@@ -287,6 +318,11 @@ static struct qcom_icc_node mas_qpic = {
.buswidth = 4,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 1,
+   .qos.prio_level = 1,
+   .qos.qos_port = 14,
.num_links = ARRAY_SIZE(mas_qpic_links),
.links = mas_qpic_links,
 };
@@ -301,6 +337,11 @@ static struct qcom_icc_node mas_qdss_bam = {
.buswidth = 4,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 1,
+   .qos.prio_level = 1,
+   .qos.qos_port = 1,
.num_links = ARRAY_SIZE(mas_qdss_bam_links),
.links = mas_qdss_bam_links,
 };
@@ -348,6 +389,11 @@ static struct qcom_icc_node mas_qdss_etr = {
.buswidth = 8,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 1,
+   .qos.prio_level = 1,
+   .qos.qos_port = 0,
.num_links = ARRAY_SIZE(mas_qdss_etr_links),
.links = mas_qdss_etr_links,
 };
@@ -363,6 +409,11 @@ static struct qcom_icc_node mas_emac = {
.buswidth = 8,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 1,
+   .qos.prio_level = 1,
+   .qos.qos_port = 17,
.num_links = ARRAY_SIZE(mas_emac_links),
.links = mas_emac_links,
 };
@@ -378,6 +429,11 @@ static struct qcom_icc_node mas_pcie = {
.buswidth = 8,
.mas_rpm_id = -1,
.slv_rpm_id = -1,
+   .qos.ap_owned = true,
+   .qos.qos_mode = NOC_QOS_MODE_FIXED,
+   .qos.areq_prio = 1,
+   .qos.prio_level = 1,
+   .qos.qos_port = 8,
.num_links = ARRAY_SIZE(mas_pcie_links),
.links = mas_pcie_links,
 };
@@ -393,6 +449,11 @@ static 

[PATCH 4/7] interconnect: qcom: Add MSM8937 interconnect provider driver

2024-06-09 Thread Adam Skladowski
Add driver for interconnect busses found in MSM8937 based platforms.
The topology consists of four NoCs that are partially controlled
by a RPM processor.

Signed-off-by: Adam Skladowski 
---
 drivers/interconnect/qcom/Kconfig   |9 +
 drivers/interconnect/qcom/Makefile  |2 +
 drivers/interconnect/qcom/msm8937.c | 1374 +++
 3 files changed, 1385 insertions(+)
 create mode 100644 drivers/interconnect/qcom/msm8937.c

diff --git a/drivers/interconnect/qcom/Kconfig 
b/drivers/interconnect/qcom/Kconfig
index a0e9c09954ed..c3c534e7dad6 100644
--- a/drivers/interconnect/qcom/Kconfig
+++ b/drivers/interconnect/qcom/Kconfig
@@ -26,6 +26,15 @@ config INTERCONNECT_QCOM_MSM8916
  This is a driver for the Qualcomm Network-on-Chip on msm8916-based
  platforms.
 
+config INTERCONNECT_QCOM_MSM8937
+   tristate "Qualcomm MSM8937 interconnect driver"
+   depends on INTERCONNECT_QCOM
+   depends on QCOM_SMD_RPM
+   select INTERCONNECT_QCOM_SMD_RPM
+   help
+ This is a driver for the Qualcomm Network-on-Chip on msm8937-based
+ platforms.
+
 config INTERCONNECT_QCOM_MSM8939
tristate "Qualcomm MSM8939 interconnect driver"
depends on INTERCONNECT_QCOM
diff --git a/drivers/interconnect/qcom/Makefile 
b/drivers/interconnect/qcom/Makefile
index 21ce45438258..a27dcb474df5 100644
--- a/drivers/interconnect/qcom/Makefile
+++ b/drivers/interconnect/qcom/Makefile
@@ -6,6 +6,7 @@ interconnect_qcom-y := icc-common.o
 icc-bcm-voter-objs := bcm-voter.o
 qnoc-msm8909-objs  := msm8909.o
 qnoc-msm8916-objs  := msm8916.o
+qnoc-msm8937-objs  := msm8937.o
 qnoc-msm8939-objs  := msm8939.o
 qnoc-msm8974-objs  := msm8974.o
 qnoc-msm8976-objs  := msm8976.o
@@ -41,6 +42,7 @@ icc-smd-rpm-objs  := smd-rpm.o icc-rpm.o 
icc-rpm-clocks.o
 obj-$(CONFIG_INTERCONNECT_QCOM_BCM_VOTER) += icc-bcm-voter.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8909) += qnoc-msm8909.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8916) += qnoc-msm8916.o
+obj-$(CONFIG_INTERCONNECT_QCOM_MSM8937) += qnoc-msm8937.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8939) += qnoc-msm8939.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8974) += qnoc-msm8974.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8976) += qnoc-msm8976.o
diff --git a/drivers/interconnect/qcom/msm8937.c 
b/drivers/interconnect/qcom/msm8937.c
new file mode 100644
index ..470175c1c38b
--- /dev/null
+++ b/drivers/interconnect/qcom/msm8937.c
@@ -0,0 +1,1374 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Based on data from msm8937-bus.dtsi in Qualcomm's msm-3.18 release:
+ *   Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#include 
+
+#include "icc-rpm.h"
+
+enum {
+   QNOC_MASTER_AMPSS_M0 = 1,
+   QNOC_MASTER_GRAPHICS_3D,
+   QNOC_SNOC_BIMC_0_MAS,
+   QNOC_SNOC_BIMC_2_MAS,
+   QNOC_SNOC_BIMC_1_MAS,
+   QNOC_MASTER_TCU_0,
+   QNOC_MASTER_SPDM,
+   QNOC_MASTER_BLSP_1,
+   QNOC_MASTER_BLSP_2,
+   QNOC_MASTER_USB_HS,
+   QNOC_MASTER_XM_USB_HS1,
+   QNOC_MASTER_CRYPTO_CORE0,
+   QNOC_MASTER_SDCC_1,
+   QNOC_MASTER_SDCC_2,
+   QNOC_SNOC_PNOC_MAS,
+   QNOC_MASTER_QDSS_BAM,
+   QNOC_BIMC_SNOC_MAS,
+   QNOC_MASTER_JPEG,
+   QNOC_MASTER_MDP_PORT0,
+   QNOC_PNOC_SNOC_MAS,
+   QNOC_MASTER_VIDEO_P0,
+   QNOC_MASTER_VFE,
+   QNOC_MASTER_VFE1,
+   QNOC_MASTER_CPP,
+   QNOC_MASTER_QDSS_ETR,
+   QNOC_PNOC_M_0,
+   QNOC_PNOC_M_1,
+   QNOC_PNOC_INT_0,
+   QNOC_PNOC_INT_1,
+   QNOC_PNOC_INT_2,
+   QNOC_PNOC_INT_3,
+   QNOC_PNOC_SLV_0,
+   QNOC_PNOC_SLV_1,
+   QNOC_PNOC_SLV_2,
+   QNOC_PNOC_SLV_3,
+   QNOC_PNOC_SLV_4,
+   QNOC_PNOC_SLV_6,
+   QNOC_PNOC_SLV_7,
+   QNOC_PNOC_SLV_8,
+   QNOC_SNOC_QDSS_INT,
+   QNOC_SNOC_INT_0,
+   QNOC_SNOC_INT_1,
+   QNOC_SNOC_INT_2,
+   QNOC_SLAVE_EBI_CH0,
+   QNOC_BIMC_SNOC_SLV,
+   QNOC_SLAVE_SDCC_2,
+   QNOC_SLAVE_SPDM_WRAPPER,
+   QNOC_SLAVE_PDM,
+   QNOC_SLAVE_PRNG,
+   QNOC_SLAVE_TCSR,
+   QNOC_SLAVE_SNOC_CFG,
+   QNOC_SLAVE_MESSAGE_RAM,
+   QNOC_SLAVE_CAMERA_CFG,
+   QNOC_SLAVE_DISPLAY_CFG,
+   QNOC_SLAVE_VENUS_CFG,
+   QNOC_SLAVE_GRAPHICS_3D_CFG,
+   QNOC_SLAVE_TLMM,
+   QNOC_SLAVE_BLSP_1,
+   QNOC_SLAVE_BLSP_2,
+   QNOC_SLAVE_PMIC_ARB,
+   QNOC_SLAVE_SDCC_1,
+   QNOC_SLAVE_CRYPTO_0_CFG,
+   QNOC_SLAVE_USB_HS,
+   QNOC_SLAVE_TCU,
+   QNOC_PNOC_SNOC_SLV,
+   QNOC_SLAVE_APPSS,
+   QNOC_SLAVE_WCSS,
+   QNOC_SNOC_BIMC_0_SLV,
+   QNOC_SNOC_BIMC_1_SLV,
+   QNOC_SNOC_BIMC_2_SLV,
+   QNOC_SLAVE_OCIMEM,
+   QNOC_SNOC_PNOC_SLV,
+   QNOC_SLAVE_QDSS_STM,
+   QNOC_SLAVE_CATS_128,
+ 

[PATCH 3/7] dt-bindings: interconnect: Add Qualcomm MSM8937 DT bindings

2024-06-09 Thread Adam Skladowski
Add bindings for Qualcomm MSM8937 Network-On-Chip interconnect devices.

Signed-off-by: Adam Skladowski 
---
 .../bindings/interconnect/qcom,msm8937.yaml   | 81 
 .../dt-bindings/interconnect/qcom,msm8937.h   | 93 +++
 2 files changed, 174 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/interconnect/qcom,msm8937.yaml
 create mode 100644 include/dt-bindings/interconnect/qcom,msm8937.h

diff --git a/Documentation/devicetree/bindings/interconnect/qcom,msm8937.yaml 
b/Documentation/devicetree/bindings/interconnect/qcom,msm8937.yaml
new file mode 100644
index ..39a1ca441bb2
--- /dev/null
+++ b/Documentation/devicetree/bindings/interconnect/qcom,msm8937.yaml
@@ -0,0 +1,81 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interconnect/qcom,msm8937.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm MSM8937 Network-On-Chip interconnect
+
+maintainers:
+  - Konrad Dybcio 
+
+description: |
+  The Qualcomm MSM8937 interconnect providers support adjusting the
+  bandwidth requirements between the various NoC fabrics.
+
+allOf:
+  - $ref: qcom,rpm-common.yaml#
+
+properties:
+  compatible:
+enum:
+  - qcom,msm8937-bimc
+  - qcom,msm8937-pcnoc
+  - qcom,msm8937-snoc
+
+  reg:
+maxItems: 1
+
+patternProperties:
+  '^interconnect-[a-z0-9\-]+$':
+type: object
+$ref: qcom,rpm-common.yaml#
+description:
+  The interconnect providers do not have a separate QoS register space,
+  but share parent's space.
+
+allOf:
+  - $ref: qcom,rpm-common.yaml#
+
+properties:
+  compatible:
+const: qcom,msm8937-snoc-mm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+
+bimc: interconnect@40 {
+compatible = "qcom,msm8937-bimc";
+reg = <0x0040 0x5a000>;
+#interconnect-cells = <2>;
+};
+
+pcnoc: interconnect@50 {
+compatible = "qcom,msm8937-pcnoc";
+reg = <0x0050 0x13080>;
+#interconnect-cells = <2>;
+};
+
+snoc: interconnect@58 {
+compatible = "qcom,msm8937-bimc";
+reg = <0x0058 0x16080>;
+#interconnect-cells = <2>;
+
+  snoc_mm: interconnect-snoc {
+  compatible = "qcom,msm8937-snoc-mm";
+  #interconnect-cells = <2>;
+  };
+};
diff --git a/include/dt-bindings/interconnect/qcom,msm8937.h 
b/include/dt-bindings/interconnect/qcom,msm8937.h
new file mode 100644
index ..98b8a4637aab
--- /dev/null
+++ b/include/dt-bindings/interconnect/qcom,msm8937.h
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Qualcomm MSM8937 interconnect IDs
+ */
+
+#ifndef __DT_BINDINGS_INTERCONNECT_QCOM_MSM8937_H
+#define __DT_BINDINGS_INTERCONNECT_QCOM_MSM8937_H
+
+/* BIMC fabric */
+#define MAS_APPS_PROC  0
+#define MAS_OXILI  1
+#define MAS_SNOC_BIMC_02
+#define MAS_SNOC_BIMC_23
+#define MAS_SNOC_BIMC_14
+#define MAS_TCU_0  5
+#define SLV_EBI6
+#define SLV_BIMC_SNOC  7
+
+/* PCNOC fabric */
+#define MAS_SPDM   0
+#define MAS_BLSP_1 1
+#define MAS_BLSP_2 2
+#define MAS_USB_HS13
+#define MAS_XI_USB_HS1 4
+#define MAS_CRYPTO 5
+#define MAS_SDCC_1 6
+#define MAS_SDCC_2 7
+#define MAS_SNOC_PCNOC 8
+#define PCNOC_M_0  9
+#define PCNOC_M_1  10
+#define PCNOC_INT_011
+#define PCNOC_INT_112
+#define PCNOC_INT_213
+#define PCNOC_INT_314
+#define PCNOC_S_0  15
+#define PCNOC_S_1  16
+#define PCNOC_S_2  17
+#define PCNOC_S_3  18
+#define PCNOC_S_4  19
+#define PCNOC_S_6  20
+#define PCNOC_S_7  21
+#define PCNOC_S_8  22
+#define SLV_SDCC_2 23
+#define SLV_SPDM   24
+#define SLV_PDM25
+#define SLV_PRNG   26
+#define SLV_TCSR   27
+#define SLV_SNOC_CFG   28
+#define SLV_MESSAGE_RAM29
+#define SLV_CAMERA_SS_CFG  30
+#define SLV_DISP_SS_CFG31
+#define SLV_VENUS_CFG  32
+#define SLV_GPU_CFG33
+#define SLV_TLMM   34
+#define SLV_BLSP_1 35
+#define SLV_BLSP_2 36
+#define SLV_PMIC_ARB   37
+#define SLV_SDCC_1 38
+#define SLV_CRYPTO_0_CFG   39
+#define SLV_USB_HS 40
+#define SLV_TCU41
+#define SLV_PCNOC_SNOC 42
+
+/* SNOC fabric */
+#define MAS_QDSS_BAM   0
+#define MAS_BIMC_SNOC  1
+#define 

[PATCH 2/7] interconnect: qcom: Add MSM8976 interconnect provider driver

2024-06-09 Thread Adam Skladowski
Add driver for interconnect busses found in MSM8976 based platforms.
The topology consists of four NoCs that are partially controlled
by a RPM processor.

Signed-off-by: Adam Skladowski 
---
 drivers/interconnect/qcom/Kconfig   |9 +
 drivers/interconnect/qcom/Makefile  |2 +
 drivers/interconnect/qcom/msm8976.c | 1443 +++
 3 files changed, 1454 insertions(+)
 create mode 100644 drivers/interconnect/qcom/msm8976.c

diff --git a/drivers/interconnect/qcom/Kconfig 
b/drivers/interconnect/qcom/Kconfig
index 1446a839184e..a0e9c09954ed 100644
--- a/drivers/interconnect/qcom/Kconfig
+++ b/drivers/interconnect/qcom/Kconfig
@@ -44,6 +44,15 @@ config INTERCONNECT_QCOM_MSM8974
 This is a driver for the Qualcomm Network-on-Chip on msm8974-based
 platforms.
 
+config INTERCONNECT_QCOM_MSM8976
+   tristate "Qualcomm MSM8976 interconnect driver"
+   depends on INTERCONNECT_QCOM
+   depends on QCOM_SMD_RPM
+   select INTERCONNECT_QCOM_SMD_RPM
+   help
+This is a driver for the Qualcomm Network-on-Chip on msm8976-based
+platforms.
+
 config INTERCONNECT_QCOM_MSM8996
tristate "Qualcomm MSM8996 interconnect driver"
depends on INTERCONNECT_QCOM
diff --git a/drivers/interconnect/qcom/Makefile 
b/drivers/interconnect/qcom/Makefile
index 2ea3113d0a4d..21ce45438258 100644
--- a/drivers/interconnect/qcom/Makefile
+++ b/drivers/interconnect/qcom/Makefile
@@ -8,6 +8,7 @@ qnoc-msm8909-objs   := msm8909.o
 qnoc-msm8916-objs  := msm8916.o
 qnoc-msm8939-objs  := msm8939.o
 qnoc-msm8974-objs  := msm8974.o
+qnoc-msm8976-objs  := msm8976.o
 qnoc-msm8996-objs  := msm8996.o
 icc-osm-l3-objs:= osm-l3.o
 qnoc-qcm2290-objs  := qcm2290.o
@@ -42,6 +43,7 @@ obj-$(CONFIG_INTERCONNECT_QCOM_MSM8909) += qnoc-msm8909.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8916) += qnoc-msm8916.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8939) += qnoc-msm8939.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8974) += qnoc-msm8974.o
+obj-$(CONFIG_INTERCONNECT_QCOM_MSM8976) += qnoc-msm8976.o
 obj-$(CONFIG_INTERCONNECT_QCOM_MSM8996) += qnoc-msm8996.o
 obj-$(CONFIG_INTERCONNECT_QCOM_OSM_L3) += icc-osm-l3.o
 obj-$(CONFIG_INTERCONNECT_QCOM_QCM2290) += qnoc-qcm2290.o
diff --git a/drivers/interconnect/qcom/msm8976.c 
b/drivers/interconnect/qcom/msm8976.c
new file mode 100644
index ..b6cefdf0fecb
--- /dev/null
+++ b/drivers/interconnect/qcom/msm8976.c
@@ -0,0 +1,1443 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Based on data from msm8976-bus.dtsi in Qualcomm's msm-3.10 release:
+ *   Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#include 
+
+#include "icc-rpm.h"
+
+static const char * const snoc_intf_clocks[] = {
+   "ipa", /* mas_ipa */
+};
+
+enum {
+   QNOC_MASTER_AMPSS_M0 = 1,
+   QNOC_MNOC_BIMC_MAS,
+   QNOC_SNOC_BIMC_MAS,
+   QNOC_MASTER_TCU_0,
+   QNOC_MASTER_USB_HS2,
+   QNOC_MASTER_BLSP_1,
+   QNOC_MASTER_USB_HS,
+   QNOC_MASTER_BLSP_2,
+   QNOC_MASTER_CRYPTO_CORE0,
+   QNOC_MASTER_SDCC_1,
+   QNOC_MASTER_SDCC_2,
+   QNOC_MASTER_SDCC_3,
+   QNOC_SNOC_PNOC_MAS,
+   QNOC_MASTER_LPASS_AHB,
+   QNOC_MASTER_SPDM,
+   QNOC_MASTER_DEHR,
+   QNOC_MASTER_XM_USB_HS1,
+   QNOC_MASTER_QDSS_BAM,
+   QNOC_BIMC_SNOC_MAS,
+   QNOC_MASTER_JPEG,
+   QNOC_MASTER_GRAPHICS_3D,
+   QNOC_MASTER_MDP_PORT0,
+   QNOC_MASTER_MDP_PORT1,
+   QNOC_PNOC_SNOC_MAS,
+   QNOC_MASTER_VIDEO_P0,
+   QNOC_MASTER_VIDEO_P1,
+   QNOC_MASTER_VFE0,
+   QNOC_MASTER_VFE1,
+   QNOC_MASTER_CPP,
+   QNOC_MASTER_QDSS_ETR,
+   QNOC_MASTER_LPASS_PROC,
+   QNOC_MASTER_IPA,
+   QNOC_PNOC_M_0,
+   QNOC_PNOC_M_1,
+   QNOC_PNOC_INT_0,
+   QNOC_PNOC_INT_1,
+   QNOC_PNOC_INT_2,
+   QNOC_PNOC_SLV_1,
+   QNOC_PNOC_SLV_2,
+   QNOC_PNOC_SLV_3,
+   QNOC_PNOC_SLV_4,
+   QNOC_PNOC_SLV_8,
+   QNOC_PNOC_SLV_9,
+   QNOC_SNOC_MM_INT_0,
+   QNOC_SNOC_QDSS_INT,
+   QNOC_SNOC_INT_0,
+   QNOC_SNOC_INT_1,
+   QNOC_SNOC_INT_2,
+   QNOC_SLAVE_EBI_CH0,
+   QNOC_BIMC_SNOC_SLV,
+   QNOC_SLAVE_TCSR,
+   QNOC_SLAVE_TLMM,
+   QNOC_SLAVE_CRYPTO_0_CFG,
+   QNOC_SLAVE_MESSAGE_RAM,
+   QNOC_SLAVE_PDM,
+   QNOC_SLAVE_PRNG,
+   QNOC_SLAVE_PMIC_ARB,
+   QNOC_SLAVE_SNOC_CFG,
+   QNOC_SLAVE_DCC_CFG,
+   QNOC_SLAVE_CAMERA_CFG,
+   QNOC_SLAVE_DISPLAY_CFG,
+   QNOC_SLAVE_VENUS_CFG,
+   QNOC_SLAVE_SDCC_1,
+   QNOC_SLAVE_BLSP_1,
+   QNOC_SLAVE_USB_HS,
+   QNOC_SLAVE_SDCC_3,
+   QNOC_SLAVE_SDCC_2,
+   QNOC_SLAVE_GRAPHICS_3D_CFG,
+   QNOC_SLAVE_USB_HS2,
+   QNOC_SLAVE_BLSP_2,
+   QNOC_PNOC_SNOC_SLV,
+   

[PATCH 1/7] dt-bindings: interconnect: Add Qualcomm MSM8976 DT bindings

2024-06-09 Thread Adam Skladowski
Add bindings for Qualcomm MSM8976 Network-On-Chip interconnect devices.

Signed-off-by: Adam Skladowski 
---
 .../bindings/interconnect/qcom,msm8976.yaml   | 107 ++
 .../dt-bindings/interconnect/qcom,msm8976.h   |  97 
 2 files changed, 204 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/interconnect/qcom,msm8976.yaml
 create mode 100644 include/dt-bindings/interconnect/qcom,msm8976.h

diff --git a/Documentation/devicetree/bindings/interconnect/qcom,msm8976.yaml 
b/Documentation/devicetree/bindings/interconnect/qcom,msm8976.yaml
new file mode 100644
index ..bc9d08443e7c
--- /dev/null
+++ b/Documentation/devicetree/bindings/interconnect/qcom,msm8976.yaml
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interconnect/qcom,msm8976.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm MSM8976 Network-On-Chip interconnect
+
+maintainers:
+  - Konrad Dybcio 
+
+description: |
+  The Qualcomm MSM8976 interconnect providers support adjusting the
+  bandwidth requirements between the various NoC fabrics.
+
+properties:
+  compatible:
+enum:
+  - qcom,msm8976-bimc
+  - qcom,msm8976-pcnoc
+  - qcom,msm8976-snoc
+
+  reg:
+maxItems: 1
+
+  clock-names:
+minItems: 1
+maxItems: 2
+
+  clocks:
+minItems: 1
+maxItems: 2
+
+patternProperties:
+  '^interconnect-[a-z0-9\-]+$':
+type: object
+$ref: qcom,rpm-common.yaml#
+description:
+  The interconnect providers do not have a separate QoS register space,
+  but share parent's space.
+
+allOf:
+  - $ref: qcom,rpm-common.yaml#
+
+properties:
+  compatible:
+const: qcom,msm8976-snoc-mm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+allOf:
+  - $ref: qcom,rpm-common.yaml#
+  - if:
+  properties:
+compatible:
+  const: qcom,msm8976-snoc
+
+then:
+  properties:
+clocks:
+  items:
+- description: IPA clock from RPMCC
+clock-names:
+  const: ipa
+
+  required:
+- clocks
+- clock-names
+
+examples:
+  - |
+#include 
+#include 
+
+bimc: interconnect@40 {
+compatible = "qcom,msm8976-bimc";
+reg = <0x0040 0x62000>;
+#interconnect-cells = <2>;
+};
+
+pcnoc: interconnect@50 {
+compatible = "qcom,msm8976-pcnoc";
+reg = <0x0050 0x14000>;
+#interconnect-cells = <2>;
+};
+
+snoc: interconnect@58 {
+compatible = "qcom,msm8976-snoc";
+reg = <0x0058 0x1a000>;
+clocks =  < RPM_SMD_IPA_CLK>;
+clock-names = "ipa";
+#interconnect-cells = <2>;
+
+  snoc_mm: interconnect-snoc {
+  compatible = "qcom,msm8976-snoc-mm";
+  #interconnect-cells = <2>;
+  };
+};
diff --git a/include/dt-bindings/interconnect/qcom,msm8976.h 
b/include/dt-bindings/interconnect/qcom,msm8976.h
new file mode 100644
index ..4ea90f22320e
--- /dev/null
+++ b/include/dt-bindings/interconnect/qcom,msm8976.h
@@ -0,0 +1,97 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Qualcomm MSM8976 interconnect IDs
+ */
+
+#ifndef __DT_BINDINGS_INTERCONNECT_QCOM_MSM8976_H
+#define __DT_BINDINGS_INTERCONNECT_QCOM_MSM8976_H
+
+/* BIMC fabric */
+#define MAS_APPS_PROC  0
+#define MAS_SMMNOC_BIMC1
+#define MAS_SNOC_BIMC  2
+#define MAS_TCU_0  3
+#define SLV_EBI4
+#define SLV_BIMC_SNOC  5
+
+/* PCNOC fabric */
+#define MAS_USB_HS20
+#define MAS_BLSP_1 1
+#define MAS_USB_HS12
+#define MAS_BLSP_2 3
+#define MAS_CRYPTO 4
+#define MAS_SDCC_1 5
+#define MAS_SDCC_2 6
+#define MAS_SDCC_3 7
+#define MAS_SNOC_PCNOC 8
+#define MAS_LPASS_AHB  9
+#define MAS_SPDM   10
+#define MAS_DEHR   11
+#define MAS_XM_USB_HS1 12
+#define PCNOC_M_0  13
+#define PCNOC_M_1  14
+#define PCNOC_INT_015
+#define PCNOC_INT_116
+#define PCNOC_INT_217
+#define PCNOC_S_1  18
+#define PCNOC_S_2  19
+#define PCNOC_S_3  20
+#define PCNOC_S_4  21
+#define PCNOC_S_8  22
+#define PCNOC_S_9  23
+#define SLV_TCSR   24
+#define SLV_TLMM   25
+#define SLV_CRYPTO_0_CFG   26
+#define SLV_MESSAGE_RAM27
+#define SLV_PDM28
+#define SLV_PRNG   29
+#define SLV_PMIC_ARB   30
+#define SLV_SNOC_CFG   31
+#define SLV_DCC_CFG32
+#define SLV_CAMERA_SS_CFG  33
+#define SLV_DISP_SS_CFG34

[PATCH 0/7] msm8937/msm8976/qcs404 icc patches

2024-06-09 Thread Adam Skladowski
This series introduce new ICC drivers for some legacy socs
while at it also updates a bit of qcs404 driver which seems
to not receive much attention lately.
Please take in consideration i do not own any qcs404 board
so i cannot test anything else than if it compiles.

Adam Skladowski (7):
  dt-bindings: interconnect: Add Qualcomm MSM8976 DT bindings
  interconnect: qcom: Add MSM8976 interconnect provider driver
  dt-bindings: interconnect: Add Qualcomm MSM8937 DT bindings
  interconnect: qcom: Add MSM8937 interconnect provider driver
  interconnect: qcom: qcs404: Introduce AP-owned nodes
  interconnect: qcom: qcs404: Add regmaps and more bus descriptions
  dt-bindings: interconnect: qcom: msm8939: Fix example

 .../bindings/interconnect/qcom,msm8937.yaml   |   81 +
 .../bindings/interconnect/qcom,msm8939.yaml   |   22 +-
 .../bindings/interconnect/qcom,msm8976.yaml   |  107 ++
 drivers/interconnect/qcom/Kconfig |   18 +
 drivers/interconnect/qcom/Makefile|4 +
 drivers/interconnect/qcom/msm8937.c   | 1374 
 drivers/interconnect/qcom/msm8976.c   | 1443 +
 drivers/interconnect/qcom/qcs404.c|  126 +-
 .../dt-bindings/interconnect/qcom,msm8937.h   |   93 ++
 .../dt-bindings/interconnect/qcom,msm8976.h   |   97 ++
 10 files changed, 3354 insertions(+), 11 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/interconnect/qcom,msm8937.yaml
 create mode 100644 
Documentation/devicetree/bindings/interconnect/qcom,msm8976.yaml
 create mode 100644 drivers/interconnect/qcom/msm8937.c
 create mode 100644 drivers/interconnect/qcom/msm8976.c
 create mode 100644 include/dt-bindings/interconnect/qcom,msm8937.h
 create mode 100644 include/dt-bindings/interconnect/qcom,msm8976.h

-- 
2.45.1




[PATCH] ARM: dts: qcom: motorola-falcon: add accelerometer, magnetometer

2024-06-09 Thread Stanislav Jakubek
Add the accelerometer and magnetometer that are present on the Motorola
Moto G (2013) device.

Signed-off-by: Stanislav Jakubek 
---
 .../boot/dts/qcom/msm8226-motorola-falcon.dts | 53 +++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/qcom/msm8226-motorola-falcon.dts 
b/arch/arm/boot/dts/qcom/msm8226-motorola-falcon.dts
index 029e1b1659c9..5dbca83f2230 100644
--- a/arch/arm/boot/dts/qcom/msm8226-motorola-falcon.dts
+++ b/arch/arm/boot/dts/qcom/msm8226-motorola-falcon.dts
@@ -96,6 +96,35 @@ reserved@fb0 {
};
 };
 
+_i2c2 {
+   status = "okay";
+
+   magnetometer@c {
+   compatible = "asahi-kasei,ak8963";
+   reg = <0xc>;
+   interrupts-extended = < 66 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 62 GPIO_ACTIVE_LOW>;
+   vdd-supply = <_l19>;
+   vid-supply = <_lvs1>;
+   pinctrl-0 = <_int_default _reset_default>;
+   pinctrl-names = "default";
+   };
+
+   accelerometer@19 {
+   compatible = "st,lis3dh-accel";
+   reg = <0x19>;
+   interrupts-extended = < 63 IRQ_TYPE_EDGE_FALLING>;
+   vdd-supply = <_l19>;
+   vddio-supply = <_lvs1>;
+   pinctrl-0 = <_int_default>;
+   pinctrl-names = "default";
+   mount-matrix = "0", "1", "0",
+  "1", "0", "0",
+  "0", "0", "-1";
+   st,drdy-int-pin = <1>;
+   };
+};
+
 _i2c3 {
status = "okay";
 
@@ -321,6 +350,30 @@  {
 };
 
  {
+   accel_int_default: accel-int-default-state {
+   pins = "gpio63";
+   function = "gpio";
+   drive-strength = <2>;
+   bias-disable;
+   output-disable;
+   };
+
+   mag_int_default: mag-int-default-state {
+   pins = "gpio66";
+   function = "gpio";
+   drive-strength = <2>;
+   bias-disable;
+   output-disable;
+   };
+
+   mag_reset_default: mag-reset-default-state {
+   pins = "gpio62";
+   function = "gpio";
+   drive-strength = <2>;
+   bias-disable;
+   output-high;
+   };
+
reg_lcd_default: reg-lcd-default-state {
pins = "gpio31", "gpio33";
function = "gpio";
-- 
2.34.1




[PATCH 05/14] tracefs: replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-09 Thread Julia Lawall
Since SLOB was removed, it is not necessary to use call_rcu
when the callback only performs kmem_cache_free. Use
kfree_rcu() directly.

The changes were done using the following Coccinelle semantic patch.
This semantic patch is designed to ignore cases where the callback
function is used in another way.

// 
@r@
expression e;
local idexpression e2;
identifier cb,f;
position p;
@@

(
call_rcu(...,e2)
|
call_rcu(>f,cb@p)
)

@r1@
type T;
identifier x,r.cb;
@@

 cb(...) {
(
   kmem_cache_free(...);
|
   T x = ...;
   kmem_cache_free(...,x);
|
   T x;
   x = ...;
   kmem_cache_free(...,x);
)
 }

@s depends on r1@
position p != r.p;
identifier r.cb;
@@

 cb@p

@script:ocaml@
cb << r.cb;
p << s.p;
@@

Printf.eprintf "Other use of %s at %s:%d\n"
   cb (List.hd p).file (List.hd p).line

@depends on r1 && !s@
expression e;
identifier r.cb,f;
position r.p;
@@

- call_rcu(>f,cb@p)
+ kfree_rcu(e,f)

@r1a depends on !s@
type T;
identifier x,r.cb;
@@

- cb(...) {
(
-  kmem_cache_free(...);
|
-  T x = ...;
-  kmem_cache_free(...,x);
|
-  T x;
-  x = ...;
-  kmem_cache_free(...,x);
)
- }
// 

Signed-off-by: Julia Lawall 
Reviewed-by: Paul E. McKenney 
Reviewed-by: Vlastimil Babka 

---
 fs/tracefs/inode.c |   10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 7c29f4afc23d..338c52168e61 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -53,14 +53,6 @@ static struct inode *tracefs_alloc_inode(struct super_block 
*sb)
return >vfs_inode;
 }
 
-static void tracefs_free_inode_rcu(struct rcu_head *rcu)
-{
-   struct tracefs_inode *ti;
-
-   ti = container_of(rcu, struct tracefs_inode, rcu);
-   kmem_cache_free(tracefs_inode_cachep, ti);
-}
-
 static void tracefs_free_inode(struct inode *inode)
 {
struct tracefs_inode *ti = get_tracefs(inode);
@@ -70,7 +62,7 @@ static void tracefs_free_inode(struct inode *inode)
list_del_rcu(>list);
spin_unlock_irqrestore(_inode_lock, flags);
 
-   call_rcu(>rcu, tracefs_free_inode_rcu);
+   kfree_rcu(ti, rcu);
 }
 
 static ssize_t default_read_file(struct file *file, char __user *buf,