All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/10] s390x update
@ 2020-06-05 15:37 Cornelia Huck
  2020-06-05 15:37 ` [PULL 01/10] s390x/kvm: help valgrind in several places Cornelia Huck
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-s390x, Cornelia Huck, qemu-devel

The following changes since commit b489f015fbe2bd59d409211f79ea0a8ac5d2a66d:

  Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2020-06-05 11:53:37 +0100)

are available in the Git repository at:

  https://github.com/cohuck/qemu tags/s390x-20200605

for you to fetch changes up to c44d26a2347177f9bcd558a7c429396b373bb68e:

  target/s390x: Restrict system-mode declarations (2020-06-05 17:13:11 +0200)

----------------------------------------------------------------
s390x update:
- enhance s390x documentation
- allow ORBs without prefetch specified for vfio-ccw
- various cleanups and enhancements

----------------------------------------------------------------

Christian Borntraeger (1):
  s390x/kvm: help valgrind in several places

Cornelia Huck (4):
  docs/s390x: document the virtual css
  docs/s390x: document 3270
  docs/s390x: document vfio-ccw
  MAINTAINERS: add Thomas as additional s390x maintainer

Janosch Frank (1):
  s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name

Jared Rossi (1):
  vfio-ccw: allow non-prefetch ORBs

Philippe Mathieu-Daudé (3):
  target/s390x: Only compile decode_basedisp() on system-mode
  target/s390x/helper: Clean ifdef'ry
  target/s390x: Restrict system-mode declarations

 MAINTAINERS                    |  1 +
 docs/system/s390x/3270.rst     | 32 +++++++++++++
 docs/system/s390x/css.rst      | 86 ++++++++++++++++++++++++++++++++++
 docs/system/s390x/vfio-ccw.rst | 77 ++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst   |  3 ++
 hw/s390x/pv.c                  |  2 +-
 hw/s390x/s390-virtio-ccw.c     |  2 +-
 hw/vfio/ccw.c                  | 13 ++---
 include/hw/s390x/pv.h          |  4 +-
 target/s390x/helper.c          |  5 --
 target/s390x/internal.h        | 16 +++++--
 target/s390x/kvm.c             |  4 +-
 12 files changed, 219 insertions(+), 26 deletions(-)
 create mode 100644 docs/system/s390x/3270.rst
 create mode 100644 docs/system/s390x/css.rst
 create mode 100644 docs/system/s390x/vfio-ccw.rst

-- 
2.25.4



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PULL 01/10] s390x/kvm: help valgrind in several places
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 02/10] s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name Cornelia Huck
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell
  Cc: David Hildenbrand, Cornelia Huck, qemu-devel,
	Christian Borntraeger, qemu-s390x, Philippe Mathieu-Daudé

From: Christian Borntraeger <borntraeger@de.ibm.com>

We need some little help in the code to reduce the valgrind noise.
This patch does this with some designated initializers for the cpu
model features and subfunctions.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200429074201.100924-1-borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 target/s390x/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 69881a0da0b3..f2f75d2a57e8 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -2165,7 +2165,7 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
 
 static int query_cpu_subfunc(S390FeatBitmap features)
 {
-    struct kvm_s390_vm_cpu_subfunc prop;
+    struct kvm_s390_vm_cpu_subfunc prop = {};
     struct kvm_device_attr attr = {
         .group = KVM_S390_VM_CPU_MODEL,
         .attr = KVM_S390_VM_CPU_MACHINE_SUBFUNC,
@@ -2292,7 +2292,7 @@ static int kvm_to_feat[][2] = {
 
 static int query_cpu_feat(S390FeatBitmap features)
 {
-    struct kvm_s390_vm_cpu_feat prop;
+    struct kvm_s390_vm_cpu_feat prop = {};
     struct kvm_device_attr attr = {
         .group = KVM_S390_VM_CPU_MODEL,
         .attr = KVM_S390_VM_CPU_MACHINE_FEAT,
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 02/10] s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
  2020-06-05 15:37 ` [PULL 01/10] s390x/kvm: help valgrind in several places Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 03/10] docs/s390x: document the virtual css Cornelia Huck
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Cornelia Huck, qemu-s390x, David Hildenbrand, qemu-devel, Janosch Frank

From: Janosch Frank <frankja@linux.ibm.com>

s390_pv_perf_clear_reset() is not a very helpful name since that
function needs to be called for a normal and a clear reset via
diag308.

Let's instead name it s390_pv_prep_reset() which reflects the purpose
of the function a bit better.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200505124159.24099-1-frankja@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 hw/s390x/pv.c              | 2 +-
 hw/s390x/s390-virtio-ccw.c | 2 +-
 include/hw/s390x/pv.h      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
index f11868e865fa..ab3a2482aad7 100644
--- a/hw/s390x/pv.c
+++ b/hw/s390x/pv.c
@@ -88,7 +88,7 @@ int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak)
     return s390_pv_cmd(KVM_PV_UNPACK, &args);
 }
 
-void s390_pv_perf_clear_reset(void)
+void s390_pv_prep_reset(void)
 {
     s390_pv_cmd_exit(KVM_PV_PREP_RESET, NULL);
 }
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 67ae2e02ffd8..60b16fef77f7 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -401,7 +401,7 @@ static void s390_pv_prepare_reset(S390CcwMachineState *ms)
         s390_cpu_set_state(S390_CPU_STATE_STOPPED, S390_CPU(cs));
     }
     s390_pv_unshare();
-    s390_pv_perf_clear_reset();
+    s390_pv_prep_reset();
 }
 
 static void s390_machine_reset(MachineState *machine)
diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h
index 522ca6a04ee8..aee758bc2d34 100644
--- a/include/hw/s390x/pv.h
+++ b/include/hw/s390x/pv.h
@@ -39,7 +39,7 @@ int s390_pv_vm_enable(void);
 void s390_pv_vm_disable(void);
 int s390_pv_set_sec_parms(uint64_t origin, uint64_t length);
 int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak);
-void s390_pv_perf_clear_reset(void);
+void s390_pv_prep_reset(void);
 int s390_pv_verify(void);
 void s390_pv_unshare(void);
 void s390_pv_inject_reset_error(CPUState *cs);
@@ -49,7 +49,7 @@ static inline int s390_pv_vm_enable(void) { return 0; }
 static inline void s390_pv_vm_disable(void) {}
 static inline int s390_pv_set_sec_parms(uint64_t origin, uint64_t length) { return 0; }
 static inline int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) { return 0; }
-static inline void s390_pv_perf_clear_reset(void) {}
+static inline void s390_pv_prep_reset(void) {}
 static inline int s390_pv_verify(void) { return 0; }
 static inline void s390_pv_unshare(void) {}
 static inline void s390_pv_inject_reset_error(CPUState *cs) {};
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 03/10] docs/s390x: document the virtual css
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
  2020-06-05 15:37 ` [PULL 01/10] s390x/kvm: help valgrind in several places Cornelia Huck
  2020-06-05 15:37 ` [PULL 02/10] s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 04/10] docs/s390x: document 3270 Cornelia Huck
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Thomas Huth, qemu-s390x, Cornelia Huck, qemu-devel

Add some hints about "devno" rules.

Message-Id: <20200515151518.83950-2-cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 docs/system/s390x/css.rst    | 86 ++++++++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 docs/system/s390x/css.rst

diff --git a/docs/system/s390x/css.rst b/docs/system/s390x/css.rst
new file mode 100644
index 000000000000..3b4016118423
--- /dev/null
+++ b/docs/system/s390x/css.rst
@@ -0,0 +1,86 @@
+The virtual channel subsystem
+=============================
+
+QEMU implements a virtual channel subsystem with subchannels, (mostly
+functionless) channel paths, and channel devices (virtio-ccw, 3270, and
+devices passed via vfio-ccw). It supports multiple subchannel sets (MSS) and
+multiple channel subsystems extended (MCSS-E).
+
+All channel devices support the ``devno`` property, which takes a parameter
+in the form ``<cssid>.<ssid>.<device number>``.
+
+The default channel subsystem image id (``<cssid>``) is ``0xfe``. Devices in
+there will show up in channel subsystem image ``0`` to guests that do not
+enable MCSS-E. Note that devices with a different cssid will not be visible
+if the guest OS does not enable MCSS-E (which is true for all supported guest
+operating systems today).
+
+Supported values for the subchannel set id (``<ssid>``) range from ``0-3``.
+Devices with a ssid that is not ``0`` will not be visible if the guest OS
+does not enable MSS (any Linux version that supports virtio also enables MSS).
+Any device may be put into any subchannel set, there is no restriction by
+device type.
+
+The device number can range from ``0-0xffff``.
+
+If the ``devno`` property is not specified for a device, QEMU will choose the
+next free device number in subchannel set 0, skipping to the next subchannel
+set if no more device numbers are free.
+
+QEMU places a device at the first free subchannel in the specified subchannel
+set. If a device is hotunplugged and later replugged, it may appear at a
+different subchannel. (This is similar to how z/VM works.)
+
+
+Examples
+--------
+
+* a virtio-net device, cssid/ssid/devno automatically assigned::
+
+    -device virtio-net-ccw
+
+  In a Linux guest (without default devices and no other devices specified
+  prior to this one), this will show up as ``0.0.0000`` under subchannel
+  ``0.0.0000``.
+
+  The auto-assigned-properties in QEMU (as seen via e.g. ``info qtree``)
+  would be ``dev_id = "fe.0.0000"`` and ``subch_id = "fe.0.0000"``.
+
+* a virtio-rng device in subchannel set ``0``::
+
+    -device virtio-rng-ccw,devno=fe.0.0042
+
+  If added to the same Linux guest as above, it would show up as ``0.0.0042``
+  under subchannel ``0.0.0001``.
+
+  The properties for the device would be ``dev_id = "fe.0.0042"`` and
+  ``subch_id = "fe.0.0001"``.
+
+* a virtio-gpu device in subchannel set ``2``::
+
+    -device virtio-gpu-ccw,devno=fe.2.1111
+
+  If added to the same Linux guest as above, it would show up as ``0.2.1111``
+  under subchannel ``0.2.0000``.
+
+  The properties for the device would be ``dev_id = "fe.2.1111"`` and
+  ``subch_id = "fe.2.0000"``.
+
+* a virtio-mouse device in a non-standard channel subsystem image::
+
+    -device virtio-mouse-ccw,devno=2.0.2222
+
+  This would not show up in a standard Linux guest.
+
+  The properties for the device would be ``dev_id = "2.0.2222"`` and
+  ``subch_id = "2.0.0000"``.
+
+* a virtio-keyboard device in another non-standard channel subsystem image::
+
+    -device virtio-keyboard-ccw,devno=0.0.1234
+
+  This would not show up in a standard Linux guest, either, as ``0`` is not
+  the standard channel subsystem image id.
+
+  The properties for the device would be ``dev_id = "0.0.1234"`` and
+  ``subch_id = "0.0.0000"``.
diff --git a/docs/system/target-s390x.rst b/docs/system/target-s390x.rst
index 7d76ae97b401..37ca032d98ef 100644
--- a/docs/system/target-s390x.rst
+++ b/docs/system/target-s390x.rst
@@ -23,6 +23,7 @@ or vfio-ap is also available.
 
 .. toctree::
    s390x/vfio-ap
+   s390x/css
 
 Architectural features
 ======================
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 04/10] docs/s390x: document 3270
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (2 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 03/10] docs/s390x: document the virtual css Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 05/10] vfio-ccw: allow non-prefetch ORBs Cornelia Huck
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Thomas Huth, qemu-s390x, Cornelia Huck, qemu-devel

Add some basic info how to use 3270 devices.

Message-Id: <20200515151518.83950-3-cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 docs/system/s390x/3270.rst   | 32 ++++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 docs/system/s390x/3270.rst

diff --git a/docs/system/s390x/3270.rst b/docs/system/s390x/3270.rst
new file mode 100644
index 000000000000..1774cdcadf01
--- /dev/null
+++ b/docs/system/s390x/3270.rst
@@ -0,0 +1,32 @@
+3270 devices
+============
+
+QEMU supports connecting an external 3270 terminal emulator (such as
+``x3270``) to make a single 3270 device available to a guest. Note that this
+supports basic features only.
+
+To provide a 3270 device to a guest, create a ``x-terminal3270`` linked to
+a ``tn3270`` chardev. The guest will see a 3270 channel device. In order
+to actually be able to use it, attach the ``x3270`` emulator to the chardev.
+
+Example configuration
+---------------------
+
+* Add a ``tn3270`` chardev and a ``x-terminal3270`` to the QEMU command line::
+
+    -chardev socket,id=char_0,host=0.0.0.0,port=2300,nowait,server,tn3270
+    -device x-terminal3270,chardev=char_0,devno=fe.0.000a,id=terminal_0
+
+* Start the guest. In the guest, use ``chccwdev -e 0.0.000a`` to enable
+  the device.
+
+* On the host, start the ``x3270`` emulator::
+
+    x3270 <host>:2300
+
+* In the guest, locate the 3270 device node under ``/dev/3270/`` (say,
+  ``tty1``) and start a getty on it::
+
+    systemctl start serial-getty@3270-tty1.service
+
+This should get you an addtional tty for logging into the guest.
diff --git a/docs/system/target-s390x.rst b/docs/system/target-s390x.rst
index 37ca032d98ef..2592a05303ef 100644
--- a/docs/system/target-s390x.rst
+++ b/docs/system/target-s390x.rst
@@ -24,6 +24,7 @@ or vfio-ap is also available.
 .. toctree::
    s390x/vfio-ap
    s390x/css
+   s390x/3270
 
 Architectural features
 ======================
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 05/10] vfio-ccw: allow non-prefetch ORBs
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (3 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 04/10] docs/s390x: document 3270 Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 06/10] docs/s390x: document vfio-ccw Cornelia Huck
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Eric Farman, qemu-s390x, Cornelia Huck, qemu-devel, Jared Rossi

From: Jared Rossi <jrossi@linux.ibm.com>

Remove the explicit prefetch check when using vfio-ccw devices.
This check does not trigger in practice as all Linux channel programs
are intended to use prefetch.

Newer Linux kernel versions do not require to force the PFCH flag with
vfio-ccw devices anymore.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20200512181535.18630-2-jrossi@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 hw/vfio/ccw.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index c8624943c177..63406184d226 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -74,16 +74,9 @@ static IOInstEnding vfio_ccw_handle_request(SubchDev *sch)
     struct ccw_io_region *region = vcdev->io_region;
     int ret;
 
-    if (!(sch->orb.ctrl0 & ORB_CTRL0_MASK_PFCH)) {
-        if (!(vcdev->force_orb_pfch)) {
-            warn_once_pfch(vcdev, sch, "requires PFCH flag set");
-            sch_gen_unit_exception(sch);
-            css_inject_io_interrupt(sch);
-            return IOINST_CC_EXPECTED;
-        } else {
-            sch->orb.ctrl0 |= ORB_CTRL0_MASK_PFCH;
-            warn_once_pfch(vcdev, sch, "PFCH flag forced");
-        }
+    if (!(sch->orb.ctrl0 & ORB_CTRL0_MASK_PFCH) && vcdev->force_orb_pfch) {
+        sch->orb.ctrl0 |= ORB_CTRL0_MASK_PFCH;
+        warn_once_pfch(vcdev, sch, "PFCH flag forced");
     }
 
     QEMU_BUILD_BUG_ON(sizeof(region->orb_area) != sizeof(ORB));
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 06/10] docs/s390x: document vfio-ccw
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (4 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 05/10] vfio-ccw: allow non-prefetch ORBs Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 07/10] MAINTAINERS: add Thomas as additional s390x maintainer Cornelia Huck
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Thomas Huth, qemu-s390x, Cornelia Huck, qemu-devel

Add a basic example for passing a dasd via vfio-ccw.

Message-Id: <20200518075522.97643-1-cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 docs/system/s390x/vfio-ccw.rst | 77 ++++++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst   |  1 +
 2 files changed, 78 insertions(+)
 create mode 100644 docs/system/s390x/vfio-ccw.rst

diff --git a/docs/system/s390x/vfio-ccw.rst b/docs/system/s390x/vfio-ccw.rst
new file mode 100644
index 000000000000..8f65442c0f56
--- /dev/null
+++ b/docs/system/s390x/vfio-ccw.rst
@@ -0,0 +1,77 @@
+Subchannel passthrough via vfio-ccw
+===================================
+
+vfio-ccw (based upon the mediated vfio device infrastructure) allows to
+make certain I/O subchannels and their devices available to a guest. The
+host will not interact with those subchannels/devices any more.
+
+Note that while vfio-ccw should work with most non-QDIO devices, only ECKD
+DASDs have really been tested.
+
+Example configuration
+---------------------
+
+Step 1: configure the host device
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+As every mdev is identified by a uuid, the first step is to obtain one::
+
+  [root@host ~]# uuidgen
+  7e270a25-e163-4922-af60-757fc8ed48c6
+
+Note: it is recommended to use the ``mdevctl`` tool for actually configuring
+the host device.
+
+To define the same device as configured below to be started
+automatically, use
+
+::
+
+   [root@host ~]# driverctl -b css set-override 0.0.0313 vfio_ccw
+   [root@host ~]# mdevctl define -u 7e270a25-e163-4922-af60-757fc8ed48c6 \
+                  -p 0.0.0313 -t vfio-ccw_io -a
+
+If using ``mdevctl`` is not possible or wanted, follow the manual procedure
+below.
+
+* Locate the subchannel for the device (in this example, ``0.0.2b09``)::
+
+    [root@host ~]# lscss | grep 0.0.2b09 | awk '{print $2}'
+    0.0.0313
+
+* Unbind the subchannel (in this example, ``0.0.0313``) from the standard
+  I/O subchannel driver and bind it to the vfio-ccw driver::
+
+    [root@host ~]# echo 0.0.0313 > /sys/bus/css/devices/0.0.0313/driver/unbind
+    [root@host ~]# echo 0.0.0313 > /sys/bus/css/drivers/vfio_ccw/bind
+
+* Create the mediated device (identified by the uuid)::
+
+    [root@host ~]# echo "7e270a25-e163-4922-af60-757fc8ed48c6" > \
+    /sys/bus/css/devices/0.0.0313/mdev_supported_types/vfio_ccw-io/create
+
+Step 2: configure QEMU
+~~~~~~~~~~~~~~~~~~~~~~
+
+* Reference the created mediated device and (optionally) pick a device id to
+  be presented in the guest (here, ``fe.0.1234``, which will end up visible
+  in the guest as ``0.0.1234``::
+
+    -device vfio-ccw,devno=fe.0.1234,sysfsdev=\
+    /sys/bus/mdev/devices/7e270a25-e163-4922-af60-757fc8ed48c6
+
+* Start the guest. The device (here, ``0.0.1234``) should now be usable::
+
+    [root@guest ~]# lscss -d 0.0.1234
+    Device   Subchan.  DevType CU Type Use  PIM PAM POM  CHPID
+    ----------------------------------------------------------------------
+    0.0.1234 0.0.0007  3390/0e 3990/e9      f0  f0  ff   1a2a3a0a 00000000
+    [root@guest ~]# chccwdev -e 0.0.1234
+    Setting device 0.0.1234 online
+    Done
+    [root@guest ~]# dmesg -t
+    (...)
+    dasd-eckd 0.0.1234: A channel path to the device has become operational
+    dasd-eckd 0.0.1234: New DASD 3390/0E (CU 3990/01) with 10017 cylinders, 15 heads, 224 sectors
+    dasd-eckd 0.0.1234: DASD with 4 KB/block, 7212240 KB total size, 48 KB/track, compatible disk layout
+    dasda:VOL1/  0X2B09: dasda1
diff --git a/docs/system/target-s390x.rst b/docs/system/target-s390x.rst
index 2592a05303ef..644e404ef9fd 100644
--- a/docs/system/target-s390x.rst
+++ b/docs/system/target-s390x.rst
@@ -25,6 +25,7 @@ or vfio-ap is also available.
    s390x/vfio-ap
    s390x/css
    s390x/3270
+   s390x/vfio-ccw
 
 Architectural features
 ======================
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 07/10] MAINTAINERS: add Thomas as additional s390x maintainer
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (5 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 06/10] docs/s390x: document vfio-ccw Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 08/10] target/s390x: Only compile decode_basedisp() on system-mode Cornelia Huck
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Thomas Huth, qemu-s390x, Cornelia Huck, qemu-devel

...because two people are better than one.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Message-Id: <20200525155855.225564-1-cohuck@redhat.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3e7d9cb0a57a..6e7890ce8222 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -85,6 +85,7 @@ Architecture support
 --------------------
 S390 general architecture support
 M: Cornelia Huck <cohuck@redhat.com>
+M: Thomas Huth <thuth@redhat.com>
 S: Supported
 F: default-configs/s390x-softmmu.mak
 F: gdb-xml/s390*.xml
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 08/10] target/s390x: Only compile decode_basedisp() on system-mode
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (6 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 07/10] MAINTAINERS: add Thomas as additional s390x maintainer Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 09/10] target/s390x/helper: Clean ifdef'ry Cornelia Huck
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-s390x, Cornelia Huck, qemu-devel, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The decode_basedisp*() methods are only used in ioinst.c,
which is only build in system-mode emulation.

I/O instructions are privileged, and other S instructions
are decoded elsewhere.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200526172427.17460-6-f4bug@amsat.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 target/s390x/internal.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index 8c95c734dbe9..c1678dc6bc8b 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -204,6 +204,8 @@ enum cc_op {
     CC_OP_MAX
 };
 
+#ifndef CONFIG_USER_ONLY
+
 static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb,
                                        uint8_t *ar)
 {
@@ -225,6 +227,8 @@ static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb,
 /* Base/displacement are at the same locations. */
 #define decode_basedisp_rs decode_basedisp_s
 
+#endif /* CONFIG_USER_ONLY */
+
 /* arch_dump.c */
 int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
                               int cpuid, void *opaque);
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 09/10] target/s390x/helper: Clean ifdef'ry
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (7 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 08/10] target/s390x: Only compile decode_basedisp() on system-mode Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 15:37 ` [PULL 10/10] target/s390x: Restrict system-mode declarations Cornelia Huck
  2020-06-05 22:31 ` [PULL 00/10] s390x update Peter Maydell
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Cornelia Huck, qemu-s390x, David Hildenbrand, qemu-devel,
	Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

All this code is guarded checking CONFIG_USER_ONLY definition.
Drop the duplicated checks.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200526172427.17460-7-f4bug@amsat.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 target/s390x/helper.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index 09f60406aa33..9257d388baed 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -42,9 +42,6 @@ void s390x_cpu_timer(void *opaque)
 {
     cpu_inject_cpu_timer((S390CPU *) opaque);
 }
-#endif
-
-#ifndef CONFIG_USER_ONLY
 
 hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr)
 {
@@ -98,14 +95,12 @@ void s390_handle_wait(S390CPU *cpu)
     CPUState *cs = CPU(cpu);
 
     if (s390_cpu_halt(cpu) == 0) {
-#ifndef CONFIG_USER_ONLY
         if (is_special_wait_psw(cpu->env.psw.addr)) {
             qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
         } else {
             cpu->env.crash_reason = S390_CRASH_REASON_DISABLED_WAIT;
             qemu_system_guest_panicked(cpu_get_crash_info(cs));
         }
-#endif
     }
 }
 
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PULL 10/10] target/s390x: Restrict system-mode declarations
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (8 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 09/10] target/s390x/helper: Clean ifdef'ry Cornelia Huck
@ 2020-06-05 15:37 ` Cornelia Huck
  2020-06-05 22:31 ` [PULL 00/10] s390x update Peter Maydell
  10 siblings, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-06-05 15:37 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-s390x, Cornelia Huck, qemu-devel, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

As these declarations are restricted to !CONFIG_USER_ONLY in
helper.c, only declare them when system-mode emulation is used.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200526172427.17460-8-f4bug@amsat.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 target/s390x/internal.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index c1678dc6bc8b..b1e0ebf67f81 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -236,9 +236,11 @@ int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
 
 /* cc_helper.c */
 const char *cc_name(enum cc_op cc_op);
-void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr);
 uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
                  uint64_t vr);
+#ifndef CONFIG_USER_ONLY
+void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr);
+#endif /* CONFIG_USER_ONLY */
 
 
 /* cpu.c */
@@ -303,18 +305,18 @@ void s390_cpu_gdb_init(CPUState *cs);
 
 /* helper.c */
 void s390_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
-hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
+void do_restart_interrupt(CPUS390XState *env);
+#ifndef CONFIG_USER_ONLY
 uint64_t get_psw_mask(CPUS390XState *env);
 void s390_cpu_recompute_watchpoints(CPUState *cs);
 void s390x_tod_timer(void *opaque);
 void s390x_cpu_timer(void *opaque);
-void do_restart_interrupt(CPUS390XState *env);
 void s390_handle_wait(S390CPU *cpu);
+hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
 #define S390_STORE_STATUS_DEF_ADDR offsetof(LowCore, floating_pt_save_area)
 int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch);
 int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len);
-#ifndef CONFIG_USER_ONLY
 LowCore *cpu_map_lowcore(CPUS390XState *env);
 void cpu_unmap_lowcore(LowCore *lowcore);
 #endif /* CONFIG_USER_ONLY */
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PULL 00/10] s390x update
  2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
                   ` (9 preceding siblings ...)
  2020-06-05 15:37 ` [PULL 10/10] target/s390x: Restrict system-mode declarations Cornelia Huck
@ 2020-06-05 22:31 ` Peter Maydell
  10 siblings, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2020-06-05 22:31 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: qemu-s390x, QEMU Developers

On Fri, 5 Jun 2020 at 16:38, Cornelia Huck <cohuck@redhat.com> wrote:
>
> The following changes since commit b489f015fbe2bd59d409211f79ea0a8ac5d2a66d:
>
>   Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2020-06-05 11:53:37 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/cohuck/qemu tags/s390x-20200605
>
> for you to fetch changes up to c44d26a2347177f9bcd558a7c429396b373bb68e:
>
>   target/s390x: Restrict system-mode declarations (2020-06-05 17:13:11 +0200)
>
> ----------------------------------------------------------------
> s390x update:
> - enhance s390x documentation
> - allow ORBs without prefetch specified for vfio-ccw
> - various cleanups and enhancements
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-06-05 22:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 15:37 [PULL 00/10] s390x update Cornelia Huck
2020-06-05 15:37 ` [PULL 01/10] s390x/kvm: help valgrind in several places Cornelia Huck
2020-06-05 15:37 ` [PULL 02/10] s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name Cornelia Huck
2020-06-05 15:37 ` [PULL 03/10] docs/s390x: document the virtual css Cornelia Huck
2020-06-05 15:37 ` [PULL 04/10] docs/s390x: document 3270 Cornelia Huck
2020-06-05 15:37 ` [PULL 05/10] vfio-ccw: allow non-prefetch ORBs Cornelia Huck
2020-06-05 15:37 ` [PULL 06/10] docs/s390x: document vfio-ccw Cornelia Huck
2020-06-05 15:37 ` [PULL 07/10] MAINTAINERS: add Thomas as additional s390x maintainer Cornelia Huck
2020-06-05 15:37 ` [PULL 08/10] target/s390x: Only compile decode_basedisp() on system-mode Cornelia Huck
2020-06-05 15:37 ` [PULL 09/10] target/s390x/helper: Clean ifdef'ry Cornelia Huck
2020-06-05 15:37 ` [PULL 10/10] target/s390x: Restrict system-mode declarations Cornelia Huck
2020-06-05 22:31 ` [PULL 00/10] s390x update Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.