Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8673335ybn; Tue, 1 Oct 2019 11:26:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRN41/RQvnEfIPQtsbdGOZSkf+lmok7jd1ks6ForEsDMQ4Eu5B8+BdGfhmYe1UlftGhsn1 X-Received: by 2002:aa7:dcca:: with SMTP id w10mr27374557edu.183.1569954402508; Tue, 01 Oct 2019 11:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569954402; cv=none; d=google.com; s=arc-20160816; b=X9+ZMb2XRzpAmItX+7Oge3uCtbTad3wSYsMnsYzX4a2vPCrUiyvAPkjVZNijchgFhA zZxEbgW7dE8RduaqPCeX4oZ3d1MKv7dDwdqffak4oOW6nC6R7Jv2duoL5+7erMo3V5xV j66Z/q70O96REGejwdh7gH7CoZva4jS9mJfX5AqYc35SVet7X5YFNPlJVFjZ7+YEhu4P lOHZLY4UXsUxHmOVkKDf5rqFkULqsfSaFK0DKPRl3pUXANvJDiYleeuO3lOmr/tlBM31 rc/3S2Zxy5GBaWJKVJoSbEWkpsECPOuTom+gCT6P2dJtezsm7y7MsdtOSbpLaNEkMdHr ZnbQ== 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=qYFpRFTWDDUzP8DqWBz3QCNkMrOKSEFwK1Jbqi8UpE4=; b=DuoGTLnxC2gHgSHynx6/YJTw1UhtrMV8ojf1G3aPP7tOE/yE7AH8y0SwR5ukHo3alx HiFpApO2xQoTyEkVi/x1WoWFcT8AdkLQPjUKky8ZTr7ABDq98WkFPGJN8//Yj5a56ICa HBNkvLttlOY9SXjQMNmFhwF4A2ou7m5jS8UIjKCmrPzka/kMKOhlptePu1+CXPRL36TQ LM5NN+CkeaXuSSIrLKjKLi1GX7bL5rG11dM9Hsi35PcSjQX9U06dSEepKQsPEnMiMA2v LcYMOPdfMgv+XJf3sv2qHNLtEz7g5tQmgjaTp+DOxq9982u61CQmYDqWw+l2vYbJaYuQ +arA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=odQoLLf6; 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 w5si9503921eds.179.2019.10.01.11.26.18; Tue, 01 Oct 2019 11:26:42 -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=odQoLLf6; 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 S1732073AbfJASXn (ORCPT + 99 others); Tue, 1 Oct 2019 14:23:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:56194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731560AbfJASXn (ORCPT ); Tue, 1 Oct 2019 14:23:43 -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 17FC820815; Tue, 1 Oct 2019 18:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569954221; bh=30tHIqsDuyS4f8J3OK28SndY+e+8UaTT56u/QQWRHho=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=odQoLLf6OCmnd+DWoF7HNvP7+n/w0zmHVkSI99DuU6myj5pv1WWcCBm02zyGc19Ql RqhAf1pvzE9QSnQhfdbwVrNyySAi8t7B6csVibpVIxtSEsZdmCyN3l7qyHCr1caS14 uvWycia7O0XMDdyBU6ueyO+7Nfv74WN1/PWZBNzA= Date: Tue, 1 Oct 2019 11:23:40 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Rob Herring cc: Oleksandr Andrushchenko , Robin Murphy , Julien Grall , Boris Ostrovsky , "linux-kernel@vger.kernel.org" , Nicolas Saenz Julienne , Juergen Gross , Stefano Stabellini , "xen-devel@lists.xenproject.org" , Oleksandr Andrushchenko Subject: Re: [RFC PATCH] xen/gntdev: Stop abusing DT of_dma_configure API In-Reply-To: Message-ID: References: <20190925215006.12056-1-robh@kernel.org> <1ae7f42e-bf93-b335-b543-653fae5cf49f@epam.com> <28440326-ed76-b014-c1b8-02125c3214b9@arm.com> 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 Thu, 26 Sep 2019, Rob Herring wrote: > On Thu, Sep 26, 2019 at 6:16 AM Oleksandr Andrushchenko > wrote: > > > > On 9/26/19 1:46 PM, Robin Murphy wrote: > > > On 2019-09-26 11:17 am, Oleksandr Andrushchenko wrote: > > >> > > >> On 9/26/19 12:49 PM, Julien Grall wrote: > > >>> Hi Rob, > > >>> > > >>> > > >>> On 9/25/19 10:50 PM, Rob Herring wrote: > > >>>> As the comment says, this isn't a DT based device. of_dma_configure() > > >>>> is going to stop allowing a NULL DT node, so this needs to be fixed. > > >>> > > >>> And this can't work on arch not selecting CONFIG_OF and can select > > >>> CONFIG_XEN_GRANT_DMA_ALLOC. > > >>> > > >>> We are lucky enough on x86 because, AFAICT, arch_setup_dma_ops is just > > >>> a nop. > > >>> > > >> No luck is needed as [1] does nothing for those platforms not using > > >> CONFIG_OF > > >>>> > > >>>> Not sure exactly what setup besides arch_setup_dma_ops is needed... > > >>> > > >>> We probably want to update dma_mask, coherent_dma_mask and > > >>> dma_pfn_offset. > > >>> > > >>> Also, while look at of_configure_dma, I noticed that we consider the > > >>> DMA will not be coherent for the grant-table. Oleksandr, do you know > > >>> why they can't be coherent? > > >> The main and the only reason to use of_configure_dma is that if we don't > > >> then we > > >> are about to stay with dma_dummy_ops [2]. It effectively means that > > >> operations on dma-bufs > > >> will end up returning errors, like [3], [4], thus not making it possible > > >> for Xen PV DRM and DMA > > >> part of gntdev driver to do what we need (dma-bufs in our use-cases > > >> allow zero-copying > > >> while using graphics buffers and many more). > > >> > > >> I didn't find any better way of achieving that, but of_configure_dma... > > >> If there is any better solution which will not break the existing > > >> functionality then > > >> I will definitely change the drivers so we do not abuse DT ) > > >> Before that, please keep in mind that merging this RFC will break Xen PV > > >> DRM + > > >> DMA buf support in gntdev... > > >> Hope we can work out some acceptable solution, so everyone is happy > > > > > > As I mentioned elsewhere, the recent dma-direct rework means that > > > dma_dummy_ops are now only explicitly installed for the ACPI error > > > case, so - much as I may dislike it - you should get regular > > > (direct/SWIOTLB) ops by default again. > > Ah, my bad, I missed that change. So, if no dummy dma ops are to be used > > then > > I believe we can apply both changes, e.g. remove of_dma_configure from > > both of the drivers. > > What about the dma masks? I think there's a default setup, but it is > considered a driver bug to not set its mask. xen_drm_front sets the > coherent_dma_mask (why only 32-bits though?), but not the dma_mask. > gntdev is doing neither. I could copy out what of_dma_configure does > but better for the Xen folks to decide what is needed or not and test > the change. I'm not setup to test any of this. FYI I have seen the issue Oleksandr is talking about too. I confirm that the only reason for the of_configure_dma call is to get away from the dummy_dma_ops and use the default dma_ops instead. I think this should be mentioned in the commit message so that if one day the behavior regarding dummy_dma_ops changes one more time, hopefully we'll be able to figure out the issue more easily with bisection. In regards to the coherent_dma_mask and dma_mask, I can't see why gntdev would have any dma addressing limitations, so we should be able to set both to 64 bits. I also can't see why xen_drm_front would limit it to 32 bits, after all this is just the frontend, if anything it would be the backend that has a limitation. So, we should be able to set both dma_mask and coherent_dma_mask in xen_drm_front to 64 bits. Oleksandr, can you confirm?