Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH v3 0/6] vfio: type1: support for ARM SMMUS with VFIO_IOMMU_TYPE1
@ 2014-11-27 17:22 Antonios Motakis
       [not found] ` <1417108976-10113-1-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Antonios Motakis @ 2014-11-27 17:22 UTC (permalink / raw)
  To: kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	alex.williamson-H+wXaHxf7aLQT0dZR+AlfA
  Cc: eric.auger-QSEj5FYQhm4dnm+yROfE0A, marc.zyngier-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, Antonios Motakis,
	tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J,
	christoffer.dall-QSEj5FYQhm4dnm+yROfE0A

This patch series makes the VFIO_IOMMU_TYPE1 driver buildable on ARM, so it
may be used with ARM SMMUs. It also adds support for the IOMMU_NOEXEC flag
supported by SMMUs adhering to the ARM SMMU specification so the VFIO user can
specify whether the target memory can be executed by the device behind the
SMMU.

This applies on top of the branch 'next' by Joerg Roedel available at
git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git

Changes from v2:
 - Rebased on latest iommu/next branch by Joerg Roedel
Changes from v1:
 - Bugfixes and corrected some typos
 - Use enum for VFIO IOMMU driver capabilities

Antonios Motakis (6):
  vfio: implement iommu driver capabilities with an enum
  vfio: type1: support for ARM SMMUs
  vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag
  vfio: type1: replace domain wide protection flags with supported
    capabilities
  vfio: type1: replace vfio_domains_have_iommu_cache with generic
    function
  vfio: type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag

 drivers/vfio/Kconfig            |  2 +-
 drivers/vfio/vfio_iommu_type1.c | 85 ++++++++++++++++++++++++++++-------------
 include/uapi/linux/vfio.h       | 30 ++++++++-------
 3 files changed, 77 insertions(+), 40 deletions(-)

-- 
2.1.3

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH v3 4/6] vfio: type1: replace domain wide protection flags with supported capabilities
@ 2015-01-29 12:24 GAUGUEY Rémy 228890
       [not found] ` <022C7612790E20489F80A6F0D54B849F3B2C11AD-C/8XDKI8rPk8KqdCPk9DGyghONGMnRii@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: GAUGUEY Rémy 228890 @ 2015-01-29 12:24 UTC (permalink / raw)
  To: Antonios Motakis, kvmarm@lists.cs.columbia.edu,
	iommu@lists.linux-foundation.org, alex.williamson@redhat.com
  Cc: open list:VFIO DRIVER, will.deacon@arm.com, open list,
	tech@virtualopensystems.com

Hi Antonios, 

On Thu, 27 Nov 2014 18:22:53 Antonios Motakis wrote:
>VFIO_IOMMU_TYPE1 keeps track for each domain it knows a list of protection
>flags it always applies to all mappings in the domain. This is used for
>domains that support IOMMU_CAP_CACHE_COHERENCY.
>
>Refactor this slightly, by keeping track instead that a given domain
>supports the capability, and applying the IOMMU_CACHE protection flag when
>doing the actual DMA mappings.
>
>This will allow us to reuse the behavior for IOMMU_CAP_NOEXEC, which we
>also want to keep track of, but without applying it to all domains that
>support it unless the user explicitly requests it.
>
>Signed-off-by: Antonios Motakis <a.motakis@xxxxxxxxxxxxxxxxxxxxxx>
>---
> drivers/vfio/vfio_iommu_type1.c | 25 +++++++++++++++++--------
> 1 file changed, 17 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
>index 4a9d666..c54dab8 100644
>--- a/drivers/vfio/vfio_iommu_type1.c
>+++ b/drivers/vfio/vfio_iommu_type1.c
> 			if (ret)
> 				return ret;
> 
>@@ -731,7 +740,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
> 	}
> 
> 	if (iommu_capable(bus, IOMMU_CAP_CACHE_COHERENCY))
>-		domain->prot |= IOMMU_CACHE;
>+		domain->caps |= IOMMU_CAP_CACHE_COHERENCY;

IMHO this is not good since IOMMU_CAP_CACHE_COHERENCY is not a bitfield but an enum 
See include/linux/iommu.h 
enum iommu_cap {
	IOMMU_CAP_CACHE_COHERENCY,	/* IOMMU can enforce cache coherent DMA
					   transactions */
	IOMMU_CAP_INTR_REMAP,		/* IOMMU supports interrupt isolation */
	IOMMU_CAP_NOEXEC,		/* IOMMU_NOEXEC flag */
};
One possible fix would to redefine the enum with values with bitfiled values
enum iommu_cap {
	IOMMU_CAP_CACHE_COHERENCY = 1, /* IOMMU can enforce cache coherent DMA
					   transactions */
	IOMMU_CAP_INTR_REMAP = 2,	/* IOMMU supports interrupt isolation */
	IOMMU_CAP_NOEXEC = 4,		/* IOMMU_NOEXEC flag */
};

Regards
Rémy

>_______________________________________________
>kvmarm mailing list
>kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-01-29 16:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 17:22 [PATCH v3 0/6] vfio: type1: support for ARM SMMUS with VFIO_IOMMU_TYPE1 Antonios Motakis
     [not found] ` <1417108976-10113-1-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
2014-11-27 17:22   ` [PATCH v3 1/6] vfio: implement iommu driver capabilities with an enum Antonios Motakis
2014-11-27 17:22   ` [PATCH v3 2/6] vfio: type1: support for ARM SMMUs Antonios Motakis
2014-11-27 17:22   ` [PATCH v3 3/6] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag Antonios Motakis
2014-11-27 17:22   ` [PATCH v3 4/6] vfio: type1: replace domain wide protection flags with supported capabilities Antonios Motakis
2014-11-27 17:22   ` [PATCH v3 5/6] vfio: type1: replace vfio_domains_have_iommu_cache with generic function Antonios Motakis
2014-11-27 17:22   ` [PATCH v3 6/6] vfio: type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag Antonios Motakis
  -- strict thread matches above, loose matches on Subject: below --
2015-01-29 12:24 [PATCH v3 4/6] vfio: type1: replace domain wide protection flags with supported capabilities GAUGUEY Rémy 228890
     [not found] ` <022C7612790E20489F80A6F0D54B849F3B2C11AD-C/8XDKI8rPk8KqdCPk9DGyghONGMnRii@public.gmane.org>
2015-01-29 16:13   ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox