[coreboot-gerrit] Change in coreboot[master]: nb/intel/sandybridge/acpi: Add RMRR for GFX device

Nico Huber (Code Review) gerrit at coreboot.org
Sat Nov 17 14:12:30 CET 2018


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/29668


Change subject: nb/intel/sandybridge/acpi: Add RMRR for GFX device
......................................................................

nb/intel/sandybridge/acpi: Add RMRR for GFX device

The iGPU always needs access to its stolen memory. For proper IOMMU, we
have to make the OS aware of that.

Directly below TOLUD lies the data stolen memory (BDSM) followed by the
GTT stolen memory (BGSM), the iGPU needs access to both.

Change-Id: I391d0a5f1ea14bc90fbacabce41dddfa12b5bb0d
Signed-off-by: Nico Huber <nico.h at gmx.de>
---
M src/northbridge/intel/sandybridge/acpi.c
1 file changed, 17 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/68/29668/1

diff --git a/src/northbridge/intel/sandybridge/acpi.c b/src/northbridge/intel/sandybridge/acpi.c
index 88ac2b1..7089510 100644
--- a/src/northbridge/intel/sandybridge/acpi.c
+++ b/src/northbridge/intel/sandybridge/acpi.c
@@ -67,6 +67,22 @@
 	return current;
 }
 
+static unsigned long acpi_fill_gfx_rmrr(const unsigned long current)
+{
+	const uintptr_t base_mask = ~(MiB - 1);
+
+	struct device *const host = dev_find_slot(0, PCI_DEVFN(0, 0));
+	if (!host)
+		return current;
+
+	const u32 bgsm = pci_read_config32(host, BGSM) & base_mask;
+	const u32 tolud = pci_read_config32(host, TOLUD) & base_mask;
+	if (!bgsm || !tolud)
+		return current;
+
+	return current + acpi_create_dmar_rmrr(current, 0, bgsm, tolud - 1);
+}
+
 static unsigned long acpi_fill_dmar(unsigned long current)
 {
 	const struct device *const igfx = dev_find_slot(0, PCI_DEVFN(2, 0));
@@ -74,6 +90,7 @@
 	if (igfx && igfx->enabled) {
 		const unsigned long tmp = current;
 		current += acpi_create_dmar_drhd(current, 0, 0, IOMMU_BASE1);
+		current = acpi_fill_gfx_rmrr(current);
 		current += acpi_create_dmar_ds_pci(current, 0, 2, 0);
 		current += acpi_create_dmar_ds_pci(current, 0, 2, 1);
 		acpi_dmar_drhd_fixup(tmp, current);

-- 
To view, visit https://review.coreboot.org/29668
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I391d0a5f1ea14bc90fbacabce41dddfa12b5bb0d
Gerrit-Change-Number: 29668
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181117/3424cecc/attachment.html>


More information about the coreboot-gerrit mailing list