Skip to contentSkip to conversation

soc: qcom: provide mechanism for drivers to access L2 registers

PATCH Superseded Neil Leeder 6 participants 13 messages May 20, 2016 – May 26, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: qcom: provide mechanism for drivers to access L2 registers

L2 registers are accessed using a select register and data register pair. To prevent multiple concurrent writes to the select register by independent drivers, the write to the select register and the associated access of the data register are protected with a lock. All drivers accessing the L2 registers use the set and get functions provided by l2-accessors to ensure correct reads and writes to L2 registers.

---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
drivers/soc/qcom/Kconfig +9 -0
index 461b387..c8498cd 100644
@@ -10,6 +10,15 @@ config QCOM_GSBI
           functions for connecting the underlying serial UART, SPI, and I2C
           devices to the output pins.
 
+config QCOM_L2_ACCESSORS
+	bool "Qualcomm Technologies L2-cache accessors"
+	depends on ARCH_QCOM
+	help
+	  Say y here to enable support for the Qualcomm Technologies
+	  L2 accessors.
+	  Provides support for accessing registers in the L2 cache
+	  for Qualcomm Technologies chips.
+
 config QCOM_PM
 	bool "Qualcomm Power Management"
 	depends on ARCH_QCOM && !ARM64
drivers/soc/qcom/Makefile +1 -0
index fdd664e..6ef29b9 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
+obj-$(CONFIG_QCOM_L2_ACCESSORS) += l2-accessors.o
 obj-$(CONFIG_QCOM_PM)	+=	spm.o
 obj-$(CONFIG_QCOM_SMD) +=	smd.o
 obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
drivers/soc/qcom/l2-accessors.c new file +66 -0

66 lines not on this page · raw message

include/linux/soc/qcom/l2-accessors.h new file +27 -0
new file mode 100644
index 0000000..563c114
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __QCOM_L2_ACCESSORS_H
+#define __QCOM_L2_ACCESSORS_H
+
+#ifdef CONFIG_QCOM_L2_ACCESSORS
+void set_l2_indirect_reg(u64 reg_addr, u64 val);
+u64 get_l2_indirect_reg(u64 reg_addr);
+#else
+static inline void set_l2_indirect_reg(u64 reg_addr, u64 val) {}
+static inline u64 get_l2_indirect_reg(u64 reg_addr)
+{
+	return 0;
+}
+#endif
+#endif
Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#1 lore raw
Quoted 11 lines · Neil Leeder
drivers/soc/qcom/l2-accessors.c new file +5 -0
new file mode 100644
index 0000000..fbb69bd
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and

drivers/soc/qcom/l2-accessors.c line 15

Quoted 10 lines
drivers/soc/qcom/l2-accessors.c new file +10 -0
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/spinlock.h>
+#include <linux/module.h>

export.h instead?

drivers/soc/qcom/l2-accessors.c line 18

Quoted 3 lines
drivers/soc/qcom/l2-accessors.c new file +3 -0
+#include <linux/soc/qcom/l2-accessors.h>
+#include <asm/cputype.h>
+#include <asm/sysreg.h>

Is there a patch to add sysreg.h to arch/arm? It would be nice to use one l2 accessor API on arm64 and arm.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
Quoted 16 lines · Stephen Boyd
Quoted 15 lines · Neil Leeder
drivers/soc/qcom/l2-accessors.c new file +9 -0
new file mode 100644
index 0000000..fbb69bd
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
Quoted 8 lines

drivers/soc/qcom/l2-accessors.c line 15

Quoted 6 lines
drivers/soc/qcom/l2-accessors.c new file +6 -0
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/spinlock.h>
+#include <linux/module.h>

export.h instead?

OK, will address in v2

Quoted 8 lines

drivers/soc/qcom/l2-accessors.c line 18

Quoted 4 lines
drivers/soc/qcom/l2-accessors.c new file +3 -0
+#include <linux/soc/qcom/l2-accessors.h>
+#include <asm/cputype.h>
+#include <asm/sysreg.h>

Is there a patch to add sysreg.h to arch/arm? It would be nice to use one l2 accessor API on arm64 and arm.

Sounds like a good thing for the next person who submits a krait L2 patch to consider.

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#3 lore raw
Quoted 9 lines · Neil Leeder
Quoted 4 lines · Stephen Boyd

Is there a patch to add sysreg.h to arch/arm? It would be nice to use one l2 accessor API on arm64 and arm.

Sounds like a good thing for the next person who submits a krait L2 patch to consider.

Heh, ok. If it isn't supported in this patch then we need to make the config depend on ARM64 so that this doesn't fail to compile on ARM.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw
Quoted 5 lines · Stephen Boyd
Quoted 4 lines · Neil Leeder
Quoted 1 line · Stephen Boyd
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Is there a patch to add sysreg.h to arch/arm? It would be nice to use one l2 accessor API on arm64 and arm.

Sounds like a good thing for the next person who submits a krait L2 patch to consider.

Heh, ok. If it isn't supported in this patch then we need to make the config depend on ARM64 so that this doesn't fail to compile on ARM.

Ok, I'll add that in v2 too.

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#5 lore raw
In reply to Neil Leeder
Quoted 7 lines · Neil Leeder

L2 registers are accessed using a select register and data register pair. To prevent multiple concurrent writes to the select register by independent drivers, the write to the select register and the associated access of the data register are protected with a lock. All drivers accessing the L2 registers use the set and get functions provided by l2-accessors to ensure correct reads and writes to L2 registers.

What will this be used for? (i.e. which drivers want to touch the L2 registers?).

Generally we expect FW to configure the caches and interconnect appropriately.

Quoted 9 lines
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

Quoted 124 lines
drivers/soc/qcom/Kconfig +9 -0
index 461b387..c8498cd 100644
@@ -10,6 +10,15 @@ config QCOM_GSBI
           functions for connecting the underlying serial UART, SPI, and I2C
           devices to the output pins.
 
+config QCOM_L2_ACCESSORS
+	bool "Qualcomm Technologies L2-cache accessors"
+	depends on ARCH_QCOM
+	help
+	  Say y here to enable support for the Qualcomm Technologies
+	  L2 accessors.
+	  Provides support for accessing registers in the L2 cache
+	  for Qualcomm Technologies chips.
+
 config QCOM_PM
 	bool "Qualcomm Power Management"
 	depends on ARCH_QCOM && !ARM64
drivers/soc/qcom/Makefile +1 -0
index fdd664e..6ef29b9 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
+obj-$(CONFIG_QCOM_L2_ACCESSORS) += l2-accessors.o
 obj-$(CONFIG_QCOM_PM)	+=	spm.o
 obj-$(CONFIG_QCOM_SMD) +=	smd.o
 obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
drivers/soc/qcom/l2-accessors.c new file +66 -0
new file mode 100644
index 0000000..fbb69bd
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/spinlock.h>
+#include <linux/module.h>
+#include <linux/soc/qcom/l2-accessors.h>
+#include <asm/cputype.h>
+#include <asm/sysreg.h>
+
+#define	L2CPUSRSELR_EL1	S3_3_c15_c0_6
+#define	L2CPUSRDR_EL1	S3_3_c15_c0_7
+
+static DEFINE_RAW_SPINLOCK(l2_access_lock);
+
+/**
+ * set_l2_indirect_reg: write value to an L2 register
+ * @reg: Address of L2 register.
+ * @value: Value to be written to register.
+ *
+ * Use architecturally required barriers for ordering between system register
+ * accesses
+ */
+void set_l2_indirect_reg(u64 reg, u64 val)
+{
+	unsigned long flags;
+
+	raw_spin_lock_irqsave(&l2_access_lock, flags);
+	write_sysreg(reg, L2CPUSRSELR_EL1);
+	isb();
+	write_sysreg(val, L2CPUSRDR_EL1);
+	isb();
+	raw_spin_unlock_irqrestore(&l2_access_lock, flags);
+}
+EXPORT_SYMBOL(set_l2_indirect_reg);
+
+/**
+ * get_l2_indirect_reg: read an L2 register value
+ * @reg: Address of L2 register.
+ *
+ * Use architecturally required barriers for ordering between system register
+ * accesses
+ */
+u64 get_l2_indirect_reg(u64 reg)
+{
+	u64 val;
+	unsigned long flags;
+
+	raw_spin_lock_irqsave(&l2_access_lock, flags);
+	write_sysreg(reg, L2CPUSRSELR_EL1);
+	isb();
+	val = read_sysreg(L2CPUSRDR_EL1);
+	raw_spin_unlock_irqrestore(&l2_access_lock, flags);
+
+	return val;
+}
+EXPORT_SYMBOL(get_l2_indirect_reg);
include/linux/soc/qcom/l2-accessors.h new file +15 -0
new file mode 100644
index 0000000..563c114
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 
+#ifndef __QCOM_L2_ACCESSORS_H
+#define __QCOM_L2_ACCESSORS_H

include/linux/soc/qcom/l2-accessors.h line 25

Quoted 10 lines
include/linux/soc/qcom/l2-accessors.h new file +10 -0
+
+#ifdef CONFIG_QCOM_L2_ACCESSORS
+void set_l2_indirect_reg(u64 reg_addr, u64 val);
+u64 get_l2_indirect_reg(u64 reg_addr);
+#else
+static inline void set_l2_indirect_reg(u64 reg_addr, u64 val) {}
+static inline u64 get_l2_indirect_reg(u64 reg_addr)
+{
+	return 0;
+}

Surely it would be better to error out on any unintentional use of these at build time?

Thanks,
Mark.

#6 lore raw
Quoted 9 lines · Mark Rutland
Quoted 7 lines · Neil Leeder

L2 registers are accessed using a select register and data register pair. To prevent multiple concurrent writes to the select register by independent drivers, the write to the select register and the associated access of the data register are protected with a lock. All drivers accessing the L2 registers use the set and get functions provided by l2-accessors to ensure correct reads and writes to L2 registers.

Quoted 5 lines

What will this be used for? (i.e. which drivers want to touch the L2 registers?).

Generally we expect FW to configure the caches and interconnect appropriately.

The primary use is in the L2 PMU driver, which will be posted shortly.

Quoted 11 lines
Quoted 10 lines
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
Quoted 4 lines

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

It's under soc/qcom, and dependent on ARCH_QCOM and (in v2) also on ARM64. It applies to all QCOM ARM64 SoCs. Given that it can only be used in a QCOM driver, and the include path has qcom in it, I'd prefer not to add redundancy by adding another qcom in there.

Quoted 20 lines
Quoted 19 lines
include/linux/soc/qcom/l2-accessors.h new file +13 -0
new file mode 100644
index 0000000..563c114
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
Quoted 15 lines

include/linux/soc/qcom/l2-accessors.h line 25

Quoted 12 lines
include/linux/soc/qcom/l2-accessors.h new file +12 -0
+#ifndef __QCOM_L2_ACCESSORS_H
+#define __QCOM_L2_ACCESSORS_H
+
+#ifdef CONFIG_QCOM_L2_ACCESSORS
+void set_l2_indirect_reg(u64 reg_addr, u64 val);
+u64 get_l2_indirect_reg(u64 reg_addr);
+#else
+static inline void set_l2_indirect_reg(u64 reg_addr, u64 val) {}
+static inline u64 get_l2_indirect_reg(u64 reg_addr)
+{
+	return 0;
+}

Surely it would be better to error out on any unintentional use of these at build time?

This allows building code which is common to ARM SoCs and QCOM SoCs without having to ifdef out the QCOM-specific pieces.

Quoted 4 lines

Thanks,
Mark.

Thanks,
Neil

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#7 lore raw
Quoted 30 lines · Neil Leeder
Quoted 9 lines · Mark Rutland
Quoted 7 lines · Neil Leeder

L2 registers are accessed using a select register and data register pair. To prevent multiple concurrent writes to the select register by independent drivers, the write to the select register and the associated access of the data register are protected with a lock. All drivers accessing the L2 registers use the set and get functions provided by l2-accessors to ensure correct reads and writes to L2 registers.

Quoted 5 lines

What will this be used for? (i.e. which drivers want to touch the L2 registers?).

Generally we expect FW to configure the caches and interconnect appropriately.

The primary use is in the L2 PMU driver, which will be posted shortly.

Quoted 11 lines
Quoted 10 lines
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
Quoted 8 lines
Quoted 4 lines

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

It's under soc/qcom, and dependent on ARCH_QCOM and (in v2) also on ARM64. It applies to all QCOM ARM64 SoCs. Given that it can only be used in a QCOM driver, and the include path has qcom in it, I'd prefer not to add redundancy by adding another qcom in there.

They ended up calling the pinctrl file qcom/pinctrl/qdf2xxx.c.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8f1338cd80648adf5434798f5393ad7c55d10848

Regards,
Cov

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#8 lore raw
Quoted 3 lines · Christopher Covington

They ended up calling the pinctrl file qcom/pinctrl/qdf2xxx.c.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8f1338cd80648adf5434798f5393ad7c55d10848

To be fair, none of the other drivers in drivers/soc/ specify any specific SOCs. They all have generic file names.

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.
#9 lore raw
In reply to Neil Leeder
Quoted 11 lines · Neil Leeder
Quoted 9 lines · Mark Rutland
Quoted 7 lines · Neil Leeder

L2 registers are accessed using a select register and data register pair. To prevent multiple concurrent writes to the select register by independent drivers, the write to the select register and the associated access of the data register are protected with a lock. All drivers accessing the L2 registers use the set and get functions provided by l2-accessors to ensure correct reads and writes to L2 registers.

Quoted 7 lines
Quoted 5 lines

What will this be used for? (i.e. which drivers want to touch the L2 registers?).

Generally we expect FW to configure the caches and interconnect appropriately.

The primary use is in the L2 PMU driver, which will be posted shortly.

Ok.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
Quoted 6 lines
Quoted 4 lines

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

It's under soc/qcom, and dependent on ARCH_QCOM and (in v2) also on ARM64. It applies to all QCOM ARM64 SoCs.

Per Christopher's comment, it sounds like this applies to QDF24xx.

Given that the code uses IMPLEMENTATION DEFINED system registers, I presume that this does not apply to MSM8916 which uses Cortex-A53, for example (though perhaps it does, and I am mistaken).

Quoted 2 lines

Given that it can only be used in a QCOM driver, and the include path has qcom in it, I'd prefer not to add redundancy by adding another qcom in there.

I'm not asking for another "qcom", but simply the SoC variant or family (e.g. "qdf24xx" would be fine).

Quoted 36 lines
Quoted 20 lines
Quoted 19 lines
include/linux/soc/qcom/l2-accessors.h new file +13 -0
new file mode 100644
index 0000000..563c114
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
Quoted 15 lines

include/linux/soc/qcom/l2-accessors.h line 25

Quoted 12 lines
include/linux/soc/qcom/l2-accessors.h new file +12 -0
+#ifndef __QCOM_L2_ACCESSORS_H
+#define __QCOM_L2_ACCESSORS_H
+
+#ifdef CONFIG_QCOM_L2_ACCESSORS
+void set_l2_indirect_reg(u64 reg_addr, u64 val);
+u64 get_l2_indirect_reg(u64 reg_addr);
+#else
+static inline void set_l2_indirect_reg(u64 reg_addr, u64 val) {}
+static inline u64 get_l2_indirect_reg(u64 reg_addr)
+{
+	return 0;
+}

Surely it would be better to error out on any unintentional use of these at build time?

Quoted 2 lines

This allows building code which is common to ARM SoCs and QCOM SoCs without having to ifdef out the QCOM-specific pieces.

These shouldn't appear in generic code.

Other than the L2 PMU driver (which presumably depends on or selects CONFIG_QCOM_L2_ACCESSORS), what code would you have to ifdef?

I don't have a major concern on this, I just don't see where it should matter.

Thanks,
Mark.

#10 lore raw
Quoted 28 lines · Mark Rutland
Quoted 14 lines · Neil Leeder
Quoted 12 lines · Mark Rutland
Quoted 9 lines · Neil Leeder
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
Quoted 6 lines
Quoted 4 lines

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

It's under soc/qcom, and dependent on ARCH_QCOM and (in v2) also on ARM64. It applies to all QCOM ARM64 SoCs.

Per Christopher's comment, it sounds like this applies to QDF24xx.

Given that the code uses IMPLEMENTATION DEFINED system registers, I presume that this does not apply to MSM8916 which uses Cortex-A53, for example (though perhaps it does, and I am mistaken).

Quoted 6 lines
Quoted 2 lines

Given that it can only be used in a QCOM driver, and the include path has qcom in it, I'd prefer not to add redundancy by adding another qcom in there.

I'm not asking for another "qcom", but simply the SoC variant or family (e.g. "qdf24xx" would be fine).

It applies to all ARMv8 SoCs with QCOM processors in them. So QDF24xx and mobile 820, but not SoCs with ARM processors in them such as MSM8916. So neither msm_ nor qdf_ are accurate prefixes. As Timur pointed out, the majority of source files in drivers/soc/qcom don't have any prefix, which is a reason why I didn't include one.

Quoted 39 lines
Quoted 36 lines
Quoted 20 lines
Quoted 19 lines
include/linux/soc/qcom/l2-accessors.h new file +13 -0
new file mode 100644
index 0000000..563c114
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
Quoted 15 lines

include/linux/soc/qcom/l2-accessors.h line 25

Quoted 12 lines
include/linux/soc/qcom/l2-accessors.h new file +12 -0
+#ifndef __QCOM_L2_ACCESSORS_H
+#define __QCOM_L2_ACCESSORS_H
+
+#ifdef CONFIG_QCOM_L2_ACCESSORS
+void set_l2_indirect_reg(u64 reg_addr, u64 val);
+u64 get_l2_indirect_reg(u64 reg_addr);
+#else
+static inline void set_l2_indirect_reg(u64 reg_addr, u64 val) {}
+static inline u64 get_l2_indirect_reg(u64 reg_addr)
+{
+	return 0;
+}

Surely it would be better to error out on any unintentional use of these at build time?

Quoted 2 lines

This allows building code which is common to ARM SoCs and QCOM SoCs without having to ifdef out the QCOM-specific pieces.

Quoted 7 lines

These shouldn't appear in generic code.

Other than the L2 PMU driver (which presumably depends on or selects CONFIG_QCOM_L2_ACCESSORS), what code would you have to ifdef?

I don't have a major concern on this, I just don't see where it should matter.

Ok, I agree, I will remove this. Thanks.

Quoted 4 lines

Thanks,
Mark.

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#11 lore raw
Quoted 34 lines · Neil Leeder
Quoted 31 lines · Mark Rutland
Quoted 14 lines · Neil Leeder
Quoted 12 lines · Mark Rutland
Quoted 9 lines · Neil Leeder
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
Quoted 6 lines
Quoted 4 lines

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

It's under soc/qcom, and dependent on ARCH_QCOM and (in v2) also on ARM64. It applies to all QCOM ARM64 SoCs.

Per Christopher's comment, it sounds like this applies to QDF24xx.

Given that the code uses IMPLEMENTATION DEFINED system registers, I presume that this does not apply to MSM8916 which uses Cortex-A53, for example (though perhaps it does, and I am mistaken).

Quoted 2 lines

Given that it can only be used in a QCOM driver, and the include path has qcom in it, I'd prefer not to add redundancy by adding another qcom in there.

Quoted 7 lines
Quoted 3 lines

I'm not asking for another "qcom", but simply the SoC variant or family (e.g. "qdf24xx" would be fine).

It applies to all ARMv8 SoCs with QCOM processors in them. So QDF24xx and mobile 820, but not SoCs with ARM processors in them such as MSM8916. So neither msm_ nor qdf_ are accurate prefixes.

What's the code name for the SoC in QDF24xx? The 820 is Kryo, is it the same core in QDF24xx or does that have some other name.

We should try to pick something adding value, not adding another generic thing.

Quoted 3 lines

As Timur pointed out, the majority of source files in drivers/soc/qcom don't have any prefix, which is a reason why I didn't include one.

There's no reason to add a generic "qcom" to the qcom folder, if anything we should drop the "qcom" prefix of the only one in there.

Regards,
Bjorn

#12 lore raw
Quoted 44 lines · Bjorn Andersson
Quoted 34 lines · Neil Leeder
Quoted 31 lines · Mark Rutland
Quoted 14 lines · Neil Leeder
Quoted 12 lines · Mark Rutland
Quoted 9 lines · Neil Leeder
---
 drivers/soc/qcom/Kconfig              |  9 +++++
 drivers/soc/qcom/Makefile             |  1 +
 drivers/soc/qcom/l2-accessors.c       | 66 +++++++++++++++++++++++++++++++++++
 include/linux/soc/qcom/l2-accessors.h | 27 ++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/soc/qcom/l2-accessors.c
 create mode 100644 include/linux/soc/qcom/l2-accessors.h
Quoted 6 lines
Quoted 4 lines

These are awfully generic file names (and function names). Which SoCs does this apply to?

It would be good to give these more specific names.

It's under soc/qcom, and dependent on ARCH_QCOM and (in v2) also on ARM64. It applies to all QCOM ARM64 SoCs.

Per Christopher's comment, it sounds like this applies to QDF24xx.

Given that the code uses IMPLEMENTATION DEFINED system registers, I presume that this does not apply to MSM8916 which uses Cortex-A53, for example (though perhaps it does, and I am mistaken).

Quoted 2 lines

Given that it can only be used in a QCOM driver, and the include path has qcom in it, I'd prefer not to add redundancy by adding another qcom in there.

Quoted 7 lines
Quoted 3 lines

I'm not asking for another "qcom", but simply the SoC variant or family (e.g. "qdf24xx" would be fine).

It applies to all ARMv8 SoCs with QCOM processors in them. So QDF24xx and mobile 820, but not SoCs with ARM processors in them such as MSM8916. So neither msm_ nor qdf_ are accurate prefixes.

Quoted 5 lines

What's the code name for the SoC in QDF24xx? The 820 is Kryo, is it the same core in QDF24xx or does that have some other name.

We should try to pick something adding value, not adding another generic thing.

There is currently no public name for the QDF24xx core.

Quoted 11 lines
Quoted 4 lines

As Timur pointed out, the majority of source files in drivers/soc/qcom don't have any prefix, which is a reason why I didn't include one.

There's no reason to add a generic "qcom" to the qcom folder, if anything we should drop the "qcom" prefix of the only one in there.

Regards,
Bjorn

Neil

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.