Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2904873imu; Mon, 19 Nov 2018 07:53:01 -0800 (PST) X-Google-Smtp-Source: AJdET5cjY3iJasVsaBdsJ213SEINKHCGkNGJ6el+xNHQ0hl8u+2+XvqPKAaGh0wmvcSsjC80aeXx X-Received: by 2002:a62:9a09:: with SMTP id o9-v6mr24115504pfe.229.1542642781690; Mon, 19 Nov 2018 07:53:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542642781; cv=none; d=google.com; s=arc-20160816; b=WqiTWfY+EYgH7FcIfiTcd+hE4hX2MOWZLjvwdXdQfiKPkXC1LGEz+rJgTyOOUzo4VW JhW8x4O+OquYdfs0gsreA/zp3UXcX3NYjqifd+RSowfu00h2D12JFKQE6JkWxyI+xWMB CWlawTLCjD8rAmp9k/pMfek26nltpNm9g+4Matz7xG4eQODEWoP1mqKx2WQNb+F0iffh Kevba7bG7ickOa1Eg7Ry08U5wN1ZmjbEX2QmhX0LFILbT6lQmARPqCRLGBvFp35SBQGu UFowH3uYNjR8FhaXKT3eWp9dycbmKvcrN9rWUCQ1Drk57mxLHgfh8kO0votEE2PljFUN ForA== 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=V5t3BcksypVq/uPGv9+YmU2NmmQbSSdKqoqc+Vp1s5g=; b=XGlIRGERCFOdUjU0SFYrqfTWhHJXiikROkvPESphnnMc+E25MP3LWt19Q2fSkd6jX1 LyHR0icxb5bIQ02zJvNtpAdLPFHuQYn8GZc6ElrZBrOjwlEcIVbgZGHbg9mCh2kfgx5e n4w9ySgLZF/iTvgHsWc2AfqRQgrpXEnIaIclSkwU+FiXPhmbeQ4P6y4YtIB/kvrOXGNO zfRV/vp9buQRRzugMm2i8sAhqFdR67x4EOmrAOP3gthfMA7Rj8QqZS0qOlq2zKGnwuBu BhUOM9k2/EVsEOsvtG0Wg4Xa8Hh9yTZYGZn6AXF0Uu6tVl/+6ruQBP3VJb0uv/3xsJB9 bD+g== 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 c6si18890155plr.414.2018.11.19.07.52.46; Mon, 19 Nov 2018 07:53:01 -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 S1729950AbeKTCOk (ORCPT + 99 others); Mon, 19 Nov 2018 21:14:40 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60154 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729869AbeKTCOk (ORCPT ); Mon, 19 Nov 2018 21:14:40 -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 A053015AB; Mon, 19 Nov 2018 07:50:41 -0800 (PST) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 48DA43F575; Mon, 19 Nov 2018 07:50:40 -0800 (PST) Subject: Re: [PATCH 5/5] dma-direct: always allow dma mask <= physiscal memory size To: Ramon Fried , benh@kernel.crashing.org Cc: Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, open list , iommu@lists.linux-foundation.org, hch@lst.de, linux@roeck-us.net References: <20180927223539.28449-1-hch@lst.de> <20180927223539.28449-6-hch@lst.de> <8402ecc9c8ed9c69ad3e91eca4d07a5ab077b22d.camel@kernel.crashing.org> From: Robin Murphy Message-ID: Date: Mon, 19 Nov 2018 15:50:35 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/11/2018 14:18, Ramon Fried wrote: > On Tue, Oct 9, 2018 at 8:02 AM Benjamin Herrenschmidt > wrote: >> >> On Wed, 2018-10-03 at 16:10 -0700, Alexander Duyck wrote: >>>> - * Because 32-bit DMA masks are so common we expect every architecture >>>> - * to be able to satisfy them - either by not supporting more physical >>>> - * memory, or by providing a ZONE_DMA32. If neither is the case, the >>>> - * architecture needs to use an IOMMU instead of the direct mapping. >>>> - */ >>>> - if (mask < phys_to_dma(dev, DMA_BIT_MASK(32))) >>>> + u64 min_mask; >>>> + >>>> + if (IS_ENABLED(CONFIG_ZONE_DMA)) >>>> + min_mask = DMA_BIT_MASK(ARCH_ZONE_DMA_BITS); >>>> + else >>>> + min_mask = DMA_BIT_MASK(32); >>>> + >>>> + min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT); >>>> + >>>> + if (mask >= phys_to_dma(dev, min_mask)) >>>> return 0; >>>> -#endif >>>> return 1; >>>> } >>> >>> So I believe I have run into the same issue that Guenter reported. On >>> an x86_64 system w/ Intel IOMMU. I wasn't able to complete boot and >>> all probe attempts for various devices were failing with -EIO errors. >>> >>> I believe the last mask check should be "if (mask < phys_to_dma(dev, >>> min_mask))" not a ">=" check. >> >> Right, that test is backwards. I needed to change it here too (powermac >> with the rest of the powerpc series). >> >> Cheers, >> Ben. >> >> > > Hi, I'm working on a MIPS64 soc with PCIe root complex on it, and it > appears that this series of patches are causing all PCI drivers that > request 64bit mask to fail with -5. > It's broken in 4.19. However, I just checked, it working on master. > We may need to backport a couple of patches to 4.19. I'm not sure > though which patches should be backported as there were at least 10 > patches resolving this dma_direct area recently. > Christoph, Robin. > Can we ask Greg to backport all these changes ? What do you think ? As far as I'm aware, the only real issue in 4.19 was my subtle breakage around setting bus_dma_mask - that's fixed by 6778be4e5209, which according to my inbox got picked up by autosel for 4.19 stable last week. Robin.