* [PATCH] soc/tegra: Register SoC device
@ 2017-08-17 14:42 Thierry Reding
[not found] ` <20170817144217.31346-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Thierry Reding @ 2017-08-17 14:42 UTC (permalink / raw)
To: Thierry Reding
Cc: Jonathan Hunter, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Move this code from arch/arm/mach-tegra and make it common among 32-bit
and 64-bit Tegra SoCs. This is slightly complicated by the fact that on
32-bit Tegra, the SoC device is used as the parent for all devices that
are instantiated from device tree.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/mach-tegra/tegra.c | 29 +---------------------
drivers/soc/tegra/Kconfig | 5 ++++
drivers/soc/tegra/fuse/fuse-tegra.c | 48 +++++++++++++++++++++++++++++++++++--
include/soc/tegra/fuse.h | 2 ++
4 files changed, 54 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 649e9e8c7bcc..02e712d2ea30 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -84,35 +84,8 @@ static void __init tegra_dt_init_irq(void)
static void __init tegra_dt_init(void)
{
- struct soc_device_attribute *soc_dev_attr;
- struct soc_device *soc_dev;
- struct device *parent = NULL;
+ struct device *parent = tegra_soc_device_register();
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
- if (!soc_dev_attr)
- goto out;
-
- soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
- soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
- tegra_sku_info.revision);
- soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
-
- soc_dev = soc_device_register(soc_dev_attr);
- if (IS_ERR(soc_dev)) {
- kfree(soc_dev_attr->family);
- kfree(soc_dev_attr->revision);
- kfree(soc_dev_attr->soc_id);
- kfree(soc_dev_attr);
- goto out;
- }
-
- parent = soc_device_to_device(soc_dev);
-
- /*
- * Finished with the static registrations now; fill in the missing
- * devices
- */
-out:
of_platform_default_populate(NULL, NULL, parent);
}
diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig
index 1beb7c347344..e9e277178c94 100644
--- a/drivers/soc/tegra/Kconfig
+++ b/drivers/soc/tegra/Kconfig
@@ -107,6 +107,11 @@ config ARCH_TEGRA_186_SOC
endif
endif
+config SOC_TEGRA_FUSE
+ def_bool y
+ depends on ARCH_TEGRA
+ select SOC_BUS
+
config SOC_TEGRA_FLOWCTRL
bool
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 75b38194750f..02686378dfc1 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -19,10 +19,12 @@
#include <linux/device.h>
#include <linux/kobject.h>
#include <linux/init.h>
-#include <linux/platform_device.h>
+#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
-#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/sys_soc.h>
#include <soc/tegra/common.h>
#include <soc/tegra/fuse.h>
@@ -213,6 +215,31 @@ static void tegra_enable_fuse_clk(void __iomem *base)
writel(reg, base + 0x14);
}
+struct device * __init tegra_soc_device_register(void)
+{
+ struct soc_device_attribute *attr;
+ struct soc_device *dev;
+
+ attr = kzalloc(sizeof(*attr), GFP_KERNEL);
+ if (!attr)
+ return NULL;
+
+ attr->family = kasprintf(GFP_KERNEL, "Tegra");
+ attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_sku_info.revision);
+ attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
+
+ dev = soc_device_register(attr);
+ if (IS_ERR(dev)) {
+ kfree(attr->soc_id);
+ kfree(attr->revision);
+ kfree(attr->family);
+ kfree(attr);
+ return ERR_CAST(dev);
+ }
+
+ return soc_device_to_device(dev);
+}
+
static int __init tegra_init_fuse(void)
{
const struct of_device_id *match;
@@ -314,6 +341,23 @@ static int __init tegra_init_fuse(void)
pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
+
return 0;
}
early_initcall(tegra_init_fuse);
+
+#ifdef CONFIG_ARM64
+static int __init tegra_init_soc(void)
+{
+ struct device *soc;
+
+ soc = tegra_soc_device_register();
+ if (IS_ERR(soc)) {
+ pr_err("failed to register SoC device: %ld\n", PTR_ERR(soc));
+ return PTR_ERR(soc);
+ }
+
+ return 0;
+}
+device_initcall(tegra_init_soc)
+#endif
diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
index b4c9219e7f95..9b6ea0c72117 100644
--- a/include/soc/tegra/fuse.h
+++ b/include/soc/tegra/fuse.h
@@ -65,6 +65,8 @@ int tegra_fuse_readl(unsigned long offset, u32 *value);
extern struct tegra_sku_info tegra_sku_info;
+struct device *tegra_soc_device_register(void);
+
#endif /* __ASSEMBLY__ */
#endif /* __SOC_TEGRA_FUSE_H__ */
--
2.13.3
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <20170817144217.31346-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] soc/tegra: Register SoC device [not found] ` <20170817144217.31346-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2017-08-22 10:15 ` Sudeep Holla [not found] ` <61dde661-313f-0b51-233b-ce957c514a55-5wv7dgnIgG8@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Sudeep Holla @ 2017-08-22 10:15 UTC (permalink / raw) To: Thierry Reding Cc: Sudeep Holla, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jonathan Hunter On 17/08/17 15:42, Thierry Reding wrote: > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > Move this code from arch/arm/mach-tegra and make it common among 32-bit > and 64-bit Tegra SoCs. This is slightly complicated by the fact that on > 32-bit Tegra, the SoC device is used as the parent for all devices that > are instantiated from device tree. > This seem to be in linux-next and causing the below splat on my platform which is not Tegra :) WARNING: .... at drivers/soc/tegra/fuse/tegra-apbmisc.c:48 tegra_get_chip_id+0x30/0x40 Modules linked in: CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc6-next-20170822-00008-g52a8e57512ae #13 task: ffff8009768a0000 task.stack: ffff000008038000 PC is at tegra_get_chip_id+0x30/0x40 LR is at tegra_get_chip_id+0x30/0x40 tegra_get_chip_id+0x30/0x40 tegra_soc_device_register+0x68/0xd0 tegra_init_soc+0x10/0x44 do_one_initcall+0x38/0x120 kernel_init_freeable+0x184/0x224 kernel_init+0x10/0x100 ret_from_fork+0x10/0x18 -- Regards, Sudeep ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <61dde661-313f-0b51-233b-ce957c514a55-5wv7dgnIgG8@public.gmane.org>]
* Re: [PATCH] soc/tegra: Register SoC device [not found] ` <61dde661-313f-0b51-233b-ce957c514a55-5wv7dgnIgG8@public.gmane.org> @ 2017-08-22 11:19 ` Thierry Reding 2017-08-22 15:00 ` Sudeep Holla 2017-08-23 8:49 ` Arnd Bergmann 0 siblings, 2 replies; 7+ messages in thread From: Thierry Reding @ 2017-08-22 11:19 UTC (permalink / raw) To: Sudeep Holla Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jonathan Hunter [-- Attachment #1: Type: text/plain, Size: 2726 bytes --] On Tue, Aug 22, 2017 at 11:15:21AM +0100, Sudeep Holla wrote: > > > On 17/08/17 15:42, Thierry Reding wrote: > > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > > > Move this code from arch/arm/mach-tegra and make it common among 32-bit > > and 64-bit Tegra SoCs. This is slightly complicated by the fact that on > > 32-bit Tegra, the SoC device is used as the parent for all devices that > > are instantiated from device tree. > > > > This seem to be in linux-next and causing the below splat on my platform > which is not Tegra :) > > WARNING: .... at drivers/soc/tegra/fuse/tegra-apbmisc.c:48 > tegra_get_chip_id+0x30/0x40 > Modules linked in: > CPU: 2 PID: 1 Comm: swapper/0 Not tainted > 4.13.0-rc6-next-20170822-00008-g52a8e57512ae #13 > task: ffff8009768a0000 task.stack: ffff000008038000 > PC is at tegra_get_chip_id+0x30/0x40 > LR is at tegra_get_chip_id+0x30/0x40 > tegra_get_chip_id+0x30/0x40 > tegra_soc_device_register+0x68/0xd0 > tegra_init_soc+0x10/0x44 > do_one_initcall+0x38/0x120 > kernel_init_freeable+0x184/0x224 > kernel_init+0x10/0x100 > ret_from_fork+0x10/0x18 Indeed. Does the below patch fix this? Thierry --- >8 --- From 5706cacc2af5e4ef138d1cd9e1269ca4947a447f Mon Sep 17 00:00:00 2001 From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Date: Tue, 22 Aug 2017 13:15:18 +0200 Subject: [PATCH] soc/tegra: Restrict SoC device registration to Tegra Commit 8a46828e623c ("soc/tegra: Register SoC device") added an initcall to register the SoC device on Tegra. However, that code is unrestricted and will run on all platforms, causing unwanted warnings. Fix this by first checking that we're running on hardware that supports the fuses block that we use to provide SoC information. Fixes: 8a46828e623c ("soc/tegra: Register SoC device") Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- drivers/soc/tegra/fuse/fuse-tegra.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 02686378dfc1..161522bd98ac 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -349,8 +349,16 @@ early_initcall(tegra_init_fuse); #ifdef CONFIG_ARM64 static int __init tegra_init_soc(void) { + struct device_node *np; struct device *soc; + /* make sure we're running on Tegra */ + np = of_find_matching_node(NULL, tegra_fuse_match); + if (!np) + return 0; + + of_node_put(np); + soc = tegra_soc_device_register(); if (IS_ERR(soc)) { pr_err("failed to register SoC device: %ld\n", PTR_ERR(soc)); -- 2.13.3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] soc/tegra: Register SoC device 2017-08-22 11:19 ` Thierry Reding @ 2017-08-22 15:00 ` Sudeep Holla 2017-08-23 8:49 ` Arnd Bergmann 1 sibling, 0 replies; 7+ messages in thread From: Sudeep Holla @ 2017-08-22 15:00 UTC (permalink / raw) To: Thierry Reding Cc: Sudeep Holla, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jonathan Hunter On 22/08/17 12:19, Thierry Reding wrote: > On Tue, Aug 22, 2017 at 11:15:21AM +0100, Sudeep Holla wrote: >> >> >> On 17/08/17 15:42, Thierry Reding wrote: >>> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >>> >>> Move this code from arch/arm/mach-tegra and make it common among 32-bit >>> and 64-bit Tegra SoCs. This is slightly complicated by the fact that on >>> 32-bit Tegra, the SoC device is used as the parent for all devices that >>> are instantiated from device tree. >>> >> >> This seem to be in linux-next and causing the below splat on my platform >> which is not Tegra :) >> >> WARNING: .... at drivers/soc/tegra/fuse/tegra-apbmisc.c:48 >> tegra_get_chip_id+0x30/0x40 >> Modules linked in: >> CPU: 2 PID: 1 Comm: swapper/0 Not tainted >> 4.13.0-rc6-next-20170822-00008-g52a8e57512ae #13 >> task: ffff8009768a0000 task.stack: ffff000008038000 >> PC is at tegra_get_chip_id+0x30/0x40 >> LR is at tegra_get_chip_id+0x30/0x40 >> tegra_get_chip_id+0x30/0x40 >> tegra_soc_device_register+0x68/0xd0 >> tegra_init_soc+0x10/0x44 >> do_one_initcall+0x38/0x120 >> kernel_init_freeable+0x184/0x224 >> kernel_init+0x10/0x100 >> ret_from_fork+0x10/0x18 > > Indeed. Does the below patch fix this? > Yes, it does. -- Regards, Sudeep ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] soc/tegra: Register SoC device 2017-08-22 11:19 ` Thierry Reding 2017-08-22 15:00 ` Sudeep Holla @ 2017-08-23 8:49 ` Arnd Bergmann [not found] ` <CAK8P3a0XHobGzSzP4w5zCJNZ-v2bmZ8yFPs0PudD9XMETJDJdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Arnd Bergmann @ 2017-08-23 8:49 UTC (permalink / raw) To: Thierry Reding Cc: Sudeep Holla, open list:TEGRA ARCHITECTURE SUPPORT, Linux ARM, Jonathan Hunter On Tue, Aug 22, 2017 at 1:19 PM, Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On Tue, Aug 22, 2017 at 11:15:21AM +0100, Sudeep Holla wrote: >> >> >> On 17/08/17 15:42, Thierry Reding wrote: >> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >> > >> > Move this code from arch/arm/mach-tegra and make it common among 32-bit >> > and 64-bit Tegra SoCs. This is slightly complicated by the fact that on >> > 32-bit Tegra, the SoC device is used as the parent for all devices that >> > are instantiated from device tree. >> > >> >> This seem to be in linux-next and causing the below splat on my platform >> which is not Tegra :) >> >> WARNING: .... at drivers/soc/tegra/fuse/tegra-apbmisc.c:48 >> tegra_get_chip_id+0x30/0x40 >> Modules linked in: >> CPU: 2 PID: 1 Comm: swapper/0 Not tainted >> 4.13.0-rc6-next-20170822-00008-g52a8e57512ae #13 >> task: ffff8009768a0000 task.stack: ffff000008038000 >> PC is at tegra_get_chip_id+0x30/0x40 >> LR is at tegra_get_chip_id+0x30/0x40 >> tegra_get_chip_id+0x30/0x40 >> tegra_soc_device_register+0x68/0xd0 >> tegra_init_soc+0x10/0x44 >> do_one_initcall+0x38/0x120 >> kernel_init_freeable+0x184/0x224 >> kernel_init+0x10/0x100 >> ret_from_fork+0x10/0x18 > > Indeed. Does the below patch fix this? > > Thierry > > --- >8 --- > From 5706cacc2af5e4ef138d1cd9e1269ca4947a447f Mon Sep 17 00:00:00 2001 > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > Date: Tue, 22 Aug 2017 13:15:18 +0200 > Subject: [PATCH] soc/tegra: Restrict SoC device registration to Tegra > > Commit 8a46828e623c ("soc/tegra: Register SoC device") added an initcall > to register the SoC device on Tegra. However, that code is unrestricted > and will run on all platforms, causing unwanted warnings. > > Fix this by first checking that we're running on hardware that supports > the fuses block that we use to provide SoC information. > > Fixes: 8a46828e623c ("soc/tegra: Register SoC device") > Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> I just found the same thing by inspection after running into drivers/soc/tegra/fuse/fuse-tegra.c:360:0: error: expected ';' at end of input Please fix that as well. Lastly, I believe that tegra_init_fuse() has the same bug, it just doesn't lead to an Oops, just to a harmless warning message, but please add another check there, or combine the two checks in some form. Arnd ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <CAK8P3a0XHobGzSzP4w5zCJNZ-v2bmZ8yFPs0PudD9XMETJDJdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] soc/tegra: Register SoC device [not found] ` <CAK8P3a0XHobGzSzP4w5zCJNZ-v2bmZ8yFPs0PudD9XMETJDJdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-08-23 9:11 ` Thierry Reding 2017-08-23 9:21 ` Arnd Bergmann 0 siblings, 1 reply; 7+ messages in thread From: Thierry Reding @ 2017-08-23 9:11 UTC (permalink / raw) To: Arnd Bergmann Cc: Sudeep Holla, open list:TEGRA ARCHITECTURE SUPPORT, Linux ARM, Jonathan Hunter [-- Attachment #1: Type: text/plain, Size: 3220 bytes --] On Wed, Aug 23, 2017 at 10:49:36AM +0200, Arnd Bergmann wrote: > On Tue, Aug 22, 2017 at 1:19 PM, Thierry Reding > <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Tue, Aug 22, 2017 at 11:15:21AM +0100, Sudeep Holla wrote: > >> > >> > >> On 17/08/17 15:42, Thierry Reding wrote: > >> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > >> > > >> > Move this code from arch/arm/mach-tegra and make it common among 32-bit > >> > and 64-bit Tegra SoCs. This is slightly complicated by the fact that on > >> > 32-bit Tegra, the SoC device is used as the parent for all devices that > >> > are instantiated from device tree. > >> > > >> > >> This seem to be in linux-next and causing the below splat on my platform > >> which is not Tegra :) > >> > >> WARNING: .... at drivers/soc/tegra/fuse/tegra-apbmisc.c:48 > >> tegra_get_chip_id+0x30/0x40 > >> Modules linked in: > >> CPU: 2 PID: 1 Comm: swapper/0 Not tainted > >> 4.13.0-rc6-next-20170822-00008-g52a8e57512ae #13 > >> task: ffff8009768a0000 task.stack: ffff000008038000 > >> PC is at tegra_get_chip_id+0x30/0x40 > >> LR is at tegra_get_chip_id+0x30/0x40 > >> tegra_get_chip_id+0x30/0x40 > >> tegra_soc_device_register+0x68/0xd0 > >> tegra_init_soc+0x10/0x44 > >> do_one_initcall+0x38/0x120 > >> kernel_init_freeable+0x184/0x224 > >> kernel_init+0x10/0x100 > >> ret_from_fork+0x10/0x18 > > > > Indeed. Does the below patch fix this? > > > > Thierry > > > > --- >8 --- > > From 5706cacc2af5e4ef138d1cd9e1269ca4947a447f Mon Sep 17 00:00:00 2001 > > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > Date: Tue, 22 Aug 2017 13:15:18 +0200 > > Subject: [PATCH] soc/tegra: Restrict SoC device registration to Tegra > > > > Commit 8a46828e623c ("soc/tegra: Register SoC device") added an initcall > > to register the SoC device on Tegra. However, that code is unrestricted > > and will run on all platforms, causing unwanted warnings. > > > > Fix this by first checking that we're running on hardware that supports > > the fuses block that we use to provide SoC information. > > > > Fixes: 8a46828e623c ("soc/tegra: Register SoC device") > > Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > I just found the same thing by inspection after running into > > drivers/soc/tegra/fuse/fuse-tegra.c:360:0: error: expected ';' at end of input > > Please fix that as well. Done, though it's strange that I didn't see those errors. Are those compiler errors or sparse errors? I'll be sending out both patches right away. > Lastly, I believe that tegra_init_fuse() has the same bug, it just doesn't lead > to an Oops, just to a harmless warning message, but please add another > check there, or combine the two checks in some form. I don't think that's the case. The of_find_matching_node_and_match() should catch all non-Tegra cases, and the backward-compatibility fallback has an extra check on the SoC compatible. See the comment on lines 295-298. That code is fairly old and I haven't seen anybody bring up any errors on non-Tegra platforms for that particular piece. Thanks, Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] soc/tegra: Register SoC device 2017-08-23 9:11 ` Thierry Reding @ 2017-08-23 9:21 ` Arnd Bergmann 0 siblings, 0 replies; 7+ messages in thread From: Arnd Bergmann @ 2017-08-23 9:21 UTC (permalink / raw) To: Thierry Reding Cc: open list:TEGRA ARCHITECTURE SUPPORT, Jonathan Hunter, Linux ARM, Sudeep Holla On Wed, Aug 23, 2017 at 11:11 AM, Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On Wed, Aug 23, 2017 at 10:49:36AM +0200, Arnd Bergmann wrote: >> On Tue, Aug 22, 2017 at 1:19 PM, Thierry Reding >> <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > On Tue, Aug 22, 2017 at 11:15:21AM +0100, Sudeep Holla wrote: >> >> >> >> >> >> On 17/08/17 15:42, Thierry Reding wrote: >> >> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >> >> > >> >> > Move this code from arch/arm/mach-tegra and make it common among 32-bit >> >> > and 64-bit Tegra SoCs. This is slightly complicated by the fact that on >> >> > 32-bit Tegra, the SoC device is used as the parent for all devices that >> >> > are instantiated from device tree. >> >> > >> >> >> >> This seem to be in linux-next and causing the below splat on my platform >> >> which is not Tegra :) >> >> >> >> WARNING: .... at drivers/soc/tegra/fuse/tegra-apbmisc.c:48 >> >> tegra_get_chip_id+0x30/0x40 >> >> Modules linked in: >> >> CPU: 2 PID: 1 Comm: swapper/0 Not tainted >> >> 4.13.0-rc6-next-20170822-00008-g52a8e57512ae #13 >> >> task: ffff8009768a0000 task.stack: ffff000008038000 >> >> PC is at tegra_get_chip_id+0x30/0x40 >> >> LR is at tegra_get_chip_id+0x30/0x40 >> >> tegra_get_chip_id+0x30/0x40 >> >> tegra_soc_device_register+0x68/0xd0 >> >> tegra_init_soc+0x10/0x44 >> >> do_one_initcall+0x38/0x120 >> >> kernel_init_freeable+0x184/0x224 >> >> kernel_init+0x10/0x100 >> >> ret_from_fork+0x10/0x18 >> > >> > Indeed. Does the below patch fix this? >> > >> > Thierry >> > >> > --- >8 --- >> > From 5706cacc2af5e4ef138d1cd9e1269ca4947a447f Mon Sep 17 00:00:00 2001 >> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >> > Date: Tue, 22 Aug 2017 13:15:18 +0200 >> > Subject: [PATCH] soc/tegra: Restrict SoC device registration to Tegra >> > >> > Commit 8a46828e623c ("soc/tegra: Register SoC device") added an initcall >> > to register the SoC device on Tegra. However, that code is unrestricted >> > and will run on all platforms, causing unwanted warnings. >> > >> > Fix this by first checking that we're running on hardware that supports >> > the fuses block that we use to provide SoC information. >> > >> > Fixes: 8a46828e623c ("soc/tegra: Register SoC device") >> > Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >> >> I just found the same thing by inspection after running into >> >> drivers/soc/tegra/fuse/fuse-tegra.c:360:0: error: expected ';' at end of input >> >> Please fix that as well. > > Done, though it's strange that I didn't see those errors. Are those > compiler errors or sparse errors? It's from the compiler. I just upgraded to gcc-8, which might explain it, or it could be configuration (module/built-in) dependent. > I'll be sending out both patches right away. Thanks! >> Lastly, I believe that tegra_init_fuse() has the same bug, it just doesn't lead >> to an Oops, just to a harmless warning message, but please add another >> check there, or combine the two checks in some form. > > I don't think that's the case. The of_find_matching_node_and_match() > should catch all non-Tegra cases, and the backward-compatibility > fallback has an extra check on the SoC compatible. See the comment on > lines 295-298. > > That code is fairly old and I haven't seen anybody bring up any errors > on non-Tegra platforms for that particular piece. My mistake, I see how it works now. Thanks for checking. Arnd ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-08-23 9:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 14:42 [PATCH] soc/tegra: Register SoC device Thierry Reding
[not found] ` <20170817144217.31346-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-22 10:15 ` Sudeep Holla
[not found] ` <61dde661-313f-0b51-233b-ce957c514a55-5wv7dgnIgG8@public.gmane.org>
2017-08-22 11:19 ` Thierry Reding
2017-08-22 15:00 ` Sudeep Holla
2017-08-23 8:49 ` Arnd Bergmann
[not found] ` <CAK8P3a0XHobGzSzP4w5zCJNZ-v2bmZ8yFPs0PudD9XMETJDJdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-23 9:11 ` Thierry Reding
2017-08-23 9:21 ` Arnd Bergmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox