From nobody Fri Dec 19 16:48:03 2025 Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC4013A1DB for ; Sat, 24 Aug 2024 22:27:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.133.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724538443; cv=none; b=Z6pc9+OhCq6Fp362AEHGfiU0skHf/irMM16QCcjpltvzfz8h6oMUEAlrHInzKCejiNMge9/fvKQ1AHc+41fw9M+Ca5eYkLseOPvrfzh15AmlSCj1OTShYVX8qi+dWazPuIkMAzwoJCujREsZ+KkV+EfvUJmV18lIKQJpeaLMJMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724538443; c=relaxed/simple; bh=iv/lNNOEab19um3DFuHm0/su5FdPyA+yQpxGNpGqdKg=; h=Date:From:To:cc:Subject:Message-ID:MIME-Version:Content-Type; b=SMTtB6TgF2dyTLoNI+of0FMZUiIYaDCZ5W199vfk9DsQi+jhOn1e26zxMvqB5DOLG9otkIgiDT4BeMTq8x11BV/W6Sgt/ENkbJufQVck7v+MAG+CqAecoDIv82INpiX04yvB6eLqWfdK1kTBEMIPVn6Q6JJgBVFZmxrvVJs8Evk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk; spf=none smtp.mailfrom=orcam.me.uk; arc=none smtp.client-ip=78.133.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=orcam.me.uk Received: by angie.orcam.me.uk (Postfix, from userid 500) id 3D03692009C; Sun, 25 Aug 2024 00:17:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 2E2C692009B; Sat, 24 Aug 2024 23:17:10 +0100 (BST) Date: Sat, 24 Aug 2024 23:17:10 +0100 (BST) From: "Maciej W. Rozycki" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org cc: Boris Ostrovsky , "H. Peter Anvin" , "Kirill A. Shutemov" , Rick Edgecombe , Isaku Yamahata , Kevin Loughlin , linux-kernel@vger.kernel.org Subject: [PATCH] x86/EISA: Use memremap() to probe for the EISA BIOS signature Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Area at the 0x0FFFD9 physical location in the PC memory space is regular=20 memory, traditionally ROM BIOS and more recently a copy of BIOS code and=20 data in RAM, write-protected. Use memremap() then to get access to it rather than ioremap(), avoiding=20 issues in virtualization scenarios and complementing changes such as=20 commit f7750a795687 ("x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use=20 memremap() for RAM mappings") or commit 5997efb96756 ("x86/boot: Use=20 memremap() to map the MPF and MPC data"). Reported-by: Kirill A. Shutemov Closes: https://lore.kernel.org/r/20240822095122.736522-1-kirill.shutemov@l= inux.intel.com Signed-off-by: Maciej W. Rozycki --- Hi, It's not clear to me if pieces added with commit 6a92b11169a6 ("x86/EISA:=20 Don't probe EISA bus for Xen PV guests") are still needed with this change=20 in place; it's not my area of experience and the submitter of said commit=20 clearly didn't realise this is really an access to regular memory rather=20 than MMIO. If they are not needed, they can be discarded with a follow-up=20 change. I have verified this change with my plain EISA i486 box, and just to be=20 sure with a debug patch to report that `EISA_bus' (hardly used nowadays)=20 has indeed been set. Please apply. Maciej --- arch/x86/kernel/eisa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) linux-x86-eisa-bus-probe-memremap.diff Index: linux-macro/arch/x86/kernel/eisa.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/arch/x86/kernel/eisa.c +++ linux-macro/arch/x86/kernel/eisa.c @@ -11,15 +11,15 @@ =20 static __init int eisa_bus_probe(void) { - void __iomem *p; + void *p; =20 if ((xen_pv_domain() && !xen_initial_domain()) || cc_platform_has(CC_ATTR= _GUEST_SEV_SNP)) return 0; =20 - p =3D ioremap(0x0FFFD9, 4); + p =3D memremap(0x0FFFD9, 4, MEMREMAP_WB); if (p && readl(p) =3D=3D 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24)) EISA_bus =3D 1; - iounmap(p); + memunmap(p); return 0; } subsys_initcall(eisa_bus_probe);