git: 24e38af60a63 - main - DMAR: add knob to disable RMRR entries installation into domains
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Dec 2023 01:28:51 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=24e38af60a637073b5164837959098acaa3d8daa commit 24e38af60a637073b5164837959098acaa3d8daa Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-12-23 16:57:19 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-12-26 01:28:22 +0000 DMAR: add knob to disable RMRR entries installation into domains Sponsored by: The FreeBSD Foundation MFC after: 1 week --- 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 76a53f6bbd1a..49c87cf0b39f 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -237,6 +237,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 c29508300b29..7346162d1502 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);