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=-2.2 required=3.0 tests=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 B98A3C0650F for ; Tue, 30 Jul 2019 06:26:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D3292064A for ; Tue, 30 Jul 2019 06:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbfG3G05 (ORCPT ); Tue, 30 Jul 2019 02:26:57 -0400 Received: from verein.lst.de ([213.95.11.211]:48085 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbfG3G05 (ORCPT ); Tue, 30 Jul 2019 02:26:57 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 221D568AEF; Tue, 30 Jul 2019 08:26:52 +0200 (CEST) Date: Tue, 30 Jul 2019 08:26:51 +0200 From: Christoph Hellwig To: Geert Uytterhoeven Cc: Christoph Hellwig , Linux IOMMU , Marek Szyprowski , Takashi Iwai , Robin Murphy , Michal Simek , Linux ARM , linux-m68k , Parisc List , Linux-sh list , linux-xtensa@linux-xtensa.org, linuxppc-dev , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH 4/5] dma-mapping: provide a better default ->get_required_mask Message-ID: <20190730062651.GA29518@lst.de> References: <20190725063401.29904-1-hch@lst.de> <20190725063401.29904-5-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Mon, Jul 29, 2019 at 11:57:19AM +0200, Geert Uytterhoeven wrote: > Hi Christoph, > > On Thu, Jul 25, 2019 at 8:35 AM Christoph Hellwig wrote: > > Most dma_map_ops instances are IOMMUs that work perfectly fine in 32-bits > > of IOVA space, and the generic direct mapping code already provides its > > own routines that is intelligent based on the amount of memory actually > > present. Wire up the dma-direct routine for the ARM direct mapping code > > as well, and otherwise default to the constant 32-bit mask. This way > > we only need to override it for the occasional odd IOMMU that requires > > 64-bit IOVA support, or IOMMU drivers that are more efficient if they > > can fall back to the direct mapping. > > As I know you like diving into cans of worms ;-) > > Does 64-bit IOVA support actually work in general? Or only on 64-bit > platforms, due to dma_addr_t to unsigned long truncation on 32-bit? Most IOMMUs use 32-bit IOVAs, and thus we default to the 32-bit mask because it is common and failsafe vs the normal linux assumptions. However the ia64 SGI SN2 platform, and the powerpc IBM ebus implementations seem to require a 64-bit mask already, so we keep that behavior as is.