Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3708291ybv; Mon, 10 Feb 2020 05:05:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzUaCbD6qOTYodNbGivHH0fIdd6jjGVeN2qvgn2o+qExAmpRuKC10d9zg/z26A2hOJeAoP0 X-Received: by 2002:a54:4895:: with SMTP id r21mr765851oic.107.1581339947388; Mon, 10 Feb 2020 05:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339947; cv=none; d=google.com; s=arc-20160816; b=aYmxN91PAApHq6KcgJw+j0DZLf+Ln6vrFXBplhT9H+D8IZBICuI/F2uMoYv4oc1Mp5 LfLKe/12fCvGoL3pZ9KW7TkeQTQO/2Kpg9fNCCr0i2J6qWrR8RrMBr8Kda1BO9XvdS1y cTZqeHliq17IxeCxa7/sTOsIv4UHaymWLc8bRiUfL0o0CJ8b7278VG6Nvht0QPKMACZ7 +SSkRSR6685OJXImv1lwd+2avh2R7BWkLHvzqjy6/uINbeq3sxebKU24zjtE/xWZR82Y jS4vonNhcXuCHWc3FDk91CqJEdEv4CXjGE94yOzTJa7BKa8xi96YFOAzpKgz10BtvNFV qSvw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lR6MYeEtF8Mu0KQwtK+z56aQ+K+ho66+VHscKkJRXRI=; b=WjF9jZSM9T/3BxzgygfS+c/Ah4n/TrtvLrEaso32JxLhCYF9WFBdquaAVi83yiK16/ tSOHhXTyc0YVXCazRFmwPODk+3Nb52gXBXPa1PrvY3Oe5qbfjWiNIUALfXkdNSRYi3P4 LO6itd9QEVi5s25uZdjKGt1ttbNbbA9Yl1h2ojJukfOZ8tMEp/DlBjwnZHEe0L3ddiUl yTawFdH9Etf6L9iXX5BmIIyP1nlG9SbOHNLPVrpwpYMVPf7FEssuGFzRCGyK9qauN40F Kipu4bDWaswCi5Flr9L2z3sP+VmvD815sWGonwB8/n8cZdtFF6+hsZujixFjVR1NN/Ca Bu+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MLQrTFyZ; 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 k20si121040oiw.273.2020.02.10.05.05.35; Mon, 10 Feb 2020 05:05: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; dkim=pass header.i=@kernel.org header.s=default header.b=MLQrTFyZ; 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 S1730262AbgBJND4 (ORCPT + 99 others); Mon, 10 Feb 2020 08:03:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:40208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729706AbgBJMkU (ORCPT ); Mon, 10 Feb 2020 07:40:20 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4AFAD20873; Mon, 10 Feb 2020 12:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338420; bh=cDztcK+reDB/TcP8f2+T4tcfLGtQ5Z92p23Ou4/MWwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLQrTFyZKQ57uNrJvqNko6YPy1AAeMfOuyyybgP8b7AWgh2RYB40e1peOZKL6vadl om1gl26DSskVDytrfuroEPvUuqWSb7qVuAlVAA+6fl3AsFtuw7aiN8xH6ir+KtV4sr 2QIHfItALlFRO9hQdGDcLPIUsrbqQx/LvtQi61DA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Zigotzky , Michael Ellerman , Ulf Hansson , Rob Herring Subject: [PATCH 5.5 138/367] of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc Date: Mon, 10 Feb 2020 04:30:51 -0800 Message-Id: <20200210122437.597135691@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman commit dabf6b36b83a18d57e3d4b9d50544ed040d86255 upstream. There's an OF helper called of_dma_is_coherent(), which checks if a device has a "dma-coherent" property to see if the device is coherent for DMA. But on some platforms devices are coherent by default, and on some platforms it's not possible to update existing device trees to add the "dma-coherent" property. So add a Kconfig symbol to allow arch code to tell of_dma_is_coherent() that devices are coherent by default, regardless of the presence of the property. Select that symbol on powerpc when NOT_COHERENT_CACHE is not set, ie. when the system has a coherent cache. Fixes: 92ea637edea3 ("of: introduce of_dma_is_coherent() helper") Cc: stable@vger.kernel.org # v3.16+ Reported-by: Christian Zigotzky Tested-by: Christian Zigotzky Signed-off-by: Michael Ellerman Reviewed-by: Ulf Hansson Signed-off-by: Rob Herring Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/Kconfig | 1 + drivers/of/Kconfig | 4 ++++ drivers/of/address.c | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -238,6 +238,7 @@ config PPC select NEED_DMA_MAP_STATE if PPC64 || NOT_COHERENT_CACHE select NEED_SG_DMA_LENGTH select OF + select OF_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE select OF_EARLY_FLATTREE select OLD_SIGACTION if PPC32 select OLD_SIGSUSPEND --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -103,4 +103,8 @@ config OF_OVERLAY config OF_NUMA bool +config OF_DMA_DEFAULT_COHERENT + # arches should select this if DMA is coherent by default for OF devices + bool + endif # OF --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -995,12 +995,16 @@ out: * @np: device node * * It returns true if "dma-coherent" property was found - * for this device in DT. + * for this device in the DT, or if DMA is coherent by + * default for OF devices on the current platform. */ bool of_dma_is_coherent(struct device_node *np) { struct device_node *node = of_node_get(np); + if (IS_ENABLED(CONFIG_OF_DMA_DEFAULT_COHERENT)) + return true; + while (node) { if (of_property_read_bool(node, "dma-coherent")) { of_node_put(node);