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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 2298BC0044C for ; Thu, 1 Nov 2018 08:33:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D81CC204FD for ; Thu, 1 Nov 2018 08:33:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D81CC204FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbeKARfr (ORCPT ); Thu, 1 Nov 2018 13:35:47 -0400 Received: from verein.lst.de ([213.95.11.211]:43098 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727704AbeKARfr (ORCPT ); Thu, 1 Nov 2018 13:35:47 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 196CC7F1C0; Thu, 1 Nov 2018 09:33:46 +0100 (CET) Date: Thu, 1 Nov 2018 09:33:46 +0100 From: Christoph Hellwig To: "Maciej W. Rozycki" Cc: Christoph Hellwig , Paul Burton , iommu@lists.linux-foundation.org, Marek Szyprowski , Robin Murphy , Greg Kroah-Hartman , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] MIPS: Fix `dma_alloc_coherent' returning a non-coherent allocation Message-ID: <20181101083346.GA7136@lst.de> References: <20180914095808.22202-1-hch@lst.de> <20180914095808.22202-5-hch@lst.de> <20181031203206.GA28337@lst.de> <20181101051359.GA4164@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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 01, 2018 at 07:54:24AM +0000, Maciej W. Rozycki wrote: > Fix a MIPS `dma_alloc_coherent' regression from commit bc3ec75de545 > ("dma-mapping: merge direct and noncoherent ops") that causes a cached > allocation to be returned on noncoherent cache systems. > > This is due to an inverted check now used in the MIPS implementation of > `arch_dma_alloc' on the result from `dma_direct_alloc_pages' before > doing the cached-to-uncached mapping of the allocation address obtained. > The mapping has to be done for a non-NULL rather than NULL result, > because a NULL result means the allocation has failed. > > Invert the check for correct operation then. > > Signed-off-by: Maciej W. Rozycki > Fixes: bc3ec75de545 ("dma-mapping: merge direct and noncoherent ops") > Cc: stable@vger.kernel.org # 4.19+ Oops, yes this looks good: Reviewed-by: Christoph Hellwig