[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 2/4] Add EXEC_FLAG to VFIO DMA mappings
From: |
Alvise Rigo |
Subject: |
Re: [Qemu-devel] [RFC 2/4] Add EXEC_FLAG to VFIO DMA mappings |
Date: |
Fri, 25 Apr 2014 11:12:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 24/04/2014 02:25, Peter Crosthwaite wrote:
> On Fri, Apr 18, 2014 at 3:29 AM, Alvise Rigo
> <address@hidden> wrote:
>> The flag is mandatory for the ARM SMMU, add it.
>> When VFIO will be able to tell about the IOMMU being used, we will add
>> it only if necessary.
>>
>> Signed-off-by: Alvise Rigo <address@hidden>
>> ---
>> hw/vfio/common.c | 3 +++
>> linux-headers/linux/vfio.h | 1 +
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index 9d1f723..f4c1fec 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -107,6 +107,9 @@ static int vfio_dma_map(VFIOContainer *container, hwaddr
>> iova,
>> map.flags |= VFIO_DMA_MAP_FLAG_WRITE;
>> }
>>
>> + /* add exec flag */
>> + map.flags |= VFIO_DMA_MAP_FLAG_WRITE;
>> +
>
> Did you mean FLAG_EXEC?
Definitively yes, the flag is VFIO_DMA_MAP_FLAG_EXEC.
I will fix this in the next version.
Thank you,
alvise
>
> Regards,
> Peter
>
>> /*
>> * Try the mapping, if it fails with EBUSY, unmap the region and try
>> * again. This shouldn't be necessary, but we sometimes see it in
>> diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
>> index 17c58e0..e0b404e 100644
>> --- a/linux-headers/linux/vfio.h
>> +++ b/linux-headers/linux/vfio.h
>> @@ -392,6 +392,7 @@ struct vfio_iommu_type1_dma_map {
>> __u32 flags;
>> #define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from
>> device */
>> #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */
>> +#define VFIO_DMA_MAP_FLAG_EXEC (1 << 2) /* executable from device */
>> __u64 vaddr; /* Process virtual address */
>> __u64 iova; /* IO virtual address */
>> __u64 size; /* Size of mapping (bytes) */
>> --
>> 1.8.3.2
>>
>>