git: b563be66998d - main - dmar_qi_emit(): use atomic_store_64() when available
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Sep 2024 21:50:43 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b563be66998ddd9dbc83364c8b515398d984c140 commit b563be66998ddd9dbc83364c8b515398d984c140 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-06-06 03:21:31 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-09-04 21:50:18 +0000 dmar_qi_emit(): use atomic_store_64() when available Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/iommu/intel_qi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/x86/iommu/intel_qi.c b/sys/x86/iommu/intel_qi.c index b474d695552f..8b5cfe3c0205 100644 --- a/sys/x86/iommu/intel_qi.c +++ b/sys/x86/iommu/intel_qi.c @@ -139,15 +139,25 @@ dmar_qi_emit(struct dmar_unit *unit, uint64_t data1, uint64_t data2) { DMAR_ASSERT_LOCKED(unit); +#ifdef __LP64__ + atomic_store_64((uint64_t *)(unit->x86c.inv_queue + + unit->x86c.inv_queue_tail), data1); +#else *(volatile uint64_t *)(unit->x86c.inv_queue + unit->x86c.inv_queue_tail) = data1; +#endif unit->x86c.inv_queue_tail += DMAR_IQ_DESCR_SZ / 2; KASSERT(unit->x86c.inv_queue_tail <= unit->x86c.inv_queue_size, ("tail overflow 0x%x 0x%jx", unit->x86c.inv_queue_tail, (uintmax_t)unit->x86c.inv_queue_size)); unit->x86c.inv_queue_tail &= unit->x86c.inv_queue_size - 1; +#ifdef __LP64__ + atomic_store_64((uint64_t *)(unit->x86c.inv_queue + + unit->x86c.inv_queue_tail), data2); +#else *(volatile uint64_t *)(unit->x86c.inv_queue + unit->x86c.inv_queue_tail) = data2; +#endif unit->x86c.inv_queue_tail += DMAR_IQ_DESCR_SZ / 2; KASSERT(unit->x86c.inv_queue_tail <= unit->x86c.inv_queue_size, ("tail overflow 0x%x 0x%jx", unit->x86c.inv_queue_tail,