From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Andy Shevchenko <andy@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-acpi@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/1] x86: Use resource_set_{range,size}() helpers
Date: Fri, 18 Apr 2025 18:15:30 +0300 (EEST) [thread overview]
Message-ID: <db829a60-c524-73bc-e7c3-fed60e980d99@linux.intel.com> (raw)
In-Reply-To: <aAIB7Om9n_tXDnvk@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]
On Fri, 18 Apr 2025, Ingo Molnar wrote:
>
> * Ilpo Järvinen <ilpo.jarvinen@linux.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.
next prev parent reply other threads:[~2025-04-18 15:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 10:13 [PATCH 1/1] x86: Use resource_set_{range,size}() helpers Ilpo Järvinen
2025-04-16 10:22 ` Andy Shevchenko
2025-04-16 10:23 ` Andy Shevchenko
2025-04-16 11:53 ` Ilpo Järvinen
2025-04-16 12:03 ` Andy Shevchenko
2025-04-16 12:18 ` Ilpo Järvinen
2025-04-16 15:25 ` Andy Shevchenko
2025-04-18 7:40 ` Ingo Molnar
2025-04-18 15:15 ` Ilpo Järvinen [this message]
2025-04-19 14:57 ` Ingo Molnar
2025-04-16 15:05 ` Rafael J. Wysocki
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=db829a60-c524-73bc-e7c3-fed60e980d99@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andy@kernel.org \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).