]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Merge tag 'powerpc-5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 4 Aug 2019 17:30:47 +0000 (10:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 4 Aug 2019 17:30:47 +0000 (10:30 -0700)
Pull powerpc fixes from Michael Ellerman:
 "Some more powerpc fixes for 5.3:

   - Wire up the new clone3 syscall.

   - A fix for the PAPR SCM nvdimm driver, to fix a crash when firmware
     gives us a device that's attached to a non-online NUMA node.

   - A fix for a boot failure on 32-bit with KASAN enabled.

   - Three fixes for implicit fall through warnings, some of which are
     errors for us due to -Werror.

  Thanks to: Aneesh Kumar K.V, Christophe Leroy, Kees Cook, Santosh
  Sivaraj, Stephen Rothwell"

* tag 'powerpc-5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/kasan: fix early boot failure on PPC32
  drivers/macintosh/smu.c: Mark expected switch fall-through
  powerpc/spe: Mark expected switch fall-throughs
  powerpc/nvdimm: Pick nearby online node if the device node is not online
  powerpc/kvm: Fall through switch case explicitly
  powerpc: Wire up clone3 syscall

arch/powerpc/include/asm/unistd.h
arch/powerpc/kernel/align.c
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/syscalls/syscall.tbl
arch/powerpc/kvm/book3s_32_mmu.c
arch/powerpc/mm/kasan/kasan_init_32.c
arch/powerpc/platforms/pseries/papr_scm.c
drivers/macintosh/smu.c

index 68473c3c471cacad92b82958f2202ad1ab0ec984..b0720c7c3fcf620ceaa212266e4fc6c02c2a2989 100644 (file)
@@ -49,6 +49,7 @@
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_SYS_CLONE3
 
 #endif         /* __ASSEMBLY__ */
 #endif /* _ASM_POWERPC_UNISTD_H_ */
index 7107ad86de65d1632e29d677d8979824ef0e9908..92045ed649762f0ebea1f7d93b3ff6603f2b68fc 100644 (file)
@@ -176,9 +176,11 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg,
                        ret |= __get_user_inatomic(temp.v[1], p++);
                        ret |= __get_user_inatomic(temp.v[2], p++);
                        ret |= __get_user_inatomic(temp.v[3], p++);
+                       /* fall through */
                case 4:
                        ret |= __get_user_inatomic(temp.v[4], p++);
                        ret |= __get_user_inatomic(temp.v[5], p++);
+                       /* fall through */
                case 2:
                        ret |= __get_user_inatomic(temp.v[6], p++);
                        ret |= __get_user_inatomic(temp.v[7], p++);
@@ -259,9 +261,11 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg,
                        ret |= __put_user_inatomic(data.v[1], p++);
                        ret |= __put_user_inatomic(data.v[2], p++);
                        ret |= __put_user_inatomic(data.v[3], p++);
+                       /* fall through */
                case 4:
                        ret |= __put_user_inatomic(data.v[4], p++);
                        ret |= __put_user_inatomic(data.v[5], p++);
+                       /* fall through */
                case 2:
                        ret |= __put_user_inatomic(data.v[6], p++);
                        ret |= __put_user_inatomic(data.v[7], p++);
index 85fdb6d879f174365f828859b5e8a047e5aafcfa..54fab22c9a4355edfdd41e1557b6e27c7c73c7ff 100644 (file)
@@ -597,6 +597,14 @@ ppc_clone:
        stw     r0,_TRAP(r1)            /* register set saved */
        b       sys_clone
 
+       .globl  ppc_clone3
+ppc_clone3:
+       SAVE_NVGPRS(r1)
+       lwz     r0,_TRAP(r1)
+       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
+       stw     r0,_TRAP(r1)            /* register set saved */
+       b       sys_clone3
+
        .globl  ppc_swapcontext
 ppc_swapcontext:
        SAVE_NVGPRS(r1)
index d9105fcf4021cac77120fc87ed1a70ab961a6201..0a0b5310f54a6fac4664b9180cdd67603b733543 100644 (file)
@@ -487,6 +487,11 @@ _GLOBAL(ppc_clone)
        bl      sys_clone
        b       .Lsyscall_exit
 
+_GLOBAL(ppc_clone3)
+       bl      save_nvgprs
+       bl      sys_clone3
+       b       .Lsyscall_exit
+
 _GLOBAL(ppc32_swapcontext)
        bl      save_nvgprs
        bl      compat_sys_swapcontext
index 3331749aab20abdd84d21d019240b8cecc60dfba..43f736ed47f28a1dff42ffb7ae7b3e19613e0211 100644 (file)
 432    common  fsmount                         sys_fsmount
 433    common  fspick                          sys_fspick
 434    common  pidfd_open                      sys_pidfd_open
-# 435 reserved for clone3
+435    nospu   clone3                          ppc_clone3
index 6539361778578e8b141b99f77f0b2fc46825cb8d..18f244aad7aaa46c1eb45db0f6a283c3d11d9be0 100644 (file)
@@ -239,6 +239,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
                                case 2:
                                case 6:
                                        pte->may_write = true;
+                                       /* fall through */
                                case 3:
                                case 5:
                                case 7:
index 0d62be3cba47b8f6d22340ccba961800d8b86d4c..74f4555a62ba50cc5bbee38467e912477044e2cb 100644 (file)
@@ -21,7 +21,7 @@ static void kasan_populate_pte(pte_t *ptep, pgprot_t prot)
                __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 0);
 }
 
-static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end)
+static int __ref kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end)
 {
        pmd_t *pmd;
        unsigned long k_cur, k_next;
@@ -35,7 +35,10 @@ static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_
                if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte)
                        continue;
 
-               new = pte_alloc_one_kernel(&init_mm);
+               if (slab_is_available())
+                       new = pte_alloc_one_kernel(&init_mm);
+               else
+                       new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE);
 
                if (!new)
                        return -ENOMEM;
index 2c07908359b282d72f3ce8d06634fd660c2e5b92..a5ac371a3f066ecbabb1c2899a4e36468e598a01 100644 (file)
@@ -275,12 +275,32 @@ static const struct attribute_group *papr_scm_dimm_groups[] = {
        NULL,
 };
 
+static inline int papr_scm_node(int node)
+{
+       int min_dist = INT_MAX, dist;
+       int nid, min_node;
+
+       if ((node == NUMA_NO_NODE) || node_online(node))
+               return node;
+
+       min_node = first_online_node;
+       for_each_online_node(nid) {
+               dist = node_distance(node, nid);
+               if (dist < min_dist) {
+                       min_dist = dist;
+                       min_node = nid;
+               }
+       }
+       return min_node;
+}
+
 static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
 {
        struct device *dev = &p->pdev->dev;
        struct nd_mapping_desc mapping;
        struct nd_region_desc ndr_desc;
        unsigned long dimm_flags;
+       int target_nid, online_nid;
 
        p->bus_desc.ndctl = papr_scm_ndctl;
        p->bus_desc.module = THIS_MODULE;
@@ -319,8 +339,10 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
 
        memset(&ndr_desc, 0, sizeof(ndr_desc));
        ndr_desc.attr_groups = region_attr_groups;
-       ndr_desc.numa_node = dev_to_node(&p->pdev->dev);
-       ndr_desc.target_node = ndr_desc.numa_node;
+       target_nid = dev_to_node(&p->pdev->dev);
+       online_nid = papr_scm_node(target_nid);
+       ndr_desc.numa_node = online_nid;
+       ndr_desc.target_node = target_nid;
        ndr_desc.res = &p->res;
        ndr_desc.of_node = p->dn;
        ndr_desc.provider_data = p;
@@ -338,6 +360,9 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
                                ndr_desc.res, p->dn);
                goto err;
        }
+       if (target_nid != online_nid)
+               dev_info(dev, "Region registered with target node %d and online node %d",
+                        target_nid, online_nid);
 
        return 0;
 
index 276065c888bcdd31b16070f1f78a7695a9c71790..23f1f41c86029092a01d662c1a362552cffa3e04 100644 (file)
@@ -852,6 +852,7 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd)
                break;
        case SMU_I2C_TRANSFER_COMBINED:
                cmd->info.devaddr &= 0xfe;
+               /* fall through */
        case SMU_I2C_TRANSFER_STDSUB:
                if (cmd->info.sublen > 3)
                        return -EINVAL;