From nobody Sun May 19 03:38:19 2024 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=1646671726; cv=none; d=zohomail.com; s=zohoarc; b=SYWdgx2Uur0zV7abevsnfme2w+7lJzmmSiQac5+9+GD+jJiiuJBgLvNtC7rocUDveMykhKj2/DVCjYQV28xZbanXnErvk6xnUOQTUoFp1Maa69F0KloybhBMp4tsHYDO9fefY6f4IoFJsh4H1rke8zT2/z7LL45Fcf2UTDTTxAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671726; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=khb2dSFPApkPaahIP5O1Jg4lPgEuKg6KdJgWB44Ysm4=; b=DM2TN+RyYQH+AYxAMdAmjEb106PmugoVzVnY4fsHFTpN1hjQTr3TePvKy9tS0PWg0LnYYcgl3YyiMuOgragSG7lyifp7f1ODnvEsLOksGr7LPNqWgSCwir7UICxvpsNa510275LWSu+lGTfE0FROw3U7R06AzzUo6YhvkCaS+qY= 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 1646671726861173.4064695019673; Mon, 7 Mar 2022 08:48:46 -0800 (PST) Received: from localhost ([::1]:35904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGXM-0003ls-SY for importer@patchew.org; Mon, 07 Mar 2022 11:48:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGVv-0001Kw-RH for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:15 -0500 Received: from [2a00:1450:4864:20::429] (port=37874 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVu-0007il-9K for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:15 -0500 Received: by mail-wr1-x429.google.com with SMTP id q14so8727891wrc.4 for ; Mon, 07 Mar 2022 08:47:13 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=khb2dSFPApkPaahIP5O1Jg4lPgEuKg6KdJgWB44Ysm4=; b=mOzqoQYNMgc1nA+71FFmo27RsIKW294IW0QHrhL0EAbzL9K08ZjeIofxkiChLbJdh8 szVPjBkIjgzs3wQJjJZGa5CMBpnUmlcER8clYcBzTUdek7WjhFXBYEwv4p+VETkgarX6 b+hRC7EJyCuJwsEFAOUG+Vxms2VJewM9X42vq5rZn1Fnps4UfhP8H4Q7imuzmsa9Z3HM gCrKLIgKG/fdqSYEai6A63uCN/XVnsh1zZJFuEVpCJSDkoAmEOuCXxe+XyBCeq+AEsjf JLRybn0lRGuR0ubhkY35dV00VbHkS8B07fYNBq/k3mQhfhIS3kyhlJjKymy/+qGViWC9 abNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=khb2dSFPApkPaahIP5O1Jg4lPgEuKg6KdJgWB44Ysm4=; b=i7mev0D5nd5eseQGSqJte/+ZqWza7k+UyGWBzpqwFJ00xQFcn1lx9J+K6gP3olNEM+ ReLRyWm0hAs+6MZ00EBuWAH7iLbzZgGGvZJE3xpUePPSGcH5qH8JGh2NqBV5jel7h5Fe r0roYAJK+kGkO0tGUeAEso7Gvd/JXNi1g8hijBJqXHdDmF84zoSDddCJOXTmT43ZJ38+ LSpqZe1Z8tCcaYRYmANzrrYguQuM3CmVtuFoHerYmToWdd815Gn2zMdfCseTHyxxtMDB dO5epTYveuBdrQoPBSi3m/RmbUNJuGw9JL7/ElFZpcX0J4yPRcGVcf4mf/D4rAEHlPzR 5qbw== X-Gm-Message-State: AOAM531rZrcxfj8JQHo83Ee1rSB7GulTpeOzzbOnTuzG4MUoFStaruFY sp+CMEzXqz3+sBreU4uTG+s08EcGLTnK7A== X-Google-Smtp-Source: ABdhPJxV4awvBFCDp+xlBF9dTne0rWTfPfpp+Rg7Dmp8mzxh5LjBoK3qN8lE3xt7sxfTfIbQ0DB1hQ== X-Received: by 2002:a5d:6f0d:0:b0:1f1:f897:9dc with SMTP id ay13-20020a5d6f0d000000b001f1f89709dcmr4229874wrb.32.1646671632741; Mon, 07 Mar 2022 08:47:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/18] util: Make qemu_oom_check() a static function Date: Mon, 7 Mar 2022 16:46:52 +0000 Message-Id: <20220307164709.2503250-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (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=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671729249100001 The qemu_oom_check() function, which we define in both oslib-posix.c and oslib-win32.c, is now used only locally in that file; make it static. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20220226180723.1706285-3-peter.maydell@linaro.org --- include/qemu-common.h | 2 -- util/oslib-posix.c | 2 +- util/oslib-win32.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 68b2e3bc109..8c0d9ab0f77 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -26,8 +26,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -void *qemu_oom_check(void *ptr); - ssize_t qemu_write_full(int fd, const void *buf, size_t count) QEMU_WARN_UNUSED_RESULT; =20 diff --git a/util/oslib-posix.c b/util/oslib-posix.c index f2be7321c59..ed5974d3845 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -199,7 +199,7 @@ fail_close: return false; } =20 -void *qemu_oom_check(void *ptr) +static void *qemu_oom_check(void *ptr) { if (ptr =3D=3D NULL) { fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)= ); diff --git a/util/oslib-win32.c b/util/oslib-win32.c index af559ef3398..c87e6977246 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -44,7 +44,7 @@ /* this must come after including "trace.h" */ #include =20 -void *qemu_oom_check(void *ptr) +static void *qemu_oom_check(void *ptr) { if (ptr =3D=3D NULL) { fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()= ); --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671845; cv=none; d=zohomail.com; s=zohoarc; b=QMj22f8s7hLfYoMYN9ln072kXQ8svMloPsAT3mtqAtR+FZigOWqD5wPQxBP9/iov2S+cLKj9n1G5yW7jyN7LjphUGa4bhaFgontR0/VND0REt+/6D/S0r4sCfagH5xH0ncGFrf8gtbUcaOLSRqkhRnQGc696WRPWKjCXum8xR+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671845; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9VfQ5wi2gw0vpXzXf74eUVOgttIcr7mfX30dEcsQ3oM=; b=BjUKqFKf3dh3hQeEX2Le0B4LXkg0ca/p3/fVP9ye2iTJX8hv0ysDYmEqtrkG23wqmuLYnvPMk3DMXJ1UL6N8wJKC2hLm2Ga7poEsdcXsY7SEkl5o9PUx361/VQNbnlPHiexQOvo1sC4Jt2rVACAwenRqjDEyrBmi2TL5heVma6A= 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 1646671845196170.4112628935643; Mon, 7 Mar 2022 08:50:45 -0800 (PST) Received: from localhost ([::1]:44476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGZH-0000xM-K6 for importer@patchew.org; Mon, 07 Mar 2022 11:50:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGVx-0001MH-3R for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:17 -0500 Received: from [2a00:1450:4864:20::436] (port=41979 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVu-0007is-UT for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:16 -0500 Received: by mail-wr1-x436.google.com with SMTP id i8so24261541wrr.8 for ; Mon, 07 Mar 2022 08:47:14 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9VfQ5wi2gw0vpXzXf74eUVOgttIcr7mfX30dEcsQ3oM=; b=S7gZrJQ4mYMIduPfWXEFFEcAhjU1yxS4OLf9eRBpw6cSxvF4PdAslKPU3P8Q1f7/+f /PcrmSI+BGPCceHc7Xe828ZIbLLbZYLukvMil0igPaBE7kHxjElcp80MMlHNxCA4HLGe AyuRnaz9MmJzioqwILRzBW0Ws15bVc78LwAZAvQ93nMqhv3f5stCtJMGef4C8/ivd6Pz G6w34/Mpq/agOTrZ87sPo5J3oLJpbjxdyefmn6//E5pf050pRFYOng+i0W1mPWSRxdQ0 DNU1UIFA81Ek/bwzbfEJA0hspadT764TVlQ0wfP89OProfw6wgAyHpRj9AjC5QGA1KXj gP0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9VfQ5wi2gw0vpXzXf74eUVOgttIcr7mfX30dEcsQ3oM=; b=5EPs/UXrg+LDy9IoOEfSmyOM5XhbA1IU2aAGSb07s+a55QEpNdwyKFPZBSao2i4At6 9oCkzhiEKMtteY/KLTsw9dqumByyN4nteIdc8pRlk9x1/VH3f6aGr37eZVtDNvGVpP8G mmpJJODfvFGMY6dJB97NCnXiUXdT+gwOj2lqOsU90eC6h3kXRk4j2ZM1c8P7Jv5c1z9j DUkvwBZ1JJ4/bzzyJrQKNpoDtBcBNYqrMPwBcCub3cJ+pONXfHE56FNQsAjrtPy+DmrX 6w8HITDAt3Mzmog6jocmuYDqXg+H9dmpCqblRRQAsreKi+522ZrB+0amj5d19YNju/qd NIdA== X-Gm-Message-State: AOAM532D71V8xt4yb/gNi/DQJIf8/IlaIQCtNxNKDFBqt8jWPIqm6CpR xnr1Ab9PPDJ+ne7MoNnVsYvjzCQWEcaqZw== X-Google-Smtp-Source: ABdhPJzmOsML2CZV6cCofCeafLNjUlflxUjIQWiS5KhuArxIS/YkXMgJR8wBEnTH+HLBudCkytbKWA== X-Received: by 2002:a5d:5911:0:b0:1f0:3272:2ac9 with SMTP id v17-20020a5d5911000000b001f032722ac9mr8751180wrd.1.1646671633620; Mon, 07 Mar 2022 08:47:13 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/18] util: Unify implementations of qemu_memalign() Date: Mon, 7 Mar 2022 16:46:53 +0000 Message-Id: <20220307164709.2503250-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (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=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671846597100001 We implement qemu_memalign() in both oslib-posix.c and oslib-win32.c, but the two versions are essentially the same: they call qemu_try_memalign(), and abort() after printing an error message if it fails. The only difference is that the win32 version prints the GetLastError() value whereas the POSIX version prints strerror(errno). However, this is a bug in the win32 version: in commit dfbd0b873a85021 in 2020 we changed the implementation of qemu_try_memalign() from using VirtualAlloc() (which sets the GetLastError() value) to using _aligned_malloc() (which sets errno), but didn't update the error message to match. Replace the two separate functions with a single version in a new memalign.c file, which drops the unnecessary extra qemu_oom_check() function and instead prints a more useful message including the requested size and alignment as well as the errno string. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220226180723.1706285-4-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- util/memalign.c | 39 +++++++++++++++++++++++++++++++++++++++ util/oslib-posix.c | 14 -------------- util/oslib-win32.c | 14 -------------- util/meson.build | 1 + 4 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 util/memalign.c diff --git a/util/memalign.c b/util/memalign.c new file mode 100644 index 00000000000..6dfc20abbb1 --- /dev/null +++ b/util/memalign.c @@ -0,0 +1,39 @@ +/* + * memalign.c: Allocate an aligned memory region + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2010-2016 Red Hat, Inc. + * Copyright (c) 2022 Linaro Ltd + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" + +void *qemu_memalign(size_t alignment, size_t size) +{ + void *p =3D qemu_try_memalign(alignment, size); + if (p) { + return p; + } + fprintf(stderr, + "qemu_memalign: failed to allocate %zu bytes at alignment %zu:= %s\n", + size, alignment, strerror(errno)); + abort(); +} diff --git a/util/oslib-posix.c b/util/oslib-posix.c index ed5974d3845..0278902ee79 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -199,15 +199,6 @@ fail_close: return false; } =20 -static void *qemu_oom_check(void *ptr) -{ - if (ptr =3D=3D NULL) { - fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)= ); - abort(); - } - return ptr; -} - void *qemu_try_memalign(size_t alignment, size_t size) { void *ptr; @@ -234,11 +225,6 @@ void *qemu_try_memalign(size_t alignment, size_t size) return ptr; } =20 -void *qemu_memalign(size_t alignment, size_t size) -{ - return qemu_oom_check(qemu_try_memalign(alignment, size)); -} - /* alloc shared memory pages */ void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared, bool noreserve) diff --git a/util/oslib-win32.c b/util/oslib-win32.c index c87e6977246..05857414695 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -44,15 +44,6 @@ /* this must come after including "trace.h" */ #include =20 -static void *qemu_oom_check(void *ptr) -{ - if (ptr =3D=3D NULL) { - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()= ); - abort(); - } - return ptr; -} - void *qemu_try_memalign(size_t alignment, size_t size) { void *ptr; @@ -68,11 +59,6 @@ void *qemu_try_memalign(size_t alignment, size_t size) return ptr; } =20 -void *qemu_memalign(size_t alignment, size_t size) -{ - return qemu_oom_check(qemu_try_memalign(alignment, size)); -} - static int get_allocation_granularity(void) { SYSTEM_INFO system_info; diff --git a/util/meson.build b/util/meson.build index 3736988b9f6..f6ee74ad0c8 100644 --- a/util/meson.build +++ b/util/meson.build @@ -51,6 +51,7 @@ util_ss.add(when: 'CONFIG_POSIX', if_true: files('drm.c')) util_ss.add(files('guest-random.c')) util_ss.add(files('yank.c')) util_ss.add(files('int128.c')) +util_ss.add(files('memalign.c')) =20 if have_user util_ss.add(files('selfmap.c')) --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671992; cv=none; d=zohomail.com; s=zohoarc; b=RLvRo9YV9bSTzYhS1uGNtoCa82GDvxxVs/jAjrGnQ9sQc7Q9bRDMWZ66/vXVsNYW/D/yBJVMx8lvs2+JjZskx9h1UgyAgC26QTdQ2Plf9SdDbntnsPQNabD+TnIaGwogb2b+q/1v9E1NkY/5EwzUqqZ9rwDA9GIAwdbAN2gf73g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671992; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wNLlmiJKgcgevH7l2nRJUQn8/Ms/TerlHklY+uOxLsA=; b=QCDlCwIXzy94rH9SsNsNTbFI6cTw1nra3DL1EH9yLl36ZkHq+xR0YPtRIhZmNEkNz80OQE7T6zJ8ayOvDIHCTzp0zzEh7l35keTH/QmGJyFaPhst4NOluzXcu2zUYCB7e+54VBEbZB46Fh2ZslR1KywhFkoQnF2h/A4O9vqekFw= 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 1646671992421345.66127806307145; Mon, 7 Mar 2022 08:53:12 -0800 (PST) Received: from localhost ([::1]:51590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGbf-0005kg-85 for importer@patchew.org; Mon, 07 Mar 2022 11:53:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGVx-0001N2-H9 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:17 -0500 Received: from [2a00:1450:4864:20::42d] (port=39515 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVv-0007iz-Qv for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:17 -0500 Received: by mail-wr1-x42d.google.com with SMTP id n15so10165596wra.6 for ; Mon, 07 Mar 2022 08:47:15 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wNLlmiJKgcgevH7l2nRJUQn8/Ms/TerlHklY+uOxLsA=; b=xTyjjVL2OXeg6EXRwId/5u2w32ZmV6gDAzGVwLT/AKmz4mcTs608VSAqj0yAeczzUc K4nGm7aHCDGHZOiPlc38ZXUFMco9IOjpsUy9J1evcJ8VWFZBusSi2jc6k/EVzMp3gUE4 mGT+vZW50G38wefn7vvcv78q0AmzD7g0RFh/E5Am2Mbfr2leCOogZ7sf9XL3RIy5TCi6 HofSJdoCHwXWN/FGsD+DY3DYBOIByevQ1h+Ky3qRnCcxwFwfX1tNuvOoqLuehyc73vMd esIQ7153KkeRMJcBY/y/kA0StG9GhLBxGMCKmux4Dgq59Kc7GpEiKMYXuYhzsu3XAFWH K5gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wNLlmiJKgcgevH7l2nRJUQn8/Ms/TerlHklY+uOxLsA=; b=uLnQUqg87uNdRqRVdf4+ChFf8j1JF/TF85pmUUL/+JhUgqlNIfULQE2VUB+fts9+p9 ZCtGHiATM34rFYF4cYJvKH2KfP9pWkLgWbO1dME/vC37I9DX/RYtHCTJ/RRdsO0G2TI3 Zqp4WW/zH/Wsj4Q/J55Q2LeSoCUWZ2k5D+9xVe3P0BtjVBokOe4DLAyRBPZKfWiMVbdH W8htKSO2O1t/9NFUaTqZUOyycKISMfOhKqQhCJAj7D7D5QCAWxVk1S0lKu+XnMjR3j/T MAvc0KL10yYvDK4ojSDLx/vxjsOxU++KknAZ2zZtu2VRfgGM+rEs0qPLbyEHzqPfShFL /mmQ== X-Gm-Message-State: AOAM533PtyegshhGmt2tl1gGN2Caim2yx3aKJ3cWyaVyzVQ6EOvWJ+ei Vhki7P4qW2B2hlGomGqo6dz6rCE8bqN9Mw== X-Google-Smtp-Source: ABdhPJyoR4SzrLYfoJQrJj553yEq1lUK0dNicSOPjv+Q06b82YF+60d1ITwT4/a5bTlS2ds504yVxw== X-Received: by 2002:a05:6000:15cb:b0:1f1:e283:fcc0 with SMTP id y11-20020a05600015cb00b001f1e283fcc0mr8029596wry.18.1646671634444; Mon, 07 Mar 2022 08:47:14 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/18] util: Return valid allocation for qemu_try_memalign() with zero size Date: Mon, 7 Mar 2022 16:46:54 +0000 Message-Id: <20220307164709.2503250-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (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=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671994489100001 Currently qemu_try_memalign()'s behaviour if asked to allocate 0 bytes is rather variable: * on Windows, we will assert * on POSIX platforms, we get the underlying behaviour of the posix_memalign() or equivalent function, which may be either "return a valid non-NULL pointer" or "return NULL" Explictly check for 0 byte allocations, so we get consistent behaviour across platforms. We handle them by incrementing the size so that we return a valid non-NULL pointer that can later be passed to qemu_vfree(). This is permitted behaviour for the posix_memalign() API and is the most usual way that underlying malloc() etc implementations handle a zero-sized allocation request, because it won't trip up calling code that assumes NULL means an error. (This includes our own qemu_memalign(), which will abort on NULL.) This change is a preparation for sharing the qemu_try_memalign() code between Windows and POSIX. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- util/oslib-posix.c | 3 +++ util/oslib-win32.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 0278902ee79..f7e22f4ff9b 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -209,6 +209,9 @@ void *qemu_try_memalign(size_t alignment, size_t size) g_assert(is_power_of_2(alignment)); } =20 + if (size =3D=3D 0) { + size++; + } #if defined(CONFIG_POSIX_MEMALIGN) int ret; ret =3D posix_memalign(&ptr, alignment, size); diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 05857414695..8c28d70904d 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -48,12 +48,14 @@ void *qemu_try_memalign(size_t alignment, size_t size) { void *ptr; =20 - g_assert(size !=3D 0); if (alignment < sizeof(void *)) { alignment =3D sizeof(void *); } else { g_assert(is_power_of_2(alignment)); } + if (size =3D=3D 0) { + size++; + } ptr =3D _aligned_malloc(size, alignment); trace_qemu_memalign(alignment, size, ptr); return ptr; --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671848; cv=none; d=zohomail.com; s=zohoarc; b=dTvMPl6NoWaz5DMbccRR02gob9jD+7WHdoVf+sS7zTv7Ffkaguy+yakvVVfeFhAyZZaKrhsDh4XHEgVGzbUEMPxfyZvwoU55cMqFDkBJ0lA2FGQyOOgL7U1Y8+FCgv6qsPY3HAU5MfG6m509dS9sNMKWmlloEvYYdLaXro5SDAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671848; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xpC06DHhxVDLscz6Xo2CkegCEhzKYUxBYFFVOWGgdvk=; b=YfHFCC1pUekgycrHmaFD0ghVW0R6+1xRn39QqgsgZFNsbjq46G0+ZYkvTh4IuDQzWJZocJsBSe91qYzqAEx2wGshRKltFlHfN9oLO1nI02z93m9dciAVFAUJCX/Jcxsq/kVWUNXPX7bnaQhZV/+iOoPjiP1I7IUc1j4arAsn/+c= 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 1646671848783980.4699436588373; Mon, 7 Mar 2022 08:50:48 -0800 (PST) Received: from localhost ([::1]:44570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGZL-00011B-7d for importer@patchew.org; Mon, 07 Mar 2022 11:50:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGVy-0001QQ-Db for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:18 -0500 Received: from [2a00:1450:4864:20::431] (port=33631 helo=mail-wr1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVw-0007jF-Ks for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:18 -0500 Received: by mail-wr1-x431.google.com with SMTP id j17so24366977wrc.0 for ; Mon, 07 Mar 2022 08:47:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xpC06DHhxVDLscz6Xo2CkegCEhzKYUxBYFFVOWGgdvk=; b=SIqeN4AtLpG9QCpuK4KlXzRTsmeuUtwHAJ6m5pZMNg/XPLrpK6p7G2BkS6MsYsIHso S+/2NuSTbjQ2PPEg3Bv1JxgpR+G36OReOaV/fN6GLwR3LGcSWoeuMUlSGO8WeXky1QNG f9OojReDk8Z5KMd+0ZcuwBtPD0yR8VXexKXLCYvYvOB4g8vMCl6iEB5Hh2XDPuftoWk4 TN4IKmh3BRHulQ+uIRiTv+YgA+/h1dLJojTAyGHCbkXA8W02/fW4MDwmBxJN8bJ98Kuy A8g3v+jQvLhIFCJ4nRGKwWSdH2DbYqHjM4362bmLzASgDhh4CtYv4Lg1/hgI1P34hDqj +upw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xpC06DHhxVDLscz6Xo2CkegCEhzKYUxBYFFVOWGgdvk=; b=CboB/6hH3jH0eK6wygrIGkiRsnyHCB8ChNYDdPrzZ6rKlIEjDw61A52uJWY19cE7rP l1iHOm6LaeUQlNQaBZudL9O4L6/q0aN2wVW7o6yi+CsSgWjkE2lCoAfcUUYpZhjv0SIf yhLG56oJ4t1uwGCJlpGydO8TAXFai86ZN32Clam/pu+GzgHshhch1xCkj9D3Sgi9rftw r7b7AFiBeLjA7U/MfIcfRVXIaroJ56iWCcUxyWlLH5u9ncLVjl6HrWy156QMVZSIgNEY zZOlA+UX0iRIDfDCk0fpS9+zamW4cLlVD0ABgoFF5et56CGY88xubl0Ng2lH/PUu8x0i mtSQ== X-Gm-Message-State: AOAM533TpExL7ayCcS3t3tqhp2CxBmlF5EdtcfXrt89DgegwrBD90sXL GnGdvoj0ztDQiLMdj1m/I0fW1RQvP/Fj5A== X-Google-Smtp-Source: ABdhPJyYqX89o75e8QOpUWCcB9fnjQTBtGK+ibx/acEvRqrWCafg8M7GE+ejesMPyjQL1e+HtJzhgw== X-Received: by 2002:adf:f1c1:0:b0:1e3:1381:7bd5 with SMTP id z1-20020adff1c1000000b001e313817bd5mr9076519wro.450.1646671635234; Mon, 07 Mar 2022 08:47:15 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/18] meson.build: Don't misdetect posix_memalign() on Windows Date: Mon, 7 Mar 2022 16:46:55 +0000 Message-Id: <20220307164709.2503250-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::431 (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=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671850147100001 Currently we incorrectly think that posix_memalign() exists on Windows. This is because of a combination of: * the msys2/mingw toolchain/libc claim to have a __builtin_posix_memalign when there isn't a builtin of that name * meson will assume that if you have a __builtin_foo that counts for has_function('foo') Specifying a specific include file via prefix: causes meson to not treat builtins as sufficient and actually look for the function itself; see this meson pull request which added that as the official way to get the right answer: https://github.com/mesonbuild/meson/pull/1150 Currently this misdectection doesn't cause problems because we only use CONFIG_POSIX_MEMALIGN in oslib-posix.c; however that will change in a following commit. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220226180723.1706285-6-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 038502714ab..b541506c1c5 100644 --- a/meson.build +++ b/meson.build @@ -1619,7 +1619,9 @@ config_host_data.set('CONFIG_CLOCK_ADJTIME', cc.has_f= unction('clock_adjtime')) config_host_data.set('CONFIG_DUP3', cc.has_function('dup3')) config_host_data.set('CONFIG_FALLOCATE', cc.has_function('fallocate')) config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fall= ocate')) -config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memal= ign')) +# Note that we need to specify prefix: here to avoid incorrectly +# thinking that Windows has posix_memalign() +config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memal= ign', prefix: '#include ')) config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwai= t', dependencies: threads)) --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671733; cv=none; d=zohomail.com; s=zohoarc; b=bhTIDn109v2E3L0mIsTxVZ1Bqq/MJqWpvFm0CNoICAXhBoJCaTU0Dt8nnZuHuZVfwohtO78bgNo0GGnd1NGOmEk95sKVV84mUWMpvzBMFRA4xy2ShCesBRmFWiXh/WPx8mQ19Dw7jy858Ul8B+p989HriVz3AtBbMRfCY0voxJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671733; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=88/vli9sz3m24lTiI0cGWu1ovNoRhU1oqr+a87iSyJw=; b=WrCHWTJG9fkoBwTLZSwztRhhFsNvsV3O1rhRUWgYj7VYURnpRi8g8fxf/0ie3BBNg1qJrI55fJiSa+deZhQEPnLIM2UdM1PZ8c6D90fDYAYdkrY6RJURP0S89pRhwbcbpe49Ac+X0cJuo234Ee/5iZcNLBTJeqXTmhKhJNW+hPQ= 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 1646671733293689.2908556676026; Mon, 7 Mar 2022 08:48:53 -0800 (PST) Received: from localhost ([::1]:36606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGXU-0004E8-92 for importer@patchew.org; Mon, 07 Mar 2022 11:48:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGVz-0001T5-80 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:19 -0500 Received: from [2a00:1450:4864:20::335] (port=56171 helo=mail-wm1-x335.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVx-0007jP-GK for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:18 -0500 Received: by mail-wm1-x335.google.com with SMTP id i66so9554896wma.5 for ; Mon, 07 Mar 2022 08:47:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=88/vli9sz3m24lTiI0cGWu1ovNoRhU1oqr+a87iSyJw=; b=iDa9H092MybqwrOSEyObQw2tgUbZDEZNrbeQ6QZO49MO6OOpuzHuPBHqiWRmVLocmK 9Xd5C4c3iCOC2KUFqf8FLj/IQYhT1/I3YwQ0PFlFiLixY9UdKFWzVOZv1HwK9LLLWErE We8u2K9aP14MCgRlud1MbCum2iapB6JbJ2rQIBM16w7knAdwwgrDZYdx9osetAnIibZV 8FBJj80R3aTGXGOfz++GQpRkgqh7jz301QesimhTqIkoZtIOANphksc51NzXcOem1ODE 7D3q3U7v12dEAjUmrIKmB2A0gah4uSFBWwchMtVh2wuCWyjxWgqBUC3C35oomyJZE8k6 cqrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=88/vli9sz3m24lTiI0cGWu1ovNoRhU1oqr+a87iSyJw=; b=OdqW8xCnlgqX78tIZ+UDb1Qzsaxkk+fhaHsxq2GC4ChfcGVghpXzNPAvgLbkBCQ5c5 flNgAc6FtxMpkbBAnJo0F257n3Z34eLW/4Tu1qyZB/Ge9bIoWQfDkG591btk9Rn1/q8e 3OeeIMmcUYHRS2tOOI93GwYkPC92fsNGao2G4xaCkmoyXZ5zeynwZxgZBS/etxM0yvmU ZRtegUt5pnR6ADuZmDd8tce2QFp7zf8DAmvIUjAwwjJlc3k5ieuQXQuTP0JdaxqEqIHz pnuob3R3MLIQSni8og0180MWxEM+lylmeHnukNI2PyCX+G6IGZCj/Z6f7MrmOOwm1Jk4 Mf/w== X-Gm-Message-State: AOAM530pkx5YWKudAoAS4iMVWKOip+VeP8GfzWYELUXb8PDDiyyRYy+X Y3Qw/s3qa0pNvQbYWHcc0ByGGD6oyamZVw== X-Google-Smtp-Source: ABdhPJztqNFvzXrMnx3R0PVNk8UqQZD+7Iy2i1Rgg0eLwV9QGWyWB7Y2f3QS5GSFLwM/2/iMrFCKSg== X-Received: by 2002:a05:600c:154c:b0:382:6377:14bd with SMTP id f12-20020a05600c154c00b00382637714bdmr9949277wmg.125.1646671636166; Mon, 07 Mar 2022 08:47:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/18] util: Share qemu_try_memalign() implementation between POSIX and Windows Date: Mon, 7 Mar 2022 16:46:56 +0000 Message-Id: <20220307164709.2503250-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::335 (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=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671735245100001 The qemu_try_memalign() functions for POSIX and Windows used to be significantly different, but these days they are identical except for the actual allocation function called, and the POSIX version already has to have ifdeffery for different allocation functions. Move to a single implementation in memalign.c, which uses the Windows _aligned_malloc if we detect that function in meson. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220226180723.1706285-7-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- meson.build | 1 + util/memalign.c | 39 +++++++++++++++++++++++++++++++++++++++ util/oslib-posix.c | 29 ----------------------------- util/oslib-win32.c | 17 ----------------- 4 files changed, 40 insertions(+), 46 deletions(-) diff --git a/meson.build b/meson.build index b541506c1c5..bc0ac931e1a 100644 --- a/meson.build +++ b/meson.build @@ -1622,6 +1622,7 @@ config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has= _function('posix_fallocate' # Note that we need to specify prefix: here to avoid incorrectly # thinking that Windows has posix_memalign() config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memal= ign', prefix: '#include ')) +config_host_data.set('CONFIG_ALIGNED_MALLOC', cc.has_function('_aligned_ma= lloc')) config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwai= t', dependencies: threads)) diff --git a/util/memalign.c b/util/memalign.c index 6dfc20abbb1..22b405700e3 100644 --- a/util/memalign.c +++ b/util/memalign.c @@ -25,6 +25,45 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/host-utils.h" +#include "trace.h" + +void *qemu_try_memalign(size_t alignment, size_t size) +{ + void *ptr; + + if (alignment < sizeof(void*)) { + alignment =3D sizeof(void*); + } else { + g_assert(is_power_of_2(alignment)); + } + + /* + * Handling of 0 allocations varies among the different + * platform APIs (for instance _aligned_malloc() will + * fail) -- ensure that we always return a valid non-NULL + * pointer that can be freed by qemu_vfree(). + */ + if (size =3D=3D 0) { + size++; + } +#if defined(CONFIG_POSIX_MEMALIGN) + int ret; + ret =3D posix_memalign(&ptr, alignment, size); + if (ret !=3D 0) { + errno =3D ret; + ptr =3D NULL; + } +#elif defined(CONFIG_ALIGNED_MALLOC) + ptr =3D _aligned_malloc(size, alignment); +#elif defined(CONFIG_BSD) + ptr =3D valloc(size); +#else + ptr =3D memalign(alignment, size); +#endif + trace_qemu_memalign(alignment, size, ptr); + return ptr; +} =20 void *qemu_memalign(size_t alignment, size_t size) { diff --git a/util/oslib-posix.c b/util/oslib-posix.c index f7e22f4ff9b..91798f7e504 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -199,35 +199,6 @@ fail_close: return false; } =20 -void *qemu_try_memalign(size_t alignment, size_t size) -{ - void *ptr; - - if (alignment < sizeof(void*)) { - alignment =3D sizeof(void*); - } else { - g_assert(is_power_of_2(alignment)); - } - - if (size =3D=3D 0) { - size++; - } -#if defined(CONFIG_POSIX_MEMALIGN) - int ret; - ret =3D posix_memalign(&ptr, alignment, size); - if (ret !=3D 0) { - errno =3D ret; - ptr =3D NULL; - } -#elif defined(CONFIG_BSD) - ptr =3D valloc(size); -#else - ptr =3D memalign(alignment, size); -#endif - trace_qemu_memalign(alignment, size, ptr); - return ptr; -} - /* alloc shared memory pages */ void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared, bool noreserve) diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 8c28d70904d..d9768532bec 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -44,23 +44,6 @@ /* this must come after including "trace.h" */ #include =20 -void *qemu_try_memalign(size_t alignment, size_t size) -{ - void *ptr; - - if (alignment < sizeof(void *)) { - alignment =3D sizeof(void *); - } else { - g_assert(is_power_of_2(alignment)); - } - if (size =3D=3D 0) { - size++; - } - ptr =3D _aligned_malloc(size, alignment); - trace_qemu_memalign(alignment, size, ptr); - return ptr; -} - static int get_allocation_granularity(void) { SYSTEM_INFO system_info; --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672080; cv=none; d=zohomail.com; s=zohoarc; b=TSMF6csF3bxqRoSXxYy8U2M9EarcLgYxL0DB5/v2PiskIhI0BSFevF7K+7oe+XsYJka8x2ORvbRbXg/BT1C8JsfUTwkC3HuivVZtbKsftEpLMCmaOuz0Nz/9fx+R4g+B5jUfZvdhdQD6YS/BqziPm+XxFBOe4lddS70NrfuWHec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672080; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NaCmncalisG2HmxfoLWWRFVxRQONisu66EFRvxsSlWo=; b=f2b1tB/b/bmB+qGdrNKZYZZXZfSlhGUJDNK1cTyEw0yeymmMaZvQE9TUwJkF+0pIeUkskObQ5rR7lNHHRSJO6BuQk9Q9Zt4EknAbrsOzL2y9/5hnD/Jn+Ehyv3JbQUHyYUTGt+s6PrzFWbd/KmTjH+esKNsimh16ocLGq+Xwlcc= 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 1646672080412998.1796954595219; Mon, 7 Mar 2022 08:54:40 -0800 (PST) Received: from localhost ([::1]:58042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGd5-0001Yc-7u for importer@patchew.org; Mon, 07 Mar 2022 11:54:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGVz-0001Um-Qx for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:19 -0500 Received: from [2a00:1450:4864:20::335] (port=42741 helo=mail-wm1-x335.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVy-0007je-74 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:19 -0500 Received: by mail-wm1-x335.google.com with SMTP id r187-20020a1c2bc4000000b003810e6b192aso9669636wmr.1 for ; Mon, 07 Mar 2022 08:47:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NaCmncalisG2HmxfoLWWRFVxRQONisu66EFRvxsSlWo=; b=F/wj2lrRFSQ/W1yKkYWTYcQlJt81DPS3nXJ09Sa+3XiMHXwxa9ojTCkYKrc8Wxj9nP CCU6rmxOZzZ5q1oJS4mSyXkcVvSW5VlvOQawsmLOwZmhNWPiUARBXmvg6jtyKgNw3GW8 h9D0Ddz1mXT9NmIdVZ4m9VzqJ6+yXxe1dKckucpXfkVVDzCnRFscl/XjCzf6K1mqyCfT rIKktLmwgk2joL0KYU2fPjJL2uaFKf8b3Fu/6QTSqoDwxZEn5ze2nsV1uTEN/AQzRoxN 7vb2F7jcvoKrRo8Gpj4O3Y/Z2kBRo/zhujmtGe1emp5yuB5ibPVDU80yS31soL6hBIw0 CGVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NaCmncalisG2HmxfoLWWRFVxRQONisu66EFRvxsSlWo=; b=T8Cy60/LZ9fIFWAxxTCSO0/tUcovpCnpPzIY2A8FXYXOXCgqKlaPQ3kEAkGUNN9dXA ByxCN3mhQj2zeIuezFlZSsl9RWqve4nvWPnlxI7nUWVjBY3q2VM2i1Bqoss2f4i7Gzex g7GJYeM6mVkF5YpE2DBYhBSAxGyHNKyPDfjFZIU+slWUYyP6XcgqCq4okrtRFvgJa7/4 Tb8db8AmDUCLDcKGP6UHggHmg9sqlDup+Mxy67/dhbie96EVnSfElAzDeBRcPcTn3byZ AfWpKbkOwdAOaiFfFGBFzHXRh2r6bbyaWOig78i61enFmw0Se85EKLyy8kJncJEljwz0 c8Dg== X-Gm-Message-State: AOAM5317/2Lf/DTDpE5sO1edn+XDjca+4LmkX4wCX7RW41NyCin4fdVe N4uNcIZdQKGQuAvMRkMcqcYkINktNUP7dw== X-Google-Smtp-Source: ABdhPJyxbr7Aynx3ejmWPr3lvECPf0iHAxZpPRbvchRwceYs4hiOzNBURh2Cry+MZCo2KmW4Cr8Xfg== X-Received: by 2002:a05:600c:4f0c:b0:389:990e:d9f4 with SMTP id l12-20020a05600c4f0c00b00389990ed9f4mr8490955wmq.90.1646671636900; Mon, 07 Mar 2022 08:47:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/18] util: Use meson checks for valloc() and memalign() presence Date: Mon, 7 Mar 2022 16:46:57 +0000 Message-Id: <20220307164709.2503250-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::335 (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=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672082740100001 Instead of assuming that all CONFIG_BSD have valloc() and anything else is memalign(), explicitly check for those functions in meson.build and use the "is the function present" define. Tests for specific functionality are better than which-OS checks; this also lets us give a helpful error message if somehow there's no usable function present. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20220226180723.1706285-8-peter.maydell@linaro.org --- meson.build | 2 ++ util/memalign.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index bc0ac931e1a..774d0248a62 100644 --- a/meson.build +++ b/meson.build @@ -1623,6 +1623,8 @@ config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has= _function('posix_fallocate' # thinking that Windows has posix_memalign() config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memal= ign', prefix: '#include ')) config_host_data.set('CONFIG_ALIGNED_MALLOC', cc.has_function('_aligned_ma= lloc')) +config_host_data.set('CONFIG_VALLOC', cc.has_function('valloc')) +config_host_data.set('CONFIG_MEMALIGN', cc.has_function('memalign')) config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwai= t', dependencies: threads)) diff --git a/util/memalign.c b/util/memalign.c index 22b405700e3..083aaae619c 100644 --- a/util/memalign.c +++ b/util/memalign.c @@ -56,10 +56,12 @@ void *qemu_try_memalign(size_t alignment, size_t size) } #elif defined(CONFIG_ALIGNED_MALLOC) ptr =3D _aligned_malloc(size, alignment); -#elif defined(CONFIG_BSD) +#elif defined(CONFIG_VALLOC) ptr =3D valloc(size); -#else +#elif defined(CONFIG_MEMALIGN) ptr =3D memalign(alignment, size); +#else + #error No function to allocate aligned memory available #endif trace_qemu_memalign(alignment, size, ptr); return ptr; --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672158; cv=none; d=zohomail.com; s=zohoarc; b=MI2ZFjea0EoME6ssFXeJAicUvKMBsX8kLl3ViGFt9jiNJWHVpF9jbtgWERywaplv9XbdRpN/6GsIyIhhcaAHipC+KZbCbp/C2+EIlbSwevouUQaTyWtdaBthm0puvivxl0G7sB3gRcbYIm9PmIyIv8uoDkuMPswkRDYYGhPkOKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672158; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FESTC/0BZsNEujezQb148jTd0VqMzayMHKHa6G291j4=; b=TWlrxVyDDu0ae2SNh3EgKVzBMCcOSSFvBl2iLr1qMZdfPzJ7gBAbTK9WTnnlOpyKUPel4OD+TllHrKmpz8wGqPsWEBoMs+YFMGdm6ZUJjGxt5tQlG4lN9U4vj+1AIQcfrvmDLLkcaFMh8dPMWyDss36xgTqSMaMipMDaGn7pH00= 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 1646672158485350.4468987237084; Mon, 7 Mar 2022 08:55:58 -0800 (PST) Received: from localhost ([::1]:35896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGeL-0005Tm-Ac for importer@patchew.org; Mon, 07 Mar 2022 11:55:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW0-0001Wp-H9 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:20 -0500 Received: from [2a00:1450:4864:20::32c] (port=33993 helo=mail-wm1-x32c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGVy-0007jw-VU for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:20 -0500 Received: by mail-wm1-x32c.google.com with SMTP id k8-20020a05600c1c8800b003899c7ac55dso197080wms.1 for ; Mon, 07 Mar 2022 08:47:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=FESTC/0BZsNEujezQb148jTd0VqMzayMHKHa6G291j4=; b=bcyXpi2u7b757mR/7vciHB5XPXLe+n8WxN07JDjKkVVzm16Zh1Q5RevZwwHbVPwFV7 w40o2w3MlOR8nfWt6+auDqXgih/+xvSlnzBMq2dA+f3zXK8cyinvavjm2sd7uxrwcTFE GoJ2QesyiSUKFL4JdRrTAmo49tjkgE1V5nDTtz8T/5g1j4cJolPhuz6Ta0N5nqKWj+iR afgX7Lh8gKqHALiVnXpr+3joa2Vgo+bRHv+amRvter1b53VNUFMmoWljqER2xcRcA9Vw eXATzt8VTce82c+w/30IrVP1rrKDaub6dvBSZhcHZL/5PrfUu0wrTkofE/D9+0F38sTE wzAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FESTC/0BZsNEujezQb148jTd0VqMzayMHKHa6G291j4=; b=hQ1NYv0Jqku/+adTzHGvBffLF297lu4YFDMizewEolSHwX6RNLRsNIQPN3v7v5Zmpu HsvLUsJotzZ3kGbAl9RSOVwybgK2EJ8N6Og8zi68IeIKhFr9IzAw/zwxPMC916W586pM DwOU0q3jOPLHg/+z7COoKsc0CNbGLKB/aMtw6Ylo6rQMWkRRCz/MMwUB2FwlqXbT69AX UMad+AknWGzEfRUyJ2vulONr4fif8NTdOTpiGQnjblhr59IqSwXDBcwWBw3jZ3liUD8H wHvBCDlHvSzhY9IR/w/nrklyUiPkw1qV6+umYptaMdechsyp+eXVBvWrrYfkAbjlqLi9 pBJQ== X-Gm-Message-State: AOAM5301k0Nk0HBrcgAAgC0k/SEGLO2Vx1u4RcGn8/RORaKPknHsT7jg ScJfUR+Mw7ZibukBzt0yp27l5eqaNT5vwA== X-Google-Smtp-Source: ABdhPJxte/Gqa2PiRTUA1wKNs5vphw9dtnBbtq0cR38CT1ARlb7U0sG9Bg8R3rX08xvYvYoIwqhvbw== X-Received: by 2002:a05:600c:2846:b0:389:9347:9aaf with SMTP id r6-20020a05600c284600b0038993479aafmr9635461wmb.87.1646671637689; Mon, 07 Mar 2022 08:47:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/18] util: Put qemu_vfree() in memalign.c Date: Mon, 7 Mar 2022 16:46:58 +0000 Message-Id: <20220307164709.2503250-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32c (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=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672160729100003 qemu_vfree() is the companion free function to qemu_memalign(); put it in memalign.c so the allocation and free functions are together. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220226180723.1706285-9-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- util/memalign.c | 11 +++++++++++ util/oslib-posix.c | 6 ------ util/oslib-win32.c | 6 ------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/util/memalign.c b/util/memalign.c index 083aaae619c..440b8fd9a76 100644 --- a/util/memalign.c +++ b/util/memalign.c @@ -78,3 +78,14 @@ void *qemu_memalign(size_t alignment, size_t size) size, alignment, strerror(errno)); abort(); } + +void qemu_vfree(void *ptr) +{ + trace_qemu_vfree(ptr); +#if !defined(CONFIG_POSIX_MEMALIGN) && defined(CONFIG_ALIGNED_MALLOC) + /* Only Windows _aligned_malloc needs a special free function */ + _aligned_free(ptr); +#else + free(ptr); +#endif +} diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 91798f7e504..2ebfb750578 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -220,12 +220,6 @@ void *qemu_anon_ram_alloc(size_t size, uint64_t *align= ment, bool shared, return ptr; } =20 -void qemu_vfree(void *ptr) -{ - trace_qemu_vfree(ptr); - free(ptr); -} - void qemu_anon_ram_free(void *ptr, size_t size) { trace_qemu_anon_ram_free(ptr, size); diff --git a/util/oslib-win32.c b/util/oslib-win32.c index d9768532bec..4b1ce0be4b0 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -75,12 +75,6 @@ void *qemu_anon_ram_alloc(size_t size, uint64_t *align, = bool shared, return ptr; } =20 -void qemu_vfree(void *ptr) -{ - trace_qemu_vfree(ptr); - _aligned_free(ptr); -} - void qemu_anon_ram_free(void *ptr, size_t size) { trace_qemu_anon_ram_free(ptr, size); --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671739; cv=none; d=zohomail.com; s=zohoarc; b=Nb+hkzuD8SMdSLTM4snyZyvU9K0P2kk73TAJ1oL0MqDasgRBuPCk9niR22xAUmRw2bx7S9HZVpKjI3IE3miKaMqICD0i0StjnBiAvh+bAuXtgZVYYyxFNp1/De0nl3yTP6N1lRe1pGsWOn2eS/BfEpNkJiNaEsY1V2Xd+aCYyY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671739; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NXJeKfiydTxWODRLKaEdrTagQPu6Toife0/QFAZ3RT4=; b=MGXNyik6fx/N7Iba5UveB1zybLZ9v/BRJPTFPR2wXE40dhbtry/cE59g6fv2lJeyA1DvSkyzzs+lytwvKjNBSfRrIVxt8RGVBO1ZX7dfvOTm9ioBSW9zY2UiziN6xBsO/TRm1wwoTjfQRTHNcIWCl12y8w1pegh8NyqUOzRuKhE= 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 1646671739253884.6178082513385; Mon, 7 Mar 2022 08:48:59 -0800 (PST) Received: from localhost ([::1]:37074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGXa-0004Ws-Ne for importer@patchew.org; Mon, 07 Mar 2022 11:48:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW3-0001fm-9p for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:23 -0500 Received: from [2a00:1450:4864:20::32e] (port=36380 helo=mail-wm1-x32e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW0-0007kP-GC for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:23 -0500 Received: by mail-wm1-x32e.google.com with SMTP id n31-20020a05600c3b9f00b003898fc06f1eso486244wms.1 for ; Mon, 07 Mar 2022 08:47:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NXJeKfiydTxWODRLKaEdrTagQPu6Toife0/QFAZ3RT4=; b=Rs5MFR6sMT7EKbRlfxu/ozi59p30i2ldUsx2rtmAhrye9pYY1ul/pa729HHnOuDRK/ C9MZ/GslSZQSf62qHCrh6RIEfAcsXQpd15dyxHNi0oE9w7tws+xZMSFrOxiB+RQO+ZkW cP+LV2QI+dHK+8PsecH87agRsOKjRtRdN97NZuueI6n5k9uqCogp5xxtENyb8rBzyczq d1uY/JZKxRWhfJrNbwWC/18eaW5o6jtpzCtvzn+9T5K5Sixt4HYQHodFFoFT4IQsUnnA 5TjXf5AmmpovvNzfwXGHy/dDQvumZmE8Z3wDGEWdQ7fn5wDSBEGuN/V7+OTBkuLcnDhH ip6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NXJeKfiydTxWODRLKaEdrTagQPu6Toife0/QFAZ3RT4=; b=dmcJHTt76OG0k+j3LQeSHFH9ay4PypOJThRgHTtBzwxLx1WAySP/TaAH6QRI6Y7ZXB 9RrlwWXWJLcSZoAapqq1te0RNN1mc2c93q2LFP26mnLuzJPCoAyEVg7b5Zkgogdzug9V cWr6SzHP+6wvISbTyb94SlQTx2HKd2xGq4ZVTI9W95zDNV4xhrko4kLv4TD1O7frElpZ M8wUAbcssXw8QuZpiOC8ZF9G+xVdwFvxcC48umfdHatz7i2ZvSLWbvXI5jLH8Rjysnqd d8eO3D1MOBjC9XmuBZyRksJ1gsUgmZTNXQs3QXfSUn4QoIfK5FdmJkdVN0+ilsUvae6M f1ig== X-Gm-Message-State: AOAM530C5OP0fk7Du30kKxzduSZe3+lIOzcCLRqMbNwxHlhuQkAQlc2Y QtwGvDrGBQrBY2tJay8RlBMQ82WF3ICwXA== X-Google-Smtp-Source: ABdhPJwQOof+/ye+uympgiHJhWjmcftRZkfyZqJKsQQzi7gMdt9AuX5saFcPIHE5KdV6PYvyOA7auA== X-Received: by 2002:a7b:cb8d:0:b0:389:7389:ff9b with SMTP id m13-20020a7bcb8d000000b003897389ff9bmr9994118wmi.32.1646671638899; Mon, 07 Mar 2022 08:47:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/18] osdep: Move memalign-related functions to their own header Date: Mon, 7 Mar 2022 16:46:59 +0000 Message-Id: <20220307164709.2503250-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32e (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=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671741097100001 Move the various memalign-related functions out of osdep.h and into their own header, which we include only where they are used. While we're doing this, add some brief documentation comments. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20220226180723.1706285-10-peter.maydell@linaro.org --- include/qemu/memalign.h | 61 ++++++++++++++++++++++++++++++++++ include/qemu/osdep.h | 18 ---------- block/blkverify.c | 1 + block/block-copy.c | 1 + block/commit.c | 1 + block/crypto.c | 1 + block/dmg.c | 1 + block/export/fuse.c | 1 + block/file-posix.c | 1 + block/io.c | 1 + block/mirror.c | 1 + block/nvme.c | 1 + block/parallels-ext.c | 1 + block/parallels.c | 1 + block/qcow.c | 1 + block/qcow2-cache.c | 1 + block/qcow2-cluster.c | 1 + block/qcow2-refcount.c | 1 + block/qcow2-snapshot.c | 1 + block/qcow2.c | 1 + block/qed-l2-cache.c | 1 + block/qed-table.c | 1 + block/qed.c | 1 + block/quorum.c | 1 + block/raw-format.c | 1 + block/vdi.c | 1 + block/vhdx-log.c | 1 + block/vhdx.c | 1 + block/vmdk.c | 1 + block/vpc.c | 1 + block/win32-aio.c | 1 + hw/block/dataplane/xen-block.c | 1 + hw/block/fdc.c | 1 + hw/ide/core.c | 1 + hw/ppc/spapr.c | 1 + hw/ppc/spapr_softmmu.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/tpm/tpm_ppi.c | 2 +- nbd/server.c | 1 + net/l2tpv3.c | 2 +- plugins/loader.c | 1 + qemu-img.c | 1 + qemu-io-cmds.c | 1 + qom/object.c | 1 + softmmu/physmem.c | 1 + target/i386/hvf/hvf.c | 1 + target/i386/kvm/kvm.c | 1 + tcg/region.c | 1 + tests/bench/atomic_add-bench.c | 1 + tests/bench/qht-bench.c | 1 + util/atomic64.c | 1 + util/memalign.c | 1 + util/qht.c | 1 + 53 files changed, 112 insertions(+), 20 deletions(-) create mode 100644 include/qemu/memalign.h diff --git a/include/qemu/memalign.h b/include/qemu/memalign.h new file mode 100644 index 00000000000..fa299f3bf67 --- /dev/null +++ b/include/qemu/memalign.h @@ -0,0 +1,61 @@ +/* + * Allocation and free functions for aligned memory + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_MEMALIGN_H +#define QEMU_MEMALIGN_H + +/** + * qemu_try_memalign: Allocate aligned memory + * @alignment: required alignment, in bytes + * @size: size of allocation, in bytes + * + * Allocate memory on an aligned boundary (i.e. the returned + * address will be an exact multiple of @alignment). + * @alignment must be a power of 2, or the function will assert(). + * On success, returns allocated memory; on failure, returns NULL. + * + * The memory allocated through this function must be freed via + * qemu_vfree() (and not via free()). + */ +void *qemu_try_memalign(size_t alignment, size_t size); +/** + * qemu_memalign: Allocate aligned memory, without failing + * @alignment: required alignment, in bytes + * @size: size of allocation, in bytes + * + * Allocate memory in the same way as qemu_try_memalign(), but + * abort() with an error message if the memory allocation fails. + * + * The memory allocated through this function must be freed via + * qemu_vfree() (and not via free()). + */ +void *qemu_memalign(size_t alignment, size_t size); +/** + * qemu_vfree: Free memory allocated through qemu_memalign + * @ptr: memory to free + * + * This function must be used to free memory allocated via qemu_memalign() + * or qemu_try_memalign(). (Using the wrong free function will cause + * subtle bugs on Windows hosts.) + */ +void qemu_vfree(void *ptr); +/* + * It's an analog of GLIB's g_autoptr_cleanup_generic_gfree(), used to def= ine + * g_autofree macro. + */ +static inline void qemu_cleanup_generic_vfree(void *p) +{ + void **pp =3D (void **)p; + qemu_vfree(*pp); +} + +/* + * Analog of g_autofree, but qemu_vfree is called on cleanup instead of g_= free. + */ +#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)= )) + +#endif diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 7bcce3bceb0..bc3df26da36 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -379,28 +379,10 @@ extern "C" { #endif =20 int qemu_daemon(int nochdir, int noclose); -void *qemu_try_memalign(size_t alignment, size_t size); -void *qemu_memalign(size_t alignment, size_t size); void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared, bool noreserve); -void qemu_vfree(void *ptr); void qemu_anon_ram_free(void *ptr, size_t size); =20 -/* - * It's an analog of GLIB's g_autoptr_cleanup_generic_gfree(), used to def= ine - * g_autofree macro. - */ -static inline void qemu_cleanup_generic_vfree(void *p) -{ - void **pp =3D (void **)p; - qemu_vfree(*pp); -} - -/* - * Analog of g_autofree, but qemu_vfree is called on cleanup instead of g_= free. - */ -#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)= )) - #ifdef _WIN32 #define HAVE_CHARDEV_SERIAL 1 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ diff --git a/block/blkverify.c b/block/blkverify.c index d1facf5ba90..53ba1c91957 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -16,6 +16,7 @@ #include "qemu/cutils.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/memalign.h" =20 typedef struct { BdrvChild *test_file; diff --git a/block/block-copy.c b/block/block-copy.c index ce116318b57..619e5580faf 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -22,6 +22,7 @@ #include "qemu/coroutine.h" #include "block/aio_task.h" #include "qemu/error-report.h" +#include "qemu/memalign.h" =20 #define BLOCK_COPY_MAX_COPY_RANGE (16 * MiB) #define BLOCK_COPY_MAX_BUFFER (1 * MiB) diff --git a/block/commit.c b/block/commit.c index c76899f640c..851d1c557a1 100644 --- a/block/commit.c +++ b/block/commit.c @@ -20,6 +20,7 @@ #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" +#include "qemu/memalign.h" #include "sysemu/block-backend.h" =20 enum { diff --git a/block/crypto.c b/block/crypto.c index 9d5fecbef86..1ba82984efe 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -31,6 +31,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" #include "crypto.h" =20 typedef struct BlockCrypto BlockCrypto; diff --git a/block/dmg.c b/block/dmg.c index 447901fbb87..c626587f9c5 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -27,6 +27,7 @@ #include "qemu/bswap.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "qemu/memalign.h" #include "dmg.h" =20 int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, diff --git a/block/export/fuse.c b/block/export/fuse.c index 5029e70f843..e80b24a8671 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -19,6 +19,7 @@ #define FUSE_USE_VERSION 31 =20 #include "qemu/osdep.h" +#include "qemu/memalign.h" #include "block/aio.h" #include "block/block.h" #include "block/export.h" diff --git a/block/file-posix.c b/block/file-posix.c index 1f1756e192a..c000a61db29 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -31,6 +31,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "qemu/units.h" +#include "qemu/memalign.h" #include "trace.h" #include "block/thread-pool.h" #include "qemu/iov.h" diff --git a/block/io.c b/block/io.c index efc011ce657..8e621a49464 100644 --- a/block/io.c +++ b/block/io.c @@ -32,6 +32,7 @@ #include "block/coroutines.h" #include "block/write-threshold.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/block/mirror.c b/block/mirror.c index ce6bc58d1f4..d8ecb9efa29 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -23,6 +23,7 @@ #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #include "qemu/bitmap.h" +#include "qemu/memalign.h" =20 #define MAX_IN_FLIGHT 16 #define MAX_IO_BYTES (1 << 20) /* 1 Mb */ diff --git a/block/nvme.c b/block/nvme.c index dd20de3865b..552029931d5 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -21,6 +21,7 @@ #include "qemu/module.h" #include "qemu/cutils.h" #include "qemu/option.h" +#include "qemu/memalign.h" #include "qemu/vfio-helpers.h" #include "block/block_int.h" #include "sysemu/replay.h" diff --git a/block/parallels-ext.c b/block/parallels-ext.c index e0dd0975c6f..cb22a427d72 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -29,6 +29,7 @@ #include "parallels.h" #include "crypto/hash.h" #include "qemu/uuid.h" +#include "qemu/memalign.h" =20 #define PARALLELS_FORMAT_EXTENSION_MAGIC 0xAB234CEF23DCEA87ULL =20 diff --git a/block/parallels.c b/block/parallels.c index e58c8284222..cd23e02d06c 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -41,6 +41,7 @@ #include "qapi/qapi-visit-block-core.h" #include "qemu/bswap.h" #include "qemu/bitmap.h" +#include "qemu/memalign.h" #include "migration/blocker.h" #include "parallels.h" =20 diff --git a/block/qcow.c b/block/qcow.c index c39940f33eb..4fba1b9e364 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -32,6 +32,7 @@ #include "qemu/option.h" #include "qemu/bswap.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" #include #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 7444b9c4ab0..8a0105911f7 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/memalign.h" #include "qcow2.h" #include "trace.h" =20 diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 21884a1ab9a..20a16ba6ee0 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "qcow2.h" #include "qemu/bswap.h" +#include "qemu/memalign.h" #include "trace.h" =20 int qcow2_shrink_l1_table(BlockDriverState *bs, uint64_t exact_size) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 46145722527..94033972bed 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -28,6 +28,7 @@ #include "qemu/range.h" #include "qemu/bswap.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" #include "trace.h" =20 static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size, diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 71ddb08c212..075269a0237 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -29,6 +29,7 @@ #include "qemu/bswap.h" #include "qemu/error-report.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" =20 static void qcow2_free_single_snapshot(BlockDriverState *bs, int i) { diff --git a/block/qcow2.c b/block/qcow2.c index c8115e1cba0..b5c47931ef4 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -38,6 +38,7 @@ #include "qemu/option_int.h" #include "qemu/cutils.h" #include "qemu/bswap.h" +#include "qemu/memalign.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-block-core.h" #include "crypto.h" diff --git a/block/qed-l2-cache.c b/block/qed-l2-cache.c index b5483623989..caf2c024c2d 100644 --- a/block/qed-l2-cache.c +++ b/block/qed-l2-cache.c @@ -51,6 +51,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/memalign.h" #include "trace.h" #include "qed.h" =20 diff --git a/block/qed-table.c b/block/qed-table.c index 405d446cbe7..1cc844b1a5f 100644 --- a/block/qed-table.c +++ b/block/qed-table.c @@ -17,6 +17,7 @@ #include "qemu/sockets.h" /* for EINPROGRESS on Windows */ #include "qed.h" #include "qemu/bswap.h" +#include "qemu/memalign.h" =20 /* Called with table_lock held. */ static int coroutine_fn qed_read_table(BDRVQEDState *s, uint64_t offset, diff --git a/block/qed.c b/block/qed.c index 558d3646c4b..f34d9a3ac1a 100644 --- a/block/qed.c +++ b/block/qed.c @@ -20,6 +20,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/memalign.h" #include "trace.h" #include "qed.h" #include "sysemu/block-backend.h" diff --git a/block/quorum.c b/block/quorum.c index c28dda7baac..f33f30d36b8 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -17,6 +17,7 @@ #include "qemu/cutils.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/memalign.h" #include "block/block_int.h" #include "block/coroutines.h" #include "block/qdict.h" diff --git a/block/raw-format.c b/block/raw-format.c index bda757fd195..69fd650eaf7 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -31,6 +31,7 @@ #include "qapi/error.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/memalign.h" =20 typedef struct BDRVRawState { uint64_t offset; diff --git a/block/vdi.c b/block/vdi.c index bdc58d726ee..cca3a3a3567 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -64,6 +64,7 @@ #include "qemu/coroutine.h" #include "qemu/cutils.h" #include "qemu/uuid.h" +#include "qemu/memalign.h" =20 /* Code configuration options. */ =20 diff --git a/block/vhdx-log.c b/block/vhdx-log.c index 7672161d955..ff0d4e0da05 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -23,6 +23,7 @@ #include "block/block_int.h" #include "qemu/error-report.h" #include "qemu/bswap.h" +#include "qemu/memalign.h" #include "vhdx.h" =20 =20 diff --git a/block/vhdx.c b/block/vhdx.c index 356ec4c455a..410c6f96101 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -25,6 +25,7 @@ #include "qemu/crc32c.h" #include "qemu/bswap.h" #include "qemu/error-report.h" +#include "qemu/memalign.h" #include "vhdx.h" #include "migration/blocker.h" #include "qemu/uuid.h" diff --git a/block/vmdk.c b/block/vmdk.c index 0dfab6e9413..37c0946066e 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -33,6 +33,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "qemu/bswap.h" +#include "qemu/memalign.h" #include "migration/blocker.h" #include "qemu/cutils.h" #include diff --git a/block/vpc.c b/block/vpc.c index 297a26262ab..4d8f16e1990 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -33,6 +33,7 @@ #include "migration/blocker.h" #include "qemu/bswap.h" #include "qemu/uuid.h" +#include "qemu/memalign.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-block-core.h" diff --git a/block/win32-aio.c b/block/win32-aio.c index c57e10c9979..aadc7b1bc3c 100644 --- a/block/win32-aio.c +++ b/block/win32-aio.c @@ -29,6 +29,7 @@ #include "block/raw-aio.h" #include "qemu/event_notifier.h" #include "qemu/iov.h" +#include "qemu/memalign.h" #include #include =20 diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index 860787580a3..2785b9e8497 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +#include "qemu/memalign.h" #include "qapi/error.h" #include "hw/xen/xen_common.h" #include "hw/block/xen_blkif.h" diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 21d18ac2e36..347875a0cda 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -32,6 +32,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/timer.h" +#include "qemu/memalign.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" diff --git a/hw/ide/core.c b/hw/ide/core.c index 33463d9b8f2..a7ac4de18ad 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -30,6 +30,7 @@ #include "qemu/main-loop.h" #include "qemu/timer.h" #include "qemu/hw-version.h" +#include "qemu/memalign.h" #include "sysemu/sysemu.h" #include "sysemu/blockdev.h" #include "sysemu/dma.h" diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4cc204f90df..953fc65fa86 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -27,6 +27,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/datadir.h" +#include "qemu/memalign.h" #include "qapi/error.h" #include "qapi/qapi-events-machine.h" #include "qapi/qapi-events-qdev.h" diff --git a/hw/ppc/spapr_softmmu.c b/hw/ppc/spapr_softmmu.c index 4ee03c83e48..5170a33369e 100644 --- a/hw/ppc/spapr_softmmu.c +++ b/hw/ppc/spapr_softmmu.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" #include "cpu.h" #include "helper_regs.h" #include "hw/ppc/spapr.h" diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 3666b8d9468..072686ed58f 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -26,6 +26,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/hw-version.h" +#include "qemu/memalign.h" #include "hw/scsi/scsi.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h" diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c index 6dbb9f41e40..c89ac53e65e 100644 --- a/hw/tpm/tpm_ppi.c +++ b/hw/tpm/tpm_ppi.c @@ -12,7 +12,7 @@ */ =20 #include "qemu/osdep.h" - +#include "qemu/memalign.h" #include "qapi/error.h" #include "sysemu/memory_mapping.h" #include "migration/vmstate.h" diff --git a/nbd/server.c b/nbd/server.c index 9fb2f264023..53e68cf027f 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -25,6 +25,7 @@ #include "trace.h" #include "nbd-internal.h" #include "qemu/units.h" +#include "qemu/memalign.h" =20 #define NBD_META_ID_BASE_ALLOCATION 0 #define NBD_META_ID_ALLOCATION_DEPTH 1 diff --git a/net/l2tpv3.c b/net/l2tpv3.c index e4d4218db69..b8faa8796c8 100644 --- a/net/l2tpv3.c +++ b/net/l2tpv3.c @@ -34,7 +34,7 @@ #include "qemu/sockets.h" #include "qemu/iov.h" #include "qemu/main-loop.h" - +#include "qemu/memalign.h" =20 /* The buffer size needs to be investigated for optimum numbers and * optimum means of paging in on different systems. This size is diff --git a/plugins/loader.c b/plugins/loader.c index 4883b0a1cbc..88c30bde2d6 100644 --- a/plugins/loader.c +++ b/plugins/loader.c @@ -27,6 +27,7 @@ #include "qemu/cacheinfo.h" #include "qemu/xxhash.h" #include "qemu/plugin.h" +#include "qemu/memalign.h" #include "hw/core/cpu.h" #include "exec/exec-all.h" #ifndef CONFIG_USER_ONLY diff --git a/qemu-img.c b/qemu-img.c index 6fe2466032f..5dffb3e6160 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -42,6 +42,7 @@ #include "qemu/module.h" #include "qemu/sockets.h" #include "qemu/units.h" +#include "qemu/memalign.h" #include "qom/object_interfaces.h" #include "sysemu/block-backend.h" #include "block/block_int.h" diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 46593d632d8..633b46cdb25 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -21,6 +21,7 @@ #include "qemu/option.h" #include "qemu/timer.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" =20 #define CMD_NOFILE_OK 0x01 =20 diff --git a/qom/object.c b/qom/object.c index 9f7a33139d4..4048a2fef1e 100644 --- a/qom/object.c +++ b/qom/object.c @@ -16,6 +16,7 @@ #include "qom/object.h" #include "qom/object_interfaces.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" #include "qapi/visitor.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" diff --git a/softmmu/physmem.c b/softmmu/physmem.c index a13289a594a..59dcf13faf4 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -42,6 +42,7 @@ #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" +#include "qemu/memalign.h" #include "exec/memory.h" #include "exec/ioport.h" #include "sysemu/dma.h" diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 4ba6e82fab3..fc12c02fb21 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -49,6 +49,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/error-report.h" +#include "qemu/memalign.h" =20 #include "sysemu/hvf.h" #include "sysemu/hvf_int.h" diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 2c8feb4a6f7..83d09883020 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -37,6 +37,7 @@ #include "qemu/main-loop.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/memalign.h" #include "hw/i386/x86.h" #include "hw/i386/apic.h" #include "hw/i386/apic_internal.h" diff --git a/tcg/region.c b/tcg/region.c index 72afb357389..97ca5291d52 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -26,6 +26,7 @@ #include "qemu/units.h" #include "qemu/madvise.h" #include "qemu/mprotect.h" +#include "qemu/memalign.h" #include "qemu/cacheinfo.h" #include "qapi/error.h" #include "exec/exec-all.h" diff --git a/tests/bench/atomic_add-bench.c b/tests/bench/atomic_add-bench.c index f05471ab45c..8a6faad6ece 100644 --- a/tests/bench/atomic_add-bench.c +++ b/tests/bench/atomic_add-bench.c @@ -2,6 +2,7 @@ #include "qemu/thread.h" #include "qemu/host-utils.h" #include "qemu/processor.h" +#include "qemu/memalign.h" =20 struct thread_info { uint64_t r; diff --git a/tests/bench/qht-bench.c b/tests/bench/qht-bench.c index 2e5b70ccd04..8afe161d106 100644 --- a/tests/bench/qht-bench.c +++ b/tests/bench/qht-bench.c @@ -10,6 +10,7 @@ #include "qemu/qht.h" #include "qemu/rcu.h" #include "qemu/xxhash.h" +#include "qemu/memalign.h" =20 struct thread_stats { size_t rd; diff --git a/util/atomic64.c b/util/atomic64.c index 22983a970f1..c20d071d8e5 100644 --- a/util/atomic64.c +++ b/util/atomic64.c @@ -8,6 +8,7 @@ #include "qemu/atomic.h" #include "qemu/thread.h" #include "qemu/cacheinfo.h" +#include "qemu/memalign.h" =20 #ifdef CONFIG_ATOMIC64 #error This file must only be compiled if !CONFIG_ATOMIC64 diff --git a/util/memalign.c b/util/memalign.c index 440b8fd9a76..c199ae70732 100644 --- a/util/memalign.c +++ b/util/memalign.c @@ -26,6 +26,7 @@ =20 #include "qemu/osdep.h" #include "qemu/host-utils.h" +#include "qemu/memalign.h" #include "trace.h" =20 void *qemu_try_memalign(size_t alignment, size_t size) diff --git a/util/qht.c b/util/qht.c index 079605121b1..065fc501f44 100644 --- a/util/qht.c +++ b/util/qht.c @@ -69,6 +69,7 @@ #include "qemu/qht.h" #include "qemu/atomic.h" #include "qemu/rcu.h" +#include "qemu/memalign.h" =20 //#define QHT_DEBUG =20 --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671991; cv=none; d=zohomail.com; s=zohoarc; b=EMQVLFSuNJktBmhP2ZUscy/2MS+F4cvvCl8szIGxa1BkSM2C766JNXihcCSaFWrFA4Z6e1nmd4xa1Vfsc63m0SpcCsH1byNk7vsCM5py2jGMYZC8sf5ya5x6gyo7r0CZS2j51gMOFQwhm6gixHcq9pdFkWhJhIXACjeo+qkOSxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671991; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uwF139MRa/ui3lWjCgZadSTEZfoUO9damBLTd17IfOk=; b=a4om5ss2kjLvtfDra20UAIezo11FC7+e1XKD/MdWcKJ7q8vztSZFr7U69qlXhEDAYtONmjxU1hfYFG6lQEXM/if9bYOTvb5SQ0ic2lSx/Ox2SurgXhi7XQvyCk3hRMiOayo+FrPdnEVp5HB1UJWeMUytb23r+ZAJj/K5tV4GYe0= 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 164667199148344.44612727424578; Mon, 7 Mar 2022 08:53:11 -0800 (PST) Received: from localhost ([::1]:51612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGbf-0005lV-AF for importer@patchew.org; Mon, 07 Mar 2022 11:53:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW2-0001cm-KZ for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:22 -0500 Received: from [2a00:1450:4864:20::32d] (port=54005 helo=mail-wm1-x32d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW1-0007ka-0s for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:22 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 19so9301644wmy.3 for ; Mon, 07 Mar 2022 08:47:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=uwF139MRa/ui3lWjCgZadSTEZfoUO9damBLTd17IfOk=; b=o3RMUUxiOJv65VQuPTkA4plC6vqEKnqwELwGthRYYsMOb97IeZG5r8HkHsrk19WPrC pL85KVuCV6EJQ/GljECP0JNKWi96ascudzorEQxl1K+uD5Ts07BJfBzR00+Zq4FFpUGW gjZO8/gNhQchtMzzBKvC1gzw0DLLojbhTefdlPzipWMeJLswaDWu7MnM2KBFO4zE9YNO ATEwYr998+ZWH/lt4CE72I8MpplbzJH/I92FDFNSyjgSS6TMlRM004lMu3dSH2MeDLZY t+4EX/Pw/g8tt0uDlZJHNImE3yG5OPdDdc+gC0dm/3UlV9Ep1/VN5FIJrLYhmwPuhjPF ebgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uwF139MRa/ui3lWjCgZadSTEZfoUO9damBLTd17IfOk=; b=IANND6hb/w76F8edJxutdcrIu3h72JNSMnabjIOLm8LDE4Ily25ZmNgeic6jD9h7QP iSsQqB0fwxbdquLK0qvrZYEdXroYMmFaDyrqJb/jsfaoJHFKpQTo49YAMNCvF7tiQ2d4 h4laDJhMX19nooz8Jqfo6dETh/8hW4itYGKTSLWgqe3MpDhH376eim8CfBOyPZkJYg8j H7AMbOoUKifXLcz6kT2BzSD6P6Sj8kw17+rd2U+ddAidFeLkC3rCD/rMxycPpAqZIzFV tIlqZKtgxLdVoPWpBWOCGkkuKIWUeoRtas6Fw2z6X+/f11kB+VC6pVfaNuoO9C1JMAtL i1ew== X-Gm-Message-State: AOAM531Pt/wzQVXy7MR5fLnv1a7TA8GMv40cmMSS6OpW70TJU1aIxQGf YtltpxH8HVZz9dAQsBvMmOPDvaqg9BuoqQ== X-Google-Smtp-Source: ABdhPJwZ3SgXz/hUrwwiMngr+MzN6/RvEh1rN6DwLqQHSuRUfWlOkS2EAcNPYrxlN4XHBEzP+VWUeg== X-Received: by 2002:a05:600c:4e56:b0:389:bc4e:6ffb with SMTP id e22-20020a05600c4e5600b00389bc4e6ffbmr2223398wmq.63.1646671639710; Mon, 07 Mar 2022 08:47:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/18] target/arm/translate-neon: UNDEF if VLD1/VST1 stride bits are non-zero Date: Mon, 7 Mar 2022 16:47:00 +0000 Message-Id: <20220307164709.2503250-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32d (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=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672003267100007 Content-Type: text/plain; charset="utf-8" For VLD1/VST1 (single element to one lane) we are only accessing one register, and so the 'stride' is meaningless. The bits that would specify stride (insn bit [4] for size=3D1, bit [6] for size=3D2) are specified to be zero in the encoding (which would correspond to a stride of 1 for VLD2/VLD3/VLD4 etc), and we must UNDEF if they are not. We failed to make this check, which meant that we would incorrectly handle some instruction patterns as loads or stores instead of UNDEFing them. Enforce that stride =3D=3D 1 for the nregs =3D=3D 1 case. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/890 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Richard Henderson Message-id: 20220303113741.2156877-2-peter.maydell@linaro.org --- target/arm/translate-neon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c index 3854dd35163..072fdc1e6ee 100644 --- a/target/arm/translate-neon.c +++ b/target/arm/translate-neon.c @@ -657,6 +657,9 @@ static bool trans_VLDST_single(DisasContext *s, arg_VLD= ST_single *a) /* Catch the UNDEF cases. This is unavoidably a bit messy. */ switch (nregs) { case 1: + if (a->stride !=3D 1) { + return false; + } if (((a->align & (1 << a->size)) !=3D 0) || (a->size =3D=3D 2 && (a->align =3D=3D 1 || a->align =3D=3D 2))= ) { return false; --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672079; cv=none; d=zohomail.com; s=zohoarc; b=jJ4vihNJaCMkx6IFykNz0pP/t+MqJpsExjY5Ve47a3T+yN5QHboBtEUWLF/zIiKCbgUHHWA0sEkO2jtPplfSOqyHd/lgsq5Gv45+9dZ/G3imnsCIerXt5hkgtwutiEQc/FZxuY0+F4dETUfZeIN1+D5GyanY/c0Dy5bsDX9lols= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672079; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cuM6/+p90e9wLyBjLSQA/Njnuwiyeuurw2dGmJV2SRg=; b=JD+FHJ+QprWj+hVigu5lXyVx4MCaN7AlSN0/dAEiqolVnOelGE5lOJX+qxNlB2KvrHRHMBAD9IMUtyd/akvsWvIhMpKQQ1lw6rY02M1EbPrzmPUyKwTpvOP55fj+L6wytVP4pi/bPudgdKkzM1inYSbDpuZaFWIpctuRTzGTnuo= 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 1646672079914694.5843226429673; Mon, 7 Mar 2022 08:54:39 -0800 (PST) Received: from localhost ([::1]:58022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGd4-0001Xx-4V for importer@patchew.org; Mon, 07 Mar 2022 11:54:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW3-0001fr-9y for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:23 -0500 Received: from [2a00:1450:4864:20::42c] (port=41971 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW1-0007km-Pu for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:23 -0500 Received: by mail-wr1-x42c.google.com with SMTP id i8so24262095wrr.8 for ; Mon, 07 Mar 2022 08:47:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=cuM6/+p90e9wLyBjLSQA/Njnuwiyeuurw2dGmJV2SRg=; b=MOllhC7TI+Mxey5Cl0jmwWdbv25DDA81Z/5GU+DSJocmnSwcvx4Mti+zVkrpkoGuyI zAZyw9VhMIkvrA0T7gU4zez/ox3pYrQ2xI2vK4+l8QsQjqFguv+RtDthaKcIxr7oT7J0 WJUtF9WOxHNqwOTxHT9ja2OZJgAwETBy77IObgolt6Hn0x4w129+h9WWPwfFEYjnPcry MQWlFnQlY2t3WRyboXjZ0i7NRdm5JzhawRWMe2ZCCa5OiZ76bcbi+bQkZFuzz800AaKC HjFPbb76OltewSW76Mk1kvMCtSFRCzcoesqmryRy9qLS88le4OeMKPrADBLKJ2Mmc8gG Q6LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cuM6/+p90e9wLyBjLSQA/Njnuwiyeuurw2dGmJV2SRg=; b=Zhp032pVODN/qErYbw6TklS33tqqM90HnXX1H6YaJUo49cStVU/Qn3RxcKi42G3Tuo ZKuIMdQFEgnvbeN2L0Hl7GtfE8uP413mfmPinTOnG5/0QclcfhssN1Aeur2Nzj6pknay LDB8+0dPYNRUv4aI0M26n2D1mHfmO0MB0qlU30V2wVqXDq7KIfZdK2/nEwmXIM4lVe9T hvQIsoLTSna4HhK9not5QfBAWShGOc3XC6qKL8B9hXEyf4hEvqKQ9ezhrNcKCKVftagj AlZGkDjvbJK/g0nf23VLGQqP9P0OlbViHPzW/I6w9F1TDKTMime6md50Mt8zraR1R69v +B7w== X-Gm-Message-State: AOAM5302+OoKHzfoYbYYHpvyO9473wZMaw2NCsGd1IbFbeB0RA8ehvWB dfCDCsLSVzt44b35U1fQT3viGcEJi4avUg== X-Google-Smtp-Source: ABdhPJzWRfeSZCjR545/qCKZRJX8v2lnqoI5Tsk/OcC0RET37RDumfezHIcz6hNlWtazn9j68UQe6g== X-Received: by 2002:a5d:47c5:0:b0:1ef:f2e8:11fc with SMTP id o5-20020a5d47c5000000b001eff2e811fcmr8670979wrc.109.1646671640502; Mon, 07 Mar 2022 08:47:20 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/18] target/arm/translate-neon: Simplify align field check for VLD3 Date: Mon, 7 Mar 2022 16:47:01 +0000 Message-Id: <20220307164709.2503250-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (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=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672082741100002 Content-Type: text/plain; charset="utf-8" For VLD3 (single 3-element structure to one lane), there is no alignment specification and the alignment bits in the instruction must be zero. This is bit [4] for the size=3D0 and size=3D1 cases, and bits [5:4] for the size=3D2 case. We do this check correctly in VLDST_single(), but we write it a bit oddly: in the 'case 3' code we check for bit 0 of a->align (bit [4] of the insn), and then we fall through to the 'case 2' code which checks bit 1 of a->align (bit [5] of the insn) in the size 2 case. Replace this with just checking "is a->align non-zero" for VLD3, which lets us drop the fall-through and put the cases in this switch in numerical order. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Richard Henderson Message-id: 20220303113741.2156877-3-peter.maydell@linaro.org --- target/arm/translate-neon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c index 072fdc1e6ee..384604c0095 100644 --- a/target/arm/translate-neon.c +++ b/target/arm/translate-neon.c @@ -665,16 +665,16 @@ static bool trans_VLDST_single(DisasContext *s, arg_V= LDST_single *a) return false; } break; - case 3: - if ((a->align & 1) !=3D 0) { - return false; - } - /* fall through */ case 2: if (a->size =3D=3D 2 && (a->align & 2) !=3D 0) { return false; } break; + case 3: + if (a->align !=3D 0) { + return false; + } + break; case 4: if (a->size =3D=3D 2 && a->align =3D=3D 3) { return false; --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646671861; cv=none; d=zohomail.com; s=zohoarc; b=a4WZV2t3bIFzaj8LrddHZyUaXbyzRLde7pLfcJmpPzuU0awvrTUMoxToTooZOTO7373bwtJpl8CPzsjuenbId4k6ZKZ4l57XIn1HziT1k/PcPHRZTDe/PfApE2JIUckM6v9xyGz9jVXlU9UQpZkSCbuCui+ayRIZzeMqXRw9wco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646671861; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rTX2jK+IjrpdOkaSjScoBgbhdOK2PtRbSfSVbqxnH7w=; b=ZabFdq55d4TowOahrvLFODYU27pU5oF7itNycImp9hEzKOQEJdRfpo72+zgxQQgwvKyA14o58UkgxwGurOBNKQZT/3k+PaRSYBJYUhCQGFmkAAw17drW/5vl8EViFaKVcTEbL7i4XofM83ARtjaoyPqlQLsXoDcP8Uw87/Gbcp8= 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 1646671861286233.2499144309263; Mon, 7 Mar 2022 08:51:01 -0800 (PST) Received: from localhost ([::1]:45086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGZY-0001MS-Bp for importer@patchew.org; Mon, 07 Mar 2022 11:51:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW4-0001kW-H4 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:24 -0500 Received: from [2a00:1450:4864:20::429] (port=40744 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW2-0007kv-Kj for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:24 -0500 Received: by mail-wr1-x429.google.com with SMTP id k24so14822941wrd.7 for ; Mon, 07 Mar 2022 08:47:22 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rTX2jK+IjrpdOkaSjScoBgbhdOK2PtRbSfSVbqxnH7w=; b=Agr+lCbuFecOueyYbqoM+Rf1EdZSsdnSkVH+4JHQIlyThzzf5dq/Z9xkQ280wT01PK YLlCoPY1HMEswDOyiVbmbODUU9NxfeDl751LpMK7IexLh+mUKj4067qgZnX/qAQVt7g9 ErlUrBWXs25bY2aCALhjee0BiHznm5mg0at+qrm2gd9uZTvmow3Y0NgsYUiNKHd3RkyB pRqI+A6EpLeG74rrHvEFKEcYKyRSRX3mNDtq84ItWwZKAUA1XCOBS9yMPnLokj9F0gqD Ibq+qxF/0RhtzNNTu0gDmaZ4y6+Ph55YoU68BmJLbbr+Viau8NNTw8m2VNJXXnOzbELL XHfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rTX2jK+IjrpdOkaSjScoBgbhdOK2PtRbSfSVbqxnH7w=; b=K6pw1kj4FZsjPjvjD7P9cEH/v4nWU4CYyqCA5MJC2PuZhXixUtbjy1mC5bzqeAIVbl HfdJeXzuKpa0v1wEBHNHMh9hwVO1j6o/V1MrksCAFPQvaEXBCP9PfYmI04/nE1Sk9zC0 K0OSZBi+xytI8iCwSbgGGCmOh6waHVFSCiMMR4QYQ3dKnpyTtNDpuQuii/mwMb2B+mKP qh7wX+23+ZvkKxPhnskpOM9a8Qh/arDgZ50ZjUtlMiHqN6bt9/dkFDN/J8R9z+eUD9tV MR3Gwrs64u4XNysXoC9VXCey2o6jWmk1th+n+BauOSZRCuB6jHpvgW+32C/toRUj5Fp8 F36w== X-Gm-Message-State: AOAM533Lb+il8kXgWnmSeqkKTSyvyXgRak5jIhRSyupLZnfBNVn5PxAc 7lpA2joSBguc/gmSSJpSs0I8edvUgAAhWw== X-Google-Smtp-Source: ABdhPJycksPcOVOVw4e0a5urgaarM56kQvxnAa0UhwBWisAQhQ4qr7pN7cvIJZyw383DtYemOGNvhg== X-Received: by 2002:a05:6000:168e:b0:1f1:faee:f1c4 with SMTP id y14-20020a056000168e00b001f1faeef1c4mr3067576wrd.173.1646671641372; Mon, 07 Mar 2022 08:47:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/18] hw/intc/arm_gicv3_its: Add trace events for commands Date: Mon, 7 Mar 2022 16:47:02 +0000 Message-Id: <20220307164709.2503250-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (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=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646671882679100001 Content-Type: text/plain; charset="utf-8" When debugging code that's using the ITS, it's helpful to see tracing of the ITS commands that the guest executes. Add suitable trace events. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220303202341.2232284-2-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 28 ++++++++++++++++++++++++++-- hw/intc/trace-events | 12 ++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 4f598d3c14f..77dc702734b 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -366,6 +366,19 @@ static ItsCmdResult process_its_cmd(GICv3ITSState *s, = const uint64_t *cmdpkt, =20 devid =3D (cmdpkt[0] & DEVID_MASK) >> DEVID_SHIFT; eventid =3D cmdpkt[1] & EVENTID_MASK; + switch (cmd) { + case INTERRUPT: + trace_gicv3_its_cmd_int(devid, eventid); + break; + case CLEAR: + trace_gicv3_its_cmd_clear(devid, eventid); + break; + case DISCARD: + trace_gicv3_its_cmd_discard(devid, eventid); + break; + default: + g_assert_not_reached(); + } return do_process_its_cmd(s, devid, eventid, cmd); } =20 @@ -382,15 +395,16 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, c= onst uint64_t *cmdpkt, =20 devid =3D (cmdpkt[0] & DEVID_MASK) >> DEVID_SHIFT; eventid =3D cmdpkt[1] & EVENTID_MASK; + icid =3D cmdpkt[2] & ICID_MASK; =20 if (ignore_pInt) { pIntid =3D eventid; + trace_gicv3_its_cmd_mapi(devid, eventid, icid); } else { pIntid =3D (cmdpkt[1] & pINTID_MASK) >> pINTID_SHIFT; + trace_gicv3_its_cmd_mapti(devid, eventid, icid, pIntid); } =20 - icid =3D cmdpkt[2] & ICID_MASK; - if (devid >=3D s->dt.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes: devid %d>=3D%d", @@ -484,6 +498,7 @@ static ItsCmdResult process_mapc(GICv3ITSState *s, cons= t uint64_t *cmdpkt) } else { cte.rdbase =3D 0; } + trace_gicv3_its_cmd_mapc(icid, cte.rdbase, cte.valid); =20 if (icid >=3D s->ct.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPC: invalid ICID 0x%d", icid= ); @@ -539,6 +554,8 @@ static ItsCmdResult process_mapd(GICv3ITSState *s, cons= t uint64_t *cmdpkt) dte.ittaddr =3D (cmdpkt[2] & ITTADDR_MASK) >> ITTADDR_SHIFT; dte.valid =3D cmdpkt[2] & CMD_FIELD_VALID_MASK; =20 + trace_gicv3_its_cmd_mapd(devid, dte.size, dte.ittaddr, dte.valid); + if (devid >=3D s->dt.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPD: invalid device ID field 0x%x >=3D 0x%x\n", @@ -562,6 +579,8 @@ static ItsCmdResult process_movall(GICv3ITSState *s, co= nst uint64_t *cmdpkt) rd1 =3D FIELD_EX64(cmdpkt[2], MOVALL_2, RDBASE1); rd2 =3D FIELD_EX64(cmdpkt[3], MOVALL_3, RDBASE2); =20 + trace_gicv3_its_cmd_movall(rd1, rd2); + if (rd1 >=3D s->gicv3->num_cpu) { qemu_log_mask(LOG_GUEST_ERROR, "%s: RDBASE1 %" PRId64 @@ -601,6 +620,8 @@ static ItsCmdResult process_movi(GICv3ITSState *s, cons= t uint64_t *cmdpkt) eventid =3D FIELD_EX64(cmdpkt[1], MOVI_1, EVENTID); new_icid =3D FIELD_EX64(cmdpkt[2], MOVI_2, ICID); =20 + trace_gicv3_its_cmd_movi(devid, eventid, new_icid); + if (devid >=3D s->dt.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes: devid %d>=3D%d", @@ -779,6 +800,7 @@ static void process_cmdq(GICv3ITSState *s) * is already consistent by the time SYNC command is executed. * Hence no further processing is required for SYNC command. */ + trace_gicv3_its_cmd_sync(); break; case GITS_CMD_MAPD: result =3D process_mapd(s, cmdpkt); @@ -803,6 +825,7 @@ static void process_cmdq(GICv3ITSState *s) * need to trigger lpi priority re-calculation to be in * sync with LPI config table or pending table changes. */ + trace_gicv3_its_cmd_inv(); for (i =3D 0; i < s->gicv3->num_cpu; i++) { gicv3_redist_update_lpi(&s->gicv3->cpu[i]); } @@ -814,6 +837,7 @@ static void process_cmdq(GICv3ITSState *s) result =3D process_movall(s, cmdpkt); break; default: + trace_gicv3_its_cmd_unknown(cmd); break; } if (result =3D=3D CMD_CONTINUE) { diff --git a/hw/intc/trace-events b/hw/intc/trace-events index b28cda4e08e..e92662b405c 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -176,6 +176,18 @@ gicv3_its_write(uint64_t offset, uint64_t data, unsign= ed size) "GICv3 ITS write: gicv3_its_badwrite(uint64_t offset, uint64_t data, unsigned size) "GICv3 I= TS write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u: error" gicv3_its_translation_write(uint64_t offset, uint64_t data, unsigned size,= uint32_t requester_id) "GICv3 ITS TRANSLATER write: offset 0x%" PRIx64 " d= ata 0x%" PRIx64 " size %u requester_id 0x%x" gicv3_its_process_command(uint32_t rd_offset, uint8_t cmd) "GICv3 ITS: pro= cessing command at offset 0x%x: 0x%x" +gicv3_its_cmd_int(uint32_t devid, uint32_t eventid) "GICv3 ITS: command IN= T DeviceID 0x%x EventID 0x%x" +gicv3_its_cmd_clear(uint32_t devid, uint32_t eventid) "GICv3 ITS: command = CLEAR DeviceID 0x%x EventID 0x%x" +gicv3_its_cmd_discard(uint32_t devid, uint32_t eventid) "GICv3 ITS: comman= d DISCARD DeviceID 0x%x EventID 0x%x" +gicv3_its_cmd_sync(void) "GICv3 ITS: command SYNC" +gicv3_its_cmd_mapd(uint32_t devid, uint32_t size, uint64_t ittaddr, int va= lid) "GICv3 ITS: command MAPD DeviceID 0x%x Size 0x%x ITT_addr 0x%" PRIx64 = " V %d" +gicv3_its_cmd_mapc(uint32_t icid, uint64_t rdbase, int valid) "GICv3 ITS: = command MAPC ICID 0x%x RDbase 0x%" PRIx64 " V %d" +gicv3_its_cmd_mapi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3= ITS: command MAPI DeviceID 0x%x EventID 0x%x ICID 0x%x" +gicv3_its_cmd_mapti(uint32_t devid, uint32_t eventid, uint32_t icid, uint3= 2_t intid) "GICv3 ITS: command MAPTI DeviceID 0x%x EventID 0x%x ICID 0x%x p= INTID 0x%x" +gicv3_its_cmd_inv(void) "GICv3 ITS: command INV or INVALL" +gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVAL= L RDbase1 0x%" PRIx64 " RDbase2 0x%" PRIx64 +gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3= ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" +gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" =20 # armv7m_nvic.c nvic_recompute_state(int vectpending, int vectpending_prio, int exception_= prio) "NVIC state recomputed: vectpending %d vectpending_prio %d exception_= prio %d" --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672157; cv=none; d=zohomail.com; s=zohoarc; b=nM5lj2rneHNFAz6WW7dev/ofNIJMLFh2dO8McSuLedx0O7ip4TBQa26+LwA+RoKppJbGOC6UA0CLLTzjO/uCW82A1C3rB4nD+YY+fAsQCHF5/fPyzUB/6/xrJEZQ0mHnk3QFyO+/dKlSjUQaYhkehQAJEkTyzgakSQR2wXSNAU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672157; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xPLWOc1ulzWD7BSXwRoC+kifzLTGlELDNs5HJiVO+oQ=; b=bg8NeEQKm3SfkQia2pS55yFgr/5SfLEXPcNUisnDccluXL+/hIyEwFmUe4aQSzK2Tk1PApmN9z9VldUoMsj9Oo3zTuZWShMAEQ/G7fgmwX5N7f5wXxdVygVOPOuQqnvOQo7wtmKtdhroEI+uuK7JYH9JoLKmHTchTQ6Tzw/7+Vk= 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 1646672157719438.9505391775317; Mon, 7 Mar 2022 08:55:57 -0800 (PST) Received: from localhost ([::1]:35930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGeK-0005VA-Po for importer@patchew.org; Mon, 07 Mar 2022 11:55:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW5-0001nP-AT for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:25 -0500 Received: from [2a00:1450:4864:20::42a] (port=40745 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW3-0007lG-Jx for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:25 -0500 Received: by mail-wr1-x42a.google.com with SMTP id k24so14823005wrd.7 for ; Mon, 07 Mar 2022 08:47:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xPLWOc1ulzWD7BSXwRoC+kifzLTGlELDNs5HJiVO+oQ=; b=Qn8tf0s0iP9w00DfxAL7z5ec9TCgcDkpLGsS1+qmyr1ZBlGUut398ybjTRyNU6kVuU hKmd8LHg1K/gUr7Xe68aQYv37sFUzgXxhmf2e7Od+scyLKxXXZ0sR2wCJOzCmBohusWc qa148Kp2BrpLwRsbZWA6x5ZFuCItNonnhn1FExN7mtfw3MeaKHDqqt9oNgAGayAXA0Yj /r5ys4NwEWDucLfdh1IKELMTD+hUFluE14aDeXJF8NV7DQaa+I6nZbyAXFIzIcqIovQw wBdvXniqW71d5wC+fsw54qzuSyS1KYTIl38OdjxCmhgWHY8+PYR7Qg1HVXocYJnoZys/ qAVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xPLWOc1ulzWD7BSXwRoC+kifzLTGlELDNs5HJiVO+oQ=; b=zG4Lk1KNfBNVcrQfzzi0CKaZY14EEDnNa9WQnDxWsYNMLXP6NR4oBKiYhj32zVl8gL 6IEXXHejxg0rGKL3ct3ozI+rz7PEhyDM6KxriFbaIfG/itsmCGx1s0i6Ov6aOab3q/1y KylHgqNPtnPgLUbxB41GkhKVBS/pkUoucu8mWA65+33OWCf0xcEGtrtZd+1H2xYa2tgr RBIZ271d6xl1mONL6M2aOXgYt42yuwXVbHf9Kh+SMDvRo8L31eF7D7J2yKo6+l39EtEw iAhbTteSgDgHKHfkBm3mVsaFlIPn/hPM6bXAtKvrXz7Js8FlMLjNGCHhNra+ibNP35yi 6PlA== X-Gm-Message-State: AOAM533DB/n3vYGi0nF58EA75f4DVPKjpyFvh1/yUd8Kwhhx07hB0B09 VCnCf/R18jXDUFduPeHYx4dO72LaM2N3Gw== X-Google-Smtp-Source: ABdhPJw0J6lhfKNUPihJbqZhrMTKnkIxdrWQJ5MoqnzeBinqD6m7Jl47jpn1piTEn68cegz5gGlmlA== X-Received: by 2002:adf:f646:0:b0:1f0:4e5b:f423 with SMTP id x6-20020adff646000000b001f04e5bf423mr9422438wrp.2.1646671642211; Mon, 07 Mar 2022 08:47:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/18] hw/intc/arm_gicv3_its: Add trace events for table reads and writes Date: Mon, 7 Mar 2022 16:47:03 +0000 Message-Id: <20220307164709.2503250-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (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=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672158735100001 Content-Type: text/plain; charset="utf-8" For debugging guest use of the ITS, it can be helpful to trace when the ITS reads and writes the in-memory tables. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220303202341.2232284-3-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 37 +++++++++++++++++++++++++++++++------ hw/intc/trace-events | 9 +++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 77dc702734b..9f4df6a8cbb 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -161,16 +161,22 @@ static MemTxResult get_cte(GICv3ITSState *s, uint16_t= icid, CTEntry *cte) if (entry_addr =3D=3D -1) { /* No L2 table entry, i.e. no valid CTE, or a memory error */ cte->valid =3D false; - return res; + goto out; } =20 cteval =3D address_space_ldq_le(as, entry_addr, MEMTXATTRS_UNSPECIFIED= , &res); if (res !=3D MEMTX_OK) { - return res; + goto out; } cte->valid =3D FIELD_EX64(cteval, CTE, VALID); cte->rdbase =3D FIELD_EX64(cteval, CTE, RDBASE); - return MEMTX_OK; +out: + if (res !=3D MEMTX_OK) { + trace_gicv3_its_cte_read_fault(icid); + } else { + trace_gicv3_its_cte_read(icid, cte->valid, cte->rdbase); + } + return res; } =20 /* @@ -187,6 +193,10 @@ static bool update_ite(GICv3ITSState *s, uint32_t even= tid, const DTEntry *dte, uint64_t itel =3D 0; uint32_t iteh =3D 0; =20 + trace_gicv3_its_ite_write(dte->ittaddr, eventid, ite->valid, + ite->inttype, ite->intid, ite->icid, + ite->vpeid, ite->doorbell); + if (ite->valid) { itel =3D FIELD_DP64(itel, ITE_L, VALID, 1); itel =3D FIELD_DP64(itel, ITE_L, INTTYPE, ite->inttype); @@ -221,11 +231,13 @@ static MemTxResult get_ite(GICv3ITSState *s, uint32_t= eventid, =20 itel =3D address_space_ldq_le(as, iteaddr, MEMTXATTRS_UNSPECIFIED, &re= s); if (res !=3D MEMTX_OK) { + trace_gicv3_its_ite_read_fault(dte->ittaddr, eventid); return res; } =20 iteh =3D address_space_ldl_le(as, iteaddr + 8, MEMTXATTRS_UNSPECIFIED,= &res); if (res !=3D MEMTX_OK) { + trace_gicv3_its_ite_read_fault(dte->ittaddr, eventid); return res; } =20 @@ -235,6 +247,9 @@ static MemTxResult get_ite(GICv3ITSState *s, uint32_t e= ventid, ite->icid =3D FIELD_EX64(itel, ITE_L, ICID); ite->vpeid =3D FIELD_EX64(itel, ITE_L, VPEID); ite->doorbell =3D FIELD_EX64(iteh, ITE_H, DOORBELL); + trace_gicv3_its_ite_read(dte->ittaddr, eventid, ite->valid, + ite->inttype, ite->intid, ite->icid, + ite->vpeid, ite->doorbell); return MEMTX_OK; } =20 @@ -254,17 +269,23 @@ static MemTxResult get_dte(GICv3ITSState *s, uint32_t= devid, DTEntry *dte) if (entry_addr =3D=3D -1) { /* No L2 table entry, i.e. no valid DTE, or a memory error */ dte->valid =3D false; - return res; + goto out; } dteval =3D address_space_ldq_le(as, entry_addr, MEMTXATTRS_UNSPECIFIED= , &res); if (res !=3D MEMTX_OK) { - return res; + goto out; } dte->valid =3D FIELD_EX64(dteval, DTE, VALID); dte->size =3D FIELD_EX64(dteval, DTE, SIZE); /* DTE word field stores bits [51:8] of the ITT address */ dte->ittaddr =3D FIELD_EX64(dteval, DTE, ITTADDR) << ITTADDR_SHIFT; - return MEMTX_OK; +out: + if (res !=3D MEMTX_OK) { + trace_gicv3_its_dte_read_fault(devid); + } else { + trace_gicv3_its_dte_read(devid, dte->valid, dte->size, dte->ittadd= r); + } + return res; } =20 /* @@ -465,6 +486,8 @@ static bool update_cte(GICv3ITSState *s, uint16_t icid,= const CTEntry *cte) uint64_t cteval =3D 0; MemTxResult res =3D MEMTX_OK; =20 + trace_gicv3_its_cte_write(icid, cte->valid, cte->rdbase); + if (cte->valid) { /* add mapping entry to collection table */ cteval =3D FIELD_DP64(cteval, CTE, VALID, 1); @@ -524,6 +547,8 @@ static bool update_dte(GICv3ITSState *s, uint32_t devid= , const DTEntry *dte) uint64_t dteval =3D 0; MemTxResult res =3D MEMTX_OK; =20 + trace_gicv3_its_dte_write(devid, dte->valid, dte->size, dte->ittaddr); + if (dte->valid) { /* add mapping entry to device table */ dteval =3D FIELD_DP64(dteval, DTE, VALID, 1); diff --git a/hw/intc/trace-events b/hw/intc/trace-events index e92662b405c..53414aa1979 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -188,6 +188,15 @@ gicv3_its_cmd_inv(void) "GICv3 ITS: command INV or INV= ALL" gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVAL= L RDbase1 0x%" PRIx64 " RDbase2 0x%" PRIx64 gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3= ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" +gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: = Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" +gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS:= Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" +gicv3_its_cte_read_fault(uint32_t icid) "GICv3 ITS: Collection Table read = for ICID 0x%x: faulted" +gicv3_its_ite_read(uint64_t ittaddr, uint32_t eventid, int valid, int intt= ype, uint32_t intid, uint32_t icid, uint32_t vpeid, uint32_t doorbell) "GIC= v3 ITS: Interrupt Table read for ITTaddr 0x%" PRIx64 " EventID 0x%x: valid = %d inttype %d intid 0x%x ICID 0x%x vPEID 0x%x doorbell 0x%x" +gicv3_its_ite_read_fault(uint64_t ittaddr, uint32_t eventid) "GICv3 ITS: I= nterrupt Table read for ITTaddr 0x%" PRIx64 " EventID 0x%x: faulted" +gicv3_its_ite_write(uint64_t ittaddr, uint32_t eventid, int valid, int int= type, uint32_t intid, uint32_t icid, uint32_t vpeid, uint32_t doorbell) "GI= Cv3 ITS: Interrupt Table write for ITTaddr 0x%" PRIx64 " EventID 0x%x: vali= d %d inttype %d intid 0x%x ICID 0x%x vPEID 0x%x doorbell 0x%x" +gicv3_its_dte_read(uint32_t devid, int valid, uint32_t size, uint64_t itta= ddr) "GICv3 ITS: Device Table read for DeviceID 0x%x: valid %d size 0x%x IT= Taddr 0x%" PRIx64 +gicv3_its_dte_write(uint32_t devid, int valid, uint32_t size, uint64_t itt= addr) "GICv3 ITS: Device Table write for DeviceID 0x%x: valid %d size 0x%x = ITTaddr 0x%" PRIx64 +gicv3_its_dte_read_fault(uint32_t devid) "GICv3 ITS: Device Table read for= DeviceID 0x%x: faulted" =20 # armv7m_nvic.c nvic_recompute_state(int vectpending, int vectpending_prio, int exception_= prio) "NVIC state recomputed: vectpending %d vectpending_prio %d exception_= prio %d" --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672310; cv=none; d=zohomail.com; s=zohoarc; b=JswVz59PsK2QbXXivK3AP4pVRhpy4TAvUM97Ksfb0slMdtoJmk+aDF+wI9hTBgdsCZphNW6030xZl1YL4tOiJJoSqH3wutIBfmtx0SYSTGxxYP4bpeSiSV/gOYV0A+EMOQPVIwaLN1l3bjS6uRiD7wZ2ODHVl2AaeOznkDgcoXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672310; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=k3XXdEEkAT8rtcP4zgQB24XrJWOVDRQK/GtPyU/3Usc=; b=BkUK9prWp5MZRrC8JfBt2peTesJt8x7x3mANZ2r+VWphWX5m3KeKtDe2q50TBzi438B7Cl/JO6g5n6VBNI2vkNdrYvjelr+Ls/TrqTqndISsD9WuFzkovXJYXYZjqV5yy7w6wb4m48dmuh0/hJ8ZkbXLz8MtRvLpZSZ3bFwpBJM= 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 1646672310040683.4763107201635; Mon, 7 Mar 2022 08:58:30 -0800 (PST) Received: from localhost ([::1]:40250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGgn-0008Q0-Sk for importer@patchew.org; Mon, 07 Mar 2022 11:58:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW5-0001pG-T7 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:25 -0500 Received: from [2a00:1450:4864:20::42f] (port=33631 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW4-0007lU-8J for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:25 -0500 Received: by mail-wr1-x42f.google.com with SMTP id j17so24367559wrc.0 for ; Mon, 07 Mar 2022 08:47:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=k3XXdEEkAT8rtcP4zgQB24XrJWOVDRQK/GtPyU/3Usc=; b=qt78X5T32qE3+V+QdB9RtVkOR845+/Wnc0L498DnmiZub4fOypKPtmG0LLhOmjgV/U qGxG5vy80ycliH+owJGNW0KW6TI4L6aS22ohN3m6ZsXbpcWnjVgJjAOhFRNwaxZNY5lP rhK5Piqub2JazJaY6icSaKtr2VYFZ1AKwrSdP9kNWYgW4w8WtP/yzq8l+bGhugKGR4Y6 TW2yXQM9XKLBaE1w9eZrMbiIv8g5x+rF7Z7eXyCjOLcnAZq1pt5MTeCfC9ANg0tYfjc1 f9+J7wCh5oxgI6V3/Zptxjbb9G+Z0Xqt9Ez+F4458ZmmK1QCl9pK46/YvmFrHD+hnNBS 3Ojw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k3XXdEEkAT8rtcP4zgQB24XrJWOVDRQK/GtPyU/3Usc=; b=sonNTaJ0rAac+qPe0k7XV8/TLhqzs9E6pATdU7W5jer0gwU90s91fMimCVEy3fb07x 3ApXGQVwOWTdpRNT2gH1pEyl0o8Oj73oQg7AcRZDg4QwOyC7Me79JmB5RQwCjIJ2pfgy nEJWEgikqwUjsZ3PmmNQX+QhTJeLX0xS4Xa7c4YaTQVzKoLG9hFOM71coZD8yOJIvO2+ aNKLx6u5zUqlD6dzRxHUjE5LyjSaEZ3rZDkiK1YhUGK7c5P2KjUIfYx6VCp1YPpX8+OV KKprYfI+UARB0DKj6YzXIIjs2yJ+8I/GayqEr3YUQBBsVZE3VSkPx6t+9eKSiONu8GFq umVQ== X-Gm-Message-State: AOAM531Eh/jdJbe1sAS295kfF5+05UECdxlKDpZWlCceDilxkciqAgIx iAq1cKpHpMhMOA2YOcBh/s5Cj3EsVsbYEg== X-Google-Smtp-Source: ABdhPJzljYG3cVB4SoBuOxWOnbmNx6PCspyLO+PFAvShYiwg3oeLABoFqV9juiwwGlTYLCUwtSLIxg== X-Received: by 2002:adf:ea0f:0:b0:1f0:61f6:c3df with SMTP id q15-20020adfea0f000000b001f061f6c3dfmr8895702wrm.543.1646671642978; Mon, 07 Mar 2022 08:47:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/18] hw/intc/arm_gicv3: Specify valid and impl in MemoryRegionOps Date: Mon, 7 Mar 2022 16:47:04 +0000 Message-Id: <20220307164709.2503250-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (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=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672334952100001 Content-Type: text/plain; charset="utf-8" The GICv3 has some registers that support byte accesses, and some that support 8-byte accesses. Our TCG implementation implements all of this, switching on the 'size' argument and handling the registers that must support reads of that size while logging an error for attempted accesses to registers that do not support that size access. However we forgot to tell the core memory subsystem about this by specifying the .impl and .valid fields in the MemoryRegionOps struct, so the core was happily simulating 8 byte accesses by combining two 4 byte accesses. This doesn't have much guest-visible effect, since there aren't many 8 byte registers and they all support being written in two 4 byte parts. Set the .impl and .valid fields to say that all sizes from 1 to 8 bytes are both valid and implemented by the device. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220303202341.2232284-4-peter.maydell@linaro.org --- hw/intc/arm_gicv3.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c index 6d3c8ee231c..0b8f79a1227 100644 --- a/hw/intc/arm_gicv3.c +++ b/hw/intc/arm_gicv3.c @@ -369,11 +369,19 @@ static const MemoryRegionOps gic_ops[] =3D { .read_with_attrs =3D gicv3_dist_read, .write_with_attrs =3D gicv3_dist_write, .endianness =3D DEVICE_NATIVE_ENDIAN, + .valid.min_access_size =3D 1, + .valid.max_access_size =3D 8, + .impl.min_access_size =3D 1, + .impl.max_access_size =3D 8, }, { .read_with_attrs =3D gicv3_redist_read, .write_with_attrs =3D gicv3_redist_write, .endianness =3D DEVICE_NATIVE_ENDIAN, + .valid.min_access_size =3D 1, + .valid.max_access_size =3D 8, + .impl.min_access_size =3D 1, + .impl.max_access_size =3D 8, } }; =20 --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672310; cv=none; d=zohomail.com; s=zohoarc; b=FXA5pUFL3Ty3E84hWzPO+zz7v4+R/zgtUzo4GtRhhR9uePvj22AArdskiwS0HvL0o8yBEl1fihd2Roki8WcavQbHM4OXbFOLGWq2WLi00sSdEjQKHnSBFeipb6jqSttOa8P74DO0g6KnXTyeFYhpNfgp2yKeb5nB1bJ7hvbXuuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672310; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GANdenYBNkwkak0rQWxlFry8Hc7CxTND/movhx4GhWc=; b=SSyfu10zjf8xalT/yV5m3XSzztBc8tuSS1zhu+ZeB4cLA4/stEKYo4vbe+7G/JDdXgFncX8Drcu1xAQk/RnGFxha5cMcCQNvTysklBsuZNKVLccmWl/BSMO3HyqPGF/bmkqvLtjVJ1mi9hACv9+WRzH2sWf8juEFcSstmwwS8Mg= 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 1646672310123301.4440773515661; Mon, 7 Mar 2022 08:58:30 -0800 (PST) Received: from localhost ([::1]:40188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGgm-0008No-TV for importer@patchew.org; Mon, 07 Mar 2022 11:58:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW6-0001tg-Vr for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:27 -0500 Received: from [2a00:1450:4864:20::432] (port=37885 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW5-0007lh-An for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:26 -0500 Received: by mail-wr1-x432.google.com with SMTP id q14so8728712wrc.4 for ; Mon, 07 Mar 2022 08:47:24 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GANdenYBNkwkak0rQWxlFry8Hc7CxTND/movhx4GhWc=; b=IKz0htit7869nNO9uEz6541f34HfujznBcbW+adLOt29A8h8YwkVg9eczAnQCHlLyl kcotL+qKhh7rgV7Iw0iM5/UkvCM2ljKMDAXhM2fuuhbbKL5gd+/AnFUWY84EZ9UErDfx m39W+nJqhSMHCCjOYUkjKZaCLRXLPu/9A7II3kPjOtxZBytD6E/Fay+XfoBemoYnlAf4 MZ2JujxKEBbZlx++eXa9N5C2q74W5uWcdkxXa3hb/5ATmb4v1xT4hnx6zoOHk0B+dwsH sJq7B29Yenb4YbhA5HZApbx2RDavIn409Cr+k6ljXe7ZSXhC/dnM2V0CjbiIKrE2D2o3 M5Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GANdenYBNkwkak0rQWxlFry8Hc7CxTND/movhx4GhWc=; b=ND+W+04nP0ZUaD1p2/8cqKNKH5a+WpXFICXLCBAHCvNVK1R1jDcKFXPyT0Y1uHXzpd 65dxrV3wBJcQBwta048m7F1hd+jHcufttqxg9Ecv0hAUMQmzOYkPNhsf5/F6m5wojl9s qxD2hT9VZV2WI/drldzyYbdFx6uJ4eJ6hZw7pK7tuPRVGEtH5HdNvwHrTZkFTwPOcXnA dZBSr8sWpkVZH5e152o+2SWv3WCUOvxCVgzkIYlRGLJSYm9Do3bwxIKH7wA2ZBbUf6w3 UShnIg6bhJoZI3jSI3C6PBxs/X1RnK0T+jSqOIHkU/gDDTEIb3mn3ZuHQj6WR/RbylED JufA== X-Gm-Message-State: AOAM5305/sh+P7h5oq4BnQgSyjEjPDLFjkLWwjO0m1/Vw52VU03qjF1L 2+ZHUSOUi5+90cb43wmSVy4+2M6DjxB5jg== X-Google-Smtp-Source: ABdhPJycSbHO1G3ys77xvSARk+BG4byZdwV+fnhvT4N7nzgj0xxI2MRg8iB7TRjhR0WSSxIyT7u8nQ== X-Received: by 2002:adf:dc91:0:b0:1f0:728c:8faf with SMTP id r17-20020adfdc91000000b001f0728c8fafmr9151784wrj.287.1646671643781; Mon, 07 Mar 2022 08:47:23 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/18] hw/intc/arm_gicv3: Fix missing spaces in error log messages Date: Mon, 7 Mar 2022 16:47:05 +0000 Message-Id: <20220307164709.2503250-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (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=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672310421100003 Content-Type: text/plain; charset="utf-8" We forgot a space in some log messages, so the output ended up looking like gicv3_dist_write: invalid guest write at offset 0000000000008000size 8 with a missing space before "size". Add the missing spaces. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220303202341.2232284-5-peter.maydell@linaro.org --- hw/intc/arm_gicv3_dist.c | 4 ++-- hw/intc/arm_gicv3_its.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/intc/arm_gicv3_dist.c b/hw/intc/arm_gicv3_dist.c index 4164500ea96..28d913b2114 100644 --- a/hw/intc/arm_gicv3_dist.c +++ b/hw/intc/arm_gicv3_dist.c @@ -838,7 +838,7 @@ MemTxResult gicv3_dist_read(void *opaque, hwaddr offset= , uint64_t *data, if (!r) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid guest read at offset " TARGET_FMT_plx - "size %u\n", __func__, offset, size); + " size %u\n", __func__, offset, size); trace_gicv3_dist_badread(offset, size, attrs.secure); /* The spec requires that reserved registers are RAZ/WI; * so use MEMTX_ERROR returns from leaf functions as a way to @@ -879,7 +879,7 @@ MemTxResult gicv3_dist_write(void *opaque, hwaddr offse= t, uint64_t data, if (!r) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid guest write at offset " TARGET_FMT_plx - "size %u\n", __func__, offset, size); + " size %u\n", __func__, offset, size); trace_gicv3_dist_badwrite(offset, data, size, attrs.secure); /* The spec requires that reserved registers are RAZ/WI; * so use MEMTX_ERROR returns from leaf functions as a way to diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 9f4df6a8cbb..b96b874afdf 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1313,7 +1313,7 @@ static MemTxResult gicv3_its_read(void *opaque, hwadd= r offset, uint64_t *data, if (!result) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid guest read at offset " TARGET_FMT_plx - "size %u\n", __func__, offset, size); + " size %u\n", __func__, offset, size); trace_gicv3_its_badread(offset, size); /* * The spec requires that reserved registers are RAZ/WI; @@ -1349,7 +1349,7 @@ static MemTxResult gicv3_its_write(void *opaque, hwad= dr offset, uint64_t data, if (!result) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid guest write at offset " TARGET_FMT_plx - "size %u\n", __func__, offset, size); + " size %u\n", __func__, offset, size); trace_gicv3_its_badwrite(offset, data, size); /* * The spec requires that reserved registers are RAZ/WI; --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672512; cv=none; d=zohomail.com; s=zohoarc; b=FaXpkLOvNTvcs31rhXVIm+wbXyoF6W/LuBz5sWfDEzF2lCtNFACqewrRQbzg198ka/Pbua1L/99nJ5uJ6ZUErIQagEMzm3EZ39I94+I6MCZvjN0heh2Us2zX9OAcMRjXOjKr2jvIqznOeY2vD6AaAV+HXg2YPd645HFKJvZbbEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672512; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MRh+1RqLLcfZLhVPGuXevsBv8v4iq4OG65QKu3dfbzw=; b=UCqeMAL2rj3JtquEf5nJsOocPVcTlUTxrFpFRjNIH3phe5P1UruHBuspxGp5ViPk4IwPXYJD9VaWW5OhvMifqRuLkT4bL+IQoxU9RGmFiIv8t7n6BNCHXZj0Ofq60dRHnUavqmuGk6pxkShyN/9CkI2MNLtJpeRmbVdKjPSs2lY= 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 1646672512670378.15690680392413; Mon, 7 Mar 2022 09:01:52 -0800 (PST) Received: from localhost ([::1]:45372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGk2-0003Og-QE for importer@patchew.org; Mon, 07 Mar 2022 12:01:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW7-0001v4-Bs for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:27 -0500 Received: from [2a00:1450:4864:20::335] (port=56172 helo=mail-wm1-x335.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW5-0007lw-Tx for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:26 -0500 Received: by mail-wm1-x335.google.com with SMTP id i66so9555178wma.5 for ; Mon, 07 Mar 2022 08:47:25 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MRh+1RqLLcfZLhVPGuXevsBv8v4iq4OG65QKu3dfbzw=; b=lA6lducashhhMtl8Li24OA+QT+sv8GjzsqDictcjJuoT4yf09sii/biSZtOMr2nIvE AqRHQAdEbZx3330YwXUpoA8d4eOEFTVLjoXT88izbo1cvm8hUsWxbb0AW6Au86O6RZyA rxfXgtstZMJD5X5f0wDHkqhhHXMIeghRXGXohlbVG7Eyi72ncvxRiGTOdkr+XPyGKRNN r+/lCQNvexIIpcr+ahedyxYukMlRUlmPz19OLYWFfqWqH+78vspfoKD2yLkHx8yNGyj4 +fILhI3NQeXYNUcKDiXQabc9mldvcPf6u+VTL5bCODg4KUXt3CnN7A4y/eeUHEvUw2wg AnEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MRh+1RqLLcfZLhVPGuXevsBv8v4iq4OG65QKu3dfbzw=; b=TUrCMW9dAUwbDvZ59vuN1niQRIWAe7YXojVmxDq3aMfqSxRNAyK/iAXlPwcs+rf3gW C6zGqJ+uwBVJvJDRLBw79Win74Uhe4JOVgXaNaH/uCRn8uXmjlOhQOwYn3i8/d38kvMq hfnlsHqANI/FSWP2/JhbwZFwfrpoJfs3nu3QFQTU81weFcxOxpSAuKrxfGWYzEvX/yfH XyG3ORazB71rlxTtpwu3p4AFpDYIZPv/VX5Wc/6jDcsfw1MWcDE+C9mMETl3jRvMWz/N P3kGRcYROlkQk1GCHZqDc/3syPmGMMeS33Run0BrmRfOzr5W9G2YgYAjIhqxwoZbM0NI 7wRQ== X-Gm-Message-State: AOAM532VLTmmdeFkuTfmj3bcRxMt1j3Y4vtx28doq5u/YE2ZmFjONZF+ aqJHje7ZcOHYs4Pw9BBqbhldOqi+AUtNpQ== X-Google-Smtp-Source: ABdhPJwcDAStyz91+FCCEtr63klDX1df/Q9Bo3I/pqeWTNKKxNtx02d9x5ah8IbEbB0v/oPynPr7mw== X-Received: by 2002:a05:600c:19d4:b0:389:771e:3c4f with SMTP id u20-20020a05600c19d400b00389771e3c4fmr9799281wmq.23.1646671644689; Mon, 07 Mar 2022 08:47:24 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/18] hw/intc/arm_gicv3_cpuif: Fix register names in ICV_HPPIR read trace event Date: Mon, 7 Mar 2022 16:47:06 +0000 Message-Id: <20220307164709.2503250-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::335 (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=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672515427100001 Content-Type: text/plain; charset="utf-8" The trace_gicv3_icv_hppir_read trace event takes an integer value which it uses to form the register name, which should be either ICV_HPPIR0 or ICV_HPPIR1. We were passing in the 'grp' variable for this, but that is either GICV3_G0 or GICV3_G1NS, which happen to be 0 and 2, which meant that tracing for the ICV_HPPIR1 register was incorrectly printed as ICV_HPPIR2. Use the same approach we do for all the other similar trace events, and pass in 'ri->crm =3D=3D 8 ? 0 : 1', deriving the index value directly from the ARMCPRegInfo struct. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220303202341.2232284-6-peter.maydell@linaro.org --- hw/intc/arm_gicv3_cpuif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index d7e03d0cab8..1a3d440a54b 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -612,7 +612,8 @@ static uint64_t icv_hppir_read(CPUARMState *env, const = ARMCPRegInfo *ri) } } =20 - trace_gicv3_icv_hppir_read(grp, gicv3_redist_affid(cs), value); + trace_gicv3_icv_hppir_read(ri->crm =3D=3D 8 ? 0 : 1, + gicv3_redist_affid(cs), value); return value; } =20 --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672510; cv=none; d=zohomail.com; s=zohoarc; b=U2eugeNi9rJTJ3+pWyeDiEXHExH0qCEoRuwgj1+wNAIl1wy6uPZuFcT04QwbdjB2M/PXQNQDcmbO5LcUXdMqG8Tg3/vM8qn6wK4USdr1135d3B+7dz0mC+bV0SFvCqzarUa5q2O/0JONsSnXJI2Pij0eMeFbIcYt+ztOlqvK5FY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672510; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U2DXG281yG+T8TcjY7hKoPvKUj4soEUbCsJuYEFv69Y=; b=muCHx7sYFbY74i0J+bA9FG/TmaD5gMDUQ/IIQ610/gc8ErLInylb88Fx3ISyilDENKjWHPF2S7H54SpILeUXHN93fOsgAj8p9U88Leqkym0QoLNwoFTssnkMnpbmSWshfFpq90wnVuMOgRnkBnTos7S43Qwg8gF9XkQsB/kA7G0= 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 1646672510173391.8004607623694; Mon, 7 Mar 2022 09:01:50 -0800 (PST) Received: from localhost ([::1]:45328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGk1-0003Mr-21 for importer@patchew.org; Mon, 07 Mar 2022 12:01:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGW8-000208-Pk for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:28 -0500 Received: from [2a00:1450:4864:20::430] (port=45966 helo=mail-wr1-x430.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW6-0007mO-Rq for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:28 -0500 Received: by mail-wr1-x430.google.com with SMTP id p9so24271579wra.12 for ; Mon, 07 Mar 2022 08:47:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=U2DXG281yG+T8TcjY7hKoPvKUj4soEUbCsJuYEFv69Y=; b=DXRtA6IKLXX0B5QfLDpI41/XiSIvhTtaCneWcPBiJTHzBZNP2xKUUzQ6Hkic3NFKj6 fHTiC7VUfIJJ+yVntqxA+7+2ybrRDbiB0rcjX0kjMcAmSm5j1DsVdX0GjCdC9WJVjXIQ bT+DOjsduf4U0njNYtIYmeVO5jIMpAHdwA+Eb7mskW0Py5hH5yMuyuo1inNVNbGDtgGc vG+NvG/QeOQVrtTztD/0ho7wIL295xGzzt0kXDrqR8E482CXocZUKMYLi5eZNexm3RAV UWbjXGEm826IgZYvrMo5kijPCOC2lCGYvw+kka5osGA1xg6gR6n+mvcWSumGtYkZ8GKc oP5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U2DXG281yG+T8TcjY7hKoPvKUj4soEUbCsJuYEFv69Y=; b=mWE0/kjIbe532qspzzGwRygccEqvRiDelBrzmPkzW9DGMpMzx1qf5cu+t1qvr6tT09 ik2/b+dieIyVg+TY96uYJREhrbzLFoyDEv5r66FaptIAEjoMkVyc+Rmpt/fLq67JdRlF x7IVP9SW9qVSprVCSUTpfvwh2axClGGJrSPQMuLmAQu+CXzreUUZoyrWwQ3WGVBqBG4Y /E2zgtkWAKsCyuR4yl1ZBb/UZMEA5LNVvQpvUBJW9tUuKythYhMdvvuxTPtescJ8G8Rr BiBTpGfb8ye8rpzFG7Am+B4PZMxiF7wWIA2JoIq7LuQupzBC4KubBS7ddtmGuKB4soqZ m5BQ== X-Gm-Message-State: AOAM532qetXPw60EnNCRhFb7UxlCjhil+WN5jmKx/dayhjyCHxkjFPL7 dslKCWKRI1PbTeAD9oAot18/b++oR1Ejew== X-Google-Smtp-Source: ABdhPJx46UBkJ2FLl9gtCKNEjsE5aQo38HTGtUhiZkJDDhyQKOXNGqH7JyvTKmiAa3qcZaeL6chyMw== X-Received: by 2002:a5d:534a:0:b0:1f0:5c4b:cec8 with SMTP id t10-20020a5d534a000000b001f05c4bcec8mr9360646wrv.115.1646671645509; Mon, 07 Mar 2022 08:47:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/18] ui/cocoa: Use the standard about panel Date: Mon, 7 Mar 2022 16:47:07 +0000 Message-Id: <20220307164709.2503250-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::430 (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=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672516853100003 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki This provides standard look and feel for the about panel and reduces code. Signed-off-by: Akihiko Odaki Message-id: 20220227042241.1543-1-akihiko.odaki@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- ui/cocoa.m | 112 +++++++++++------------------------------------------ 1 file changed, 23 insertions(+), 89 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 8ab9ab5e84d..c88149852b0 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -83,7 +83,7 @@ static void cocoa_switch(DisplayChangeListener *dcl, =20 static void cocoa_refresh(DisplayChangeListener *dcl); =20 -static NSWindow *normalWindow, *about_window; +static NSWindow *normalWindow; static const DisplayChangeListenerOps dcl_ops =3D { .dpy_name =3D "cocoa", .dpy_gfx_update =3D cocoa_update, @@ -1140,7 +1140,6 @@ QemuCocoaView *cocoaView; - (BOOL)verifyQuit; - (void)openDocumentation:(NSString *)filename; - (IBAction) do_about_menu_item: (id) sender; -- (void)make_about_window; - (void)adjustSpeed:(id)sender; @end =20 @@ -1186,8 +1185,6 @@ QemuCocoaView *cocoaView; [pauseLabel setFont: [NSFont fontWithName: @"Helvetica" size: 90]]; [pauseLabel setTextColor: [NSColor blackColor]]; [pauseLabel sizeToFit]; - - [self make_about_window]; } return self; } @@ -1471,92 +1468,29 @@ QemuCocoaView *cocoaView; /* The action method for the About menu item */ - (IBAction) do_about_menu_item: (id) sender { - [about_window makeKeyAndOrderFront: nil]; -} - -/* Create and display the about dialog */ -- (void)make_about_window -{ - /* Make the window */ - int x =3D 0, y =3D 0, about_width =3D 400, about_height =3D 200; - NSRect window_rect =3D NSMakeRect(x, y, about_width, about_height); - about_window =3D [[NSWindow alloc] initWithContentRect:window_rect - styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskC= losable | - NSWindowStyleMaskMiniaturizable - backing:NSBackingStoreBuffered - defer:NO]; - [about_window setTitle: @"About"]; - [about_window setReleasedWhenClosed: NO]; - [about_window center]; - NSView *superView =3D [about_window contentView]; - - /* Create the dimensions of the picture */ - int picture_width =3D 80, picture_height =3D 80; - x =3D (about_width - picture_width)/2; - y =3D about_height - picture_height - 10; - NSRect picture_rect =3D NSMakeRect(x, y, picture_width, picture_height= ); - - /* Make the picture of QEMU */ - NSImageView *picture_view =3D [[NSImageView alloc] initWithFrame: - picture_rect]; - char *qemu_image_path_c =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/h= icolor/512x512/apps/qemu.png"); - NSString *qemu_image_path =3D [NSString stringWithUTF8String:qemu_imag= e_path_c]; - g_free(qemu_image_path_c); - NSImage *qemu_image =3D [[NSImage alloc] initWithContentsOfFile:qemu_i= mage_path]; - [picture_view setImage: qemu_image]; - [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown]; - [superView addSubview: picture_view]; - - /* Make the name label */ - NSBundle *bundle =3D [NSBundle mainBundle]; - if (bundle) { - x =3D 0; - y =3D y - 25; - int name_width =3D about_width, name_height =3D 20; - NSRect name_rect =3D NSMakeRect(x, y, name_width, name_height); - NSTextField *name_label =3D [[NSTextField alloc] initWithFrame: na= me_rect]; - [name_label setEditable: NO]; - [name_label setBezeled: NO]; - [name_label setDrawsBackground: NO]; - [name_label setAlignment: NSTextAlignmentCenter]; - NSString *qemu_name =3D [[bundle executablePath] lastPathComponent= ]; - [name_label setStringValue: qemu_name]; - [superView addSubview: name_label]; + NSAutoreleasePool *pool =3D [[NSAutoreleasePool alloc] init]; + char *icon_path_c =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor= /512x512/apps/qemu.png"); + NSString *icon_path =3D [NSString stringWithUTF8String:icon_path_c]; + g_free(icon_path_c); + NSImage *icon =3D [[NSImage alloc] initWithContentsOfFile:icon_path]; + NSString *version =3D @"QEMU emulator version " QEMU_FULL_VERSION; + NSString *copyright =3D @QEMU_COPYRIGHT; + NSDictionary *options; + if (icon) { + options =3D @{ + NSAboutPanelOptionApplicationIcon : icon, + NSAboutPanelOptionApplicationVersion : version, + @"Copyright" : copyright, + }; + [icon release]; + } else { + options =3D @{ + NSAboutPanelOptionApplicationVersion : version, + @"Copyright" : copyright, + }; } - - /* Set the version label's attributes */ - x =3D 0; - y =3D 50; - int version_width =3D about_width, version_height =3D 20; - NSRect version_rect =3D NSMakeRect(x, y, version_width, version_height= ); - NSTextField *version_label =3D [[NSTextField alloc] initWithFrame: - version_rect]; - [version_label setEditable: NO]; - [version_label setBezeled: NO]; - [version_label setAlignment: NSTextAlignmentCenter]; - [version_label setDrawsBackground: NO]; - - /* Create the version string*/ - NSString *version_string; - version_string =3D [[NSString alloc] initWithFormat: - @"QEMU emulator version %s", QEMU_FULL_VERSION]; - [version_label setStringValue: version_string]; - [superView addSubview: version_label]; - - /* Make copyright label */ - x =3D 0; - y =3D 35; - int copyright_width =3D about_width, copyright_height =3D 20; - NSRect copyright_rect =3D NSMakeRect(x, y, copyright_width, copyright_= height); - NSTextField *copyright_label =3D [[NSTextField alloc] initWithFrame: - copyright_rect]; - [copyright_label setEditable: NO]; - [copyright_label setBezeled: NO]; - [copyright_label setDrawsBackground: NO]; - [copyright_label setAlignment: NSTextAlignmentCenter]; - [copyright_label setStringValue: [NSString stringWithFormat: @"%s", - QEMU_COPYRIGHT]]; - [superView addSubview: copyright_label]; + [NSApp orderFrontStandardAboutPanelWithOptions:options]; + [pool release]; } =20 /* Used by the Speed menu items */ --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672000; cv=none; d=zohomail.com; s=zohoarc; b=FYM14Dv0qYKDN5Sm4eT2Un4DGjIQqzJtfYTAoKsIz5QuU1iKHCslLeJ4Dzx86YG/OSRpiB+D3NzBOxdi5mAxteHR4ndc6Xg5hw3eusa/U28zFfL4/A6PQYJtW59wbASPaABBem4iGo3bbvlOjZiaPle/67z0wVvs+Qh+wEv6rKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672000; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1uFtbkyoP6FALtVBSBQYa/7yZFXHFLiOSjVsvV63nhI=; b=ZZxK4jWKbMiTvyt+l/xd4RgrO97C4rMgeCmTBFKlTG6NsimIOqU7+VB2X+Dfs1/3GGUCaY4g7B0tUszW+y9VcSDYovQ38m3zw5S6FPC/PtfGv2QwLtTQ4sOgOSQMqOYd4hh2gge+rlyIn4SmUFsRcDcorCfVVk0bh41IDWQ1Hzc= 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 164667200006294.15397093584363; Mon, 7 Mar 2022 08:53:20 -0800 (PST) Received: from localhost ([::1]:52092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGbl-00064n-Tn for importer@patchew.org; Mon, 07 Mar 2022 11:53:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGWB-00023U-Hn for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:33 -0500 Received: from [2a00:1450:4864:20::32c] (port=41695 helo=mail-wm1-x32c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW7-0007mY-JY for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:29 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 7-20020a05600c228700b00385fd860f49so8803967wmf.0 for ; Mon, 07 Mar 2022 08:47:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1uFtbkyoP6FALtVBSBQYa/7yZFXHFLiOSjVsvV63nhI=; b=fG5yZY+VnwRpA397cIx7pnc5BjEX5gBPH9M2iuLHOZluX4mGR0/Me/JtSHBvNeUSiR rN5B8GxlLDCDIQ/HC7MzjR/6MnsulksdOUSo1p/0EbnlAf/b/BqaHhYnQ2jiYVGuaXap keRmdr0O+dDejiCj4itSxR4VWZvaM7AH54fNr/zTHbF2pA3PYKcDA29D+Eyl1D2Kq+mk KdjxOUugeLnKTaLtS5oPcmX2KPPzu1r0hpbXKguiEQw9YLlB8fVNXQ0yjQqP98K1XMbr cahkOgJ3mWdIxplZBHXv+p1401gZEBk7B1dcjQD9tAkndMv5SIdxd//3Yrtr8/94vjVh 8ZFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1uFtbkyoP6FALtVBSBQYa/7yZFXHFLiOSjVsvV63nhI=; b=HeG/K0l1i3w4CrR+7eR9FvY/5ZDM0ZWHWlXRxLCljDyLMznN6baVs6mAybqO3gyCJU +Od0nvO6TAYBdpXU79640VX/zx/K+A1HEZH8rB7FXIplkTzntfNu2z83X8bQ3XGvM3LS ue2cvTHRI+6YH0/3r7dp4eEVJkM96+/qZmmEwHY69x21PWM/K4WApBh+KJ6qmfr+CrzE KiVWGjZCjrhnSomvxdHsaw031qmYqizaDoLUV8MTNc9U0F8dAK0E2sJ0Pbi5gDiljxJE iIY8BvsiyS0iOhxEz6wLhPCFsVKcUXFUc0nPmwb3ouSn0KpmcGDA0tnO314o9VaWUVkc UzXw== X-Gm-Message-State: AOAM530b4Guhp5HyMprY2wf+g1iYsQJ+kF9mO1fREVSdJ9AvEh/myyGe xiP27njQ+/SUc/sXmtSa01WCl212oQ4WbA== X-Google-Smtp-Source: ABdhPJy6Um4FDFkGVrR7DkJc/y5E8+EyT7ifX5s4M9T9QFF7yZ8PnYPfLd8Rl8b9nnImApZLCeeIZQ== X-Received: by 2002:a1c:ed0e:0:b0:380:fa8c:da99 with SMTP id l14-20020a1ced0e000000b00380fa8cda99mr9845859wmh.135.1646671646321; Mon, 07 Mar 2022 08:47:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/18] target/arm: Provide cpu property for controling FEAT_LPA2 Date: Mon, 7 Mar 2022 16:47:08 +0000 Message-Id: <20220307164709.2503250-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32c (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=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672000563100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson There is a Linux kernel bug present until v5.12 that prevents booting with FEAT_LPA2 enabled. As a workaround for TCG, allow the feature to be disabled from -cpu max. Since this kernel bug is present in the Fedora 31 image that we test in avocado, disable lpa2 on the command-line. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/cpu.h | 5 ++++- target/arm/cpu.c | 6 ++++++ target/arm/cpu64.c | 24 ++++++++++++++++++++++++ tests/avocado/boot_linux.py | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 24d9fff1705..4aa70ceca12 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -204,10 +204,12 @@ typedef struct { # define ARM_MAX_VQ 16 void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); +void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); #else # define ARM_MAX_VQ 1 static inline void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { } static inline void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) { } +static inline void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) { } #endif =20 typedef struct ARMVectorReg { @@ -975,10 +977,11 @@ struct ARMCPU { =20 /* * Intermediate values used during property parsing. - * Once finalized, the values should be read from ID_AA64ISAR1. + * Once finalized, the values should be read from ID_AA64*. */ bool prop_pauth; bool prop_pauth_impdef; + bool prop_lpa2; =20 /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */ uint32_t dcz_blocksize; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7091684a16d..185d4e774d5 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1392,6 +1392,12 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **= errp) error_propagate(errp, local_err); return; } + + arm_cpu_lpa2_finalize(cpu, &local_err); + if (local_err !=3D NULL) { + error_propagate(errp, local_err); + return; + } } =20 if (kvm_enabled()) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 2fdc16bf182..eb44c05822c 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -688,6 +688,29 @@ void aarch64_add_pauth_properties(Object *obj) } } =20 +static Property arm_cpu_lpa2_property =3D + DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true); + +void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) +{ + uint64_t t; + + /* + * We only install the property for tcg -cpu max; this is the + * only situation in which the cpu field can be true. + */ + if (!cpu->prop_lpa2) { + return; + } + + t =3D cpu->isar.id_aa64mmfr0; + t =3D FIELD_DP64(t, ID_AA64MMFR0, TGRAN16, 2); /* 16k pages w/ LPA2 = */ + t =3D FIELD_DP64(t, ID_AA64MMFR0, TGRAN4, 1); /* 4k pages w/ LPA2 = */ + t =3D FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 3); /* 16k stage2 w/ LPA2= */ + t =3D FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 3); /* 4k stage2 w/ LPA2= */ + cpu->isar.id_aa64mmfr0 =3D t; +} + static void aarch64_host_initfn(Object *obj) { #if defined(CONFIG_KVM) @@ -897,6 +920,7 @@ static void aarch64_max_initfn(Object *obj) aarch64_add_sve_properties(obj); object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_max_v= q, cpu_max_set_sve_max_vq, NULL, NULL); + qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); } =20 static void aarch64_a64fx_initfn(Object *obj) diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py index ab19146d1ee..ee584d2fdf2 100644 --- a/tests/avocado/boot_linux.py +++ b/tests/avocado/boot_linux.py @@ -79,6 +79,7 @@ def test_virt_tcg_gicv2(self): """ self.require_accelerator("tcg") self.vm.add_args("-accel", "tcg") + self.vm.add_args("-cpu", "max,lpa2=3Doff") self.vm.add_args("-machine", "virt,gic-version=3D2") self.add_common_args() self.launch_and_wait(set_up_ssh_connection=3DFalse) @@ -91,6 +92,7 @@ def test_virt_tcg_gicv3(self): """ self.require_accelerator("tcg") self.vm.add_args("-accel", "tcg") + self.vm.add_args("-cpu", "max,lpa2=3Doff") self.vm.add_args("-machine", "virt,gic-version=3D3") self.add_common_args() self.launch_and_wait(set_up_ssh_connection=3DFalse) --=20 2.25.1 From nobody Sun May 19 03:38:19 2024 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=1646672086; cv=none; d=zohomail.com; s=zohoarc; b=NJZ/wqPt3sU0qdeqC+HTFXXbdDogXgVbmWZFdR5347g7n/85Cic4I/R9twpdSioVoTgZD+6ftNWAyFVEmmHF/1+dccXGTesPBdOQ898CHT7Ml1Etv6+jKxmG67PPHJTnb908aSyjsjgqqfTFwLKkQF2pWjarx0Vk7Rr/rD5PL6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646672086; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rQyfB/hnr8PD3XNGQDMI+Pr8j6F6XBEv5eRGs9i8nt8=; b=YgXxHl+ditJfW67u8afOc9LbFwnvrTkbJb+MkPiS9YV6eKeI2h7iTtCTjFJfklnxL68/ClgaM2VFkbcgIDiwjjLyCUpm+Z6JGQAAYfU1HIlB2ihf68lIsPK35tVkmwejLWR1QlNq509lxytepar6Hsj3Zjyvy3gmpo1cPznzxqs= 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 1646672086134188.94333132126064; Mon, 7 Mar 2022 08:54:46 -0800 (PST) Received: from localhost ([::1]:58540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRGdA-0001sL-RB for importer@patchew.org; Mon, 07 Mar 2022 11:54:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRGWB-00023Y-KD for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:33 -0500 Received: from [2a00:1450:4864:20::42d] (port=43538 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRGW8-0007mo-BE for qemu-devel@nongnu.org; Mon, 07 Mar 2022 11:47:29 -0500 Received: by mail-wr1-x42d.google.com with SMTP id e24so11303259wrc.10 for ; Mon, 07 Mar 2022 08:47:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b00384b71a50d5sm13806652wme.24.2022.03.07.08.47.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 08:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rQyfB/hnr8PD3XNGQDMI+Pr8j6F6XBEv5eRGs9i8nt8=; b=D10jSVS475FnNaqQh2gJODWNdi1neVRNrKh53wfYyDUs+tiW/M7zdjfMwtlKeAZEKs VXrfpT63vUe30Bs6R6VJEKooRm8UI26e6wEKrWGTXtQUJfJrKkgXS0kVlcZYPd0m2myX tqNy7NM2OSPiP9D/Xfaqi7Ybe/b4eZ4XcskAQdYO0j+JlxvBRmL3KwI/IbuzsrLz0m2L YHXSn2jOazIt2iyzhxD9CdwmcyMsYYNkAhnosk4i8zC3DOq8XUCjOWmNCCpIoVS1fBjP K9gq9s9FQf++OYd4DalwzpuHciybry3EPTzF2F3t70+GuKJsnC9lJa/KcatG82l1HbjS /2Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rQyfB/hnr8PD3XNGQDMI+Pr8j6F6XBEv5eRGs9i8nt8=; b=4n4AnLhPdzGYt/k0TG5rwQtAUnW5cpwXLJit4O5Oy7wQte8+r7JxLLwYY7d8TInmeW oPARBXLW30vHhzGo2HgZs5kBq+PAMoFqzbRYiF3QNtirpsgdfRqeQ8rP9NM3uAevd5Nc HmE2ovWr5uzKZVbysj3W6X1PYXSU7KD1wxX8cU0kNMFflqTNNEJBikyyUR/XEy/nAoQE kpVrPNeBh/xA07+kj/m9rxLDMBHcObvAhmaoXmm2XKh5sLL9FuqyBqQuvCj76fr7SAoo k2pJRXNKzMomxAgOvjbAGSTNUeGaGYl8hmHouREMmXqt+BJ2h+MxGqnWKuAfA4cWmEm7 xO3A== X-Gm-Message-State: AOAM531RB07f2amgiPRuIR35K8Aq7++PIEudNHmhpvqoEQ12VaFipQPd gs2pOhIe/fBpe3QMvTQkyM/4V1xYVkpctw== X-Google-Smtp-Source: ABdhPJyKeUTbsSK8hdf3HcsCMZSIPJ98z8/0O17kpLVYybnDr1eyhDTv43f8WVnNEOUQRMogio3LMQ== X-Received: by 2002:a05:6000:1206:b0:1f1:e68d:a72b with SMTP id e6-20020a056000120600b001f1e68da72bmr6537274wrx.368.1646671647036; Mon, 07 Mar 2022 08:47:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/18] hw/arm/virt: Disable LPA2 for -machine virt-6.2 Date: Mon, 7 Mar 2022 16:47:09 +0000 Message-Id: <20220307164709.2503250-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307164709.2503250-1-peter.maydell@linaro.org> References: <20220307164709.2503250-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (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=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646672088024100001 From: Richard Henderson There is a Linux kernel bug present until v5.12 that prevents booting with FEAT_LPA2 enabled. As a workaround for TCG, disable this feature for machine versions prior to 7.0. Cc: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- include/hw/arm/virt.h | 1 + hw/arm/virt.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index c1ea17d0def..7e76ee26198 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -132,6 +132,7 @@ struct VirtMachineClass { bool no_secure_gpio; /* Machines < 6.2 have no support for describing cpu topology to guest= */ bool no_cpu_topology; + bool no_tcg_lpa2; }; =20 struct VirtMachineState { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 46bf7ceddf3..46a42502bc5 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2102,6 +2102,10 @@ static void machvirt_init(MachineState *machine) object_property_set_bool(cpuobj, "pmu", false, NULL); } =20 + if (vmc->no_tcg_lpa2 && object_property_find(cpuobj, "lpa2")) { + object_property_set_bool(cpuobj, "lpa2", false, NULL); + } + if (object_property_find(cpuobj, "reset-cbar")) { object_property_set_int(cpuobj, "reset-cbar", vms->memmap[VIRT_CPUPERIPHS].base, @@ -3020,8 +3024,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 0) =20 static void virt_machine_6_2_options(MachineClass *mc) { + VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_7_0_options(mc); compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); + vmc->no_tcg_lpa2 =3D true; } DEFINE_VIRT_MACHINE(6, 2) =20 --=20 2.25.1