From patchwork Thu Apr 28 08:28:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 66875 Delivered-To: patches@linaro.org Received: by 10.140.93.198 with SMTP id d64csp80401qge; Thu, 28 Apr 2016 01:29:01 -0700 (PDT) X-Received: by 10.194.88.201 with SMTP id bi9mr13613248wjb.147.1461832141595; Thu, 28 Apr 2016 01:29:01 -0700 (PDT) Return-Path: Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com. [2a00:1450:400c:c09::22d]) by mx.google.com with ESMTPS id c10si9417422wjt.45.2016.04.28.01.29.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 01:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::22d as permitted sender) client-ip=2a00:1450:400c:c09::22d; 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::22d as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x22d.google.com with SMTP id e201so67266973wme.0 for ; Thu, 28 Apr 2016 01:29:01 -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=B9R2XieqDsFNwy25hC3MuaZEK2t0cyoU703HeuWHlp2LKbCKEPCsrcmRRZ477waYZU yyHXbp9+9oW9D5NjajKeup1H/9cZZ3PVcvqsQnulwDYEBxztbpD/7IAb+19SBg90mXAY CjnUsqE1XHGdbRbQh4kl9wejVgmeI4TvNDns8= 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=WQHGcSTFyP/tt1y8HVpmnpaLKYY9CAVpx6zRzRIoap23UqjKTTa0chS9rp60Yla8lB 36zCBa4vMV7HOlZigbRYWwueKaoBFeX6R9SixscydyJ8uhpZfxCk+Gww98z3NCP8UMs6 7vQU18PDgs2vDr04VzcDOsI1jTJmOJxscI7yB+eQ3uoeCEazYXx99augUv+PnM/+6U3a jNqM0vG1sTijHemmMcAuExMdIqTqGS+/+ajm6e1Fv7vx+9CD/Eu5hYpn5DAC0+nzzADe Vb/SK1P0uIW5jEnWH4UQqXKjknX3d2NpIreEMjsfDzyLJ6i92uaVB3xXZ1mOoVvc70ML 1c8A== X-Gm-Message-State: AOPr4FVWaus5rsZ1OWIKYyqRxXMGJvgTaSKD4B3m74jpx8YZ97lQRgGzON7nQWdChrj3XitG+Rc= X-Received: by 10.194.48.7 with SMTP id h7mr15195750wjn.81.1461832141300; Thu, 28 Apr 2016 01:29:01 -0700 (PDT) Return-Path: Received: from new-host-46.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id j6sm8349121wjb.29.2016.04.28.01.28.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 01:28:59 -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 v8 1/7] vfio: introduce a vfio_dma type field Date: Thu, 28 Apr 2016 08:28:32 +0000 Message-Id: <1461832118-5668-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461832118-5668-1-git-send-email-eric.auger@linaro.org> References: <1461832118-5668-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 {