From nobody Tue Jan 02 00:42:00 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 4T3vF52s0qz55yx3; Tue, 2 Jan 2024 00:42:01 +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 4T3vF50fHZz3Prt; Tue, 2 Jan 2024 00:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704156121; 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=K4Ln4hN3++fDD5Up+AEO+Pbw3wgJVeS2Pxs8/vZC3II=; b=G31Zedzk0ODmG/W3h5k4PEbJeLazz0i6HqVohZ1Zs8CjgxLpHuGRthbb2EbbnO4028GrnI 2pdFbtxczUM6iUiOzypaQZGDED/tPLTSZxbfTlEIh1inEI5LTYj1eXb4Y2C8FL2ljZPDGL vNcwXUAi+kb2gU7+RggABso8ljfIqZte37CBrLhTFoU6cyblDf8J4wJ1EHUBnIqh77rJR3 n/hLcIXk6pyZ4piWnOtJpKuOEFIsdGArAcPm1923uEpEPRZM7lMT0t3Kx8PSVnHeBdSZkJ XXCoBXIGuuWLUb+vKyUHYoT/FtfRCYqkTGQ5WJ10dPRpgllKqG/u7g0e0Rg5tQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704156121; a=rsa-sha256; cv=none; b=fGacTgi71ZN+2fp8GTwb0WBBM2J8e/V8U2iTKQOijbVEoLFwFa/5eamebLk/Puwly4Qa6/ 53ylNC2tJkyo6Ma7aY8hMo5RWZKKoXR23FEnpuM6PW8ekUpBwaj/n+VvEGxuccMxA/SmTV ZOnm/YV+b2re2lahZUxGAGut9uC8KNBnRv8Y476XbHM+KOkACzOVPpSFxICci9wQ5OCF/r wbwHXN5ELeCqJUIgi+OnDVODSUsfPXBKWLzxw1Pds1HNN6wv7DSgAJ6XP/JvDglO+mQdoO DgdN4SmD0y73+anb/r4M64kUIcLIwN0H8kLwtQogloFQFWUMgAxfcb6l0Hs5+A== 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=1704156121; 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=K4Ln4hN3++fDD5Up+AEO+Pbw3wgJVeS2Pxs8/vZC3II=; b=E2QoKNpMh1UI4IW2e+DylGPitqLiu6XwiEzVK4EMEvKyId8X1C3G8mu/HD0JsIL7rn83Jb EXDwnv2HxtdHui4+SeJRb362S45BZh/2ymqkAzgBUQyZ3oaApTMefOxdJDeJC8PbrNd8hg OKeeChFkDihKzG1/drmB/nJ3/70ioMmU5jucGtZQO4NVo9v8ajLSeqVK3ttuW0Hrq/cu/T h1ILwjJesNrwH6tlC2uH4l6QFwcGyg7/E0pC/3qYcoTtdWtJbRhLAS0OMISNWs9wFxeRSU 61hjtVjfR6B+f1FaT12r+L4TRuz8kzJ+N/3DSrI23+sPwqP50BEz7dFK27Yeeg== 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 4T3vF467nlzfnJ; Tue, 2 Jan 2024 00:42:00 +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 4020g0jm097050; Tue, 2 Jan 2024 00:42:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4020g0aJ097047; Tue, 2 Jan 2024 00:42:00 GMT (envelope-from git) Date: Tue, 2 Jan 2024 00:42:00 GMT Message-Id: <202401020042.4020g0aJ097047@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: 8019d103e020 - stable/14 - iommu_gas: make placeholder entry at the start of the GAS zero size 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: 8019d103e020a5aa100d7a652739d733f8c2c2eb Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8019d103e020a5aa100d7a652739d733f8c2c2eb commit 8019d103e020a5aa100d7a652739d733f8c2c2eb Author: Konstantin Belousov AuthorDate: 2023-12-22 22:19:05 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-02 00:41:39 +0000 iommu_gas: make placeholder entry at the start of the GAS zero size (cherry picked from commit f59128775636846574e092c68e849a56f74577e6) --- sys/dev/iommu/iommu_gas.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 9a74854f926f..cfd375c658c3 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -118,7 +118,7 @@ static int iommu_gas_cmp_entries(struct iommu_map_entry *a, struct iommu_map_entry *b) { - /* Last entry have zero size, so <= */ + /* First and last entries have zero size, so <= */ KASSERT(a->start <= a->end, ("inverted entry %p (%jx, %jx)", a, (uintmax_t)a->start, (uintmax_t)a->end)); KASSERT(b->start <= b->end, ("inverted entry %p (%jx, %jx)", @@ -244,25 +244,17 @@ iommu_gas_init_domain(struct iommu_domain *domain) KASSERT(RB_EMPTY(&domain->rb_root), ("non-empty entries %p", domain)); - /* - * The end entry must be inserted first because it has a zero-length gap - * between start and end. Initially, all augmentation data for a new - * entry is zero. Function iommu_gas_augment_entry will compute no - * change in the value of (start-end) and no change in the value of - * free_down, so it will return false to suggest that nothing changed in - * the entry. Thus, inserting the end entry second prevents - * augmentation information to be propogated to the begin entry at the - * tree root. So it is inserted first. - */ end->start = domain->end; end->end = domain->end; end->flags = IOMMU_MAP_ENTRY_PLACE | IOMMU_MAP_ENTRY_UNMAPPED; RB_INSERT(iommu_gas_entries_tree, &domain->rb_root, end); begin->start = 0; - begin->end = IOMMU_PAGE_SIZE; + begin->end = 0; begin->flags = IOMMU_MAP_ENTRY_PLACE | IOMMU_MAP_ENTRY_UNMAPPED; RB_INSERT_PREV(iommu_gas_entries_tree, &domain->rb_root, end, begin); + iommu_gas_augment_entry(end); + iommu_gas_augment_entry(begin); domain->start_gap = begin; domain->first_place = begin; @@ -739,7 +731,8 @@ iommu_gas_remove_locked(struct iommu_domain *domain, #ifdef INVARIANTS RB_FOREACH(entry, iommu_gas_entries_tree, &domain->rb_root) { - if ((entry->flags & IOMMU_MAP_ENTRY_RMRR) != 0) + if ((entry->flags & (IOMMU_MAP_ENTRY_RMRR | + IOMMU_MAP_ENTRY_PLACE)) != 0) continue; KASSERT(entry->end <= start || entry->start >= end, ("iommu_gas_remove leftover entry (%#jx, %#jx) range "