freebsd-dev/sys/x86
Konstantin Belousov f9feb09189 Correct handling of RMRR during early enumeration stages.
On some machines, DMAR contexts must be created before all devices
under the scope of the corresponding DMAR unit are enumerated.
Current code has two problems with that:
- scope lookup returns NULL device_t, which causes to skip creating a
  context with RMRR, which is fatal for the affected device.
- calculation of the final pci dbsf address fails if any bridge in the
  scope is not yet enumerated, because code relies on pcib_get_bus().

Make creation of contexts work either with device_t, or with DMAR PCI
scope paths.  Scope provides enough information to infer context
address, and it is directly matched against DMAR tables scopes.

When calculating bus addresses for the scope or device, use direct
pci_cfgregread(PCIR_SECBUS_1) to get the secondary bus number, instead
of pcib_get_bus().

The issue was observed on HP Gen servers, where iLO PCI devices are
located behind south bridge switch.  Turning on translation without
satisfying RMRR requests caused iLO to mostly hang, up to the level of
being unusable to control the server.

While there, remove hw.dmar.dmar_match_verbose tunable, and make the
normal logging under bootverbose useful and sufficient to diagnose
DRHD and RMRR parsing and matching.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2019-04-18 14:18:06 +00:00
..
acpica Drop "All rights reserved" from my copyright statements. 2019-03-06 22:11:45 +00:00
bios sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
cpufreq cpufreq: Remove error-prone table terminators in favor of automatic sizing 2018-04-14 03:15:05 +00:00
include pci_cfgreg.c: Use io port config access for early boot time. 2019-04-09 18:07:17 +00:00
iommu Correct handling of RMRR during early enumeration stages. 2019-04-18 14:18:06 +00:00
isa Fix amd64/i386 LINT build after r344982 2019-03-11 19:46:15 +00:00
pci Add pci_early function to detect Intel stolen memory. 2018-10-31 23:17:00 +00:00
x86 pci_cfgreg.c: Use io port config access for early boot time. 2019-04-09 18:07:17 +00:00
xen Drop "All rights reserved" from my copyright statements. 2019-03-06 22:11:45 +00:00