Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3551852pxk; Mon, 28 Sep 2020 23:06:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw275viDCt1IKjFjpjotx4PFevfvw6doTRxXBFAWnsdhnfBEFQcdqD3H96AnyYxF4mC2Vxu X-Received: by 2002:a17:906:4c81:: with SMTP id q1mr2210348eju.72.1601359603834; Mon, 28 Sep 2020 23:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601359603; cv=none; d=google.com; s=arc-20160816; b=xLcKPEEUn4R/08POLoaOmBGE1rBw70pRzzvhIDf+o7Df3+zIo4UyX0NAgg2hMjSIaA C8Q4SIjt0TrS+Io2mOM6rd662zQYxuM5aSuQ78BSemM6xOd64hg575/4b/mnXYcRs88v XW7hpqFP+t0BLOTACGmyAjdjsx9V/73Bq76eQ3pMHf/5Fv+KX6u7I3hNAO4Smt6J+FRb ouflCbiseR99nc/RFhipfZ/5ON4/vtHAsg7plTsNJFZR5+/lDvmqLCLZAgvgO+I8HrEk 8vcZ811DDTKncwK9w/hcYWBVkFku+lOCHHqo1cFXqPW2MLuBou151oqtK9H5DE2ZU3uu wrWw== 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=48XgreAjZs4gur0K4ZOCA5DaxMVnkVf7Jp8MpcZsDas=; b=N8KDEPx0/UVtQthixwJubC6EE6lkNspgTRBZTdbrhhtW72P4NmI0aDXrMMi6zx2ioW yxjDQM632ik4klbMTc1VHXNLy1eOoFw2vdm9bYQc2rXmBpAm8ZEk9r+Q9ILk/oP2nYCd wQJF5V3EPi/pek+m9nw/a2Bi21mMbwGZxZqt+Pa/6PhZMCWmgK0G4OPNfCbV58ZsAL3D T3tEajWhvGdTRoenvjgfeM+2Y62zqrnLVUR9n2XdRG67vLPNCJXb4Azgt1w0MZ5c5FHa LaHbGzkRHniDrP8Ig0G2Q5NwKXz5rix4FSjCQ6fn31KIwP/+VpasuJzZ4q0xB4U29O01 0Q5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=oXuJQuGq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si2011369eji.683.2020.09.28.23.06.20; Mon, 28 Sep 2020 23:06:43 -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=@infradead.org header.s=casper.20170209 header.b=oXuJQuGq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725822AbgI2GDR (ORCPT + 99 others); Tue, 29 Sep 2020 02:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbgI2GDQ (ORCPT ); Tue, 29 Sep 2020 02:03:16 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97DAEC061755 for ; Mon, 28 Sep 2020 23:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=48XgreAjZs4gur0K4ZOCA5DaxMVnkVf7Jp8MpcZsDas=; b=oXuJQuGq0ROHVISt/bjm7XwpEh yG1nifrbWvewLtpXqRZ9xyNslwmyidUDLomZWW23JWBNnJAvP6eIetGY6HpbtslVV9oFUmTRnH492 7h7vO7W1sZ/atG+giK+SI9EcEpbQYGXCgsmL4XSnR+ZbjtLwmu5KeJ/Ix7yXEiFiDpu+mkJf8atJy 4pT+9vlpeuXzcjNoezx+i0Y6cm69s2ISSTlbkTndF1TyYZ/x/z9cmYxWBtKjDs8jj+kwYacrk8ILP 4Rqpb+UvBAghohjGOS1gwmSRuFahG2XBHC+chUMcdhvDJq5AdhdDc1x+gjpNddd7uzfIpZaHUHTfj RAGa15Qg==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kN8jD-0001sZ-AE; Tue, 29 Sep 2020 06:03:07 +0000 Date: Tue, 29 Sep 2020 07:03:07 +0100 From: Christoph Hellwig To: Eric Auger Cc: eric.auger.pro@gmail.com, joro@8bytes.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, will.deacon@arm.com, robin.murphy@arm.com, dwmw2@infradead.org, alex.williamson@redhat.com, jean-philippe.brucker@arm.com Subject: Re: [RFC 2/3] iommu: Account for dma_mask and iommu aperture in IOVA reserved regions Message-ID: <20200929060307.GA6564@infradead.org> References: <20200928195037.22654-1-eric.auger@redhat.com> <20200928195037.22654-3-eric.auger@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200928195037.22654-3-eric.auger@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 09:50:36PM +0200, Eric Auger wrote: > VFIO currently exposes the usable IOVA regions through the > VFIO_IOMMU_GET_INFO ioctl. However it fails to take into account > the dma_mask of the devices within the container. The top limit > currently is defined by the iommu aperture. Can we take a step back here? The dma_mask only has a meaning for the DMA API, and not the iommu API, it should have no relevance here. More importantly if we are using vfio no dma_mask should be set to start with. > + if (geo.aperture_end < ULLONG_MAX && geo.aperture_end != geo.aperture_start) { Please avoid pointlessly overlong lines.