Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1258429imu; Thu, 13 Dec 2018 11:59:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/XIbWsU1tLdJhK3+IaM3vOcow7GpEZyI3NtCyWONGBN5yCsjZIgpiU3P3E1hzsXnpyy96Yx X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr144404plb.107.1544731187616; Thu, 13 Dec 2018 11:59:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544731187; cv=none; d=google.com; s=arc-20160816; b=uNyeRZuYnozfrl0oHRziUQobbL7Dk4XXX91YbZOvZaRoTk51Gv1SoopipxIN3Rf6WU 7AJf7w6P4akXLL729fo/R1fXrTd3RzbSLG0EFjnhS10j5j3EISuT+vBPFm+e37cpCrOH z5om/1baIT9lUsd8feYEfAME5GMbiaOEkY1T3quuem2fDkS3jc2axxfmUABcqmS0Kprw bF9bi+aoAbHPw9eCUoLWQeoE9fvltiXjYz0qDyECislS7bfvUHdcRpZdxnoa+6a4+CMW XDurbMwJ3/0MaXuzAc6BbKy3qtY9x1XPY/6l2qekPx9sP7v1KHfYZgpnIlOKq0cDI4Ug s78Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VvfP9wRvuBpkXC59vDwHc2WRLg3DvYeJfx3T+AbEQUY=; b=NxsvW58lfF4VLVVy/k9uS1tz4IaVXclPCweZcietRh4fOo7If8bLHyMna/XHb3j/xx zTJhWTHYNHIz/TGW9LFGqj4NceiqO+CJDHk5n+vrOnBsPKLJBoc0UAKD2ve+jMeUcTEG LShr0HBB/Zo0WhEus0MwoXxxOIeE/evhoOGfFT7VlvobyTK8xr8lOWdnpOSh3ZvcWgpT HfEUtXymdn+yPC6SiUKEGpU765wfva5Ye1ole+H0/S0ui9/QZyf29CPG33iZUnfpIkhn rDZxjEbJDQ/TLmK6jlzO3eKe1RD6JuS6ULIGkEdxXVgRbLLW64wKXBwDLajVAKL5MAP5 5MYA== 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 n3si2189748pld.36.2018.12.13.11.59.32; Thu, 13 Dec 2018 11:59:47 -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 S1728722AbeLMT6d (ORCPT + 99 others); Thu, 13 Dec 2018 14:58:33 -0500 Received: from verein.lst.de ([213.95.11.211]:42933 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727684AbeLMT6d (ORCPT ); Thu, 13 Dec 2018 14:58:33 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id D452568DD6; Thu, 13 Dec 2018 20:58:31 +0100 (CET) Date: Thu, 13 Dec 2018 20:58:31 +0100 From: Christoph Hellwig To: "Lendacky, Thomas" Cc: Alexander Duyck , Robin Murphy , Christoph Hellwig , "alexander.h.duyck@linux.intel.com" , "open list:INTEL IOMMU (VT-d)" , Benjamin Herrenschmidt , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , LKML , Guenter Roeck , Greg KH Subject: Re: [PATCH] dma-direct: Fix return value of dma_direct_supported Message-ID: <20181213195831.GA15478@lst.de> References: <20181003234746.3586.42014.stgit@localhost.localdomain> <5329f992-d3aa-c16c-1218-c26d758889b8@arm.com> 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 13, 2018 at 07:45:57PM +0000, Lendacky, Thomas wrote: > So I think this needs to be __phys_to_dma() here. I only recently got a > system that had a device where the driver only supported 32-bit DMA and > found that when SME is active this returns 0 and causes the driver to fail > to initialize. This is because the SME encryption bit (bit 47) is part of > the check when using phys_to_dma(). During actual DMA when SME is active, > bounce buffers will be used for anything that can't meet the 48-bit > requirement. But for this test, using __phys_to_dma() should give the > desired results, right? > > If you agree with this, I'll submit a patch to make the change. I missed > this in 4.19, so I'll need to submit something to stable, too. The only > issue there is the 4.20 fix won't apply cleanly to 4.19. Yes, please send a patch. Please make sure it includes a code comment that explains why the __-prefixed version is used.