From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCHv7 05/26] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag Date: Tue, 23 Sep 2014 16:21:16 -0600 Message-ID: <1411510876.24563.47.camel@ul30vt.home> References: <1411483586-29304-1-git-send-email-a.motakis@virtualopensystems.com> <1411483586-29304-6-git-send-email-a.motakis@virtualopensystems.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1411483586-29304-6-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Antonios Motakis Cc: kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, marc.zyngier-5wv7dgnIgG8@public.gmane.org, "open list:ABI/API" , will.deacon-5wv7dgnIgG8@public.gmane.org, open list , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org, kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org, christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org List-Id: linux-api@vger.kernel.org On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: > We introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag to the VFIO dma map call, > and expose its availability via the capability VFIO_IOMMU_PROT_NOEXEC. > This way the user can control whether the XN flag will be set on the > requested mappings. The IOMMU_NOEXEC flag needs to be available for all > the IOMMUs of the container used. > > Signed-off-by: Antonios Motakis > --- > include/uapi/linux/vfio.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index 6612974..30f630c 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -29,6 +29,7 @@ > * capability is subject to change as groups are added or removed. > */ > #define VFIO_DMA_CC_IOMMU 4 > +#define VFIO_IOMMU_PROT_NOEXEC 5 Can't we advertise this as a flag bit in vfio_iommu_type1_info instead? Also, EEH already took 5 as seen immediately below. > > /* Check if EEH is supported */ > #define VFIO_EEH 5 > @@ -401,6 +402,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_NOEXEC (1 << 2) /* not executable from device */ > __u64 vaddr; /* Process virtual address */ > __u64 iova; /* IO virtual address */ > __u64 size; /* Size of mapping (bytes) */