From: "Radek Marciňa" <github.unusual340@8alias.com>
To: stable@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>,Ingo Molnar
<mingo@redhat.com>,Borislav Petkov <bp@alien8.de>,Dave Hansen
<dave.hansen@linux.intel.com>,x86@kernel.org,Andrew Morton
<akpm@linux-foundation.org>,David Hildenbrand
<david@kernel.org>,linux-mm@kvack.org,Arnd Bergmann
<arnd@arndb.de>,Michael Kelley
<mhkelley58@gmail.com>,linux-kernel@vger.kernel.org
Subject: [PATCH 6.12.y 0/2] Fix ioremap of addresses above 4 GiB on x86-32 PAE
Date: Sat, 31 Oct 2026 15:44:03 +0000 [thread overview]
Message-ID: <179346145167.7.7861216093151225931.1735978772@8alias.com> (raw)
From: Radek Marciňa <github.unusual340@8alias.com>
Both patches are stable-only. In these trees the x86 PAGE_MASK is an
unsigned long, so "phys_addr &= PAGE_MASK" on a 64-bit physical address
clears bits 32-63. __ioremap_caller() and __early_ioremap() both do
this and map the low 32-bit alias of anything above 4 GiB.
Mainline is not affected since v6.13, where commit efe8419ae78d ("vdso:
Introduce vdso/page.h") and commit d4a65302dd84 ("vdso: Change
PAGE_MASK to signed on all 32-bit architectures") made PAGE_MASK signed
on 32-bit. Neither was marked for stable. They cannot go to 6.6.y and
older, which lack CONFIG_PAGE_SHIFT (added in v6.9). They do apply to
6.12.y, but together with the i915 build fix in commit 8fd236b00fc1
("drm: i915: Change fault type to unsigned long") they change PAGE_MASK
on every 32-bit architecture, the kind of change that caused the arm32
regression d4a65302dd84 itself fixes. So these patches cast at the two
affected sites instead.
Please apply to 6.12.y, 6.6.y, 6.1.y, 5.15.y and 5.10.y; the series
applies unchanged to all five. 6.18.y and later have the upstream
change.
Reproducer for 1/2: i386_defconfig plus CONFIG_HIGHMEM64G=y,
CONFIG_VIRTIO_PCI=y and CONFIG_HW_RANDOM_VIRTIO=y, booted with
qemu-system-x86_64 -M q35 -accel kvm -cpu host,host-phys-bits-limit=44 \
-m 5G -object memory-backend-ram,id=big,size=4G,share=on \
-device ivshmem-plain,memdev=big -device virtio-rng-pci \
-nic none -nographic -no-reboot \
-kernel arch/x86/boot/bzImage -append "console=ttyS0 panic=-1"
The extra options get the virtio BARs above 4 GiB with SeaBIOS 1.16.2,
1.16.3 and 1.17.0. Since 1.16.3 SeaBIOS places 64-bit BARs high when
the guest has RAM above 4 GiB, which on q35 starts at -m 2816M; before
that only when the 32-bit window overflows, which the 4 GiB ivshmem BAR
forces. host-phys-bits-limit=44 keeps SeaBIOS 1.16.3 from placing them
beyond the 44 bits a PAE kernel can address.
On 6.12.115 the virtio BAR 4 at 0xe0100000000 gets mapped at physical
0x0-0x3fff (per /proc/vmallocinfo), the device ends up FAILED and the
log shows
virtio_rng virtio0: probe with driver virtio_rng failed with error -2
With 1/2 applied the mapping is at 0xe0100000000, the device reaches
DRIVER_OK and /dev/hwrng returns data.
Nothing in a QEMU boot early-maps memory above 4 GiB on i386, so 2/2
was tested with a throwaway late_initcall that calls
early_memremap(0x100000123, 16) and prints slow_virt_to_phys() of the
result: 0x123 on 6.12.115, 0x100000123 with 2/2 applied.
Unmodified v7.3 in the same setup (CONFIG_X86_PAE=y in place of
CONFIG_HIGHMEM64G=y, which no longer exists) gets both mappings right.
Built with GCC 16.2.1, run on QEMU 11.1.2 with KVM.
Radek Marciňa (2):
x86/ioremap: Sign-extend PAGE_MASK when aligning the physical address
mm/early_ioremap: Sign-extend PAGE_MASK when aligning the physical
address
arch/x86/mm/ioremap.c | 2 +-
mm/early_ioremap.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.56.0
next reply other threads:[~2026-10-31 15:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 15:44 Radek Marciňa [this message]
2026-10-31 15:45 ` [PATCH 6.12.y 1/2] x86/ioremap: Sign-extend PAGE_MASK when aligning the physical address Radek Marciňa
2026-10-31 15:45 ` [PATCH 6.12.y 2/2] mm/early_ioremap: " Radek Marciňa
2026-10-31 20:25 ` Greg KH
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=179346145167.7.7861216093151225931.1735978772@8alias.com \
--to=github.unusual340@8alias.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhkelley58@gmail.com \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--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
all inboxes | Powered by JetHome®