Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3587621pxk; Tue, 29 Sep 2020 00:25:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynKIMt/M2ZKj4zqQfal0yfiTxAxrsNqUs7PGH3D1iEcpQuQ1FQhtLiKQQBc9JnRkBjcNkk X-Received: by 2002:a50:f69a:: with SMTP id d26mr1713447edn.21.1601364304251; Tue, 29 Sep 2020 00:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601364304; cv=none; d=google.com; s=arc-20160816; b=uwc5ZoG2q1DNQl9g88HbcPo2QdpEN6UTfcu9N1y7qCE/XDbYea9ZB3d35ylzmbKIM8 9PLVpf7KEN1v5niIyneQ3VUSAbLIi94O3ba6S8Ol2p1GnQwaveDkoMyxNfmz+9zNDWCj 5K58dUoQerJCHvw1Edf+Ruz0KTEhvoC7Eea43UAKCl/BQa/e6g+L5Qw8FcvQ9zu8h4/l Wmc+5EZC0cBM4L3MOqjZ5td/7Bnbhe11HK1Tod6GIOkApNxS9YotwMyOt12f9w35LAm9 CCN9H6192e7waL9UI8r8VCd8pDw+0TF5evU9Su9WnfYmEp5NTqJmPgBSh3u8sUYobKqD XB4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=p4YPMWYaZn/NlSCV+4SJY1EF6+YsEiEQ6nhQ9wb6D5w=; b=UJYX9wwqRtAq+RTZI31Om5AZaz+HPQ0kfk2KwJrSznT/YYkRhfh+iy1lJELXLIiA3X nQOUF8RBWasf1NLI7owPawBwrJF8S0rRdxiHO2iRbWFO7ntEqMgwcB+adrCVWAwqIdIx ss1fs4M2A7HTAcx9iFErlTGawkKuIxlk9szYMpE3zgnp++8pilP7cblloOKoJ5ym7Xb7 BWocxlpof6f20TpyUM+VTN1P/exDVkGkt2kyGWC4eYet47sr1dMTZYDV/UJJ4SCAR0IQ zvSYyaIjSBCC7qZj/gKz2V2MAguyPL8tE+5SjMa5DphLC+9jAPgYXtLo8l60ogOkJm80 BKDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S5LuHFtl; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df7si2325459edb.271.2020.09.29.00.24.40; Tue, 29 Sep 2020 00:25:04 -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=@redhat.com header.s=mimecast20190719 header.b=S5LuHFtl; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725791AbgI2HUu (ORCPT + 99 others); Tue, 29 Sep 2020 03:20:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47626 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgI2HUu (ORCPT ); Tue, 29 Sep 2020 03:20:50 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601364048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p4YPMWYaZn/NlSCV+4SJY1EF6+YsEiEQ6nhQ9wb6D5w=; b=S5LuHFtlWLl2UzJp8bhBG+H+zes+s+g/nOBaKIDRzWsAR8dIUzUCrOkkgkmRhqbn9XGo1j xH86hQQjROatPBgbluVjdlNkXt1uLyKyuX8sc906URAJo7mRnsdz8cPCUKn1raamooH649 +5CaSdHwd4ltQMD6au1DIIfyj/YvjEY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-348-UoTOZ8xuPUSEUzduIvcDKQ-1; Tue, 29 Sep 2020 03:20:44 -0400 X-MC-Unique: UoTOZ8xuPUSEUzduIvcDKQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A32A9801F9A; Tue, 29 Sep 2020 07:20:42 +0000 (UTC) Received: from [10.36.113.210] (ovpn-113-210.ams2.redhat.com [10.36.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADDB378815; Tue, 29 Sep 2020 07:20:37 +0000 (UTC) Subject: Re: [RFC 2/3] iommu: Account for dma_mask and iommu aperture in IOVA reserved regions To: Christoph Hellwig 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 References: <20200928195037.22654-1-eric.auger@redhat.com> <20200928195037.22654-3-eric.auger@redhat.com> <20200929060307.GA6564@infradead.org> From: Auger Eric Message-ID: <35b5ff6b-1c6a-ced0-aeb0-6135b9fa26d5@redhat.com> Date: Tue, 29 Sep 2020 09:20:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200929060307.GA6564@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christoph, On 9/29/20 8:03 AM, Christoph Hellwig wrote: > 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. You will find more context in my reply to Alex. Thanks Eric > >> + if (geo.aperture_end < ULLONG_MAX && geo.aperture_end != geo.aperture_start) { > > Please avoid pointlessly overlong lines. >