From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067277; cv=none; d=zohomail.com; s=zohoarc; b=VodkYsGZEBhr+s+NUI7gmp/bkMeihtzxVhgUQVM0DIsIJo8q4TAcwCYgwniWRsXpTrObrZaZ0ckUppHU3Xtu+rW67POP9+2ZZEE7L5q44S/ETwNMFUyM08bGyCWjBHlftvcw2Z9HoesiH8ZH5pgWNwZzz4ScZV/HsD3PPvd9eZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067277; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=8U4A80jC7+/79AhHavykypKcf13HzhPLu4pYUv3S2WQ=; b=imNnd+gdihPasiKFLDKgesWUdlYzkTtKqlwQF41+ZA3zuJUohibSRfMHW6VrwRVcXl+Xi2WikWIt4TZXgJiqOjA34EcMsUzlsWVU9sDzXkhLpRMQxpE+Qt5yybdKsMMBsqZDHvFsDKAZQPS+6FHyLyz/aCTh6i0Us4wy1pEftQ8= 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 1770067277880421.202926098042; Mon, 2 Feb 2026 13:21:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1LW-0004R4-KN; Mon, 02 Feb 2026 16:20:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1LU-0004Qg-Rm for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:32 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1LS-0007Jr-2E for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:31 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47edd6111b4so52426515e9.1 for ; Mon, 02 Feb 2026 13:20:29 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e132303fsm47077201f8f.36.2026.02.02.13.20.26 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:20:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067227; x=1770672027; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8U4A80jC7+/79AhHavykypKcf13HzhPLu4pYUv3S2WQ=; b=N/ZE3G/JP7wdIJ+hTbvHQtBrCVnczTskoZPO8Yhm5s7Fkz1E5i1Gs3X1aqcGKHFm8W 1dpbLCRfLHAIYV+PLzcvtSzEMzXaiC1JXqWIzzAPzmzwNgvg71KoYcigOUkcsQewo6gs iUXostYWZ4S1UE/Sk/zccRQOozoRyFCNME/awnIwVmWNAaVKIqdJ2JUF4hVzAbwNM+mg WPOv8+iLUa9Y+qAjsqFyS6GGldQ5XAidxNjPRD/vB98xSdkGF+xalMymUWY8o7y6WKKy xSQbww0JnMmn2Z5N7WuKqFwFFlx+K6kLNWuZWatX50/TGcTtoP2ZDwScb+d0fc85w1GD wp6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067227; x=1770672027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8U4A80jC7+/79AhHavykypKcf13HzhPLu4pYUv3S2WQ=; b=kCex3BBtxxT9362QacZZdxkrq3+LuB3Y+Zf+nekX8eRXH+1685+XtmHxDw3P4opLA9 vk8kdEVr+wVS8UcSFX99gJOknE6VPNiQJIzf8a6NLHJTl1FSqGkQ+ip9poRYvHfJ7z1g XJlLobfflDRLzgGS6TrP7rXThL9ZjsGFvcpJtho0u7xY1Rsu8h77D5tEu2lP+er7Hws+ ChHsH+VEkf2NvR3guaSF42DObmmk7Lm4ahZsEuI8+CMJ38PgGRK2QnJxy7z2iXfv78dX 746wWOL0LkkTj6X6dD2qU0l3wzGjlgjCvdF3Nj/751FLbI0EuQF14ZfyBHQEyVLLzl5g Y6lQ== X-Gm-Message-State: AOJu0YwUCF4JZUkVTRCC51DAq6TuO/qHwG+1Er4AHHhXsiu6hOdLQYZz C/o7KjD4aLTDWZsWbD4uuPOtn3nWxGi5nzZhOMo6V9vpcrxuNs1saoMKM7MuA/nYBdqJpq8Tx4w 4mnCvfXI= X-Gm-Gg: AZuq6aK66KY3GPn5/16yQAFzUaheO+8OgRTFUo5WnlkMxBounvDlvAb6Wans4DkFCUG 3reARTGZVRuzf4Q/2BdU//rF8L8rJVQKaJASmTkgcvJUYxmv1x/+ZmJymr0lEno5C2NzV0HqgfH jRzYRX7Q+wDauOJNuUy2rk+JEfYvThzWWrjg9vk2aED8gHeUCeNJ7kKY0rvqQ+tDviz2N7xArbL W8gwVcQ8K5i2Y8cZ/fE9XGBqs4EJ5EdHF5Y2g4Hp+aTX77p72zc36ujbeEPKqzRdp9EfrYJpwQD qCJO+kj2tGqIkbPevcRRH233s4FadvsUl78MBW0JiE2vD0wB8Ee7GvubfoZC2WxSVh84ploZcOU zPrPFzR11VKMxic3Nuz1Z0L7SQEfBRvQVeFVQg4HDtNqotf3ZSwDWqLRzQLVNrhYc0ZnkhVZeQ7 0x3yJ6FKVR5XAfKLG9ksfy2ovOlHFE5A9FOUWXQuHuIt9MQpxqfN7kL2FBpoNf X-Received: by 2002:a05:6000:3110:b0:435:db94:1933 with SMTP id ffacd0b85a97d-435f3a6b9e0mr18725439f8f.1.1770067227551; Mon, 02 Feb 2026 13:20:27 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 01/16] tests/unit: add unit test for qemu_hexdump() Date: Mon, 2 Feb 2026 22:20:04 +0100 Message-ID: <20260202212019.94205-2-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067279582154100 From: Vladimir Sementsov-Ogievskiy Test that the fix in commit 20aa05edc2c ("util/hexdump: fix QEMU_HEXDUMP_LINE_WIDTH logic") make sense. To not break compilation when we build without 'block', move hexdump.c out of "if have_block" in meson.build. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20260202112826.38018-1-philmd@linaro.org> --- tests/unit/test-cutils.c | 66 ++++++++++++++++++++++++++++++++++++++++ util/meson.build | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/tests/unit/test-cutils.c b/tests/unit/test-cutils.c index 75fae29003a..1fa4113ef4d 100644 --- a/tests/unit/test-cutils.c +++ b/tests/unit/test-cutils.c @@ -3626,6 +3626,67 @@ static void test_si_prefix(void) g_assert_cmpstr(si_prefix(18), =3D=3D, "E"); } =20 +static void test_qemu_hexdump_alignment(void) +{ + /* + * Test that ASCII part is properly aligned for incomplete lines. + * This test catches the bug that was fixed in previous commit + * "util/hexdump: fix QEMU_HEXDUMP_LINE_WIDTH logic". + * + * We use data that is not aligned to 16 bytes, so last line + * is incomplete. + */ + static const uint8_t data[] =3D { + /* First line: 16 bytes */ + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, /* "Hello Wo" */ + 0x72, 0x6c, 0x64, 0x21, 0x20, 0x54, 0x68, 0x69, /* "rld! Thi" */ + /* Second line: 5 bytes (incomplete) */ + 0x73, 0x20, 0x69, 0x73, 0x20 /* "s is " */ + }; + char *fname =3D NULL; + int fd; + g_autofree char *output =3D NULL; + size_t size, bytes_read; + FILE *f; + + fd =3D g_file_open_tmp("test-qemu-hexdump-alignment-XXXXXX", &fname, N= ULL); + g_assert(fd >=3D 0); + g_assert_nonnull(fname); + f =3D fdopen(fd, "w+"); + + g_assert_nonnull(f); + + qemu_hexdump(f, "test", data, sizeof(data)); + + size =3D ftell(f); + fseek(f, 0, SEEK_SET); + + output =3D g_malloc(size + 1); + bytes_read =3D 0; + while (bytes_read < size) { + size_t chunk =3D fread(output + bytes_read, 1, size - bytes_read, = f); + if (chunk =3D=3D 0) { + break; + } + bytes_read +=3D chunk; + } + g_assert_cmpuint(bytes_read, =3D=3D, size); + output[size] =3D '\0'; + + fclose(f); + unlink(fname); + g_free(fname); + + /* We expect proper alignment of "s is" part on the second line */ + static const char *expected =3D + "test: 0000: 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 20 54 68 69 " + "Hello World! Thi\n" + "test: 0010: 73 20 69 73 20 " + "s is \n"; + + g_assert_cmpstr(output, =3D=3D, expected); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -3995,5 +4056,10 @@ int main(int argc, char **argv) test_iec_binary_prefix); g_test_add_func("/cutils/si_prefix", test_si_prefix); + + /* qemu_hexdump() test */ + g_test_add_func("/cutils/qemu_hexdump/alignment", + test_qemu_hexdump_alignment); + return g_test_run(); } diff --git a/util/meson.build b/util/meson.build index a0cfdc30ba6..7c9445615d7 100644 --- a/util/meson.build +++ b/util/meson.build @@ -33,6 +33,7 @@ endif util_ss.add(files('defer-call.c')) util_ss.add(files('envlist.c', 'path.c', 'module.c')) util_ss.add(files('event.c')) +util_ss.add(files('hexdump.c')) util_ss.add(files('host-utils.c')) util_ss.add(files('bitmap.c', 'bitops.c')) util_ss.add(files('fifo8.c')) @@ -90,7 +91,6 @@ if have_block util_ss.add(files('buffer.c')) util_ss.add(files('bufferiszero.c')) util_ss.add(files('hbitmap.c')) - util_ss.add(files('hexdump.c')) util_ss.add(files('iova-tree.c')) util_ss.add(files('iov.c')) util_ss.add(files('nvdimm-utils.c')) --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067277; cv=none; d=zohomail.com; s=zohoarc; b=egCbmZaxfBL1ByqwtpH+DzurRYDR8Neo5T9KhPkzToXdFGKPPfy//GIuQE5s7hGy03Ja9KYaM6fnjmp8PVKm9PsgwatRQ1t6/NJFgjgFdcx4khm9XuR4R2H1IQhLC7kZUQbLr2NyMoBz/kfsdXMtN6cVqWPHZUK+JRVr5BLs0Y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067277; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=FZySsQfVGsWoB5DbDHJmehqOfv8LCDyeSqzpu/czsbk=; b=IdAP7Zp+pfX0DE39CtYZOGzebFalSdzjSS9XXU4GgpnyK4ZrFfWU35o/E/BxFAT30lsWRLT3XxSC7hbj/X0wrWQFAHoJ5nY89O4GUCo0gowFQbJZGmRXhHjGq6mdr6xa14PuaM81XPJtK7CCSeuZtLRkWuF3VxAitNJvwB70x2o= 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 1770067277508444.7600042489074; Mon, 2 Feb 2026 13:21:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Lc-0004Rz-F3; Mon, 02 Feb 2026 16:20:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1La-0004Rf-My for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:38 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1LX-0007K9-Tc for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:37 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-47ff94b46afso1385625e9.1 for ; Mon, 02 Feb 2026 13:20:35 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4830516a0a0sm13672525e9.15.2026.02.02.13.20.33 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:20:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067234; x=1770672034; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FZySsQfVGsWoB5DbDHJmehqOfv8LCDyeSqzpu/czsbk=; b=WNUQD74VLJ92eA7WYcgKf9k/smgNRfWi3U6hCAVwutt6aKWcZecLL47My3KkC2dZvp Rgh5V3rXTLaPsAzfLely6exkt6Q2no1/dFo2pg8BM7gH52ftxilkHZALQQSlIT7vEkhd mALe4zEjaqtEhQRKixiZsSoS2BjQOipryfO5tR3CEm1UJqeSQWxRSioQ6E708hua8o3+ 6hSQdpBQOkpyMu5enymzUIvRf97tKiiEkNcW7r+NMQdNphHIwuGHRfOn69V65s912fRf 4ORNFY05Q23IENtoiUQR0eGlX+6Jk4yGmLAnwXr0qF3Wb5izVHHbcUtLJT79dgdGPPxH Y2IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067234; x=1770672034; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=FZySsQfVGsWoB5DbDHJmehqOfv8LCDyeSqzpu/czsbk=; b=MZCkMRej2pbnulfCUUjlfk03QYJhXnL+F0uCEzxX+vk0S0nck9ZCZ5ZSItHbM8h4At 6zFkXIQLv7fsCq2ZXzRL4xP7Ki02u9E/U2Wc5XNytRN10Td/YqqVNCdXr1CQfs+M3GL3 UF6fx7KG9teRNksoy7CU3UbCv4tG53uo36e4ecRe2D/OQ3Fcxm6OhBxNGxxPvW7o/PNr RSGrLAOuRKYTqScoKNwCFSYnWcoO84drgk7TKEYW8+YuUmurzFfNhWD9GGOFstjBMn6b fUzu4p6mJv2qoISu0U4K9EuMUN7pY23beu3bnHB3A44z67Z77aCQNtm9O7ma7NlmKI9C kAGA== X-Gm-Message-State: AOJu0YzzsynzNO9+o5bFuy5qGTZQpblyfhucVBYTe1y8x/6VhOM50Uk7 UjtVzH0ma2RhjN60LHvaK948cf1BvpxDpR5Vuxro5loAjMuGJiyH4rj+sJffzvbbBEU3j4ejB7/ YJgn06kU= X-Gm-Gg: AZuq6aKOeFibSQkMWErYrdnb6w8J3PbzmIIQHS7LLR5T0RPtP132GU1iYZ8O+R1iRzd JFtqTwzcLku2XMzKJVyxSARBQbN0yvTceP1BQBJCU9zLFYdyfO8lYt+QPiqgsEGv+kX9UvJAuwW Oo+thyl0zU2rthG8mzYrICWxj7GCC8UA5DterMKX/ZOQBm/ueyUKZvHrjm95UNH5pUUZYliXyuF iQJxoqq5+12p64SnAVPlWLAQwfsxoSQvtCH4PVPwy8zz0RaBHnoubtS6kQpZgxfPVhmTEAaWO+A WmUz0a7L9s8xMvjCegvJE72oY+7zcPSt2T4nNBP1Z+Xd0wB9U6DdcTHwZbQUDCnPEfPEwI/BCxF p4aDJd4+Tk3jhu90xBLCzNq5EpKGeauqohcP095+5uakAT3WxUHxh61iNfR4vowgmgHsOhOYniJ bve5DVEFKziB9zU4Hp5JevnKpCZqgo6fy1/t2rpQ0sO734dzmEvFHnEaWDcztKGYdyngnnDPA= X-Received: by 2002:a05:600c:5394:b0:480:4a90:1afd with SMTP id 5b1f17b1804b1-483050f3f03mr13425855e9.0.1770067234074; Mon, 02 Feb 2026 13:20:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 02/16] target/alpha: Use explicit little-endian LD/ST API Date: Mon, 2 Feb 2026 22:20:05 +0100 Message-ID: <20260202212019.94205-3-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067279392158500 The Alpha architecture uses little endianness. Directly use the little-endian LD/ST API. Mechanical change running: $ for a in uw w l q; do \ sed -i -e "s/ld${a}_p(/ld${a}_le_p(/" \ $(git grep -wlE '(ld|st)u?[wlq]_p' target/alpha/); done Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Manos Pitsidianakis Reviewed-by: Richard Henderson Message-Id: <20251224160040.88612-2-philmd@linaro.org> --- target/alpha/helper.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/alpha/helper.c b/target/alpha/helper.c index a9af52a928f..80542cb0665 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -214,17 +214,18 @@ static int get_physical_address(CPUAlphaState *env, t= arget_ulong addr, =20 pt =3D env->ptbr; =20 - /* TODO: rather than using ldq_phys() to read the page table we should + /* + * TODO: rather than using ldq_phys_le() to read the page table we sho= uld * use address_space_ldq() so that we can handle the case when * the page table read gives a bus fault, rather than ignoring it. - * For the existing code the zero data that ldq_phys will return for + * For the existing code the zero data that ldq_phys_le will return for * an access to invalid memory will result in our treating the page * table as invalid, which may even be the right behaviour. */ =20 /* L1 page table read. */ index =3D (addr >> (TARGET_PAGE_BITS + 20)) & 0x3ff; - L1pte =3D ldq_phys(cs->as, pt + index*8); + L1pte =3D ldq_phys_le(cs->as, pt + index * 8); =20 if (unlikely((L1pte & PTE_VALID) =3D=3D 0)) { ret =3D MM_K_TNV; @@ -237,7 +238,7 @@ static int get_physical_address(CPUAlphaState *env, tar= get_ulong addr, =20 /* L2 page table read. */ index =3D (addr >> (TARGET_PAGE_BITS + 10)) & 0x3ff; - L2pte =3D ldq_phys(cs->as, pt + index*8); + L2pte =3D ldq_phys_le(cs->as, pt + index * 8); =20 if (unlikely((L2pte & PTE_VALID) =3D=3D 0)) { ret =3D MM_K_TNV; @@ -250,7 +251,7 @@ static int get_physical_address(CPUAlphaState *env, tar= get_ulong addr, =20 /* L3 page table read. */ index =3D (addr >> TARGET_PAGE_BITS) & 0x3ff; - L3pte =3D ldq_phys(cs->as, pt + index*8); + L3pte =3D ldq_phys_le(cs->as, pt + index * 8); =20 phys =3D L3pte >> 32 << TARGET_PAGE_BITS; if (unlikely((L3pte & PTE_VALID) =3D=3D 0)) { --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067277; cv=none; d=zohomail.com; s=zohoarc; b=ENCCEPHRaimY35oUsY4r3y3RkXjKcJF1uksPjQ4rU7qDeok/CQJeOCK8hHLXrc3IMRwsFKHzunFX4CVUKq0N+WhQNpXEC+Fguqq7puXaT51ohlPvj8KjE4NXH1vnWjJqsK4vT/8K4RBCOc5utpAhzFMOrYPff1lFELJ8fSTNgnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067277; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=dAg43hDJKLeJM0wu3Qk21qDtHG5d3oy3Ln1thTA7p9g=; b=lrXYx/UW3aBQn9iW/SQV/c1TzSNlb6imcyB86gbD7K2JEo/d0LUnaOHoXi7edtMDBsG6HxTvBTjiIkepYA+nqBfTeAc4a0DqDZB5kxUMtKXn20zGbzKZLJjCruH42IJdQYwvBk8HlB1kTRA48DpGnQvH0QOzEEm1bh7AhmGzn8Y= 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 1770067277066401.34709119669867; Mon, 2 Feb 2026 13:21:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Ln-0004Tw-EP; Mon, 02 Feb 2026 16:20:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Ll-0004Ti-RE for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:49 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Le-0007KP-QE for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:44 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-47edd9024b1so39897395e9.3 for ; Mon, 02 Feb 2026 13:20:42 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4830516a0a0sm13677965e9.15.2026.02.02.13.20.39 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067241; x=1770672041; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dAg43hDJKLeJM0wu3Qk21qDtHG5d3oy3Ln1thTA7p9g=; b=w4E9QeKvcQDOYnLpagzEosCedLlVzcgfQxR82P6VZ8ZpKh1IcnM6AwhQktrjPkHxIU rp2hN2wLM/7Ku1NPgMl0E2CASLEaF1X4KJtcGCGheiEyjlODvJtn7kR0pMpbRg+Ffdk7 I40Y7ZgTom3QTnZFtG85zvdPSTC1CBRC5c6qlLH0BSyjf0nl9BOPCDPwEGg5C3wSCMWN CwtolAHrBTy5NGUweZAFl8RQYFOliKeyk0XbezDS7+PKdlk5pccH6QKlGCf297X9yp00 /mKoDScnlK1VquakYB1Zs2Gckqj+T5lAJPq/ncu7IEjwgUSWJ3ZHgjZpL20+slX2I9fw qkKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067241; x=1770672041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=dAg43hDJKLeJM0wu3Qk21qDtHG5d3oy3Ln1thTA7p9g=; b=cx+z9vdpj8Ma5NFnIeFR6UYpYNrM23p8qZy6iQiawVUWniVQTPop0eshVRX1Rt6H3Q G4JouxxhywmfUQa4sToc+bQtSNEp3IC8JJFn6oUAk7yy7uX32JJF4sLR1hD9P8hds0VO tNy+IkdExnltpjkbsQBfDCu3XPBuLV1DJaKRl2NxoXGsyEjwAVrpq+X7HyN/gvHXT/HD Fsaj/DgnkkV8yJ+kgynA1zfOR4ngZFB8xKXWAAQ9I/JBx4UETAZl9brCXcxgUApvRA88 yORzZBS6RuMUbSgfrLphyJeheaUszVLkOXzf9iTgOMnadLsa1kmB7/mlIzxBWMamdb7E LwoA== X-Gm-Message-State: AOJu0YyOBCHkd/gMneNzw8aMabDot1JpEo7oekNESZFfjq0RfPacxU1O VfeG0i+tZGFgWJdGr7thXMAHy3QeCytWw31eQqSb47BBIUzKxZYrMpP4wHoqk041G3K0/h1J0DV M0yTdOtI= X-Gm-Gg: AZuq6aK25hvbN2qQJbiRHetTBKeaD+WydRK0nG+VMbeNI/ijTRnpudofAbr4WDIJevd KcMqt0k4CfK2+RsoX4uwDvS2AR+zCKFML5H9X1YDC7fBdrjJQbOLCo0uM5RKfn98R9+ZcAE8vtr aM109x7vI/4H5rctS6aowJG11OjySJ8x6tPYHUgwEVMIRxZZCSD7vMb68eXRnTnKT3UAaTdk90B FeLLlagaNsBOPLBxn606ONdirgPqVU2V2IbUyN/4W9/jAjxdXbuxRIdLuGjzi4ZKhECQ1TcIyke hKGMmZSstgLY3u+LQOiKoreG9V/OIltTd6wc/JGl0vQjUCcAr5tdMdaDori83BlRGTY9npVkPc9 HX4ggZuKSWrhG4soK8sErPBw2ac+LEValSuiWoVimp+ZCmXZOlbVfmavK+1IOeR3m2+mohdXLGX nr2mvO5U1pCM2bc/0hzRBri2EYVs3+w4KS7nHOlX4rZ/skTs+ROz8+6J/4PjiV X-Received: by 2002:a05:600c:4443:b0:475:dd8d:2f52 with SMTP id 5b1f17b1804b1-482db4a317bmr178741595e9.32.1770067240787; Mon, 02 Feb 2026 13:20:40 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 03/16] target/alpha: Inline translator_ldl() Date: Mon, 2 Feb 2026 22:20:06 +0100 Message-ID: <20260202212019.94205-4-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067279910154100 translator_ldl() is defined in "exec/translator.h" as: 198 static inline uint32_t 199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) 200 { 201 return translator_ldl_end(env, db, pc, MO_TE); 202 } Directly use the inlined form, expanding MO_TE -> MO_LE since Alpha use little-endian order. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20251224160040.88612-5-philmd@linaro.org> --- target/alpha/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 3be97057465..48ac50a7cdf 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -2905,7 +2905,7 @@ static void alpha_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); uint32_t insn =3D translator_ldl_end(cpu_env(cpu), &ctx->base, - ctx->base.pc_next, MO_TE); + ctx->base.pc_next, MO_LE); =20 ctx->base.pc_next +=3D 4; ctx->base.is_jmp =3D translate_one(ctx, insn); --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067345; cv=none; d=zohomail.com; s=zohoarc; b=lKLQcO05vDej+nK0QR7KgquUpz5eVbfHaK1+wt5suWX8sMK42NFjESv2r8EkD4CYpXAkWzlzLE9+3FoVRRdDTXsWayVhLn4A/Biyn/oWAagdIDuIrBpgfe/PvxKL24wohmjtEy7Rr4v+r1IzRgxC4UdpnDn9Vk3vTUuJT50qSKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067345; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=fnVEsqFli6BIdwPxt+cMr6vVYl3Hlh2AGSUbGnAGHvY=; b=PvJjwncVVREpmo4sxPNZQrzpHQDZ1BIC9/+rtuDvQQglOaPNbPq2Kaq6unLmwSrRGSwkeXj1z6Gz6FgBxeB18RteVELN937NDFG4EZyHpxPe9KXU20MBbxS/pKfzyDlWv6OTe8FAV/9WFw8/MGPpAOhgDYjKLHVFORb6uv8hu7Y= 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 1770067345713853.5043803833413; Mon, 2 Feb 2026 13:22:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Lp-0004Uf-5I; Mon, 02 Feb 2026 16:20:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Ln-0004Tv-D1 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:51 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Ll-0007Kf-L0 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:20:51 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-432d2c96215so4718856f8f.3 for ; Mon, 02 Feb 2026 13:20:49 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e1353ac2sm49339919f8f.38.2026.02.02.13.20.46 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067247; x=1770672047; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=fnVEsqFli6BIdwPxt+cMr6vVYl3Hlh2AGSUbGnAGHvY=; b=uhpQgVcsvfYCzp83MaEGRjnkes5u7KctqVa7+vpGFpiohk+ieZH0Q0yRLZyh0hElRC 4j1+tNdOW+eyL1cKdI6eQDXKLJDRABUCd6ZJRvLp8EjRFFiUKWtcGraJiPOs2PQQccWC qYRCR4mtJuWF6FVfYYL+NVroRaBgwdJpQNigSaJfEH0Lqx74wOncXpPYXELljL7iu4mu 2AwwPTRJtxAUpuRZvbRqe9lq8U421Pvw5OoCbFhKxp8YYAfVuSW30XrRjLgWccYAqtWm eMiGOcn4kvi0BR2QRv0D9ih9NpFusHAJbOkX8oVrv4BcWy4YlAmseDlZiLAT0hbADG1t 3R5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067247; x=1770672047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fnVEsqFli6BIdwPxt+cMr6vVYl3Hlh2AGSUbGnAGHvY=; b=XOGVcSobfgVhEohfNIU4cKgoxH5Jc75CLelpVNU5Z5mf0JlGZATxyHE2kPHuXvtbG5 N01Z0CPtWro4ojute0NKfNixOxp1jFZJIttswwKp6JVc/gcvpKBZOTFV+8D0H3zSCFt1 T1RXyoPMwsIWG+Bo5s6rGAaWhGA1q62/E+qRYosdBfU0zLx2hAJ5MML7uZBH+T8fxH3r rZBXCtuRgnNaSZjG2cTzAotiOCzZfw6+aqG7fDLmfx6up2i+4bBOOQjHCpe15zeQgk8F uNb6Fe5AKpiZEhwqW4SrICmkaDCBQmx/2NgcbvStE68JnQQD2sP94DLF9yP0VUo2qQc8 6Mng== X-Gm-Message-State: AOJu0YyqGNauFZSZ/Sklk31I7e8+M9vAHm06Sb4PL9h2cBkQ3/g16PvC e6ap/P7QU5ek4n+1MCZ+2NNqOdIb9L0y8vG1LMhUQt5aeZUSN7Ob9ZC9NXoUAyB1vLm3HMsawlg Dk407Zpg= X-Gm-Gg: AZuq6aKLomWYqMc1mTdx+VLqcbM9cJlHv7eSkpoBUC5OcuBtzeoMjF7UeX2P1+Rttni VqjnR/XfLqfjkMrKvUTiAXnerWu42mxSG4FwsnJCSj3fcWxh5xwsxteBkK2GGCT7beTt36tL7RD tO1XOf1OtnDDiZz7x9jgMK2cYdoiPF7Xc4qXATIe5TLZ3EHtc3O/WKT+6HyyIX+3bp2VvKw3MC9 YdpMhlFU9DspL2gDwlLD4qBsZKMHvW66/2eX0QtJbqOMzIYNXwjwb9TiDNMNY9cmWyR1KTK8uB6 EFMz3PJoDujuAb//S1WsWj3Nf6WSfu/uKe3CQT7h+XghQ4O0zOvuZ2PPR+1Q3Nau5tWj21qpFBV dVFaRKOH6qBNsS3a63VGMXPDHWOQzmmvJzqT20wFEiwj1clhiXf2nqs1x+62Ew8+244DujiiPpp kPXFBsJc8JfQ6427twIrPq6BEP4D/Rfh3O5K1qHxNDRKH0zuOUtLA/VjuHGqKF9nwkJzfs1o8= X-Received: by 2002:a05:6000:2689:b0:430:fa9a:74d with SMTP id ffacd0b85a97d-435f3a7bb17mr20639014f8f.24.1770067247445; Mon, 02 Feb 2026 13:20:47 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 04/16] configs/targets: Forbid Alpha to use legacy native endianness APIs Date: Mon, 2 Feb 2026 22:20:07 +0100 Message-ID: <20260202212019.94205-5-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067347166158500 All Alpha-related binaries are buildable without a single use of the legacy "native endian" API. Unset the transitional TARGET_USE_LEGACY_NATIVE_ENDIAN_API definition to forbid further uses of the legacy API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20251224160040.88612-6-philmd@linaro.org> --- configs/targets/alpha-linux-user.mak | 1 + configs/targets/alpha-softmmu.mak | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/targets/alpha-linux-user.mak b/configs/targets/alpha-l= inux-user.mak index aa25766236e..ee505e16ef4 100644 --- a/configs/targets/alpha-linux-user.mak +++ b/configs/targets/alpha-linux-user.mak @@ -3,3 +3,4 @@ TARGET_SYSTBL_ABI=3Dcommon TARGET_SYSTBL=3Dsyscall.tbl TARGET_LONG_BITS=3D64 TARGET_XML_FILES=3D gdb-xml/alpha-core.xml +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=3Dy diff --git a/configs/targets/alpha-softmmu.mak b/configs/targets/alpha-soft= mmu.mak index e31f059a52d..22fbbf0cb08 100644 --- a/configs/targets/alpha-softmmu.mak +++ b/configs/targets/alpha-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=3Dalpha TARGET_LONG_BITS=3D64 TARGET_XML_FILES=3D gdb-xml/alpha-core.xml +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=3Dy --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067302; cv=none; d=zohomail.com; s=zohoarc; b=mS/u7BTd2N3ui0Pvi4TL//JpmAStsTS7G3XYTW1IUUBhdyK2XwzwBYhcGX3cofyl3IyvzpuJzM8cp8V6/eGiZBSr2nm9ql4FRy79UbSsdue0MyzI/bvQy7OEihbuX/wNaeok1aCsGECrsOxHHHYqJeJfXQlt+3DVkjxNEkThU+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067302; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=/CYxwqlwyfwDhs0x6N9r7EkQHeNibWYl61Ma+6YfqBs=; b=YouCnvyiu4wy8XjJAiugfdkHvA4+u91jcRningHBRCiDDwulae61kJMyeUUcRCK22PDbWF+kX0z7V4l4Lfdmiq4VgHH7++B0YD2lpaI0qonGQD4Ok3+xTfy69RZhcZztfjR8nHQiX0PVcq5AmRA/qWsIPwyeZiZqooMj2piYqYI= 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 1770067302866392.3956607795815; Mon, 2 Feb 2026 13:21:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1MF-0004ZM-3x; Mon, 02 Feb 2026 16:21:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1M4-0004Wc-EH for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:08 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1M1-0007LC-5D for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:08 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-482f2599980so21161065e9.0 for ; Mon, 02 Feb 2026 13:20:55 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10ee057sm51925616f8f.15.2026.02.02.13.20.53 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067254; x=1770672054; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/CYxwqlwyfwDhs0x6N9r7EkQHeNibWYl61Ma+6YfqBs=; b=FptRFeJeUkyE2jvhHWVaqiQXCfryjiEQcNaAOGrOJ0f7Z16DRbxrRKPdmbJ/f5Hi3A GEMHTYbqAUKcCpUgqG4W8xZy5zU2I/Z6Rc+7NOaoM+a1pxQGzW8SZagKRaBD/TwD60vy S22nSyYLgXMo2buP6TuPJNNEDLRAVbQl/QYhI0QvB8dmZv+a8FDHeEZoyh1Dy+fSn6eO 0kjI5fyPbQgYzSBT3iSEvAQszxepGeAT2oDCiGBvvAlDZ/dyyx+uDUW1zCUwsd4Eoae1 JQjhtnit7S/fPRf+Gj1e9M/hsWveuCS8W1SNdMW4GcMoqcTEPwoP5TIqgJJ5GuqWjzk5 5KOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067254; x=1770672054; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/CYxwqlwyfwDhs0x6N9r7EkQHeNibWYl61Ma+6YfqBs=; b=CpuSDf2t4G+SgRIpfvtk+eSCSJvrcHuVob+5NZQ8nLbKhrwedXB0VOsTV0cH/XQfdq YrU++hfZQ/8RGZdnE1gb/FhbYoPymX3Y86Vstd5pHLc8q4wv30h+83xgTzrQbV4j9qKe /6NTXJhr7BXfEipyeyw6YbhU2RfMUnYQQqGURid7+TrDvW216HXhnPlbQhUmp6KHws3R fJmfTxbqX5VxZDI92ezQ2kZZwwZ02VOjguPtduoikqtj6qw3dx7sjCVaWC0ftixFYcdY 7zt2RzB+o+QfDaVh1ypIZAWWt7TGweAdY+0IIMExVuhWakQhf5r+s7gGlGw6WvECxP+q 4h6Q== X-Gm-Message-State: AOJu0Ywg6iU0zpSDOXv56UauBAeLyk/vLOslWCPI/sFE2eRzO2QyCanW DETDgjMEwAgLHAmxVWw7YHJBjp9qsetGQdgnWhwVivwM9CAYuOtDYUi7fGZ4/yv6st4/718up8l M8JcZQo4= X-Gm-Gg: AZuq6aJmvUBJUzqfVofNzbU1D82Hdqo7gwlsCf6R4Cn4CVkkG+WHijdFtpDU4xu5vv7 aK3J6GJs61HP5s79pZ2YzZibx8iI019F0NSq0rR0cKOGTg7e5a4O64Po6Ke1j/eGAKjAEU5POPw kkk2TW6mANPcf2A8XRpUu/HaJDBu1zAJaY7FJP9MRgAlqNtMaGppdxH318MMhxR9lFSIkTk8D1+ ChCqWde3U+Mcrj1GZLR6wsCXfe2F1y1WMrQfo5a6sfTKVnZotsiCtWGGv9ynEENjmixiJfVgnvI KcDr8T/w+7dwBWh0Ucp0LaODt1Me57Fc3VVbtKANZBEsf+qXiti4NGlA/k4UxlCZTqIl/QVF0Gx B0H7MI3fH1/YDe3yepMtH1z6VYOfAEJzKXb10JasxiaU9X1a5t9J/nAqpZVRrjRDp2tC/EN8V6E w8fMsdZPs1pnXOul3etm4jA+W3e48t1Ru1Ixu7Sc4vE09KaLaXsbbIRpmSpQA/ X-Received: by 2002:a05:600c:528f:b0:480:6fbc:695f with SMTP id 5b1f17b1804b1-482db49702dmr165280325e9.32.1770067254301; Mon, 02 Feb 2026 13:20:54 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 05/16] target/alpha: Replace legacy ld_phys() -> address_space_ld() Date: Mon, 2 Feb 2026 22:20:08 +0100 Message-ID: <20260202212019.94205-6-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067303904154100 Prefer the address_space_ld/st API over the legacy ld_phys() because it allow checking for bus access fault. Since we removed the last legacy uses of the legacy ldst_phys() API, set the TARGET_NOT_USING_LEGACY_LDST_PHYS_API variable to hide the legacy API to alpha binaries, avoiding further API uses to creep in. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20251224160040.88612-7-philmd@linaro.org> --- configs/targets/alpha-linux-user.mak | 1 + configs/targets/alpha-softmmu.mak | 1 + target/alpha/helper.c | 29 ++++++++++++++++------------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/configs/targets/alpha-linux-user.mak b/configs/targets/alpha-l= inux-user.mak index ee505e16ef4..2f1312f0362 100644 --- a/configs/targets/alpha-linux-user.mak +++ b/configs/targets/alpha-linux-user.mak @@ -4,3 +4,4 @@ TARGET_SYSTBL=3Dsyscall.tbl TARGET_LONG_BITS=3D64 TARGET_XML_FILES=3D gdb-xml/alpha-core.xml TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=3Dy +TARGET_NOT_USING_LEGACY_LDST_PHYS_API=3Dy diff --git a/configs/targets/alpha-softmmu.mak b/configs/targets/alpha-soft= mmu.mak index 22fbbf0cb08..5c6af0eafc1 100644 --- a/configs/targets/alpha-softmmu.mak +++ b/configs/targets/alpha-softmmu.mak @@ -2,3 +2,4 @@ TARGET_ARCH=3Dalpha TARGET_LONG_BITS=3D64 TARGET_XML_FILES=3D gdb-xml/alpha-core.xml TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=3Dy +TARGET_NOT_USING_LEGACY_LDST_PHYS_API=3Dy diff --git a/target/alpha/helper.c b/target/alpha/helper.c index 80542cb0665..126a53c829b 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -169,6 +169,7 @@ static int get_physical_address(CPUAlphaState *env, tar= get_ulong addr, int prot_need, int mmu_idx, target_ulong *pphys, int *pprot) { + const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; CPUState *cs =3D env_cpu(env); target_long saddr =3D addr; target_ulong phys =3D 0; @@ -176,6 +177,7 @@ static int get_physical_address(CPUAlphaState *env, tar= get_ulong addr, target_ulong pt, index; int prot =3D 0; int ret =3D MM_K_ACV; + MemTxResult txres; =20 /* Handle physical accesses. */ if (mmu_idx =3D=3D MMU_PHYS_IDX) { @@ -214,18 +216,13 @@ static int get_physical_address(CPUAlphaState *env, t= arget_ulong addr, =20 pt =3D env->ptbr; =20 - /* - * TODO: rather than using ldq_phys_le() to read the page table we sho= uld - * use address_space_ldq() so that we can handle the case when - * the page table read gives a bus fault, rather than ignoring it. - * For the existing code the zero data that ldq_phys_le will return for - * an access to invalid memory will result in our treating the page - * table as invalid, which may even be the right behaviour. - */ - /* L1 page table read. */ index =3D (addr >> (TARGET_PAGE_BITS + 20)) & 0x3ff; - L1pte =3D ldq_phys_le(cs->as, pt + index * 8); + L1pte =3D address_space_ldq_le(cs->as, pt + index * 8, attrs, &txres); + if (txres !=3D MEMTX_OK) { + /* bus fault */ + goto exit; + } =20 if (unlikely((L1pte & PTE_VALID) =3D=3D 0)) { ret =3D MM_K_TNV; @@ -238,7 +235,11 @@ static int get_physical_address(CPUAlphaState *env, ta= rget_ulong addr, =20 /* L2 page table read. */ index =3D (addr >> (TARGET_PAGE_BITS + 10)) & 0x3ff; - L2pte =3D ldq_phys_le(cs->as, pt + index * 8); + L2pte =3D address_space_ldq_le(cs->as, pt + index * 8, attrs, &txres); + if (txres !=3D MEMTX_OK) { + /* bus fault */ + goto exit; + } =20 if (unlikely((L2pte & PTE_VALID) =3D=3D 0)) { ret =3D MM_K_TNV; @@ -251,7 +252,11 @@ static int get_physical_address(CPUAlphaState *env, ta= rget_ulong addr, =20 /* L3 page table read. */ index =3D (addr >> TARGET_PAGE_BITS) & 0x3ff; - L3pte =3D ldq_phys_le(cs->as, pt + index * 8); + L3pte =3D address_space_ldq_le(cs->as, pt + index * 8, attrs, &txres); + if (txres !=3D MEMTX_OK) { + /* bus fault */ + goto exit; + } =20 phys =3D L3pte >> 32 << TARGET_PAGE_BITS; if (unlikely((L3pte & PTE_VALID) =3D=3D 0)) { --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067390; cv=none; d=zohomail.com; s=zohoarc; b=KywLiRwulRRIUCkurYzzgJDpl9x8OnDOCIPLUhjNqy2tNfvI/3YTqYyYG7E9Qen0ccDL48Z1kl5BaMAabPlkuWJdqoiBmVdpVs0Web211P31Q5aPUoFqBNgaaoMlxjDYWEgt213Rv6D8Zc4smrxOUPhXiIRByp7t4H6sR+T4JFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067390; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=legVcGNyjRa2lR5kbPRfIkXIuqxbddQOaBVHlXWvfIY=; b=XGKpEc7JwI8d6h34Vl3YQo0r20SHMm+y/4kAoKcKjSvSB0Kn5g44VabUDjSQeZj2a5Hu5YGi8n89I8mWXPr+ewKCZuBcjMOkLuxKFxHjSNu92tXrn2mgJCZm/f3PVg8cvUvVw3dRDMBkrihl1zspEtQNYUfigEvMkHRw5KdP0GA= 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 1770067390408779.1663562622297; Mon, 2 Feb 2026 13:23:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1M6-0004X3-CD; Mon, 02 Feb 2026 16:21:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1M4-0004Wd-EK for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:08 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1M2-0007Lz-Iq for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:08 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4805ef35864so42032015e9.0 for ; Mon, 02 Feb 2026 13:21:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4830511ccd0sm13520285e9.1.2026.02.02.13.21.00 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067261; x=1770672061; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=legVcGNyjRa2lR5kbPRfIkXIuqxbddQOaBVHlXWvfIY=; b=odf/hVMPd4Jrgl+txLoZL+uvpKOpmJXJtbZfOE5S9kBuNKSltxWPpR5syGHblTmumM rH2QedjOyJsYbHPy5A2g/wfql7lBx2PSOD8oxIXqt6MKbCgYBl5B44FUpyk8EyTzpn8o 44UnKGSCFBJI88W1jVvK8Ab6Hq9AL5Jvw/fH5qKqOriq/pLxrxcZAas0pYlw5OkKSmRm QR1kKK6ns7qU6yu9pGHBBxy1Umhq51Jb2bRkHBpPJmvvVb6Wp6v8eMBTxnBsCf4enhgs jM5I9yniwIWGAShv9p341GlMiiOemlrJybOakK7cPhRyDFGuFrHtoHydVE0Vpo0/ryH2 9RaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067261; x=1770672061; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=legVcGNyjRa2lR5kbPRfIkXIuqxbddQOaBVHlXWvfIY=; b=koq6qVS4MUJsTcbGQj5P3i+AkQgIttP0ePEa6DlYmm2Fm8QGCu018lOPWYZqKddoax sH/k9Q0XemcRpZNN6dyNVb29jrbywfoOVEMOnJXAq9xEzKGgN731U/D6VUttmwi39sPI 1sWvLMlJmn59sA7xsw42k5bunpczR6dYWZTnTCyW20BEp7BhSMCh6QQa5WNZHL+00v+v COpBpQKQ24cal3zRKq7v3nPof32TtYhYm/Qr24GNhWejTTXE0Yhwh9s+gaM2hIv5YwkI GVA72s/LVqMxd3P/TPazY2Mkc3JDKp2Zix/WvDo84f0gmhSjIggPwmHR74M0yGhlN9dB D8wA== X-Gm-Message-State: AOJu0YwSBRdowN38Yys6Mqs1fwu4ZKj4zD3hFdm5N/CiHZSRNAfGXrvW lWucbFl904PNU/DIEiIQYVeOOxTsUV2zkPDddxmELcQESc5h5gROCCruMDh/OyY9iyIXFsc9ama NiXdCbKU= X-Gm-Gg: AZuq6aJB5BY3AluEtyIVikfE7PorfXXERWvS4zRETHqs6TbLWHt/2nNAn5IcOe7fbw5 HeuB5s1qbhljG0Gs5pQrnXvWnATs3XUIWrxte7FWH16MKywrFQbaT/+yxuSTZoFAEZTSnBsoFp0 2yRyDESDYFA2KqCR6xb6Pxk7zEabLPs4ZrS8ovnGF+dpJ49TQQHVrgucJm9e6ZvY1BoVq8iFg8u mqZ3fv+hRXvCPhLyphPLL2e4aRp36ZSG1wWO5/hVbVE2eKY5yJSvCg4mILSfxl6tJ96ghaknvK7 YEINouJRqrHh77pjf60S78xUQsswJmpA+lcWpP0B1+kUgy3CBjP21IvCOoxdFE8HKH6BTOggYUp HfeaNdVVwPnPIgVqeZsUZznn5abDQK3b7L79J/FZFLKmxFw4zrNMhS6DjBYYZXDjYUbXasY9NUD ZBZXgq8ZXaueUt0P9HlUKn4hd3vochMCv6njldErJX0CQUNYosVE5u2RM4S51b X-Received: by 2002:a05:600c:3e1b:b0:477:afc5:fb02 with SMTP id 5b1f17b1804b1-482db47cd93mr140204285e9.21.1770067260906; Mon, 02 Feb 2026 13:21:00 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 06/16] memory: Remove memory_region_init_rom_device_nomigrate() Date: Mon, 2 Feb 2026 22:20:09 +0100 Message-ID: <20260202212019.94205-7-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067391567158500 From: BALATON Zoltan This function is not used outside of memory_region_init_rom_device() which is its only caller. Inline it there and remove it. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- docs/devel/memory.rst | 1 - .../memory-region-housekeeping.cocci | 8 ---- include/system/memory.h | 27 ------------ system/memory.c | 41 ++++++------------- 4 files changed, 13 insertions(+), 64 deletions(-) diff --git a/docs/devel/memory.rst b/docs/devel/memory.rst index f22146e56ce..8558f70a421 100644 --- a/docs/devel/memory.rst +++ b/docs/devel/memory.rst @@ -114,7 +114,6 @@ the backing memory yourself, you can call the functions: =20 - memory_region_init_ram_nomigrate() - memory_region_init_rom_nomigrate() -- memory_region_init_rom_device_nomigrate() =20 which only initialize the MemoryRegion and leave handling migration to the caller. diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 29651ebde90..7f89e9712ec 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -97,14 +97,6 @@ expression NAME; expression SIZE; expression ERRP; @@ --memory_region_init_rom_device_nomigrate(MR, NULL, OPS, OPAQUE, NAME, SIZE= , ERRP); -+memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP); - ... --vmstate_register_ram_global(MR); - - -// Device is owner -@@ typedef DeviceState; identifier device_fn, dev, obj; expression E1, E2, E3, E4, E5; diff --git a/include/system/memory.h b/include/system/memory.h index 8f8725ea2d5..0562af31361 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -1614,33 +1614,6 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *= mr, uint64_t size, Error **errp); =20 -/** - * memory_region_init_rom_device_nomigrate: Initialize a ROM memory regio= n. - * Writes are handled via callbacks. - * - * Note that this function does not do anything to cause the data in the - * RAM side of the memory region to be migrated; that is the responsibility - * of the caller. - * - * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count - * @ops: callbacks for write access handling (must not be NULL). - * @opaque: passed to the read and write callbacks of the @ops structure. - * @name: Region name, becomes part of RAMBlock name used in migration str= eam - * must be unique within any device - * @size: size of the region. - * @errp: pointer to Error*, to store an error if it happens. - * - * Return: true on success, else false setting @errp with error. - */ -bool memory_region_init_rom_device_nomigrate(MemoryRegion *mr, - Object *owner, - const MemoryRegionOps *ops, - void *opaque, - const char *name, - uint64_t size, - Error **errp); - /** * memory_region_init_iommu: Initialize a memory region of a custom type * that translates addresses diff --git a/system/memory.c b/system/memory.c index 4bf00d82bcf..a9032fb2cfe 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1748,32 +1748,6 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *= mr, return true; } =20 -bool memory_region_init_rom_device_nomigrate(MemoryRegion *mr, - Object *owner, - const MemoryRegionOps *ops, - void *opaque, - const char *name, - uint64_t size, - Error **errp) -{ - Error *err =3D NULL; - assert(ops); - memory_region_init(mr, owner, name, size); - mr->ops =3D ops; - mr->opaque =3D opaque; - mr->terminates =3D true; - mr->rom_device =3D true; - mr->destructor =3D memory_region_destructor_ram; - mr->ram_block =3D qemu_ram_alloc(size, 0, mr, &err); - if (err) { - mr->size =3D int128_zero(); - object_unparent(OBJECT(mr)); - error_propagate(errp, err); - return false; - } - return true; -} - void memory_region_init_iommu(void *_iommu_mr, size_t instance_size, const char *mrtypename, @@ -3802,9 +3776,20 @@ bool memory_region_init_rom_device(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; + Error *err =3D NULL; =20 - if (!memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, - name, size, errp)) { + assert(ops); + memory_region_init(mr, owner, name, size); + mr->ops =3D ops; + mr->opaque =3D opaque; + mr->terminates =3D true; + mr->rom_device =3D true; + mr->destructor =3D memory_region_destructor_ram; + mr->ram_block =3D qemu_ram_alloc(size, 0, mr, &err); + if (err) { + mr->size =3D int128_zero(); + object_unparent(OBJECT(mr)); + error_propagate(errp, err); return false; } /* This will assert if owner is neither NULL nor a DeviceState. --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067387; cv=none; d=zohomail.com; s=zohoarc; b=eEKxR/aJ89MZoVlOBPLDzysv2HpShVUjdSpPuZ0E6K91lDtWJxsMmKh0NmP33LPBVC1IXc/+0V6fs1YdbHuZ1Bbom38Xx80t2vVl7UcYu/9FDJqMwIChtiELPauxYdO8KPFoHm2DgBQAse9sSCyMLoTye6ybj0CsR9jwtPhYPS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067387; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=uHF8IifM55Aqaq/6kWYrZN50Lp7Qdt66CjAoNd5bh+U=; b=EjSLtiN34/Q869ZYrqsoXahAtcMf0jX8pX8FR1K/PJ5AvaJUfRysKbGz/pGn8Gb0jK1eKeyVlu/oKl/gQ+fk+CtXh+v0laMc7ZmftnHFJbgKB0JnyqHFGUdlp+XmZ9LFg8osgfryigxmckA+dXG0VtfT4Y5fyvR8hK5tVBSraG4= 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 1770067387686746.29037526382; Mon, 2 Feb 2026 13:23:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Ml-00053P-AD; Mon, 02 Feb 2026 16:21:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1M7-0004X6-3R for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:11 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1M5-0007ML-H4 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:10 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47ee76e8656so65521655e9.0 for ; Mon, 02 Feb 2026 13:21:09 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483051292bcsm24193265e9.5.2026.02.02.13.21.06 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067268; x=1770672068; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=uHF8IifM55Aqaq/6kWYrZN50Lp7Qdt66CjAoNd5bh+U=; b=Uuq3GhLt2fc0NdHka01Uh4mETFu8Sc8k/6oEEjvBw6sZ9ohc8dotQO4vL3GEycuwDl R1Lhmt0II5SWbjwc+yEnFnUfevSp0sH+lwp8SQxsTv+jYYsZywIFlXstKUitmYoJvJ6j Sz+GhFCuoxmA6bgx/KEg+IEhGL30G1J+8HyWxgWMixK6WCPwXkOPMnT2Rtiq6TXYEeJ+ 2A70VqTk22VjN/3kBRXkpY5crP5kLeXXNALU2QTWIdQxNEvBOLlPEAUEaPaQTxLXw82N dpguTmz+ttTWuAigGtkWceFsiAi3AjP5QSczs/LhPOyMVmGnSrAkgEF6E0DAa0mKYKCN hWTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067268; x=1770672068; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=uHF8IifM55Aqaq/6kWYrZN50Lp7Qdt66CjAoNd5bh+U=; b=syAxKwiGdgLS+TVAesxuwoVp+94Lmn7ISKe4kXr0EJnrUrJZdWq4jrpPFc1yMwBFj/ rLZKwnP48vf9pn1Zuuq7cEoLPrDGXZHPp2eDSt5rouCDh9jNRS5jwm0cEjUrajJnRrjH DliwF2xG4U5rDGWrAR8QYKX6B8tpOOppxQadK2Maxu4NqwobmgaSMYAI/cNtIMvGi7rf P+HKg1W7OdBLU+ONOqK8hqUBi7fIAQUgwUVMo51mIeTHt6Ue2DBoZbmfDrABrV6PdgTT N4+GpGaBPbfHUCAqId3jAwe4VZkQ0bl6hEmuimJwYFgdBvTlKi1svjhXCSJHsRKhuEtB fHNw== X-Gm-Message-State: AOJu0YxTtKWoBW4nfZ8UC8L1Cr6vzR+Ih3NRGw5uQEq/0va/dPtDSQJL 8RVuOAB44M9R3UAMXffNVXI/X/fByTHFPTdouTtfvMSfGgqZ1pK4rBw/Xgh/57bTZKhVThRN5BH deveyJe8= X-Gm-Gg: AZuq6aKp3pT7QGrgoh8a05O1I3YG+tmn5wJu7dFmg4BuIZGGT/12X4iFn9XNdurPbwE 0xGjjGzR5u+fQpeT7mzhZJ8uEMBF+NRLXyJTiUju8onySfmuTpJCN4F9x1RkH+tsP4FrWIxg0D+ dmo556d8p3hN9u7AXQuUC7iWh+fO61oNA0hjHP6rXlKyYrQbDxqMvn+V+bbwyXlFWqGYx7l9AkK Jo1Nki+OtDCaQO6rz2EXK328s9SQlQ+7M03y/u94vxTPhlMw9Rljezcofjotoze9n1Al0D3fDWD zagRuuI+pW5u9jqXX2BUyWATbpV4Yo/H5+EDl9wGwK6SogEJCddj4n9C5v2fy1cSt5qUKxRqiGI 4AWpl8iP4XM7aHt3QZl5/1LYNdwYLLYFU47PUijhjOer0Ha9yO6DWToGEr8RLo1dB/uQLYd/yPV qS/O+yrbNPuqXqXSazoa3Ob6hdm9A7LLoM839WKZ58ve3XdtEZUvy0GqBtO590 X-Received: by 2002:a05:600c:680a:b0:47e:e57d:404 with SMTP id 5b1f17b1804b1-482db46c758mr186158065e9.16.1770067267690; Mon, 02 Feb 2026 13:21:07 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 07/16] memory: Add internal memory_region_set_ops helper function Date: Mon, 2 Feb 2026 22:20:10 +0100 Message-ID: <20260202212019.94205-8-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067389189154100 From: BALATON Zoltan This is a common operation used at multiple places, add a helper function for it. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <25045c95c083e31c6773521ecfe41900738b7bb5.1770042013.git.balato= n@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- system/memory.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/system/memory.c b/system/memory.c index a9032fb2cfe..c51d0798a84 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1559,6 +1559,15 @@ MemTxResult memory_region_dispatch_write(MemoryRegio= n *mr, } } =20 +static void memory_region_set_ops(MemoryRegion *mr, + const MemoryRegionOps *ops, + void *opaque) +{ + mr->ops =3D ops ?: &unassigned_mem_ops; + mr->opaque =3D opaque; + mr->terminates =3D true; +} + void memory_region_init_io(MemoryRegion *mr, Object *owner, const MemoryRegionOps *ops, @@ -1567,9 +1576,7 @@ void memory_region_init_io(MemoryRegion *mr, uint64_t size) { memory_region_init(mr, owner, name, size); - mr->ops =3D ops ? ops : &unassigned_mem_ops; - mr->opaque =3D opaque; - mr->terminates =3D true; + memory_region_set_ops(mr, ops, opaque); } =20 bool memory_region_init_ram_nomigrate(MemoryRegion *mr, @@ -1710,10 +1717,8 @@ void memory_region_init_ram_device_ptr(MemoryRegion = *mr, { memory_region_init(mr, owner, name, size); mr->ram =3D true; - mr->terminates =3D true; mr->ram_device =3D true; - mr->ops =3D &ram_device_mem_ops; - mr->opaque =3D mr; + memory_region_set_ops(mr, &ram_device_mem_ops, mr); mr->destructor =3D memory_region_destructor_ram; =20 /* qemu_ram_alloc_from_ptr cannot fail with ptr !=3D NULL. */ @@ -3780,9 +3785,7 @@ bool memory_region_init_rom_device(MemoryRegion *mr, =20 assert(ops); memory_region_init(mr, owner, name, size); - mr->ops =3D ops; - mr->opaque =3D opaque; - mr->terminates =3D true; + memory_region_set_ops(mr, ops, opaque); mr->rom_device =3D true; mr->destructor =3D memory_region_destructor_ram; mr->ram_block =3D qemu_ram_alloc(size, 0, mr, &err); --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067391; cv=none; d=zohomail.com; s=zohoarc; b=i/Z9cjsSVbl5ZDOpSAVwpjMrg9Bdda9dvrQMVWxLfkvcOuRmdzrxzPE5HyNRLz/+t8ihyTNsffW0pxNTnnVNaxKxB0nTg3JKzc54qf9cEUM8fjiahC6lsLa1OzL1ecJ4Pe+dB1msYpQpsfipiBbfTBOCv9R5ZSU1epF1fWXY47k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067391; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=egZXu3DNBQBdQ3b5iffnLqz+XIAliqZ9sGLkXEZxMkE=; b=lIaqqzgki+tKZPNeKjrY4MO2N3VxvjGCLmmxG1bslahDrrZZlZTnEIQmvQDevN1ZYJ19H2sUDvf17JG1Szglvb4A1kx6jRyVy+AV8PxRlN7f3XS3xF/6guZBVtqy4zfwoVzqkUCUsOLAZnteZK7k9kqe5zbwukSCy8awxjSK4YI= 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 1770067391016879.2212671782223; Mon, 2 Feb 2026 13:23:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Ml-00053k-AV; Mon, 02 Feb 2026 16:21:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1MJ-0004uN-I1 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:33 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1MF-0007Mf-Ge for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:21 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-480142406b3so36656815e9.1 for ; Mon, 02 Feb 2026 13:21:17 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-482dbcf9684sm118700725e9.5.2026.02.02.13.21.13 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067276; x=1770672076; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=egZXu3DNBQBdQ3b5iffnLqz+XIAliqZ9sGLkXEZxMkE=; b=hIYm14CoztFTV/64c0BbuTRGh57jQ4V+IQJGPGhZLMuVEURGXboogWGyw0ZEGC6JbR n89I1HUCSQAaPdMoS0IjhYZIJQM3jQJYPfSLOZ804C+gkBpFWlH2k9r2Z4n9xEPcdt+L gOUHgcwo/AS6xNdJDzn0lY7nLo/jStjLCx7EYaH07Fj1RiH73oq5zRFnU/Mx3Ebj9hJj zr9wHvIsijGxPMLZBm/vsMF4a6lGabRBwZmB4TFHabeUlWjPxd8GATrQM4IpVZY8M6b2 4z0a+/9F4/1VYUFRLRlzjk90RNNC2S9OXSiUBrLSOJiJX/g7Zpv/Hlu0rDiX0MjuJ1qI X/Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067276; x=1770672076; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=egZXu3DNBQBdQ3b5iffnLqz+XIAliqZ9sGLkXEZxMkE=; b=bllfh9hRz4M1LZro2M5Cii1ZxgV24dYI0ybgrVCNpASXk8Efhz22OeJT/4HY9bLNOw EXY3i3dwMjMczc2Y8DtNt4vfJS1TVb+z1gxqA748DsALary7jAHXL7Eq7U519BI6lEpf eW3+wcvQoJzi1iDRBVDC27POVpeQBKtY86nC/HLCFJP29tcmSNDkFnKFxv6TL8rxdA2v 8V6srlfBEAH6n6YGQ42ZvbrlhD38qLv/P2IgLsfQlf4wxHdosbyxR27m0vrs52pDXNzn 10Fuz2krbMcLbMOmwf43JH7nZmco5W8V3vcaGi8D4Mb3jtALZMNRq3653Lycxk6bL/MK pJrg== X-Gm-Message-State: AOJu0YwUV95+VMlxbDyvfLZuG6xJiinH+oHEXAh6OglT7s9w8274FPdZ OX9rVfoMZBp9y+rMEaDvpcUb1STOxorh/UF9cfWLK0GF0SCZWyRgtUuJilIn9Z6v122Yv+bobXV qMVn1gHM= X-Gm-Gg: AZuq6aLVTzxVAtsa6qVzlm9BXU6A/wmmHOok4OaJJrAFcBQGR7FlkQUe+pRVOc14S85 GQrPBks4aUtIC3NBWhmaugT16yqJZhJTBdiHgOQGr5Ofj2OX/xw9IwpChzlWQkW81mwZtGHZ1JN GdRaaXXGf3IcrR5KXSt/GFEIH71n0umY5Rv6awYBKpp2Ky7tFN4TmyqKaL8BPT+WyPj6shZPd2L D8PeLb5lgsnvHn03U/mUGeTQ4QLuAtvJIR651QnQNzlWVmCaENm1qq8dGlx26g1VNfQer63vala DqG1JWqXWH9QNpvRgUCxtRc0oXUpqh3K7pG5ddS5f4utydWXf2DmCmi5ZUu1F9FycBHR28LMBwf 5b5rnv7DjLFCxopScQWtFGcEzCqbX9d/ITUyDMubr+rBBMpO/uhqJ6IrIyH397Px7s+qBoorcF6 h9HQF1xdAjhRgMVpO1mccJp9Eh4BnUwlpKl3tBVcV59JdRo6CE4R9gvfQ+usNmTKDCwTQ79ZI= X-Received: by 2002:a05:600c:628c:b0:480:2521:4d92 with SMTP id 5b1f17b1804b1-482db47ce39mr171234055e9.24.1770067275765; Mon, 02 Feb 2026 13:21:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 08/16] hw/nvme: Fix bootindex suffix use-after-free Date: Mon, 2 Feb 2026 22:20:11 +0100 Message-ID: <20260202212019.94205-9-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067393191154100 From: Akihiko Odaki The bootindex suffix can be used as long as the property is alive. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20260125-nvme-v1-5-0658c31fade9@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvme/nvme.h | 1 + hw/nvme/ns.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 8f8c78c8503..d66f7dc82d5 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -239,6 +239,7 @@ typedef struct NvmeNamespace { DeviceState parent_obj; BlockConf blkconf; int32_t bootindex; + char bootindex_suffix[24]; int64_t size; int64_t moff; NvmeIdNs id_ns; diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 58800b3414a..38f86a17268 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -944,12 +944,11 @@ static void nvme_ns_class_init(ObjectClass *oc, const= void *data) static void nvme_ns_instance_init(Object *obj) { NvmeNamespace *ns =3D NVME_NS(obj); - char *bootindex =3D g_strdup_printf("/namespace@%d,0", ns->params.nsid= ); + + sprintf(ns->bootindex_suffix, "/namespace@%" PRIu32 ",0", ns->params.n= sid); =20 device_add_bootindex_property(obj, &ns->bootindex, "bootindex", - bootindex, DEVICE(obj)); - - g_free(bootindex); + ns->bootindex_suffix, DEVICE(obj)); } =20 static const TypeInfo nvme_ns_info =3D { --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067401; cv=none; d=zohomail.com; s=zohoarc; b=D9H45X3EqHyKoWuc8G4zdskjUnHF/l/y48Sdfplgz0w6nwqOuTgMavKCpoJo2h6T8JFyrYFohDGuaTp4EQ4FPSd4B2Qu38WuV6OWHR/nCY9wH57MHfptryidy5HxDbI2NJIAE0Q+VwBUAK6PHlL65pb//aArGVSZ6RqxmEXW+k8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067401; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=YOB4ISzqeTBlKe8AE9lG6xw3Tze1OPlSd3dhm8vtXvo=; b=F/bCW4vINLakIG9yZouenGMhVuFwgmta9UoFH9WtecHHMC687c6yBncZDq5iGRI1/esDkb1Jw9Svuenu8wJWnq785a6lzOq4aBuCOYJ1eez6vibx0ndtuhvXi8svF4bNN7IvlwUXxy1vD2qTI0BToSqrldb7pYp/erf2AIrDQEM= 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 1770067401523179.29736493196367; Mon, 2 Feb 2026 13:23:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Mu-000564-PE; Mon, 02 Feb 2026 16:22:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Mf-00052z-3i for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:46 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1MK-0007Oq-JO for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:26 -0500 Received: by mail-wm1-x341.google.com with SMTP id 5b1f17b1804b1-47ee3a63300so54689125e9.2 for ; Mon, 02 Feb 2026 13:21:23 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10e476dsm45771548f8f.4.2026.02.02.13.21.21 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067282; x=1770672082; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YOB4ISzqeTBlKe8AE9lG6xw3Tze1OPlSd3dhm8vtXvo=; b=JVS10ID+WI+mh8QssrnDGqeJE4tWoQzvm9QaYeps21UMVuk509k3oSbKVsQeXA2XHE o04NGFeqWTxOAuf+01mp4QktPiO5lSnHB4vPLGYcpMxIN/fSiDvtMMtxua1sQe14Ye9L vrN+zzrMxL37w6ItbIHyVDQPNFhsWq/+pYSYNpGc+Wrcs/61BfqoeM0CBAHQp/AhU1+D m/C7R9+lwAcpNcAuiDUDpNu1qNaRsCAIn5Us+iDXfJ/dx3euIk+JJTqK3c7i/KtNL5Dg 3Teg8aHHrUa3o3TZsWfSisDBkee8gonctnJ673zYBv23iyCjJSZWVEeHbVoysp1bd0LA ZzEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067282; x=1770672082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=YOB4ISzqeTBlKe8AE9lG6xw3Tze1OPlSd3dhm8vtXvo=; b=WkHHp9310ANjgoRMhAGWlCGLvAW82kwjHjwkfsjZ6KVEbZo0zOCTw3FpjZ8i5aR0y7 3ffPW65nKHMwMn8dFXe03IFXmBI7Ev+RA25TDOSF3vE31exZ2TvexMMaXIxdB0yAwM/n nB4P5S/kUUvVjmg8L+o10w1kgIooIh2CWc5q3tpWMGTkkhVzfduBzwPm+WDuzKaPTZfs /kRWT+BO9GS8atMujl15RnBdSSuZODG969Oaio9OaMAUrq269te23OrZ8/57daAvZz9z +LsYO9hi2wDacFhA92hwhi8ohwVbIeGE0Kc/6ofk7SZx5ZkvCmXcuBFkXgVp10A6IRtJ 2yAw== X-Gm-Message-State: AOJu0YyCBuqgRbKHf0ZZLH/rpTZlO6bkgWUczjhWSq5Sao4wlRNHmfCT 2wQAIKnRcZzvHqglTj8VnIOeXomEHHMwJldJRMqJxsJ43kpZW2jzOucHYuX71wDzdH+eYlXOoHK hCNJxPQItKQ== X-Gm-Gg: AZuq6aKKxGoiq9RCHpcA02Tb28A1oqNo7C9mXzRW6S7etyaN03GtnkNinDv8C5k+a26 D9pAl2hPHwimOIvN2Kb+zDinjg4HVyTP6/WRUqJlGvXYFMDgkIefdyL+XgKGVD1D11hx71gvpKL GZv3F+QCIuqNl0EcNyBBAvL2pM8QGCYjLZDOtQNVu21GeGehAcR04eQJ4Z8bTvuc8eKeZPovJyd ybwuM0OIAvF6hIzKbCFlXxdrzM5cFNVFtXHb00x9pbcrAM9wDgouxFHo5AcYKgSCLk6OjvNrdqa DMZxVkwsjIBXap/Cpz9b52km8hyD8SteI2pcCOngZSKy1odM0l7oeJcfV2LalStbJmCE8POynaZ syXYRc53dkqZLbc3LKalYatmdKlycIf10DjzoTR5CvUNSOTCr2lavwzaxyJzgF7bk5CnjuJCEyp TvvknKkfMKNB0/T2pDRk8GQnec80gBa//hJCFlRu5HXabr2j6uT4+pTSHbMk99 X-Received: by 2002:a05:600c:4443:b0:477:79c7:8994 with SMTP id 5b1f17b1804b1-482db4a0fb8mr194153355e9.30.1770067282471; Mon, 02 Feb 2026 13:21:22 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 09/16] hw/ide, scsi-disk: Fix typo on the rotation_rate documentation Date: Mon, 2 Feb 2026 22:20:12 +0100 Message-ID: <20260202212019.94205-10-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philmd@linaro.org; helo=mail-wm1-x341.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067403298154100 From: Alberto Garcia Correct values according to the Medium Rotation Rate field from the Block Device Characteristics VPD page (B1h) of the SCSI specification. Signed-off-by: Alberto Garcia Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20260128102548.224237-1-berto@igalia.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/ide-dev.h | 2 +- hw/scsi/scsi-disk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hw/ide/ide-dev.h b/include/hw/ide/ide-dev.h index 617e8159c77..f5eaaf68e65 100644 --- a/include/hw/ide/ide-dev.h +++ b/include/hw/ide/ide-dev.h @@ -160,7 +160,7 @@ struct IDEDevice { * 0x0000 - rotation rate not reported * 0x0001 - non-rotating medium (SSD) * 0x0002-0x0400 - reserved - * 0x0401-0xffe - rotations per minute + * 0x0401-0xfffe - rotations per minute * 0xffff - reserved */ uint16_t rotation_rate; diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 0f896c27f47..db7d04119e1 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -117,7 +117,7 @@ struct SCSIDiskState { * 0x0000 - rotation rate not reported * 0x0001 - non-rotating medium (SSD) * 0x0002-0x0400 - reserved - * 0x0401-0xffe - rotations per minute + * 0x0401-0xfffe - rotations per minute * 0xffff - reserved */ uint16_t rotation_rate; --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067395; cv=none; d=zohomail.com; s=zohoarc; b=GH9zwhMDRaX0ebQNWyDxNRxh8gndcyuxXhXkLTteWLYFcmb2/PfskAeDqsyliUX/ytpxxHgCSdZGnvkIPYIxCj+1csodX6wmAJ4tF/abPLTIQrhVg6rXXRkw9Odmjdpp/KrYPjJzU1tPrcQ6B7M6hHVzvrc98a8wBQGYh9HINmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067395; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=LmvCGcAGM0gORFw9X5FQy4jvuraTKYHzRY/pBkM5xMg=; b=WFWEyxg6HoWUeStJqZ7LR6ms/+3l9zKIJtMVARmg6RjVAIuOfLJYlCM6c15n3efzeBj9IhcwynGdcenxOsqYpTH7Fj4jmpYG9B4/HdvaebBi+wzo5qtlil6IMqUylRONmsgbVq7guaE3fqexzPr51EWjhDr07deTWWp94Wji2JY= 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 1770067395275889.3285426213636; Mon, 2 Feb 2026 13:23:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1NZ-0005Le-Ho; Mon, 02 Feb 2026 16:22:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Mj-000540-OO for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:50 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Mf-0007PZ-7W for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:48 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-48039fdc8aeso29520805e9.3 for ; Mon, 02 Feb 2026 13:21:33 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483051287cfsm25192125e9.6.2026.02.02.13.21.29 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067292; x=1770672092; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LmvCGcAGM0gORFw9X5FQy4jvuraTKYHzRY/pBkM5xMg=; b=KBdrCYzE3ziN1c9GVxYC+PRNu1jMP0jTUTZa7Kh45fnWwnI7I8qrqGLXEyue6Rjhk9 PDSM8RekXUBu8f/Visfr+aPA0F3NUTl/BnaXI8lR0q/0hSRCvc7dIlRE72X+KjHf5lfH M3WFdNbmS7iSb92QETt/R8DshbwA69MC8xa4IgUjADOgQoYNx0lvMJDeleOGENbA0bRw vxyLLkCwUrEqPBjLtJUHbH+Cr+Zo2FnaJcfjB+bNV3Y6/CDSZ3Ly1Kgeu4WMKXh76F8/ 3+OULVHJR1zUK7CtWpzwwWjpZL05Y4+42OV4eLmDCq1LQHpFrbifWaMVch6FOPzJhgD/ uRDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067292; x=1770672092; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=LmvCGcAGM0gORFw9X5FQy4jvuraTKYHzRY/pBkM5xMg=; b=vU0lYVQk5D83JsF6xKQyYNKkgHI4IPayU/wx58y9mei39LIba2JWwuyjn4Ib6Y25Bm 4pM1wxod0LJkD4XS7b4H0uH3oWO2NlZ9tbBA/4irYjH3DqRc0GTXbVh8qSKhR0BukEaS 2vNNhPjrNIFQONAkeLnkVEyvskzHfKylboNfLgL8ccD/g90/eNAMVu+rHIAw1RLpzqRh +SshSNK3uqiBrTPHN6Nn1y/ty/wLX2CBQD3cr3CBNoMwQztCxIpUtfwv3IOUt12iLaiG kDETBg5weQmesA1g3CWRrAC3tmy9ltKTi1Klvcm5TZ/xb0rJYcOy/2K0Mp3qvaqHT/az IVEA== X-Gm-Message-State: AOJu0YzrsvbL34foJZL/JA+dQCmZgfKDCo1emG+dJZx/jj8iKvDSQMVN AMI3CReSUO9dD71VqeFtgANDMDaLbg1RFdyEdoZDyuqxg9y4bPDUg7XAzNFCNqO9s7FZIVHCWa1 M9jQZdLU= X-Gm-Gg: AZuq6aKdsSdWB0dUkizaN7pv85Sh0FYsgPqclNyanfxkwiix06/uu96VFGjvR6EJqqu SbKlot+kmqb3ejWdzje8UeSEcY7H0vMSPAT36JkPNLQz3tElm4hACh+BCbNjGi+t3sRVNCtyanY mpGevHt2uTmpay2qINnbDa1PKZXM5WgWg9bYwdd16x8MGMAbIQHHx/CcI3vR031UhyFHSKy5vi6 SOqJr2vhDAQI1986qtU/VrU1vX5G5c/0z6sa504wqeLhK1Xszzg5po8aU8EGyb6JsmeXzgYwRfY 37RyKC2d8s0y9wZVLhWTD5IFuPE6oZSS/+XLkBlbnm6V5BminfioofU3/Xzw56oI12ul8Jgyc+p S0aULUceVZXtWZJ7TnFWPg8tJekmdEq8HERq3OSVqm+Q6Mk2Ofp3ZePWp0H8QQOvikM9ioMfAiB L/Q4O17xyXBBx6WpSkpig9fWD758fS1a+GuCta5Eno05FlSB8ZgotKEAt/qZDQ X-Received: by 2002:a05:600c:474f:b0:480:6ab1:ed0d with SMTP id 5b1f17b1804b1-482db452587mr167665915e9.9.1770067291887; Mon, 02 Feb 2026 13:21:31 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 10/16] accel/tcg: Send the CPUTLBEntryFull struct into io_prepare() Date: Mon, 2 Feb 2026 22:20:13 +0100 Message-ID: <20260202212019.94205-11-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067397422158500 From: Jim Shu To let io_prepare() function use the multiple members in CPUTLBEntryFull struct, send the full struct instead of 'xlat_section' member as the argument. It is the preliminary patch of next commit. Signed-off-by: Jim Shu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Mark Burton Reviewed-by: Pierrick Bouvier Message-ID: <20260128152348.2095427-2-jim.shu@sifive.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/cputlb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 6900a126827..82c9b6389dc 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1270,14 +1270,14 @@ static inline void cpu_unaligned_access(CPUState *c= pu, vaddr addr, } =20 static MemoryRegionSection * -io_prepare(hwaddr *out_offset, CPUState *cpu, hwaddr xlat, +io_prepare(hwaddr *out_offset, CPUState *cpu, CPUTLBEntryFull *full, MemTxAttrs attrs, vaddr addr, uintptr_t retaddr) { MemoryRegionSection *section; hwaddr mr_offset; =20 - section =3D iotlb_to_section(cpu, xlat, attrs); - mr_offset =3D (xlat & TARGET_PAGE_MASK) + addr; + section =3D iotlb_to_section(cpu, full->xlat_section, attrs); + mr_offset =3D (full->xlat_section & TARGET_PAGE_MASK) + addr; cpu->mem_io_pc =3D retaddr; if (!cpu->neg.can_do_io) { cpu_io_recompile(cpu, retaddr); @@ -1981,7 +1981,7 @@ static uint64_t do_ld_mmio_beN(CPUState *cpu, CPUTLBE= ntryFull *full, tcg_debug_assert(size > 0 && size <=3D 8); =20 attrs =3D full->attrs; - section =3D io_prepare(&mr_offset, cpu, full->xlat_section, attrs, add= r, ra); + section =3D io_prepare(&mr_offset, cpu, full, attrs, addr, ra); mr =3D section->mr; =20 BQL_LOCK_GUARD(); @@ -2002,7 +2002,7 @@ static Int128 do_ld16_mmio_beN(CPUState *cpu, CPUTLBE= ntryFull *full, tcg_debug_assert(size > 8 && size <=3D 16); =20 attrs =3D full->attrs; - section =3D io_prepare(&mr_offset, cpu, full->xlat_section, attrs, add= r, ra); + section =3D io_prepare(&mr_offset, cpu, full, attrs, addr, ra); mr =3D section->mr; =20 BQL_LOCK_GUARD(); @@ -2499,7 +2499,7 @@ static uint64_t do_st_mmio_leN(CPUState *cpu, CPUTLBE= ntryFull *full, tcg_debug_assert(size > 0 && size <=3D 8); =20 attrs =3D full->attrs; - section =3D io_prepare(&mr_offset, cpu, full->xlat_section, attrs, add= r, ra); + section =3D io_prepare(&mr_offset, cpu, full, attrs, addr, ra); mr =3D section->mr; =20 BQL_LOCK_GUARD(); @@ -2519,7 +2519,7 @@ static uint64_t do_st16_mmio_leN(CPUState *cpu, CPUTL= BEntryFull *full, tcg_debug_assert(size > 8 && size <=3D 16); =20 attrs =3D full->attrs; - section =3D io_prepare(&mr_offset, cpu, full->xlat_section, attrs, add= r, ra); + section =3D io_prepare(&mr_offset, cpu, full, attrs, addr, ra); mr =3D section->mr; =20 BQL_LOCK_GUARD(); --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067366; cv=none; d=zohomail.com; s=zohoarc; b=nSCQAvHckFCRfrGl82WxUjGdKKPggygRgE7EDvcIlwJwUqfHpeYIVa+cyewDscJzTciWe3tjMlYtr0akOgH4aM4YaR38VT6crzWcn7XqUwQoxTCp3zyeRoK3mAjFnGiRDo9yeZBpwFOLfLiSMgYc9M64YQEDQC00EIQ2AB/hLyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067366; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=WuWggxfl7YWGc0iIVpyLoNSrAHblpQuEzJfAm/Kjzwc=; b=WH+YZftfBr892BJQE7mSdFlA3MdQHxtXRdVWmlQ5I+vruAo4gT5nHj9v1y2CKLv+6GOcMO1YoBcC3QI5tVuIuC3NrWpR8P5tbt+xVBhZkdZioUTtAurL7pgWQIVeGz/lAHLU73x5LgH3qhSODxA4rYC3j10xtTNxeQVZiQWJo5M= 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 1770067365877171.72848264077538; Mon, 2 Feb 2026 13:22:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1N1-00057U-MX; Mon, 02 Feb 2026 16:22:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Mi-00053j-KG for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:49 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Me-0007Ps-U2 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:47 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4807068eacbso41294445e9.2 for ; Mon, 02 Feb 2026 13:21:40 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e131cfd4sm44575192f8f.25.2026.02.02.13.21.37 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067298; x=1770672098; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WuWggxfl7YWGc0iIVpyLoNSrAHblpQuEzJfAm/Kjzwc=; b=DjNfFtzRkAT5Oi9cZMsQuACeLKLEwHX97ZdaWB/8FNv2HO3Y83AAwKHj3vAma3HgU2 FoVlVO8bV1T6EoMLEpSntgSAjJTcE01HB7hWkM6UaGzACbEwJJtN7WbpnUCcccuKS6h1 tREq9iHCesYiD2E6cpITqozgdPc7lyI7uV6GWxZsYGjZbK+Murt1qP8f2N0Pn/mBxnDn 20z1f/RNDQof53g+JokNwOF/F4XYfSkKsBfZhfmbLPzBz++XgnWb8sCQ3R0T+5glriBA IssSVLlekDV+3Vt8udooqIRmjjNioFhP2+35XpmRTIbvGLuoN9EPtymiqf/CXMjK/TAT cJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067298; x=1770672098; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=WuWggxfl7YWGc0iIVpyLoNSrAHblpQuEzJfAm/Kjzwc=; b=VH9XkXoKlOmUhiFRrRv7kY8x4qM0UNeLj0vWWyuh7aYQH9Lr51SduUI065BFDZYpUP DntIaRl3qXz4acbx3xyapT5S8T+bvLlSSn2Mg3jobwX0WHcQerpVf0VUCTjR2l3nLeKP hsi9my+f4HNQMJ12ePwfzqJRaKKeWLiBOH5w5DeFfzPuUrQQVXFGXpd7GyIKY+itII/E 06LzPtDRN3htAQbGiSZACDRgddGhF8Nh8QZ5Gj2bVHb6kKwnG+e06RzWaI4DTSzEZHDr mA3I6xpiv1JDLkoSj0UnH0p9WynGwCFfGk2qoUTFJV+Npm2cKeK2yi0rzlKNg/2y7ABH iqAA== X-Gm-Message-State: AOJu0YyN9V+p4jHjX4j3UlcNvhAczzu36+nXMuLj7e6gfDP3TSCDsjwJ nUhLwOQSRVMlDnCbLERYDM7RaMB4+6N0/ocIDW9Fm7aqnAqqKlA8iyJ9GWHsMTBZxzP7M9+C7h5 6orwjaDE= X-Gm-Gg: AZuq6aLnW2WRLXCkrv/pSHl10UotIRxDEvjSyO7hSIGUKCxCFodDnY2OFVUow30YZCe Hez/u0gpEKeMkf29t2amp+ukWIR2oqHwC4osJlwmMjLZpzhXtJTfZ/edLiyG44I8D9991cX6oRq s5YDekOKEhaQDEqi3JqZfPwE1rWUMMtFRDZvWCXFhJJVZlSivOKkbLlTcfgUwlE1ba2j69CcQvx ZfDP4jKE6AeDhwuD/TKdbH/bnT11ZwPLCOu3TFrKKNORlmsndLv/r5IGW5FG+D2XVLwS/JxN0r2 NDbC4pXCiRkABpaq3M4rg6ioR5C2lmJZkNSshsV9vYVCLWAEBJpqxU1duE+IoZ3/7CSy27eKiQt XRtLrYtpFBYEVf3aSdYbAYDx5NMOIp2RnIRlqu2M6qqviNjoqZ/TyoeezOYs2uU5RkxKGugxs7k G4U79i0QlvkS7WDTlrK7hbfS9cXV8iPhSvtT+1sjZw/wUFcVUuveS0DzkXXc2r X-Received: by 2002:a05:600c:a00a:b0:480:4a90:1b00 with SMTP id 5b1f17b1804b1-482db47d460mr168420295e9.20.1770067298426; Mon, 02 Feb 2026 13:21:38 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 11/16] accel/tcg: Fix iotlb_to_section() for different AddressSpace Date: Mon, 2 Feb 2026 22:20:14 +0100 Message-ID: <20260202212019.94205-12-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_SBL=1.623 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067368941154100 From: Jim Shu 'CPUTLBEntryFull.xlat_section' stores section_index in last 12 bits to find the correct section when CPU access the IO region over the IOTLB. However, section_index is only unique inside single AddressSpace. If address space translation is over IOMMUMemoryRegion, it could return section from other AddressSpace. 'iotlb_to_section()' API only finds the sections from CPU's AddressSpace so that it couldn't find section in other AddressSpace. Thus, using 'iotlb_to_section()' API will find the wrong section and QEMU will have wrong load/store access. To fix this bug of iotlb_to_section(), store complete MemoryRegionSection pointer in CPUTLBEntryFull to replace the section_index in xlat_section. Rename 'xlat_section' to 'xlat' as we remove last 12 bits section_index inside. Also, since we directly use section pointer in the CPUTLBEntryFull (full->section), we can remove the unused functions: iotlb_to_section(), memory_region_section_get_iotlb(). This bug occurs only when (1) IOMMUMemoryRegion is in the path of CPU access. (2) IOMMUMemoryRegion returns different target_as and the section is in the IO region. Common IOMMU devices don't have this issue since they are only in the path of DMA access. Currently, the bug only occurs when ARM MPC device (hw/misc/tz-mpc.c) returns 'blocked_io_as' to emulate blocked access handling. Upcoming RISC-V wgChecker [1] and IOPMP [2] devices are also affected by this bug. [1] RISC-V WG: https://patchew.org/QEMU/20251021155548.584543-1-jim.shu@sifive.com/ [2] RISC-V IOPMP: https://patchew.org/QEMU/20250312093735.1517740-1-ethan84@andestech.com/ Signed-off-by: Jim Shu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Mark Burton Reviewed-by: Pierrick Bouvier Message-ID: <20260128152348.2095427-3-jim.shu@sifive.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/accel/tcg/iommu.h | 15 --------------- include/exec/cputlb.h | 4 ++-- include/hw/core/cpu.h | 17 +++++++++-------- accel/tcg/cputlb.c | 22 ++++++++++------------ system/physmem.c | 25 ------------------------- 5 files changed, 21 insertions(+), 62 deletions(-) diff --git a/include/accel/tcg/iommu.h b/include/accel/tcg/iommu.h index 90cfd6c0ed1..547f8ea0ef0 100644 --- a/include/accel/tcg/iommu.h +++ b/include/accel/tcg/iommu.h @@ -14,18 +14,6 @@ #include "exec/hwaddr.h" #include "exec/memattrs.h" =20 -/** - * iotlb_to_section: - * @cpu: CPU performing the access - * @index: TCG CPU IOTLB entry - * - * Given a TCG CPU IOTLB entry, return the MemoryRegionSection that - * it refers to. @index will have been initially created and returned - * by memory_region_section_get_iotlb(). - */ -MemoryRegionSection *iotlb_to_section(CPUState *cpu, - hwaddr index, MemTxAttrs attrs); - MemoryRegionSection *address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, @@ -34,8 +22,5 @@ MemoryRegionSection *address_space_translate_for_iotlb(CP= UState *cpu, MemTxAttrs attrs, int *prot); =20 -hwaddr memory_region_section_get_iotlb(CPUState *cpu, - MemoryRegionSection *section); - #endif =20 diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h index 0d1d46429c9..3a9603a6965 100644 --- a/include/exec/cputlb.h +++ b/include/exec/cputlb.h @@ -44,8 +44,8 @@ void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr= _t length); * @full: the details of the tlb entry * * Add an entry to @cpu tlb index @mmu_idx. All of the fields of - * @full must be filled, except for xlat_section, and constitute - * the complete description of the translated page. + * @full must be filled, except for xlat_offset & section, and + * constitute the complete description of the translated page. * * This is generally called by the target tlb_fill function after * having performed a successful page table walk to find the physical diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 61da2ea4331..98678704a64 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -219,15 +219,16 @@ typedef uint32_t MMUIdxMap; */ struct CPUTLBEntryFull { /* - * @xlat_section contains: - * - in the lower TARGET_PAGE_BITS, a physical section number - * - with the lower TARGET_PAGE_BITS masked off, an offset which - * must be added to the virtual address to obtain: - * + the ram_addr_t of the target RAM (if the physical section - * number is PHYS_SECTION_NOTDIRTY or PHYS_SECTION_ROM) - * + the offset within the target MemoryRegion (otherwise) + * @xlat_offset: TARGET_PAGE_BITS aligned offset which must be added to + * the virtual address to obtain: + * + the ram_addr_t of the target RAM (if the physical section + * number is PHYS_SECTION_NOTDIRTY or PHYS_SECTION_ROM) + * + the offset within the target MemoryRegion (otherwise) */ - hwaddr xlat_section; + hwaddr xlat_offset; + + /* @section contains physical section. */ + MemoryRegionSection *section; =20 /* * @phys_addr contains the physical address in the address space diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 82c9b6389dc..76546c66515 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1090,7 +1090,7 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx, } } else { /* I/O or ROMD */ - iotlb =3D memory_region_section_get_iotlb(cpu, section) + xlat; + iotlb =3D xlat; /* * Writes to romd devices must go through MMIO to enable write. * Reads to romd devices go through the ram_ptr found above, @@ -1141,10 +1141,9 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx, /* * When memory region is ram, iotlb contains a TARGET_PAGE_BITS * aligned ram_addr_t of the page base of the target RAM. - * Otherwise, iotlb contains - * - a physical section number in the lower TARGET_PAGE_BITS - * - the offset within section->mr of the page base (I/O, ROMD) with = the - * TARGET_PAGE_BITS masked off. + * Otherwise, iotlb contains a TARGET_PAGE_BITS aligned + * offset within section->mr of the page base (I/O, ROMD) + * * We subtract addr_page (which is page aligned and thus won't * disturb the low bits) to give an offset which can be added to the * (non-page-aligned) vaddr of the eventual memory access to get @@ -1154,7 +1153,8 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx, */ desc->fulltlb[index] =3D *full; full =3D &desc->fulltlb[index]; - full->xlat_section =3D iotlb - addr_page; + full->xlat_offset =3D iotlb - addr_page; + full->section =3D section; full->phys_addr =3D paddr_page; =20 /* Now calculate the new entry */ @@ -1276,8 +1276,8 @@ io_prepare(hwaddr *out_offset, CPUState *cpu, CPUTLBE= ntryFull *full, MemoryRegionSection *section; hwaddr mr_offset; =20 - section =3D iotlb_to_section(cpu, full->xlat_section, attrs); - mr_offset =3D (full->xlat_section & TARGET_PAGE_MASK) + addr; + section =3D full->section; + mr_offset =3D full->xlat_offset + addr; cpu->mem_io_pc =3D retaddr; if (!cpu->neg.can_do_io) { cpu_io_recompile(cpu, retaddr); @@ -1336,7 +1336,7 @@ static bool victim_tlb_hit(CPUState *cpu, size_t mmu_= idx, size_t index, static void notdirty_write(CPUState *cpu, vaddr mem_vaddr, unsigned size, CPUTLBEntryFull *full, uintptr_t retaddr) { - ram_addr_t ram_addr =3D mem_vaddr + full->xlat_section; + ram_addr_t ram_addr =3D mem_vaddr + full->xlat_offset; =20 trace_memory_notdirty_write_access(mem_vaddr, ram_addr, size); =20 @@ -1593,9 +1593,7 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int= mmu_idx, =20 /* We must have an iotlb entry for MMIO */ if (tlb_addr & TLB_MMIO) { - MemoryRegionSection *section =3D - iotlb_to_section(cpu, full->xlat_section & ~TARGET_PAGE_MASK, - full->attrs); + MemoryRegionSection *section =3D full->section; data->is_io =3D true; data->mr =3D section->mr; } else { diff --git a/system/physmem.c b/system/physmem.c index b0311f45312..d17596a77fb 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -747,31 +747,6 @@ translate_fail: return &d->map.sections[PHYS_SECTION_UNASSIGNED]; } =20 -MemoryRegionSection *iotlb_to_section(CPUState *cpu, - hwaddr index, MemTxAttrs attrs) -{ - int asidx =3D cpu_asidx_from_attrs(cpu, attrs); - CPUAddressSpace *cpuas =3D &cpu->cpu_ases[asidx]; - AddressSpaceDispatch *d =3D address_space_to_dispatch(cpuas->as); - int section_index =3D index & ~TARGET_PAGE_MASK; - MemoryRegionSection *ret; - - assert(section_index < d->map.sections_nb); - ret =3D d->map.sections + section_index; - assert(ret->mr); - assert(ret->mr->ops); - - return ret; -} - -/* Called from RCU critical section */ -hwaddr memory_region_section_get_iotlb(CPUState *cpu, - MemoryRegionSection *section) -{ - AddressSpaceDispatch *d =3D flatview_to_dispatch(section->fv); - return section - d->map.sections; -} - #endif /* CONFIG_TCG */ =20 void cpu_address_space_init(CPUState *cpu, int asidx, --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067397; cv=none; d=zohomail.com; s=zohoarc; b=bzuoNa8nJzkr3CUzbBrsV5S7QghMzJ02IONwcPB9ESWSjGmj4WyZy6vdrZBMs/lYDUFQYGcSV1AIw6g6LZkADYgHjjeVmQN2ohpckbBuqt/ot3OgWv+KydTtYX/yIonN88VhoA+h+/zrVdf0/xaOO//IOrO8w9FxVEiSmqrxTXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067397; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=h8AH44wPQHZpOUXhv2UytKh40nLP9b1Xn9FHzgyG/Pc=; b=fPe6+JeCjSumxhctKhPIInfdsflfYj28YAOp7NEMnet0Fg/hbanth/uqDaKIhidhPbs/LeNBKaaAl6YenSFkjbHqX3OZILBdEB8gl15OrmOToMqWfBQVPCcXFeYfoc6YkHbdhJ0NrEg+gbuurSjIlLyEuNorl5n8MxAAfljwqD0= 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 1770067397414110.26483173420024; Mon, 2 Feb 2026 13:23:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Ni-0005fs-PJ; Mon, 02 Feb 2026 16:22:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Mj-000543-PD for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:50 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Mh-0007TN-8l for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:49 -0500 Received: by mail-wr1-x443.google.com with SMTP id ffacd0b85a97d-4359249bbacso104327f8f.0 for ; Mon, 02 Feb 2026 13:21:46 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10e474csm45486985f8f.2.2026.02.02.13.21.44 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067305; x=1770672105; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=h8AH44wPQHZpOUXhv2UytKh40nLP9b1Xn9FHzgyG/Pc=; b=Yj38lTkS+KdBl6MGuuP2o3yVehsjM726yYKgEUzlte2bispilBw/dFd2JzlbO0MlBB 8T8SUPAk4Xeil/wXyvKf9gCd28blRmDCj2FfvZ74SZ+fFDr0etmzu/bCapx0lPjwVSbU px9rnJl3paAHTR3OIKOpCApD0226f9yGVKFK6ytMa+IJQ6FlhAd6w9Oju2mCHhqli+xg oYuvD083Sieb8U+tOUmu4eUbB45yv3LMbd8Y6ksr30JPw9dOy6yd5x/DS19Xc3wclro/ u3tUmvhM1RP6lh6G2Wla78th4W+QSBQqVH4l3FJzycXC4nrp5EZB3bITqgtJSV8Kky+l 0pZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067305; x=1770672105; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=h8AH44wPQHZpOUXhv2UytKh40nLP9b1Xn9FHzgyG/Pc=; b=fKjpQT0ktpy2tH56V5Sub2ZJJOVitXvzjmok6qBsDFkv1Tl83g3dAiwmlsXu5IT4yL NLIaeJruo/1NPtez4RwZWRgSKK1BQGMryaWeHlsYpQPUs9EczlXHVOEBtSQyLayefM2i SjgZL6Be1SWaqomWCGRuptEzULYVVInQj0uZQXBkpV7QDM9ch1CWlQJpayMUIKC+UPTr 57+Ld/jkKK3lgj8HWwarLuMz7b1SWyCNn3c1gssfNRhu9HufPdIRej6LzTNLZeqGB/oe XN5gxsk/d8ndLnEJ69lGlCsQ5TUuhHEubcJOfXJDcGRVNUEv75aqCReA9jIy9orlZmea Ee9w== X-Gm-Message-State: AOJu0YxEndjJ6aKoUXRXxbiGof5uQrUjAFH07uy1TbFdu1K3CKyQBggH dlBO/Nh6Jxc1BFLTZxWtQ3qI/Witu1H25px8DVfMWU26j8r9hUn0QMeY2czWRR56p60rPINNChg nb/JFOuX8Qw== X-Gm-Gg: AZuq6aK094du4Bt+6fyFm+gnWMP6WM3bzSAleEJOSa9l5C7sqdlU43nt5v12kDgpKYU kyDngXsCzTy/uAenPhqjhWGzRmPhwDLcRJTUGMhdfY4KAWxthLeQOzolTUVJMEiULcVTb7p8btd P1j0b1bUzmnEd5Jog88DYdwhsLIu5N1Fkv5jgB0l3HJsuB8XCN5TvF3pBOdUmZUA95+3WI4ns/R XI2tpRyVFk1b6P9+f8lsOeJ7cE57fHH/IcWnO8znPEeknclwSPa5i7jrMdlRj6qEGtbcerNU0yT ++5uZZ8dGgbDwE94PWY0M1aJB6Huje0HATaml/M7DY4dDcumH0l9zYT7zTuUp2eIMhAYFJm2ZNB 8ZCIQpLLahY6RluTm2uON6AdoIcQh+JXpn5cZ/Q4ENFcvO0TXJghqCbwI8Y/2TWSOTAFpc8blg6 Sa/XEaMv9jllpVIVJvCKEdwfJiZjS0CElj2S6FZERsi7Idd05Xqg5uYeLYtBj1 X-Received: by 2002:a5d:5c8a:0:b0:430:f2ee:b21f with SMTP id ffacd0b85a97d-43611427af4mr1281296f8f.22.1770067304885; Mon, 02 Feb 2026 13:21:44 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 12/16] system/physmem: Remove the assertion of page-aligned section number Date: Mon, 2 Feb 2026 22:20:15 +0100 Message-ID: <20260202212019.94205-13-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philmd@linaro.org; helo=mail-wr1-x443.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067399290158500 From: Jim Shu We don't need to OR the physical section number anymore since we now directly have a pointer on the memory section. Signed-off-by: Jim Shu Reviewed-by: Pierrick Bouvier Message-ID: <20260128152348.2095427-4-jim.shu@sifive.com> [PMD: Reworded description per Pierrick's comment] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- system/physmem.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index d17596a77fb..2fb0c25c93b 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1323,12 +1323,6 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr = base); static uint16_t phys_section_add(PhysPageMap *map, MemoryRegionSection *section) { - /* The physical section number is ORed with a page-aligned - * pointer to produce the iotlb entries. Thus it should - * never overflow into the page-aligned value. - */ - assert(map->sections_nb < TARGET_PAGE_SIZE); - if (map->sections_nb =3D=3D map->sections_nb_alloc) { map->sections_nb_alloc =3D MAX(map->sections_nb_alloc * 2, 16); map->sections =3D g_renew(MemoryRegionSection, map->sections, --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067388; cv=none; d=zohomail.com; s=zohoarc; b=JQEUfMXTd5PO7b79T3Tg/mQhqH5lOXBZdAvybmNJnRC2gYHlRSLNrlpgHChHOGHrisq8JJ61C0m+bbP7DvYtO8aKDgLSieP5+QayrBfHXJhFlkQASxm7t49Rlglqy65D3iPCjty/cK2UQ4uUEQrrMabJ8Y0erb4w85atZqv5Zpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067388; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=/yVA3QElwpb8w5P7zafXnevtaEDG4kPe47I4rDtxzQs=; b=OccoTxY2WMv+TeO+G+0R1wszbeUQIY371ElgWlxuE/oF6ghyH2MAlKgGETMjv0bOSfSV8z3al1qj3nmBstxVFVw23NnVeZjdWsbvi7ZNUVCpUeXR21PXOPgayT0dl0fZinRcpj7CkC04OJhfXRISayX6o16tuySbB+BCFVdLTwc= 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 1770067388061160.4610031547702; Mon, 2 Feb 2026 13:23:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Ni-0005eT-Mg; Mon, 02 Feb 2026 16:22:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Mp-00055f-20 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:56 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Mn-0007Zj-Fz for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:21:54 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47d6a1f08bbso23531315e9.2 for ; Mon, 02 Feb 2026 13:21:53 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10e48a6sm45266091f8f.8.2026.02.02.13.21.50 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067312; x=1770672112; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/yVA3QElwpb8w5P7zafXnevtaEDG4kPe47I4rDtxzQs=; b=rZ3esbDHRZelSmNCmTd5D9gpAXErac/FLrXhibl7fdms3cJxcntSlWgJLjQ9KWhPEC j7+gS8FIHZUnErCLGOR8O6ReFj/GkS/HBbY7WrFbOzyvXM9/7y2KmS2EjbM6JpeBvpsc 7ZuMNw5sG8S6bL1DxSoi19ciPk38UtYLcp65Ez4qNcMGPWv5pS5+3v1uOycTAT9AxDIt 3KZ8jUjZMIvrmOXRoql5SymTRS35GJIM4NewYY4P4/8MGSrjlL9lluiz4N7rWFogWpn3 Db9ZVRbYrYzbXvdblRR7ccgSMwo3X+JHwLLBgy76/TbdM45W2KPc+7NRGOsTlqXRp2ex b54w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067312; x=1770672112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/yVA3QElwpb8w5P7zafXnevtaEDG4kPe47I4rDtxzQs=; b=nMpmZzoVStdNB/yejcgWLX7IV+0lp9FEP99aFLed2R6N0b8IugQXjopbggoBbu3WKR 7WeBWUKH6Ao0a7oPKBvs1akwFryYCA7FQ9vejxweuKJvEp0u+pu7kury8beENls6kUf8 yxZUqv9z06nV98Q+lpfV+k2+IpEkvVbofQg9BnELPeYdOKkFFrSmC1+mJN4xZxT3zN1T 5lyFF8kuYQI04JgQxdPWS9h00f51Jcx6KBFpaGby5tVLJyCbFHE+1RVKBrTnmQFglZW6 KeWcsCCWv00l9wcX5Urgt1vbpgGjIFMGEmA8hx31hWCv0pfSOP5yHw/NBD5HyEQZQBxT bwbA== X-Gm-Message-State: AOJu0YxSGwHp/QwuCPoAUdYXsKFik5PZifywRkCKXRAdhy8PZcpjHB5b SN/Gz4iqid7tfZj6HBnhW33veKtZ3ANlUgrwsJpeJ0aqgGAMc4dTAHBwdEDGAMbK/9ZnFD2IO6C T6rgxxtY= X-Gm-Gg: AZuq6aJcOyxeFkN7EjtXckmaX5DWoUK1sgt7tFE+OY73tqFqros1GxOpU9VjmBNdw9z JbWOC45MN/Q3rSEIBSakiZwF+Ih8R22Qyu4CoAOhXY36UTvmVh+2/XVOXd2Gwg9QqGLL/2uLogf Q07bgI8imVQHe4bxH97iucH3bvAMQ9rwJM/EEhfLsmm8Uib2L4SpcALj6ez5J91EUEUu/pEGFPH PzLSmpgEQSRSvcOzzPOlB5XE8hRGqROrK47O9XtMFRdt9WlyKyC6NcZ/T/cFYi+5Vx9hldzGdGs 7RVE3mP2ES9BSLbFHcY91aKDPQb6tfLwq6QgppQ8n7IZ+b6lffbpYjWlekpzj44KgZG8Cvg/VRd Vud92QXy5pr0e/slgrnqgQnWPl4ckT+XkgPoNw+qxkkzvE/dn/6Shy9Lb/5IonouVLOST2U72eM CX0PxePmsyGXdaDKVEttjuH4gANKoKkKTT+35/Z1ZyqOAolWtb3jsa4wA2u/Mt X-Received: by 2002:a05:600c:c4a3:b0:45d:dc85:c009 with SMTP id 5b1f17b1804b1-482db49b168mr180904405e9.10.1770067311653; Mon, 02 Feb 2026 13:21:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 13/16] target/i386: Include missing 'svm.h' header in 'sev.h' Date: Mon, 2 Feb 2026 22:20:16 +0100 Message-ID: <20260202212019.94205-14-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067389281158500 "target/i386/sev.h" uses the vmcb_seg structure type, which is defined in "target/i386/svm.h". Current builds succeed because the files including "target/i386/sev.h" also include "monitor/hmp-target.h", itself including "cpu.h" and finally "target/i386/svm.h". Include the latter, otherwise removing "cpu.h" from "monitor/hmp-target.h" triggers: ../target/i386/sev.h:62:21: error: field has incomplete type 'struct vmcb= _seg' 62 | struct vmcb_seg es; | ^ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Zhao Liu Message-Id: <20260129164039.58472-2-philmd@linaro.org> --- target/i386/sev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/sev.h b/target/i386/sev.h index 9db1a802f6b..4358df40e48 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,6 +14,8 @@ #ifndef I386_SEV_H #define I386_SEV_H =20 +#include "target/i386/svm.h" + #ifndef CONFIG_USER_ONLY #include CONFIG_DEVICES /* CONFIG_SEV */ #endif --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067404; cv=none; d=zohomail.com; s=zohoarc; b=MEVEU8CjiE6QvYLPnZLOHObzT9sRALWtoRTOW3emdcXCRHi7a/d0eO8g8M0nkNPf+RIWv2S7syTrjxNyBdsnBZeFtNIuNsDtEOvi9MgRa3dswmAOQbHp5I4GnZxO7hwAiaA7nl07WcV3F+iLU3qbCMMjxmW7I5khCFG/EXQrh+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067404; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=u5Ye71+xXX+oIQeSRnGD+1875IhK3YEl0jQp6kUTrts=; b=LUIbvd7xlUl0uBpfYt3btpDrcp27zAL1XwVDeb3AHtEzldQ/B4xS8OPyxgO9qEZ+0XmmQGDMCZD/9gGVv+yOGoROYqYqq1FP+kOPKqERq/EVHnzNY327ICnIPwUvTr2MB3WV1OB6Ibrgw3gcjzGGZ0xpGMP6nAATAUtx4EgSvwA= 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 1770067404392137.80267618828884; Mon, 2 Feb 2026 13:23:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Nh-0005Zz-GI; Mon, 02 Feb 2026 16:22:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1Mw-000572-8f for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:22:04 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1Mu-0007cd-Fa for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:22:02 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-47ee937ecf2so1504175e9.0 for ; Mon, 02 Feb 2026 13:22:00 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483051287cfsm25232975e9.6.2026.02.02.13.21.57 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067318; x=1770672118; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=u5Ye71+xXX+oIQeSRnGD+1875IhK3YEl0jQp6kUTrts=; b=m0mBP/9vCuNoNaTBc6owj+ZbcUFukgW3mqWbxBa127DiEecmHjNnv4rWv5yWUTwhCf 0wGVAe2zlvD0TNZr+HO47uJU7vqaKAtyulklKWN+anzjZku1wd4oEeaK6H/WbG4AOHoC kmDxnu2p0rkEIqPbd7uo0CU3ij05fM7N8UtSSv3PeBsl6wk7oB6yeG8R6YE/CCtFsqAN vne1GCYE0dD02GIXjjarr4hSD/8Xamj1zOLAA4DDF8BTows+8FsPKHaRiLlDg8cNLZc6 ZvP/acQHLyU+xqYyjXQzhYMHZ50gkxE83dfMoEK/hyXGj5MdK+WeBuoz3UY+rJ7JzK2B xJ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067318; x=1770672118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=u5Ye71+xXX+oIQeSRnGD+1875IhK3YEl0jQp6kUTrts=; b=ejRQ/jhfd5aqkI35JfVATXRVVHePoLrxYguoP/AIUpjHlGfcUU3ivL29wtbo/1XgGN ms7jGLNLWhdGmERruti9smgGrqEBjlmNumKvt6aQZQ+EsA2BnXArAUEMMDMHy/IE29Mj PdyyHLDQjsd/4L+0BoGZNYDM03nTn+2VYJwHhLr8mLipVC5+WVHCVus+jXZO/E445OVc nK3cKFZFDWNO5H8nmqwFAbZJgGaInNpHPSIAfxJ13UcIfs+PlJb1OYGaS4WK3Q37dym0 1uyoMGD/5vf3WfS+pMke2cxG6K/rJi+wzlsZ28Zjbt93F0LBbL1hcZ6aJUEbD7vea5A4 qfSQ== X-Gm-Message-State: AOJu0YyiMHENj3sQVwm9ydBnbwLshbcPZSJN0+F/9AdllQQItiSEXfc8 l1tV8GFzsOz0SfC3eZY97bek/0rikZ5QVjhr2VnMiZMSanw5CTb2DTTbAdezw5ni1gP6O9gOeY3 0XWHKZp4= X-Gm-Gg: AZuq6aKii/SDYihasj04eQvAlezJKrbhaIOEmM9OwhSUcp28cCaXrrHpAusGKUliTZ+ Ugg7R9couT8KkgE36EfRkoQqfLt2cGUM7hqZIkQLQGbGSnnumA9qMWxwjzGC4Eogx/ACfupgCrn hBNgiMKynuiFnO64O68kK5eM/BTZt65hbjJQlAN/cpScWi1BjDqsFFEr0dLXOwWxsDnXu/8kO3j QQUtGikMGwjVGzlY2DLn0VkRAwg6jtx6tKO7krp0oNgUBjL0d8FK0g42pNaEGuxrPO7t6PWvol3 +ScMydR+6wu7mzFQI2AY0GaMCug1H93CFstHwCgr40e/T9Q3nz/iL4I9NhQ+K+fguxm52WT7Jd8 JVNGFLbFd1OiItVyUGdBahZe1IBcpNNhmXRIcftattgd5Se/51gc2e4OYfxpZH0dGz98pxc+jwv fg0rMf4NSogzIv6CcQlYf8gwRxiPaQfMOolhyZuQ/MECbKp3aVoQ/ex/4zJc7I X-Received: by 2002:a05:600c:4743:b0:477:a289:d854 with SMTP id 5b1f17b1804b1-483051371f9mr14562495e9.5.1770067318488; Mon, 02 Feb 2026 13:21:58 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 14/16] monitor: Reduce target-specific declarations Date: Mon, 2 Feb 2026 22:20:17 +0100 Message-ID: <20260202212019.94205-15-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067405427158500 Some declarations do not depend on target-specific types, move them out of "monitor/hmp-target.h" to "monitor/hmp.h". Commit 409e9f7131e ("mos6522: add "info via" HMP command for debugging") declared hmp_info_via() is declared twice. Remove the one in "hw/misc/mos6522.h" otherwise we get: In file included from ../hw/misc/mos6522.c:33: include/monitor/hmp.h:43:6: error: redundant redeclaration of 'hmp_info_v= ia' [-Werror=3Dredundant-decls] 43 | void hmp_info_via(Monitor *mon, const QDict *qdict); | ^~~~~~~~~~~~ In file included from ../hw/misc/mos6522.c:29: include/hw/misc/mos6522.h:175:6: note: previous declaration of 'hmp_info_= via' with type 'void(Monitor *, const QDict *)' 175 | void hmp_info_via(Monitor *mon, const QDict *qdict); | ^~~~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20260129164039.58472-3-philmd@linaro.org> --- include/hw/misc/mos6522.h | 2 -- include/monitor/hmp-target.h | 14 -------------- include/monitor/hmp.h | 13 +++++++++++++ hw/i386/sgx-stub.c | 1 + hw/i386/sgx.c | 1 + monitor/hmp-cmds.c | 1 + target/i386/cpu-apic.c | 1 + target/i386/sev-system-stub.c | 1 + target/i386/sev.c | 1 + target/m68k/monitor.c | 1 + target/riscv/monitor.c | 1 + 11 files changed, 21 insertions(+), 16 deletions(-) diff --git a/include/hw/misc/mos6522.h b/include/hw/misc/mos6522.h index 150e30a2c11..82838d09106 100644 --- a/include/hw/misc/mos6522.h +++ b/include/hw/misc/mos6522.h @@ -172,6 +172,4 @@ extern const VMStateDescription vmstate_mos6522; uint64_t mos6522_read(void *opaque, hwaddr addr, unsigned size); void mos6522_write(void *opaque, hwaddr addr, uint64_t val, unsigned size); =20 -void hmp_info_via(Monitor *mon, const QDict *qdict); - #endif /* MOS6522_H */ diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index b679aaebbff..5167d17d41d 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -47,18 +47,4 @@ int target_get_monitor_def(CPUState *cs, const char *nam= e, uint64_t *pval); CPUArchState *mon_get_cpu_env(Monitor *mon); CPUState *mon_get_cpu(Monitor *mon); =20 -void hmp_info_mem(Monitor *mon, const QDict *qdict); -void hmp_info_tlb(Monitor *mon, const QDict *qdict); -void hmp_mce(Monitor *mon, const QDict *qdict); -void hmp_info_local_apic(Monitor *mon, const QDict *qdict); -void hmp_info_sev(Monitor *mon, const QDict *qdict); -void hmp_info_sgx(Monitor *mon, const QDict *qdict); -void hmp_info_via(Monitor *mon, const QDict *qdict); -void hmp_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_info_registers(Monitor *mon, const QDict *qdict); -void hmp_gva2gpa(Monitor *mon, const QDict *qdict); -void hmp_gpa2hva(Monitor *mon, const QDict *qdict); -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict); - #endif /* MONITOR_HMP_TARGET_H */ diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 83721b5ffc6..e222bea60cd 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -180,5 +180,18 @@ void hmp_info_mtree(Monitor *mon, const QDict *qdict); void hmp_info_cryptodev(Monitor *mon, const QDict *qdict); void hmp_dumpdtb(Monitor *mon, const QDict *qdict); void hmp_info_firmware_log(Monitor *mon, const QDict *qdict); +void hmp_info_mem(Monitor *mon, const QDict *qdict); +void hmp_info_tlb(Monitor *mon, const QDict *qdict); +void hmp_mce(Monitor *mon, const QDict *qdict); +void hmp_info_local_apic(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); +void hmp_info_sgx(Monitor *mon, const QDict *qdict); +void hmp_info_via(Monitor *mon, const QDict *qdict); +void hmp_memory_dump(Monitor *mon, const QDict *qdict); +void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); +void hmp_info_registers(Monitor *mon, const QDict *qdict); +void hmp_gva2gpa(Monitor *mon, const QDict *qdict); +void hmp_gpa2hva(Monitor *mon, const QDict *qdict); +void hmp_gpa2hpa(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c index d295e54d239..1dd8d9afbfa 100644 --- a/hw/i386/sgx-stub.c +++ b/hw/i386/sgx-stub.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "hw/i386/pc.h" #include "hw/i386/sgx-epc.h" diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index e2801546ad6..5e792e8e6e9 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -16,6 +16,7 @@ #include "hw/mem/memory-device.h" #include "monitor/qdev.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "qapi/error.h" #include "qemu/error-report.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 5a673cddb2a..bad034937a9 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -21,6 +21,7 @@ #include "gdbstub/enums.h" #include "monitor/hmp.h" #include "qemu/help_option.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "monitor/monitor-internal.h" #include "qapi/error.h" diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index eeee62b52a2..f7ad7b51394 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -10,6 +10,7 @@ #include "qobject/qdict.h" #include "qapi/error.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "system/hw_accel.h" #include "system/kvm.h" diff --git a/target/i386/sev-system-stub.c b/target/i386/sev-system-stub.c index 7c5c02a5657..fb84aee94d2 100644 --- a/target/i386/sev-system-stub.c +++ b/target/i386/sev-system-stub.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "qapi/error.h" #include "sev.h" diff --git a/target/i386/sev.c b/target/i386/sev.c index 1d70f96ec1f..fef9f441c61 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -36,6 +36,7 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-i386.h" #include "confidential-guest.h" diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 161f41853ec..6d101c75df0 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -7,6 +7,7 @@ =20 #include "qemu/osdep.h" #include "cpu.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "monitor/monitor.h" =20 diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 8a77476db93..478fd392ac6 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -22,6 +22,7 @@ #include "cpu.h" #include "cpu_bits.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/hmp-target.h" #include "system/memory.h" =20 --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067388; cv=none; d=zohomail.com; s=zohoarc; b=IQ2pE52tbUh+qzC0tGn2dCqhupSzMcyOnJtFOf+IehvI4e2HWCYH69E3vzUguPE/2CGeA6NhzTjjFA1fBjKuU4hiA7hsMIuOTooEviqmq5IRCnVrasYiY+3+zZ5cYJ3YwrdncjNxK/2FisqtoCPGVwAFFqASraPtDMv7uGSUKW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067388; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=F+HvSsb0ZAdJxK5XJMrPwEmF7QygJjcq1rhHcla45EU=; b=TMQEdQ6VIpHn5AK43gymS8m08Cw5d+fmxTWLhJ/zi//8491WJBw5qDIvY/htg1MLPNy6M8cjhsVI/OCSQvWYhyLbKPVu8nIO9Hmcq+F3G4fpHKbvGzShuQ/qtP2ikGBlBR/e18CGa32kqcFbOGIhUzkaUti/EboU7Lj1HDFwZbg= 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 177006738890492.3945125786961; Mon, 2 Feb 2026 13:23:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Nh-0005UP-3F; Mon, 02 Feb 2026 16:22:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1N4-00058y-SV for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:22:13 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1N3-0007gK-7M for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:22:10 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47ee07570deso41023355e9.1 for ; Mon, 02 Feb 2026 13:22:07 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48305129419sm14158905e9.6.2026.02.02.13.22.04 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067326; x=1770672126; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=F+HvSsb0ZAdJxK5XJMrPwEmF7QygJjcq1rhHcla45EU=; b=CKctd0djY8IASQKiQktVPyWWkWIp8cHvKd+21o+w4plXI3MrQiycShzRl26aQ5ZKy0 BjDjmUuOJ1xmknObBtzexB1/kujzcvdpGtQTXwuAOzAuPVQ8ZOIaqOje+UPCDzChvO+Z WHd6d9B8zuk29M22HpA5VU0dT0Kn6honKhbcME4VZBQvFvJK08On9F9I7dOzTQ9gVFp5 mI6nlXmzNoH2N2fjiN1CpwRLxPVCTzpCBy7FLJ1BTni5Onfpt+jTmVDeStwZuTDUB7H9 Dsv2m2dxVPZunr/Xiz25oc5clQV2iDqCaVGbO+DsFexZ9uebNUTxYy35jJqODGOzDDZu U0Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067326; x=1770672126; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=F+HvSsb0ZAdJxK5XJMrPwEmF7QygJjcq1rhHcla45EU=; b=AFnnJaS8E1OqvuG4cqctpgpT+nuNldS2xXUKselpCQvKdSKiyNjxeplygP0BEJzz/R xumZOjj7g6AA19eE/clRgDVjNTKYmckl4JCLunl9CxtAMPl/SrEDOkt2iyfbFTiI38OQ wTxwac78I0NDt67tZHxffq6JY90k6cfl2fqadXoZnKfbnVx5sZYYyG3HEa9OL2WM7Gd7 b4RrmW0JB8NRf7jE3LV5jXMQfDymfIAV6fy+kgDtPb4gmTLKgGKrwbfiTqFCkmx5pEoK vQyAqI1TejXwVJeOT+jkSkK2ShHqKUqi3C8kKLN8BSXrth12xSUIijXpQ5dGa64uzXIr y4KA== X-Gm-Message-State: AOJu0YwGOx7Jd4xjleAQTh75hfw2RLV4whU8vNZWXq9iyUa+y8wQOIyo p+KWWkqDMKkMLj3YjSk1dsXZBW2yQqXz5Y2t0YOYhBXPaouO4UJIEvPBVq2VJOqthIUWdYxMnrm VB8GA5Hc= X-Gm-Gg: AZuq6aLDAfz5/q6LmL/0tjEaTvYis53xKSQFGES2IzAhgE+eZhMTrP0IrpWPVR9+f24 OKoqGd1/oFkd+XXHxNkP+FLePcm0/AcV/w4aL2RAbXgV7pFzJHLubMhMvyWW2Tdo6spz34q+Ijj 6VoXUku0KVZPK2XHRyH5Rtm5lpXsFFLiSWPm3zIBVW41hBhYQUPPA7eB65nh7+2TWzx/z5Idwoe qft5RFdGAN675I5D6QA83BVZNo6ZaonFEHO/Jt9amHm8DKaJLnHfDMzRFO2NYTHMmGa0Wgu4sz9 uSkeIK5ygE9hjGbKVCXuOObUwnrBtFznIODolE+ZiD/N9O/sxEs3rezavoUGhCjVgmpOjqHChGv um3HQM71YON4SX/vUDefgRwwfRaWq2WmGyKu+VJjqspupWXNVAAtTxi3qccBrzbCQXol8XHVUN0 oazMFZacKt+HET3WMLktY75jbjgec0xlqbzmuXLSxFzlVsoru6UvJ++li46X4U X-Received: by 2002:a05:600c:8b27:b0:480:1c85:88bf with SMTP id 5b1f17b1804b1-482db4998ddmr161055115e9.27.1770067326253; Mon, 02 Feb 2026 13:22:06 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 15/16] monitor: Add hmp_cmds_for_target() helper Date: Mon, 2 Feb 2026 22:20:18 +0100 Message-ID: <20260202212019.94205-16-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067389352158500 HMPCommand arrays are filled with target-specific commands, so defined in a target-specific unit. Introduce the hmp_cmds_for_target() to allow target-agnostic code to access the arrays. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Pierrick Bouvier Message-Id: <20260129164039.58472-4-philmd@linaro.org> --- monitor/monitor-internal.h | 9 +++++++-- monitor/hmp-target.c | 13 ++++++++----- monitor/hmp.c | 8 +++++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 7735c731083..feca111ae31 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -169,8 +169,6 @@ extern QmpCommandList qmp_commands, qmp_cap_negotiation= _commands; extern QemuMutex monitor_lock; extern MonitorList mon_list; =20 -extern HMPCommand hmp_cmds[]; - void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush, bool use_io_thread); void monitor_data_destroy(Monitor *mon); @@ -187,4 +185,11 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const= char *name); void handle_hmp_command(MonitorHMP *mon, const char *cmdline); int hmp_compare_cmd(const char *name, const char *list); =20 +/* + * hmp_cmds_for_target: Return array of HMPCommand entries + * + * If @info_command is true, return the particular 'info foo' commands arr= ay. + */ +HMPCommand *hmp_cmds_for_target(bool info_command); + #endif diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 37dfd7fd4c6..59c60d13b52 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -44,8 +44,6 @@ /* Make devices configuration available for use in hmp-commands*.hx templa= tes */ #include CONFIG_DEVICES =20 -static HMPCommand hmp_info_cmds[]; - /** * Is @name in the '|' separated list of names @list? */ @@ -76,11 +74,16 @@ static HMPCommand hmp_info_cmds[] =3D { }; =20 /* hmp_cmds and hmp_info_cmds would be sorted at runtime */ -HMPCommand hmp_cmds[] =3D { +static HMPCommand hmp_cmds[] =3D { #include "hmp-commands.h" { NULL, NULL, }, }; =20 +HMPCommand *hmp_cmds_for_target(bool info_command) +{ + return info_command ? hmp_info_cmds : hmp_cmds; +} + /* * Set @pval to the value in the register identified by @name. * return 0 if OK, -1 if not found @@ -148,7 +151,7 @@ static void __attribute__((__constructor__)) sortcmdlis= t(void) void monitor_register_hmp(const char *name, bool info, void (*cmd)(Monitor *mon, const QDict *qdict)) { - HMPCommand *table =3D info ? hmp_info_cmds : hmp_cmds; + HMPCommand *table =3D hmp_cmds_for_target(info); =20 while (table->name !=3D NULL) { if (strcmp(table->name, name) =3D=3D 0) { @@ -164,7 +167,7 @@ void monitor_register_hmp(const char *name, bool info, void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)) { - HMPCommand *table =3D hmp_info_cmds; + HMPCommand *table =3D hmp_cmds_for_target(true); =20 while (table->name !=3D NULL) { if (strcmp(table->name, name) =3D=3D 0) { diff --git a/monitor/hmp.c b/monitor/hmp.c index 4caafbc7146..17e5756986f 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -301,7 +301,7 @@ void hmp_help_cmd(Monitor *mon, const char *name) } =20 /* 2. dump the contents according to parsed args */ - help_cmd_dump(mon, hmp_cmds, args, nb_args, 0); + help_cmd_dump(mon, hmp_cmds_for_target(false), args, nb_args, 0); =20 free_cmdline_args(args, nb_args); } @@ -1131,7 +1131,8 @@ void handle_hmp_command(MonitorHMP *mon, const char *= cmdline) =20 trace_handle_hmp_command(mon, cmdline); =20 - cmd =3D monitor_parse_command(mon, cmdline, &cmdline, hmp_cmds); + cmd =3D monitor_parse_command(mon, cmdline, &cmdline, + hmp_cmds_for_target(false)); if (!cmd) { return; } @@ -1375,7 +1376,8 @@ static void monitor_find_completion(void *opaque, } =20 /* 2. auto complete according to args */ - monitor_find_completion_by_table(mon, hmp_cmds, args, nb_args); + monitor_find_completion_by_table(mon, hmp_cmds_for_target(false), + args, nb_args); =20 cleanup: free_cmdline_args(args, nb_args); --=20 2.52.0 From nobody Mon Feb 9 01:34:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770067399; cv=none; d=zohomail.com; s=zohoarc; b=Lpz88v0ZinIjOvz6hKCW0Lt4cSHqX12F7I3XNxM0ZNOgPXxRTrQGYwm7eN6g7Gcww3l9gIUIsCdbLTTTS+z7UMTjRFz4J8YxG7v7UMVjJszGkt4qRwKlIMTy3bueAzQYpYZ5xvu2uH0p0y13Cy3dInogzvGuXdKz60Km/cMkOng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770067399; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=LGPgOWqY6NlYrVCwUyVSsX2YgvOrDGLMDph16Mc2NKE=; b=KK5zdO7jr8C84kxcIi/z1914cu7sC1tWjFa5U0MWRRP7qiZbQVGLPV5+wcmYEYqNkI7CTe35e6A8uro7dKqB7CJAP2mwjRqJXkmAFm/753EJLLgTFNSefq5lG6SE3JN01S9SjqftgBQJmqzFb/pxAbJmpwC6RALncvewp/KGJhQ= 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 1770067399088337.62478269397275; Mon, 2 Feb 2026 13:23:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn1Nj-0005i3-Nb; Mon, 02 Feb 2026 16:22:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn1NA-00059g-Fw for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:22:20 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vn1N8-0007jk-UP for qemu-devel@nongnu.org; Mon, 02 Feb 2026 16:22:16 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-482f454be5bso1326725e9.0 for ; Mon, 02 Feb 2026 13:22:14 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48305133689sm14003955e9.12.2026.02.02.13.22.12 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Feb 2026 13:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770067333; x=1770672133; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LGPgOWqY6NlYrVCwUyVSsX2YgvOrDGLMDph16Mc2NKE=; b=Y8DzaG0wG+rDWKl5nAjG5qt1MJjKn/QjEKYI8vdDes1JCNqyLxjytGeLZKLJIsSl1f lpuMr+qFEwnw5fxvbT+1+nH37dGbdbYLIFgVrYkj5oo+OGS1yE49WHET6r82laZ6R4mB fvNxeNeGNNhk2knHqsSmvQ2ES8ANJEVUTioIf3w9lD7ZEdDCbWWw1DuOOHyl5jRBlS2U hB/teHTqTiWQCZLUjPzvbQcAef/9qFY3xSZiA1tVLhb0U5BfIOVlZ8lHrG+4WVxMtDSz TakrRrZtwSp1ZU8Vu67zgha8D6f0TJPLDduW+eoN7xeR/l4m8muhy6fXIcH/RcfaR9aK CSSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770067333; x=1770672133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=LGPgOWqY6NlYrVCwUyVSsX2YgvOrDGLMDph16Mc2NKE=; b=ItKVlxXMpwRnHsrolHX4Pb7cdJ98Orud/w3gwomz/0m4RNU6F2d+8hzQoozv46ksVD 1BJby8aRogN63xaCFPeOYicfqzY8YDzY/ABjcvrVdkSo4rNhDEK5wD9Lh6Ov4xRUgnHp PJj2RMonO5ynZynlfJsETJOxASVJ2s7paSNjOr2xrAxoVWPchor22WXwsF/ZVoiK0bwB kj3AhWaDJ5rzAishV9k5Q2/wMPQz4DE1zSTOOnn+MW2NHj0TPyenur0a8EIUQoV6M8Pa joEauN/Y6cDok+uaKwQj25TGpfB/uy93iM69WfMfQJkA8/QnHj1gh7tQIwvbnmxw7Si6 MMug== X-Gm-Message-State: AOJu0YzDJlQECveP+y1bP8/zZv6Mrws+9O9ZOmakTwOpqBtr4fzzWSCR 18mYBcact70/uznw70cm3WJwxyjLhGbsOucaILD6HFVlveoyvhN5pl4seUtD2WOAi2VmnexnKeH EQ24/XI8= X-Gm-Gg: AZuq6aJ6Jw3Nqm7o1IxHgATNTcT8XRUxonetTUkh9D0DA1w+lSUYtPDEXek0B1Rnjrv xCVJR9CxHr0J8gGSQgiFBrcRQLaROrm9u1y7xsXzk1pk5ejsfv3UEN8Qyq387P544Y4HYZ4gKpX wh2DyTIsXOmEVKNJczv3/nrdBoGfuGIDlDc0khnoGRgZReQ3yD4w6hSHgqRh/6Q1h2uLDDOScpx +pn6ErWuC+91UIG0VOvldEZ7dCeNq2bDrz3bT3IetfpEZb1UZzPR2eeROZ098ccVtEpmanJeZeG /Ak0pRn3qa25Kj9zkbg1vylMxl2mDpkRZ2xm3i38A5tnWIRbISKoT/BoNRoIom7fks39rBxU0xo qUD/JtSfSuHGe3MV1qTIsCbY3Wr64LxHveqHgBgaiGNK8wmoxoqwFuenFixlZ47TSF53vnup2Qr 7iYuByfXCOhuOVDxCDnsyx2F1Ipob28TECrk+tjq505p9m/K2/txkyDrp46nT1 X-Received: by 2002:a05:600c:6303:b0:47e:e59c:67c5 with SMTP id 5b1f17b1804b1-4830513aed8mr15509575e9.8.1770067333141; Mon, 02 Feb 2026 13:22:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 16/16] monitor: Reduce target-specific methods Date: Mon, 2 Feb 2026 22:20:19 +0100 Message-ID: <20260202212019.94205-17-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202212019.94205-1-philmd@linaro.org> References: <20260202212019.94205-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1770067401384158502 The following methods don't use target-specific code anymore: - hmp_compare_cmd() - monitor_register_hmp() - monitor_register_hmp_info_hrt() Move them to hmp.c which is target-agnostic, being built once. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Message-Id: <20260129164039.58472-5-philmd@linaro.org> --- monitor/hmp-target.c | 57 -------------------------------------------- monitor/hmp.c | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 57 deletions(-) diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 59c60d13b52..420969bd6eb 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -33,8 +33,6 @@ #include "qapi/qapi-commands-control.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-machine.h" -#include "qapi/error.h" -#include "qemu/cutils.h" =20 #if defined(TARGET_S390X) #include "hw/s390x/storage-keys.h" @@ -44,29 +42,6 @@ /* Make devices configuration available for use in hmp-commands*.hx templa= tes */ #include CONFIG_DEVICES =20 -/** - * Is @name in the '|' separated list of names @list? - */ -int hmp_compare_cmd(const char *name, const char *list) -{ - const char *p, *pstart; - int len; - len =3D strlen(name); - p =3D list; - for (;;) { - pstart =3D p; - p =3D qemu_strchrnul(p, '|'); - if ((p - pstart) =3D=3D len && !memcmp(pstart, name, len)) { - return 1; - } - if (*p =3D=3D '\0') { - break; - } - p++; - } - return 0; -} - /* Please update hmp-commands.hx when adding or changing commands */ static HMPCommand hmp_info_cmds[] =3D { #include "hmp-commands-info.h" @@ -147,35 +122,3 @@ static void __attribute__((__constructor__)) sortcmdli= st(void) sizeof(*hmp_info_cmds), compare_mon_cmd); } - -void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)) -{ - HMPCommand *table =3D hmp_cmds_for_target(info); - - while (table->name !=3D NULL) { - if (strcmp(table->name, name) =3D=3D 0) { - g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); - table->cmd =3D cmd; - return; - } - table++; - } - g_assert_not_reached(); -} - -void monitor_register_hmp_info_hrt(const char *name, - HumanReadableText *(*handler)(Error **e= rrp)) -{ - HMPCommand *table =3D hmp_cmds_for_target(true); - - while (table->name !=3D NULL) { - if (strcmp(table->name, name) =3D=3D 0) { - g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); - table->cmd_info_hrt =3D handler; - return; - } - table++; - } - g_assert_not_reached(); -} diff --git a/monitor/hmp.c b/monitor/hmp.c index 17e5756986f..0a5bbf82197 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1497,3 +1497,58 @@ void monitor_init_hmp(Chardev *chr, bool use_readlin= e, Error **errp) monitor_event, NULL, &mon->common, NULL, true= ); monitor_list_append(&mon->common); } + +/** + * Is @name in the '|' separated list of names @list? + */ +int hmp_compare_cmd(const char *name, const char *list) +{ + const char *p, *pstart; + int len; + len =3D strlen(name); + p =3D list; + for (;;) { + pstart =3D p; + p =3D qemu_strchrnul(p, '|'); + if ((p - pstart) =3D=3D len && !memcmp(pstart, name, len)) { + return 1; + } + if (*p =3D=3D '\0') { + break; + } + p++; + } + return 0; +} + +void monitor_register_hmp(const char *name, bool info, + void (*cmd)(Monitor *mon, const QDict *qdict)) +{ + HMPCommand *table =3D hmp_cmds_for_target(info); + + while (table->name !=3D NULL) { + if (strcmp(table->name, name) =3D=3D 0) { + g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); + table->cmd =3D cmd; + return; + } + table++; + } + g_assert_not_reached(); +} + +void monitor_register_hmp_info_hrt(const char *name, + HumanReadableText *(*handler)(Error **e= rrp)) +{ + HMPCommand *table =3D hmp_cmds_for_target(true); + + while (table->name !=3D NULL) { + if (strcmp(table->name, name) =3D=3D 0) { + g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); + table->cmd_info_hrt =3D handler; + return; + } + table++; + } + g_assert_not_reached(); +} --=20 2.52.0