git: 512bb0da518b - main - x86/dmar: add dmar_is_running()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Apr 2025 23:07:13 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=512bb0da518be1dff3f937b7f653c6d3deb4b071
commit 512bb0da518be1dff3f937b7f653c6d3deb4b071
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-12-14 02:06:04 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-04-01 23:01:34 +0000
x86/dmar: add dmar_is_running()
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/x86/iommu/intel_dmar.h | 2 ++
sys/x86/iommu/intel_drv.c | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/sys/x86/iommu/intel_dmar.h b/sys/x86/iommu/intel_dmar.h
index 57a66aae69b2..018501082dd2 100644
--- a/sys/x86/iommu/intel_dmar.h
+++ b/sys/x86/iommu/intel_dmar.h
@@ -263,6 +263,8 @@ int dmar_map_ioapic_intr(u_int ioapic_id, u_int cpu, u_int vector, bool edge,
bool activehi, int irq, u_int *cookie, uint32_t *hi, uint32_t *lo);
int dmar_unmap_ioapic_intr(u_int ioapic_id, u_int *cookie);
+int dmar_is_running(void);
+
extern int haw;
extern int dmar_rmrr_enable;
diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c
index dd2a3d1a631f..28db14bba95b 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -86,6 +86,7 @@
static device_t *dmar_devs;
static int dmar_devcnt;
+static bool dmar_running = false;
typedef int (*dmar_iter_t)(ACPI_DMAR_HEADER *, void *);
@@ -539,6 +540,7 @@ dmar_attach(device_t dev)
DMAR_UNLOCK(unit);
#endif
+ dmar_running = true;
return (0);
}
@@ -1055,6 +1057,13 @@ dmar_inst_rmrr_iter(ACPI_DMAR_HEADER *dmarh, void *arg)
}
+int
+dmar_is_running(void)
+{
+
+ return (dmar_running ? 0 : ENXIO);
+}
+
/*
* Pre-create all contexts for the DMAR which have RMRR entries.
*/