From patchwork Wed May 4 11:54:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 67122 Delivered-To: patches@linaro.org Received: by 10.140.92.199 with SMTP id b65csp135332qge; Wed, 4 May 2016 04:54:31 -0700 (PDT) X-Received: by 10.28.127.81 with SMTP id a78mr30922851wmd.34.1462362871491; Wed, 04 May 2016 04:54:31 -0700 (PDT) Return-Path: Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com. [2a00:1450:400c:c09::22b]) by mx.google.com with ESMTPS id y6si4415975wjv.135.2016.05.04.04.54.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 04:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::22b as permitted sender) client-ip=2a00:1450:400c:c09::22b; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::22b as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x22b.google.com with SMTP id a17so89575805wme.0 for ; Wed, 04 May 2016 04:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ViJzSDfeyyalOSH+sePs9b2xSr4F4PGoPqKdl4+diBQ=; b=O8wj1fZ4vWSYrfuLm7zbqBioip0ZwF273pMaRXH2ghxcMhpJm8Be705v7nNz9xX4j+ HgLVkcSj3dPXDp6fqnzcMgCVb1X1oyGCwpMywY42Zo6LfgO9IF0LyQUv7nhbto1269vX XGuTuSp2sPJPu/0sFFm8D+1nUVtHUWx71Rvpg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ViJzSDfeyyalOSH+sePs9b2xSr4F4PGoPqKdl4+diBQ=; b=PBaZd/H2XJAcIdDQ6NjSNI0nV3/QMC6xMwwhkylfpND5Rq7vDbex8ZmVrBqqqlxEKt 5g2T2HPS+iXUwzPk7xrWCNCkAZYAHFaY3JHwqC67nTL2WXDwOMANqUcw8/e6SyyNVG3f X4/5Zb5vmFMIRB5SnIeIgxFQb0dWfQoOwg311wNvY2XQqehLQu3LHcK0Eudsqf/+En1E 7kuAJ3HC5Mk6F1dIENMyeup5JuJIvdDO3AJ9cF45AyNI57b+0OiDhQZ44QbR3b2/GLUy 9kgdNsscsPsbLJdCI+2AT4VUVT0mS5V4WdIAM12B6EC2kuJetyVwMU5cB/BzyZh083vX EQeA== X-Gm-Message-State: AOPr4FUhWjDZxwcSuK45AL+gy6T2e6wwtLBG8LUHB3ySPs+v1KkNEcqNM6UVF8S+AU/JYEHTA4I= X-Received: by 10.194.26.41 with SMTP id i9mr9167455wjg.114.1462362871244; Wed, 04 May 2016 04:54:31 -0700 (PDT) Return-Path: Received: from new-host-61.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id ck9sm3816623wjc.22.2016.05.04.04.54.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 May 2016 04:54:29 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, robin.murphy@arm.com, alex.williamson@redhat.com, will.deacon@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, christoffer.dall@linaro.org, linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, iommu@lists.linux-foundation.org, Jean-Philippe.Brucker@arm.com, julien.grall@arm.com, yehuday@marvell.com Subject: [PATCH v9 1/7] vfio: introduce a vfio_dma type field Date: Wed, 4 May 2016 11:54:12 +0000 Message-Id: <1462362858-2925-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462362858-2925-1-git-send-email-eric.auger@linaro.org> References: <1462362858-2925-1-git-send-email-eric.auger@linaro.org> We introduce a vfio_dma type since we will need to discriminate different types of dma slots: - VFIO_IOVA_USER: IOVA region used to map user vaddr - VFIO_IOVA_RESERVED: IOVA region reserved to map host device PA such as MSI doorbells Signed-off-by: Eric Auger --- v6 -> v7: - add VFIO_IOVA_ANY - do not introduce yet any VFIO_IOVA_RESERVED handling --- drivers/vfio/vfio_iommu_type1.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 1.9.1 diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 75b24e9..aaf5a6c 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -53,6 +53,16 @@ module_param_named(disable_hugepages, MODULE_PARM_DESC(disable_hugepages, "Disable VFIO IOMMU support for IOMMU hugepages."); +enum vfio_iova_type { + VFIO_IOVA_USER = 0, /* standard IOVA used to map user vaddr */ + /* + * IOVA reserved to map special host physical addresses, + * MSI frames for instance + */ + VFIO_IOVA_RESERVED, + VFIO_IOVA_ANY, /* matches any IOVA type */ +}; + struct vfio_iommu { struct list_head domain_list; struct mutex lock; @@ -75,6 +85,7 @@ struct vfio_dma { unsigned long vaddr; /* Process virtual addr */ size_t size; /* Map size (bytes) */ int prot; /* IOMMU_READ/WRITE */ + enum vfio_iova_type type; /* type of IOVA */ }; struct vfio_group {