From nobody Mon Sep 21 15:26:11 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hpRrz6Dn4z6slkW for ; Mon, 21 Sep 2026 15:26:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hpRrz3WHYz4b0w for ; Mon, 21 Sep 2026 15:26:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790004371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GAadZs2C8VNbx6wDf1BpwzlkoSp6Jj+IWMErzqR/aso=; b=ENUii7eldbkxrJEq3ZYrKzHAcnwrVhsA63qkEannZYFHk6bHbArpD/IwR+BjrqTQ1P4Jwv B92s36SkZHVyb+nWQVQ86i4lDimvTDDuE7TS/IzXfdzByyf00aRlGhCc+DCD4izIhD0pYi /RQZNU4eJiPVHYJLThTdjV5l18G07zVLfqhxEcBn4d9+ZVaNB6sdfsk1q8m0o7Rx2627XY DTAYmWRWCXX4GBA1fZ90M+Fza01/PrDcekzeZ9iokSbOMZ4MGQ7oM6dcbpn+ZcSXuG8mvm bKe/Kdim8a/P9rEJ2SjKUrZnYv5+So/Dk4lgE+plvgzeqTyRanmThOS9eMCGYA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790004371; b=YL1S+gYlkQxO00LaEtRER88296FPwmvbxBesgtFW3z5ImDA2zodh31HWi6QMdb7kJE1qS7 CXF/OCLd446wXzGn0f2tHBN/9r2TnUddDlZbe4uehd0zbE2eW0dGUScFwIl4ROZXscLmH7 tImw3C5KvMFoACoEliYiBeqof3uhSM+sDwlc6pFn8UaO+FvlTKDxevyrJwKrvhrVLn90on b5d5A+UjMKsQl750wCK7aPImBcPbkALvWao2zmOu8SI5GL/v59X/YI03KIUMlkX6lWP47d zAerA9aAU12TF7kbxXvxDK9l41qa7jAKzZJoENSBpr7YTr9yUNdvvLxNoSESbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790004371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GAadZs2C8VNbx6wDf1BpwzlkoSp6Jj+IWMErzqR/aso=; b=LvtT2ok0d4Hm2iyT8Aevm4f4K0nVQ3JSfgRwXDzu2AWU9T7FucPyuCMUMXEhEWF+f3lH3R W7xSMp7l3d5RrmGIA23BEP/fEjfaIIrOcYgDxTHqd59qloZmkgRY7bDiMIMDgxXyDrLqUV O1GzwhZXLX5kgK77cCRd0WBteDs8enGcfs9BDT6r0qETIAG/3AzlaMU6sbt/h9+sP8fpJ1 n8bB6YDYAXv2ItQamIihU07P3lK+QlttkfgdEJv9JMAd0eVodPnJRXid6ZDY25crY4deTX XTtGTuIcaOk4JtLvPdqraRQHRnpLbDogw/e5k5JQD2leMYeZEpWmQQu39kcr7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hpRrz2WGBzPNg for ; Mon, 21 Sep 2026 15:26:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 304db by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 21 Sep 2026 15:26:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 50e01b6351b1 - main - arm64/smmu: Only MSI poll when cache-coherent List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50e01b6351b1a4955814cce021852c65a5b5bb9f Auto-Submitted: auto-generated Date: Mon, 21 Sep 2026 15:26:11 +0000 Message-Id: <6ab14c93.304db.37544c3a@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=50e01b6351b1a4955814cce021852c65a5b5bb9f commit 50e01b6351b1a4955814cce021852c65a5b5bb9f Author: Andrew Turner AuthorDate: 2026-09-18 11:29:19 +0000 Commit: Andrew Turner CommitDate: 2026-09-18 11:29:19 +0000 arm64/smmu: Only MSI poll when cache-coherent Only use the MSI polling method when we support MSIs and the SMMU is cache-coherent. The SMMU writes to a memory location. If it is not cache-coherent then the CPU may read the existing value in its cache and miss the signal the sync operation has completed. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59489 --- sys/arm64/iommu/smmu.c | 12 ++++++++---- sys/arm64/iommu/smmu_fdt.c | 2 ++ sys/arm64/iommu/smmuvar.h | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c index 930c97a8aeb3..2b95d2f5fb3c 100644 --- a/sys/arm64/iommu/smmu.c +++ b/sys/arm64/iommu/smmu.c @@ -623,20 +623,23 @@ smmu_sync(struct smmu_softc *sc) struct smmu_cmdq_entry cmd; struct smmu_queue *q; int prod; + bool msipoll; q = &sc->cmdq; prod = q->lc.prod; + msipoll = ((sc->options & SMMU_OPT_MSIPOLL) != 0); + /* Enqueue sync command. */ memset(&cmd, 0, sizeof(cmd)); cmd.opcode = CMD_SYNC; - if ((sc->features & SMMU_FEATURE_MSI) != 0) { + if (msipoll) { cmd.sync.msiaddr = q->paddr + Q_IDX(q, prod) * CMDQ_ENTRY_DWORDS * 8; } smmu_cmdq_enqueue_cmd(sc, &cmd); - if ((sc->features & SMMU_FEATURE_MSI) != 0) + if (msipoll) smmu_sync_wait_msi(sc, q); else smmu_sync_wait_poll(sc, q); @@ -1356,8 +1359,6 @@ smmu_check_features(struct smmu_softc *sc) uint32_t reg; uint32_t val; - sc->features = 0; - reg = bus_read_4(sc->res[0], SMMU_IDR0); if (reg & IDR0_ST_LVL_2) { @@ -1404,6 +1405,9 @@ smmu_check_features(struct smmu_softc *sc) if (bootverbose) device_printf(sc->dev, "MSI feature present.\n"); sc->features |= SMMU_FEATURE_MSI; + /* Support polling if we support MSI & are cache-coherent */ + if ((sc->features & SMMU_FEATURE_COHERENCY) != 0) + sc->options |= SMMU_OPT_MSIPOLL; } if (reg & IDR0_HYP) { diff --git a/sys/arm64/iommu/smmu_fdt.c b/sys/arm64/iommu/smmu_fdt.c index 31105054ddb2..0bd512a47d6f 100644 --- a/sys/arm64/iommu/smmu_fdt.c +++ b/sys/arm64/iommu/smmu_fdt.c @@ -87,6 +87,8 @@ smmu_fdt_attach(device_t dev) sc->dev = dev; node = ofw_bus_get_node(dev); + if (OF_hasprop(node, "dma-coherent")) + sc->features |= SMMU_FEATURE_COHERENCY; rid = 0; sc->res[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, diff --git a/sys/arm64/iommu/smmuvar.h b/sys/arm64/iommu/smmuvar.h index 60fad8f87531..e517e3e88ac1 100644 --- a/sys/arm64/iommu/smmuvar.h +++ b/sys/arm64/iommu/smmuvar.h @@ -160,6 +160,10 @@ struct smmu_softc { #define SMMU_FEATURE_VAX (1 << 13) #define SMMU_FEATURE_COHERENCY (1 << 14) #define SMMU_FEATURE_RANGE_INV (1 << 15) + + uint32_t options; +#define SMMU_OPT_MSIPOLL (1 << 0) + struct smmu_queue cmdq; struct smmu_queue evtq; struct smmu_queue priq;