virtio-ccw: commands on revision-less devices
commit151fcdfd628a396845b275831e920ddbc10a9f18
authorCornelia Huck <cohuck@redhat.com>
Tue, 16 Feb 2021 11:18:30 +0000 (16 12:18 +0100)
committerCornelia Huck <cohuck@redhat.com>
Thu, 4 Mar 2021 10:23:35 +0000 (4 11:23 +0100)
treea15d33dd0acced19628020de036bfb54da123f4c
parent403af209db8c030ed1e000640cd3cd80c6882883
virtio-ccw: commands on revision-less devices

The virtio standard specifies that any non-transitional device must
reject commands prior to revision setting (which we do). Devices
that are transitional need to assume revision 0 (legacy) if the
driver sends a non-revision-setting command first in order to
support legacy drivers. We neglected to do the latter.

Fortunately, nearly everything worked as intended anyway; the only
problem was not properly rejecting revision setting after some other
command had been issued. Easy to fix by setting revision to 0 if
we see a non-revision command on a legacy-capable revision-less
device.

Found by code inspection, not observed in the wild.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Message-Id: <20210216111830.1087847-1-cohuck@redhat.com>
hw/s390x/virtio-ccw.c