Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp374499pxb; Thu, 26 Aug 2021 05:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy5ZtDJBCpJ4hs8Mxupe+WpX5B+wRoGdmo8Pl4uG3Q3NigfiEM063FZ5fUxXYagIdAIirJ X-Received: by 2002:aa7:c311:: with SMTP id l17mr3974794edq.320.1629980594372; Thu, 26 Aug 2021 05:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629980594; cv=none; d=google.com; s=arc-20160816; b=veJdkYuwCX0qRvj3rxVh+nxYOOyA8b7s+dadjWgx/oyqKWRBVq3ksaK4Wiba/sBBun 4E7l/eZ/b8KIwPS5xocwMx2LVssov1gNWBySf3XHb6f57+gFPJK6hyCWI5Yhl668AZXy WzNCbZnVqzdHrgZWO0/LC0chxcQdTqmYr4qcW/FNMvXiZMWZzm7XvpwUQ5lQKGUqxb6s gmHDT+Qw6mXPbkx+XyT7Luph24jUAJXHolrt6J+cNCcaWE+1sdXEUu/QitTzZ6yMm0e4 E4OQciiUHTUSGCqMBZ2iJYABVtTmcqQbdtZpoipYt7s+AjjhQU6fheDf+YJShvGml7PD dPcg== 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:dkim-signature; bh=v7KqzQJkSi8ftAONeP7LkeFQvet5wxyhKiHQuCVaVI0=; b=bXO07/ItXgj07u+3Uh/UfUu50VDAUwyKl4iUxXIOu7ZFq+buq8gjev/kSMQVBLkZUQ dPHfMNwBRTKEQh2x6vQk594Rf6REbMgZuBPaC9IC++Wvsdnv0eRsQLUT6wVw0mLAg6+d jS8tqKH3lWthSI2sv3ToYc2jvdvaNfv81BBtVs9VS882eXH6mqrVC8Zdgqng+WOw1DMk el9ycm3VH6+aLrf8Nbw/3azuuDYX6QlLTkzb7h4rXh2wZdz8l8wxHP9CA5PtOlaw1avI Pn4wSfbe7SMKssw2mRVpLaf28OIwkb9pEe62IPSeFCFdmC3K4H02bKGKVruHwVYwRSIM aZ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=sqVrzyX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc34si3179016ejc.702.2021.08.26.05.22.30; Thu, 26 Aug 2021 05:23:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=sqVrzyX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242583AbhHZMUS (ORCPT + 99 others); Thu, 26 Aug 2021 08:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242404AbhHZMUL (ORCPT ); Thu, 26 Aug 2021 08:20:11 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C130AC0617AE for ; Thu, 26 Aug 2021 05:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=v7KqzQJkSi8ftAONeP7LkeFQvet5wxyhKiHQuCVaVI0=; b=sqVrzyX0+Bb+uxIfzIohMi6Sc NY4nexc3ugoDP0LDv6g685BfQxOmOAoA72xEzeIaj1lFWO78UNh3QYFQ/ak3lrI0TsyDWoDZVv/kb RPWG8ulE4G405t1G1eM+CHoPamXwZxS27Sh0JH5InyQ9/tZxN7CDGfl5LL1/RmKblQOuPFkczCG4z FBA+s+JgkrLXo2XRJo4uD3Ld/2/pCGovXnUwojIeWYuEW/TrGQ8iePlFSHRSKJJxc3+cZEPwpQOCy nAlOcvJRYIV5Qr0K2HRH6bWIAHgu5qjDNxoU3hoddTCR46N+RpxhnisX8Z8wpC1vEtkMRr/g6ozoY wpDdzlD6g==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:47712) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJELl-0007sx-I0; Thu, 26 Aug 2021 13:19:17 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1mJELl-0000oQ-AI; Thu, 26 Aug 2021 13:19:17 +0100 Date: Thu, 26 Aug 2021 13:19:17 +0100 From: "Russell King (Oracle)" To: Michael Walle Cc: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Lukas F . Hartmann" , Marek Vasut , Lucas Stach , Christian Gmeiner , David Airlie , Daniel Vetter Subject: Re: [PATCH 3/3] drm/etnaviv: use a 32 bit mask as coherent DMA mask Message-ID: <20210826121917.GS22278@shell.armlinux.org.uk> References: <20210826121006.685257-1-michael@walle.cc> <20210826121006.685257-4-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210826121006.685257-4-michael@walle.cc> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 26, 2021 at 02:10:06PM +0200, Michael Walle wrote: > - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(40); > - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; > + /* > + * PTA and MTLB can have 40 bit base addresses, but > + * unfortunately, an entry in the MTLB can only point to a > + * 32 bit base address of a STLB. Moreover, to initialize the > + * MMU we need a command buffer with a 32 bit address because > + * without an MMU there is only an indentity mapping between > + * the internal 32 bit addresses and the bus addresses. > + * > + * To make things easy, we set the dma_coherent_mask to 32 > + * bit to make sure we are allocating the command buffers and > + * TLBs in the lower 4 GiB address space. > + */ > + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(40)) || > + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) { > + dev_dbg(&pdev->dev, "No suitable DMA available\n"); > + return -ENODEV; > + } This makes no sense. In the previous patch, you initialised pdev->dev.dma_mask ot point at the coherent mask, implying that it wasn't already set - for which dma_coerce_mask_and_coherent() should be used. Now you're just calling dma_set_mask(), which will fail if pdev->dev.dma_mask hasn't already been set to point at something. If it's already been initialised to point at something, then you shouldn't be overwriting it in the driver, and you should've used dma_set_mask_and_coherent() in your previous patch. Confused. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!