From patchwork Tue Apr 19 17:24:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 66131 Delivered-To: patches@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1983587qge; Tue, 19 Apr 2016 10:24:56 -0700 (PDT) X-Received: by 10.28.98.137 with SMTP id w131mr25654138wmb.30.1461086696926; Tue, 19 Apr 2016 10:24:56 -0700 (PDT) Return-Path: Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com. [2a00:1450:400c:c09::234]) by mx.google.com with ESMTPS id cz8si1330612wjd.11.2016.04.19.10.24.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Apr 2016 10:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::234 as permitted sender) client-ip=2a00:1450:400c:c09::234; 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::234 as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x234.google.com with SMTP id v188so171471427wme.1 for ; Tue, 19 Apr 2016 10:24:56 -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=g3n9R+XisMZjvZ4+eB8lWF06GHxkiT/99lE3lpsYI0V7WmL8Zb+c+6krGhO1+wKLBO tkd3zvmEqTsCYXvRrjDZaRgOiMtnfw9LZJhcOABE6hQP0tTSsjof7OaVNJ44dzMwGuna DTARiAgaqlFOopcblT2cA2j6jvY3L6FfZ0mjQ= 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=hSWnKLLjLfEUdGPP3F4Ys6i5bLzxR5/aqYgca5X7qxTu3rYjRwaPnJnfRbfv7MwcvJ dAZy99xjsdgruMm5IbhCMxkwAh1z0ff0Vlva5lPdLmqgtYKy1NkK1tE5Ka664YG2ydSF uULnqdA/G1DGMnJVoerv6s/0FAijUUiIYmKCRgU/dLvOozGjyf+SJZ/zpGamW/8qgxa7 5Fn5bOyuKlXSHDPJWyj+u4HlqZsiaaQ+MK6YZt9Tfdrs5sgQ2cYgTGPkvNY7ji0Xa6Eu s3c71/ZG0OrkV9HWXeO7MDbvF3C+6MMEVF3CrxQFo0W6Fe2KCLufJ+/On9i8g7gnIaLg pIWQ== X-Gm-Message-State: AOPr4FW0aEFtabJ2BnERFBI2UpzvVLsbcTzEWm4qsL/HLiZ9W/9AC2C6YuJiq9OxxdMHTY4yJ6g= X-Received: by 10.28.24.80 with SMTP id 77mr24562976wmy.16.1461086696637; Tue, 19 Apr 2016 10:24:56 -0700 (PDT) Return-Path: Received: from new-host-34.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id w202sm5330220wmw.18.2016.04.19.10.24.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Apr 2016 10:24:55 -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 Subject: [PATCH v7 1/7] vfio: introduce a vfio_dma type field Date: Tue, 19 Apr 2016 17:24:41 +0000 Message-Id: <1461086687-2658-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461086687-2658-1-git-send-email-eric.auger@linaro.org> References: <1461086687-2658-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 {