From nobody Thu Aug 6 07:10:50 2026 X-Original-To: dev-commits-src-branches@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 4hFz2f4v2tz6p0S8 for ; Thu, 06 Aug 2026 07:10:50 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hFz2f3vstz49t5 for ; Thu, 06 Aug 2026 07:10:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786000250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ufXcv3drNzztwkIsrrSJJzgQbRljhgVTigJxbESyymE=; b=kXM6cNdQ4YXheawSJfCl7zV2mKU+MxYYT7Wejz8JkJTK1wv+LxA8eYdZE3/7T3pt6DXb4k Yc39vB8M3tRwd8Csl4Yxxz9TloGkmMnOEAgEJMLJ4vcEoV7m2MXAbC0Mppz9U7lTr8iJIr 7Rve2WxVBiR3TpDAWpQBTadoAK1M9zA/PjqNdfYUNfETZcKKd+DELGKxkOVqD264KqPH7U +JiaIE+pZCukvbhhxQJWRffXu5pEjBu7hXQLhGL123oIU9+iuZ4KluKOhxdIsPw5F1Hu0p BqTMVGualDJaGByemjZ9+Eo/ugMAw0R4h2rlRRzaubIwR94ukKg+BXciaxQD7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786000250; a=rsa-sha256; cv=none; b=nD3vujsHqnDg0s+OAlb/zoTZjJgAMrmFa0UxXJZuwqOTGQnlbbPkoWL+GPrJsQTUp3Vzxv oxGtd5Xv+cksbJ5j4NORzTwFPmQ2wNMMUWP1UVozUvO/JyF6qzxbYeTHH6fVTAMnVOrHLp eIw3yQxNSpMAEB7F7eXs4OGOdrl5+EPXy2j7ovuPJgTCbjViwvfkAouWcrKmy7qF8SksI5 mrKPqsbYiRBcZF1bZSHxbzMS7EXn3suUhl2FAdfgXisg7pwjEDKzzzfo3NZ4qgE/waDqVa uZkW6wK9TGjEQDIlk0kOFed+VuJ5inWNWVgbc97fc86ZLMotyS6VeEBdPkxN8Q== 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=1786000250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ufXcv3drNzztwkIsrrSJJzgQbRljhgVTigJxbESyymE=; b=rgMfqWZ/KxSIUDU8IlbfXZjTQbgFLsCX/+SNuC3VDI4584HKychGDinxu0GzcqO3bRvdNq H9dpMClFCmS6ea2Fufjvb9SzUdQsofuizS2EITfUTl/rsjosactQ0shoupNk/jkHGEyGFa +P90If76TBbc9i+EqrTH4DEnZ8rTpVbiu1kvxdfIYp7SQzzDBbJw/8Z+4pNXcw3ILhydIv gt2raD1QwenjXqB+hxLKcYlyYRaxDwwrwTaT0wDwmUi2sUkwYMdSblVgJlGyoU6dLJ3jrK qYKUn9XqJEPJEyJu6WfHeXR/3pcPHRyYkhvAFXJfCWWxKxXhH79Cp2zHLDtnIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hFz2f2t63z18hR for ; Thu, 06 Aug 2026 07:10:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35eab by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 06 Aug 2026 07:10:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Timo =?utf-8?Q?V=C3=B6lker?= From: Michael Tuexen Subject: git: b1afe190d766 - stable/14 - virtio_pci_modern: Remove endianness conversion for config space List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b1afe190d7668d7c89eb6c350d03692a9b241088 Auto-Submitted: auto-generated Date: Thu, 06 Aug 2026 07:10:50 +0000 Message-Id: <6a74337a.35eab.79d5e1ed@gitrepo.freebsd.org> The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b1afe190d7668d7c89eb6c350d03692a9b241088 commit b1afe190d7668d7c89eb6c350d03692a9b241088 Author: Timo Völker AuthorDate: 2026-06-28 10:39:10 +0000 Commit: Michael Tuexen CommitDate: 2026-08-06 05:09:02 +0000 virtio_pci_modern: Remove endianness conversion for config space The bus_* functions already handle converting from PCI endianness (i.e. little-endian) to native endianness when accessing the config space (see ofw_pcib_bus_get_bus_tag), so converting again with virtio_htogX/virtio_gtohX undoes any byte-swapping and breaks big-endian systems. They should only be used for operating on shared memory. Note part of this reverts commit fb53b42e36a9 ("virtio-modern: fix PCI common read/write functions on big endian targets"). PR: 294706 Reviewed by: adrian, tuexen Fixes: fb53b42e36a9 ("virtio-modern: fix PCI common read/write functions on big endian targets") Fixes: 9da9560c4dd3 ("virtio: Add VirtIO PCI modern (V1) support") Differential Revision: https://reviews.freebsd.org/D57392 (cherry picked from commit 07b5d1ca52b113cecad3cda73ff5e782d8f4d07d) --- sys/dev/virtio/pci/virtio_pci_modern.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c index 2c54288aefba..d28c486deb9e 100644 --- a/sys/dev/virtio/pci/virtio_pci_modern.c +++ b/sys/dev/virtio/pci/virtio_pci_modern.c @@ -666,16 +666,13 @@ vtpci_modern_read_dev_config(device_t dev, bus_size_t offset, void *dst, *(uint8_t *) dst = vtpci_modern_read_device_1(sc, offset); break; case 2: - *(uint16_t *) dst = virtio_htog16(true, - vtpci_modern_read_device_2(sc, offset)); + *(uint16_t *) dst = vtpci_modern_read_device_2(sc, offset); break; case 4: - *(uint32_t *) dst = virtio_htog32(true, - vtpci_modern_read_device_4(sc, offset)); + *(uint32_t *) dst = vtpci_modern_read_device_4(sc, offset); break; case 8: - *(uint64_t *) dst = virtio_htog64(true, - vtpci_modern_read_device_8(sc, offset)); + *(uint64_t *) dst = vtpci_modern_read_device_8(sc, offset); break; default: panic("%s: device %s invalid device read length %d offset %d", @@ -701,17 +698,17 @@ vtpci_modern_write_dev_config(device_t dev, bus_size_t offset, const void *src, vtpci_modern_write_device_1(sc, offset, *(const uint8_t *) src); break; case 2: { - uint16_t val = virtio_gtoh16(true, *(const uint16_t *) src); + uint16_t val = *(const uint16_t *) src; vtpci_modern_write_device_2(sc, offset, val); break; } case 4: { - uint32_t val = virtio_gtoh32(true, *(const uint32_t *) src); + uint32_t val = *(const uint32_t *) src; vtpci_modern_write_device_4(sc, offset, val); break; } case 8: { - uint64_t val = virtio_gtoh64(true, *(const uint64_t *) src); + uint64_t val = *(const uint64_t *) src; vtpci_modern_write_device_8(sc, offset, val); break; } @@ -1313,15 +1310,13 @@ vtpci_modern_read_common_1(struct vtpci_modern_softc *sc, bus_size_t off) static uint16_t vtpci_modern_read_common_2(struct vtpci_modern_softc *sc, bus_size_t off) { - return virtio_htog16(true, - bus_read_2(&sc->vtpci_common_res_map.vtrm_map, off)); + return bus_read_2(&sc->vtpci_common_res_map.vtrm_map, off); } static uint32_t vtpci_modern_read_common_4(struct vtpci_modern_softc *sc, bus_size_t off) { - return virtio_htog32(true, - bus_read_4(&sc->vtpci_common_res_map.vtrm_map, off)); + return bus_read_4(&sc->vtpci_common_res_map.vtrm_map, off); } static void @@ -1335,16 +1330,14 @@ static void vtpci_modern_write_common_2(struct vtpci_modern_softc *sc, bus_size_t off, uint16_t val) { - bus_write_2(&sc->vtpci_common_res_map.vtrm_map, - off, virtio_gtoh16(true, val)); + bus_write_2(&sc->vtpci_common_res_map.vtrm_map, off, val); } static void vtpci_modern_write_common_4(struct vtpci_modern_softc *sc, bus_size_t off, uint32_t val) { - bus_write_4(&sc->vtpci_common_res_map.vtrm_map, - off, virtio_gtoh32(true, val)); + bus_write_4(&sc->vtpci_common_res_map.vtrm_map, off, val); } static void