From nobody Tue Feb 10 06:26:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770416411; cv=none; d=zohomail.com; s=zohoarc; b=CKjkXrODKTBlj2uWa/sQRXP0tXm8nV8jawyNEeMz5q1RpCo+CzjONH7i7avOJ4X/D3igsLjyr0wY6s+twMEI53SonFPy9DiCEEmjgj4cepdC/HwFRB/6EdFzEMvuFOteQzlGrsrvnDaZZn6VJF3Wte3iYS+VGu9Fwcqn96/G5D0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770416411; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BDVf0HcSlG+DZgs/i7+uJFbsNebFbALD/dqSu3oQmMY=; b=e436EpvFjwKMsWdOxSyDrI3X9w0XAcoE5qX+fYXPEhz3Ch+rsnDm7HdfZUAAesNaZ7mLQFIGvOjgyM5+6WMRBetU+mbx+stIljw6UR21q6btSCpq2VVTDm02AQ4KN6le6WcWXB4UhSIlit8KRHuRQ/ktcojZf8eS+pDWApl8u5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770416411487269.09230263578195; Fri, 6 Feb 2026 14:20:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1voUAc-00063C-G8; Fri, 06 Feb 2026 17:19:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1voUAb-00062C-Ao for qemu-devel@nongnu.org; Fri, 06 Feb 2026 17:19:21 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1voUAZ-00079A-IG for qemu-devel@nongnu.org; Fri, 06 Feb 2026 17:19:21 -0500 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-c6c444e89bcso933519a12.2 for ; Fri, 06 Feb 2026 14:19:18 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a95bff42f7sm13316575ad.68.2026.02.06.14.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 14:19:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770416357; x=1771021157; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BDVf0HcSlG+DZgs/i7+uJFbsNebFbALD/dqSu3oQmMY=; b=Trosb6454QyhFg1H2TJuX6LgGDSX76J60tXs5ti45lqSbIuXqLFzhq5hrTnTlSC34m 1RA3J+uA1lyjypwu1ts83Flpcf+jxFk1H1DylLKAZ86GJ7/xGX/IKpGliPk4aoMlcVkz lOzP5lifOgG3j6gX+U6cSx2sYBlQ8ANJzWIzX3mslNpGaw1KUzxXN2bcLKaqvHVDVgTm L1EFkdFCM6UogFsI5MqcXiIxKJIK7dChIebd7Jb0fXKE5dzTlyQNZnnfxaZ2oBqrTOPA SRxq6VKOfLYzQjhvGnvTLLHUcF8FPzkK/rAVzkmc8wSRM6Yw/bvCG6GvY9UT0ZHjFG7e 7Uzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770416358; x=1771021158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BDVf0HcSlG+DZgs/i7+uJFbsNebFbALD/dqSu3oQmMY=; b=bpFifCF28HjOMc/of3w72LEMl0g7ipG1mUx5hq8Km2cORTldya4N8vW0usLEOEfrUr 2djIhgZ4UIRR0kOlFkggZ1TMEN5wo1PlYxuWJXQZ0IwVAjcv2LTsjd6yShGFMYEXE8nf r5aZ9XMClpdJvjR9Ahd+Im9bsk+DVoOXVMWR4qhRw7F/FoUopq3O3ZovOpPPULNqqQ1A qZX5PwA35BfjE8Fr4pv3r4Fvj3o4S6OYZ866mVCgp36TyXCOglUI/JAcjjfvU6Gc1Lpq u+sM64i63O2n6X580W1kNo0iv5haCu+Ez2WKwShu0PTY1g41h73TW+mwzZdxjCQ3QdaR uUcw== X-Gm-Message-State: AOJu0YyrLhoeSijPbZA9M2QniqxopJIbvmbr4TPfe+6HddCRnQJoktXb qH6W5PmQypIOOJkZxPw7RUS5iiW4duT426M8bPHfVQnMzZRt6BYQLj7ysGCLyAMsqNkIltudVJG inzPo X-Gm-Gg: AZuq6aJNZ9JRAf7aEa7fqtwfdvYksR9n97sCEl+v83lOSVpU3dA9+qn/ax7Rr/M2+D8 IQ5g1vj8QrWK6POoO7v5ypDFwNd+84bk9ZIJBEeD1KXBXmvK2/mUeVDeEHUDd0Rwg3/ZG/jyqU8 t8DYzXnrRLeqrKPbxcbzgtMHQNFVOXK7VQWW7OY7f3quqJYX0Ss5r5p0Jp5VeeBQndgDdRlkV/8 ekIBpiwjAlzaCKQEwQnEy8/eNfzle/02ncFXL4PFbB0dqpfSJwFZNSFDByQOFaA9O3m4dvquIqY 8RQLNzoaUs8OuPAiVhzyyDzkbTT0kVnMwKQV9rSPp/U4nHcUVkwKEO3MCAoGjIr+sKgTp5xbhOR 6981+aNt1kmkB36p2XZa8hcz3EiPgD/qT6g0/NzwTRnPn6TQz7W8qi6m5/3ygWG7WWo9YZ/Iefr olzyW8LbU7ZcG/LE/OvTlxRveybBThEpzRsLyaX/lC88XIbMzEUOLeAe6QlESKU72iNSaYCiDh5 w+b X-Received: by 2002:a17:903:298b:b0:2a9:484c:ff21 with SMTP id d9443c01a7336-2a951666249mr45795875ad.25.1770416357498; Fri, 06 Feb 2026 14:19:17 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefano Garzarella , Nicholas Piggin , Harsh Prateek Bora , "Michael S. Tsirkin" , Pierrick Bouvier , stefanha@redhat.com, richard.henderson@linaro.org, qemu-ppc@nongnu.org Subject: [PATCH v5 2/9] hw/virtio: Introduce VirtIODevice::access_is_big_endian boolean field Date: Fri, 6 Feb 2026 14:19:01 -0800 Message-ID: <20260206221908.1451528-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260206221908.1451528-1-pierrick.bouvier@linaro.org> References: <20260206221908.1451528-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770416412967158500 From: Philippe Mathieu-Daud=C3=A9 VirtIODevice::access_is_big_endian boolean field, initialized on device realize, and updated when setting device features. This happens on reset or when configuring device after initial realize. It represents whether load/store accesses are ordered using big endianness. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Pierrick Bouvier --- include/hw/virtio/virtio.h | 5 +++++ hw/virtio/virtio.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 65872f2c54c..0f792e24f23 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -154,6 +154,11 @@ struct VirtIODevice VMChangeStateEntry *vmstate; char *bus_name; uint8_t device_endian; + /** + * @access_is_big_endian: whether load/store memory accesses are order= ed + * using big endianness. + */ + bool access_is_big_endian; /** * @user_guest_notifier_mask: gate usage of ->guest_notifier_mask() ca= llback. * This is used to suppress the masking of guest updates for diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 77ca54e5206..a429ff7de39 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3154,6 +3154,10 @@ static int virtio_set_features_nocheck(VirtIODevice = *vdev, const uint64_t *val) } =20 virtio_features_copy(vdev->guest_features_ex, tmp); + if (!bad) { + /* set_features might enable VIRTIO_F_VERSION_1 */ + vdev->access_is_big_endian =3D virtio_access_is_big_endian(vdev); + } return bad ? -1 : 0; } =20 @@ -4075,6 +4079,7 @@ static void virtio_device_realize(DeviceState *dev, E= rror **errp) vdev->listener.commit =3D virtio_memory_listener_commit; vdev->listener.name =3D "virtio"; memory_listener_register(&vdev->listener, vdev->dma_as); + vdev->access_is_big_endian =3D virtio_access_is_big_endian(vdev); } =20 static void virtio_device_unrealize(DeviceState *dev) --=20 2.47.3