On Wed, 12 Sep 2018 15:42:58 -0400 Tony Krowiak <akrowiak@xxxxxxxxxxxxxxxxxx> wrote: > From: Tony Krowiak <akrowiak@xxxxxxxxxxxxx> > > Provides the sysfs interfaces for: > > 1. Assigning AP control domains to the mediated matrix device > > 2. Unassigning AP control domains from a mediated matrix device > > 3. Displaying the control domains assigned to a mediated matrix > device > > The IDs of the AP control domains assigned to the mediated matrix > device are stored in an AP domain mask (ADM). The bits in the ADM, > from most significant to least significant bit, correspond to > AP domain numbers 0 to 255. On some systems, the maximum allowable > domain number may be less than 255 - depending upon the host's > AP configuration - and assignment may be rejected if the input > domain ID exceeds the limit. > > When a control domain is assigned, the bit corresponding its domain > ID will be set in the ADM. Likewise, when a domain is unassigned, > the bit corresponding to its domain ID will be cleared in the ADM. > > The relevant sysfs structures are: > > /sys/devices/vfio_ap/matrix/ > ...... [mdev_supported_types] > ......... [vfio_ap-passthrough] > ............ [devices] > ...............[$uuid] > .................. assign_control_domain > .................. unassign_control_domain > > To assign a control domain to the $uuid mediated matrix device's > ADM, write its domain number to the assign_control_domain file. > To unassign a domain, write its domain number to the > unassign_control_domain file. The domain number is specified > using conventional semantics: If it begins with 0x the number > will be parsed as a hexadecimal (case insensitive) number; > if it begins with 0, it is parsed as an octal number; > otherwise, it will be parsed as a decimal number. > > For example, to assign control domain 173 (0xad) to the mediated > matrix device $uuid: > > echo 173 > assign_control_domain > > or > > echo 0255 > assign_control_domain > > or > > echo 0xad > assign_control_domain > > To unassign control domain 173 (0xad): > > echo 173 > unassign_control_domain > > or > > echo 0255 > unassign_control_domain > > or > > echo 0xad > unassign_control_domain > > The assignment will be rejected if the APQI exceeds the maximum > value for an AP domain: > * If the AP Extended Addressing (APXA) facility is installed, > the max value is 255 > * Else the max value is 15 > > 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 | 112 +++++++++++++++++++++++++++++++++++++ > 1 files changed, 112 insertions(+), 0 deletions(-) > Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx>