s390x/sclp: proper support of larger send and receive masks
commitbc61c8c626d17970b8fdd48a2f044b92418500e0
authorClaudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Fri, 23 Feb 2018 17:42:56 +0000 (23 18:42 +0100)
committerCornelia Huck <cohuck@redhat.com>
Thu, 8 Mar 2018 14:49:23 +0000 (8 15:49 +0100)
treeea1495a4da6c01429c571bc4287ac6f535342b1f
parent08b824aa2d459f2822736ccaeb240811fac72957
s390x/sclp: proper support of larger send and receive masks

Until 67915de9f0383ccf4a ("s390x/event-facility: variable-length event masks")
we only supported sclp event masks with a size of exactly 4 bytes, even
though the architecture allows the guests to set up sclp event masks
from 1 to 1021 bytes in length.
After that patch, the behaviour was almost compliant, but some issues
were still remaining, in particular regarding the handling of selective
reads and migration.

When setting the sclp event mask, a mask size is also specified. Until
now we only considered the size in order to decide which bits to save
in the internal state. On the other hand, when a guest performs a
selective read, it sends a mask, but it does not specify a size; the
implied size is the size of the last mask that has been set.

Specifying bits in the mask of selective read that are not available in
the internal mask should return an error, and bits past the end of the
mask should obviously be ignored. This can only be achieved by keeping
track of the lenght of the mask.

The mask length is thus now part of the internal state that needs to be
migrated.

This patch fixes the handling of selective reads, whose size will now
match the length of the event mask, as per architecture.

While the default behaviour is to be compliant with the architecture,
when using older machine models the old broken behaviour is selected
(allowing only masks of size exactly 4), in order to be able to migrate
toward older versions.

Fixes: 67915de9f0383ccf4a ("s390x/event-facility: variable-length event masks")
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Message-Id: <1519407778-23095-2-git-send-email-imbrenda@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
hw/s390x/event-facility.c
hw/s390x/s390-virtio-ccw.c