pc-bios/s390-ccw: Remove redundant vring schid attribute
The schid is already stored as an attribute of the VDev itself and any other instances are copies of this same value. To avoid CCW specific attributes in the VRing let's just access the existing VDev schid attribute as needed. Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Eric Farman <farman@linux.ibm.com> Reviewed-by: Farhan Ali <alifm@linux.ibm.com> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com> Message-ID: <20260309003601.242634-3-jrossi@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Jared Rossi committed
Mar 8, 2026 at 20:35 UTC
5dbabcfee8977cb90b38e0b2a7871602c1960eb4
4 files changed
+7
-9
pc-bios/s390-ccw/virtio-blkdev.c
+1
-1
@@ -42,7 +42,7 @@ static int virtio_blk_read_many(VDev *vdev, unsigned long sector, void *load_add
42
/* Now we can tell the host to read */
43
vring_wait_reply();
44
45
- if (drain_irqs(vr->schid)) {
45
+ if (drain_irqs()) {
46
/* Well, whatever status is supposed to contain... */
47
status = 1;
48
}
pc-bios/s390-ccw/virtio-net.c
+1
-1
@@ -88,7 +88,7 @@ int send(int fd, const void *buf, int len, int flags)
88
while (!vr_poll(txvq)) {
89
yield();
90
}
91
- if (drain_irqs(txvq->schid)) {
91
+ if (drain_irqs()) {
92
puts("send: drain irqs failed");
93
return -1;
94
}
pc-bios/s390-ccw/virtio.c
+4
-5
@@ -72,14 +72,14 @@ static long virtio_notify(SubChannelId schid, int vq_idx, long cookie)
72
* Virtio functions *
73
***********************************************/
74
75
-int drain_irqs(SubChannelId schid)
75
+int drain_irqs(void)
76
{
77
Irb irb = {};
78
int r = 0;
79
80
while (1) {
81
/* FIXME: make use of TPI, for that enable subchannel and isc */
82
- if (tsch(schid, &irb)) {
82
+ if (tsch(vdev.schid, &irb)) {
83
/* Might want to differentiate error codes later on. */
84
if (irb.scsw.cstat) {
85
r = -EIO;
@@ -134,7 +134,7 @@ static void vring_init(VRing *vr, VqInfo *info)
134
135
bool vring_notify(VRing *vr)
136
{
137
- vr->cookie = virtio_notify(vr->schid, vr->id, vr->cookie);
137
+ vr->cookie = virtio_notify(vdev.schid, vr->id, vr->cookie);
138
return vr->cookie >= 0;
139
}
140
@@ -211,7 +211,7 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd)
211
} while (cmd[i++].flags & VRING_DESC_F_NEXT);
212
213
vring_wait_reply();
214
- if (drain_irqs(vr->schid)) {
214
+ if (drain_irqs()) {
215
return -1;
216
}
217
return 0;
@@ -316,7 +316,6 @@ int virtio_setup_ccw(VDev *vdev)
316
}
317
info.num = config.num;
318
vring_init(&vdev->vrings[i], &info);
319
- vdev->vrings[i].schid = vdev->schid;
319
if (run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false)) {
320
puts("Cannot set VQ info");
321
return -EIO;
pc-bios/s390-ccw/virtio.h
+1
-2
@@ -103,7 +103,6 @@ struct VRing {
103
VRingDesc *desc;
104
VRingAvail *avail;
105
VRingUsed *used;
106
- SubChannelId schid;
106
long cookie;
107
int id;
108
};
@@ -269,7 +268,7 @@ struct VirtioCmd {
268
typedef struct VirtioCmd VirtioCmd;
269
270
bool vring_notify(VRing *vr);
272
-int drain_irqs(SubChannelId schid);
271
+int drain_irqs(void);
272
void vring_send_buf(VRing *vr, void *p, int len, int flags);
273
int vr_poll(VRing *vr);
274
int vring_wait_reply(void);