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: Eric Auger X-Patchwork-Id: 8882211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 213BB9F39D for ; Tue, 19 Apr 2016 17:26:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F9BA202E5 for ; Tue, 19 Apr 2016 17:26:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 853172026F for ; Tue, 19 Apr 2016 17:26:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1asZOq-0007ul-2T; Tue, 19 Apr 2016 17:25:20 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asZOm-0006gL-RI for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2016 17:25:17 +0000 Received: by mail-wm0-x229.google.com with SMTP id v188so171471426wme.1 for ; Tue, 19 Apr 2016 10:24:57 -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=Qkk0LESHbwqdkA0YHcXcSu5fXu7NXmfVezX4AagN4ZwAoy/rIe8jRXX7/d/SzfY1uP hidI0QnaeHE6LlXipiVjC92ctSXmM8NlqwJUnuPY0MZgWD45Zqio2fiGrejKP8AtxXuD UZMt/wXKM2Ef1I8+RKx7UYBGe6lKGtLN4p1CKLtiJclpqcU6afy8wrzn+BAnoYZErAGk RddiaaZ0CIdlDMyoTenIAX7szal+C9eQMCWOhfLohzK89QKylhD+CjywhiZ5sLJ5fBO0 oBR+tFlDc8tJhSn73j2vfBEhpBVWiMINoi7dU+Wee/7AsIjJa3Pf43ODk8AWjGzWfSBY b+nw== X-Gm-Message-State: AOPr4FVkILgGIdQGY81iXJz7oGIJIj69RtQaBa4eu0njE6PKgYR/rP78X9hfli70gkelCE/4 X-Received: by 10.28.24.80 with SMTP id 77mr24562976wmy.16.1461086696637; Tue, 19 Apr 2016 10:24:56 -0700 (PDT) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160419_102517_182678_78AC329E X-CRM114-Status: GOOD ( 12.59 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: julien.grall@arm.com, patches@linaro.org, Jean-Philippe.Brucker@arm.com, p.fedin@samsung.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, iommu@lists.linux-foundation.org, pranav.sawargaonkar@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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 {