Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp309918ybp; Thu, 10 Oct 2019 18:42:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxl//dhpY2xpNea2HgT0asnZ8Pwxeoz6VJcikQG9tt4tnXvcsGUJJyB7ILapJjY6ISjjCgr X-Received: by 2002:a17:906:7f04:: with SMTP id d4mr11507444ejr.178.1570758165252; Thu, 10 Oct 2019 18:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570758165; cv=none; d=google.com; s=arc-20160816; b=XJ0Vjbm9e9q+jpxx6rtAA2NOK7dYuxxIeyzHCT8Mz+Z/qc2G+GNahGyJ4kPkk6aKve zPbZsHDbk5d8qkupFeYV9nmbbndAbwbK1JsjGB1d3LbSd0TLty1U3rbHX9R8mNX+WRdX FJJUa/NEqunCjCmZGMZ7BMjvMfN98H96jDCa42tdC2dGpaKhgijC469cpGEt+vRS1Cq0 jGrBXvd9ZQA8vVZRlRw5im0/4gtPW2D7fUo37sLLvBC0xqFZsKZoo3W2MiFuCUc5mhti BgvAqBI5ewLb2p534usjulxcG9zkyjIIzBzqljd9hvO+Qds4dM+8vdsJKsVO5+vUc55i 29XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=WEygtdXVWjAxV8dL2ziv3NOzoaTNHZmXltTUPww1rPU=; b=Bd0RdK8xXeXKDBGGBt4KTaoO2MRALm6bj5Q5X1YpfWtg1XucOcnXV4mUs8Py4KuKp8 rgr4tXnvpV+Sc5snjWFuYonc8PlowNaGvQNsMk8SE9H2tgRFfMzjHa8T1beSycYXh2Jh 2w7lYJZE/mdJPXwQm2Y+Sox/alnEMkE9pVNtnZQx8M+cwyuF7nBVrv/ynSCPRp4kMS/3 jJr1xO+qnag7C0UQuRVJKn01jhlf3a6rVgqfeYU4U1pUIbtNVlAozzYAicSvmt9DZxMS OooT2/uuvHoR5+lCYn/GvYekB+W8PQJ0bcHr2SuU3H7XOKKnnuSqHfKDM9F4dG26PtX3 UZQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JJn52lxU; 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=pass (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 r14si4349004eju.69.2019.10.10.18.42.08; Thu, 10 Oct 2019 18:42:45 -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; dkim=pass header.i=@kernel.org header.s=default header.b=JJn52lxU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbfJKBmD (ORCPT + 99 others); Thu, 10 Oct 2019 21:42:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:57662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727588AbfJKBmC (ORCPT ); Thu, 10 Oct 2019 21:42:02 -0400 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (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 EC10020650; Fri, 11 Oct 2019 01:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570758121; bh=kuiJxqx7ftSjXbGl7w3Cj53FiBAzPrWqRAHm4ucmenI=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=JJn52lxUqYCMfBanJIi1nftwB1S1F6Gx+tmUVqgj3IQ3ltS5BXb5MEYPR0QSk23hy iIZLrlaemZJ7eqYcCpjh07CUnFOTvTfYzNcXvGgLI5/rzThQEKs3gt8ZSE1om21QBU Y4KtAPvqWYKHndyZOm7WqZuOTVKNTIKoqdw4hJU0= Date: Thu, 10 Oct 2019 18:42:00 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Rob Herring cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Robin Murphy , Julien Grall , Nicolas Saenz Julienne , Oleksandr Andrushchenko , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Christoph Hellwig Subject: Re: [PATCH v2] xen: Stop abusing DT of_dma_configure API In-Reply-To: <20191008194155.4810-1-robh@kernel.org> Message-ID: References: <20191008194155.4810-1-robh@kernel.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Oct 2019, Rob Herring wrote: > 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 Reviewed-by: Stefano Stabellini > --- > 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(-) > > 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); > > -- > 2.20.1 >