From nobody Tue Jan 02 00:41:58 2024 X-Original-To: dev-commits-src-all@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 4T3vF26M3tz560B5; Tue, 2 Jan 2024 00:41:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T3vF25BfDz3Pwg; Tue, 2 Jan 2024 00:41:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704156118; 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=YbbQZAHidixKTW1WiRwn1h0fn9mOxGMOt6rB81anNGs=; b=tTWKdQxAkuXVT95UJhLZiqxXf5BsXFbDjg6TwDvmhwWv7mGe8Ex/qGW4ZWqZMSvkyKdO6o yvIdLqnAskANcEGA+5NS3XBhBDOPTSvPeq6F1VGA7MpH31ImQZuSJ1Hwya+TTQ2r8weWqc OdxpD3n5X+IRpnPqjKGyuVvdFl6AnhMgLKvrojQXINKrWAiiofsZPu64CwGEY67WNaH9aC UBZL53R1+JX7PfKGc+qpLmez0uuC5robOm4IXVNhAK0S2fnLP7sDWa+Np/n3RkEpdSWRCL ulLJZS+n4m7L2pQx5TBCIs5nzDElDWy4y/uCyBHpiZ8gO4oPmWi5C/Q0hWcWcg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704156118; a=rsa-sha256; cv=none; b=qEntJKi7TTxiz/wuTePqxPvNaVwm+NdsoUuoZGkVm7wPUOYhA+fUwRunCYt8SpL1Xro8sT PAQfpOfWw/KfWSVoBvYTybQh2mZc90YZHY/rs6ED5W1kKUq6qaXqfQ3V9hQWQNnp7XLjgR Y/5rsJJeH1ttmAEVNsJOUJ1m2tsjq25PJr3VG6H7eQjGze5exukN4F8RXzJDHxYdki1QL3 dQruP4t1NKe9j+QodO7j5t7cm02BlfcsujDMDTca6+fLLtgpeEhElvnFzyWGlptVWG3zFQ Kd7UmFDGFuFVfB9MFILSszZW6fVggvaO6q9Da1ADJQQp+SItALpIvpQF3MC0ug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704156118; 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=YbbQZAHidixKTW1WiRwn1h0fn9mOxGMOt6rB81anNGs=; b=NuTrBFdlXDlc9XP4M86i40ODGjAznU6QoPPbHK6tPeyjoMrw0IuW4PXvodAJsDYKEIC5jv RUtgO9BSiwWEZbwB9TjLVnc85sq37UJvlg/9AmRMR0MMQDDTCORm5c/s5eO0dc94pxR3qi UCPldeyC41l16vfhVz3CkRl3RBlhqf9fsFrtOYHOi/tHMGDix6MDeeQZwA5OXnlHaTj65I MrZ+Bww8SkBBuEMNyKko498uDn+/K2IKwi4a5orgiNKZM9hXdZxEWkuKph27cnZ0K/wACR xau6rPCs5qfBJBmtBo/hncOxotiCoXvk1k0PhW2vd3yxIUxMgSRsvdGUv1k9Gg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T3vF24Jsnzfw7; Tue, 2 Jan 2024 00:41:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4020fwic096941; Tue, 2 Jan 2024 00:41:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4020fw9u096938; Tue, 2 Jan 2024 00:41:58 GMT (envelope-from git) Date: Tue, 2 Jan 2024 00:41:58 GMT Message-Id: <202401020041.4020fw9u096938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5dcf0d72f645 - stable/14 - IOMMU: add GAS map entry flag IOMMU_MAP_ENTRY_FAKE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5dcf0d72f645bee142d28cbdc213cfc1458bc306 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5dcf0d72f645bee142d28cbdc213cfc1458bc306 commit 5dcf0d72f645bee142d28cbdc213cfc1458bc306 Author: Konstantin Belousov AuthorDate: 2023-12-22 22:39:27 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-02 00:41:39 +0000 IOMMU: add GAS map entry flag IOMMU_MAP_ENTRY_FAKE (cherry picked from commit a59c252903e81f46c74903ce5b1cf0960927dbcc) --- sys/dev/iommu/iommu_gas.c | 6 +++++- sys/dev/iommu/iommu_gas.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index e178acf60478..dc850747512a 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -123,7 +123,8 @@ iommu_gas_cmp_entries(struct iommu_map_entry *a, struct iommu_map_entry *b) a, (uintmax_t)a->start, (uintmax_t)a->end)); KASSERT(b->start <= b->end, ("inverted entry %p (%jx, %jx)", b, (uintmax_t)b->start, (uintmax_t)b->end)); - KASSERT(a->end <= b->start || b->end <= a->start || + KASSERT(((a->flags | b->flags) & IOMMU_MAP_ENTRY_FAKE) != 0 || + a->end <= b->start || b->end <= a->start || a->end == a->start || b->end == b->start, ("overlapping entries %p (%jx, %jx) f %#x %p (%jx, %jx) f %#x" " domain %p %p", @@ -536,11 +537,13 @@ iommu_gas_alloc_region(struct iommu_domain *domain, struct iommu_map_entry *entr if (entry->end >= domain->end) return (EINVAL); + entry->flags |= IOMMU_MAP_ENTRY_FAKE; next = RB_NFIND(iommu_gas_entries_tree, &domain->rb_root, entry); KASSERT(next != NULL, ("next must be non-null %p %jx", domain, (uintmax_t)entry->start)); prev = RB_PREV(iommu_gas_entries_tree, &domain->rb_root, next); /* prev could be NULL */ + entry->flags &= ~IOMMU_MAP_ENTRY_FAKE; /* * Adapt to broken BIOSes which specify overlapping RMRR @@ -658,6 +661,7 @@ iommu_gas_remove_clip_left(struct iommu_domain *domain, iommu_gaddr_t start, bzero(&fentry, sizeof(fentry)); fentry.start = start + 1; fentry.end = start + 1; + fentry.flags = IOMMU_MAP_ENTRY_FAKE; entry = RB_NFIND(iommu_gas_entries_tree, &domain->rb_root, &fentry); if (entry->start >= start || diff --git a/sys/dev/iommu/iommu_gas.h b/sys/dev/iommu/iommu_gas.h index 8069c5a15a34..cdc4bd22d60c 100644 --- a/sys/dev/iommu/iommu_gas.h +++ b/sys/dev/iommu/iommu_gas.h @@ -50,6 +50,7 @@ #define IOMMU_MAP_ENTRY_UNMAPPED 0x0010 /* No backing pages */ #define IOMMU_MAP_ENTRY_REMOVING 0x0020 /* In process of removal by iommu_gas_remove() */ +#define IOMMU_MAP_ENTRY_FAKE 0x0040 /* disable assert in cmp() */ #define IOMMU_MAP_ENTRY_READ 0x1000 /* Read permitted */ #define IOMMU_MAP_ENTRY_WRITE 0x2000 /* Write permitted */ #define IOMMU_MAP_ENTRY_SNOOP 0x4000 /* Snoop */