2024-03-06 14:12:01

by Jason J. Herne

[permalink] [raw]
Subject: [PATCH v2 0/5] s390/vfio-ap: queue_configuration sysfs attribute for mdevctl automation

Mdevctl requires a way to atomically query and atomically update a vfio-ap
mdev's current state. This patch set creates the queue_configuration sysfs
attribute. This new attribute allows reading and writing an mdev's entire
state in one go. If a newly written state is invalid for any reason the entire
state is rejected and the target mdev remains unchanged.

Changelog
==========
v2
- Rebased patched on top of latest master
- Reworked code to fit changes introduced by f848cba767e59
s390/vfio-ap: reset queues filtered from the guest's AP config
- Moved docs changes to separate patch

Jason J. Herne (5):
s390/ap: Externalize AP bus specific bitmap reading function
s390/vfio-ap: Add sysfs attr, queue_configuration, to export mdev
state
s390/vfio-ap: Ignore duplicate link requests in
vfio_ap_mdev_link_queue
s390/vfio-ap: Add write support to sysfs attr ap_config
s390: doc: Update doc

Documentation/arch/s390/vfio-ap.rst | 27 ++++
drivers/s390/crypto/ap_bus.c | 13 +-
drivers/s390/crypto/ap_bus.h | 22 +++
drivers/s390/crypto/vfio_ap_ops.c | 206 ++++++++++++++++++++++++--
drivers/s390/crypto/vfio_ap_private.h | 6 +-
5 files changed, 245 insertions(+), 29 deletions(-)

--
2.41.0



2024-03-06 14:12:52

by Jason J. Herne

[permalink] [raw]
Subject: [PATCH v2 5/5] s390: doc: Update doc

fix me

Signed-off-by: Jason J. Herne <[email protected]>
---
Documentation/arch/s390/vfio-ap.rst | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/Documentation/arch/s390/vfio-ap.rst b/Documentation/arch/s390/vfio-ap.rst
index 929ee1c1c940..af5ef60355a2 100644
--- a/Documentation/arch/s390/vfio-ap.rst
+++ b/Documentation/arch/s390/vfio-ap.rst
@@ -380,6 +380,33 @@ matrix device.
control_domains:
A read-only file for displaying the control domain numbers assigned to the
vfio_ap mediated device.
+ ap_config:
+ A read/write file that, when written to, allows the entire vfio_ap mediated
+ device's ap configuration to be replaced in one shot. Three masks are given,
+ one for adapters, one for domains, and one for control domains. If the
+ given state cannot be set, then no changes are made to the vfio-ap
+ mediated device.
+
+ The format of the data written to ap_config is as follows:
+ {amask},{dmask},{cmask}\n
+
+ \n is a newline character.
+
+ amask, dmask, and cmask are masks identifying which adapters, domains,
+ and control domains should be assigned to the mediated device.
+
+ The format of a mask is as follows:
+ 0xNN..NN
+
+ Where NN..NN is 64 hexadecimal characters representing a 256-bit value.
+ The leftmost (highest order) bit represents adapter/domain 0.
+
+ For an example set of masks that represent your mdev's current
+ configuration, simply cat ap_config.
+
+ This attribute is intended to be used by automation. End users would be
+ better served using the respective assign/unassign attributes for
+ adapters, domains, and control domains.

* functions:

--
2.41.0


2024-03-06 14:39:54

by Matthew Rosato

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] s390: doc: Update doc

On 3/6/24 9:08 AM, Jason J. Herne wrote:
> fix me

^^ Oops, just needs a small message here.



2024-03-06 14:41:30

by Jason J. Herne

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] s390: doc: Update doc

On 3/6/24 9:38 AM, Matthew Rosato wrote:
> On 3/6/24 9:08 AM, Jason J. Herne wrote:
>> fix me
>
> ^^ Oops, just needs a small message here.
>
>

NACK, looks good to me :)

This is what I get for thinking "nahh, no need to double check the docs
patch... It's fine." I'll fix for v3 or reply with an updated patch if
there's no other rework.

2024-03-06 14:48:51

by Matthew Rosato

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] s390/vfio-ap: queue_configuration sysfs attribute for mdevctl automation

On 3/6/24 9:08 AM, Jason J. Herne wrote:
> Mdevctl requires a way to atomically query and atomically update a vfio-ap
> mdev's current state. This patch set creates the queue_configuration sysfs

Less important than the patches themselves, but s/queue_configuration/ap_config/ here as well as title of cover letter.



2024-03-06 22:06:20

by Matthew Rosato

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] s390/vfio-ap: queue_configuration sysfs attribute for mdevctl automation

On 3/6/24 9:08 AM, Jason J. Herne wrote:
> Mdevctl requires a way to atomically query and atomically update a vfio-ap
> mdev's current state. This patch set creates the queue_configuration sysfs
> attribute. This new attribute allows reading and writing an mdev's entire
> state in one go. If a newly written state is invalid for any reason the entire
> state is rejected and the target mdev remains unchanged.
>
> Changelog
> ==========
> v2
> - Rebased patched on top of latest master
> - Reworked code to fit changes introduced by f848cba767e59
> s390/vfio-ap: reset queues filtered from the guest's AP config
> - Moved docs changes to separate patch

Tested exploitation of the new sysfs interface using proposed s390-tools code + mdevctl. Besides the other minor changes mentioned separately, feel free to include

Tested-by: Matthew Rosato <[email protected]>

for the code patches.


2024-03-11 18:21:10

by Anthony Krowiak

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] s390: doc: Update doc


On 3/6/24 9:08 AM, Jason J. Herne wrote:
> fix me
>
> Signed-off-by: Jason J. Herne <[email protected]>
> ---
> Documentation/arch/s390/vfio-ap.rst | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/Documentation/arch/s390/vfio-ap.rst b/Documentation/arch/s390/vfio-ap.rst
> index 929ee1c1c940..af5ef60355a2 100644
> --- a/Documentation/arch/s390/vfio-ap.rst
> +++ b/Documentation/arch/s390/vfio-ap.rst
> @@ -380,6 +380,33 @@ matrix device.
> control_domains:
> A read-only file for displaying the control domain numbers assigned to the
> vfio_ap mediated device.
> + ap_config:
> + A read/write file that, when written to, allows the entire vfio_ap mediated
> + device's ap configuration to be replaced in one shot. Three masks are given,
> + one for adapters, one for domains, and one for control domains. If the
> + given state cannot be set, then no changes are made to the vfio-ap
> + mediated device.
> +
> + The format of the data written to ap_config is as follows:
> + {amask},{dmask},{cmask}\n
> +
> + \n is a newline character.
> +
> + amask, dmask, and cmask are masks identifying which adapters, domains,
> + and control domains should be assigned to the mediated device.
> +
> + The format of a mask is as follows:
> + 0xNN..NN
> +
> + Where NN..NN is 64 hexadecimal characters representing a 256-bit value.
> + The leftmost (highest order) bit represents adapter/domain 0.


Same comment I made in patch 4/5:

I won't reject giving an r-b for the above, but could be more
informative; maybe more along the lines of how this is described in all
documentation:


Where NN..NN is 64 hexadecimal characters comprising a bitmap containing
256 bits. Each bit, from left

to right, corresponds to a number from 0 to 255. If a bit is set, the

corresponding adapter, domain or control domain is assigned to the
vfio_ap mdev.

You could also mention that setting an adapter or domain number greater
than the maximum allowed for

for the system will result in an error.


> +
> + For an example set of masks that represent your mdev's current
> + configuration, simply cat ap_config.
> +
> + This attribute is intended to be used by automation. End users would be
> + better served using the respective assign/unassign attributes for
> + adapters, domains, and control domains.
>
> * functions:
>