qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v3 08/37] vfio/container: Switch to dma_map|unmap API


From: Duan, Zhenzhong
Subject: RE: [PATCH v3 08/37] vfio/container: Switch to dma_map|unmap API
Date: Mon, 30 Oct 2023 02:48:03 +0000


>-----Original Message-----
>From: Cédric Le Goater <clg@redhat.com>
>Sent: Friday, October 27, 2023 10:26 PM
>Subject: Re: [PATCH v3 08/37] vfio/container: Switch to dma_map|unmap API
>
>On 10/26/23 12:30, Zhenzhong Duan wrote:
>> From: Eric Auger <eric.auger@redhat.com>
>>
>> No fucntional change intended.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
...

>> diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
>> new file mode 100644
>> index 0000000000..9db8b89b2f
>> --- /dev/null
>> +++ b/hw/vfio/container-base.c
>> @@ -0,0 +1,49 @@
>> +/*
>> + * VFIO BASE CONTAINER
>> + *
>> + * Copyright (C) 2023 Intel Corporation.
>> + * Copyright Red Hat, Inc. 2023
>> + *
>> + * Authors: Yi Liu <yi.l.liu@intel.com>
>> + *          Eric Auger <eric.auger@redhat.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> +
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> +
>> + * You should have received a copy of the GNU General Public License along
>> + * with this program; if not, see <http://www.gnu.org/licenses/>.
>> + */
>
>Please reduce the header with an SPDX identifier.

Will fix.

>
>> +
>> +#include "qemu/osdep.h"
>> +#include "qapi/error.h"
>> +#include "qemu/error-report.h"
>> +#include "hw/vfio/vfio-container-base.h"
>> +
>> +int vfio_container_dma_map(VFIOContainerBase *bcontainer,
>> +                           hwaddr iova, ram_addr_t size,
>> +                           void *vaddr, bool readonly)
>> +{
>> +    if (!bcontainer->ops->dma_map) {
>
>I think this could be an assert instead ?

Good suggestion, will fix.

>
>> +        return -EINVAL;
>> +    }
>> +
>> +    return bcontainer->ops->dma_map(bcontainer, iova, size, vaddr, 
>> readonly);
>> +}
>> +
>> +int vfio_container_dma_unmap(VFIOContainerBase *bcontainer,
>> +                             hwaddr iova, ram_addr_t size,
>> +                             IOMMUTLBEntry *iotlb)
>> +{
>> +    if (!bcontainer->ops->dma_unmap) {
>> +        return -EINVAL;
>> +    }

and here.

Thanks
Zhenzhong

reply via email to

[Prev in Thread] Current Thread [Next in Thread]