Merge tag 's390-5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Feb 2021 22:12:32 +0000 (14:12 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Feb 2021 22:12:32 +0000 (14:12 -0800)
Pull more s390 updates from Vasily Gorbik:

 - Fix physical vs virtual confusion in some basic mm macros and
   routines. Caused by __pa == __va on s390 currently.

 - Get rid of on-stack cpu masks.

 - Add support for complete CPU counter set extraction.

 - Add arch_irq_work_raise implementation.

 - virtio-ccw revision and opcode fixes.

* tag 's390-5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/cpumf: Add support for complete counter set extraction
  virtio/s390: implement virtio-ccw revision 2 correctly
  s390/smp: implement arch_irq_work_raise()
  s390/topology: move cpumasks away from stack
  s390/smp: smp_emergency_stop() - move cpumask away from stack
  s390/smp: __smp_rescan_cpus() - move cpumask away from stack
  s390/smp: consolidate locking for smp_rescan()
  s390/mm: fix phys vs virt confusion in vmem_*() functions family
  s390/mm: fix phys vs virt confusion in pgtable allocation routines
  s390/mm: fix invalid __pa() usage in pfn_pXd() macros
  s390/mm: make pXd_deref() macros return a pointer
  s390/opcodes: rename selhhhr to selfhr

1  2 
arch/s390/mm/vmem.c

diff --combined arch/s390/mm/vmem.c
@@@ -4,7 -4,6 +4,7 @@@
   *    Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
   */
  
 +#include <linux/memory_hotplug.h>
  #include <linux/memblock.h>
  #include <linux/pfn.h>
  #include <linux/mm.h>
@@@ -27,14 -26,14 +27,14 @@@ static void __ref *vmem_alloc_pages(uns
  
        if (slab_is_available())
                return (void *)__get_free_pages(GFP_KERNEL, order);
-       return (void *) memblock_phys_alloc(size, size);
+       return memblock_alloc(size, size);
  }
  
  static void vmem_free_pages(unsigned long addr, int order)
  {
        /* We don't expect boot memory to be removed ever. */
        if (!slab_is_available() ||
-           WARN_ON_ONCE(PageReserved(phys_to_page(addr))))
+           WARN_ON_ONCE(PageReserved(virt_to_page(addr))))
                return;
        free_pages(addr, order);
  }
@@@ -57,7 -56,7 +57,7 @@@ pte_t __ref *vmem_pte_alloc(void
        if (slab_is_available())
                pte = (pte_t *) page_table_alloc(&init_mm);
        else
-               pte = (pte_t *) memblock_phys_alloc(size, size);
+               pte = (pte_t *) memblock_alloc(size, size);
        if (!pte)
                return NULL;
        memset64((u64 *)pte, _PAGE_INVALID, PTRS_PER_PTE);
@@@ -85,7 -84,7 +85,7 @@@ static void vmemmap_flush_unused_sub_pm
  {
        if (!unused_sub_pmd_start)
                return;
-       memset(__va(unused_sub_pmd_start), PAGE_UNUSED,
+       memset((void *)unused_sub_pmd_start, PAGE_UNUSED,
               ALIGN(unused_sub_pmd_start, PMD_SIZE) - unused_sub_pmd_start);
        unused_sub_pmd_start = 0;
  }
@@@ -98,7 -97,7 +98,7 @@@ static void vmemmap_mark_sub_pmd_used(u
         * getting removed (just in case the memmap never gets initialized,
         * e.g., because the memory block never gets onlined).
         */
-       memset(__va(start), 0, sizeof(struct page));
+       memset((void *)start, 0, sizeof(struct page));
  }
  
  static void vmemmap_use_sub_pmd(unsigned long start, unsigned long end)
  
  static void vmemmap_use_new_sub_pmd(unsigned long start, unsigned long end)
  {
-       void *page = __va(ALIGN_DOWN(start, PMD_SIZE));
+       unsigned long page = ALIGN_DOWN(start, PMD_SIZE);
  
        vmemmap_flush_unused_sub_pmd();
  
  
        /* Mark the unused parts of the new memmap page PAGE_UNUSED. */
        if (!IS_ALIGNED(start, PMD_SIZE))
-               memset(page, PAGE_UNUSED, start - __pa(page));
+               memset((void *)page, PAGE_UNUSED, start - page);
        /*
         * We want to avoid memset(PAGE_UNUSED) when populating the vmemmap of
         * consecutive sections. Remember for the last added PMD the last
  /* Returns true if the PMD is completely unused and can be freed. */
  static bool vmemmap_unuse_sub_pmd(unsigned long start, unsigned long end)
  {
-       void *page = __va(ALIGN_DOWN(start, PMD_SIZE));
+       unsigned long page = ALIGN_DOWN(start, PMD_SIZE);
  
        vmemmap_flush_unused_sub_pmd();
-       memset(__va(start), PAGE_UNUSED, end - start);
-       return !memchr_inv(page, PAGE_UNUSED, PMD_SIZE);
+       memset((void *)start, PAGE_UNUSED, end - start);
+       return !memchr_inv((void *)page, PAGE_UNUSED, PMD_SIZE);
  }
  
  /* __ref: we'll only call vmemmap_alloc_block() via vmemmap_populate() */
@@@ -166,7 -165,7 +166,7 @@@ static int __ref modify_pte_table(pmd_
                        if (pte_none(*pte))
                                continue;
                        if (!direct)
-                               vmem_free_pages(pfn_to_phys(pte_pfn(*pte)), 0);
+                               vmem_free_pages((unsigned long) pfn_to_virt(pte_pfn(*pte)), 0);
                        pte_clear(&init_mm, addr, pte);
                } else if (pte_none(*pte)) {
                        if (!direct) {
                                        goto out;
                                pte_val(*pte) = __pa(new_page) | prot;
                        } else {
-                               pte_val(*pte) = addr | prot;
+                               pte_val(*pte) = __pa(addr) | prot;
                        }
                } else {
                        continue;
@@@ -201,7 -200,7 +201,7 @@@ static void try_free_pte_table(pmd_t *p
                if (!pte_none(*pte))
                        return;
        }
-       vmem_pte_free(__va(pmd_deref(*pmd)));
+       vmem_pte_free((unsigned long *) pmd_deref(*pmd));
        pmd_clear(pmd);
  }
  
@@@ -242,7 -241,7 +242,7 @@@ static int __ref modify_pmd_table(pud_
                            IS_ALIGNED(next, PMD_SIZE) &&
                            MACHINE_HAS_EDAT1 && addr && direct &&
                            !debug_pagealloc_enabled()) {
-                               pmd_val(*pmd) = addr | prot;
+                               pmd_val(*pmd) = __pa(addr) | prot;
                                pages++;
                                continue;
                        } else if (!direct && MACHINE_HAS_EDAT1) {
@@@ -338,7 -337,7 +338,7 @@@ static int modify_pud_table(p4d_t *p4d
                            IS_ALIGNED(next, PUD_SIZE) &&
                            MACHINE_HAS_EDAT2 && addr && direct &&
                            !debug_pagealloc_enabled()) {
-                               pud_val(*pud) = addr | prot;
+                               pud_val(*pud) = __pa(addr) | prot;
                                pages++;
                                continue;
                        }
@@@ -533,22 -532,11 +533,22 @@@ void vmem_remove_mapping(unsigned long 
        mutex_unlock(&vmem_mutex);
  }
  
 +struct range arch_get_mappable_range(void)
 +{
 +      struct range mhp_range;
 +
 +      mhp_range.start = 0;
 +      mhp_range.end =  VMEM_MAX_PHYS - 1;
 +      return mhp_range;
 +}
 +
  int vmem_add_mapping(unsigned long start, unsigned long size)
  {
 +      struct range range = arch_get_mappable_range();
        int ret;
  
 -      if (start + size > VMEM_MAX_PHYS ||
 +      if (start < range.start ||
 +          start + size > range.end + 1 ||
            start + size < start)
                return -ERANGE;