From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A098C433F5 for ; Mon, 21 Feb 2022 23:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236418AbiBUXWD (ORCPT ); Mon, 21 Feb 2022 18:22:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235191AbiBUXV7 (ORCPT ); Mon, 21 Feb 2022 18:21:59 -0500 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75F024BEB for ; Mon, 21 Feb 2022 15:21:34 -0800 (PST) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-2d310db3812so154787397b3.3 for ; Mon, 21 Feb 2022 15:21:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=fAz2iY/D/cZqbvbRIbhtRW6KqWkElxsNNM+Upljv8j8=; b=LpNdwLY0+XX45OIkTfPgMAkNKf7PUIg0ikiV54uqh5tS+jNAj8v3nUeh6aa+7vaVpR DEWShxwETuyGkR+9wL1MGmrmSwLFJ72AVbjUzmyumqlWAlEbyvL8a/+XaGU+i7BAePJz GpsvWorIp18VqOZfGMsIvPnx6684zMe+DdUiM9zck6d/l4jTVzh1Epmpt+XM1o4VmYTC vm9dHLzhFweDZc69QJoChOdUCYbqec9b23fHpMFh1CvXMIT/b4KYwfyTVvITZJjL1Z2E aK22ovU4Gb6jKAk07Qe4KnQo89ZGu/dcsFNA8hMDnBaFmUV9ReLakCQ2MDv3TvDpLAu0 8AXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=fAz2iY/D/cZqbvbRIbhtRW6KqWkElxsNNM+Upljv8j8=; b=O3ZS0qQG+MhOYKaOt5GH0JcRGP7p1xj9o9tyfCX8l3L8LXm6tZC0dstNV0deuKKSHK zDYHJSKpMpK7hVtnlvGOoItjlqRIVJMzfeSHXcZEni7AAKiK5b965QFUWhSoUBNIU9Kt oYPMf5VskvuLA76ZR3EaA4v3rSDR7WlkeLBSwCyAia7Y0Deu4kMn7MCl0AZq0p+t7Cx9 nbFp6h5wW4nRmaEygEDJfHgILvzaNqL5l+QsmR6tg0qjRlYzJeJLRXRhFkOiorgNoQt4 Xs3uQAe67PD3x6MGmVvWDq0k2Bz73tAlkQRCdy0C/QZqTPuQ1Rcm60A6j45hbfl20bsx wq7g== X-Gm-Message-State: AOAM5335tUOjdP5J0dbRCI54r8U1h/8Sah+U5CwqDb9wsbfSXK9sT+d4 AHoRR0B4SZeRvHNN4/8NCV/n+DjP77BI9wRMFTNTdg== X-Google-Smtp-Source: ABdhPJzsW4ss5B7xVh6geOONvYuQHzSentMXLj552L88FxQEVUaKpHa4mz5QLqDIQin6TSrKuiLq+2RXgGJVxLkhsOs= X-Received: by 2002:a81:3905:0:b0:2d7:2c5:9a7c with SMTP id g5-20020a813905000000b002d702c59a7cmr11126651ywa.140.1645485694181; Mon, 21 Feb 2022 15:21:34 -0800 (PST) MIME-Version: 1.0 References: <20220221184631.252308-1-alvin@pqrs.dk> <20220221184631.252308-3-alvin@pqrs.dk> In-Reply-To: <20220221184631.252308-3-alvin@pqrs.dk> From: Linus Walleij Date: Tue, 22 Feb 2022 00:21:21 +0100 Message-ID: Subject: Re: [PATCH v2 net-next 2/2] net: dsa: realtek: rtl8365mb: serialize indirect PHY register access To: =?UTF-8?Q?Alvin_=C5=A0ipraga?= Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Michael Rasmussen , =?UTF-8?Q?Alvin_=C5=A0ipraga?= , Luiz Angelo Daros de Luca , =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 21, 2022 at 7:46 PM Alvin =C5=A0ipraga wrote: > Realtek switches in the rtl8365mb family can access the PHY registers of > the internal PHYs via the switch registers. This method is called > indirect access. At a high level, the indirect PHY register access > method involves reading and writing some special switch registers in a > particular sequence. This works for both SMI and MDIO connected > switches. What I worry about is whether we need to do a similar patch to rtl8366rb_phy_read() and rtl8366rb_phy_write() in rtl8366rb.c? And what about the upcoming rtl8367 driver? > To fix this problem, one must guard against regmap access while the > PHY indirect register read is executing. Fix this by using the newly > introduced "nolock" regmap in all PHY-related functions, and by aquiring > the regmap mutex at the top level of the PHY register access callbacks. > Although no issue has been observed with PHY register _writes_, this > change also serializes the indirect access method there. This is done > purely as a matter of convenience and for reasons of symmetry. > > Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for = RTL8365MB-VC") > Link: https://lore.kernel.org/netdev/CAJq09z5FCgG-+jVT7uxh1a-0CiiFsoKoHYs= AWJtiKwv7LXKofQ@mail.gmail.com/ > Link: https://lore.kernel.org/netdev/871qzwjmtv.fsf@bang-olufsen.dk/ > Reported-by: Ar=C4=B1n=C3=A7 =C3=9CNAL > Reported-by: Luiz Angelo Daros de Luca > Signed-off-by: Alvin =C5=A0ipraga This is a beautiful patch. Excellent job. Reviewed-by: Linus Walleij Yours, Linus Walleij