]> Git Repo - linux.git/commitdiff
Merge tag 's390-6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
authorLinus Torvalds <[email protected]>
Thu, 6 Jul 2023 20:18:30 +0000 (13:18 -0700)
committerLinus Torvalds <[email protected]>
Thu, 6 Jul 2023 20:18:30 +0000 (13:18 -0700)
Pull more s390 updates from Alexander Gordeev:

 - Fix virtual vs physical address confusion in vmem_add_range() and
   vmem_remove_range() functions

 - Include <linux/io.h> instead of <asm/io.h> and <asm-generic/io.h>
   throughout s390 code

 - Make all PSW related defines also available for assembler files.
   Remove PSW_DEFAULT_KEY define from uapi for that

 - When adding an undefined symbol the build still succeeds, but
   userspace crashes trying to execute VDSO, because the symbol is not
   resolved. Add undefined symbols check to prevent that

 - Use kvmalloc_array() instead of kzalloc() for allocaton of 256k
   memory when executing s390 crypto adapter IOCTL

 - Add -fPIE flag to prevent decompressor misaligned symbol build error
   with clang

 - Use .balign instead of .align everywhere. This is a no-op for s390,
   but with this there no mix in using .align and .balign anymore

 - Filter out -mno-pic-data-is-text-relative flag when compiling kernel
   to prevent VDSO build error

 - Rework entering of DAT-on mode on CPU restart to use PSW_KERNEL_BITS
   mask directly

 - Do not retry administrative requests to some s390 crypto cards, since
   the firmware assumes replay attacks

 - Remove most of the debug code, which is build in when kernel config
   option CONFIG_ZCRYPT_DEBUG is enabled

 - Remove CONFIG_ZCRYPT_MULTIDEVNODES kernel config option and switch
   off the multiple devices support for the s390 zcrypt device driver

 - With the conversion to generic entry machine checks are accounted to
   the current context instead of irq time. As result, the STCKF
   instruction at the beginning of the machine check handler and the
   lowcore member are no longer required, therefore remove it

 - Fix various typos found with codespell

 - Minor cleanups to CPU-measurement Counter and Sampling Facilities
   code

 - Revert patch that removes VMEM_MAX_PHYS macro, since it causes a
   regression

* tag 's390-6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (25 commits)
  Revert "s390/mm: get rid of VMEM_MAX_PHYS macro"
  s390/cpum_sf: remove check on CPU being online
  s390/cpum_sf: handle casts consistently
  s390/cpum_sf: remove unnecessary debug statement
  s390/cpum_sf: remove parameter in call to pr_err
  s390/cpum_sf: simplify function setup_pmu_cpu
  s390/cpum_cf: remove unneeded debug statements
  s390/entry: remove mcck clock
  s390: fix various typos
  s390/zcrypt: remove ZCRYPT_MULTIDEVNODES kernel config option
  s390/zcrypt: do not retry administrative requests
  s390/zcrypt: cleanup some debug code
  s390/entry: rework entering DAT-on mode on CPU restart
  s390/mm: fence off VM macros from asm and linker
  s390: include linux/io.h instead of asm/io.h
  s390/ptrace: make all psw related defines also available for asm
  s390/ptrace: remove PSW_DEFAULT_KEY from uapi
  s390/vdso: filter out mno-pic-data-is-text-relative cflag
  s390: consistently use .balign instead of .align
  s390/decompressor: fix misaligned symbol build error
  ...

1  2 
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/vsie.c
arch/s390/mm/gmap.c
drivers/crypto/Kconfig
drivers/s390/block/dcssblk.c
drivers/s390/net/ctcm_mpc.c

diff --combined arch/s390/kvm/kvm-s390.c
index 67001969646484ef5ad0d59f28b3ec93275b49dc,9f02cdaec0972a93df2606929b5e8bf8ee7fc95e..d1e768bcfe1d380fc6653c6376c0ad4f366c0a9a
@@@ -2156,10 -2156,6 +2156,10 @@@ static unsigned long kvm_s390_next_dirt
                ms = container_of(mnode, struct kvm_memory_slot, gfn_node[slots->node_idx]);
                ofs = 0;
        }
 +
 +      if (cur_gfn < ms->base_gfn)
 +              ofs = 0;
 +
        ofs = find_next_bit(kvm_second_dirty_bitmap(ms), ms->npages, ofs);
        while (ofs >= ms->npages && (mnode = rb_next(mnode))) {
                ms = container_of(mnode, struct kvm_memory_slot, gfn_node[slots->node_idx]);
@@@ -4161,7 -4157,7 +4161,7 @@@ static void kvm_arch_vcpu_ioctl_initial
        vcpu->run->s.regs.fpc = 0;
        /*
         * Do not reset these registers in the protected case, as some of
-        * them are overlayed and they are not accessible in this case
+        * them are overlaid and they are not accessible in this case
         * anyway.
         */
        if (!kvm_s390_pv_cpu_is_protected(vcpu)) {
diff --combined arch/s390/kvm/vsie.c
index 0333ee482eb894d477bf54bb44007ec87d100297,5e1a382b281d5cdd9a060fe69cba7fcd1e5b9ad3..61499293c2ac3b955a7de66a366f955d144ae3b5
@@@ -177,8 -177,7 +177,8 @@@ static int setup_apcb00(struct kvm_vcp
                            sizeof(struct kvm_s390_apcb0)))
                return -EFAULT;
  
 -      bitmap_and(apcb_s, apcb_s, apcb_h, sizeof(struct kvm_s390_apcb0));
 +      bitmap_and(apcb_s, apcb_s, apcb_h,
 +                 BITS_PER_BYTE * sizeof(struct kvm_s390_apcb0));
  
        return 0;
  }
@@@ -204,8 -203,7 +204,8 @@@ static int setup_apcb11(struct kvm_vcp
                            sizeof(struct kvm_s390_apcb1)))
                return -EFAULT;
  
 -      bitmap_and(apcb_s, apcb_s, apcb_h, sizeof(struct kvm_s390_apcb1));
 +      bitmap_and(apcb_s, apcb_s, apcb_h,
 +                 BITS_PER_BYTE * sizeof(struct kvm_s390_apcb1));
  
        return 0;
  }
@@@ -504,7 -502,7 +504,7 @@@ static int shadow_scb(struct kvm_vcpu *
        scb_s->mso = new_mso;
        scb_s->prefix = new_prefix;
  
-       /* We have to definetly flush the tlb if this scb never ran */
+       /* We have to definitely flush the tlb if this scb never ran */
        if (scb_s->ihcpu != 0xffffU)
                scb_s->ihcpu = scb_o->ihcpu;
  
@@@ -901,7 -899,7 +901,7 @@@ static int inject_fault(struct kvm_vcp
                        (vaddr & 0xfffffffffffff000UL) |
                        /* 52-53: store / fetch */
                        (((unsigned int) !write_flag) + 1) << 10,
-                       /* 62-63: asce id (alway primary == 0) */
+                       /* 62-63: asce id (always primary == 0) */
                .exc_access_id = 0, /* always primary */
                .op_access_id = 0, /* not MVPG */
        };
diff --combined arch/s390/mm/gmap.c
index f4b6fc746fce623ea6d1811b3289a34b37b56f85,e2a92243227b9ecebfed7180669c26fe7ac83176..989ebd0912b489ba4667c0c8d4452a5e71c13d3a
@@@ -895,12 -895,12 +895,12 @@@ static int gmap_pte_op_fixup(struct gma
  
  /**
   * gmap_pte_op_end - release the page table lock
 - * @ptl: pointer to the spinlock pointer
 + * @ptep: pointer to the locked pte
 + * @ptl: pointer to the page table spinlock
   */
 -static void gmap_pte_op_end(spinlock_t *ptl)
 +static void gmap_pte_op_end(pte_t *ptep, spinlock_t *ptl)
  {
 -      if (ptl)
 -              spin_unlock(ptl);
 +      pte_unmap_unlock(ptep, ptl);
  }
  
  /**
@@@ -1011,7 -1011,7 +1011,7 @@@ static int gmap_protect_pte(struct gma
  {
        int rc;
        pte_t *ptep;
 -      spinlock_t *ptl = NULL;
 +      spinlock_t *ptl;
        unsigned long pbits = 0;
  
        if (pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID)
        pbits |= (bits & GMAP_NOTIFY_SHADOW) ? PGSTE_VSIE_BIT : 0;
        /* Protect and unlock. */
        rc = ptep_force_prot(gmap->mm, gaddr, ptep, prot, pbits);
 -      gmap_pte_op_end(ptl);
 +      gmap_pte_op_end(ptep, ptl);
        return rc;
  }
  
@@@ -1154,7 -1154,7 +1154,7 @@@ int gmap_read_table(struct gmap *gmap, 
                                /* Do *NOT* clear the _PAGE_INVALID bit! */
                                rc = 0;
                        }
 -                      gmap_pte_op_end(ptl);
 +                      gmap_pte_op_end(ptep, ptl);
                }
                if (!rc)
                        break;
@@@ -1248,7 -1248,7 +1248,7 @@@ static int gmap_protect_rmap(struct gma
                        if (!rc)
                                gmap_insert_rmap(sg, vmaddr, rmap);
                        spin_unlock(&sg->guest_table_lock);
 -                      gmap_pte_op_end(ptl);
 +                      gmap_pte_op_end(ptep, ptl);
                }
                radix_tree_preload_end();
                if (rc) {
@@@ -1740,7 -1740,7 +1740,7 @@@ EXPORT_SYMBOL_GPL(gmap_shadow)
   * The r2t parameter specifies the address of the source table. The
   * four pages of the source table are made read-only in the parent gmap
   * address space. A write to the source table area @r2t will automatically
-  * remove the shadow r2 table and all of its decendents.
+  * remove the shadow r2 table and all of its descendants.
   *
   * Returns 0 if successfully shadowed or already shadowed, -EAGAIN if the
   * shadow table structure is incomplete, -ENOMEM if out of memory and
@@@ -2156,7 -2156,7 +2156,7 @@@ int gmap_shadow_page(struct gmap *sg, u
                        tptep = (pte_t *) gmap_table_walk(sg, saddr, 0);
                        if (!tptep) {
                                spin_unlock(&sg->guest_table_lock);
 -                              gmap_pte_op_end(ptl);
 +                              gmap_pte_op_end(sptep, ptl);
                                radix_tree_preload_end();
                                break;
                        }
                                rmap = NULL;
                                rc = 0;
                        }
 -                      gmap_pte_op_end(ptl);
 +                      gmap_pte_op_end(sptep, ptl);
                        spin_unlock(&sg->guest_table_lock);
                }
                radix_tree_preload_end();
@@@ -2495,7 -2495,7 +2495,7 @@@ void gmap_sync_dirty_log_pmd(struct gma
                                continue;
                        if (ptep_test_and_clear_uc(gmap->mm, vmaddr, ptep))
                                set_bit(i, bitmap);
 -                      spin_unlock(ptl);
 +                      pte_unmap_unlock(ptep, ptl);
                }
        }
        gmap_pmd_op_end(gmap, pmdp);
@@@ -2537,12 -2537,7 +2537,12 @@@ static inline void thp_split_mm(struct 
   * Remove all empty zero pages from the mapping for lazy refaulting
   * - This must be called after mm->context.has_pgste is set, to avoid
   *   future creation of zero pages
 - * - This must be called after THP was enabled
 + * - This must be called after THP was disabled.
 + *
 + * mm contracts with s390, that even if mm were to remove a page table,
 + * racing with the loop below and so causing pte_offset_map_lock() to fail,
 + * it will never insert a page table containing empty zero pages once
 + * mm_forbids_zeropage(mm) i.e. mm->context.has_pgste is set.
   */
  static int __zap_zero_pages(pmd_t *pmd, unsigned long start,
                           unsigned long end, struct mm_walk *walk)
                spinlock_t *ptl;
  
                ptep = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
 +              if (!ptep)
 +                      break;
                if (is_zero_pfn(pte_pfn(*ptep)))
                        ptep_xchg_direct(walk->mm, addr, ptep, __pte(_PAGE_INVALID));
                pte_unmap_unlock(ptep, ptl);
diff --combined drivers/crypto/Kconfig
index 9f5b2d28bff5947874613149429275a1de853a50,d34f2cfeed06dacc68fade13f4c728e64c489371..44e44b8d9ce67bce2d9bcc33329bf019fc62a4bd
@@@ -92,17 -92,6 +92,6 @@@ config ZCRYPT_DEBU
  
          If unsure, say N.
  
- config ZCRYPT_MULTIDEVNODES
-       bool "Support for multiple zcrypt device nodes"
-       default y
-       depends on S390
-       depends on ZCRYPT
-       help
-         With this option enabled the zcrypt device driver can
-         provide multiple devices nodes in /dev. Each device
-         node can get customized to limit access and narrow
-         down the use of the available crypto hardware.
  config PKEY
        tristate "Kernel API for protected key handling"
        depends on S390
@@@ -807,6 -796,5 +796,6 @@@ config CRYPTO_DEV_SA2U
          acceleration for cryptographic algorithms on these devices.
  
  source "drivers/crypto/aspeed/Kconfig"
 +source "drivers/crypto/starfive/Kconfig"
  
  endif # CRYPTO_HW
index 405d76df9427c1b8d2c1b4f74ed9c4c8b441c15c,a573ffbd4a335c1f1ab3a8afa26dbfe0dd5a3153..09acf3853a77e9ea3a7616475b766ae51031966b
@@@ -20,8 -20,8 +20,8 @@@
  #include <linux/pfn_t.h>
  #include <linux/uio.h>
  #include <linux/dax.h>
+ #include <linux/io.h>
  #include <asm/extmem.h>
- #include <asm/io.h>
  
  #define DCSSBLK_NAME "dcssblk"
  #define DCSSBLK_MINORS_PER_DISK 1
@@@ -54,8 -54,7 +54,8 @@@ static int dcssblk_dax_zero_page_range(
        rc = dax_direct_access(dax_dev, pgoff, nr_pages, DAX_ACCESS,
                        &kaddr, NULL);
        if (rc < 0)
 -              return rc;
 +              return dax_mem2blk_err(rc);
 +
        memset(kaddr, 0, nr_pages << PAGE_SHIFT);
        dax_flush(dax_dev, kaddr, nr_pages << PAGE_SHIFT);
        return 0;
index c44ba88f9f478c6000d493c90246490d707658e6,80d8c98e71a7b11210140f513affa2191044b03d..7a2f34a5e0e09ff95bfd2f5b9248f1bdbf68b771
  #include <linux/netdevice.h>
  #include <net/dst.h>
  
- #include <linux/io.h>         /* instead of <asm/io.h> ok ? */
- #include <asm/ccwdev.h>
- #include <asm/ccwgroup.h>
- #include <linux/bitops.h>     /* instead of <asm/bitops.h> ok ? */
- #include <linux/uaccess.h>    /* instead of <asm/uaccess.h> ok ? */
+ #include <linux/io.h>
+ #include <linux/bitops.h>
+ #include <linux/uaccess.h>
  #include <linux/wait.h>
  #include <linux/moduleparam.h>
+ #include <asm/ccwdev.h>
+ #include <asm/ccwgroup.h>
  #include <asm/idals.h>
  
  #include "ctcm_main.h"
@@@ -144,9 -144,9 +144,9 @@@ void ctcmpc_dumpit(char *buf, int len
  
        for (ct = 0; ct < len; ct++, ptr++, rptr++) {
                if (sw == 0) {
 -                      sprintf(addr, "%16.16llx", (__u64)rptr);
 +                      scnprintf(addr, sizeof(addr), "%16.16llx", (__u64)rptr);
  
 -                      sprintf(boff, "%4.4X", (__u32)ct);
 +                      scnprintf(boff, sizeof(boff), "%4.4X", (__u32)ct);
                        bhex[0] = '\0';
                        basc[0] = '\0';
                }
                if (sw == 8)
                        strcat(bhex, "  ");
  
 -              sprintf(tbuf, "%2.2llX", (__u64)*ptr);
 +              scnprintf(tbuf, sizeof(tbuf), "%2.2llX", (__u64)*ptr);
  
                tbuf[2] = '\0';
                strcat(bhex, tbuf);
                        continue;
                if ((strcmp(duphex, bhex)) != 0) {
                        if (dup != 0) {
 -                              sprintf(tdup,
 -                                      "Duplicate as above to %s", addr);
 +                              scnprintf(tdup, sizeof(tdup),
 +                                        "Duplicate as above to %s", addr);
                                ctcm_pr_debug("                --- %s ---\n",
                                                tdup);
                        }
                        strcat(basc, " ");
                }
                if (dup != 0) {
 -                      sprintf(tdup, "Duplicate as above to %s", addr);
 +                      scnprintf(tdup, sizeof(tdup),
 +                                "Duplicate as above to %s", addr);
                        ctcm_pr_debug("                --- %s ---\n", tdup);
                }
                ctcm_pr_debug("   %s (+%s) : %s  [%s]\n",
                                        addr, boff, bhex, basc);
        } else {
                if (dup >= 1) {
 -                      sprintf(tdup, "Duplicate as above to %s", addr);
 +                      scnprintf(tdup, sizeof(tdup),
 +                                "Duplicate as above to %s", addr);
                        ctcm_pr_debug("                --- %s ---\n", tdup);
                }
                if (dup != 0) {
@@@ -293,7 -291,7 +293,7 @@@ static struct net_device *ctcmpc_get_de
        struct net_device *dev;
        struct ctcm_priv *priv;
  
 -      sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num);
 +      scnprintf(device, sizeof(device), "%s%i", MPC_DEVICE_NAME, port_num);
  
        dev = __dev_get_by_name(&init_net, device);
  
This page took 0.100366 seconds and 4 git commands to generate.