0047-nb-haswell-lock-policy-regs-when-disabling-IOMMU.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From fa4f05e39744eb4c4606f940b8acc7fd053b11d4 Mon Sep 17 00:00:00 2001
  2. From: Leah Rowe <info@minifree.org>
  3. Date: Sat, 4 May 2024 02:00:53 +0100
  4. Subject: [PATCH 1/1] nb/haswell: lock policy regs when disabling IOMMU
  5. Angel Pons told me I should do it. See comments here:
  6. https://review.coreboot.org/c/coreboot/+/81016
  7. I see no harm in complying with the request. I'll merge
  8. this into the main patch at a later date and try to
  9. get this upstreamed.
  10. Just a reminder: on Optiplex 9020 variants, Xorg locks up
  11. under Linux when tested with a graphics card; disabling
  12. IOMMU works around the issue. Intel graphics work just fine
  13. with IOMMU turned on. Libreboot disables IOMMU by default,
  14. on the 9020, so that users can install graphics cards easily.
  15. Signed-off-by: Leah Rowe <info@minifree.org>
  16. ---
  17. src/northbridge/intel/haswell/early_init.c | 15 +++++++--------
  18. 1 file changed, 7 insertions(+), 8 deletions(-)
  19. diff --git a/src/northbridge/intel/haswell/early_init.c b/src/northbridge/intel/haswell/early_init.c
  20. index 1a7e0b1076..e9506ee830 100644
  21. --- a/src/northbridge/intel/haswell/early_init.c
  22. +++ b/src/northbridge/intel/haswell/early_init.c
  23. @@ -160,17 +160,16 @@ static void haswell_setup_iommu(void)
  24. const u32 capid0_a = pci_read_config32(HOST_BRIDGE, CAPID0_A);
  25. u8 enable_iommu = get_uint_option("iommu", 1);
  26. - if (!enable_iommu)
  27. - return;
  28. -
  29. if (capid0_a & VTD_DISABLE)
  30. return;
  31. - /* Setup BARs: zeroize top 32 bits; set enable bit */
  32. - mchbar_write32(GFXVTBAR + 4, GFXVT_BASE_ADDRESS >> 32);
  33. - mchbar_write32(GFXVTBAR + 0, GFXVT_BASE_ADDRESS | 1);
  34. - mchbar_write32(VTVC0BAR + 4, VTVC0_BASE_ADDRESS >> 32);
  35. - mchbar_write32(VTVC0BAR + 0, VTVC0_BASE_ADDRESS | 1);
  36. + if (enable_iommu) {
  37. + /* Setup BARs: zeroize top 32 bits; set enable bit */
  38. + mchbar_write32(GFXVTBAR + 4, GFXVT_BASE_ADDRESS >> 32);
  39. + mchbar_write32(GFXVTBAR + 0, GFXVT_BASE_ADDRESS | 1);
  40. + mchbar_write32(VTVC0BAR + 4, VTVC0_BASE_ADDRESS >> 32);
  41. + mchbar_write32(VTVC0BAR + 0, VTVC0_BASE_ADDRESS | 1);
  42. + }
  43. /* Set L3HIT2PEND_DIS, lock GFXVTBAR policy config registers */
  44. u32 reg32;
  45. --
  46. 2.39.2