Skip to contentSkip to conversation

docs/s390x/pcidevices: document pci devices on s390x

PATCH Superseded Sebastian Mitterle 4 participants 6 messages Jan 27, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs/s390x/pcidevices: document pci devices on s390x

Add some documentation about the zpci device and how to use it with pci devices on s390x.

Used source: Cornelia Huck's blog post
https://people.redhat.com/~cohuck/2018/02/19/notes-on-pci-on-s390x.html

---
v2: move section below 'Device support'

---
 docs/system/s390x/pcidevices.rst | 34 ++++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst     |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 docs/system/s390x/pcidevices.rst
docs/system/s390x/pcidevices.rst new file +34 -0
new file mode 100644
index 0000000000..fec905d6e6
@@ -0,0 +1,34 @@
+PCI devices on s390x
+====================
+
+PCI devices on s390x work differently than on other architectures.
+
+To start with, using a PCI device requires the additional ``zpci`` device. For example,
+in order to pass a PCI device ``0000:00:00.0`` through you'd specify::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+                   -device vfio-pci,host=0000:00:00.0,id=hostdev0
+
+Here, the zpci device is joined with the PCI device via the ``target`` property.
+
+Note that we don't set bus, slot or function here for the guest as is common in other
+PCI implementations. Topology information is not available on s390x. Instead, ``uid``
+and ``fid`` determine how the device is presented to the guest operating system.
+
+In case of Linux, ``uid`` will be used in the ``domain`` part of the PCI identifier, and
+``fid`` identifies the physical slot, i.e.::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=7,fid=8,target=hostdev0,id=zpci1 \
+                   ...
+
+will be presented in the guest as::
+
+ # lspci -v
+ 0007:00:00.0 ...
+ Physical Slot: 00000008
+ ...
+
+Finally, note that you might have to enable the ``zpci`` feature in the cpu model in oder to use
+it.
docs/system/target-s390x.rst +1 -0
index c636f64113..f6f11433c7 100644
@@ -26,6 +26,7 @@ or vfio-ap is also available.
    s390x/css
    s390x/3270
    s390x/vfio-ccw
+   s390x/pcidevices
 
 Architectural features
 ======================
Signature · 1 line
2.37.3
#1 lore raw
Quoted 2 lines · Sebastian Mitterle

Add some documentation about the zpci device and how to use it with pci devices on s390x.

Thanks for tackling this! ... some comments below...

Quoted 18 lines

Used source: Cornelia Huck's blog post
https://people.redhat.com/~cohuck/2018/02/19/notes-on-pci-on-s390x.html

---
v2: move section below 'Device support'

---
  docs/system/s390x/pcidevices.rst | 34 ++++++++++++++++++++++++++++++++
  docs/system/target-s390x.rst     |  1 +
  2 files changed, 35 insertions(+)

create mode 100644 docs/system/s390x/pcidevices.rst

docs/system/s390x/pcidevices.rst new file +0 -0
new file mode 100644
index 0000000000..fec905d6e6

docs/system/s390x/pcidevices.rst line 6

Quoted 6 lines
docs/system/s390x/pcidevices.rst new file +6 -0
@@ -0,0 +1,34 @@
+PCI devices on s390x
+====================
+
+PCI devices on s390x work differently than on other architectures.
+
+To start with, using a PCI device requires the additional ``zpci`` device. For example,

Please wrap lines at 80 columns (if possible)

docs/system/s390x/pcidevices.rst line 7

Quoted 1 line
docs/system/s390x/pcidevices.rst new file +1 -0
+in order to pass a PCI device ``0000:00:00.0`` through you'd specify::

I'd suggest to be more explicit here:

in order to pass a host PCI device ``0000:00:00.0`` through to the guest, you would specify::

docs/system/s390x/pcidevices.rst line 15

Quoted 7 lines
docs/system/s390x/pcidevices.rst new file +7 -0
+ qemu-system-s390x ... \
+                   -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+                   -device vfio-pci,host=0000:00:00.0,id=hostdev0
+
+Here, the zpci device is joined with the PCI device via the ``target`` property.
+
+Note that we don't set bus, slot or function here for the guest as is common in other

"as *it* is common" ?

Quoted 8 lines
docs/system/s390x/pcidevices.rst new file +8 -0
+PCI implementations. Topology information is not available on s390x. Instead, ``uid``
+and ``fid`` determine how the device is presented to the guest operating system.
+
+In case of Linux, ``uid`` will be used in the ``domain`` part of the PCI identifier, and
+``fid`` identifies the physical slot, i.e.::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=7,fid=8,target=hostdev0,id=zpci1 \

docs/system/s390x/pcidevices.rst line 33

Quoted 10 lines
docs/system/s390x/pcidevices.rst new file +10 -0
+                   ...
+
+will be presented in the guest as::
+
+ # lspci -v
+ 0007:00:00.0 ...
+ Physical Slot: 00000008
+ ...
+
+Finally, note that you might have to enable the ``zpci`` feature in the cpu model in oder to use

s/oder/order/

(and it's a very long line again, please wrap at 80 columns)

docs/system/s390x/pcidevices.rst line 34

Quoted 1 line
docs/system/s390x/pcidevices.rst new file +1 -0
+it.

Should we also add some information about virtio devices? (can also be added later, not necessarily in your patch already)

Thomas

Reviewed-by on v2 1/1
#3 lore raw
In reply to Sebastian Mitterle
Quoted 7 lines · Sebastian Mitterle

Add some documentation about the zpci device and how to use it with pci devices on s390x.

Used source: Cornelia Huck's blog post
https://people.redhat.com/~cohuck/2018/02/19/notes-on-pci-on-s390x.html

Thanks,

C.

Quoted 60 lines

---
v2: move section below 'Device support'

---
  docs/system/s390x/pcidevices.rst | 34 ++++++++++++++++++++++++++++++++
  docs/system/target-s390x.rst     |  1 +
  2 files changed, 35 insertions(+)

create mode 100644 docs/system/s390x/pcidevices.rst

docs/system/s390x/pcidevices.rst new file +34 -0
new file mode 100644
index 0000000000..fec905d6e6
@@ -0,0 +1,34 @@
+PCI devices on s390x
+====================
+
+PCI devices on s390x work differently than on other architectures.
+
+To start with, using a PCI device requires the additional ``zpci`` device. For example,
+in order to pass a PCI device ``0000:00:00.0`` through you'd specify::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+                   -device vfio-pci,host=0000:00:00.0,id=hostdev0
+
+Here, the zpci device is joined with the PCI device via the ``target`` property.
+
+Note that we don't set bus, slot or function here for the guest as is common in other
+PCI implementations. Topology information is not available on s390x. Instead, ``uid``
+and ``fid`` determine how the device is presented to the guest operating system.
+
+In case of Linux, ``uid`` will be used in the ``domain`` part of the PCI identifier, and
+``fid`` identifies the physical slot, i.e.::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=7,fid=8,target=hostdev0,id=zpci1 \
+                   ...
+
+will be presented in the guest as::
+
+ # lspci -v
+ 0007:00:00.0 ...
+ Physical Slot: 00000008
+ ...
+
+Finally, note that you might have to enable the ``zpci`` feature in the cpu model in oder to use
+it.
docs/system/target-s390x.rst +1 -0
index c636f64113..f6f11433c7 100644
@@ -26,6 +26,7 @@ or vfio-ap is also available.
     s390x/css
     s390x/3270
     s390x/vfio-ccw
+   s390x/pcidevices
 
  Architectural features
  ======================
#4 lore raw
In reply to Sebastian Mitterle
Quoted 21 lines · Sebastian Mitterle

Add some documentation about the zpci device and how to use it with pci devices on s390x.

Used source: Cornelia Huck's blog post
https://people.redhat.com/~cohuck/2018/02/19/notes-on-pci-on-s390x.html

---
v2: move section below 'Device support'

---
 docs/system/s390x/pcidevices.rst | 34 ++++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst     |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 docs/system/s390x/pcidevices.rst
docs/system/s390x/pcidevices.rst new file +0 -0
new file mode 100644
index 0000000000..fec905d6e6

docs/system/s390x/pcidevices.rst line 4

Quoted 4 lines
docs/system/s390x/pcidevices.rst new file +4 -0
@@ -0,0 +1,34 @@
+PCI devices on s390x
+====================
+
+PCI devices on s390x work differently than on other architectures.

add "and need to be configured in a slightly different way." ?

docs/system/s390x/pcidevices.rst line 6

Quoted 2 lines
docs/system/s390x/pcidevices.rst new file +2 -0
+
+To start with, using a PCI device requires the additional ``zpci`` device. For example,

I think the "zpci" device is not technically "required" (ISTR that we autogenerate it, if needed); however, you need it if you actually want to specify uid/fid/... what about:

"Every PCI device is linked with an additional ``zpci`` device. While the ``zpci`` device will be autogenerated if not specified, it is recommended to specify it explicitly so that you can pass s390-specific PCI configuration."

?

docs/system/s390x/pcidevices.rst line 16

Quoted 10 lines
docs/system/s390x/pcidevices.rst new file +10 -0
+in order to pass a PCI device ``0000:00:00.0`` through you'd specify::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+                   -device vfio-pci,host=0000:00:00.0,id=hostdev0
+
+Here, the zpci device is joined with the PCI device via the ``target`` property.
+
+Note that we don't set bus, slot or function here for the guest as is common in other
+PCI implementations. Topology information is not available on s390x. Instead, ``uid``

"Topology information is not available on s390x, and the guest will not see any of the bus/slot/function information specified on the command line."

?

Quoted 8 lines
docs/system/s390x/pcidevices.rst new file +8 -0
+and ``fid`` determine how the device is presented to the guest operating system.
+
+In case of Linux, ``uid`` will be used in the ``domain`` part of the PCI identifier, and
+``fid`` identifies the physical slot, i.e.::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=7,fid=8,target=hostdev0,id=zpci1 \
+                   ...

docs/system/s390x/pcidevices.rst line 34

Quoted 10 lines
docs/system/s390x/pcidevices.rst new file +10 -0
+
+will be presented in the guest as::
+
+ # lspci -v
+ 0007:00:00.0 ...
+ Physical Slot: 00000008
+ ...
+
+Finally, note that you might have to enable the ``zpci`` feature in the cpu model in oder to use
+it.

I'm wondering what the current state of that feature is -- is it present by default in the newer named models? (My original blog entry was written nearly five years ago ;)

#2 lore raw
In reply to Thomas Huth
Quoted 41 lines · Thomas Huth
Quoted 2 lines · Sebastian Mitterle

Add some documentation about the zpci device and how to use it with pci devices on s390x.

Thanks for tackling this! ... some comments below...

Quoted 18 lines

Used source: Cornelia Huck's blog post
https://people.redhat.com/~cohuck/2018/02/19/notes-on-pci-on-s390x.html

---
v2: move section below 'Device support'

---
  docs/system/s390x/pcidevices.rst | 34 ++++++++++++++++++++++++++++++++
  docs/system/target-s390x.rst     |  1 +
  2 files changed, 35 insertions(+)

create mode 100644 docs/system/s390x/pcidevices.rst

docs/system/s390x/pcidevices.rst new file +0 -0
new file mode 100644
index 0000000000..fec905d6e6

docs/system/s390x/pcidevices.rst line 6

Quoted 6 lines
docs/system/s390x/pcidevices.rst new file +6 -0
@@ -0,0 +1,34 @@
+PCI devices on s390x
+====================
+
+PCI devices on s390x work differently than on other architectures.
+
+To start with, using a PCI device requires the additional ``zpci`` device. For example,

Please wrap lines at 80 columns (if possible)

docs/system/s390x/pcidevices.rst line 7

Quoted 1 line
docs/system/s390x/pcidevices.rst new file +1 -0
+in order to pass a PCI device ``0000:00:00.0`` through you'd specify::

I'd suggest to be more explicit here:

in order to pass a host PCI device ``0000:00:00.0`` through to the guest, you would specify::

Quoted 10 lines

docs/system/s390x/pcidevices.rst line 15

Quoted 7 lines
docs/system/s390x/pcidevices.rst new file +7 -0
+ qemu-system-s390x ... \
+                   -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+                   -device vfio-pci,host=0000:00:00.0,id=hostdev0
+
+Here, the zpci device is joined with the PCI device via the ``target`` property.
+
+Note that we don't set bus, slot or function here for the guest as is common in other

"as *it* is common" ?

I checked linguee.com and it seems to me it's correct to omit the 'it' here.

Quoted 21 lines
Quoted 8 lines
docs/system/s390x/pcidevices.rst new file +8 -0
+PCI implementations. Topology information is not available on s390x. Instead, ``uid``
+and ``fid`` determine how the device is presented to the guest operating system.
+
+In case of Linux, ``uid`` will be used in the ``domain`` part of the PCI identifier, and
+``fid`` identifies the physical slot, i.e.::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=7,fid=8,target=hostdev0,id=zpci1 \

docs/system/s390x/pcidevices.rst line 33

Quoted 10 lines
docs/system/s390x/pcidevices.rst new file +10 -0
+                   ...
+
+will be presented in the guest as::
+
+ # lspci -v
+ 0007:00:00.0 ...
+ Physical Slot: 00000008
+ ...
+
+Finally, note that you might have to enable the ``zpci`` feature in the cpu model in oder to use

s/oder/order/

Quoted 7 lines

(and it's a very long line again, please wrap at 80 columns)

docs/system/s390x/pcidevices.rst line 34

Quoted 1 line
docs/system/s390x/pcidevices.rst new file +1 -0
+it.

Should we also add some information about virtio devices? (can also be added later, not necessarily in your patch already)

I don't have experience with virtio pci devices on s390x. Therefore I prefer not to add this information this time.

Quoted 2 lines

Thomas

#5 lore raw
In reply to Cornelia Huck
Quoted 76 lines · Cornelia Huck
Quoted 21 lines · Sebastian Mitterle

Add some documentation about the zpci device and how to use it with pci devices on s390x.

Used source: Cornelia Huck's blog post
https://people.redhat.com/~cohuck/2018/02/19/notes-on-pci-on-s390x.html

---
v2: move section below 'Device support'

---
 docs/system/s390x/pcidevices.rst | 34 ++++++++++++++++++++++++++++++++
 docs/system/target-s390x.rst     |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 docs/system/s390x/pcidevices.rst
docs/system/s390x/pcidevices.rst new file +0 -0
new file mode 100644
index 0000000000..fec905d6e6

docs/system/s390x/pcidevices.rst line 4

Quoted 4 lines
docs/system/s390x/pcidevices.rst new file +4 -0
@@ -0,0 +1,34 @@
+PCI devices on s390x
+====================
+
+PCI devices on s390x work differently than on other architectures.

add "and need to be configured in a slightly different way." ?

docs/system/s390x/pcidevices.rst line 6

Quoted 2 lines
docs/system/s390x/pcidevices.rst new file +2 -0
+
+To start with, using a PCI device requires the additional ``zpci`` device. For example,

I think the "zpci" device is not technically "required" (ISTR that we autogenerate it, if needed); however, you need it if you actually want to specify uid/fid/... what about:

"Every PCI device is linked with an additional ``zpci`` device. While the ``zpci`` device will be autogenerated if not specified, it is recommended to specify it explicitly so that you can pass s390-specific PCI configuration."

?

docs/system/s390x/pcidevices.rst line 16

Quoted 10 lines
docs/system/s390x/pcidevices.rst new file +10 -0
+in order to pass a PCI device ``0000:00:00.0`` through you'd specify::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+                   -device vfio-pci,host=0000:00:00.0,id=hostdev0
+
+Here, the zpci device is joined with the PCI device via the ``target`` property.
+
+Note that we don't set bus, slot or function here for the guest as is common in other
+PCI implementations. Topology information is not available on s390x. Instead, ``uid``

"Topology information is not available on s390x, and the guest will not see any of the bus/slot/function information specified on the command line."

?

Quoted 14 lines
docs/system/s390x/pcidevices.rst new file +14 -0
+and ``fid`` determine how the device is presented to the guest operating system.
+
+In case of Linux, ``uid`` will be used in the ``domain`` part of the PCI identifier, and
+``fid`` identifies the physical slot, i.e.::
+
+ qemu-system-s390x ... \
+                   -device zpci,uid=7,fid=8,target=hostdev0,id=zpci1 \
+                   ...
+
+will be presented in the guest as::
+
+ # lspci -v
+ 0007:00:00.0 ...
+ Physical Slot: 00000008
Quoted 9 lines

docs/system/s390x/pcidevices.rst line 34

Quoted 4 lines
docs/system/s390x/pcidevices.rst new file +4 -0
+ ...
+
+Finally, note that you might have to enable the ``zpci`` feature in the cpu model in oder to use
+it.

I'm wondering what the current state of that feature is -- is it present by default in the newer named models? (My original blog entry was written nearly five years ago ;)

David Hildenbrand confirmed the feature is default-on in the qemu model since qemu 4.0 and also for the host model if supported by the modern hardware. Therefore, I'll omit this sentence.