* [PATCH] ARC: Fix ICCM & DCCM runtime size checks
@ 2020-04-02 17:54 ` Eugeniy Paltsev
0 siblings, 0 replies; 4+ messages in thread
From: Eugeniy Paltsev @ 2020-04-02 17:54 UTC (permalink / raw)
To: linux-snps-arc, Vineet Gupta
Cc: linux-kernel, Alexey Brodkin, Eugeniy Paltsev
As of today the ICCM and DCCM size checks are incorrectly using
mismatched units (KiB checked against bytes). The CONFIG_ARC_DCCM_SZ
and CONFIG_ARC_ICCM_SZ are in KiB, but the size calculated in
runtime and stored in cpu->dccm.sz and cpu->iccm.sz is in bytes.
Fix that.
Reported-by: Paul Greco <pmgreco@us.ibm.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
arch/arc/kernel/setup.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index aa41af6ef4ac..efdedf83b954 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -11,6 +11,7 @@
#include <linux/clocksource.h>
#include <linux/console.h>
#include <linux/module.h>
+#include <linux/sizes.h>
#include <linux/cpu.h>
#include <linux/of_clk.h>
#include <linux/of_fdt.h>
@@ -409,12 +410,12 @@ static void arc_chk_core_config(void)
if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
panic("Linux built with incorrect DCCM Base address\n");
- if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
+ if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
panic("Linux built with incorrect DCCM Size\n");
#endif
#ifdef CONFIG_ARC_HAS_ICCM
- if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
+ if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
panic("Linux built with incorrect ICCM Size\n");
#endif
--
2.21.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARC: Fix ICCM & DCCM runtime size checks
@ 2020-04-02 17:54 ` Eugeniy Paltsev
0 siblings, 0 replies; 4+ messages in thread
From: Eugeniy Paltsev @ 2020-04-02 17:54 UTC (permalink / raw)
To: linux-snps-arc, Vineet Gupta
Cc: Alexey Brodkin, Eugeniy Paltsev, linux-kernel
As of today the ICCM and DCCM size checks are incorrectly using
mismatched units (KiB checked against bytes). The CONFIG_ARC_DCCM_SZ
and CONFIG_ARC_ICCM_SZ are in KiB, but the size calculated in
runtime and stored in cpu->dccm.sz and cpu->iccm.sz is in bytes.
Fix that.
Reported-by: Paul Greco <pmgreco@us.ibm.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
arch/arc/kernel/setup.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index aa41af6ef4ac..efdedf83b954 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -11,6 +11,7 @@
#include <linux/clocksource.h>
#include <linux/console.h>
#include <linux/module.h>
+#include <linux/sizes.h>
#include <linux/cpu.h>
#include <linux/of_clk.h>
#include <linux/of_fdt.h>
@@ -409,12 +410,12 @@ static void arc_chk_core_config(void)
if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
panic("Linux built with incorrect DCCM Base address\n");
- if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
+ if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
panic("Linux built with incorrect DCCM Size\n");
#endif
#ifdef CONFIG_ARC_HAS_ICCM
- if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
+ if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
panic("Linux built with incorrect ICCM Size\n");
#endif
--
2.21.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ARC: Fix ICCM & DCCM runtime size checks
2020-04-02 17:54 ` Eugeniy Paltsev
@ 2020-04-03 22:00 ` Vineet Gupta
-1 siblings, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2020-04-03 22:00 UTC (permalink / raw)
To: Eugeniy Paltsev, linux-snps-arc; +Cc: linux-kernel, Alexey Brodkin
On 4/2/20 10:54 AM, Eugeniy Paltsev wrote:
> As of today the ICCM and DCCM size checks are incorrectly using
> mismatched units (KiB checked against bytes). The CONFIG_ARC_DCCM_SZ
> and CONFIG_ARC_ICCM_SZ are in KiB, but the size calculated in
> runtime and stored in cpu->dccm.sz and cpu->iccm.sz is in bytes.
>
> Fix that.
>
> Reported-by: Paul Greco <pmgreco@us.ibm.com>
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
LGTM. Will be added after merge window !
Thx,
-Vineet
> ---
> arch/arc/kernel/setup.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
> index aa41af6ef4ac..efdedf83b954 100644
> --- a/arch/arc/kernel/setup.c
> +++ b/arch/arc/kernel/setup.c
> @@ -11,6 +11,7 @@
> #include <linux/clocksource.h>
> #include <linux/console.h>
> #include <linux/module.h>
> +#include <linux/sizes.h>
> #include <linux/cpu.h>
> #include <linux/of_clk.h>
> #include <linux/of_fdt.h>
> @@ -409,12 +410,12 @@ static void arc_chk_core_config(void)
> if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
> panic("Linux built with incorrect DCCM Base address\n");
>
> - if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
> + if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
> panic("Linux built with incorrect DCCM Size\n");
> #endif
>
> #ifdef CONFIG_ARC_HAS_ICCM
> - if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
> + if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
> panic("Linux built with incorrect ICCM Size\n");
> #endif
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARC: Fix ICCM & DCCM runtime size checks
@ 2020-04-03 22:00 ` Vineet Gupta
0 siblings, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2020-04-03 22:00 UTC (permalink / raw)
To: Eugeniy Paltsev, linux-snps-arc; +Cc: Alexey Brodkin, linux-kernel
On 4/2/20 10:54 AM, Eugeniy Paltsev wrote:
> As of today the ICCM and DCCM size checks are incorrectly using
> mismatched units (KiB checked against bytes). The CONFIG_ARC_DCCM_SZ
> and CONFIG_ARC_ICCM_SZ are in KiB, but the size calculated in
> runtime and stored in cpu->dccm.sz and cpu->iccm.sz is in bytes.
>
> Fix that.
>
> Reported-by: Paul Greco <pmgreco@us.ibm.com>
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
LGTM. Will be added after merge window !
Thx,
-Vineet
> ---
> arch/arc/kernel/setup.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
> index aa41af6ef4ac..efdedf83b954 100644
> --- a/arch/arc/kernel/setup.c
> +++ b/arch/arc/kernel/setup.c
> @@ -11,6 +11,7 @@
> #include <linux/clocksource.h>
> #include <linux/console.h>
> #include <linux/module.h>
> +#include <linux/sizes.h>
> #include <linux/cpu.h>
> #include <linux/of_clk.h>
> #include <linux/of_fdt.h>
> @@ -409,12 +410,12 @@ static void arc_chk_core_config(void)
> if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
> panic("Linux built with incorrect DCCM Base address\n");
>
> - if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
> + if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
> panic("Linux built with incorrect DCCM Size\n");
> #endif
>
> #ifdef CONFIG_ARC_HAS_ICCM
> - if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
> + if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
> panic("Linux built with incorrect ICCM Size\n");
> #endif
>
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-03 22:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 17:54 [PATCH] ARC: Fix ICCM & DCCM runtime size checks Eugeniy Paltsev
2020-04-02 17:54 ` Eugeniy Paltsev
2020-04-03 22:00 ` Vineet Gupta
2020-04-03 22:00 ` Vineet Gupta
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.