lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb401f7d-7b2d-15ef-51c8-2c63be70f04c@linux.ibm.com>
Date:   Tue, 14 Dec 2021 09:59:11 -0500
From:   Matthew Rosato <mjrosato@...ux.ibm.com>
To:     Pierre Morel <pmorel@...ux.ibm.com>, linux-s390@...r.kernel.org
Cc:     alex.williamson@...hat.com, cohuck@...hat.com,
        schnelle@...ux.ibm.com, farman@...ux.ibm.com,
        borntraeger@...ux.ibm.com, hca@...ux.ibm.com, gor@...ux.ibm.com,
        gerald.schaefer@...ux.ibm.com, agordeev@...ux.ibm.com,
        frankja@...ux.ibm.com, david@...hat.com, imbrenda@...ux.ibm.com,
        vneethv@...ux.ibm.com, oberpar@...ux.ibm.com, freude@...ux.ibm.com,
        thuth@...hat.com, pasic@...ux.ibm.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 30/32] vfio-pci/zdev: add DTSM to clp group capability

On 12/14/21 4:58 AM, Pierre Morel wrote:
> 
> 
> On 12/7/21 21:57, Matthew Rosato wrote:
>> The DTSM, or designation type supported mask, indicates what IOAT formats
>> are available to the guest.  For an interpreted device, userspace will 
>> not
>> know what format(s) the IOAT assist supports, so pass it via the
>> capability chain.  Since the value belongs to the Query PCI Function 
>> Group
>> clp, let's extend the existing capability with a new version.
>>
>> Signed-off-by: Matthew Rosato <mjrosato@...ux.ibm.com>
>> ---
>>   drivers/vfio/pci/vfio_pci_zdev.c | 9 ++++++---
>>   include/uapi/linux/vfio_zdev.h   | 3 +++
>>   2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/vfio/pci/vfio_pci_zdev.c 
>> b/drivers/vfio/pci/vfio_pci_zdev.c
>> index 85be77492a6d..342b59ed36c9 100644
>> --- a/drivers/vfio/pci/vfio_pci_zdev.c
>> +++ b/drivers/vfio/pci/vfio_pci_zdev.c
>> @@ -45,19 +45,22 @@ static int zpci_group_cap(struct zpci_dev *zdev, 
>> struct vfio_info_cap *caps)
>>   {
>>       struct vfio_device_info_cap_zpci_group cap = {
>>           .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_GROUP,
>> -        .header.version = 1,
>> +        .header.version = 2,
>>           .dasm = zdev->dma_mask,
>>           .msi_addr = zdev->msi_addr,
>>           .flags = VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH,
>>           .mui = zdev->fmb_update,
>>           .noi = zdev->max_msi,
>>           .maxstbl = ZPCI_MAX_WRITE_SIZE,
> 
> This, maxstbl, is not part of the patch but shouldn't we consider it too?
> The maxstbl is fixed for intercepted VFIO because the kernel is handling 
> the STBL instruction in behalf of the guest.
> Here the guest will use STBL directly.
> 
> I think we should report the right maxstbl value.
> 

I think we are OK, I think you missed the line that does this already, 
it was added in patch 27 when we wire up interpretive execution.  So, 
here we are defaulting to reporting ZPCI_MAX_WRITE_SIZE, and then ...

>> -        .version = zdev->version
>> +        .version = zdev->version,
>> +        .dtsm = 0
>>       };
>>       /* Some values are different for interpreted devices */
>> -    if (zdev->kzdev && zdev->kzdev->interp)
>> +    if (zdev->kzdev && zdev->kzdev->interp) {
>>           cap.maxstbl = zdev->maxstbl;

... Here we overwrite this with the hardware value only for interpreted 
devices.  Just like we are also now additionally doing for DTSM with 
this patch.

>> +        cap.dtsm = kvm_s390_pci_get_dtsm(zdev);
>> +    }
>>       return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
>>   }
>> diff --git a/include/uapi/linux/vfio_zdev.h 
>> b/include/uapi/linux/vfio_zdev.h
>> index 1a5229b7bb18..b4c2ba8e71f0 100644
>> --- a/include/uapi/linux/vfio_zdev.h
>> +++ b/include/uapi/linux/vfio_zdev.h
>> @@ -47,6 +47,9 @@ struct vfio_device_info_cap_zpci_group {
>>       __u16 noi;        /* Maximum number of MSIs */
>>       __u16 maxstbl;        /* Maximum Store Block Length */
>>       __u8 version;        /* Supported PCI Version */
>> +    /* End of version 1 */
>> +    __u8 dtsm;        /* Supported IOAT Designations */
>> +    /* End of version 2 */
>>   };
>>   /**
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ