arc: some allmodconfig build fixes
v2 cover arc: some allmodconfig build fixes
From: Randy Dunlap <[email protected]>
Hi,
Here are a few patches that fix build errors or warnings that I encountered while doing arc "allmodconfig" builds.
These patches do not fix all of the build issues.
arch/arc/include/asm/delay.h | 3 +++ arch/arc/mm/cache.c | 7 ++++--- arch/arc/plat-eznps/include/plat/ctop.h | 1 + arch/arc/plat-eznps/mtm.c | 6 ++++-- 4 files changed, 12 insertions(+), 5 deletions(-)
PATCH v2 1/4 arc: fix build errors in arc/include/asm/delay.h
From: Randy Dunlap <[email protected]>
Fix build errors in arch/arc/'s delay.h:
- add "extern unsigned long loops_per_jiffy;"
- add <asm-generic/types.h> for "u64"
In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32:../arch/arc/include/asm/delay.h: In function '__udelay':../arch/arc/include/asm/delay.h:61:12: error: 'u64' undeclared (first use in this function)
loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
^~~In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32:../arch/arc/include/asm/delay.h: In function '__udelay':../arch/arc/include/asm/delay.h:63:37: error: 'loops_per_jiffy' undeclared (first use in this function)
loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
^~~~~~~~~~~~~~~---
v2: add extern for loops_per_jiffy instead of including <linux/delay.h>
for it
arch/arc/include/asm/delay.h | 3 +++ 1 file changed, 3 insertions(+)
arch/arc/include/asm/delay.h +3 -0
@@ -17,8 +17,11 @@#ifndef __ASM_ARC_UDELAY_H#define __ASM_ARC_UDELAY_H +#include <asm-generic/types.h> #include <asm/param.h> /* HZ */ +extern unsigned long loops_per_jiffy; +static inline void __delay (unsigned long loops) { __asm__ __volatile__(
PATCH v2 2/4 arc: fix type warnings in arc/mm/cache.c
In reply to rd_dunlabFrom: Randy Dunlap <[email protected]>
Fix type warnings in arch/arc/mm/cache.c.
../arch/arc/mm/cache.c: In function 'flush_anon_page':../arch/arc/mm/cache.c:1062:55: warning: passing argument 2 of '__flush_dcache_page' makes integer from pointer without a cast [-Wint-conversion]
__flush_dcache_page((phys_addr_t)page_address(page), page_address(page));
^~~~~~~~~~~~~~~~~~
../arch/arc/mm/cache.c:1013:59: note: expected 'long unsigned int' but argument is of type 'void *'
void __flush_dcache_page(phys_addr_t paddr, unsigned long vaddr)
~~~~~~~~~~~~~~^~~~~---
v2: drop some spurious (accidental) patch lines
arch/arc/mm/cache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arc/mm/cache.c +4 -3
@@ -1038,7 +1038,7 @@ void flush_cache_mm(struct mm_struct *mmvoid flush_cache_page (struct vm_area_struct *vma,unsigned long u_vaddr,unsigned long pfn) { -unsigned int paddr = pfn <<PAGE_SHIFT ; +phys_addr_t paddr = pfn <<PAGE_SHIFT ; u_vaddr &=PAGE_MASK ;
@@ -1058,8 +1058,9 @@ void flush_anon_page(struct vm_area_stru unsigned long u_vaddr) {/* TBD: do we really need to clear the kernel mapping */ -__flush_dcache_page (page_address (page), u_vaddr); -__flush_dcache_page (page_address (page),page_address (page)); +__flush_dcache_page ((phys_addr_t )page_address (page), u_vaddr); +__flush_dcache_page ((phys_addr_t )page_address (page), + (phys_addr_t )page_address (page)); }
PATCH v2 3/4 arc: fix data type errors in platform headers
In reply to rd_dunlabFrom: Randy Dunlap <[email protected]>
Add <asm-generic/types.h> to fix build errors.
Both ctop.h and <soc/nps/common.h> use u32 types and cause many errors.
Examples:../include/soc/nps/common.h:71:4: error: unknown type name 'u32'
u32 __reserved:20, cluster:4, core:4, thread:4;
../include/soc/nps/common.h:76:3: error: unknown type name 'u32'
u32 value;
../include/soc/nps/common.h:124:4: error: unknown type name 'u32'
u32 base:8, cl_x:4, cl_y:4,../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
u32 value;
../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'
u32 gen:1, gdis:1, clk_gate_dis:1, asb:1,
../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32'
u32 value;
../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32'
u32 csa:22, dmsid:6, __reserved:3, cs:1;../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
u32 value;
---
v2: no change
arch/arc/plat-eznps/include/plat/ctop.h | 1 + 1 file changed, 1 insertion(+)
arch/arc/plat-eznps/include/plat/ctop.h +1 -0
@@ -21,6 +21,7 @@#error "Incorrect ctop.h include"#endif +#include <asm-generic/types.h> #include <soc/nps/common.h> /* core auxiliary registers */
Re: [PATCH 3/4 v2] arc: fix data type errors in platform headers
Quoted 40 lines · rd_dunlab
From: Randy Dunlap <rdunlap at infradead.org>
Add <
asm-generic/types.h> to fix build errors.
Bothctop.hand <soc/nps/common.h> use u32 types and cause many errors.Examples:
../include/soc/nps/common.h:71:4: error: unknown type name 'u32'u32 __reserved:20, cluster:4, core:4, thread:4; ../include/soc/nps/common.h:76:3: error: unknown type name 'u32' u32 value; ../include/soc/nps/common.h:124:4: error: unknown type name 'u32' u32 base:8, cl_x:4, cl_y:4,
../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
u32 value;
../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'u32 gen:1, gdis:1, clk_gate_dis:1, asb:1, ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32' u32 value; ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32' u32 csa:22, dmsid:6, __reserved:3, cs:1;
../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
u32 value;Signed-off-by Randy Dunlap <rdunlap at infradead.org>Cc Vineet Gupta <vgupta at synopsys.com>Cc linux-snps-arc at lists.infradead.orgCc Elad Kanfi <eladkan at mellanox.com>Cc Leon Romanovsky <leonro at mellanox.com>Cc Ofer Levi <oferle at mellanox.com>---
v2: no changearch/arc/plat-eznps/include/plat/ctop.h | 1 + 1 file changed, 1 insertion(+)
arch/arc/plat-eznps/include/plat/ctop.h line 24
Quoted 4 lines
arch/arc/plat-eznps/include/plat/ctop.h +1
-0@@ -21,6 +21,7 @@#error "Incorrect ctop.h include"#endif +#include <asm-generic/types.h>
I'm not familiar with arch/* code, so maybe my question will sound naive., but why "asm-generic/types.h" and not "linux/types.h"?
Thanks for fixing build.
Quoted 7 lines
arch/arc/plat-eznps/include/plat/ctop.h +0
-1#include <soc/nps/common.h> /* core auxiliary registers */ --
PATCH v3 3/4 arc: fix data type errors in platform headers
Quoted 44 lines · Leon Romanovsky
Quoted 43 lines · rd_dunlab
From: Randy Dunlap <rdunlap at infradead.org>
Add <
asm-generic/types.h> to fix build errors.
Bothctop.hand <soc/nps/common.h> use u32 types and cause many errors.Examples:
../include/soc/nps/common.h:71:4: error: unknown type name 'u32'u32 __reserved:20, cluster:4, core:4, thread:4; ../include/soc/nps/common.h:76:3: error: unknown type name 'u32' u32 value; ../include/soc/nps/common.h:124:4: error: unknown type name 'u32' u32 base:8, cl_x:4, cl_y:4,
../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
u32 value;
../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'u32 gen:1, gdis:1, clk_gate_dis:1, asb:1, ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32' u32 value; ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32' u32 csa:22, dmsid:6, __reserved:3, cs:1;
../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
u32 value;Signed-off-by Randy Dunlap <rdunlap at infradead.org>Cc Vineet Gupta <vgupta at synopsys.com>Cc linux-snps-arc at lists.infradead.orgCc Elad Kanfi <eladkan at mellanox.com>Cc Leon Romanovsky <leonro at mellanox.com>Cc Ofer Levi <oferle at mellanox.com>---
v2: no changearch/arc/plat-eznps/include/plat/ctop.h | 1 + 1 file changed, 1 insertion(+)arch/arc/plat-eznps/include/plat/ctop.h +0
-0@@ -21,6 +21,7 @@#error "Incorrect ctop.h include"#endif
Quoted 4 lines
arch/arc/plat-eznps/include/plat/ctop.h line 24
Quoted 1 line
arch/arc/plat-eznps/include/plat/ctop.h +1
-0+#include <asm-generic/types.h> I'm not familiar with
arch/*code, so maybe my question will sound naive., but why "asm-generic/types.h" and not "linux/types.h"?
Nope, good question. That works and should be preferred.
Please use the new patch below.
Signature · 48 lines
From: Randy Dunlap <[email protected]> Add <linux/types.h> to fix build errors. Both ctop.h and <soc/nps/common.h> use u32 types and cause many errors. Examples: ../include/soc/nps/common.h:71:4: error: unknown type name 'u32' u32 __reserved:20, cluster:4, core:4, thread:4; ../include/soc/nps/common.h:76:3: error: unknown type name 'u32' u32 value; ../include/soc/nps/common.h:124:4: error: unknown type name 'u32' u32 base:8, cl_x:4, cl_y:4, ../include/soc/nps/common.h:127:3: error: unknown type name 'u32' u32 value; ../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32' u32 gen:1, gdis:1, clk_gate_dis:1, asb:1, ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32' u32 value; ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32' u32 csa:22, dmsid:6, __reserved:3, cs:1; ../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32' u32 value; Signed-off-by: Randy Dunlap <rdunlap at infradead.org> Cc: Vineet Gupta <vgupta at synopsys.com> Cc: linux-snps-arc at lists.infradead.org Cc: Elad Kanfi <eladkan at mellanox.com> Cc: Leon Romanovsky <leonro at mellanox.com> Cc: Ofer Levi <oferle at mellanox.com> --- v2: no change v3: use <linux/types.h> instead of <asm-generic/types.h> arch/arc/plat-eznps/include/plat/ctop.h | 1 + 1 file changed, 1 insertion(+) --- linux-next-20180723.orig/arch/arc/plat-eznps/include/plat/ctop.h +++ linux-next-20180723/arch/arc/plat-eznps/include/plat/ctop.h @@ -21,6 +21,7 @@ #error "Incorrect ctop.h include" #endif +#include <linux/types.h> #include <soc/nps/common.h> /* core auxiliary registers */
Re: [PATCH 3/4 v3] arc: fix data type errors in platform headers
Quoted 87 lines · Randy Dunlap
Quoted 44 lines · Leon Romanovsky
Quoted 43 lines · rd_dunlab
From: Randy Dunlap <rdunlap at infradead.org>
Add <
asm-generic/types.h> to fix build errors.
Bothctop.hand <soc/nps/common.h> use u32 types and cause many errors.Examples:
../include/soc/nps/common.h:71:4: error: unknown type name 'u32'u32 __reserved:20, cluster:4, core:4, thread:4; ../include/soc/nps/common.h:76:3: error: unknown type name 'u32' u32 value; ../include/soc/nps/common.h:124:4: error: unknown type name 'u32' u32 base:8, cl_x:4, cl_y:4,
../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
u32 value;
../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'u32 gen:1, gdis:1, clk_gate_dis:1, asb:1, ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32' u32 value; ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32' u32 csa:22, dmsid:6, __reserved:3, cs:1;
../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
u32 value;Signed-off-by Randy Dunlap <rdunlap at infradead.org>Cc Vineet Gupta <vgupta at synopsys.com>Cc linux-snps-arc at lists.infradead.orgCc Elad Kanfi <eladkan at mellanox.com>Cc Leon Romanovsky <leonro at mellanox.com>Cc Ofer Levi <oferle at mellanox.com>---
v2: no changearch/arc/plat-eznps/include/plat/ctop.h | 1 + 1 file changed, 1 insertion(+)arch/arc/plat-eznps/include/plat/ctop.h +0
-0@@ -21,6 +21,7 @@#error "Incorrect ctop.h include"#endif Quoted 4 lines
arch/arc/plat-eznps/include/plat/ctop.h line 24
Quoted 1 line
arch/arc/plat-eznps/include/plat/ctop.h +1
-0+#include <asm-generic/types.h> I'm not familiar with
arch/*code, so maybe my question will sound naive., but why "asm-generic/types.h" and not "linux/types.h"?Nope, good question. That works and should be preferred.
Please use the new patch below.
--
From: Randy Dunlap <rdunlap at infradead.org>
Add <
linux/types.h> to fix build errors.
Bothctop.hand <soc/nps/common.h> use u32 types and cause many errors.Examples:
../include/soc/nps/common.h:71:4: error: unknown type name 'u32'u32 __reserved:20, cluster:4, core:4, thread:4; ../include/soc/nps/common.h:76:3: error: unknown type name 'u32' u32 value; ../include/soc/nps/common.h:124:4: error: unknown type name 'u32' u32 base:8, cl_x:4, cl_y:4,
../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
u32 value;
../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'u32 gen:1, gdis:1, clk_gate_dis:1, asb:1, ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32' u32 value; ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32' u32 csa:22, dmsid:6, __reserved:3, cs:1;
../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
u32 value;Signed-off-by Randy Dunlap <rdunlap at infradead.org>Cc Vineet Gupta <vgupta at synopsys.com>Cc linux-snps-arc at lists.infradead.orgCc Elad Kanfi <eladkan at mellanox.com>Cc Leon Romanovsky <leonro at mellanox.com>Cc Ofer Levi <oferle at mellanox.com>
Quoted 7 lines
---
v2: no change
v3: use <linux/types.h> instead of <asm-generic/types.h>arch/arc/plat-eznps/include/plat/ctop.h | 1 + 1 file changed, 1 insertion(+)
Thanks,
Reviewed-by: Leon Romanovsky <leonro at mellanox.com>
PATCH v2 4/4 arc: fix printk warning in arc/plat-eznps/mtm.c
In reply to rd_dunlabFrom: Randy Dunlap <[email protected]>
Fix printk format warning in arch/arc/plat-eznps/mtm.c:
In file included from ../include/linux/printk.h:7,
from ../include/linux/kernel.h:14,
from ../include/linux/list.h:9,
from ../include/linux/smp.h:12,
from ../arch/arc/plat-eznps/mtm.c:17:
../arch/arc/plat-eznps/mtm.c: In function 'set_mtm_hs_ctr':
../include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^~~~~~
../include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
../include/linux/printk.h:308:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~../arch/arc/plat-eznps/mtm.c:166:3: note: in expansion of macro 'pr_err'
pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n", ^~~~~~../arch/arc/plat-eznps/mtm.c:166:40: note: format string is defined here
pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
~^
%ldThe hs_ctr variable can just be int instead of long, so also change kstrtol() to kstrtoint() and leave the format string as %d.
Also add 2 header files since they are used in mtm.c and we prefer not to depend on accidental/indirect #includes.
---
v2: no change
arch/arc/plat-eznps/mtm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arc/plat-eznps/mtm.c +4 -2
@@ -15,6 +15,8 @@*/ #include <linux/smp.h> +#include <linux/init.h> +#include <linux/kernel.h> #include <linux/io.h> #include <linux/log2.h> #include <asm/arcregs.h>
@@ -157,10 +159,10 @@ void mtm_enable_core(unsigned int cpu)/* Verify and set the value of the mtm hs counter */ static int __init set_mtm_hs_ctr (char *ctr_str) { -long hs_ctr; +int hs_ctr;int ret; - ret =kstrtol (ctr_str,0 , &hs_ctr); + ret =kstrtoint (ctr_str,0 , &hs_ctr);if (ret || hs_ctr >MT_HS_CNT_MAX || hs_ctr <MT_HS_CNT_MIN ) { pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
Re: [PATCH 4/4 v2] arc: fix printk warning in arc/plat-eznps/mtm.c
Quoted 38 lines · rd_dunlab
From: Randy Dunlap <rdunlap at infradead.org>
Fix printk format warning in
arch/arc/plat-eznps/mtm.c:In file included from
../include/linux/printk.h:7,from ../include/linux/kernel.h:14, from ../include/linux/list.h:9, from ../include/linux/smp.h:12, from ../arch/arc/plat-eznps/mtm.c:17: ../arch/arc/plat-eznps/mtm.c: In function 'set_mtm_hs_ctr': ../include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^~~~~~ ../include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH' #define KERN_ERR KERN_SOH "3" /* error conditions */ ^~~~~~~~ ../include/linux/printk.h:308:9: note: in expansion of macro 'KERN_ERR' printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~
../arch/arc/plat-eznps/mtm.c:166:3: note: in expansion of macro 'pr_err'
pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n", ^~~~~~../arch/arc/plat-eznps/mtm.c:166:40: note: format string is defined here
pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",~^ %ldThe
hs_ctrvariable can just be int instead of long, so also changekstrtol()tokstrtoint()and leave the format string as %d.Also add 2 header files since they are used in
mtm.cand we prefer not to depend on accidental/indirect #includes.Signed-off-by Randy Dunlap <rdunlap at infradead.org>Cc Vineet Gupta <vgupta at synopsys.com>Cc linux-snps-arc at lists.infradead.orgCc Elad Kanfi <eladkan at mellanox.com>Cc Leon Romanovsky <leonro at mellanox.com>Cc Ofer Levi <oferle at mellanox.com>
Quoted 6 lines
---
v2: no changearch/arc/plat-eznps/mtm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks,
Reviewed-by: Leon Romanovsky <leonro at mellanox.com>