linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Philipp Stanner" <pstanner@redhat.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Hanjun Guo" <guohanjun@huawei.com>, "Neil Brown" <neilb@suse.de>,
	"Kent Overstreet" <kent.overstreet@gmail.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Niklas Schnelle" <schnelle@linux.ibm.com>,
	"Uladzislau Koshchanka" <koshchanka@gmail.com>,
	"John Sanpe" <sanpeqf@gmail.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Kees Cook" <keescook@chromium.org>,
	"David Gow" <davidgow@google.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"wuqiang.matt" <wuqiang.matt@bytedance.com>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Jason Baron" <jbaron@akamai.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Ben Dooks" <ben.dooks@codethink.co.uk>,
	"Danilo Krummrich" <dakr@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Linux-Arch <linux-arch@vger.kernel.org>,
	stable@vger.kernel.org, "Arnd Bergmann" <arnd@kernel.org>
Subject: Re: [PATCH v3 5/5] lib, pci: unify generic pci_iounmap()
Date: Mon, 04 Dec 2023 14:50:45 +0100	[thread overview]
Message-ID: <05173886-444c-4bae-b1a5-d2b068e9c4a5@app.fastmail.com> (raw)
In-Reply-To: <2648aef32cd5a2272cd3ce8cd7ed5b29b2d21cad.camel@redhat.com>

On Mon, Dec 4, 2023, at 14:39, Philipp Stanner wrote:
> On Mon, 2023-12-04 at 13:38 +0100, Philipp Stanner wrote:

>> + */
>> +#if defined(ARCH_WANTS_GENERIC_IOMEM_IS_IOPORT)
>> +bool iomem_is_ioport(void __iomem *addr)
>>  {
>> -       IO_COND(addr, /* nothing */, iounmap(addr));
>> +       unsigned long port = (unsigned long __force)addr;
>> +
>> +       if (port > PIO_OFFSET && port < PIO_RESERVED)
>
> by the way:
> Reading that again my instinctive feeling would be that it should be
> port >= PIO_OFFSET.
>
> This is, however, the exactly copied logic from the IO_COND macro in
> lib/iomap.c. Is it possible that this macro contains a bug here?

Right, I think that would make more sense, but there is no
practical difference as long as I/O port 0 is always unused,
which is at least true on x86 because of PCIBIOS_MIN_IO.
Commit bb356ddb78b2 ("RISC-V: PCI: Avoid handing out address
0 to devices") describes how setting PCIBIOS_MIN_IO to 0
caused other problems.

I would just leave the logic consistent with IO_COND here,
or maybe use IO_COND() directly, like

      IO_COND(addr, return true, /* nothing */);
      return false;

     Arnd

  reply	other threads:[~2023-12-04 13:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 12:38 [PATCH v3 0/5] Regather scattered PCI-Code Philipp Stanner
2023-12-04 12:38 ` [PATCH v3 1/5] lib/pci_iomap.c: fix cleanup bugs in pci_iounmap() Philipp Stanner
2023-12-04 13:35   ` Arnd Bergmann
2023-12-04 12:38 ` [PATCH v3 2/5] lib: move pci_iomap.c to drivers/pci/ Philipp Stanner
2023-12-04 13:37   ` Arnd Bergmann
2023-12-04 12:38 ` [PATCH v3 3/5] lib: move pci-specific devres code " Philipp Stanner
2023-12-04 12:38 ` [PATCH v3 4/5] pci: move devres code from pci.c to devres.c Philipp Stanner
2023-12-04 12:38 ` [PATCH v3 5/5] lib, pci: unify generic pci_iounmap() Philipp Stanner
2023-12-04 13:39   ` Philipp Stanner
2023-12-04 13:50     ` Arnd Bergmann [this message]
2023-12-04 14:09       ` Philipp Stanner
2023-12-04 14:29         ` Arnd Bergmann
2023-12-04 13:53   ` Arnd Bergmann
2023-12-05 10:44   ` kernel test robot
2023-12-05 14:34     ` Philipp Stanner
2023-12-05 14:43       ` 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=05173886-444c-4bae-b1a5-d2b068e9c4a5@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@kernel.org \
    --cc=ben.dooks@codethink.co.uk \
    --cc=bhelgaas@google.com \
    --cc=dakr@redhat.com \
    --cc=dave.jiang@intel.com \
    --cc=davidgow@google.com \
    --cc=guohanjun@huawei.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jbaron@akamai.com \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@gmail.com \
    --cc=koshchanka@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=neilb@suse.de \
    --cc=pstanner@redhat.com \
    --cc=sanpeqf@gmail.com \
    --cc=schnelle@linux.ibm.com \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=wuqiang.matt@bytedance.com \
    --cc=yury.norov@gmail.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 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).