]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/mm: thread pgprot_t through create_section_mapping()
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 10 Apr 2020 21:33:32 +0000 (14:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Apr 2020 22:36:21 +0000 (15:36 -0700)
In prepartion to support a pgprot_t argument for arch_add_memory().

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Eric Badger <ebadger@gigaio.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Link: http://lkml.kernel.org/r/20200306170846.9333-6-logang@deltatee.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/include/asm/book3s/64/hash.h
arch/powerpc/include/asm/book3s/64/radix.h
arch/powerpc/include/asm/sparsemem.h
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/mm/book3s64/pgtable.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/mm/mem.c

index 2781ebf6add4fc6cfa98d124ba020c664c51743e..6fc4520092c7b51f68c7a64d822eee76488d4db1 100644 (file)
@@ -251,7 +251,8 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
 extern void hash__vmemmap_remove_mapping(unsigned long start,
                                     unsigned long page_size);
 
-int hash__create_section_mapping(unsigned long start, unsigned long end, int nid);
+int hash__create_section_mapping(unsigned long start, unsigned long end,
+                                int nid, pgprot_t prot);
 int hash__remove_section_mapping(unsigned long start, unsigned long end);
 
 #endif /* !__ASSEMBLY__ */
index a1c60d5b50af7db9fbc48dd70112e44e6ccadf97..08c222d5b764b48f285985e5de3d94d2d2144540 100644 (file)
@@ -294,7 +294,8 @@ static inline unsigned long radix__get_tree_size(void)
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
-int radix__create_section_mapping(unsigned long start, unsigned long end, int nid);
+int radix__create_section_mapping(unsigned long start, unsigned long end,
+                                 int nid, pgprot_t prot);
 int radix__remove_section_mapping(unsigned long start, unsigned long end);
 #endif /* CONFIG_MEMORY_HOTPLUG */
 #endif /* __ASSEMBLY__ */
index 3192d454a733ad6f31e9ecf2a702a6795ad1e1c1..c89b32443cff30ca3a902692b4bcdd172ca43229 100644 (file)
@@ -13,7 +13,8 @@
 #endif /* CONFIG_SPARSEMEM */
 
 #ifdef CONFIG_MEMORY_HOTPLUG
-extern int create_section_mapping(unsigned long start, unsigned long end, int nid);
+extern int create_section_mapping(unsigned long start, unsigned long end,
+                                 int nid, pgprot_t prot);
 extern int remove_section_mapping(unsigned long start, unsigned long end);
 
 #ifdef CONFIG_PPC_BOOK3S_64
index 7e5714a69a58426ba00ffcf7d4765fd82f808cb4..8ed2411c3f3956a10aacc9ea2915495cc50619f9 100644 (file)
@@ -809,7 +809,8 @@ int resize_hpt_for_hotplug(unsigned long new_mem_size)
        return 0;
 }
 
-int hash__create_section_mapping(unsigned long start, unsigned long end, int nid)
+int hash__create_section_mapping(unsigned long start, unsigned long end,
+                                int nid, pgprot_t prot)
 {
        int rc;
 
@@ -819,7 +820,7 @@ int hash__create_section_mapping(unsigned long start, unsigned long end, int nid
        }
 
        rc = htab_bolt_mapping(start, end, __pa(start),
-                              pgprot_val(PAGE_KERNEL), mmu_linear_psize,
+                              pgprot_val(prot), mmu_linear_psize,
                               mmu_kernel_ssize);
 
        if (rc < 0) {
index 2bf7e1b4fd826c858f5a0257ade0e642bfa7de54..e0bb69c616e4a2267dddb9da5e59574d06ea8b52 100644 (file)
@@ -171,12 +171,13 @@ void mmu_cleanup_all(void)
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
-int __meminit create_section_mapping(unsigned long start, unsigned long end, int nid)
+int __meminit create_section_mapping(unsigned long start, unsigned long end,
+                                    int nid, pgprot_t prot)
 {
        if (radix_enabled())
-               return radix__create_section_mapping(start, end, nid);
+               return radix__create_section_mapping(start, end, nid, prot);
 
-       return hash__create_section_mapping(start, end, nid);
+       return hash__create_section_mapping(start, end, nid, prot);
 }
 
 int __meminit remove_section_mapping(unsigned long start, unsigned long end)
index 2a9a0cd7949009fc1d4db61585f311bcf9814bc9..8f9edf07063ad53914d59b451cedcc0a99bb6417 100644 (file)
@@ -254,7 +254,7 @@ static unsigned long next_boundary(unsigned long addr, unsigned long end)
 
 static int __meminit create_physical_mapping(unsigned long start,
                                             unsigned long end,
-                                            int nid)
+                                            int nid, pgprot_t _prot)
 {
        unsigned long vaddr, addr, mapping_size = 0;
        bool prev_exec, exec = false;
@@ -290,7 +290,7 @@ static int __meminit create_physical_mapping(unsigned long start,
                        prot = PAGE_KERNEL_X;
                        exec = true;
                } else {
-                       prot = PAGE_KERNEL;
+                       prot = _prot;
                        exec = false;
                }
 
@@ -334,7 +334,7 @@ static void __init radix_init_pgtable(void)
 
                WARN_ON(create_physical_mapping(reg->base,
                                                reg->base + reg->size,
-                                               -1));
+                                               -1, PAGE_KERNEL));
        }
 
        /* Find out how many PID bits are supported */
@@ -713,8 +713,10 @@ static int __meminit stop_machine_change_mapping(void *data)
 
        spin_unlock(&init_mm.page_table_lock);
        pte_clear(&init_mm, params->aligned_start, params->pte);
-       create_physical_mapping(__pa(params->aligned_start), __pa(params->start), -1);
-       create_physical_mapping(__pa(params->end), __pa(params->aligned_end), -1);
+       create_physical_mapping(__pa(params->aligned_start),
+                               __pa(params->start), -1, PAGE_KERNEL);
+       create_physical_mapping(__pa(params->end), __pa(params->aligned_end),
+                               -1, PAGE_KERNEL);
        spin_lock(&init_mm.page_table_lock);
        return 0;
 }
@@ -871,14 +873,16 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end)
        radix__flush_tlb_kernel_range(start, end);
 }
 
-int __meminit radix__create_section_mapping(unsigned long start, unsigned long end, int nid)
+int __meminit radix__create_section_mapping(unsigned long start,
+                                           unsigned long end, int nid,
+                                           pgprot_t prot)
 {
        if (end >= RADIX_VMALLOC_START) {
                pr_warn("Outside the supported range\n");
                return -1;
        }
 
-       return create_physical_mapping(__pa(start), __pa(end), nid);
+       return create_physical_mapping(__pa(start), __pa(end), nid, prot);
 }
 
 int __meminit radix__remove_section_mapping(unsigned long start, unsigned long end)
index e1cc581158163d86dc3b29c94f01f6606334750b..bf63ab04db63ed93319bc6f5d2ee5a3358f13521 100644 (file)
@@ -90,7 +90,8 @@ int memory_add_physaddr_to_nid(u64 start)
 }
 #endif
 
-int __weak create_section_mapping(unsigned long start, unsigned long end, int nid)
+int __weak create_section_mapping(unsigned long start, unsigned long end,
+                                 int nid, pgprot_t prot)
 {
        return -ENODEV;
 }
@@ -131,7 +132,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
        resize_hpt_for_hotplug(memblock_phys_mem_size());
 
        start = (unsigned long)__va(start);
-       rc = create_section_mapping(start, start + size, nid);
+       rc = create_section_mapping(start, start + size, nid, PAGE_KERNEL);
        if (rc) {
                pr_warn("Unable to create mapping for hot added memory 0x%llx..0x%llx: %d\n",
                        start, start + size, rc);