From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Vadim Pasternak <vadimp@nvidia.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
Michael Shych <michaelsh@nvidia.com>,
Ciju Rajan K <crajank@nvidia.com>,
Felix Radensky <fradensky@nvidia.com>,
Oleksandr Shamray <oleksandrs@nvidia.com>,
"platform-driver-x86@vger.kernel.org"
<platform-driver-x86@vger.kernel.org>
Subject: RE: [PATCH v5 05/12] platform/mellanox: mlxreg-hotplug: Add support for new flavor of capability registers
Date: Tue, 11 Feb 2025 16:48:13 +0200 (EET) [thread overview]
Message-ID: <c1d2e2d7-7189-3d77-7887-ed0a2e1c8709@linux.intel.com> (raw)
In-Reply-To: <PH7PR12MB66687E5512AB0A506A411C70AFF22@PH7PR12MB6668.namprd12.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 4083 bytes --]
On Mon, 10 Feb 2025, Vadim Pasternak wrote:
> > -----Original Message-----
> > From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > Sent: Monday, 3 February 2025 15:47
> > To: Vadim Pasternak <vadimp@nvidia.com>
> > Cc: Hans de Goede <hdegoede@redhat.com>; Michael Shych
> > <michaelsh@nvidia.com>; Ciju Rajan K <crajank@nvidia.com>; Felix Radensky
> > <fradensky@nvidia.com>; Oleksandr Shamray <oleksandrs@nvidia.com>;
> > platform-driver-x86@vger.kernel.org
> > Subject: Re: [PATCH v5 05/12] platform/mellanox: mlxreg-hotplug: Add
> > support for new flavor of capability registers
> >
> > On Fri, 24 Jan 2025, Vadim Pasternak wrote:
> >
> > > Hotplug platform data is common across the various systems, while
> > > hotplug driver should be able to configure only the instances relevant
> > > to specific system.
> > >
> > > For example, platform hoptplug data might contain descriptions for
> > > fan1, fan2, ..., fan{n}, while some systems equipped with all 'n'
> > > fans, others with less.
> > > Same for power units, power controllers, ASICs and so on.
> > >
> > > For detection of the real number of equipped devices capability
> > > registers are used.
> > > These registers used to indicate presence of hotplug devices through
> > > the bitmap.
> >
> > Hi,
> >
> > Don't leave non-full lines in middle of a paragraph.
> >
> > > For some new big modular systems, these registers will provide
> > > presence by counters.
> > >
> > > Use slot parameter to determine whether capability register contains
> > > bitmask or counter.
> > >
> > > Some 'capability' registers can be shared between different resources.
> > > Use fields 'capability_bit' and 'capability_mask' for getting only
> > > relevant capability bits.
> > >
> > > Reviewed-by: Felix Radensky <fradensky@nvidia.com>
> > > Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> > > ---
> > > v2->v3
> > > Comments pointed out by Ilpo:
> > > - Change rol32() to shift left.
> > > ---
> > > drivers/platform/mellanox/mlxreg-hotplug.c | 22
> > > ++++++++++++++++++++--
> > > 1 file changed, 20 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c
> > > b/drivers/platform/mellanox/mlxreg-hotplug.c
> > > index 0ce9fff1f7d4..c525b8754d48 100644
> > > --- a/drivers/platform/mellanox/mlxreg-hotplug.c
> > > +++ b/drivers/platform/mellanox/mlxreg-hotplug.c
> > > @@ -274,6 +274,12 @@ static int mlxreg_hotplug_attr_init(struct
> > mlxreg_hotplug_priv_data *priv)
> > > if (ret)
> > > return ret;
> > >
> > > + if (!regval)
> > > + continue;
> > > +
> > > + /* Remove non-relevant bits. */
> > > + if (item->capability_mask)
> > > + regval = (regval & item->capability_mask) <<
> > > +item->capability_bit;
>
> After dropping 'capability_bit', it'll be just masking of unused bits:
>
> /* Remove non-relevant bits. */
> if (item->capability_mask)
> regval = (regval & item->capability_mask);
>
> >
> > What's in regval at this point? What it was before this patch?
> >
> > > item->mask = GENMASK((regval & item->mask) - 1, 0);
> >
> > I'm sorry but that comment didn't really help me understand what's going on
> > here with the double field mask generation.
This does not address all my concerns. Before this change, GENMASK() was
calculated from regval directly. After this change, it is calculated from
the value that is subset of bits. Why were the bits relevant before this
change?
Your patch 1 says "Register contains bitmask of attributes or number of
attributtes, which should be handled." So if it's the first case, bitmask
of attributes, how can this code be correct since that value is passed to
GENMASK()??
TBH, even that pre-existing item->mask recalculation looks really odd.
> > Is the code correct both before the addition of the extra step and after it?
> > Because I cannot wrap my head around what this code attempts to do and
> > how could it be correct both pre and post this change.
--
i.
next prev parent reply other threads:[~2025-02-11 14:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 17:26 [PATCH v5 00/12] platform/mellanox: Add support for new systems, amendments, relocate mlx-platform module Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 01/12] mellanox: Relocate mlx-platform driver Vadim Pasternak
2025-02-04 14:33 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 02/12] platform: mellanox: mlx-platform: Cosmetic changes Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 03/12] platform: mellanox: mlx-platform: Change register name Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 04/12] platform_data/mlxreg: Add capability bit and mask fields Vadim Pasternak
2025-02-03 13:50 ` Ilpo Järvinen
2025-02-10 20:30 ` Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 05/12] platform/mellanox: mlxreg-hotplug: Add support for new flavor of capability registers Vadim Pasternak
2025-02-03 13:47 ` Ilpo Järvinen
2025-02-10 20:30 ` Vadim Pasternak
2025-02-11 14:48 ` Ilpo Järvinen [this message]
2025-01-24 17:26 ` [PATCH v5 06/12] platform/mellanox: Rename field to improve code readability Vadim Pasternak
2025-02-03 13:52 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 07/12] platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU Vadim Pasternak
2025-02-03 14:20 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 08/12] platform: mellanox: Introduce support of Nvidia smart switch Vadim Pasternak
2025-02-03 14:32 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 09/12] platform: mellanox: Cosmetic changes to improve code style Vadim Pasternak
2025-02-03 14:35 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 10/12] platform: mellanox: mlx-platform: Add support for new Nvidia system Vadim Pasternak
2025-02-03 14:38 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 11/12] platform: mellanox: nvsw-sn2200: Add support for new system flavour Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 12/12] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces Vadim Pasternak
2025-02-03 14:40 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1d2e2d7-7189-3d77-7887-ed0a2e1c8709@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=crajank@nvidia.com \
--cc=fradensky@nvidia.com \
--cc=hdegoede@redhat.com \
--cc=michaelsh@nvidia.com \
--cc=oleksandrs@nvidia.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=vadimp@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.