freebsd-nq/sys/amd64
John Baldwin c45cbc7a1f Don't reset memory attributes when mapping physical addresses for ACPI.
Previously, AcpiOsMemory was using pmap_mapbios which would always map
the requested address Write-Back (WB).  For several AMD Ryzen laptops,
the BIOS uses AcpiOsMemory to directly access the PCI MCFG region in
order to access PCI config registers.  This has the side effect of
remapping the MCFG region in the direct map as WB instead of UC
hanging the laptops during boot.

On the one laptop I examined in detail, the _PIC global method used to
switch from 8259A PICs to I/O APICs uses a pair of PCI config space
registers at offset 0x84 in the device at 0:0:0 to as a pair of
address/data registers to access an indirect register in the chipset
and clear a single bit to switch modes.

To fix, alter the semantics of pmap_mapbios() such that it does not
modify the attributes of any existing mappings and instead uses the
existing attributes.  If a new mapping is created, this new mapping
uses WB (the default memory attribute).

Special thanks to the gentleman whose name I don't have who brought
two affected laptops to the hacker lounge at BSDCan.  Direct access to
the affected systems permitted finding the root cause within an hour
or so.

PR:		231760, 236899
Reviewed by:	kib, alc
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20327
2019-08-03 01:36:05 +00:00
..
acpica Merge ACPICA 20190329. 2019-03-29 20:21:28 +00:00
amd64 Don't reset memory attributes when mapping physical addresses for ACPI. 2019-08-03 01:36:05 +00:00
cloudabi32 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
cloudabi64 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
conf Remove gzip'ed a.out support. 2019-07-30 05:13:16 +00:00
ia32 Don't pass error from syscallenter() to syscallret(). 2019-07-15 21:25:16 +00:00
include vmx: use C99 bool, not boolean_t 2019-08-01 02:16:48 +00:00
linux linuxulator: rename linux_locore.s to .asm 2019-07-30 17:18:31 +00:00
linux32 linuxulator: rename linux_locore.s to .asm 2019-07-30 17:18:31 +00:00
pci pci_cfgreg.c: Use io port config access for early boot time. 2019-04-09 18:07:17 +00:00
sgx Add a return value to vm_page_remove(). 2019-06-26 17:37:51 +00:00
vmm vmx: use C99 bool, not boolean_t 2019-08-01 02:16:48 +00:00
Makefile