Leah Rowe has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81016?usp=email )
Change subject: nb/intel/haswell: make IOMMU a runtime option ......................................................................
nb/intel/haswell: make IOMMU a runtime option
When I tested graphics cards on a coreboot port for Dell OptiPlex 9020 SFF, I could not use a graphics card unless I set iommu=off on the Linux cmdline.
The current coreboot behaviour is to check whether the CPU has vt-d support and, if it does, initialise the IOMMU.
This patch maintains the current behaviour by default, but allows the user to turn *off* the IOMMU, even if vt-d is supported by the host CPU.
If iommu=Disable is specified, the check will not be performed, and the IOMMU will be left disabled. This option has been added to all current Haswell boards, though it is recommended to leave the IOMMU turned on in most setups.
Change-Id: Ib743bd00a872c7d73cf9711d618811c7778f2ffb Signed-off-by: Leah Rowe info@minifree.org --- M src/mainboard/asrock/b85m_pro4/cmos.default M src/mainboard/asrock/b85m_pro4/cmos.layout M src/mainboard/asrock/h81m-hds/cmos.default M src/mainboard/asrock/h81m-hds/cmos.layout M src/mainboard/google/beltino/cmos.layout M src/mainboard/google/slippy/cmos.layout M src/mainboard/intel/baskingridge/cmos.layout M src/mainboard/lenovo/haswell/cmos.default M src/mainboard/lenovo/haswell/cmos.layout M src/mainboard/lenovo/m900_tiny/cmos.default M src/mainboard/lenovo/m900_tiny/cmos.layout M src/mainboard/supermicro/x10slm-f/cmos.default M src/mainboard/supermicro/x10slm-f/cmos.layout M src/northbridge/intel/haswell/early_init.c 14 files changed, 47 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/81016/1
diff --git a/src/mainboard/asrock/b85m_pro4/cmos.default b/src/mainboard/asrock/b85m_pro4/cmos.default index 01bf20a..dfc8b80 100644 --- a/src/mainboard/asrock/b85m_pro4/cmos.default +++ b/src/mainboard/asrock/b85m_pro4/cmos.default @@ -4,3 +4,4 @@ debug_level=Debug nmi=Enable power_on_after_fail=Disable +iommu=Enable diff --git a/src/mainboard/asrock/b85m_pro4/cmos.layout b/src/mainboard/asrock/b85m_pro4/cmos.layout index efdc333..c9883ea 100644 --- a/src/mainboard/asrock/b85m_pro4/cmos.layout +++ b/src/mainboard/asrock/b85m_pro4/cmos.layout @@ -11,6 +11,7 @@ 395 4 e 4 debug_level 408 1 e 1 nmi 409 2 e 5 power_on_after_fail + 412 1 e 6 iommu 984 16 h 0 check_sum # -----------------------------------------------------------------
@@ -38,6 +39,8 @@ 5 0 Disable 5 1 Enable 5 2 Keep + 6 0 Disable + 6 1 Enable # -----------------------------------------------------------------
# ----------------------------------------------------------------- diff --git a/src/mainboard/asrock/h81m-hds/cmos.default b/src/mainboard/asrock/h81m-hds/cmos.default index 01bf20a..dfc8b80 100644 --- a/src/mainboard/asrock/h81m-hds/cmos.default +++ b/src/mainboard/asrock/h81m-hds/cmos.default @@ -4,3 +4,4 @@ debug_level=Debug nmi=Enable power_on_after_fail=Disable +iommu=Enable diff --git a/src/mainboard/asrock/h81m-hds/cmos.layout b/src/mainboard/asrock/h81m-hds/cmos.layout index c9ba76c..95ee3d3 100644 --- a/src/mainboard/asrock/h81m-hds/cmos.layout +++ b/src/mainboard/asrock/h81m-hds/cmos.layout @@ -21,6 +21,9 @@ 408 1 e 1 nmi 409 2 e 5 power_on_after_fail
+# enable or disable iommu +412 1 e 6 iommu + # coreboot config options: check sums 984 16 h 0 check_sum
@@ -52,6 +55,9 @@ 5 1 Enable 5 2 Keep
+6 0 Disable +6 1 Enable + # ----------------------------------------------------------------- checksums
diff --git a/src/mainboard/google/beltino/cmos.layout b/src/mainboard/google/beltino/cmos.layout index 78d44c1..c143979 100644 --- a/src/mainboard/google/beltino/cmos.layout +++ b/src/mainboard/google/beltino/cmos.layout @@ -19,6 +19,9 @@ 408 1 e 1 nmi 409 2 e 7 power_on_after_fail
+# enable or disable iommu +412 1 e 8 iommu + # coreboot config options: bootloader #Used by ChromeOS: 416 128 r 0 vbnv @@ -47,6 +50,8 @@ 7 0 Disable 7 1 Enable 7 2 Keep +8 0 Disable +8 1 Enable # ----------------------------------------------------------------- checksums
diff --git a/src/mainboard/google/slippy/cmos.layout b/src/mainboard/google/slippy/cmos.layout index 78d44c1..c143979 100644 --- a/src/mainboard/google/slippy/cmos.layout +++ b/src/mainboard/google/slippy/cmos.layout @@ -19,6 +19,9 @@ 408 1 e 1 nmi 409 2 e 7 power_on_after_fail
+# enable or disable iommu +412 1 e 8 iommu + # coreboot config options: bootloader #Used by ChromeOS: 416 128 r 0 vbnv @@ -47,6 +50,8 @@ 7 0 Disable 7 1 Enable 7 2 Keep +8 0 Disable +8 1 Enable # ----------------------------------------------------------------- checksums
diff --git a/src/mainboard/intel/baskingridge/cmos.layout b/src/mainboard/intel/baskingridge/cmos.layout index 78d44c1..f2c602f 100644 --- a/src/mainboard/intel/baskingridge/cmos.layout +++ b/src/mainboard/intel/baskingridge/cmos.layout @@ -19,6 +19,8 @@ 408 1 e 1 nmi 409 2 e 7 power_on_after_fail
+412 1 e 8 iommu + # coreboot config options: bootloader #Used by ChromeOS: 416 128 r 0 vbnv @@ -47,6 +49,8 @@ 7 0 Disable 7 1 Enable 7 2 Keep +8 0 Disable +8 1 Enable # ----------------------------------------------------------------- checksums
diff --git a/src/mainboard/lenovo/haswell/cmos.default b/src/mainboard/lenovo/haswell/cmos.default index 08db97c..cc6b363 100644 --- a/src/mainboard/lenovo/haswell/cmos.default +++ b/src/mainboard/lenovo/haswell/cmos.default @@ -14,3 +14,4 @@ backlight=Keyboard enable_dual_graphics=Disable usb_always_on=Disable +iommu=Enable diff --git a/src/mainboard/lenovo/haswell/cmos.layout b/src/mainboard/lenovo/haswell/cmos.layout index 27915d3..59df76b 100644 --- a/src/mainboard/lenovo/haswell/cmos.layout +++ b/src/mainboard/lenovo/haswell/cmos.layout @@ -23,6 +23,7 @@
# coreboot config options: EC 411 1 e 8 first_battery +413 1 e 14 iommu 415 1 e 1 wlan 416 1 e 1 trackpoint 417 1 e 1 fn_ctrl_swap @@ -72,6 +73,8 @@ 13 0 Disable 13 1 AC and battery 13 2 AC only +14 0 Disable +14 1 Enable
# ----------------------------------------------------------------- checksums diff --git a/src/mainboard/lenovo/m900_tiny/cmos.default b/src/mainboard/lenovo/m900_tiny/cmos.default index 84236aa..d78cdc9 100644 --- a/src/mainboard/lenovo/m900_tiny/cmos.default +++ b/src/mainboard/lenovo/m900_tiny/cmos.default @@ -4,3 +4,4 @@ debug_level=Debug power_on_after_fail=Disable nmi=Enable +iommu=Enable diff --git a/src/mainboard/lenovo/m900_tiny/cmos.layout b/src/mainboard/lenovo/m900_tiny/cmos.layout index 322fa7d..0b61f4e 100644 --- a/src/mainboard/lenovo/m900_tiny/cmos.layout +++ b/src/mainboard/lenovo/m900_tiny/cmos.layout @@ -24,6 +24,9 @@ 408 1 e 1 nmi 409 2 e 7 power_on_after_fail
+# turn iommu on or off +412 1 e 8 iommu + # coreboot config options: ME 416 1 e 2 me_state 417 3 h 0 me_state_counter @@ -54,6 +57,8 @@ 7 0 Disable 7 1 Enable 7 2 Keep +8 0 Disable +8 1 Enable # ----------------------------------------------------------------- checksums
diff --git a/src/mainboard/supermicro/x10slm-f/cmos.default b/src/mainboard/supermicro/x10slm-f/cmos.default index 7ce38fb..6049e79 100644 --- a/src/mainboard/supermicro/x10slm-f/cmos.default +++ b/src/mainboard/supermicro/x10slm-f/cmos.default @@ -5,3 +5,4 @@ nmi=Enable power_on_after_fail=Keep hide_ast2400=Disable +iommu=Enable diff --git a/src/mainboard/supermicro/x10slm-f/cmos.layout b/src/mainboard/supermicro/x10slm-f/cmos.layout index 38ba87a..24d39e9 100644 --- a/src/mainboard/supermicro/x10slm-f/cmos.layout +++ b/src/mainboard/supermicro/x10slm-f/cmos.layout @@ -21,6 +21,9 @@ 408 1 e 1 nmi 409 2 e 5 power_on_after_fail
+# enable or disable iommu +412 1 e 6 iommu + # coreboot config options: mainboard 416 1 e 1 hide_ast2400
@@ -55,6 +58,9 @@ 5 1 Enable 5 2 Keep
+6 0 Disable +6 1 Enable + # ----------------------------------------------------------------- checksums
diff --git a/src/northbridge/intel/haswell/early_init.c b/src/northbridge/intel/haswell/early_init.c index e47deb5..1a7e0b1 100644 --- a/src/northbridge/intel/haswell/early_init.c +++ b/src/northbridge/intel/haswell/early_init.c @@ -5,6 +5,7 @@ #include <device/mmio.h> #include <device/pci_def.h> #include <device/pci_ops.h> +#include <option.h>
#include "haswell.h"
@@ -157,6 +158,10 @@ static void haswell_setup_iommu(void) { const u32 capid0_a = pci_read_config32(HOST_BRIDGE, CAPID0_A); + u8 enable_iommu = get_uint_option("iommu", 1); + + if (!enable_iommu) + return;
if (capid0_a & VTD_DISABLE) return;