public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@kernel.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Jarred White <jarredwhite@linux.microsoft.com>,
	Perry Yuan <perry.yuan@amd.com>,
	Easwar Hariharan <eahariha@linux.microsoft.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] acpi: allow building without CONFIG_HAS_IOPORT
Date: Fri, 11 Oct 2024 16:41:22 +0300	[thread overview]
Message-ID: <ZwkrAhBIu4SV6B-O@smile.fi.intel.com> (raw)
In-Reply-To: <e135bc0a-7c06-4ee2-b149-100595a29d7e@app.fastmail.com>

On Fri, Oct 11, 2024 at 11:40:05AM +0000, Arnd Bergmann wrote:
> On Fri, Oct 11, 2024, at 11:12, Andy Shevchenko wrote:
> > On Fri, Oct 11, 2024 at 09:59:46AM +0000, Arnd Bergmann wrote:
> >> On Fri, Oct 11, 2024, at 09:53, Andy Shevchenko wrote:
> >> > On Fri, Oct 11, 2024 at 06:18:18AM +0000, Arnd Bergmann wrote:
> >> >> +	if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
> >> >> +		*value = BIT_MASK(width);
> >> >> +		return AE_NOT_IMPLEMENTED;
> >> >
> >> > Perhaps it has already been discussed, but why do we need to file value with
> >> > semi-garbage when we know it's invalid anyway?
> >> 
> >> It's not strictly necessary, just precaution for possible callers
> >> that use the resulting data without checking the error code.
> >
> > Do you have any examples of that in the kernel?
> 
> drivers/acpi/processor_throttling.c:            acpi_os_read_port((acpi_io_address) throttling->status_register.
> --
> drivers/cpufreq/acpi-cpufreq.c-
> drivers/cpufreq/acpi-cpufreq.c: acpi_os_read_port(reg->address, &val, reg->bit_width);
> 
> $ git grep ^[^=]*acpi_os_read_port 
> drivers/acpi/processor_throttling.c:            acpi_os_read_port(\ (acpi_io_address) throttling->status_register.
> drivers/cpufreq/acpi-cpufreq.c: acpi_os_read_port(reg->address, &val, reg->bit_width);

May be we can add checks to them, but dunno...

> >> The all-ones data is what an x86 PC would see when an I/O
> >> port is read that is not connected to any device.
> >
> > Yes, but it's not what your code does.
> 
> My bad, I was confused about what BIT_MASK() does.
> I'll change it to "GENMASK(width, 0)", which should
> do what I intended.

Okay. Maybe also adding a comment that it's usual behaviour in response to
the read from non-existing IO port?

(Or for the curios it's all comes from the Data Bus on hardware being Open
 Drain an hence use of pull-up resistors and when there is no response on
 the bus, the default will be "All 1:s").

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-10-11 13:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  6:18 [PATCH v2 1/3] acpi: make EC support compile-time conditional Arnd Bergmann
2024-10-11  6:18 ` [PATCH v2 2/3] acpi: allow building without CONFIG_HAS_IOPORT Arnd Bergmann
2024-10-11  9:53   ` Andy Shevchenko
2024-10-11  9:59     ` Arnd Bergmann
2024-10-11 11:12       ` Andy Shevchenko
2024-10-11 11:28         ` Rafael J. Wysocki
2024-10-11 13:39           ` Andy Shevchenko
2024-10-11 11:40         ` Arnd Bergmann
2024-10-11 13:41           ` Andy Shevchenko [this message]
2024-10-11  6:18 ` [PATCH v2 3/3] acpi: processor_perflib: extend X86 dependency Arnd Bergmann
2024-10-12 22:38   ` kernel test robot
2024-10-11 16:56 ` [PATCH v2 1/3] acpi: make EC support compile-time conditional Guenter Roeck
2024-10-12 10:18 ` Hans de Goede
2024-10-21 11:39 ` Rafael J. Wysocki
2024-10-24 15:49   ` Rafael J. Wysocki
2024-10-30 12:40     ` Arnd Bergmann

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=ZwkrAhBIu4SV6B-O@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=eahariha@linux.microsoft.com \
    --cc=jarredwhite@linux.microsoft.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perry.yuan@amd.com \
    --cc=rafael@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