From nobody Tue May 26 05:21:13 2026 X-Original-To: freebsd-ppc@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 4gPh1g4ZC3z6fFgf for ; Tue, 26 May 2026 05:21:27 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPh1f4vpWz3d6k for ; Tue, 26 May 2026 05:21:26 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none); spf=pass (mx1.freebsd.org: domain of adrian.chadd@gmail.com designates 209.85.222.169 as permitted sender) smtp.mailfrom=adrian.chadd@gmail.com; arc=pass ("google.com:s=arc-20240605:i=1") Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-914cf9248ceso195754585a.1 for ; Mon, 25 May 2026 22:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779772885; cv=none; d=google.com; s=arc-20240605; b=KxmsclwCYWBp+EolJwpz5D07+vn+wgmleJ6cc4ek+yWs+GpwiBuDGAXDMlHodDX83A /XX6mp5Su8ZTOw6/5nZ7ePFa88d4PBXtY6epw9qWKwv1mgjqXT5B4TVNl7eHmvLFTf60 AiW8Tp186qWgHvcdaNgQqBidX2zC1UooHXUKcQhuGsq5BvlwVSASLzPrBwmUUtawaB3E 1NZ+RVw2RLQXE1Q4QuIiCJI3mq1GOxmwiRjzUB6JPijFbGnFQnGhQgjumvYRdvoyGASA qdghMqgi8zyczn55XwTf7GaPAExvhoL+43yLx1WKEsv1tdIkwbftgKMqErym2dtULydQ xauQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=3wVD5Z5TT4TzGXJ9dTRgDYGDUx/ekhGILSPpTy7ec9w=; fh=DACqDGF3nBOovDqRHb2deOzBWMdtXfWZlu8JD4YQr4s=; b=fmbnEPNXDuqC7+kCvxFBbg9EjRebL9KqZryL6LndKADNBBqPPQOQR1Gx1V0l1g97FF z0ytNP8ccpkhoRryVoRApIlhMby6Bg8Ce56JxsboyJtwcDKcNeJyZL9gFk9k1nIHI65m ++JMk7Q9qDMpAaIdxsHfn7Av4wgTey0MiN1ub2Fyg97+IARmrrHtmwrRJaHvmc/gASX8 emKT8Zu1wUK0woJ3/27J4M/ol4yWatfcPRTzxATfZpPBawAqTLG9s4uqFB6WQowhCkyD Z168jedAKtcqyqM2wYdxc3AjBRhT9jyWxrjoTVItmbwGxE3XXxlTqD1U0r3XVjFH7ssp 9oWw==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779772885; x=1780377685; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3wVD5Z5TT4TzGXJ9dTRgDYGDUx/ekhGILSPpTy7ec9w=; b=eu4S6YXK81dtkYxKx8IETSKf2zBF+BAgY+nDTI0b5a+0VlumSnYMdRsBRxw9ukU+wP qGdrCJrmY6dQC/g2L8M9jOCBKChhILbKT4HRdYyjZNqdSWqhB58nD4BXvIK2WrkOkNS0 6oMKiWAUsGh+ejIzvRsR6+mH4QiOTFK/7XTf0u4behiNhzW7cEjs3gWC/RGa4mnpbMLq oXUBH+Du6mU5Si8m1NETzQ/7TyDZemZvArRkGT5gL2yKpYuNOH0IvHz8bhwRxt5K5/sp 5N709SL983s9CP+QkDqYK2wRYA7F80FikxwXfjLxTDc/zU75Xo6pZjuAMeXwY3oJL61J tIhA== X-Gm-Message-State: AOJu0Ywg9Q9zv2LPp8igNPRVsEMiFgKPhzFfdkjy/0UwGGKev3yNIndW VxDB8kzzo3nGIiHKXHWQKfZNvB3TR8z5WWTnAnd3g/HD2wtT+g/B4vPldK08htwgnqzYRsruQK/ txYrgSLz8UoEbPntHRCVDZVRw52WeY1c= X-Gm-Gg: Acq92OFfnEcFzYs4h/TJb5tnXsiOSdptVGM+MDVwgM8MIpyB6MKb3OWKItJp5NR/hWI ZtyV0oQsBWAponpNN4qoQzhsng9V7sy3cURp9MNUngRghasn9TliIYXiqnmjUDhbdRT8dr2Wa/6 Ytr/13+z+eU610aLCczgEq1cTuhHYfFaiJ27nDg8EGlqGGcY5FIt4mG6LfUiadWOLUp2ft25ZAP Zzrk1CLvG7own8vXECA4bDoE0dHDoQ+0b9JxBkEgsBMppLjCHwPpAnLk0g32lE9CzBmdVY9VJxK lc4Nmz5RaV0wwc17sxNTcjP6saYs9w/2waUcg0vV4QvZVIp5u6sQBTHGyCNf+LomwKB5h73tvZA 7qDV5gR7gARVBZ8Y//kpq9gUL5EStMBrj4H/kPG78BPnYq4JJ/+q7NlRXUw== X-Received: by 2002:a05:620a:2b4d:b0:8f0:5793:ea80 with SMTP id af79cd13be357-914b4934533mr2617984185a.16.1779772885380; Mon, 25 May 2026 22:21:25 -0700 (PDT) List-Id: Porting FreeBSD to the PowerPC List-Archive: https://lists.freebsd.org/archives/freebsd-ppc List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-ppc@freebsd.org Sender: owner-freebsd-ppc@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: <00E9A4E2-8746-48C0-815D-B923D7AEE211@fh-muenster.de> In-Reply-To: <00E9A4E2-8746-48C0-815D-B923D7AEE211@fh-muenster.de> From: Adrian Chadd Date: Mon, 25 May 2026 22:21:13 -0700 X-Gm-Features: AVHnY4IzOYBgHt2etZpVteNemxXT0kBDl-mNdeaf5OWgU0oh_lYnM4vpq1egSBI Message-ID: Subject: Re: FreeBSD Big Endian in a VM and VirtIO To: =?UTF-8?B?VGltbyBWw7Zsa2Vy?= Cc: "freebsd-ppc@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-1.96 / 15.00]; ARC_ALLOW(-1.00)[google.com:s=arc-20240605:i=1]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.984]; NEURAL_SPAM_MEDIUM(0.92)[0.923]; FORGED_SENDER(0.30)[adrian@freebsd.org,adrianchadd@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_LAST(0.00)[]; TO_DN_SOME(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TAGGED_FROM(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[209.85.222.169:from]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ppc@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[adrian@freebsd.org,adrianchadd@gmail.com]; MISSING_XM_UA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-ppc@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.222.169:from]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_HAS_DN(0.00)[] X-Spamd-Bar: - X-Rspamd-Queue-Id: 4gPh1f4vpWz3d6k hi! On Sat, 23 May 2026 at 01:15, Timo V=C3=B6lker wrote: > > Hi! > > How do you run FreeBSD with Big Endian in a VM? Right now I use qemu w/ full CPU emulation, as my P8/P9 hardware is running FreeBSD natively. (I am tempted to spin up Linux on one of them just to run hardware VMs, but it honestly looks like the coverage there is fine as other developers are doing this.) > Is qemu the de facto only hypervisor used for this? Well, unless you have an IBM hardware setup to run pseries VMs. :-) > To avoid CPU emulation, I installed Debian (Little Endian) on a Raptor Bl= ackbird to run a FreeBSD (Big Endian) VM with qemu. You should be able to just setup a VM - you don't tell it the endianness - and then either boot/install a FreeBSD powerpc64 (be) or powerpc64le (le) ISO. That's it. You don't need to do anything else; the bootloader and kernel will call up to the hypervisor to set the VM endianness and then .. off you go. > > Currently, I=E2=80=99m investigating this bug: > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D294706 > > I think the cause is byte swaps in sys/dev/virtio/pci/virtio_pci_modern.c= (by virtio_htog*() or virtio_gtoh*() function calls) that shouldn=E2=80=99= t be done. At least if I remove these in my setup, the bug disappears. Now,= I wonder, are these byte swaps incorrect in my setup but necessary in othe= rs (due to another hypervisor or the endianness of the host system)? > > In my understanding, at the lines where virtio_pci_modern.c uses the virt= io_htog*() functions, it reads a value from the PCI bus. Since the PCI bus = uses little endian, it requires a byte swap in a big endian VM, but this is= already done internally by the bus_space API. So, this would mean the byte= swaps in virtio_pci_modern.c are incorrect in general and shouldn=E2=80=99= t be done. Thanks again for digging into it! -a