lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Nov 2023 17:52:43 +0100
From:   "Arnd Bergmann" <arnd@...nel.org>
To:     "Philipp Stanner" <pstanner@...hat.com>,
        "Bjorn Helgaas" <bhelgaas@...gle.com>,
        "Andrew Morton" <akpm@...ux-foundation.org>,
        "Randy Dunlap" <rdunlap@...radead.org>,
        "Jason Gunthorpe" <jgg@...pe.ca>,
        "Eric Auger" <eric.auger@...hat.com>,
        "Kent Overstreet" <kent.overstreet@...il.com>,
        "Niklas Schnelle" <schnelle@...ux.ibm.com>,
        "Neil Brown" <neilb@...e.de>, "John Sanpe" <sanpeqf@...il.com>,
        "Dave Jiang" <dave.jiang@...el.com>,
        "Yury Norov" <yury.norov@...il.com>,
        "Kees Cook" <keescook@...omium.org>,
        "Masami Hiramatsu" <mhiramat@...nel.org>,
        "David Gow" <davidgow@...gle.com>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        "wuqiang.matt" <wuqiang.matt@...edance.com>,
        "Jason Baron" <jbaron@...mai.com>,
        "Ben Dooks" <ben.dooks@...ethink.co.uk>,
        "Danilo Krummrich" <dakr@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH 4/4] lib/iomap.c: improve comment about pci anomaly

On Wed, Nov 29, 2023, at 13:40, Philipp Stanner wrote:
> On Tue, 2023-11-21 at 11:03 +0100, Arnd Bergmann wrote:
>> On Mon, Nov 20, 2023, at 22:59, Philipp Stanner wrote:
>> We should be able to define a generic version like
>> 
>> void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
>> {
>> #ifdef CONFIG_HAS_IOPORT
>>        if (iomem_is_ioport(addr)) {
>>               ioport_unmap(addr);
>>               return;
>>        }
>> #endif
>>       iounmap(addr)
>> }
>
> ACK, I think this makes sense – if we agree (as in the other thread)
> that we never need an empty pci_iounmap().
>
>> 
>> and then define iomem_is_ioport() in lib/iomap.c for x86,
>
> Wait a minute.
> lib/ should never contain architecture-specific code, should it? I
> assume your argument is that we write a default version of
> iomem_is_ioport(), that could, in theory, be used by many
> architectures, but ultimately only x86 will use that default.

I would hope that eventually we can build lib/iomap.c
only on x86, as everything else can live without it.

>> while defining it in asm-generic/io.h for the rest,
>
> So we're not talking about the function prototypes here, but about the
> actual implementation that should reside in asm-generic/io.h, aye?
> Because the prototype obviously always has to be identical.

It could live in lib/pci_iomap.c or in
include/asm-generic/pci_iomap.h, it doesn't really matter
since the definition is trivial. asm-generic/io.h is probably
not the right place, unless we want to merge all of
asm-generic/pci_iomap.h into asm-generic/io.h. We could
do that now that all architectures include asm-generic/io.h
and that includes asm-generic/pci_iomap.h unconditionally.

>> with an override in asm/io.h for those architectures
>> that need a custom inb().
>
> So like this in ARCH/include/asm/io.h:
>
> #define iomem_is_ioport iomem_is_ioport
> bool iomem_is_ioport(...);
>
> and in include/asm-generic/io.h:
>
> #ifndef iomem_is_ioport
> bool iomem_is_ioport(...);
>
> correct?

Yes.
 
>> arch/powerpc/platforms/Kconfig: select GENERIC_IOMAP
>> 
>> This is only used for two platforms: cell and powernv,
>> though on Cell it no longer does anything after the
>> commit f4981a00636 ("powerpc: Remove the celleb support");
>> I think the entire io_workarounds code now be folded
>> back into spider_pci.c if we wanted to.
>> 
>> The PowerNV LPC support does seem to still rely on it.
>> This tries to do the exact same thing as lib/logic_pio.c
>> for Huawei arm64 servers. I suspect that neither of them
>> does it entirely correctly since the powerpc side appears
>> to just override any non-LPC PIO support while the arm64
>> side is missing the ioread/iowrite support.
>
> I think by now I get what the issue with GENERIC_IOMAP is. But do you
> want me to do something about GENERIC_IOMAP (besides the things
> directly related to the PCI functionality I'm touching) for you to
> approve of a modified version of this patch series?

It would be nice to clean up some of the architectures
that incorrectly select it at the moment, but that
can be a separate series if you want to get this one
done first, or I can take a look myself.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ