Skip to contentSkip to conversation

riscv: Fix implicit declaration of 'page_to_section'

PATCH In review Kefeng Wang 3 participants 7 messages Oct 23, 2019 – Oct 24, 2019 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 riscv: Fix implicit declaration of 'page_to_section'

With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,

arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]

  int __sec = page_to_section(__pg);   \
              ^~~~~~~~~~~~~~~

Fixed by changing mk_pte() from inline function to macro.

Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")
---
 arch/riscv/include/asm/pgtable.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/riscv/include/asm/pgtable.h +1 -4
index 42292d99cc74..1db2144f9221 100644
@@ -184,10 +184,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
 	return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
 }
 
-static inline pte_t mk_pte(struct page *page, pgprot_t prot)
-{
-	return pfn_pte(page_to_pfn(page), prot);
-}
+#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
 
 #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
Signature · 7 lines
2.20.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

PATCH 2/2 riscv: Fix undefined reference to vmemmap_populate_basepages

Using CONFIG_SPARSEMEM_VMEMMAP instead of CONFIG_SPARSEMEM to fix following build issue.

riscv64-linux-ld: arch/riscv/mm/init.o: in function 'vmemmap_populate':
init.c:(.meminit.text+0x8): undefined reference to 'vmemmap_populate_basepages'

Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")
---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +1 -1
index 83f7d12042fb..a1ca6200c31f 100644
@@ -458,7 +458,7 @@ void __init paging_init(void)
 	zone_sizes_init();
 }
 
-#ifdef CONFIG_SPARSEMEM
+#ifdef CONFIG_SPARSEMEM_VMEMMAP
 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
 			       struct vmem_altmap *altmap)
 {
Signature · 7 lines
2.20.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] riscv: Fix undefined reference to vmemmap_populate_basepages

Quoted 9 lines · Kefeng Wang

Using CONFIG_SPARSEMEM_VMEMMAP instead of CONFIG_SPARSEMEM to fix following build issue.

riscv64-linux-ld: arch/riscv/mm/init.o: in function 'vmemmap_populate':
init.c:(.meminit.text+0x8): undefined reference to 'vmemmap_populate_basepages'

Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")

Yup!

Quoted 10 lines
---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +0 -0
index 83f7d12042fb..a1ca6200c31f 100644

arch/riscv/mm/init.c void __init paging_init(void) · line 464

Quoted 8 lines
arch/riscv/mm/init.c +1 -1
@@ -458,7 +458,7 @@ void __init paging_init(void)
 	zone_sizes_init();
 }
 
-#ifdef CONFIG_SPARSEMEM
+#ifdef CONFIG_SPARSEMEM_VMEMMAP
 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
 			       struct vmem_altmap *altmap)
 {

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#3 lore raw

Re: [PATCH 2/2] riscv: Fix undefined reference to vmemmap_populate_basepages

Quoted 7 lines · Logan Gunthorpe
Quoted 6 lines · Kefeng Wang

Using CONFIG_SPARSEMEM_VMEMMAP instead of CONFIG_SPARSEMEM to fix following build issue.

riscv64-linux-ld: arch/riscv/mm/init.o: in function 'vmemmap_populate':
init.c:(.meminit.text+0x8): undefined reference to 'vmemmap_populate_basepages'

Quoted 7 lines
Quoted 3 lines
Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")

Yup!

Thanks, queued for v5.4-rc.

- Paul

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Reviewed-by on v1 1/2
#4 lore raw
In reply to Kefeng Wang
Quoted 4 lines · Kefeng Wang

With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,

arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]

Quoted 8 lines
  int __sec = page_to_section(__pg);   \
              ^~~~~~~~~~~~~~~

Fixed by changing mk_pte() from inline function to macro.

Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")

Makes sense.

Quoted 11 lines
---
 arch/riscv/include/asm/pgtable.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/riscv/include/asm/pgtable.h +0 -0
index 42292d99cc74..1db2144f9221 100644
@@ -184,10 +184,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
 	return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));

arch/riscv/include/asm/pgtable.h static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) · line 190

Quoted 10 lines
arch/riscv/include/asm/pgtable.h +1 -4
 }
 
-static inline pte_t mk_pte(struct page *page, pgprot_t prot)
-{
-	return pfn_pte(page_to_pfn(page), prot);
-}
+#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
 
 #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#5 lore raw
In reply to Kefeng Wang
Quoted 4 lines · Kefeng Wang

With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,

arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]

Quoted 8 lines
  int __sec = page_to_section(__pg);   \
              ^~~~~~~~~~~~~~~

Fixed by changing mk_pte() from inline function to macro.

Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")

Thanks for the fix, but this patch adds checkpatch errors:

---
ERROR: space required after that ',' (ctx:VxV)
#37: FILE: arch/riscv/include/asm/pgtable.h:187:
+#define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot)

                    ^

ERROR: space required after that ',' (ctx:VxV)
#37: FILE: arch/riscv/include/asm/pgtable.h:187:
+#define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot)

                                                          ^

total: 2 errors, 0 warnings, 0 checks, 11 lines checked
---

Please run 'checkpatch.pl --strict' on patches before submitting.

Anyway, these have been fixed up here and queued for v5.4-rc with Logan's Reviewed-by:.

- Paul

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#6 lore raw
Quoted 23 lines · Paul Walmsley
Quoted 4 lines · Kefeng Wang

With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,

arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]

Quoted 8 lines
  int __sec = page_to_section(__pg);   \
              ^~~~~~~~~~~~~~~

Fixed by changing mk_pte() from inline function to macro.

Cc Logan Gunthorpe <[email protected]>
Fixes d95f1a542c3d ("RISC-V: Implement sparsemem")

Thanks for the fix, but this patch adds checkpatch errors:

---
ERROR: space required after that ',' (ctx:VxV)
#37: FILE: arch/riscv/include/asm/pgtable.h:187:
+#define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot)

                    ^
Quoted 8 lines

ERROR: space required after that ',' (ctx:VxV)
#37: FILE: arch/riscv/include/asm/pgtable.h:187:
+#define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot)

                                                          ^

total: 2 errors, 0 warnings, 0 checks, 11 lines checked
---

oops.

Quoted 2 lines

Please run 'checkpatch.pl --strict' on patches before submitting.

Ok, will do next time.

Quoted 3 lines

Anyway, these have been fixed up here and queued for v5.4-rc with Logan's Reviewed-by:.

Thanks.

Quoted 3 lines

- Paul

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv