Skip to content

Commit 4e00c5a

Browse files
lsgunthtorvalds
authored andcommitted
powerpc/mm: thread pgprot_t through create_section_mapping()
In prepartion to support a pgprot_t argument for arch_add_memory(). Signed-off-by: Logan Gunthorpe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dan Williams <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Eric Badger <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 30796e1 commit 4e00c5a

File tree

7 files changed

+27
-17
lines changed

7 files changed

+27
-17
lines changed

arch/powerpc/include/asm/book3s/64/hash.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
251251
extern void hash__vmemmap_remove_mapping(unsigned long start,
252252
unsigned long page_size);
253253

254-
int hash__create_section_mapping(unsigned long start, unsigned long end, int nid);
254+
int hash__create_section_mapping(unsigned long start, unsigned long end,
255+
int nid, pgprot_t prot);
255256
int hash__remove_section_mapping(unsigned long start, unsigned long end);
256257

257258
#endif /* !__ASSEMBLY__ */

arch/powerpc/include/asm/book3s/64/radix.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ static inline unsigned long radix__get_tree_size(void)
294294
}
295295

296296
#ifdef CONFIG_MEMORY_HOTPLUG
297-
int radix__create_section_mapping(unsigned long start, unsigned long end, int nid);
297+
int radix__create_section_mapping(unsigned long start, unsigned long end,
298+
int nid, pgprot_t prot);
298299
int radix__remove_section_mapping(unsigned long start, unsigned long end);
299300
#endif /* CONFIG_MEMORY_HOTPLUG */
300301
#endif /* __ASSEMBLY__ */

arch/powerpc/include/asm/sparsemem.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
#endif /* CONFIG_SPARSEMEM */
1414

1515
#ifdef CONFIG_MEMORY_HOTPLUG
16-
extern int create_section_mapping(unsigned long start, unsigned long end, int nid);
16+
extern int create_section_mapping(unsigned long start, unsigned long end,
17+
int nid, pgprot_t prot);
1718
extern int remove_section_mapping(unsigned long start, unsigned long end);
1819

1920
#ifdef CONFIG_PPC_BOOK3S_64

arch/powerpc/mm/book3s64/hash_utils.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,8 @@ int resize_hpt_for_hotplug(unsigned long new_mem_size)
809809
return 0;
810810
}
811811

812-
int hash__create_section_mapping(unsigned long start, unsigned long end, int nid)
812+
int hash__create_section_mapping(unsigned long start, unsigned long end,
813+
int nid, pgprot_t prot)
813814
{
814815
int rc;
815816

@@ -819,7 +820,7 @@ int hash__create_section_mapping(unsigned long start, unsigned long end, int nid
819820
}
820821

821822
rc = htab_bolt_mapping(start, end, __pa(start),
822-
pgprot_val(PAGE_KERNEL), mmu_linear_psize,
823+
pgprot_val(prot), mmu_linear_psize,
823824
mmu_kernel_ssize);
824825

825826
if (rc < 0) {

arch/powerpc/mm/book3s64/pgtable.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,13 @@ void mmu_cleanup_all(void)
171171
}
172172

173173
#ifdef CONFIG_MEMORY_HOTPLUG
174-
int __meminit create_section_mapping(unsigned long start, unsigned long end, int nid)
174+
int __meminit create_section_mapping(unsigned long start, unsigned long end,
175+
int nid, pgprot_t prot)
175176
{
176177
if (radix_enabled())
177-
return radix__create_section_mapping(start, end, nid);
178+
return radix__create_section_mapping(start, end, nid, prot);
178179

179-
return hash__create_section_mapping(start, end, nid);
180+
return hash__create_section_mapping(start, end, nid, prot);
180181
}
181182

182183
int __meminit remove_section_mapping(unsigned long start, unsigned long end)

arch/powerpc/mm/book3s64/radix_pgtable.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static unsigned long next_boundary(unsigned long addr, unsigned long end)
254254

255255
static int __meminit create_physical_mapping(unsigned long start,
256256
unsigned long end,
257-
int nid)
257+
int nid, pgprot_t _prot)
258258
{
259259
unsigned long vaddr, addr, mapping_size = 0;
260260
bool prev_exec, exec = false;
@@ -290,7 +290,7 @@ static int __meminit create_physical_mapping(unsigned long start,
290290
prot = PAGE_KERNEL_X;
291291
exec = true;
292292
} else {
293-
prot = PAGE_KERNEL;
293+
prot = _prot;
294294
exec = false;
295295
}
296296

@@ -334,7 +334,7 @@ static void __init radix_init_pgtable(void)
334334

335335
WARN_ON(create_physical_mapping(reg->base,
336336
reg->base + reg->size,
337-
-1));
337+
-1, PAGE_KERNEL));
338338
}
339339

340340
/* Find out how many PID bits are supported */
@@ -713,8 +713,10 @@ static int __meminit stop_machine_change_mapping(void *data)
713713

714714
spin_unlock(&init_mm.page_table_lock);
715715
pte_clear(&init_mm, params->aligned_start, params->pte);
716-
create_physical_mapping(__pa(params->aligned_start), __pa(params->start), -1);
717-
create_physical_mapping(__pa(params->end), __pa(params->aligned_end), -1);
716+
create_physical_mapping(__pa(params->aligned_start),
717+
__pa(params->start), -1, PAGE_KERNEL);
718+
create_physical_mapping(__pa(params->end), __pa(params->aligned_end),
719+
-1, PAGE_KERNEL);
718720
spin_lock(&init_mm.page_table_lock);
719721
return 0;
720722
}
@@ -871,14 +873,16 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end)
871873
radix__flush_tlb_kernel_range(start, end);
872874
}
873875

874-
int __meminit radix__create_section_mapping(unsigned long start, unsigned long end, int nid)
876+
int __meminit radix__create_section_mapping(unsigned long start,
877+
unsigned long end, int nid,
878+
pgprot_t prot)
875879
{
876880
if (end >= RADIX_VMALLOC_START) {
877881
pr_warn("Outside the supported range\n");
878882
return -1;
879883
}
880884

881-
return create_physical_mapping(__pa(start), __pa(end), nid);
885+
return create_physical_mapping(__pa(start), __pa(end), nid, prot);
882886
}
883887

884888
int __meminit radix__remove_section_mapping(unsigned long start, unsigned long end)

arch/powerpc/mm/mem.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ int memory_add_physaddr_to_nid(u64 start)
9090
}
9191
#endif
9292

93-
int __weak create_section_mapping(unsigned long start, unsigned long end, int nid)
93+
int __weak create_section_mapping(unsigned long start, unsigned long end,
94+
int nid, pgprot_t prot)
9495
{
9596
return -ENODEV;
9697
}
@@ -131,7 +132,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
131132
resize_hpt_for_hotplug(memblock_phys_mem_size());
132133

133134
start = (unsigned long)__va(start);
134-
rc = create_section_mapping(start, start + size, nid);
135+
rc = create_section_mapping(start, start + size, nid, PAGE_KERNEL);
135136
if (rc) {
136137
pr_warn("Unable to create mapping for hot added memory 0x%llx..0x%llx: %d\n",
137138
start, start + size, rc);

0 commit comments

Comments
 (0)