Add device address parameter for s390x#4010
Conversation
|
(1/1) Host_RHEL.m8.u10.product_rhel.nographic.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.10.0.s390x.io-github-autotest-qemu.boot.s390-virtio: STARTED |
bb0897e to
10065f5
Compare
|
@PaulYuuu @fbq815 Could you help review? |
| def __init__(self, busid, bus_type, aobject): | ||
| """bus&ssid&devno, 4 ssid and 65536 device numbers""" | ||
| super(QCSSBus, self).__init__( | ||
| "bus", [["ssid", "devno"], [4, 65536]], busid, bus_type, aobject |
There was a problem hiding this comment.
Well, here only cover ssid and devno, as cssidset fe by default. However, should we cover unusual test scenarios? from the qemu doc
* 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"``.we can set cssid value rather than default fe, so how about includes the ssid but set fe by default.
| if device.get_param("addr"): | ||
| del device.params["addr"] | ||
| device.set_param("devno", "fe.%s.%s" % ( | ||
| hex(addr[0])[2:], f"{addr[1]:04x}")) |
There was a problem hiding this comment.
as we can mark sure the ssid only with length 0-3, so hex(addr[0])[2:] can easy transfer to addr[0]
There was a problem hiding this comment.
And for f"{addr[1]:04x}"), of course your can "fe.%s.%4x" and addr[1] to do the same thing. Or just f"fe.{addr[0]}.{addr[1]:4x}"
d1f1344 to
9b12a5c
Compare
|
Updated. |
Secure exectuion: remove hardcode of device number for secure execution related cases on s390x, cause we are adding device number by default, reference to avocado-framework/avocado-vt#4010 Signed-off-by: bfu <bfu@redhat.com>
223171a to
8117f7b
Compare
| qdevices.QCSSBus( | ||
| "virtual-css", | ||
| "virtual-css", | ||
| "virtual-css", |
There was a problem hiding this comment.
I think busid, bus_type, aobject should not be the same.
There was a problem hiding this comment.
@xuma as the info qtree, please change the bus_type to "virtual-css-bus",
reference:
dev: virtual-css-bridge, id ""
css_dev_path = true
bus: virtual-css
type virtual-css-bus
dev: virtio-keyboard-ccw, id "input_keyboard1"
ioeventfd = true
max_revision = 2 (0x2)
devno = ""
dev_id = "fe.0.0004"
subch_id = "fe.0.0004"
| """bus&cssid&ssid&devno, 255 cssid,4 ssid and 65536 device numbers""" | ||
| super(QCSSBus, self).__init__( | ||
| "bus", | ||
| [["cssid", "ssid", "devno"], [255, 4, 65536]], |
There was a problem hiding this comment.
Set some default values in arguments; this is more flexible. If we have other requirements, then we can init QCSSBus with diff length.
There was a problem hiding this comment.
And their range should be 0-255, 0-3, 0-65535.
I would suggest you refer https://gitlab.com/qemu-project/qemu/-/blob/master/docs/system/s390x/css.rst?ref_type=heads
There was a problem hiding this comment.
@maxujun should be [["cssid", "ssid", "devno"], [256, 4, 65536]]
| if device.get_param("addr"): | ||
| del device.params["addr"] | ||
| device.set_param("devno", f"{addr[0]:x}.{addr[1]}.{addr[2]:04x}") |
There was a problem hiding this comment.
Delete it and reset? For s390x, we should ensure addr is not set.
There was a problem hiding this comment.
@maxujun please use devno instead of addr for s390x
3149364 to
33b0724
Compare
|
@PaulYuuu @fbq815 Updated,Please help review.thanks. |
|
(1/1) Host_RHEL.m9.u6.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.6.0.s390x.io-github-autotest-qemu.boot.s390-virtio: STARTED |
|
@maxujun the code LGTM but seems you should handle the CI check issue |
Updated and passed. |
| """Read the values in base of 16 (hex)""" | ||
| addr = device.get_param("devno") | ||
| if isinstance(addr, int): | ||
| return [254, 0, addr] |
There was a problem hiding this comment.
If use hard code, then cssid and ssid in the __init__ are meaningless.
There was a problem hiding this comment.
I mean, if we definitely use fe.0 as the prefix, we can handle devno only, to reduce the get free slot logic.
| ) | ||
|
|
||
| @staticmethod | ||
| def _addr2stor(addr): |
There was a problem hiding this comment.
Seems this is exactly the same as QSparseBus._addr2stor, so why do we need it?
| elif not addr: # not defined | ||
| return [254, 0, None] | ||
| elif isinstance(addr, six.string_types): | ||
| addr = [int(_, 16) for _ in addr.split(".", 2)] |
There was a problem hiding this comment.
The devno can range from 0~65535, it isn't hex, so int(_, 16) is incorrect.
Can you refine the _dev2addr function?
e807b91 to
5d0d25d
Compare
| """ | ||
|
|
||
| def __init__( | ||
| self, busid, bus_type, aobject, cssid_len=256, ssid_len=4, devno_len=65536 |
There was a problem hiding this comment.
So with the latest code, it seems cssid_len and ssid_len are not necessary, as they are fixed values.
2e462ee to
a987958
Compare
(1/1) Host_RHEL.m9.u6.nographic.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.6.0.s390x.io-github-autotest-qemu.boot.s390-virtio: STARTED |
|
(1/1) Host_RHEL.m9.u7.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.6.0.s390x.io-github-autotest-qemu.nic_hotplug.one_pci.nic_virtio.s390-virtio: STARTED [stdlog] 2025-06-11 03:03:59,316 avocado.test nic_hotplug L0217 DEBUG| Hotplug 1th 'virtio-net-ccw' nic named 'hotplug_nic1' |
|
@maxujun I've seen that with SE guest, there's no devno, could you please have a check? |
|
Signed-off-by: Xujun Ma <xuma@redhat.com>
fbq815
left a comment
There was a problem hiding this comment.
LGTM:
-object s390-pv-guest,id=lsec0
[stdlog] -enable-kvm
[stdlog] -device '{"driver": "virtio-mouse-ccw", "id": "input_mouse1", "devno": "fe.0.0003"}'
[stdlog] -device '{"driver": "virtio-keyboard-ccw", "id": "input_keyboard1", "devno": "fe.0.0004"}'
Secure exectuion: remove hardcode of device number for secure execution related cases on s390x, cause we are adding device number by default, reference to avocado-framework/avocado-vt#4010 Signed-off-by: bfu <bfu@redhat.com>
ID:1360