[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <db829a60-c524-73bc-e7c3-fed60e980d99@linux.intel.com>
Date: Fri, 18 Apr 2025 18:15:30 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Ingo Molnar <mingo@...nel.org>
cc: Andy Shevchenko <andy@...nel.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Bjorn Helgaas <bhelgaas@...gle.com>,
linux-acpi@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
linux-pci@...r.kernel.org
Subject: Re: [PATCH 1/1] x86: Use resource_set_{range,size}() helpers
On Fri, 18 Apr 2025, Ingo Molnar wrote:
>
> * Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com> wrote:
>
> > On Wed, 16 Apr 2025, Andy Shevchenko wrote:
> >
> > > On Wed, Apr 16, 2025 at 01:13:18PM +0300, Ilpo Järvinen wrote:
> > > > Convert open coded resource size calculations to use
> > > > resource_set_{range,size}() helpers.
> > > >
> > > > While at it, use SZ_* for size parameter which makes the intent of code
> > > > more obvious.
> > >
> > > ...
> > >
> > > > + resource_set_range(res, base, 1ULL << (segn_busn_bits + 20));
> > >
> > > Then probably
> > >
> > > resource_set_range(res, base, BIT_ULL(segn_busn_bits) * SZ_1M);
> > >
> > > to follow the same "While at it"?
> >
> > I'll change that now since you brought it up. It did cross my mind to
> > convert that to * SZ_1M but it seemed to go farther than I wanted with a
> > simple conversion patch.
> >
> > I've never liked the abuse of BIT*() for size related shifts though,
> > I recall I saw somewhere a helper that was better named for size
> > related operations but I just cannot recall its name and seem to not
> > find that anymore :-(. But until I come across it once again, I guess
> > I'll have to settle to BIT*().
>
> BITS_TO_LONGS()?
Hi Ingo,
I'm not entiry sure if you're referring to my BIT*() matching unrelated
macros such as BITS_TO_LONGS() (I only meant BIT() and BIT_ULL() which I
thought was clear from the context), or that BITS_TO_LONGS() would be the
solution what I'm looking for.
In case you meant the latter, BITS_TO_LONGS() is not what I'm after.
BIT(n) sets nth bit and what I'm looking for is converting n to power of
two size. Obviously, both are mathematically doing 2^n (or 1 << n) but
they feel conceptually very different things.
--
i.
Powered by blists - more mailing lists