Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 00:41:55 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: 43ccf1cf37b0 - stable/14 - DMAR: add knob to disable RMRR entries installation into domains
Message-ID:  <202401020041.4020ft2o096771@gitrepo.freebsd.org>

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

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

commit 43ccf1cf37b0629ff3bdabcfccf16865fbac4c8f
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:41:38 +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 90c883b28ea6..65ca88b052ed 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 1c428e60d96f..e20144094c80 100644
--- a/sys/x86/iommu/intel_dmar.h
+++ b/sys/x86/iommu/intel_dmar.h
@@ -319,6 +319,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 274ba566ad23..c4bb3a1745f4 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -156,6 +156,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)
@@ -170,6 +172,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;
@@ -905,6 +909,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);
 
@@ -991,6 +998,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?202401020041.4020ft2o096771>