Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3157895imb; Tue, 5 Mar 2019 02:19:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyr1CBxMCiRF1iHV4s6xoyFf935/GtO3yp41tlzCcv57vmUVnlcRANh0Z+J+fxlbi7LP4wO X-Received: by 2002:a65:5c4b:: with SMTP id v11mr707373pgr.411.1551781193831; Tue, 05 Mar 2019 02:19:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551781193; cv=none; d=google.com; s=arc-20160816; b=gIGYP1cfzXium1ogakgCEzY8pH3+hIcZH2DmlugavFwZFbrV124uwkJQVtEo+SMyNC 4R278f+1pYrVDeopVMenaRS1SMpwZTkUX0DmGTOLPgG2IrL4nn1rwKJLd4IG4mr+Gt/M Xgaz3exZLdIfmP7Yynfdh0/CCj6rXdyUgNgE2f4wrXkdtSCnC9imx121vwvPYIzE1+ZZ HvFOFdk2xUc4ZD54BcLVblapruzqJoLxkswRcqUb+D77XsEMzgWvafgxiXrKfrzBQ1eH A4p7LjP65i5Itmpl+NG3rzRTnD3k28AgKJ1tfFDXQxeB0V8lU/ehwVwTL/dSOj22WERB aVIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=VCYZh7YFSMbesLbBiCmfFk+IDJMC7rIj/LvGByjhvmM=; b=t5q6X9ACxloI3mVTtkmOyt3pz8kv3o/RY9P3m9A9a7gEmgVQYVUweLkVODOkQFrJdv lGlO81mNCKhmY38bxOlBIHyrXqwZqmzRZ+aXoAvQjf0lujodtjt0NrRp5HLU5kDzhTv8 lKB+TF7pxdIuGPsCv5tGAjbKJbvj5TQfoVw/SNyvhNE+JkupjC55mQ4krL3baQWI7/DC JjBwSd4F0726njT2cEaFcugoLoR+/5s+FLc5XWtCSzXsNRqWpRodUpCmJ+Glji25jjyh PLV8SIUsRmqN4PB/7Bz+e9oJGk1mwfwXHMNd+I4tM9qBq4T79rYEy38+UQh9774c1sIy Itrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24si7984977pfj.218.2019.03.05.02.19.37; Tue, 05 Mar 2019 02:19:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727479AbfCEJhA (ORCPT + 99 others); Tue, 5 Mar 2019 04:37:00 -0500 Received: from foss.arm.com ([217.140.101.70]:45460 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727200AbfCEJg7 (ORCPT ); Tue, 5 Mar 2019 04:36:59 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 04737A78; Tue, 5 Mar 2019 01:36:59 -0800 (PST) Received: from [10.37.12.57] (unknown [10.37.12.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 244823F71D; Tue, 5 Mar 2019 01:36:54 -0800 (PST) Subject: Re: [Xen-devel] [PATCH] Revert "swiotlb: remove SWIOTLB_MAP_ERROR" To: Robin Murphy , Arnd Bergmann , Konrad Rzeszutek Wilk , Boris Ostrovsky , Juergen Gross , Christoph Hellwig , Marek Szyprowski Cc: Stefano Stabellini , linux-kernel@vger.kernel.org, Mike Rapoport , iommu@lists.linux-foundation.org, Joerg Roedel , xen-devel@lists.xenproject.org, Andrew Morton References: <20190304195951.1118807-1-arnd@arndb.de> From: Julien Grall Message-ID: Date: Tue, 5 Mar 2019 09:36:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robin, On 3/4/19 11:56 PM, Robin Murphy wrote: > On 2019-03-04 7:59 pm, Arnd Bergmann wrote: >> This reverts commit b907e20508d0 ("swiotlb: remove >> SWIOTLB_MAP_ERROR"), which >> introduced an overflow warning in configurations that have a larger >> dma_addr_t than phys_addr_t: >> >> In file included from include/linux/dma-direct.h:5, >>                   from kernel/dma/swiotlb.c:23: >> kernel/dma/swiotlb.c: In function 'swiotlb_tbl_map_single': >> include/linux/dma-mapping.h:136:28: error: conversion from 'long long >> unsigned int' to 'phys_addr_t' {aka 'unsigned int'} changes value from >> '18446744073709551615' to '4294967295' [-Werror=overflow] >>   #define DMA_MAPPING_ERROR  (~(dma_addr_t)0) >>                              ^ >> kernel/dma/swiotlb.c:544:9: note: in expansion of macro >> 'DMA_MAPPING_ERROR' >>    return DMA_MAPPING_ERROR; >> >> The configuration that caused this is on 32-bit ARM, where the DMA >> address >> space depends on the enabled hardware platforms, while the physical >> address space depends on the type of MMU chosen (classic vs LPAE). > > Are these real platforms, or random configs? Realistically I don't see a > great deal of need to support DMA_ADDR_T_64BIT for non-LPAE. This is selected by CONFIG_XEN no matter the type of MMU chosen (see more below). > Particularly in this case since AFAIK the only selector of SWIOTLB on > Arm is Xen, and that by definition is never going to be useful on > non-LPAE hardware. While Xen itself requires LPAE, it is still possible to run a non-LPAE kernel in the guest. For instance, last time I checked, Debian was shipping only non-LPAE kernel for Arm32. On Arm, swiotlb is only used by the hardware domain (aka Dom0) to allow DMA in memory mapped from other guest. So the returned DMA address may be 64-bit. Hence why we select DMA_ADDR_T_64BIT above. Cheers, -- Julien Grall