Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 00:42:39 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d4a04574875c - stable/13 - DMAR: add knob to disable RMRR entries installation into domains
Message-ID:  <202401020042.4020gdXb003952@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=d4a04574875cbbdb8bf2600b4618cd02b781e833

commit d4a04574875cbbdb8bf2600b4618cd02b781e833
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-12-23 16:57:19 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-02 00:42:13 +0000

    DMAR: add knob to disable RMRR entries installation into domains
    
    (cherry picked from commit 24e38af60a637073b5164837959098acaa3d8daa)
---
 sys/x86/iommu/intel_ctx.c  |  3 +++
 sys/x86/iommu/intel_dmar.h |  1 +
 sys/x86/iommu/intel_drv.c  | 10 ++++++++++
 3 files changed, 14 insertions(+)

diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c
index fd17933f9556..8ea4ece26073 100644
--- a/sys/x86/iommu/intel_ctx.c
+++ b/sys/x86/iommu/intel_ctx.c
@@ -239,6 +239,9 @@ domain_init_rmrr(struct dmar_domain *domain, device_t dev, int bus,
 	vm_pindex_t size, i;
 	int error, error1;
 
+	if (!dmar_rmrr_enable)
+		return (0);
+
 	error = 0;
 	TAILQ_INIT(&rmrr_entries);
 	dmar_dev_parse_rmrr(domain, dev_domain, dev_busno, dev_path,
diff --git a/sys/x86/iommu/intel_dmar.h b/sys/x86/iommu/intel_dmar.h
index b38407e6fdc9..8343bf1e9f9b 100644
--- a/sys/x86/iommu/intel_dmar.h
+++ b/sys/x86/iommu/intel_dmar.h
@@ -318,6 +318,7 @@ extern iommu_haddr_t dmar_high;
 extern int haw;
 extern int dmar_tbl_pagecnt;
 extern int dmar_batch_coalesce;
+extern int dmar_rmrr_enable;
 
 static inline uint32_t
 dmar_read4(const struct dmar_unit *unit, int reg)
diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c
index b48993fc7969..4205b08cab4f 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -157,6 +157,8 @@ dmar_count_iter(ACPI_DMAR_HEADER *dmarh, void *arg)
 	return (1);
 }
 
+int dmar_rmrr_enable = 1;
+
 static int dmar_enable = 0;
 static void
 dmar_identify(driver_t *driver, device_t parent)
@@ -171,6 +173,8 @@ dmar_identify(driver_t *driver, device_t parent)
 	TUNABLE_INT_FETCH("hw.dmar.enable", &dmar_enable);
 	if (!dmar_enable)
 		return;
+	TUNABLE_INT_FETCH("hw.dmar.rmrr_enable", &dmar_rmrr_enable);
+
 	status = AcpiGetTable(ACPI_SIG_DMAR, 1, (ACPI_TABLE_HEADER **)&dmartbl);
 	if (ACPI_FAILURE(status))
 		return;
@@ -895,6 +899,9 @@ dmar_rmrr_iter(ACPI_DMAR_HEADER *dmarh, void *arg)
 	char *ptr, *ptrend;
 	int match;
 
+	if (!dmar_rmrr_enable)
+		return (1);
+
 	if (dmarh->Type != ACPI_DMAR_TYPE_RESERVED_MEMORY)
 		return (1);
 
@@ -981,6 +988,9 @@ dmar_inst_rmrr_iter(ACPI_DMAR_HEADER *dmarh, void *arg)
 
 	iria = arg;
 
+	if (!dmar_rmrr_enable)
+		return (1);
+
 	if (dmarh->Type != ACPI_DMAR_TYPE_RESERVED_MEMORY)
 		return (1);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401020042.4020gdXb003952>