Skip to contentSkip to conversation

ARM: coresight: fix system halt when etm enable and add nosmp to command line

PATCH New Frank.Li at freescale.com 4 participants 5 messages Feb 19, 2015 – Mar 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: coresight: fix system halt when etm enable and add nosmp to command line

From: Frank Li <[email protected]>

when nosmp set, only 1 core enabled. try to access disable core will halt. dts need added arm,primecell-periphid = <id> for none-boot core otherwise amba_device_add will halt when read peripheral id.

---
Change from v1 to v2
- fixed typo

 drivers/coresight/coresight-etm3x.c | 4 ++++
 drivers/coresight/of_coresight.c    | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/coresight/coresight-etm3x.c +4 -0
index 73c3669..d312952 100644
@@ -1829,6 +1829,10 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
 		return ret;
 
 	drvdata->cpu = pdata ? pdata->cpu : 0;
+	if (drvdata->cpu < 0) {
+		ret = -EINVAL;
+		goto err_arch_supported;
+	}
 
 	get_online_cpus();
 	etmdrvdata[drvdata->cpu] = drvdata;
drivers/coresight/of_coresight.c +1 -2
index c3efa41..6804bbd 100644
@@ -196,8 +196,7 @@ struct coresight_platform_data *of_get_coresight_platform_data(
 		if (cell) {
 			hwid = of_read_number(cell, of_n_addr_cells(dn));
 			index = get_logical_index(hwid);
-			if (index != -EINVAL)
-				pdata->cpu = index;
+			pdata->cpu = index;
 		}
 	}
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 ARM: coresight: fix system halt when etm enable and add nosmp to command line

Hi Frank,

Quoted 7 lines · Frank.Li at freescale.com

From: Frank Li <[email protected]>

when nosmp set, only 1 core enabled. try to access disable core will halt. dts need added arm,primecell-periphid = <id> for none-boot core otherwise amba_device_add will halt when read peripheral id.

Just out of interest: Do you have the coresight patches working on i.MX6, now?

I.e. is

http://www.spinics.net/lists/arm-kernel/msg397864.html

clarified, now?

Best regards

Dirk

#2 lore raw

PATCH v2 1/1 ARM: coresight: fix system halt when etm enable and add nosmp to command line

Quoted 10 lines · Dirk Behme

Hi Frank,

Quoted 7 lines · Frank.Li at freescale.com

From: Frank Li <[email protected]>

when nosmp set, only 1 core enabled. try to access disable core will halt. dts need added arm,primecell-periphid = <id> for none-boot core otherwise amba_device_add will halt when read peripheral id.

Quoted 6 lines
Quoted 1 line

Just out of interest: Do you have the coresight patches working on i.MX6, now?

No, i.MX6 have bugs about coresight.
I worked at MX7.

best regards
Frank Li

Quoted 10 lines

I.e. is

http://www.spinics.net/lists/arm-kernel/msg397864.html

clarified, now?

Best regards

Dirk

#3 lore raw

PATCH v2 1/1 ARM: coresight: fix system halt when etm enable and add nosmp to command line

In reply to Frank.Li at freescale.com
Quoted 45 lines · On 19 February 2015 at 06:57, <[email protected]> wrote:

From: Frank Li <[email protected]>

when nosmp set, only 1 core enabled. try to access disable core will halt. dts need added arm,primecell-periphid = <id> for none-boot core otherwise amba_device_add will halt when read peripheral id.

---
Change from v1 to v2
- fixed typo

 drivers/coresight/coresight-etm3x.c | 4 ++++
 drivers/coresight/of_coresight.c    | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/coresight/coresight-etm3x.c +4 -0
index 73c3669..d312952 100644
@@ -1829,6 +1829,10 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
                return ret;
 
        drvdata->cpu = pdata ? pdata->cpu : 0;
+       if (drvdata->cpu < 0) {
+               ret = -EINVAL;
+               goto err_arch_supported;
+       }
 
        get_online_cpus();
        etmdrvdata[drvdata->cpu] = drvdata;
drivers/coresight/of_coresight.c +1 -3
index c3efa41..6804bbd 100644
@@ -196,8 +196,7 @@ struct coresight_platform_data *of_get_coresight_platform_data(
                if (cell) {
                        hwid = of_read_number(cell, of_n_addr_cells(dn));
                        index = get_logical_index(hwid);
-                       if (index != -EINVAL)
-                               pdata->cpu = index;
+                       pdata->cpu = index;
                }
        }
 
--
Quoted 2 lines

1.9.1

Frank,

Thanks for your submission - this is a valid scenario. On the flip side things have changed in "of_get_coresight_platform_data()" and your patch's logic doesn't apply. Go look at my next branch [1] - we are now using "of_get_cpu_node()" so that things work on 64-bit implementations.

Keep what you've done in "etm_probe()" but you will have to re-work the other part - meddling with "cpu_online()" would be my first choice...

Lastly please improve the commit log. Adding a peripheral ID in the DTS will indeed prevent AMBA from proving a non-responsive memory area but it is not the point of the patch itself.

Thanks,
Mathieu

[1]. https://git.linaro.org/kernel/coresight.git/shortlog/refs/heads/next

#4 lore raw

PATCH v2 1/1 ARM: coresight: fix system halt when etm enable and add nosmp to command line

Quoted 51 lines · Mathieu Poirier
Quoted 45 lines · On 19 February 2015 at 06:57, <[email protected]> wrote:

From: Frank Li <[email protected]>

when nosmp set, only 1 core enabled. try to access disable core will halt. dts need added arm,primecell-periphid = <id> for none-boot core otherwise amba_device_add will halt when read peripheral id.

---
Change from v1 to v2
- fixed typo

 drivers/coresight/coresight-etm3x.c | 4 ++++
 drivers/coresight/of_coresight.c    | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/coresight/coresight-etm3x.c +4 -0
index 73c3669..d312952 100644
@@ -1829,6 +1829,10 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
                return ret;
 
        drvdata->cpu = pdata ? pdata->cpu : 0;
+       if (drvdata->cpu < 0) {
+               ret = -EINVAL;
+               goto err_arch_supported;
+       }
 
        get_online_cpus();
        etmdrvdata[drvdata->cpu] = drvdata;
drivers/coresight/of_coresight.c +1 -3
index c3efa41..6804bbd 100644
@@ -196,8 +196,7 @@ struct coresight_platform_data *of_get_coresight_platform_data(
                if (cell) {
                        hwid = of_read_number(cell, of_n_addr_cells(dn));
                        index = get_logical_index(hwid);
-                       if (index != -EINVAL)
-                               pdata->cpu = index;
+                       pdata->cpu = index;
                }
        }
 
--
Quoted 2 lines

1.9.1

Frank,

Quoted 5 lines

Thanks for your submission - this is a valid scenario. On the flip side things have changed in "of_get_coresight_platform_data()" and your patch's logic doesn't apply. Go look at my next branch [1] - we are now using "of_get_cpu_node()" so that things work on 64-bit implementations.

Okay I will rebase to you next branch.

Quoted 4 lines

Keep what you've done in "etm_probe()" but you will have to re-work the other part - meddling with "cpu_online()" would be my first choice...

of_get_cpu_node may return NULL if core is not exist. I will test it when I get hardware.
pdata->cpu will always return 0 if nosmp.

Quoted 4 lines

Lastly please improve the commit log. Adding a peripheral ID in the DTS will indeed prevent AMBA from proving a non-responsive memory area but it is not the point of the patch itself.

Our imx7 just come out. dts part have not upstream yet. So I just sent out coresight part change.

Quoted 5 lines

Thanks,
Mathieu

[1]. https://git.linaro.org/kernel/coresight.git/shortlog/refs/heads/next