From nobody Wed Apr 09 12:20:14 2025 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 4ZXhq26BFMz5sylS; Wed, 09 Apr 2025 12:20:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZXhq24jVqz3nq4; Wed, 09 Apr 2025 12:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744201214; 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=cT+cPi+tjqM/rXlVDM9c3eLuaGzUH4GT/EflFRe2O3c=; b=kewFf1aQrOQAo6iN/xIqysDvYYo/R1tusrzQ9RN/6dBGpYSmA/Qy1EpmrvbKBy78Vq8eVd PHRr4swFQcg1wrLzAddLdgkTn27hPRp2xkcHn1Bk3GlNeNfaYExmrPjp0CSEH8T+0VEDIw IJp0N5uZ9GsC6SuBW4d/esPWb1woaYKvU8osr5Oy58I4LgT0uyUAPogUicnt3SYbQ3cCOL d3KqNJtuJpzArXHQOWZo9EChrmXoRwUrm1vl9owo7I5lDStC67wq8lr0BEox871+sSgi+d aZ8NQ464SKVK4nmtCXz333HC2RbvBFE4GEzbTdO1xmIh2O4pF2iJ3EObIp1tVw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744201214; a=rsa-sha256; cv=none; b=OFri/2/t71l+4s6eJktbnE2xqEfjwOzbM0xqsBnhdSkvAlH/jed6HYqUe8SEOzd0e1EUOz 4CFP/dn2E2dOj8ZHxHNlLsoh0usweF34vT24C7xvdD2axA1QIvzEy5HSt5B5P1zd89hNGg 7HGNOCAi1vsEmbVOuMM+zJiXvHLhnuFRYXNV6/TZEqYve4+etJqxSy5IXZhUtnIevO67d1 3v++G3wvtAJJTY/QLBbq/B06mOhjQtLVmbgmOR06GFDaeVx+9d+vPAHhFR4+vUMF6glwy5 iHsOnmPeQfbBrroZFxJJp9nfUo3xOZZBU50X6+KnhCpdWWAXT8/9ADuJ7WtRvg== 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=1744201214; 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=cT+cPi+tjqM/rXlVDM9c3eLuaGzUH4GT/EflFRe2O3c=; b=pzkYcJTkH7tQRtR/yh1XwuV1orzEfn+8OqVREwxCtro4ZWBejy277ZXVaWV2z+mywboOnE EyiEdnD1S6a6Al0XAQXIrJkrlbyKFfC8Lz0EQWPChYBFN7KtQ9Mpo7vOqQJDZUORbIdORv 9LVkXv7Q5y4uKVpXr1JDiWTwaUGjCEFfptAGNGepb7MUK96WtwKmmdnQ5yf5NqPdRoFB+E wCBJJ6WTm5Isixpd5DqWXejF7aLks/piXT7L+1scYY9CRerYRFbBgPFrZBgqV5u1iX5v4u wfMcJ3FFu+6jjDdX5htqO9SAHIuJVFDFd0JAdsqOoa6VoE04vfngs94R1YUVhw== 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 4ZXhq23kdYz1yj; Wed, 09 Apr 2025 12:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 539CKEUj068694; Wed, 9 Apr 2025 12:20:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 539CKEZL068688; Wed, 9 Apr 2025 12:20:14 GMT (envelope-from git) Date: Wed, 9 Apr 2025 12:20:14 GMT Message-Id: <202504091220.539CKEZL068688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 42e4938fdbf8 - main - vm_assign_pptdev: only call vm_iommu_map() once 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 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/main X-Git-Reftype: branch X-Git-Commit: 42e4938fdbf8e2b5180e0d6aeb0075c589cf3bca Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42e4938fdbf8e2b5180e0d6aeb0075c589cf3bca commit 42e4938fdbf8e2b5180e0d6aeb0075c589cf3bca Author: Konstantin Belousov AuthorDate: 2025-04-09 11:20:30 +0000 Commit: Konstantin Belousov CommitDate: 2025-04-09 12:20:08 +0000 vm_assign_pptdev: only call vm_iommu_map() once for the first assigned pass-through device. PR: 285976 Sponsored by: The FreeBSD Foundation --- sys/amd64/vmm/vmm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index bd703f63b557..c42da02d0bf6 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -851,6 +851,7 @@ vm_assign_pptdev(struct vm *vm, int bus, int slot, int func) { int error; vm_paddr_t maxaddr; + bool map = false; /* Set up the IOMMU to do the 'gpa' to 'hpa' translation */ if (ppt_assigned_devices(vm) == 0) { @@ -860,12 +861,12 @@ vm_assign_pptdev(struct vm *vm, int bus, int slot, int func) vm->iommu = iommu_create_domain(maxaddr); if (vm->iommu == NULL) return (ENXIO); + map = true; } error = ppt_assign_device(vm, bus, slot, func); - if (error != 0) - return (error); - error = vm_iommu_map(vm); + if (error == 0 && map) + error = vm_iommu_map(vm); return (error); }