linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/4] irqchip/gic-v3: Add support to DT based quirk for msm8996
@ 2018-12-10 13:56 Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string Srinivas Kandagatla
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2018-12-10 13:56 UTC (permalink / raw)
  To: marc.zyngier
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree, Srinivas Kandagatla

Access to GICR_WAKER is restricted on msm8996 SoC in Hypervisor.
There are many devices out there with this restriction in place
and there has been no update to this firmware since last few years,
making those devices totally unusable for upstream development.

My previous attempts to add quirk based on IIDR register value seems to be
flawed by the fact that the value conflicted with other SoCs.
Last Suggestion by Marc Z using compatible seems to be the only way to apply
quirks required for msm8996 based SoCs.

Here is the patchset which add new compatible for msm8996 gicv3 and add
support gic_enable_of_quirks() followed by the actual quirk required for msm8996.

Without this quirk many qcom SoCs (atleast 3 that I know) are
unable to boot mainline.


Changes since v4:
- Added missing empty entry into quirk table.

Srinivas Kandagatla (4):
  dt-bindings/gic-v3: Add msm8996 compatible string
  irqchip/gic: common: add support to device tree based quirks
  irqchip: gic-v3: Add quirk for msm8996 secured registers
  arm64: dts: add msm8996 compatible to gicv3

 .../interrupt-controller/arm,gic-v3.txt       |  4 ++-
 arch/arm64/boot/dts/qcom/msm8996.dtsi         |  2 +-
 drivers/irqchip/irq-gic-common.c              | 12 +++++++++
 drivers/irqchip/irq-gic-common.h              |  3 +++
 drivers/irqchip/irq-gic-v3.c                  | 27 +++++++++++++++++++
 5 files changed, 46 insertions(+), 2 deletions(-)

-- 
2.19.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string
  2018-12-10 13:56 [PATCH v5 0/4] irqchip/gic-v3: Add support to DT based quirk for msm8996 Srinivas Kandagatla
@ 2018-12-10 13:56 ` Srinivas Kandagatla
  2018-12-10 22:19   ` Rob Herring
  2018-12-10 13:56 ` [PATCH v5 2/4] irqchip/gic: common: add support to device tree based quirks Srinivas Kandagatla
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Srinivas Kandagatla @ 2018-12-10 13:56 UTC (permalink / raw)
  To: marc.zyngier
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree, Srinivas Kandagatla

Access to GICR_WAKER is restricted on msm8996 SoC in Hypervisor.
There are many devices out there with this restriction in place
and there has been no update to this firmware since last few years,
making those devices totally unusable for upstream development.

IIDR register value conflicts with other SoCs, using compatible seems
to be the only way to apply quirks required for msm8996 based SoCs.

Without this quirk many qcom SoCs (atleast 3 that I know) are
unable to boot mainline.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 .../devicetree/bindings/interrupt-controller/arm,gic-v3.txt   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt b/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt
index 3ea78c4ef887..b83bb8249074 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt
@@ -7,7 +7,9 @@ Interrupts (LPI).
 
 Main node required properties:
 
-- compatible : should at least contain  "arm,gic-v3".
+- compatible : should at least contain  "arm,gic-v3" or either
+		"qcom,msm8996-gic-v3", "arm,gic-v3" for msm8996 SoCs
+		to address SoC specific bugs/quirks
 - interrupt-controller : Identifies the node as an interrupt controller
 - #interrupt-cells : Specifies the number of cells needed to encode an
   interrupt source. Must be a single cell with a value of at least 3.
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 2/4] irqchip/gic: common: add support to device tree based quirks
  2018-12-10 13:56 [PATCH v5 0/4] irqchip/gic-v3: Add support to DT based quirk for msm8996 Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string Srinivas Kandagatla
@ 2018-12-10 13:56 ` Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 3/4] irqchip: gic-v3: Add quirk for msm8996 secured registers Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3 Srinivas Kandagatla
  3 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2018-12-10 13:56 UTC (permalink / raw)
  To: marc.zyngier
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree, Srinivas Kandagatla

This patch adds support to device tree based quirks based on
device tree compatible string.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/irqchip/irq-gic-common.c | 12 ++++++++++++
 drivers/irqchip/irq-gic-common.h |  3 +++
 drivers/irqchip/irq-gic-v3.c     |  7 +++++++
 3 files changed, 22 insertions(+)

diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c
index 01e673c680cd..3c93c6f4d1f1 100644
--- a/drivers/irqchip/irq-gic-common.c
+++ b/drivers/irqchip/irq-gic-common.c
@@ -36,6 +36,18 @@ void gic_set_kvm_info(const struct gic_kvm_info *info)
 	gic_kvm_info = info;
 }
 
+void gic_enable_of_quirks(const struct device_node *np,
+			  const struct gic_quirk *quirks, void *data)
+{
+	for (; quirks->desc; quirks++) {
+		if (!of_device_is_compatible(np, quirks->compatible))
+			continue;
+		if (quirks->init(data))
+			pr_info("GIC: enabling workaround for %s\n",
+				quirks->desc);
+	}
+}
+
 void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks,
 		void *data)
 {
diff --git a/drivers/irqchip/irq-gic-common.h b/drivers/irqchip/irq-gic-common.h
index 3919cd7c5285..97e58fb6c232 100644
--- a/drivers/irqchip/irq-gic-common.h
+++ b/drivers/irqchip/irq-gic-common.h
@@ -23,6 +23,7 @@
 
 struct gic_quirk {
 	const char *desc;
+	const char *compatible;
 	bool (*init)(void *data);
 	u32 iidr;
 	u32 mask;
@@ -35,6 +36,8 @@ void gic_dist_config(void __iomem *base, int gic_irqs,
 void gic_cpu_config(void __iomem *base, void (*sync_access)(void));
 void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks,
 		void *data);
+void gic_enable_of_quirks(const struct device_node *np,
+			  const struct gic_quirk *quirks, void *data);
 
 void gic_set_kvm_info(const struct gic_kvm_info *info);
 
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 29e9d47be97d..df1ff3b5836a 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1271,6 +1271,11 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
 	gic_set_kvm_info(&gic_v3_kvm_info);
 }
 
+static const struct gic_quirk gic_quirks[] = {
+	{
+	}
+};
+
 static int __init gic_of_init(struct device_node *node, struct device_node *parent)
 {
 	void __iomem *dist_base;
@@ -1318,6 +1323,8 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
 	if (of_property_read_u64(node, "redistributor-stride", &redist_stride))
 		redist_stride = 0;
 
+	gic_enable_of_quirks(node, gic_quirks, &gic_data);
+
 	err = gic_init_bases(dist_base, rdist_regs, nr_redist_regions,
 			     redist_stride, &node->fwnode);
 	if (err)
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 3/4] irqchip: gic-v3: Add quirk for msm8996 secured registers
  2018-12-10 13:56 [PATCH v5 0/4] irqchip/gic-v3: Add support to DT based quirk for msm8996 Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 2/4] irqchip/gic: common: add support to device tree based quirks Srinivas Kandagatla
@ 2018-12-10 13:56 ` Srinivas Kandagatla
  2018-12-10 13:56 ` [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3 Srinivas Kandagatla
  3 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2018-12-10 13:56 UTC (permalink / raw)
  To: marc.zyngier
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree, Srinivas Kandagatla

Access to GICR_WAKER is restricted on msm8996 SoC in Hypervisor.
Its been more than 2+ years of wait for this to be fixed, which has
no hopes to be fixed. This change was introduced for the "lead device"
on msm8996 platform. It looks like all publicly available msm8996 and
other Qualcomm SoCs have this implementation.

So add a quirk to not access this register on msm8996.

With this quirk MSM8996 can at least boot out of mainline,
which can help community to work with boards based on MSM8996 and other
SoCs with have this restrictions. This Quirk is based on device tree
compatible string.

Without this patch Qualcomm DB820c board reboots when GICR_WAKER
is accessed.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/irqchip/irq-gic-v3.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index df1ff3b5836a..0868a9d81c3c 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -41,6 +41,8 @@
 
 #include "irq-gic-common.h"
 
+#define FLAGS_WORKAROUND_GICR_WAKER_MSM8996	(1ULL << 0)
+
 struct redist_region {
 	void __iomem		*redist_base;
 	phys_addr_t		phys_base;
@@ -55,6 +57,7 @@ struct gic_chip_data {
 	struct irq_domain	*domain;
 	u64			redist_stride;
 	u32			nr_redist_regions;
+	u64			flags;
 	bool			has_rss;
 	unsigned int		irq_nr;
 	struct partition_desc	*ppi_descs[16];
@@ -139,6 +142,9 @@ static void gic_enable_redist(bool enable)
 	u32 count = 1000000;	/* 1s! */
 	u32 val;
 
+	if (gic_data.flags & FLAGS_WORKAROUND_GICR_WAKER_MSM8996)
+		return;
+
 	rbase = gic_data_rdist_rd_base();
 
 	val = readl_relaxed(rbase + GICR_WAKER);
@@ -1067,6 +1073,15 @@ static const struct irq_domain_ops partition_domain_ops = {
 	.select = gic_irq_domain_select,
 };
 
+static bool gic_enable_quirk_msm8996(void *data)
+{
+	struct gic_chip_data *d = data;
+
+	d->flags |= FLAGS_WORKAROUND_GICR_WAKER_MSM8996;
+
+	return true;
+}
+
 static int __init gic_init_bases(void __iomem *dist_base,
 				 struct redist_region *rdist_regs,
 				 u32 nr_redist_regions,
@@ -1272,6 +1287,11 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
 }
 
 static const struct gic_quirk gic_quirks[] = {
+	{
+		.desc	= "GICv3: Qualcomm MSM8996 broken firmware",
+		.compatible = "qcom,msm8996-gic-v3",
+		.init	= gic_enable_quirk_msm8996,
+	},
 	{
 	}
 };
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3
  2018-12-10 13:56 [PATCH v5 0/4] irqchip/gic-v3: Add support to DT based quirk for msm8996 Srinivas Kandagatla
                   ` (2 preceding siblings ...)
  2018-12-10 13:56 ` [PATCH v5 3/4] irqchip: gic-v3: Add quirk for msm8996 secured registers Srinivas Kandagatla
@ 2018-12-10 13:56 ` Srinivas Kandagatla
  2018-12-13 17:26   ` Marc Zyngier
  3 siblings, 1 reply; 8+ messages in thread
From: Srinivas Kandagatla @ 2018-12-10 13:56 UTC (permalink / raw)
  To: marc.zyngier
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree, Srinivas Kandagatla

Add compatible to gicv3 node to enable quirk required to restrict writing
to GICR_WAKER register which is restricted on msm8996 SoC in Hypervisor.

With this quirk MSM8996 can at least boot out of mainline, which can help
community to work with boards based on MSM8996.

Without this patch Qualcomm DB820c board reboots on mainline.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 8585c61e32ef..cd9650cea05d 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -404,7 +404,7 @@
 		};
 
 		intc: interrupt-controller@9bc0000 {
-			compatible = "arm,gic-v3";
+			compatible = "qcom,msm8996-gic-v3", "arm,gic-v3";
 			#interrupt-cells = <3>;
 			interrupt-controller;
 			#redistributor-regions = <1>;
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string
  2018-12-10 13:56 ` [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string Srinivas Kandagatla
@ 2018-12-10 22:19   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2018-12-10 22:19 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: marc.zyngier, sudeep.holla, tglx, jason, linux-kernel,
	linux-arm-msm, rnayak, sboyd, bjorn.andersson, nicolas.dechesne,
	ctatlor97, vkoul, robh+dt, devicetree, Srinivas Kandagatla

On Mon, 10 Dec 2018 13:56:30 +0000, Srinivas Kandagatla wrote:
> Access to GICR_WAKER is restricted on msm8996 SoC in Hypervisor.
> There are many devices out there with this restriction in place
> and there has been no update to this firmware since last few years,
> making those devices totally unusable for upstream development.
> 
> IIDR register value conflicts with other SoCs, using compatible seems
> to be the only way to apply quirks required for msm8996 based SoCs.
> 
> Without this quirk many qcom SoCs (atleast 3 that I know) are
> unable to boot mainline.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  .../devicetree/bindings/interrupt-controller/arm,gic-v3.txt   | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3
  2018-12-10 13:56 ` [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3 Srinivas Kandagatla
@ 2018-12-13 17:26   ` Marc Zyngier
  2018-12-13 17:56     ` Srinivas Kandagatla
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2018-12-13 17:26 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree

On Mon, 10 Dec 2018 13:56:33 +0000,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote:
> 
> Add compatible to gicv3 node to enable quirk required to restrict writing
> to GICR_WAKER register which is restricted on msm8996 SoC in Hypervisor.
> 
> With this quirk MSM8996 can at least boot out of mainline, which can help
> community to work with boards based on MSM8996.
> 
> Without this patch Qualcomm DB820c board reboots on mainline.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  arch/arm64/boot/dts/qcom/msm8996.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> index 8585c61e32ef..cd9650cea05d 100644
> --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> @@ -404,7 +404,7 @@
>  		};
>  
>  		intc: interrupt-controller@9bc0000 {
> -			compatible = "arm,gic-v3";
> +			compatible = "qcom,msm8996-gic-v3", "arm,gic-v3";
>  			#interrupt-cells = <3>;
>  			interrupt-controller;
>  			#redistributor-regions = <1>;

I've applied the first 3 patches to irqchip/next. Please route this
one via arm-soc.

Thanks,

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3
  2018-12-13 17:26   ` Marc Zyngier
@ 2018-12-13 17:56     ` Srinivas Kandagatla
  0 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2018-12-13 17:56 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: sudeep.holla, tglx, jason, linux-kernel, linux-arm-msm, rnayak,
	sboyd, bjorn.andersson, nicolas.dechesne, ctatlor97, vkoul,
	robh+dt, devicetree



On 13/12/2018 17:26, Marc Zyngier wrote:
> I've applied the first 3 patches to irqchip/next. Please route this
> one via arm-soc.

Thanks, I will request Andy to take in his next pull request!

--srini	
> 
> Thanks,
> 
> 	M.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-13 17:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-10 13:56 [PATCH v5 0/4] irqchip/gic-v3: Add support to DT based quirk for msm8996 Srinivas Kandagatla
2018-12-10 13:56 ` [PATCH v5 1/4] dt-bindings/gic-v3: Add msm8996 compatible string Srinivas Kandagatla
2018-12-10 22:19   ` Rob Herring
2018-12-10 13:56 ` [PATCH v5 2/4] irqchip/gic: common: add support to device tree based quirks Srinivas Kandagatla
2018-12-10 13:56 ` [PATCH v5 3/4] irqchip: gic-v3: Add quirk for msm8996 secured registers Srinivas Kandagatla
2018-12-10 13:56 ` [PATCH v5 4/4] arm64: dts: add msm8996 compatible to gicv3 Srinivas Kandagatla
2018-12-13 17:26   ` Marc Zyngier
2018-12-13 17:56     ` Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).