Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3285976pxk; Mon, 5 Oct 2020 06:10:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqJzDNLstJW3e4iCA8MzFZIaOiMFgvTKSOUoHhuSS5Tb2IvYKYmgJ/Yw9Sn82aTCgbCsgj X-Received: by 2002:a5d:574c:: with SMTP id q12mr17735578wrw.253.1601903423935; Mon, 05 Oct 2020 06:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601903423; cv=none; d=google.com; s=arc-20160816; b=pkhT4GVvdK0MqO2ur/sJRE8d+YdoUR+YZNtngL1TSDvj4PG4s0SKLwPRKTrGJcybGN nj1+tN3XXh/rdrh4ii1y1XxgMWftSUXUGGJQqZGZ5PkP8E8GK9eRhLoKuS6zAMeGXnKV cmD7/xPc8CoLDxYUpRUqHIqYwQo2lvpOfAJ64m8vOqR4O8dQ61MpMkvfomnB2c8rpp3j TwrRxemz/6oBQmy7JO2daUxdkn2viH84EmkHIZ8mLV4uj797hxgttjKUYmtA+KyMBxZ5 fvKadUkTgQmJndpWXSKMfwOU9IgXqU82KxQqJCgefurZSqqDZoEnfYmOyE8BunhNzySA awIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Vr7z4hnT+iuR/5zn3y/fyWrYIuNKqsCJMD5PKQBWBjc=; b=sAp4D4+XPhflGq3kd43Gvk0ZV/loil808qEWwIaP5eFa/BTzOhcZmJBFW53/nbV9YY JJAMbg6yQGJLOMtve0ABKSe6dusj8zkhVgtKUuBeKU4Ilm+UuE9tzLetVlnYvmso/lq+ 3JpmpYAfUmsZ4E/rdAPg58cVu6N9cquYFj2Tp0T/+BzsRw2+fcwpW44FwVDl6kZkiFhG 2o+656TtGgUItA1c/PQocS2IVzpbyWKflo9FlFmUpMTmOK+SjiFiG1RuUOKFbT/tRkpF 5xnv5qs4WtwpoFxF6H97DptLSzZHPSTyrMiknPdAityLTWKYL8UaYaSdIWCEEDX3P2ig XVfA== ARC-Authentication-Results: i=1; mx.google.com; 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 bl4si7704868ejb.368.2020.10.05.06.09.57; Mon, 05 Oct 2020 06:10:23 -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; 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 S1725973AbgJENI4 (ORCPT + 99 others); Mon, 5 Oct 2020 09:08:56 -0400 Received: from verein.lst.de ([213.95.11.211]:59012 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725931AbgJENI4 (ORCPT ); Mon, 5 Oct 2020 09:08:56 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 7EDB367373; Mon, 5 Oct 2020 15:08:52 +0200 (CEST) Date: Mon, 5 Oct 2020 15:08:52 +0200 From: Christoph Hellwig To: Lorenzo Pieralisi Cc: Alex Williamson , Auger Eric , joro@8bytes.org, iommu@lists.linux-foundation.org, robin.murphy@arm.com, dwmw2@infradead.org, eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, Will Deacon , Lu Baolu , shameerali.kolothum.thodi@huawei.com, Jean-Philippe Brucker , hch@lst.de Subject: Re: [RFC 0/3] iommu: Reserved regions for IOVAs beyond dma_mask and iommu aperture Message-ID: <20201005130852.GB2163@lst.de> References: <20200928195037.22654-1-eric.auger@redhat.com> <20200928164224.12350d84@w520.home> <1cbaf3e7-cf88-77f6-4cc4-46dcd60eb649@redhat.com> <20200929121849.455af184@w520.home> <20201005104410.GA12138@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201005104410.GA12138@e121166-lin.cambridge.arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2020 at 11:44:10AM +0100, Lorenzo Pieralisi wrote: > > I see that there are both OF and ACPI hooks in pci_dma_configure() and > > both modify dev->dma_mask, which is what pci-sysfs is exposing here, > > but I'm not convinced this even does what it's intended to do. The > > driver core calls this via the bus->dma_configure callback before > > probing a driver, but then what happens when the driver calls > > pci_set_dma_mask()? This is just a wrapper for dma_set_mask() and I > > don't see anywhere that would take into account the existing > > dev->dma_mask. It seems for example that pci_dma_configure() could > > produce a 42 bit mask as we have here, then the driver could override > > that with anything that the dma_ops.dma_supported() callback finds > > acceptable, and I don't see any instances where the current > > dev->dma_mask is considered. Am I overlooking something? > > I don't think so but Christoph and Robin can provide more input on > this - it is a long story. > > ACPI and OF bindings set a default dma_mask (and dev->bus_dma_limit), > this does not prevent a driver from overriding the dev->dma_mask but DMA > mapping code still takes into account the dev->bus_dma_limit. > > This may help: > > git log -p 03bfdc31176c This is at best a historic artefact. Bus drivers have no business messing with the DMA mask, dev->bus_dma_limit is the way to communicate addressing limits on the bus (or another interconnect closer to the CPU).