Message ID | 1397755775-23833-3-git-send-email-a.rigo@virtualopensystems.com |
---|---|
State | New |
Headers | show |
On Fri, Apr 18, 2014 at 3:29 AM, Alvise Rigo <a.rigo@virtualopensystems.com> 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 <a.rigo@virtualopensystems.com> > --- > 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? 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 > >
On 24/04/2014 02:25, Peter Crosthwaite wrote: > On Fri, Apr 18, 2014 at 3:29 AM, Alvise Rigo > <a.rigo@virtualopensystems.com> 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 <a.rigo@virtualopensystems.com> >> --- >> 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 >> >>
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; + /* * 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) */
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 <a.rigo@virtualopensystems.com> --- hw/vfio/common.c | 3 +++ linux-headers/linux/vfio.h | 1 + 2 files changed, 4 insertions(+)