Merge tag 's390-5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Mar 2019 15:35:32 +0000 (08:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Mar 2019 15:35:32 +0000 (08:35 -0700)
Pull s390 fixes from Martin Schwidefsky:
 "Improvements and bug fixes for 5.1-rc2:

   - Fix early free of the channel program in vfio

   - On AP device removal make sure that all messages are flushed with
     the driver still attached that queued the message

   - Limit brk randomization to 32MB to reduce the chance that the heap
     of ld.so is placed after the main stack

   - Add a rolling average for the steal time of a CPU, this will be
     needed for KVM to decide when to do busy waiting

   - Fix a warning in the CPU-MF code

   - Add a notification handler for AP configuration change to react
     faster to new AP devices"

* tag 's390-5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/cpumf: Fix warning from check_processor_id
  zcrypt: handle AP Info notification from CHSC SEI command
  vfio: ccw: only free cp on final interrupt
  s390/vtime: steal time exponential moving average
  s390/zcrypt: revisit ap device remove procedure
  s390: limit brk randomization to 32MB

1  2 
arch/s390/kernel/smp.c
drivers/s390/cio/chsc.c

diff --combined arch/s390/kernel/smp.c
index 3fe1c77c361b98a9a4443bf1a2941f486d024030,b8eb99685546df9919883656c8a71930737f6ee1..bd197baf1dc337f018af35eeb19635b1c95998b7
@@@ -266,7 -266,8 +266,8 @@@ static void pcpu_prepare_secondary(stru
        lc->percpu_offset = __per_cpu_offset[cpu];
        lc->kernel_asce = S390_lowcore.kernel_asce;
        lc->machine_flags = S390_lowcore.machine_flags;
-       lc->user_timer = lc->system_timer = lc->steal_timer = 0;
+       lc->user_timer = lc->system_timer =
+               lc->steal_timer = lc->avg_steal_timer = 0;
        __ctl_store(lc->cregs_save_area, 0, 15);
        save_access_regs((unsigned int *) lc->access_regs_save_area);
        memcpy(lc->stfle_fac_list, S390_lowcore.stfle_fac_list,
@@@ -656,11 -657,7 +657,11 @@@ void __init smp_save_dump_cpus(void
                /* No previous system present, normal boot. */
                return;
        /* Allocate a page as dumping area for the store status sigps */
 -      page = memblock_alloc_base(PAGE_SIZE, PAGE_SIZE, 1UL << 31);
 +      page = memblock_phys_alloc_range(PAGE_SIZE, PAGE_SIZE, 0, 1UL << 31);
 +      if (!page)
 +              panic("ERROR: Failed to allocate %lx bytes below %lx\n",
 +                    PAGE_SIZE, 1UL << 31);
 +
        /* Set multi-threading state to the previous system. */
        pcpu_set_smt(sclp.mtid_prev);
        boot_cpu_addr = stap();
@@@ -770,9 -767,6 +771,9 @@@ void __init smp_detect_cpus(void
  
        /* Get CPU information */
        info = memblock_alloc(sizeof(*info), 8);
 +      if (!info)
 +              panic("%s: Failed to allocate %zu bytes align=0x%x\n",
 +                    __func__, sizeof(*info), 8);
        smp_get_core_info(info, 1);
        /* Find boot CPU type */
        if (sclp.has_core_type) {
diff --combined drivers/s390/cio/chsc.c
index 4159c63a5fd2bbba9b9c2949fde8c56ba9030a89,eaf4699be2c55c24b180eb0c4fd860be6b45de3d..a835b31aad999dcbc90847455b0c75f612aba563
@@@ -24,6 -24,7 +24,7 @@@
  #include <asm/crw.h>
  #include <asm/isc.h>
  #include <asm/ebcdic.h>
+ #include <asm/ap.h>
  
  #include "css.h"
  #include "cio.h"
@@@ -586,6 -587,15 +587,15 @@@ static void chsc_process_sei_scm_avail(
                              " failed (rc=%d).\n", ret);
  }
  
+ static void chsc_process_sei_ap_cfg_chg(struct chsc_sei_nt0_area *sei_area)
+ {
+       CIO_CRW_EVENT(3, "chsc: ap config changed\n");
+       if (sei_area->rs != 5)
+               return;
+       ap_bus_cfg_chg();
+ }
  static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area)
  {
        switch (sei_area->cc) {
@@@ -612,6 -622,9 +622,9 @@@ static void chsc_process_sei_nt0(struc
        case 2: /* i/o resource accessibility */
                chsc_process_sei_res_acc(sei_area);
                break;
+       case 3: /* ap config changed */
+               chsc_process_sei_ap_cfg_chg(sei_area);
+               break;
        case 7: /* channel-path-availability information */
                chsc_process_sei_chp_avail(sei_area);
                break;
@@@ -1382,40 -1395,3 +1395,40 @@@ int chsc_pnso_brinfo(struct subchannel_
        return chsc_error_from_response(brinfo_area->response.code);
  }
  EXPORT_SYMBOL_GPL(chsc_pnso_brinfo);
 +
 +int chsc_sgib(u32 origin)
 +{
 +      struct {
 +              struct chsc_header request;
 +              u16 op;
 +              u8  reserved01[2];
 +              u8  reserved02:4;
 +              u8  fmt:4;
 +              u8  reserved03[7];
 +              /* operation data area begin */
 +              u8  reserved04[4];
 +              u32 gib_origin;
 +              u8  reserved05[10];
 +              u8  aix;
 +              u8  reserved06[4029];
 +              struct chsc_header response;
 +              u8  reserved07[4];
 +      } *sgib_area;
 +      int ret;
 +
 +      spin_lock_irq(&chsc_page_lock);
 +      memset(chsc_page, 0, PAGE_SIZE);
 +      sgib_area = chsc_page;
 +      sgib_area->request.length = 0x0fe0;
 +      sgib_area->request.code = 0x0021;
 +      sgib_area->op = 0x1;
 +      sgib_area->gib_origin = origin;
 +
 +      ret = chsc(sgib_area);
 +      if (ret == 0)
 +              ret = chsc_error_from_response(sgib_area->response.code);
 +      spin_unlock_irq(&chsc_page_lock);
 +
 +      return ret;
 +}
 +EXPORT_SYMBOL_GPL(chsc_sgib);