From patchwork Tue Oct 8 19:41:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 175555 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6138994ill; Tue, 8 Oct 2019 12:42:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz524f+ZmMfQflwmdRvT4ZebrSa6leLDLvxGqSIeivyRjkNK/41RT22b6qHWDqRFUqs8qHH X-Received: by 2002:a17:906:c73a:: with SMTP id fj26mr10448427ejb.70.1570563723466; Tue, 08 Oct 2019 12:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570563723; cv=none; d=google.com; s=arc-20160816; b=iUST9z7q//G1FN97uATwObc9CTcG8wbKDu6CMLaksi2klpwqa0YY0ZVstc12WVloXM zkRsFPHROd71aCIot15FJCBq5xEEIyv2XlaKtTQnXlGpZZ+zfVRTDmyvb85CiUVpw/nW 2odAQ6ivTEhOEL2MmYnqXIkLz2a60uypxPM+BiXWBQdSxoukjjD7W6wWYqxU7vUKIr34 R3TxbF9LDgnnRQ3bKsC61E5W+QTYCj5j0GOxMhJZPUV5lcV6bLeRPqaBBpxCAAeTuY3D +svvVATuuK7c1Zn3Z5zMdhLFxw560pblWVKduDVzulh6FScezi/lJF2wOlO8gLply3IV jQJQ== 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 :message-id:date:subject:cc:to:from; bh=cM/iEPaCvfOjsvb7CWmfva5BP/wvMw5x+2gKptZwcOk=; b=a7l9qFsia8mOqXsJXGVWrLP+Jgaf9hPhfiGcFY8unG+KB9HeLXvdKbblvjVXiOxe4Y fpWdaicJGWVCnnZTpCnlkybQcsdVTzmN2mIyXz3RA+voDUvsCInK+/71sREisfZcOuda u9rL/GtkmJLCQeIoolGtTFgc6EeQJufGJ6qoXkgwZiUjCR9pmjDq2ZOlHDrf0JQoy9c3 G8wheYZUkgx1aF92vCEbCx3pzvbo1aAk4ok7p7CDfLkMGcC+aLPFql24SRb7IWjh9LGU FMR0kogeb3v55GNvOO2srLG3gEdA6Yr5GW7giH8FwtgqCIx6oUXvQ7A8CTHD6JXwo8wL qCug== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c31si12037edb.309.2019.10.08.12.42.03; Tue, 08 Oct 2019 12:42:03 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730344AbfJHTl6 (ORCPT + 26 others); Tue, 8 Oct 2019 15:41:58 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:39880 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728465AbfJHTl6 (ORCPT ); Tue, 8 Oct 2019 15:41:58 -0400 Received: by mail-ot1-f66.google.com with SMTP id s22so15080527otr.6 for ; Tue, 08 Oct 2019 12:41:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cM/iEPaCvfOjsvb7CWmfva5BP/wvMw5x+2gKptZwcOk=; b=uSqWXO6GLiY71U/ccJ9Cr4TL2f3ge48+x6oNa61dPxTmLbU8XUOhF8y/cFSLqB/faB AGXR7KxtIRbQ6crMPKwcAPm/FeCfDB2Bh8+1Jq6aeRD5SnDwsr8kfAzODnVS/YXHfKnd k2v6aZpbkFui1gh1vAoadJjN2XqQiEZTBOEhJocURIJ0KXxlNaY6zvQ0Lmmg5MY0C6Uc oolhGzDY60sLH1467/n1cqbxFp1QsqE6jFSc375YAgIiapQXHCTypgrPIlZ3dDSkl6qS UmWPdpijHZrl5JCyQ9nWKsJD2XdFcUdQTAE83jOiU0fap3gEnXiTSWBAkWe0bxSR9MUX YZyQ== X-Gm-Message-State: APjAAAXUoTweNjyxSl2x2C7Ty4sL04vlYXbN1klzc+ZxijHljm1/ntWd VMIxL4i5D/az45eYfAgx3Q== X-Received: by 2002:a9d:7418:: with SMTP id n24mr2934782otk.19.1570563717135; Tue, 08 Oct 2019 12:41:57 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z12sm5364645oth.71.2019.10.08.12.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 12:41:56 -0700 (PDT) From: Rob Herring To: xen-devel@lists.xenproject.org Cc: linux-kernel@vger.kernel.org, Robin Murphy , Julien Grall , Nicolas Saenz Julienne , Oleksandr Andrushchenko , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Christoph Hellwig Subject: [PATCH v2] xen: Stop abusing DT of_dma_configure API Date: Tue, 8 Oct 2019 14:41:55 -0500 Message-Id: <20191008194155.4810-1-robh@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the removed comments say, these aren't DT based devices. of_dma_configure() is going to stop allowing a NULL DT node and calling it will no longer work. The comment is also now out of date as of commit 9ab91e7c5c51 ("arm64: default to the direct mapping in get_arch_dma_ops"). Direct mapping is now the default rather than dma_dummy_ops. According to Stefano and Oleksandr, the only other part needed is setting the DMA masks and there's no reason to restrict the masks to 32-bits. So set the masks to 64 bits. Cc: Robin Murphy Cc: Julien Grall Cc: Nicolas Saenz Julienne Cc: Oleksandr Andrushchenko Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: Christoph Hellwig Cc: xen-devel@lists.xenproject.org Signed-off-by: Rob Herring --- v2: - Setup dma masks - Also fix xen_drm_front.c This can now be applied to the Xen tree independent of the coming of_dma_configure() changes. Rob drivers/gpu/drm/xen/xen_drm_front.c | 12 ++---------- drivers/xen/gntdev.c | 13 ++----------- 2 files changed, 4 insertions(+), 21 deletions(-) -- 2.20.1 Acked-by: Oleksandr Andrushchenko Reviewed-by: Boris Ostrovsky Reviewed-by: Stefano Stabellini diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c index ba1828acd8c9..4be49c1aef51 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -718,17 +718,9 @@ static int xen_drv_probe(struct xenbus_device *xb_dev, struct device *dev = &xb_dev->dev; int ret; - /* - * The device is not spawn from a device tree, so arch_setup_dma_ops - * is not called, thus leaving the device with dummy DMA ops. - * This makes the device return error on PRIME buffer import, which - * is not correct: to fix this call of_dma_configure() with a NULL - * node to set default DMA ops. - */ - dev->coherent_dma_mask = DMA_BIT_MASK(32); - ret = of_dma_configure(dev, NULL, true); + ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); if (ret < 0) { - DRM_ERROR("Cannot setup DMA ops, ret %d", ret); + DRM_ERROR("Cannot setup DMA mask, ret %d", ret); return ret; } diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index a446a7221e13..81401f386c9c 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -22,6 +22,7 @@ #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -34,9 +35,6 @@ #include #include #include -#ifdef CONFIG_XEN_GRANT_DMA_ALLOC -#include -#endif #include #include @@ -625,14 +623,7 @@ static int gntdev_open(struct inode *inode, struct file *flip) flip->private_data = priv; #ifdef CONFIG_XEN_GRANT_DMA_ALLOC priv->dma_dev = gntdev_miscdev.this_device; - - /* - * The device is not spawn from a device tree, so arch_setup_dma_ops - * is not called, thus leaving the device with dummy DMA ops. - * Fix this by calling of_dma_configure() with a NULL node to set - * default DMA ops. - */ - of_dma_configure(priv->dma_dev, NULL, true); + dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64)); #endif pr_debug("priv %p\n", priv);