1. 20 9月, 2017 3 次提交
    • H
      s390x/css: fix NULL handling for CCW addresses · cc6a9f8d
      Halil Pasic 提交于
      Back then in the time of df1fe5bb ("s390: Virtual channel subsystem
      support.", 2013-01-24) -EIO used to map to a channel-program check (via
      the default label of the switch statement).  Then 2dc95b4c
      ("s390x/3270: 3270 data stream handling", 2016-04-01) came along
      and that changed dramatically.
      
      Let us roll back this undesired side effect, and go back to
      channel-program check.
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Fixes: 2dc95b4c "s390x/3270: 3270 data stream handling"
      Message-Id: <20170908152446.14606-3-pasic@linux.vnet.ibm.com>
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      cc6a9f8d
    • H
      s390x/css: drop data-check in interpretation · 248b920d
      Halil Pasic 提交于
      The architecture says that channel-data check is indicating that
      an uncorrected storage (memory) error has been detected in regard
      to the data residing in main storage (memory) that is currently
      used for an I/O operation. The described detection is done using
      the CBC technology.
      
      The ccw interpretation code is however generating a channel-data check
      effectively when the (device specific) ccw_cb returns -EFAULT.  In case
      of virtio-ccw devices this happens when mapping memory fails, or when a
      NULL pointer is encountered. So this behavior is not architecture
      conform.
      
      Furthermore the best fit for these situations (null pointer, mapping a
      piece of guest memory fails) from architectural perspective the condition
      described as the channel subsystem refers to a location that is not
      available, which when encountered shall result in a channel-program
      check.
      
      To fix this, all we have to do is to get rid of the switch case matching
      -EFAULT: the default is generating a channel-program check.
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Message-Id: <20170908152446.14606-2-pasic@linux.vnet.ibm.com>
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      248b920d
    • H
      s390x/css: fix cc handling for XSCH · 6c864622
      Halil Pasic 提交于
      The function ioinst_handle_xsch is presenting cc 2 when it's supposed to
      present cc 1 and the other way around, because css_do_xsch has the error
      codes mixed up. Because cc 1 has precedence over cc 2 we also have to
      swap the two checks.
      
      Let us fix this.
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Reported-by: NPierre Morel <pmorel@linux.vnet.ibm.com>
      Message-Id: <20170831121828.85885-1-pasic@linux.vnet.ibm.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      6c864622
  2. 31 8月, 2017 2 次提交
  3. 28 7月, 2017 2 次提交
    • H
      s390x/css: fix bits must be zero check for TIC · 4add0da6
      Halil Pasic 提交于
      According to the PoP bit positions 0-3 and 8-32 of the format-1 CCW must
      contain zeros.  Bits 0-3 are already covered by cmd_code validity
      checking, and bit 32 is covered by the CCW address checking.
      
      Bits 8-31 correspond to CCW1.flags and CCW1.count.  Currently we only
      check for the absence of certain flags.  Let's fix this.
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Message-Id: <20170725224442.13383-3-pasic@linux.vnet.ibm.com>
      Reviewed-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      [CH: tweaked comment]
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      4add0da6
    • H
      s390x/css: check ccw address validity · 198c0d1f
      Halil Pasic 提交于
      According to the PoP channel command words (CCW) must be doubleword
      aligned and 31 bit addressable for format 1 and 24 bit addressable for
      format 0 CCWs.
      
      If the channel subsystem encounters a ccw address which does not satisfy
      this alignment requirement a program-check condition is recognised.
      
      The situation with 31 bit addressable is a bit more complicated: both the
      ORB and a format 1 CCW TIC hold the address of (the rest of) the channel
      program, that is the address of the next CCW in a word, and the PoP
      mandates that bit 0 of that word shall be zero -- or a program-check
      condition is to be recognized -- and does not belong to the field holding
      the ccw address.
      
      Since in code the corresponding fields span across the whole word (unlike
      in PoP where these are defined as 31 bit wide) we can check this by
      applying a mask. The 24 addressable case isn't affecting TIC because the
      address is composed of a halfword and a byte portion (no additional zero
      bit requirements) and just slightly complicates the ORB case where also
      bits 1-7 need to be zero.
      
      The same requirements (especially n-bit addressability) apply to the
      ccw addresses generated while chaining.
      
      Let's make our CSS implementation follow the AR more closely.
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Message-Id: <20170727154842.23427-1-pasic@linux.vnet.ibm.com>
      Reviewed-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      198c0d1f
  4. 14 7月, 2017 8 次提交
  5. 05 7月, 2017 1 次提交
  6. 06 6月, 2017 2 次提交
    • C
      s390x/css: fence off MIDA · 4e19b57b
      Cornelia Huck 提交于
      MIDA (modified indirect data addressing) is an optional facility, and
      we (currently) don't support it. Let's post an operand exception if
      the guest tries to set it in the orb and a channel program check
      if it is set in a ccw, as specified in the Principles of Operation.
      Reviewed-by: NClaudio Imbrenda <imbrenda@linux.vnet.ibm.com>
      Reviewed-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      4e19b57b
    • H
      s390x/css: catch section mismatch on load · 8ed179c9
      Halil Pasic 提交于
      Prior to the virtio-ccw-2.7 machine (and commit 2a79eb1a), our virtio
      devices residing under the virtual-css bus do not have qdev_path based
      migration stream identifiers (because their qdev_path is NULL). The ids
      are instead generated when the device is registered as a composition of
      the so called idstr, which takes the vmsd name as its value, and an
      instance_id, which is which is calculated as a maximal instance_id
      registered with the same idstr plus one, or zero (if none was registered
      previously).
      
      That means, under certain circumstances, one device might try, and even
      succeed, to load the state of a different device. This can lead to
      trouble.
      
      Let us fail the migration if the above problem is detected during load.
      
      How to reproduce the problem:
      1) start qemu-system-s390x making sure you have the following devices
         defined on your command line:
           -device virtio-rng-ccw,id=rng1,devno=fe.0.0001
           -device virtio-rng-ccw,id=rng2,devno=fe.0.0002
      2) detach the devices and reattach in reverse order using the monitor:
           (qemu) device_del rng1
           (qemu) device_del rng2
           (qemu) device_add virtio-rng-ccw,id=rng2,devno=fe.0.0002
           (qemu) device_add virtio-rng-ccw,id=rng1,devno=fe.0.0001
      3) save the state of the vm into a temporary file and quit QEMU:
           (qemu) migrate "exec:gzip -c > /tmp/tmp_vmstate.gz"
           (qemu) q
      4) use your command line from step 1 with
           -incoming "exec:gzip -c -d /tmp/tmp_vmstate.gz"
         appended to reproduce the problem (while trying to to load the saved vm)
      
      CC: qemu-stable@nongnu.org
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Reviewed-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Message-Id: <20170518111405.56947-1-pasic@linux.vnet.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      8ed179c9
  7. 19 5月, 2017 4 次提交
  8. 04 5月, 2017 2 次提交
  9. 21 4月, 2017 3 次提交
  10. 20 3月, 2017 1 次提交
    • D
      s390x/css: reassign subchannel if schid is changed after migration · 3c788ebc
      Dong Jia Shi 提交于
      The subchannel is a means to access a device. While the device number is
      assigned by the administrator, the subchannel number is assigned by
      the channel subsystem in an ascending order on cold and hot plug.
      When doing unplug and replug operations, the same device may end up on
      a different subchannel; for example
      
      - We start with a device fe.1.2222, which ends up at subchannel
        fe.1.0000.
      - Now we detach the device, attach a device fe.1.3333 (which would get
        the now-free subchannel fe.1.0000), re-attach fe.1.2222 (which ends
        up at subchannel fe.1.0001) and detach fe.1.3333.
      - We now have the same device (fe.1.2222) available to the guest; it
        just shows up on a different subchannel.
      
      In such a case, the subchannel numbers are different from what a
      QEMU would create during cold plug when parsing the command line.
      
      As this would cause a guest visible change on migration, we do restore
      the source system's value of the subchannel number on load.
      
      So we are now fine from the guest perspective. From the host
      perspective this will cause an inconsistent state in our internal data
      structures, though.
      
      For example, the subchannel 0 might not be at array position 0. This will
      lead to problems when we continue doing hot (un/re) plug operations.
      
      Let's fix this by cleaning up our internal data structures.
      Reported-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      3c788ebc
  11. 24 2月, 2017 1 次提交
  12. 28 9月, 2016 1 次提交
  13. 05 9月, 2016 1 次提交
    • C
      s390x/css: handle cssid 255 correctly · 882b3b97
      Cornelia Huck 提交于
      The cssid 255 is reserved but still valid from an architectural
      point of view. However, feeding a bogus schid of 0xffffffff into
      the virtio hypercall will lead to a crash:
      
      Stack trace of thread 138363:
              #0  0x00000000100d168c css_find_subch (qemu-system-s390x)
              #1  0x00000000100d3290 virtio_ccw_hcall_notify
              #2  0x00000000100cbf60 s390_virtio_hypercall
              #3  0x000000001010ff7a handle_hypercall
              #4  0x0000000010079ed4 kvm_cpu_exec (qemu-system-s390x)
              #5  0x00000000100609b4 qemu_kvm_cpu_thread_fn
              #6  0x000003ff8b887bb4 start_thread (libpthread.so.0)
              #7  0x000003ff8b78df0a thread_start (libc.so.6)
      
      This is because the css array was only allocated for 0..254
      instead of 0..255.
      
      Let's fix this by bumping MAX_CSSID to 255 and fencing off the
      reserved cssid of 255 during css image allocation.
      Reported-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      882b3b97
  14. 20 7月, 2016 2 次提交
  15. 12 7月, 2016 1 次提交
  16. 11 7月, 2016 1 次提交
  17. 14 6月, 2016 2 次提交
  18. 19 5月, 2016 1 次提交
  19. 01 3月, 2016 2 次提交