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: Eric Auger X-Patchwork-Id: 8966531 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 332C19F1D3 for ; Thu, 28 Apr 2016 08:31:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59C90202AE for ; Thu, 28 Apr 2016 08:31:07 +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 86BED202A1 for ; Thu, 28 Apr 2016 08:31:06 +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 1avhKI-0007Z4-3Y; Thu, 28 Apr 2016 08:29:34 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avhK6-0007Qr-Lc for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2016 08:29:23 +0000 Received: by mail-wm0-x236.google.com with SMTP id a17so52186829wme.0 for ; Thu, 28 Apr 2016 01:29:02 -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=PZCqGiXtt4BltWlALl7N6R5S7iTs+D0OFvApV9eQ6SQ5D+ZgWrpbPk4iStBTwCfRYe 3d+VEgHT8XbY7pIN8gc2GwaWAzRftp37ehXY1xGkewQGD/WxdZB/HhQYEBdVOXBAjS7i jMhU5sKTCRdV6WuUpar2eEtuAyLx6m8Bh6R6xAeIUTmyQBy7IE/oxe/y+eHuE1dMhjUc gHSbdU/+wEnzFrxMCKbUuff+Ujci1lAXx3cV8+cOwjADm7qPeI4/r/Op61v+1rTm40D+ c3CZyrM/XyD9XfCwaLbzFs5XBdxAedj7F/OsfQUlN6AcPSTtnFKKjv4i2kol+tZjpG3y /aUQ== X-Gm-Message-State: AOPr4FXQPsWOPwAVZn2Ft8Ul/7J1NtyZD9H2KMpsttmltVYdQTaRnRhOWZH0U8oOR8f6xHxb X-Received: by 10.194.48.7 with SMTP id h7mr15195750wjn.81.1461832141300; Thu, 28 Apr 2016 01:29:01 -0700 (PDT) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160428_012922_853550_D2BE59F7 X-CRM114-Status: GOOD ( 12.18 ) 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 {