Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp198653rwe; Wed, 31 Aug 2022 19:46:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR5C0JpEWrVA+uKfejAk/CwHL74pQzCQCi6wZtLqmTTck/NtTAv2JU/wACCOntv8MCMsNYXR X-Received: by 2002:a17:903:2cb:b0:171:4f0d:beb6 with SMTP id s11-20020a17090302cb00b001714f0dbeb6mr28254529plk.53.1662000397911; Wed, 31 Aug 2022 19:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662000397; cv=none; d=google.com; s=arc-20160816; b=vZn232t89IHurknjn2R5wjyU9i9xxv20Dv0RIKM4jKUj99UcvrDG1iWCMMW/zY2Btk fCk8FARaL6uW+fMkTvZGDmc5rDX4X3s+BtrgvT1yvCHwGqbKSNkoFk3YoHiPsK33EMnB X2+aQBIokYF45YYpGZhXMkCz0iTn7sJ4fH57X/hdRrPYTqJfYCy263V0cQ6+8/J9fz/X nD7otb9weKGwL2bRoceeA7ggES4Sgc7o6oXlGkDIqeB4FnHbzblSPQLmYHnww5EaQBoF tpuZFHqNmvoqIWk0//94JcNblUjBAGgqEevVNBLWh+HMU/rrkY+F7k2AfbLXcfmpZVSE lGTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=saPMMzuK3Ho4SUDDsCSKY8/njcHtrQrgxH2RFe9bLtY=; b=ZHxcWF+dDZZzyn+jSYb4dp7Pco/C7pxZ0SASYHYhg+VuRBD4SS+ZlZZI/HkXdgIJhU FXjUasbw/kJ1/Tn8849lNEgF61Q2DRH2UG4rRAESMhBR8b41H2MeexvaCC/7n+GNXxTr WyJLC0F/LuArOKkcUKvz4JCIMQlJNFTsuqaLNujZLOkr6r4wEgIi8daVgpEL0vlNn30c D+zolW1gehUX+Gl55Usjcht9J2tHHRkns19eWYOpjc624v246lcC6bg+2D9E7IyX3RX9 pG5Du94UiS5pa2L3Tc2bMWahThA3rtayuAVY3nAGDb0nZkUu/Yzpg994dyHaemp/W+/6 SSgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K9IDTvUv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170903124e00b0016bf48465e7si17544116plh.380.2022.08.31.19.46.27; Wed, 31 Aug 2022 19:46:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K9IDTvUv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232391AbiIACEf (ORCPT + 99 others); Wed, 31 Aug 2022 22:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232487AbiIACEd (ORCPT ); Wed, 31 Aug 2022 22:04:33 -0400 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F20F5122BE4 for ; Wed, 31 Aug 2022 19:04:32 -0700 (PDT) Received: by mail-qt1-x832.google.com with SMTP id r6so12417539qtx.6 for ; Wed, 31 Aug 2022 19:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=saPMMzuK3Ho4SUDDsCSKY8/njcHtrQrgxH2RFe9bLtY=; b=K9IDTvUvJFqhOsyyJMTui8J3nK54HCRWlFQ0E2R2CIXsDOGaEPoLRfixcVoGQ42Nai 8fojjLOAuj6zDPY/I0YRch7xQz4Rjri5/GpCJhlQlouT66IK0PIxX3Md1KE64GytB5PJ NMw/7TQlKB78JKfav0Xn8sxyA/bNwKSndshAJd8S9Cv9sjTVDv6bYkuju2EuyZFFmWk6 NVeNoS7u5cJ8d9Hug0VoEnXI3X1Le8ppuHPthxxjbSX+2mIBm3yUlxKNUeiHRKxPAmO4 FIDZ0N5upArZ39fzCWiKhABpoEqStPHFtMLfTFP+Cr7hl7rIrf8hgb/uxkTzBGj2vRTe Pe5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=saPMMzuK3Ho4SUDDsCSKY8/njcHtrQrgxH2RFe9bLtY=; b=oLYpUGRoUxe1RzBdMhqHt7VR6qPYdeP1tCE0ZdHf9caO8dD41rM3B401gU1ZxaR4gX v5XBuZIJIzGn5X45D45K+6Gv5g0pYLYPvXrUqyztVMh2hzhIPLnj99duSfwoqehuIgcp gHd/8DK1QSAF+RFsnbCvIfMH7WBnhJf2/yphmcItqAvQspvswQeW3+U+UQwPUv6zxDM0 h4AzA2EevC1wxUebKmBLKIxIAuAOnKEy7BEo4Sl1IgWkuQRi34YWnPlKpJctutmjUy5p 8a6eyXegWlKkg7775KvYwn6AlA1tGRB9ci2iZUeEGwiCytTjKNBZfh0OyfjRqAbDAKo0 vf9A== X-Gm-Message-State: ACgBeo3+5H8lsmPTq32LJQ6uBJ9D+YkY66rumhlOukj5UgsU1rsbsVq6 iC/g0q8mu+Nd1rfeayIlQyPEYzvh2453k+mPSBj0hw== X-Received: by 2002:ac8:5853:0:b0:343:7b95:96ff with SMTP id h19-20020ac85853000000b003437b9596ffmr22411999qth.386.1661997872094; Wed, 31 Aug 2022 19:04:32 -0700 (PDT) MIME-Version: 1.0 References: <20220421141300.GC20492@lst.de> <665d2b46-c9e2-2543-cad5-9adf022e4bcb@arm.com> <9ec5ba90-150a-c675-d95b-b13e3a4e9e10@arm.com> <5c617d66-f04b-df26-bf7a-7f479d081ac2@arm.com> <6cc93088-981e-5c2d-a757-90508455aa42@arm.com> In-Reply-To: <6cc93088-981e-5c2d-a757-90508455aa42@arm.com> From: Yongqin Liu Date: Thu, 1 Sep 2022 10:04:21 +0800 Message-ID: Subject: Re: [PATCH 0/3] More ARM DMA ops cleanup To: Robin Murphy Cc: Christoph Hellwig , linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com, arnd@kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, "Bajjuri, Praneeth" , Sumit Semwal Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Robin On Thu, 1 Sept 2022 at 01:10, Robin Murphy wrote: > > On 2022-08-31 17:41, Yongqin Liu wrote: > > Hi, Robin > > > > On Tue, 30 Aug 2022 at 23:37, Robin Murphy wrote: > >> > >> On 2022-08-30 16:19, Yongqin Liu wrote: > >>> Hi, Robin > >>> > >>> Thanks for the kind reply! > >>> > >>> On Tue, 30 Aug 2022 at 17:48, Robin Murphy wrote: > >>>> > >>>> On 2022-08-27 13:24, Yongqin Liu wrote: > >>>>> Hi, Robin, Christoph > >>>>> > >>>>> With the changes landed in the mainline kernel, > >>>>> one problem is exposed with our out of tree pvr module. > >>>>> Like the source here[1], arm_dma_ops.sync_single_for_cpu is called in > >>>>> the format like the following: > >>>>> arm_dma_ops.sync_single_for_cpu(NULL, pStart, pEnd - pStart, > >>>>> DMA_FROM_DEVICE); > >>>>> > >>>>> Not sure if you could give some suggestions on what I should do next > >>>>> to make the pvr module work again. > >>>> > >>>> Wow, that driver reinvents so many standard APIs for no apparent reason > >>>> it's not even funny. > >>>> > >>>> Anyway, from a brief look it seemingly already knows how to call the DMA > >>>> API semi-correctly, so WTF that's doing behind an #ifdef, who knows? > >>>> However it's still so completely wrong in general - fundamentally broken > >>>> AArch64 set/way cache maintenance!? - that it looks largely beyond help. > >>>> "Throw CONFIG_DMA_API_DEBUG at it and cry" is about the extent of > >>>> support I'm prepared to provide for that mess. > >>> > >>> For the moment, I do not care about the AArch64 lines, like if we only > >>> say the following two lines: > >>> arm_dma_ops.sync_single_for_device(NULL, pStart, pEnd - pStart, > >>> DMA_TO_DEVICE); > >>> arm_dma_ops.sync_single_for_cpu(NULL, pStart, pEnd - pStart, > >>> DMA_FROM_DEVICE); > >>> > >>> Could you please give some suggestions for that? > >> > >> Remove them. Then remove the #ifdef __arch64__ too, since the code under > >> there is doing a passable impression of generic DMA API usage, as long > >> as one ignores the bigger picture. > > > > I tried with this method, and found that if I only update for the > > pvr_flush_range > > and the pvr_clean_range functions, the build still could boot to the > > home screen. > > > > but if I update all the pvr_flush_range, pvr_clean_range and > > pvr_invalidate_range > > functions with this method(remove the arm_dma_ops lines and the #ifdef > > __arch64__ lines), > > then a "Unable to handle kernel NULL pointer dereference at virtual > > address 0000003c" > > error is reported like here: http://ix.io/49gu > > > > Not sure if you have any idea from the log, or could you please give > > some suggestions > > on how to debug it. > > Obviously there's almost certainly going to be more work to do on top to > make the newly-exposed codepath actually behave as expected - I was > simply making a general suggestion for a starting point based on looking > at half a dozen lines of code in isolation. > > To restate the point yet again in the hope that it's clear this time, > the DMA ops on ARM are now effectively the same as the DMA ops on arm64, > and will behave the same way. Thanks for confirming again here! > Assuming the driver already works on > arm64, then the aim should be to unify all the ARM and arm64 codepaths > for things that involve the DMA API. Thanks for the suggestion here, I will try to see if I could find anything there. > If you don't understand the code > well enough to do that, please contact Imagination; I don't support > their driver. Will try to contact the maintainer of the PVR source, but as you could guess, it might take quite a long time before it's fixed in the perfect way, and before that I need to have the build continue even with various workarounds based on my limited undersanding:( Thanks again for all the kind help and suggestions! -- Best Regards, Yongqin Liu --------------------------------------------------------------- #mailing list linaro-android@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-android