This patch adds several routines that track and expose information
about various XSAVE-related features. More specifically, it adds the
ability to check whether a given XFEATURE is supported and which XSAVE
extensions are supported. Furthermore, it adds several routines for
calculating the size and offsets within a save area given a XSAVE
feature bitmap.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D47394
This patch adds definitions for Intel PT-related MSRs and
several PT feature bits.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D46419
This patch refactors the Performance Counter interrupt setup code to
allow sharing the interrupt line between multiple drivers.
More specifically, Performance Counter interrupts are used by both
hwpmc(4) and hwt(4)'s upcoming Intel Processor Trace backend.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D46420
This refactor aims to add the ability to share performance counter
interrupts by refactoring the kernel-mode NMI handler. The handler now
allows multiple drivers to service the same interrupt (e.g. hwpmc(4)
and hwt(4)'s Intel Processor Trace backend).
Reviewed by: kib, avg
Differential Revision: https://reviews.freebsd.org/D46421
void * is handy when you truly do not care about the type. Yet there is
so much casting back and forth in the IO-APIC code as to be hazardous.
Achieve better static checking by the compiler using a typedef.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1457
The field is mostly used for display, and should match device unit, not
BIOS IVHD device id, which is deprecated and is practically zero.
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Replace the { 0, 0 } construct with the preferred DEVMETHOD_END. Add
a space after to indicate it is separate from the section above.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1457
Ensure we have at least one commonly built kernel config that does not include
DTrace.
This is intended to help detect issues such as 45d108ee14 where a variable is
only used for static probe point, resulting in build failures when DTrace is
disabled.
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D47821
Previously, VMXON would be executed on a resume, contrary to proper
initalization. The contents of MSR_IA32_FEATURE_CONTROL may be lost on
suspension, therefore must be restored. Likewise, the VMX Enable bit may be
cleared upon suspend, requiring it to be re-set.
Concretely disable VMX on suspend, and re-enable it on resume.
Note: any IOMMU context will remain lost for any enabled vmm devices.
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
Reviewed by: jhb,imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1419
This is a somewhat cleaner and more future-proof way to get the correct
device table offsets.
Reviewed by: kib
Reported by: crest_freebsd_rlwinm.de
Fixes: 5035db22 "amdiommu: Fix device table segment
base register offsets"
Differential Revision: https://reviews.freebsd.org/D47769
Segment base registers are at 8-byte intervals, while the register
write helper takes a byte-aligned offset. This fixes
DEV_TAB_HARDWARE_ERROR events and associated peripheral I/O failures
on an Epyc-based system with 8-segment device tables.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D47752
for the case where amdiommu is not enabled. In this case, it does not
matter if IVHD does not describe some device. Similarly, no unit can be
found for a device, because units are not instantiated, but it does not
matter.
Reported by: mav
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
We have been incorrectly choosing the "hlt" idle method on modern AMD
EPYC servers for C1 idle. This is because AMD also uses the Functional
Fixed Hardware interface. Due to not parsing the table properly for
AMD, and due to a weird quirk where the mwait latency for C1 is
mis-interpreted as the latency for hlt, we wind up choosing hlt for
c1, which has a far higher wake up latency (similar to IO) of roughly
400us on my test system (AMD 7502P).
This patch fixes this by:
- Looking for AMD in addition to Intel in the FFH
(Note the vendor id of "2" for AMD is not publically documented, but
AMD has confirmed they are using "2" and has promised to document it.)
- Using mwait on AMD when specified in the table, and when CPUid says
its supported
- Fixing a weird issue where we copy the contents of cx_ptr for C1 and
when moving to C2, we do not reinitialize cx_ptr. This leads to
mwait being selected, and ignoring the specified i/o halt method
unless we clear mwait before looking at the table for C2.
Differential Revision: https://reviews.freebsd.org/D47444
Reviewed by: dab, kib, vangyzen
Sponsored by: Netflix
This driver is functionally equivalent to the in-tree Intel DMAR code.
It handles busdma and interrupt remapping from the host OS. There is no
integration with bhyve, and the stub iommu drivers in bhyve code cannot
coexist with this driver (planned).
The biggest architectural problem with the code is that the AMD IOMMU
units are enumerated as PCIe-attached security devices, which is much
later after HPET and IOAPIC drivers attached and actived interrupts.
Because of this, HPET FSB interrupts and IOAPIC interrupts are always
identity-mapped.
The code is of late alpha quality. By default the driver is disabled.
To enable for testing, set in loader.conf:
hw.amdiommu.enable=1
hw.iommu.dma=1 <- to enable iommu busdma
hw.iommu.ir=1 <- to enable interrupt remapping
Discussed with: emaste
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D47256
None of these drivers are for bus devices, so bus_generic_* is not
appropriate. Most of these were nops except that detach would
actually "succeed" (but not do any cleanup).
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47374
Set a device description in probe and handle both adding and attaching
children in attach.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47185
Show the iommu unit' device name/unit which translates the device'
requests, if any, as parsed out from the BIOS tables.
Also show the rid value for the device.
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D47098
which returns apic device_t by apic_id, if there exists the pci representer
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
This also allows to move some bits of ddb print routines into
iommu_utils.c common for x86 iommu drivers.
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
IOMMU is free to access page tables until we invalidate them
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
The pages are inserted into the added slist if the entry parameter is
passed to iommu_pgfree(). For now it is nop.
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week