From nobody Tue Apr 01 22:56:31 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 4ZS3Jv5FV3z5sFRq; Tue, 01 Apr 2025 22:56:31 +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 4ZS3Jv30rtz3TcX; Tue, 01 Apr 2025 22:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743548191; 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=mHUizYajC0yQjvZSEiL5S6DfdH4UWKCJ1D0LLGPguII=; b=wY7ltH0Mzo5u1gTevlZnekWeh9OQujE+Wh7C4llXZSADvjyQXrvvvlrDJJkVCFIZTXiPrb S81LVW8n9NBzN1oCU89z2hroX+QI2mVGgHDl/lBIV+O9TYxAtboTlf4uCnd17wF+sAZz0M QzQXF2Af0Qi/5JRLXv1XBd3wH5pjeXTWgko6FiLtDBktbR1e6GYq9IfM+v4/Vitbu2tcrb P5SQnEuXuS4s7Mt9Vw7IcyO4rOVdhnBuXeJ2oNIGBJ7obIU8KXGjyybUY693lc9y+sA4wn E7AkAcTkylu+PK0z+dRffkESz0jZpe1scowkcIvW/YXYBmK+JihoFH9BKOPSUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743548191; a=rsa-sha256; cv=none; b=pg3n4r21zDaXcOP9BRf0Xnkgmv3eyChQYgRHGPdgaFU8ieS0Mt/1zU4XpsTIsKl6hdbyQt DzMA52ASNgAWGCYdKvi8PNTB6pz9mYb5HpW/Oypmi/jk0VRFdDHaz7go2v4uXmWo3Y94B2 5x2CXVBxC+9x+Legx11uSUlPdP5wE7+QfWbRyiVAKRD+rBoHfvUar1zQlKBzqcDpkHBXGc Wy7y4WTSJxcWBNj3MTNPpJkta0SGEiXGutgmb0HTZBNUo7vzYrIyYo5TjI/MtVQX5nd8/0 oZFzQPeKddPwykpKAHMRTu1DAIbW/4Xwv+1rkGySDC6SoblGTj5Jx5bAhBJIhQ== 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=1743548191; 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=mHUizYajC0yQjvZSEiL5S6DfdH4UWKCJ1D0LLGPguII=; b=KYZQDDwjqQg0VCR49XmIq6wIfVVw/4gp/39OWiJeP+w28fGhiOygiY5Rs7phhuUvkxgDpQ KT+Vqa1NLkg6cwB1mjMUFeBJ9GRDQfUauh4/SRt+ggCrd7oNaKv6X+ynWIwmWzQK1IZ/+S Yi8EWlOs23IHOD6vMIdUDHlIwdw9qEBaSuVXd+Ou9sb4tDefA2Yc1vr74M2xKXYcjxQBqo GL3Gj6OPyvRoUunGlLfLTgSfyQubA0PFWZKkrOvI6OvSwK+zPrL9h02GJyiEw1NgwIpzL8 g1QpGb58+/Esq/AxxsPgBhHxHaMJ/n/hsNpui/rvD49ljaNLdqGTURr+BXc7TA== 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 4ZS3Jv2X8Qzqv3; Tue, 01 Apr 2025 22:56:31 +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 531MuVfp029567; Tue, 1 Apr 2025 22:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 531MuVEn029564; Tue, 1 Apr 2025 22:56:31 GMT (envelope-from git) Date: Tue, 1 Apr 2025 22:56:31 GMT Message-Id: <202504012256.531MuVEn029564@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: 45f70f98fc55 - main - iommu_gas_map_region(): add comment explaining the ma array shift 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: 45f70f98fc55b753b1e7a7374b4a061aa1f27392 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45f70f98fc55b753b1e7a7374b4a061aa1f27392 commit 45f70f98fc55b753b1e7a7374b4a061aa1f27392 Author: Konstantin Belousov AuthorDate: 2025-01-25 09:37:50 +0000 Commit: Konstantin Belousov CommitDate: 2025-04-01 22:23:17 +0000 iommu_gas_map_region(): add comment explaining the ma array shift and the difference between start and entry->start values at this point. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/dev/iommu/iommu_gas.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index d97bdee47b28..ffa8dc096adc 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -875,6 +875,11 @@ iommu_gas_map_region(struct iommu_domain *domain, struct iommu_map_entry *entry, if (entry->end == entry->start) return (0); + /* + * iommu_gas_alloc_region() might clipped the entry start and + * end positions. Adjust the beginning of the ma array to map + * the pages at the requested relative positions. + */ error = domain->ops->map(domain, entry, ma + OFF_TO_IDX(start - entry->start), eflags, ((flags & IOMMU_MF_CANWAIT) != 0 ? IOMMU_PGF_WAITOK : 0));