dmar: Disable PMR in driver attach routine
Previously it was disabled right before translation was enabled. This way the disable logic is still executed even when translation is not be activated, e.g. with hw.iommu.dma=0 tunable set. On some platforms we need to disable PMR in order for core dump to work. At the same time it was observed that enabling translation has a significant impact on network performance. With this patch PMR can be disabled, with IOMMU translation not being turned on by appending the following to the loader.conf: hw.dmar.enable=1 hw.dmar.pmr.disable=1 hw.dmar.dma=0 Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D34907
This commit is contained in:
parent
14b7706264
commit
06f659c39d
@ -405,6 +405,7 @@ dmar_attach(device_t dev)
|
||||
struct dmar_unit *unit;
|
||||
ACPI_DMAR_HARDWARE_UNIT *dmaru;
|
||||
uint64_t timeout;
|
||||
int disable_pmr;
|
||||
int i, error;
|
||||
|
||||
unit = device_get_softc(dev);
|
||||
@ -528,6 +529,16 @@ dmar_attach(device_t dev)
|
||||
dmar_release_resources(dev, unit);
|
||||
return (error);
|
||||
}
|
||||
|
||||
disable_pmr = 0;
|
||||
TUNABLE_INT_FETCH("hw.dmar.pmr.disable", &disable_pmr);
|
||||
if (disable_pmr) {
|
||||
error = dmar_disable_protected_regions(unit);
|
||||
if (error != 0)
|
||||
device_printf(dev,
|
||||
"Failed to disable protected regions\n");
|
||||
}
|
||||
|
||||
error = iommu_init_busdma(&unit->iommu);
|
||||
if (error != 0) {
|
||||
dmar_release_resources(dev, unit);
|
||||
|
@ -508,6 +508,9 @@ dmar_disable_protected_regions(struct dmar_unit *unit)
|
||||
return (0);
|
||||
|
||||
reg = dmar_read4(unit, DMAR_PMEN_REG);
|
||||
if ((reg & DMAR_PMEN_EPM) == 0)
|
||||
return (0);
|
||||
|
||||
reg &= ~DMAR_PMEN_EPM;
|
||||
dmar_write4(unit, DMAR_PMEN_REG, reg);
|
||||
DMAR_WAIT_UNTIL(((dmar_read4(unit, DMAR_PMEN_REG) & DMAR_PMEN_PRS)
|
||||
|
Loading…
Reference in New Issue
Block a user