Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2157776pxt; Sun, 8 Aug 2021 13:41:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXQyd7YmaSrYNm2uU4FQaNdvaap2sFs6pNxo2z5JL1l6Z7ZhdAcWNjqkfXNwEiN5RPcgNg X-Received: by 2002:a50:ab1c:: with SMTP id s28mr24681194edc.214.1628455307349; Sun, 08 Aug 2021 13:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628455307; cv=none; d=google.com; s=arc-20160816; b=jcntz16mfi60NeE9BfZ5I4TArJ7CTDi/+8LQ3L0PMas4IOqFix4IAW6WeoZthHX+Ls 9nHwVXQfQuDlWyeaq7024o4UMpcMux/VzqtoCOMt+S+gHdBlZULLA+2MHPmbbFvo1Mnh K1NlgX3iYV0Z+/dTmQvSbv/G5G3A/reJMdhFL8M4gi+Sg/nMup+JViOINfnHQiuLKLZb +UoSg3lU6mucNaZ2pSONrMYcur+qHbzDhe/N4/9AulD11eTKhsDw6g1Wra/TkhOV8vA0 88Jj3/WAxOnZg49398dLQ4GaXhsH9NFkaZjd0hc+nbSh9h3fMN5iKujvTTgL7VmnkA39 JeMg== 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=XsY1naXGPpmVYSXrwp+yqNB1LAnbf0RuN1r5nzhLAKc=; b=nroue2a7rrhAliB1Gd7J7MW8x9Bzlt/AGQc146l3johpx2ceKxxWa/JSQzxU7pdDw1 jQCobabmN3cRSEZNi4EiYeDaZ4df72xfwSiVXU6VwPjvdAlFK1WOgGIHQuBC/G1LK313 RZbtF0hZ+li8Rr4hLEsGjftD0JqoNQ7+ngQwNjfS+Ux5lFzNh7GYestly5AeiOagYGW4 PDR8LvhgdZixyG4tnUv1z0jsddfY3j+P3LBYSh1bhIzfqxbch4rh3sFQY01aE34RSw3e VRUPvk7q7FFtztJdclfsKOQ36w35QX9bahZivOJNZXpXjeR18CKmAmsim0aEub2bKkz0 EiDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=YpoIJarz; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si14954246edt.377.2021.08.08.13.41.13; Sun, 08 Aug 2021 13:41:47 -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=pass header.i=@googlemail.com header.s=20161025 header.b=YpoIJarz; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbhHHUh2 (ORCPT + 99 others); Sun, 8 Aug 2021 16:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231559AbhHHUh1 (ORCPT ); Sun, 8 Aug 2021 16:37:27 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96414C061760; Sun, 8 Aug 2021 13:37:07 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id hs10so25371535ejc.0; Sun, 08 Aug 2021 13:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XsY1naXGPpmVYSXrwp+yqNB1LAnbf0RuN1r5nzhLAKc=; b=YpoIJarzT8405VxE8WC4sxtHg96SjtT5fNSHqFIQzaLuckx/pMl6h6p1S0I7ff24IA aBHvrn1OEKjvBfZanjTydEWhvbgIm4NrkFvvcEITpHJN2iAbCEbgmyeuSLW/lxUtqsK1 HLpWOeg+qpCe3q+IX0SvIlbkcG5jad8OW0NX1dle4KmlL7ID5U1NQjVp5bN1PiXy11YP wnbQnnfPSRC/vWxBLU7DcvlcIKD+ckvT0uPRHnxorXsWBc3tB1tmJMKwLv78V6CbmYP5 E0pX0bF5pUfLslrqs/8GeIpU9yFLPcdz5JKvoVWmIt/jdcwiofp4w2B4/pq9L406Pi5C dkCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XsY1naXGPpmVYSXrwp+yqNB1LAnbf0RuN1r5nzhLAKc=; b=Va0WAkcPt6waOuwFt6CgA5oGw6wE7LngFvWgShDsh+XDu5YjoU2L4iGNmUbBwMlHdh M6hV9qOo7/r2xwnIRyuUErbsGgz65hHYDjlSML6VjYfFGJ/9TJ795ldIsL+wH9PjY7Qk aC2V21uAzdPCW3iZJemAXZf7BTYmm6mkTNUD79YjhSvyWnKFYAFzZrVHw/95YrPxRcDW 3mRn6ufvNqheAMdnKRdebZYYHusmiZTRXrJfhJsaziMqp2/lySnai/lFvqRr32XimznJ +zwBuJnXdxDxlWQn8SnhtxIFxHZWhjVlZbD38vDXfLiUFnqUXVTigEV75T+PadG/zbFZ WmgA== X-Gm-Message-State: AOAM532ZB2Z0+7C4+FrZPHBnF053xNJYpJBapillp5Bpwrl24M3dVN8M 9nwdvXV6YWVFQmxrSp7e3S+w/fVggt4CdoDXi4I= X-Received: by 2002:a17:906:b0c5:: with SMTP id bk5mr19137983ejb.428.1628455026119; Sun, 08 Aug 2021 13:37:06 -0700 (PDT) MIME-Version: 1.0 References: <20210717234859.351911-1-martin.blumenstingl@googlemail.com> <20210717234859.351911-3-martin.blumenstingl@googlemail.com> <20210728175823.GA2766167@p14s> <20210805161506.GA3205691@p14s> In-Reply-To: <20210805161506.GA3205691@p14s> From: Martin Blumenstingl Date: Sun, 8 Aug 2021 22:36:55 +0200 Message-ID: Subject: Re: [PATCH v3 2/2] remoteproc: meson-mx-ao-arc: Add a driver for the AO ARC remote procesor To: Mathieu Poirier Cc: linux-remoteproc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, On Thu, Aug 5, 2021 at 6:15 PM Mathieu Poirier wrote: > > On Wed, Aug 04, 2021 at 11:03:57PM +0200, Martin Blumenstingl wrote: > > Hi Mathieu, > > > > thanks for taking the time to look into this! > > > > (I will address any of your comments that I am not mentioning in this > > email anymore. Thanks a lot for the suggestions!) > > > > On Wed, Jul 28, 2021 at 7:58 PM Mathieu Poirier > > wrote: > > [...] > > > > + writel(FIELD_PREP(AO_REMAP_REG0_REMAP_AHB_SRAM_BITS_17_14_FOR_ARM_CPU, > > > > + priv->sram_pa >> 14), > > > Indentation problem > > The idea here is to align priv->sram_pa with AO_REMAP_REG0... which > > are both arguments to FIELD_PREP > > Right, this is what I would have expected. When I applied the patch on my side > "priv->sram_pa ..." was aligned wiht the 'M' of "AO_REMAP_ ...". > > > Maybe using something like this will make that easier to read: > > tmp = FIELD_PREP(AO_REMAP_REG0_REMAP_AHB_SRAM_BITS_17_14_FOR_ARM_CPU, > > priv->sram_pa >> 14); > > writel(tmp, priv->remap_base + AO_REMAP_REG0); > > I think the main problem is that > AO_REMAP_REG0_REMAP_AHB_SRAM_BITS_17_14_FOR_ARM_CPU is simply too long. I > suggest making is shorter and add a comment to describe exactly what it does. AO_CPU_CNTL_AHB_SRAM_BITS_31_20 is used below and when looking at it now I think the alignment is also strange. For the next version I'll go with the tmp variable as I think it improves readability, even with the long(er) macro names. [...] > > > > + priv->arc_reset = devm_reset_control_get_exclusive(dev, NULL); > > > > + if (IS_ERR(priv->arc_reset)) { > > > > > > Function __reset_control_get() in __devm_reset_control_get() can return NULL so > > > this should be IS_ERR_OR_NULL(). > > The logic in there is: return optional ? NULL : ERR_PTR(-...); > > Ok, so you meant to do that. And I just checked reset_control_reset() and it does > account for a NULL parameter. I'm good with this one but add a comment to > make sure future readers don't think you've omitted to properly deal with the > NULL return value. > > > I am requesting a mandatory reset line here, so reset core will never > > return NULL > > See also [0] > > Indeed, I've read that too. Nonetheless __reset_control_get() can return NULL > by way of __reset_control_get_from_lookup(). I could not find where __reset_control_get_from_lookup returns NULL in case optional is false (which it is in this case because devm_reset_control_get_exclusive requests a "mandatory" reset line). Can you please point me to the problematic line(s) as I'd like to send a patch (which fixes this) to the reset subsystem maintainers $ git grep -A1 devm_reset_control_get_exclusive | grep IS_ERR_OR_NULL drivers/remoteproc/ti_k3_r5_remoteproc.c- if (IS_ERR_OR_NULL(core->reset)) { $ I suspect that this can be simplified then as well. Best regards, Martin [0] https://elixir.bootlin.com/linux/v5.14-rc4/source/include/linux/reset.h#L227 [1] https://elixir.bootlin.com/linux/v5.14-rc4/source/drivers/reset/core.c#L932