Re: [PATCH v9 13/22] s390: vfio-ap: sysfs interface to view matrix mdev matrix

From: Halil Pasic
Date: Thu Sep 13 2018 - 05:12:21 EST

On 09/12/2018 07:01 PM, Tony Krowiak wrote:
On 08/20/2018 10:08 AM, Cornelia Huck wrote:
I find this output to be a bit confusing; but OTOH, I'm probably not
the person to parse it :) Still, some comments.

ÂFrom previous discussions, ISTR that this is mainly supposed to be a
debugging/administration aid. Of course, this generates some questions:
- Should this be in sysfs (sysfs attributes are supposed to follow the
ÂÂ "one value per file" rule, at least for the most part), or would
ÂÂ debugfs be a better fit?
- Should userspace code be able to introspect the current
ÂÂ configuration? If yes, it might be better to have some
ÂÂ not-so-nice-but-easily-parsable output, possibly one attribute for
ÂÂ the assigned adapters and one for the assigned domains, and a tool
ÂÂ which distills that into a nice "matrix" with labeled rows and
ÂÂ columns for human consumption.

That said, I don't really have major objections to that interface.

For now, I will leave it in, but we could conceivably simplify configuration
of the matrix and adhere to sysfs rules by modeling this after the AP bus
apmask and aqmask sysfs interfaces. If we did that, there would need to be only
three RW sysfs interfaces:

apm or apmask or ap_mask or adapter_mask or apid_mask
aqm or aqmask or aq_mask or domains or usage_domain_mask or apqi_mask
adm or admask or ad_mask or control_domains or control_domain_mask or domain_mask

To assign a device, either a bitmask or a comma separated list of IDs prepended
with a '+' could be passed in. To unassign a device, either a bitmask in or a
comma-separated list of IDs prepended with a '-' could be passed in.

Reading an attribute would return the mask. As you suggested, tools could be
provided to parse the output and display it in a human-readable format.

I would prefer an interface where one can set at least one whole mask in one
go over the current one that let us manipulate just one bit at a time.


Signed-off-by: Tony Krowiak <akrowiak@xxxxxxxxxxxxx>
Reviewed-by: Halil Pasic <pasic@xxxxxxxxxxxxx>
Tested-by: Michael Mueller <mimu@xxxxxxxxxxxxx>
Tested-by: Farhan Ali <alifm@xxxxxxxxxxxxx>
Tested-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
 drivers/s390/crypto/vfio_ap_ops.c | 52 +++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)