Re: [PATCH RFC 2/2] vfio-ccw: support for halt/clear subchannel

Halil Pasic
2018-06-12T14:08:57Z

On 06/12/2018 03:56 PM, Pierre Morel wrote:
>> So, what are you proposing? Being more specific and stating that the
>> scsw is not necessarily a real scsw, but merely a vehicle for sending a
>> command? Or keeping it as it is now for ssch, and adding a second
>> interface for hsch/csch (and maybe rsch, msch, ...)?
>>
>
>
> I said no radical surgery, but after thinking more about it...
> I am not sure.
>
> Let's explain this:
>
> I see 2 ways to proceed but my favorite is definitively to introduce versioning.
>
>
> Way 1)
>
> This was the way I first thought about.
> We keep the existing IO Regionand structures, and are more
> specific by stating that the io_region is a command region during write
> entry and a status region during interrupt handling:
> This allow us to use the 3 bits of the FCTL field of the SCSW to pass
> commands to the kernel and stay backward compatible.
> The FCTL field has 3 bits => we can have 8 commands.
>
> PRO: small change
>
> CONTRA: This is still confusing, we do not really solve this
>         unclarity problem since QEMU view / documentation and
>         Linux view / documentation differ or we update QEMU.
>         Moreover this does not allow for long term extensions
>         and/or re-design.
>
>

I'm not really in favor of way 1. Conie's point with RSCH is a good one.
And IMHO it speaks for a new interface for commands. Squeezing the RSCH
command into the SCSW does not seem to be a good idea. Considering your
proposal with the 3 bits, we could do something like: if in FCTL the
start and the clear and the halt bits are set then we postulate that is
request for a resume. But that would be quite confusing, and we would end
up re-defining the semantic of the scsw_area -- in respect to what is
documented Documentation/s390/vfio-ccw.txt, and also what is intuitive
based on the uapi header.

>
> Way 2)
>
> We use the device VFIO versioning using the capability chain to advertise
> a new interface.
>
> This the preferred way, it is sane, allows for the userland backward
> compatibility and allows to have a new command interface, extensible
> for future use.
>
> In this case we can extend the interface to be any kind we want
> in a next version, pwrite with new io_region, mmap on new
> IO regions, status region...
>
> PRO: Extensible and also goes in the VFIO INFO extension direction
>      proposed by Alex
>

Sounds much better. I imagine the coexistence of old and new like this.
Both the old and the new QEMU would supply the the SCSW area with the old
documented semantics -- the SCSW of the virtual subchannel. But with the
new version an explicit command would be supplied via the command region
(also for SSCH). Maybe the SCSW can still end up being useful for
something in the kernel module too (maybe there are some optimization
that can be done based on the QEMU SCSW).

> CONTRA: I see none outer more work to do (but is it a problem?)
>
>
The problem I see is that designing a good interface usually hard.
I could help with review, but I don't have the resources to commit
to more than that.

> ====================
>
> Extra argumentation for versioning support
>
>
> Suppose a future implementation with 4 mapped regions like
> the following:
>
> - A Status region (RO updated as result of command and IRQ)
>
> - A command region (WO where the user send its commands)
>   userland write here to trigger IO (quite as currently)
>
> - A CCW program region (RW where the CCW chain is handled)
>   most handling done from userspace, last translations in kernel,
>   double buffering...
>
> - A performance / measurement / statistics region (RO)
>   This is updated asynchronously by hardware and/or driver
>
> This is purely theoretical and we do not need to do all at once
> but if we want to extend the implementation without problems
> and continue backward compatibility the versioning and capability
> handling is a must.

I'm not sure about this.

Regards,
Halil
[..]