From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36BE5C43461 for ; Tue, 8 Sep 2020 06:58:25 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B383D21919 for ; Tue, 8 Sep 2020 06:58:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B383D21919 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 221162052D; Tue, 8 Sep 2020 06:58:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Af+vHQeKCb0g; Tue, 8 Sep 2020 06:58:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 72EC01FEDF; Tue, 8 Sep 2020 06:58:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 461CEC0052; Tue, 8 Sep 2020 06:58:22 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id E17A2C0051 for ; Tue, 8 Sep 2020 06:58:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CEEFB871DB for ; Tue, 8 Sep 2020 06:58:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aQP3FVvKf8Dq for ; Tue, 8 Sep 2020 06:58:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by hemlock.osuosl.org (Postfix) with ESMTPS id 6375D871D8 for ; Tue, 8 Sep 2020 06:58:19 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 564BD68AFE; Tue, 8 Sep 2020 08:58:14 +0200 (CEST) Date: Tue, 8 Sep 2020 08:58:14 +0200 From: Christoph Hellwig To: Jim Quinlan Subject: Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset Message-ID: <20200908065814.GB14464@lst.de> References: <20200824193036.6033-1-james.quinlan@broadcom.com> <20200824193036.6033-8-james.quinlan@broadcom.com> <20200902215314.GA881878@ubuntu-n2-xlarge-x86> <20200902223852.GA1786990@ubuntu-n2-xlarge-x86> <6922bc0b-1849-2f2f-ec2f-fe9f0124dcfc@gmail.com> <20200903005240.GA1118@Ryzen-9-3900X.localdomain> <34aa0d6094e7d6fb3492d2cda0fec8ecc04790ed.camel@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Rich Felker , "open list:SUPERH" , David Airlie , "open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS" , Hanjun Guo , "open list:REMOTE PROCESSOR REMOTEPROC SUBSYSTEM" , "open list:DRM DRIVERS FOR ALLWINNER A10" , Julien Grall , "H. Peter Anvin" , Will Deacon , Nathan Chancellor , "open list:STAGING SUBSYSTEM" , Jean-Philippe Brucker , Florian Fainelli , Yoshinori Sato , Bartosz Golaszewski , Frank Rowand , "maintainer:X86 ARCHITECTURE 32-BIT AND 64-BIT" , Russell King , Christoph Hellwig , "open list:ACPI FOR ARM64 ACPI/arm64" , Chen-Yu Tsai , Ingo Molnar , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" , Alan Stern , Len Brown , Ohad Ben-Cohen , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Mauro Carvalho Chehab , Maxime Ripard , Rob Herring , Borislav Petkov , Yong Deng , Santosh Shilimkar , Bjorn Helgaas , Dan Williams , Andy Shevchenko , "moderated list:ARM PORT" , Felipe Balbi , Saravana Kannan , Greg Kroah-Hartman , "open list:USB SUBSYSTEM" , "Rafael J. Wysocki" , open list , Paul Kocialkowski , "open list:IOMMU DRIVERS" , Thomas Gleixner , Stefano Stabellini , Daniel Vetter , Sudeep Holla , "open list:ALLWINNER A10 CSI DRIVER" , Robin Murphy X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Mon, Sep 07, 2020 at 01:40:46PM -0400, Jim Quinlan wrote: > Thanks for looking into this. The concern I have with your solution > is that returning an arbitrarily large offset might overlap with an > improbable but valid usage. AFAIK there is nothing that disallows > mapping a device to anywhere within the 64bit range of PCIe space, > including up to say 0xffffffffffffffff. > > As an alternative perhaps changing dma_capable() so that if the > dma_range_map is present then it validates that both ends of the > prospective DMA region get "hits" on one of the offset regions in the > map. Christoph, if you are okay with this I can quickly post a patch. We use a dma_addr of all-Fs as an error code, see the definition of DMA_MAPPING_ERROR. The rationale of why we think it is safe: We don't do single byte mappings, so the last address of the address space can't effectively be used for anything. So I think it would be a good fit here. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu