Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2212368pxb; Tue, 12 Oct 2021 01:38:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm5jpYKLGb9rUiX3dlXmeIk4RMBvM0/efXJ29471UqO6OZScnrM7UW95u/nplRyX3kBApq X-Received: by 2002:a05:6402:354a:: with SMTP id f10mr45384449edd.365.1634027929196; Tue, 12 Oct 2021 01:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634027929; cv=none; d=google.com; s=arc-20160816; b=dLbomlWPiU4qoeaSGBfdPx3D2AvcUyQa8b0G7pcPNA/3hCGxTIrqwrxODMuVjs8pqB 4N1Rg9Dm8GXgedWbsjVLbUAHR3c4ZHX4TyrMTrlzJMrKrXK75uiYHWxUZdNcfX01XPUL qaXOHoqE7ZzvN8gqx2RB/Pnj8nf5btKSloOZnZkP8t9T/VvkOONbu/eA0qrPmAePzimq bkpMFQx5es9IM4WpO/nwfov6Ob4xy+S7lsvQWfC1vvw0a9/zf1qecQy9MaT4a2oz3pSd a7KiHkZaDsdKxvFumHxm+3c+hIVvE0x8HL3UppHy3wwYYqlShRZDN/z30M8uAwhAsqOE tc6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DEKNWFqxFUX2mkg60fATcZxk9uI6yAWQjBdwjDnLhnQ=; b=DKHWbTbvmNLots4f3lzHAxZAm1fCfCa0i2L1Pcwg/E2A4Ove210Rh4ICb0i1c1g0nA C2tTVPln2sLp/RRuC6Vfd6j+w+TOKBHt1g7rbl5+mTKoO7rWGTbtPmRaBDyHA6gx0dJg kOrNcN4YGSkqI+EhsLP2P3ZeSppEAXRgrOb8BeLiP+erclwDQGkIkJSjiwSeFynq1VzM XGdbSiy38fQLnS3tpKATgaiEHWTlFrYTvoTsznf4BWiD/MpF2chXofQE352Bcjf9Wp1e SP+s1YS6hQWAeUu23UemNjILdxszeE8mZEq9KY50c0QrS6mYFNiaetb4bRbYhcBwHksn JnsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NsJs462u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si14998707ejr.517.2021.10.12.01.38.26; Tue, 12 Oct 2021 01:38:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NsJs462u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235146AbhJLIgM (ORCPT + 99 others); Tue, 12 Oct 2021 04:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234745AbhJLIgM (ORCPT ); Tue, 12 Oct 2021 04:36:12 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B67E7C061570 for ; Tue, 12 Oct 2021 01:34:10 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id r7so64465276wrc.10 for ; Tue, 12 Oct 2021 01:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DEKNWFqxFUX2mkg60fATcZxk9uI6yAWQjBdwjDnLhnQ=; b=NsJs462uexyBDbU8Q4KAvcg0jiRb7CqhuB3C/ZZeC+cxldOsCvl4OG4doA6y2zEIGv ghj7++7W4e4F8SPkosTQzv2KQGLoeCuwW5hqcPbp/7ERsCOis2Ehtb29wRxmeXhssJgx 3QI8n8NdevmclkIpIkSM7RyUXzfd2kcv1BESXapdgi3SqGefyqXi0d4GRJTsoF6qAjYf dMX/D9Rm9OUqub4KJFJCnqKU0BMfFmPZPEpuBwPlKeeSagiu7y74q6LoJNhi3880UNkW YCIjAMF4RQSI66FVB0XH8OaT4+x/dG8uq56QTR8655fXZt4NKCVOMd75F3pZVnWwEky3 bXbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DEKNWFqxFUX2mkg60fATcZxk9uI6yAWQjBdwjDnLhnQ=; b=JNxa/aRfhtCirQmzAqYQvuTjAdV/9zbvpHdOP+rWvNmtpkQEvEY9j/50GNONt6wXHz 6lfn+U3qhwxgXnR2LuEpzFPLy4saWy/LKi9amYquHpKdCW34HVG/4rbAkiifuL0eszDQ ZIkmCdYDHCf/wELcNqAixPa+uHrhUsdDQRM46GoxhRWHISYR/NIMVVWMfqnoJLG6tmkR 1+Vi6N1XWzhuLQfNtQ1IFeUANtQBi8xf58qkoj8XeBdHuar4MO74uhJAMZWc1AGU4mJV tRQiz4uKn5FmHzsNmPGeRzkqsnVswEvL5QoZRzkhUZtqtJiJXNhoABrbHLGitz5+Bobh JLqg== X-Gm-Message-State: AOAM53258P8X0cMK0KAgK7cMZ7et71M74fZU8wcC2F5N2apE2w2jEhTb 8hdJ0jIxlvp+I/H+4B62rQnq8A== X-Received: by 2002:adf:bd91:: with SMTP id l17mr30158885wrh.261.1634027649193; Tue, 12 Oct 2021 01:34:09 -0700 (PDT) Received: from myrica (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id d7sm10098871wrh.13.2021.10.12.01.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 01:34:08 -0700 (PDT) Date: Tue, 12 Oct 2021 09:33:46 +0100 From: Jean-Philippe Brucker To: Jason Gunthorpe Cc: David Gibson , Liu Yi L , alex.williamson@redhat.com, hch@lst.de, jasowang@redhat.com, joro@8bytes.org, kevin.tian@intel.com, parav@mellanox.com, lkml@metux.net, pbonzini@redhat.com, lushenming@huawei.com, eric.auger@redhat.com, corbet@lwn.net, ashok.raj@intel.com, yi.l.liu@linux.intel.com, jun.j.tian@intel.com, hao.wu@intel.com, dave.jiang@intel.com, jacob.jun.pan@linux.intel.com, kwankhede@nvidia.com, robin.murphy@arm.com, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, dwmw2@infradead.org, linux-kernel@vger.kernel.org, baolu.lu@linux.intel.com, nicolinc@nvidia.com Subject: Re: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE Message-ID: References: <20210919063848.1476776-1-yi.l.liu@intel.com> <20210919063848.1476776-12-yi.l.liu@intel.com> <20210921174438.GW327412@nvidia.com> <20211001122225.GK964074@nvidia.com> <20211011233817.GS2744544@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211011233817.GS2744544@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 11, 2021 at 08:38:17PM -0300, Jason Gunthorpe wrote: > On Mon, Oct 11, 2021 at 09:49:57AM +0100, Jean-Philippe Brucker wrote: > > > Seems like we don't need the negotiation part? The host kernel > > communicates available IOVA ranges to userspace including holes (patch > > 17), and userspace can check that the ranges it needs are within the IOVA > > space boundaries. That part is necessary for DPDK as well since it needs > > to know about holes in the IOVA space where DMA wouldn't work as expected > > (MSI doorbells for example). > > I haven't looked super closely at DPDK, but the other simple VFIO app > I am aware of struggled to properly implement this semantic (Indeed it > wasn't even clear to the author this was even needed). > > It requires interval tree logic inside the application which is not a > trivial algorithm to implement in C. > > I do wonder if the "simple" interface should have an option more like > the DMA API where userspace just asks to DMA map some user memory and > gets back the dma_addr_t to use. Kernel manages the allocation > space/etc. Agreed, it's tempting to use IOVA = VA but the two spaces aren't necessarily compatible. An extension that plugs into the IOVA allocator could be useful to userspace drivers. Thanks, Jean