From nobody Thu Apr 25 03:56:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1637746634233885.3822707789012; Wed, 24 Nov 2021 01:37:14 -0800 (PST) Received: from localhost ([::1]:59094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpoiF-0007Np-V2 for importer@patchew.org; Wed, 24 Nov 2021 04:37:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpobM-0000F8-RJ; Wed, 24 Nov 2021 04:30:04 -0500 Received: from [2607:f8b0:4864:20::a32] (port=42503 helo=mail-vk1-xa32.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpobJ-0006hk-Ie; Wed, 24 Nov 2021 04:30:04 -0500 Received: by mail-vk1-xa32.google.com with SMTP id b125so1063472vkb.9; Wed, 24 Nov 2021 01:30:00 -0800 (PST) Received: from rekt.ibmuc.com ([191.19.215.188]) by smtp.gmail.com with ESMTPSA id m15sm7682583vkl.40.2021.11.24.01.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 01:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=INU73d/uF2ivB+x0H+8RzqTTu5ZxmTrDWSWRgnsrDZ8=; b=pC7eNY14KmCFvYlVefZsflmXdIsSTetzO11hgRgp5xwTL7+czIgeRoMyVFgg/lK1EL w05OgqIxgs2RhnBYjZ54/lZ7ZMyUm1qfeubPgu05L5G/0R87pWaqCjW8Zz/AbFseJ3eI D2pJALY4Om7Q8Bbd+I4gi/3DCC6vtEjC/2ZBF64y4aCcvL52Te3OoZcVKGpFiCflnfXi z0UYYyYWdsAdP0U167hqW/FrGpX7L1aHS/MUPrU20Z2/sRtlq+Np1PDb6WsUhR7EttFl xRJd3D8z2jjjfcFf7VMrQF0jSLqFC+Fiqj2FdjcXi/wml+USUEjDXMjlMDgP9b2cwHIk AxBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=INU73d/uF2ivB+x0H+8RzqTTu5ZxmTrDWSWRgnsrDZ8=; b=2DPwjoL26WD7O2bYQWFKWxmyu7kuAKFJ2SCAsHOz4cTBhOgV4Cvra5tlVDcDsn7LuF fwqGIopHlKGX+PN1ESmUlCDBUDBu4Q7tTwhprAWYR1D2MeJ6oZvY9ii4w4qJCq/4doac WoH+wHqny/m8mEM97No3Y0KosKGuCcRYR9HhOwC1tXzui0TtQ9lAoQk8aenS0fmLb9dn J/TJ/V/cvIP3Kz0xadodYTHDj+PjnK125GT3yYrztrZfAcfodbMjW7zMQtHHjqJVHYkl teuIa5R+W83bCaioOhB1d6hEZLBe/wfeo6vZo0qcYZn619oFUlk+2JXTPjXvu8olN4At tf2Q== X-Gm-Message-State: AOAM531eX3CrUFKA8LnjyRaaNu4NC3AtPoFxDj0edic7ZnoHyu1NfLxw YwciP9BlyqQ8obdXUpGSPVCbxaQDGe4= X-Google-Smtp-Source: ABdhPJzYYVi+9koubxZ0cjUCwOHOf5akj7rRGIisn7zh92bydH7DJ1Kl8nwG5fBHr7URvthKxwHacA== X-Received: by 2002:a05:6122:114c:: with SMTP id p12mr24105499vko.21.1637746199618; Wed, 24 Nov 2021 01:29:59 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-7.0 v2 1/2] ivshmem.c: change endianness to LITTLE_ENDIAN Date: Wed, 24 Nov 2021 06:29:47 -0300 Message-Id: <20211124092948.335389-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211124092948.335389-1-danielhb413@gmail.com> References: <20211124092948.335389-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::a32 (failed) 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::a32; envelope-from=danielhb413@gmail.com; helo=mail-vk1-xa32.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1637746635426100001 Content-Type: text/plain; charset="utf-8" The ivshmem device, as with most PCI devices, uses little endian byte order. However, the endianness of its mmio_ops is marked as DEVICE_NATIVE_ENDIAN. This presents not only the usual problems with big endian hosts but also with PowerPC little endian hosts as well, since the Power architecture in QEMU uses big endian hardware (XIVE controller, PCI Host Bridges, etc) even if the host is in little endian byte order. As it is today, the IVPosition of the device will be byte swapped when running in Power BE and LE. This can be seen by changing the existing qtest 'ivshmem-test' to run in ppc64 hosts and printing the IVPOSITION regs in test_ivshmem_server() right after the VM ids assert. For x86_64 the VM id values read are '0' and '1', for ppc64 (tested in a Power8 RHEL 7.9 BE server) and ppc64le (tested in a Power9 RHEL 8.6 LE server) the ids will be '0' and '0x1000000'. Change this device to LITTLE_ENDIAN fixes the issue for Power hosts of both endianness, and every other big-endian architecture that might use this device, without impacting x86 users. Fixes: cb06608e17f8 ("ivshmem: convert to memory API") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/168 Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/misc/ivshmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 1ba4a98377..299837e5c1 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -243,7 +243,7 @@ static uint64_t ivshmem_io_read(void *opaque, hwaddr ad= dr, static const MemoryRegionOps ivshmem_mmio_ops =3D { .read =3D ivshmem_io_read, .write =3D ivshmem_io_write, - .endianness =3D DEVICE_NATIVE_ENDIAN, + .endianness =3D DEVICE_LITTLE_ENDIAN, .impl =3D { .min_access_size =3D 4, .max_access_size =3D 4, --=20 2.31.1 From nobody Thu Apr 25 03:56:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1637746598873438.63399869565; Wed, 24 Nov 2021 01:36:38 -0800 (PST) Received: from localhost ([::1]:57792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpohg-0006Uh-K1 for importer@patchew.org; Wed, 24 Nov 2021 04:36:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpobP-0000Ln-Qo; Wed, 24 Nov 2021 04:30:07 -0500 Received: from [2607:f8b0:4864:20::92b] (port=36577 helo=mail-ua1-x92b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpobL-0006iR-VU; Wed, 24 Nov 2021 04:30:07 -0500 Received: by mail-ua1-x92b.google.com with SMTP id r15so3748910uao.3; Wed, 24 Nov 2021 01:30:03 -0800 (PST) Received: from rekt.ibmuc.com ([191.19.215.188]) by smtp.gmail.com with ESMTPSA id m15sm7682583vkl.40.2021.11.24.01.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 01:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tyOS5VYIUzJzztHcjBVO69KRh6HJ5QWNfDlDrDvrshA=; b=PJf61K+w2M3e3C+s5Ng654/qqCIaC7y5IxFCcYMBwJtWQNUeSVr0UT3IhHE6miZ+zL /21JxsM4m+KXbZjTLdnRzjoVUQIwFDExH12ZYD7Phr4ssJ6bZ+YBb+U3WcIFvzCToLAn XC0i2LoEpma/UcuxVjieJSaZ55MOA7NQX0z2TDZN4ZmB8Ni1pLd4YRJ5Hro0sj0SSY3X LYb8uYmzPQP+XF107ZE/vJOC2P7tf0Kpam+vgPIyiyvRlF4cIgSfWONjFq8l2dwOwuQ1 hp2avV7ECTmFxiuqR2eyXNE5C/R/pqjx1DlalaKZpOyp38m0lDTiMfN+FnCpb76TOl6c rjgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tyOS5VYIUzJzztHcjBVO69KRh6HJ5QWNfDlDrDvrshA=; b=z8PCSOoix1fXdywPY/ZNxdZ7GJCB3DxZ6bGclRL1D1WlSRQTJERe4Wm1YPKu0gPvP2 6zNQeik8oJjbLDNL2xIpgOBUfZ4PN6zg5JVWCwkw41Awdmwz+FDyCPOyjlqGNZWGE/xB imrXMvOyCf+AW4Rpo2YR134N/DdLLmKp50hg2o/hNIxdn8eEFAflWf3tw2Z4knibNWFf tgsez0X02KjQB/RZ3e+2jMDsyqnPzCh/YdxI207ZpK5EWay1uIbxX3Et8i/4ERtFKgW7 54XqEH4wNPky8Q3zYshZDw82DGjfpMpMbLg6jmIhVjNMSRpqG14xY4GuFCZbCKqOIQSa 8bcg== X-Gm-Message-State: AOAM533eB5n8SLRZLiWkH2gq31Jul0osCtQf2xbOpoJlD/J4E3YY3bkX phjhdAJ+EUrAY/toCaQrOY81x4db7W8= X-Google-Smtp-Source: ABdhPJxVwQE3gL6M+IW1xpd6mBxb+EO8O1jtcSZ7GIJafMQR4bmkZKpQGZm9Gj9nqGreg4MTplmRew== X-Received: by 2002:a05:6102:3ec3:: with SMTP id n3mr21015849vsv.48.1637746201408; Wed, 24 Nov 2021 01:30:01 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-7.0 v2 2/2] ivshmem-test.c: enable test_ivshmem_server for ppc64 arch Date: Wed, 24 Nov 2021 06:29:48 -0300 Message-Id: <20211124092948.335389-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211124092948.335389-1-danielhb413@gmail.com> References: <20211124092948.335389-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::92b (failed) 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::92b; envelope-from=danielhb413@gmail.com; helo=mail-ua1-x92b.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1637746600489100001 Content-Type: text/plain; charset="utf-8" This test, if enabled by hand, was failing when the ivhsmem device was being declared as DEVICE_NATIVE_ENDIAN with the following error: /ppc64/ivshmem/pair: OK /ppc64/ivshmem/server: ** ERROR:/home/danielhb/qemu/tests/qtest/ivshmem-test.c:367:test_ivshmem_serve= r: assertion failed (ret !=3D 0): (0 !=3D 0) Aborted After the endianness change done in the previous patch, we can verify in both a a Power 9 little-endian host and in a Power 8 big-endian host that this test is now passing: $ QTEST_QEMU_BINARY=3D./ppc64-softmmu/qemu-system-ppc64 ./tests/qtest/ivshm= em-test -m slow /ppc64/ivshmem/single: OK /ppc64/ivshmem/hotplug: OK /ppc64/ivshmem/memdev: OK /ppc64/ivshmem/pair: OK /ppc64/ivshmem/server: OK Let's keep it that way by officially enabling it for ppc64. Acked-by: Thomas Huth Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/ivshmem-test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index dfa69424ed..fe94dd3b96 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -463,7 +463,6 @@ static gchar *mktempshm(int size, int *fd) int main(int argc, char **argv) { int ret, fd; - const char *arch =3D qtest_get_arch(); gchar dir[] =3D "/tmp/ivshmem-test.XXXXXX"; =20 g_test_init(&argc, &argv, NULL); @@ -488,9 +487,7 @@ int main(int argc, char **argv) qtest_add_func("/ivshmem/memdev", test_ivshmem_memdev); if (g_test_slow()) { qtest_add_func("/ivshmem/pair", test_ivshmem_pair); - if (strcmp(arch, "ppc64") !=3D 0) { - qtest_add_func("/ivshmem/server", test_ivshmem_server); - } + qtest_add_func("/ivshmem/server", test_ivshmem_server); } =20 out: --=20 2.31.1