From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769829; cv=none; d=zohomail.com; s=zohoarc; b=hWFwWQBg4xR35VUOwHzKIIrDvxTKRbeenZT/mj2xE9wClpxyaTMT+ZoqiAcUEhbNFFeDsuxQjkvfbvW22iheD+uQqyOC8TrxHI+jX2/biJDy1a+pILak+8aRAxi8Ftat3dim1wHc3l6+vzBPCnFss6mS6pmUJ3mHJckm2YdCLRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769829; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IukQGcRHMsVbGXSG1mzI1R3dLtKOyYm2L7shctiJxkE=; b=UKMfI4kyz3XyI/zu1uWIvKs5D4/TyPaBpe/+9wKJTv3N9RWLKg9R+0oQHNO/5BYk5d+0sXX7EFzYcM4JT0X8n/EEeQ7fVJhYgBZNaE/bmYYz/hkkQhE/k+Et7RlPLXzvVXwZN4Na/PYNBah1uSkZo7OSb+9LQgc+UjbnIl+bHIM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769829619667.843135554399; Wed, 26 Aug 2026 11:43:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIaP-0006yY-P9; Wed, 26 Aug 2026 14:42:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIaN-0006rz-JJ for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:42:55 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIaK-00029N-Fm for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:42:55 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2ceaf8a1265so18283735ad.2 for ; Wed, 26 Aug 2026 11:42:52 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769771; x=1788374571; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IukQGcRHMsVbGXSG1mzI1R3dLtKOyYm2L7shctiJxkE=; b=joIL65oGCWHBM68YknwbarQ86NWE6PJIuU0usv3GZ34DvI+Lh3RO03h0F//fDJMmq+ wIJeZTcRYV5n/2ofIyOL8f4/3ZkKE9jC+zkaZPajjUbW0BBjsw5xxB6IYCYwpCUGqpEG QZMIzmwduYHcHLwZrUvaurVCFhoTJp/1FyMWYNKEXAdrbk0ePIu8dyE9Mk4jPG5OWkmK OZW7SAq2d2APxke/IF9OWMKvyqpc1lLBRBJFHN5V6ZTjoDs45WkxIQFtREHBM1ZEb+7d t48/YBYKs1uhGmkwukbiy7Q9PivS+KfASN+k6hkOUyJ7BUQzT4Dyj5oT6nqDevhmF5YF Dh5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769771; x=1788374571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=IukQGcRHMsVbGXSG1mzI1R3dLtKOyYm2L7shctiJxkE=; b=VQaKZ3g/dpgpj5VnDC4Wr/yOUSpkotZfaSvhdvvCp7feIpKEvKgwpaZ1Gy05lGSOhd lQXm/YxTF4VD0+YbREnkMsJ6O+1Bw5EP0fnxR47lgbp/ie4hZAKzONwOM5xN/tw9ptuG u6uHwr/SxRmVfycl8Rj8C+apzNyXu/TFXsxbSpI4lVJktHRvvpIvSH2BmUUzcBZ4MP5d 7uMbCwd0tvbn2nTD3ev9x5IYgU6JDZxua5tB8GOMDKiD4xnSpzo0KBMCPllYwJBzOuef GuSyG6tdArH8sSwdVfB0a8W3657a3+paX7C88P3XEbQzqM5kf2ha2D7Cl75wM0vaGFK4 B9Hg== X-Gm-Message-State: AFuF++lGBDTjbn4gAclUudQ0hwT/9yOJLu2lP82D0H1YdxBIgh63H2W8 yzyi1h9iMMO6gjqmz8ARR8GDae6kuNVnAlhEVXuNdQ6R/rfp9pvbQTVvox4X9NIcrDQ= X-Gm-Gg: AR+sD122GEtzbyjFjC3snFhY02I7LfgFxINmszTYttQe2w6+9pfwrTeIAKCRbiqoZZ+ SZFLJrRcoGJk+LeV/8vU/IO4G2WcUn/N3SeX3BTTnPHTLis/cuaIDJpMIb2hwsaM60pst4LcEid e4sfNxU/FBZr8naaKIlG50orkbCa0iQrEPfNaTx7mPW6fDtERk1kHTA6bQknIk5B6yPjjSoV0hY Do2HVqL+OM9Qn9erL41AaETO5C01yaV1s4W/gkiAo72o5z+WrjhqzOq9WKkxfEPZj0TXzTY/YqO QAkRTRkvr3zx1wxgeoPQ+FjXG+8R4zytT4OY06OUTH61veHRILdeXWYGSOjQSaE9xVXIZnPC84b LqspmjpnjpuXlwRcjFPWM0HPdLxdOOio13iJ/zNQ9Mtchu4QhtuOkm08+JJGN0U5Zi/pNjMOfTc JLvwtio1McrplAK4BYg4uxKIxAFHQvHiU+6iUHeBsaXnBQKmih3icuY0j88q51flXjWjZy5gVEr RNziLeRKhAzDOSzxrA8ug== X-Received: by 2002:a05:6a21:a382:b0:3cc:22bb:8911 with SMTP id adf61e73a8af0-3cf833389c9mr19772223637.6.1787769770909; Wed, 26 Aug 2026 11:42:50 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 01/13] accel: use a shared TYPE_ACCEL_CPU parent Date: Thu, 27 Aug 2026 02:42:15 +0800 Message-ID: <20260826184229.1145-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=luoyonggang@gmail.com; helo=mail-pl1-x634.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769830626158500 Content-Type: text/plain; charset="utf-8" - TYPE_ACCEL_CPU was "accel-" CPU_RESOLVING_TYPE, so each arch compiled a different parent (accel-arm-cpu, accel-riscv-cpu, ...). Common code registered only one of those names from target_cpu_type() at MODULE_INIT_QOM. - A combined binary still registers every linked AccelCPU subclass. RISC-V tcg-accel-riscv-cpu has parent accel-riscv-cpu even when the selected target is ARM, so the old one-parent type_init does not cover the other family. Creating the parent in the subclass register path would hide that, but it keeps per-arch parents that AccelCPUClass does not need. - AccelCPUClass is arch-independent. The parent only supplies class_size and ACCEL_CPU_CLASS(). Make TYPE_ACCEL_CPU the fixed abstract type accel-cpu and register it once next to TYPE_ACCEL. - Leaf names still encode the CPU type so accel_init_cpu_interfaces() can look up "-accel-" CPU_RESOLVING_TYPE (for example tcg-accel-arm-cpu). ACCEL_CPU_NAME() keeps that string; it is no longer derived from the parent type name. - Drop register_accel_target_type(). Subclasses keep type_register_static() with .parent =3D TYPE_ACCEL_CPU. Signed-off-by: Yonggang Luo --- accel/accel-common.c | 21 ++++++--------------- include/accel/accel-cpu-target.h | 3 +-- include/accel/accel-cpu.h | 2 ++ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/accel/accel-common.c b/accel/accel-common.c index 00a400243f0..c4c365f38c7 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -126,21 +126,12 @@ static const TypeInfo accel_types[] =3D { .instance_size =3D sizeof(AccelState), .abstract =3D true, }, + { + .name =3D TYPE_ACCEL_CPU, + .parent =3D TYPE_OBJECT, + .abstract =3D true, + .class_size =3D sizeof(AccelCPUClass), + }, }; =20 DEFINE_TYPES(accel_types) - -static void register_accel_target_type(void) -{ - g_autofree char *name =3D g_strconcat("accel-", target_cpu_type(), NUL= L); - const TypeInfo accel_cpu_type =3D { - .name =3D name, - .parent =3D TYPE_OBJECT, - .abstract =3D true, - .class_size =3D sizeof(AccelCPUClass), - }; - - type_register_static(&accel_cpu_type); -} - -type_init(register_accel_target_type); diff --git a/include/accel/accel-cpu-target.h b/include/accel/accel-cpu-tar= get.h index 6feb344e29b..cf33ebd79fc 100644 --- a/include/accel/accel-cpu-target.h +++ b/include/accel/accel-cpu-target.h @@ -24,8 +24,7 @@ #include "accel/accel-cpu.h" #include "cpu.h" =20 -#define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE -#define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU) +#define ACCEL_CPU_NAME(name) (name "-accel-" CPU_RESOLVING_TYPE) DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU) =20 #endif /* ACCEL_CPU_H */ diff --git a/include/accel/accel-cpu.h b/include/accel/accel-cpu.h index 9e7eede7c3c..5cfc2b24223 100644 --- a/include/accel/accel-cpu.h +++ b/include/accel/accel-cpu.h @@ -12,6 +12,8 @@ #include "qom/object.h" #include "hw/core/cpu.h" =20 +#define TYPE_ACCEL_CPU "accel-cpu" + typedef struct AccelCPUClass { ObjectClass parent_class; =20 --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769800; cv=none; d=zohomail.com; s=zohoarc; b=VmhWQ4zXFniZZsKWKdgHFbJ1MoS7lFnspg8+5xsQ1kiDo0a9qa8Ov+6zD2BJ9+rNNkG/yKVOp8U+YvV54GxmohYB6OMt41mrfLm+8hgVXQdOz3mSjYEnPtg8qrtygYm5I0dceDEM9dxxeUY91n9XcQSUjWStph9n7WYCcQXND9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769800; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=A8nlgx+yI5uXCE0ljkSUS5BHCQ1iuqkZ8gRew5LCZY4=; b=Qwj73Enqq4FkUfABvDeWB6gfF3ZCSOcoKlVTbn4gXNDSU4uHGY/+X1rSLjvZ+kexXqiVO9U6qlk8hpf+8zpFYORNJz4j2na2N/Fqsco79dyd41VrSpjNJY1K9cqKSVeM75HxFCq27U1iR0BJuAMZ0dVag3TVMKAGuSpRKmbByCk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769800510942.0524323841047; Wed, 26 Aug 2026 11:43:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIaY-0007Ag-6t; Wed, 26 Aug 2026 14:43:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIaV-00076A-Tu for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:03 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIaT-0002GP-37 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:03 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2d71a50caa9so7018195ad.0 for ; Wed, 26 Aug 2026 11:43:00 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769780; x=1788374580; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=A8nlgx+yI5uXCE0ljkSUS5BHCQ1iuqkZ8gRew5LCZY4=; b=EHr5ul7Ii9DpZ/MRkDioZ8O4L8eWXRHxRqdkJ8H4LdLEycoGEgeljAdjHh6wWAkjkI bAEbjHBabo6Z9Ae0YdUw4070oLch7Yp6/DKDPRNywIEzsttSxco73thkYU5NjpK1mImh zZYI9jTgIrY+trLwypz2FEUUUtH0vKYVyZp88s4yzJO+3fy+Ie1fOVb++AIHRTHlAUTE A1DUBaVqR6sa/EHxGo+SPhzNUstfN6wfZKZ93WNJ0UJh2UxmM/MSvJyzN8Gg5uQuxwef YjMe7ioiahZivcAu1c2sdid2OsedYNRTshQ9HY+oTqUqQKZgdeFAsnyeqrblcGUbuIK9 7JDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769780; x=1788374580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=A8nlgx+yI5uXCE0ljkSUS5BHCQ1iuqkZ8gRew5LCZY4=; b=PQFgPuVhm7xMnWmxSD1T78WiOlA+9K63gmX/5TwD9ZDEiMRtQvAAY+gzgfOUYenr1Q 6wHaTm9Hs2GV/40Z50i+c8MVsqulzr0NLtey1tzoRp6xDNog7RNQLrScAIl3AJSM/Fu+ ruzF7OC8vFWqmF1oA0U/NSE4waJ3nTQ3UhRN4TLXsvcfizHdYwjtdZCG8lc1sjba+aMj LyJcDCSbMTAkL7x1zUNJZtrF9qOqsj8j6x3KABofbR3l3sFRzLVz75nPjr91TPKe83DY VVdn5K8Vmf1QTP3UBbXLq6R9pVa7aNVdD5neLkr1g3IaM87XnomG9YM8i4fBKShZoEiZ ONTA== X-Gm-Message-State: AFuF++mRjmiB8TWeWumXcNk2w08SUQS+fPN7Q6Fuw88N8aBmGyrN9szk LpYkPpC8r/4xzctWQQKUTFl4O5tMp6H3M2l5NqzjPOcPjWSiQoa10YaiOwGz3haT/ys= X-Gm-Gg: AR+sD10tAB/WjgqwPl8SnZwEEfMK8tYoG/C99dylkDEBRbevjR2IgHmt5t8SJMdVMv8 82eqJ9ebvR8WEZOylLlrHodTVjxlsugKBYLcHCr2zdr+iHlwimoaeduZ0PKdBEtzfG70OAPQRIg Vsokh1/X/BrWbS9LXoQrRsdO72+k58blETOPek0KU7SlM3JBUiu2p7cHTvwdNWkRo3GakBzU5Ed rBRDRFb3jtle382nBSvUtenyOCnbuDp7BtwTlW2IU1kzm3nCiSGxrsvlmtUXSLqj5r172QkuzNP r2il+/vwQMvkTDQGZA+/5g8eUcEJy7ZCziJjJmH9vpkESB8kjgC4pcP1WiWwRavnWPYpMBz9Cdp 6kjyk+DqUaFqZAxdc3qWfDPxjv1Q6ejvY4ra6CV8H4Cp+13kW4vnBScGSlsw/GquY6F9c7DO6hy uMsoFWhUjQf7+xgkuWskzFqVL9iS6XqjNOsQB+GNvYOxlhIC1t2YBMzaI9iFV2SsrQWHCVhYA/C Jx53SlVtJuxT61yxJfXfQ== X-Received: by 2002:a17:903:3c46:b0:2ca:4f33:e86f with SMTP id d9443c01a7336-2d707b416famr168344225ad.12.1787769779699; Wed, 26 Aug 2026 11:42:59 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 02/13] hw/riscv/virt: register TYPE_TARGET_SPECIFIC Date: Thu, 27 Aug 2026 02:42:16 +0800 Message-ID: <20260826184229.1145-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=luoyonggang@gmail.com; helo=mail-pl1-x62f.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769802555158500 Content-Type: text/plain; charset="utf-8" Hide the RISC-V virt machine when the selected target is not RISC-V in a combined qemu-system binary. Signed-off-by: Yonggang Luo --- hw/riscv/virt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 2d242ef71a5..b767c5434a0 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -22,6 +22,7 @@ #include "qemu/units.h" #include "qemu/error-report.h" #include "qemu/guest-random.h" +#include "qemu/target-info.h" #include "qapi/error.h" #include "hw/core/boards.h" #include "hw/core/loader.h" @@ -1718,6 +1719,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) MachineClass *mc =3D MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 + TARGET_SPECIFIC_CLASS(oc)->is_available =3D target_base_riscv; mc->desc =3D "RISC-V VirtIO board"; mc->init =3D virt_machine_init; mc->max_cpus =3D VIRT_CPUS_MAX; @@ -1790,6 +1792,7 @@ static const TypeInfo virt_machine_typeinfo =3D { .instance_size =3D sizeof(RISCVVirtState), .interfaces =3D (const InterfaceInfo[]) { { TYPE_HOTPLUG_HANDLER }, + { TYPE_TARGET_SPECIFIC }, { } }, }; --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769811; cv=none; d=zohomail.com; s=zohoarc; b=gxNu8h8tfGVpwmDD3cGx2dO28OOwTNX3yd/bXw7aKFSkhjHkc0ChxvXkC6kTCgbrYyPc2qPImurh50J/tTvVrnwSE192NOdXQYO8ZRD93lYmpMHBF2rrY14gaDUrIY1blo+ygEBaXLpfcbrfVFB+b0wFDsgAyYoWoWIeMqhD58g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769811; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=esiIQQ8j+uvEVKSy2+ZWdGzm2PcDAqeU44dys6a2Fmc=; b=ZchPXLAYEwXy36qvn2Fp+6CLqN579RZ1Y523b6pFfCj3AULkUTbvCtaoGfcv19wvxRRly/yl4Y57achFLHs/0LfrTI4PXTS6+qTMeqz3oDVLMSVSkOZgSUJROdjeYSVSBjGOQ7fBFLJyJdayeIvD4jqkS6PSaz3lz5sehlsBEcw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769811467295.8250916573958; Wed, 26 Aug 2026 11:43:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIaq-0007mb-MY; Wed, 26 Aug 2026 14:43:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIah-0007WK-6u for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:16 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIad-0002IQ-8Y for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:14 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-39647aa9d52so261487a91.0 for ; Wed, 26 Aug 2026 11:43:10 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769790; x=1788374590; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=esiIQQ8j+uvEVKSy2+ZWdGzm2PcDAqeU44dys6a2Fmc=; b=LaHV+3ospoSnq2nPSuxnZN4wkZBxGzcDJzGalw3kA9oDC4eULJieufGH06Mahiw+YA 0pLy14MJsPO3ZcCjkuJw3eb9XGPCvjVBE8bxK48udEHwLbveoTOhHDrzDq5QCPZanBKi J6gm203u2bv/RdhW8H6ENlIg3HrHPkFajvYtBGvmKCR/j0cFVp4GK3oJZUUF241UwC1F qw+lXEBrlyb1H+OOP0bbu1k+0YPz5vzrQbb5a2c16Bpj1sTd8r5/oxtYKNzJlBwZYxH8 unzu8DKYNRU3VeeRbc3vq8W3lLwuAOb1FzO41jd4P/l7UBnY2maE5lQBZwXc0DARCWcq /lRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769790; x=1788374590; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=esiIQQ8j+uvEVKSy2+ZWdGzm2PcDAqeU44dys6a2Fmc=; b=Agun/vZF6sSyPH/FMf7k35Sx51EKSeK12OSkCnHHffRSvkDrD6N36ZqH3OOCM8M6xC Fnjtc1YcdsMNKnJZ0AgPH2lhV07eQfTfRy6xUUQw7gPqNNY5mJFNIJnc+guuDPUdD7fy sB8NjJUdGM54GNfdsj7fXFbMvu7egC1rD/l6MSsQ4Gq1F4LBZjmuZzmttdhL+IHFjAD7 4sH9j/W/0XjfYnaiEuZbFErIdFwUCH3/vz5LiDHkTZ3O3y0EXkQWzcVkV/vWy9kbj1a2 jfovnDNSN0O+c/SYYrSVxypjPNK/IdCpIFvqkPTZoetA2SW1tKoVCi3EvKby711KtYfF IW+w== X-Gm-Message-State: AFuF++nUOGXWVJICgPvSzqedymC8Soot9xQFxc/oaiSw3FzzdZO3P47i mX044jkPNmv/YalMhr1Bd+IFTp3Muh22vqLN4Uf6s+r+1Z+ysVVVFhNiNMD60sqcrAs= X-Gm-Gg: AR+sD12dPOxnW28DzxEUWPr17TOWmvUFkUTVqKXwtnL1xxAZ4VmlxRXl3sZ5InSbSA6 g1wb8KhUqmIASPIUvhuFE+kxzL4A22Hq/gbEia7liV9/i0W2it8vohqUllv6OIp6kKMhtXA6/zT 93gxy1P1RxoH9+iSyoWoFrl5vpHmVk4yAQJuojNieDwXS+lBEtTMlqxYFjebiavJglQ89FbtQMe wwfCHQydfrd/CvNLNOv8CaUcgPvt1w4rY9TjYyNgF4bq/AqYDptGAyMkAUYPN0ZV7SaYIOnxOjz 4gRPXxM7+WK2gF22jnsIT3+nmTiVm7OqqvSP5bEiLg0xn8nWpJpBk1V5olW4SSrU9uUg5Zg6Npo vINGtOG7Dk24QR5qg/IWSLhFpRhgizECH/YWTVhLyhkUXo7cEhaJVqQk5MKCG9/Rn/LyfpONWVO UsvMb3ZWzRzG6m5chbS0uB0yE1kqp4fyVIIBs/A3igKQTUnFw8PIGdOyo3gmdtAsXLZ9vWgr40B RKN1P1OE+1t6ASPuzYa8g== X-Received: by 2002:a17:90b:3811:b0:37e:1620:dabc with SMTP id 98e67ed59e1d1-3969b7e33acmr1328049a91.0.1787769789662; Wed, 26 Aug 2026 11:43:09 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 03/13] hw/arm/virt: register TYPE_TARGET_SPECIFIC on the abstract parent Date: Thu, 27 Aug 2026 02:42:17 +0800 Message-ID: <20260826184229.1145-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=luoyonggang@gmail.com; helo=mail-pj1-x102d.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769812627158500 Content-Type: text/plain; charset="utf-8" Hide the ARM virt machine when the selected target is not ARM in a combined qemu-system binary. Versioned virt types already implement TYPE_TARGET_SPECIFIC; register it on the abstract parent as well. Signed-off-by: Yonggang Luo --- hw/arm/virt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index daba9af79f1..c2ace7706f1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -4161,6 +4161,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) MachineClass *mc =3D MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 + TARGET_SPECIFIC_CLASS(oc)->is_available =3D target_base_arm; mc->init =3D machvirt_init; /* Start with max_cpus set to 512, which is the maximum supported by K= VM. * The value may be reduced later when we have more information about = the @@ -4431,6 +4432,7 @@ static const TypeInfo virt_machine_info =3D { .instance_finalize =3D virt_instance_finalize, .interfaces =3D (const InterfaceInfo[]) { { TYPE_HOTPLUG_HANDLER }, + { TYPE_TARGET_SPECIFIC }, { } }, }; --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769855; cv=none; d=zohomail.com; s=zohoarc; b=bbjOwqmFUhd8lYmEFWkXs3WJPCtKnKlWi6ZDiI+fop2cXCkz8vLFUQ/2iLlvyZdG8bdqxZ5knD09gdJuZ/5J04dtKvyMeFYYWCwjesvJbjsRHdYybPceHpbFpFhIfvqVWKCLWhIxhCUT1iyoyfNbodCDhI/HBI02YwNB+FQJdjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769855; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZjZZ5N5UC9MCFR7kDtXH3xc2F8y1ZsI5OCuFB7c1TUU=; b=a3XDEX1s0ALSqZqKwYlZw6oiYWZUAV4HKNPjgjHPdxzpebSezEOceI0dObj8CwMKPUpvNQ0/iKK4OikEcn4JNrpJADkVt3wAB7PGF+1pLgL0CWsGt1jVYzwoniMfh9RXgxuSwIdZHk6DGnZGtgNh6wT7yChnLpU5dWL6KA0aBd0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17877698555261014.2414922857338; Wed, 26 Aug 2026 11:44:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIav-00087i-PR; Wed, 26 Aug 2026 14:43:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIao-0007rH-W0 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:24 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIal-0002Lk-Ow for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:22 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-cc1cb472b76so745020a12.0 for ; Wed, 26 Aug 2026 11:43:19 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769798; x=1788374598; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZjZZ5N5UC9MCFR7kDtXH3xc2F8y1ZsI5OCuFB7c1TUU=; b=A6JhOlkoOBXb64uMEyS4hKQMgZ4BJYp3RyRgrcZ63/OtYFvw3x3DflBEKTVYTpl7dd vgH7VHydn1C7aX/cS6+qVEseZKTt7hW0TUNYyLFbnvMclit2t/u4+lGswCjOf/Q1+Yxf To1Rag+Xow/MZNmD0FOhi0Hor3EjuMpUbJwKlDJ8P4ZGzaAywMNRn4MpPNrKlcpNprxf uxksRaO9Use/3TiCMXHLHtq+Su2OW1K5aUCCxKB+flu7VbQadFRFxJJxhopWo4ShTl4f Xy/yEfn4Hjr2KzfwycL55/PmnL/eGwlktMegyYDD8Ua60Iw0u1K9vb46HNNw6ULAxEtm 1HeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769798; x=1788374598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ZjZZ5N5UC9MCFR7kDtXH3xc2F8y1ZsI5OCuFB7c1TUU=; b=Ik1xGXlyU02thvnL349Vngb1ZPvmo/HhFj36ai/JYrUnvNDoyPmvhfSuRCEAOAt8eC YFRUjx58FF8QcH+N2a8rZv+k8hnr0cuUCyjwhzAny5QLBrOgZ+AL5ZtKdY33Xzvod9Y4 fnkh92Oyo2UPOnNQDHE+rNTsOfZzQb+i7jlFh179RdWAVZm7sEfUb/K8E9fMTZnIY8LB HD3XC5/wGhQ8LBiim5Jp2R8SqM/b+z9oWgSoRRYm1wE3n0aOkMBCiATZ9lmJAXGSq27s 1FIkhsoXCH107M/qiLhU9bYZFA0im3nyZ+rDNywxP3qytRR9M8qE+29h5fAr11hQSIFX 4bPw== X-Gm-Message-State: AFuF++kfu8KabiEBIqkhMmJz6GzeXUc0bZ8OEQPq/uzvYTqFnNp6Ik1+ 6WTuIax2c5jEAt1zK9Skvgo+SEXII/5ycfVaktc+X+x0fQ8glm8D4RlfV/v1gNEWfuw= X-Gm-Gg: AR+sD13auJ9RA0fb1tXjqEvvXKhEW34kDy7LFj49ZEP7v24ReXdBG9IDJ81VKqCW6VH z6fqRmmrURrO+vEYZyxbjNgO5a3sXdL6vvSGfNopzyeK7Oh9BfME99wsV55Te9Kvrb6wPIEbBMu zIPCEj3TwkBuqv+6NLpELo0jGVJ4KCBN9IcMFeMaHHbrdrC0yh3OFtEpBiG/wbF0Apq5PF2P86j mPTaxtBJPCookAZQf2ReLj8M0YQ/dw8PTYIq+AtdY0Iz4oCoiN/eeWGunP1LTVc3VDzCQVTGMpB 5QhQa1VsfyPK7Vrxk3JGtNoBh0TM8FFsObMHkykRtRPYI+bpWoNgAE0r/SqDmx2f+z8LHgchGaZ eTkM9hC6hXXenIMhYpms9mU5ChRcABRod7QUNCYKIvL0NJB3vHH7Ss4f4s6ntYUEd/KCQSw3fgN oCw8ZktcXd5arLhGmj1Swgfip93e4yQ+HHQ89g+fJWvzCxUa+Ou/7VJZ4uGpmSqSBEZ8j8QrlRp FEpzzRR66OwJo1ttGZWZw== X-Received: by 2002:a05:6a21:6191:b0:3cc:ad3e:bd7e with SMTP id adf61e73a8af0-3cf8465a5cemr19927922637.14.1787769798331; Wed, 26 Aug 2026 11:43:18 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 04/13] machine: allow -M name to differ from QOM type Date: Thu, 27 Aug 2026 02:42:18 +0800 Message-ID: <20260826184229.1145-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x532.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769856743158500 Content-Type: text/plain; charset="utf-8" - Add machine_class_set_name() so boards can keep a stable -M name when the QOM type is uniquified. machine_class_base_init still defaults the name to the QOM type without -machine. - Document that MachineClass::name is the -M name, not the QOM type. - Sort -M help by MachineClass::name so order matches the printed names when QOM types are prefixed (arm-virt-11.1-machine vs virt-11.1). Signed-off-by: Yonggang Luo --- hw/core/machine.c | 6 ++++++ include/hw/core/boards.h | 12 +++++++++++- system/vl.c | 8 +++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 73b4d82b4a1..082f95e4349 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1209,6 +1209,12 @@ static void machine_class_init(ObjectClass *oc, cons= t void *data) "Memory size configuration"); } =20 +void machine_class_set_name(MachineClass *mc, const char *name) +{ + g_free(mc->name); + mc->name =3D g_strdup(name); +} + static void machine_class_base_init(ObjectClass *oc, const void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h index c963e956157..cb6a37235a2 100644 --- a/include/hw/core/boards.h +++ b/include/hw/core/boards.h @@ -37,6 +37,16 @@ const char *machine_default_cpu_type(const MachineState = *ms); * @mc: Machine class */ const char *machine_class_default_cpu_type(MachineClass *mc); +/** + * machine_class_set_name: Set the -M name when it differs from the QOM ty= pe + * @mc: Machine class + * @name: Name used by -M lookup, help, and migration + * + * machine_class_base_init sets MachineClass::name from the QOM type with + * the -machine suffix removed. Call this from board class_init when the + * CLI name must stay stable after the QOM type is uniquified. + */ +void machine_class_set_name(MachineClass *mc, const char *name); =20 void machine_add_audiodev_property(MachineClass *mc); void machine_run_board_init(MachineState *machine, const char *mem_path, E= rror **errp); @@ -270,7 +280,7 @@ struct MachineClass { /*< public >*/ =20 const char *family; /* NULL iff @name identifies a standalone machtype= */ - char *name; + char *name; /* -M name; default is QOM type without -machine */ const char *alias; const char *desc; const char *deprecation_reason; diff --git a/system/vl.c b/system/vl.c index 83b9425de9b..4b1fcd2031f 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1538,10 +1538,9 @@ static gint machine_class_cmp(gconstpointer a, gcons= tpointer b, gpointer d) if (mc1->family =3D=3D NULL) { if (mc2->family =3D=3D NULL) { /* Compare standalone machine types against each other; they s= ort - * in increasing order. + * in increasing order by the name shown in -M help. */ - return strcmp(object_class_get_name(OBJECT_CLASS(mc1)), - object_class_get_name(OBJECT_CLASS(mc2))); + return strcmp(mc1->name, mc2->name); } =20 /* Standalone machine types sort after families. */ @@ -1560,8 +1559,7 @@ static gint machine_class_cmp(gconstpointer a, gconst= pointer b, gpointer d) } =20 /* Within the same family, machine types sort in decreasing order. */ - return strcmp(object_class_get_name(OBJECT_CLASS(mc2)), - object_class_get_name(OBJECT_CLASS(mc1))); + return strcmp(mc2->name, mc1->name); } =20 static void machine_help_func(const QDict *qdict) --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769847; cv=none; d=zohomail.com; s=zohoarc; b=bCcyoJowfSQxKxVXeLHqfPxK7H0r23B5UAx5CZglJOSJEAyCXrhog5aw0DZHMqRauGXmy+dbMjar7TA1TM1siM9FZnZLTM3djVbwKemxbkawRfdx8AK2qtKyJMNH5UNfTW7bbbuL3NnFsKIc+HNIO+zxO+51j1xQutibTOdX1G8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769847; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nM1ebK5QgzPh85KBZgAbuAGl8pCvUeZGCYkdeDEjbf8=; b=dMurukdzjSfZyWFCk704yUWLdIb2L6yy5rOV0I/kvNriFdPt94HbzuTemJPRZlOgiDKmD0yNXLCJyK0ez0Jtf9YmGcUQGEX4zyHnkkUWshG5ZLQO1MkcmHm214R0l5jAQZ5UWTPZ2VvqZ+VR7LZSEmkldfkw4Rtmxu6HEGKWmgY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769847709298.79650069810657; Wed, 26 Aug 2026 11:44:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIaz-00005l-UL; Wed, 26 Aug 2026 14:43:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIax-0008N8-PL for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:31 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIau-0002SB-M4 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:31 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2d71a50caa9so7023345ad.0 for ; Wed, 26 Aug 2026 11:43:28 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769807; x=1788374607; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=nM1ebK5QgzPh85KBZgAbuAGl8pCvUeZGCYkdeDEjbf8=; b=eF+BoHcXjZItayld7X5V+o3iEF1U5Qa75h7/huGtCdGHC1ZB5DJHqCdQsdJLFc3jrT bU7CDZyjdir+KKU4nP0fqYNX3fNxS+bS/WRhmBGGYA3oyuNmcD3t+aHSiLjPSzsH0NIy Zs5x+6n9+EmwqLPjnfVEqV+vey6AEAlxnemH4t4g3jOCTTcnc1X+/vOsTCoaiBwCo9vb HYpIgHThju1qogyvuOASm9YmweFhMaWu65F9MMW8dyOY1wjjc1ehHjoJsnQQkDwSxu2p 1irmJi3Lv0G9W8tq2jES/YAAInEC+OT5nOvFegZ792DUGosezodYzmgn1oEbjCKPHsPP ekEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769807; x=1788374607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=nM1ebK5QgzPh85KBZgAbuAGl8pCvUeZGCYkdeDEjbf8=; b=cHF/Hyjj6/4Eq5000l+URxWKnYjQPJ1UppJgaI8AXfy60/s02BGBFFpBuRiTOsirS1 JXfHsFFmNJI8AOa4vaVP15gNoBxH+ca2C/25Jk9GvcqgpH2+uDte5USlcvGYtIfLnftE xH4sGUQsuuYrU0NXmCWPHjpU3UefWSHzKMe7qf93G36Z+2vit+HPzNrjEy0qVXQLYFSt EX7/L72Ct3rpTuAwbHfsOjkC2z8BdkuAuDhQeeUGbZjiXC37g51p7M1tzkReDOjO8Hiu pAaqruygnW27z5ZWugr6w9vOWwqf2bTEqeEUztNV+Udww5fqF4oMz424zk5YGyZEWTcT 1m5w== X-Gm-Message-State: AFuF++lEy6dwOCiaU8suGiGfpJJB1HF0WL95Hd8HWJVocgYOnQd9ctrO 6nV8Hqf0HzW6DoJVCcTzp0q32fCNEY/lsJgn+8PH02YO0YV1CSZh2Cg52hhbEGWbg4o= X-Gm-Gg: AR+sD13LulubbhpwawKONPSZl16iuIxoPFre+69MaECbNbg5l53grHO30wSQU4kcV79 adavCZP//k3zAh0B1xih8JAgtC11sfUAWn4Zzy2njcsYa/775pf3MkXxCB3PDfswO0iBYE3gP0g HgDKgeTZ/4d/OeObkfNjaFgtcOKwI/BJlfMScNCutjKFo+CuPgGwB/3sKy4SWOfN2tGVKGVbl30 UcSuB9BAahuCEpU0NX/8ozwGKzhO2AhmV2Y03I2uT1MSmgJyfOYKsGY3K0HQ4C7PmrzA82CJcHY ym/3E4SiZmuRnqJTOanKafE20UIrUAkerRZm/HuiWThhWG6hkSBIud2aZkjOgJWMQfPWlgKN5Ko NZmZh9yX+C87ir8bIrx8XovD7QxqTuZ207bjskwDSu86D25nHXlTyudOpQheQWFA74kFKMCXLqG ym2m++DGCRg1tyCC3Vj3mVwgCmzB78lC2tUf8UGBHsdwt0kZYBxKR9aEEQqe2tdYRTnR6nNSC0x hnFmtI6t3nGcr8ktADOdQ== X-Received: by 2002:a17:903:46cd:b0:2d7:1cee:3682 with SMTP id d9443c01a7336-2d71cee3c89mr70518955ad.5.1787769807238; Wed, 26 Aug 2026 11:43:27 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 05/13] hw/riscv/virt: use unique QOM name Date: Thu, 27 Aug 2026 02:42:19 +0800 Message-ID: <20260826184229.1145-6-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=luoyonggang@gmail.com; helo=mail-pl1-x634.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769849017158500 Content-Type: text/plain; charset="utf-8" Use TYPE_RISCV_VIRT_MACHINE so the RISC-V virt QOM type does not collide with ARM virt in a combined qemu-system binary. Keep the -M / help / migration name as virt via machine_class_set_name(). Signed-off-by: Yonggang Luo --- hw/riscv/virt.c | 3 ++- include/hw/riscv/virt.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index b767c5434a0..9019a0a04d6 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1721,6 +1721,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) =20 TARGET_SPECIFIC_CLASS(oc)->is_available =3D target_base_riscv; mc->desc =3D "RISC-V VirtIO board"; + machine_class_set_name(mc, "virt"); mc->init =3D virt_machine_init; mc->max_cpus =3D VIRT_CPUS_MAX; mc->default_cpu_type =3D TYPE_RISCV_CPU_BASE; @@ -1784,7 +1785,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) } =20 static const TypeInfo virt_machine_typeinfo =3D { - .name =3D MACHINE_TYPE_NAME("virt"), + .name =3D TYPE_RISCV_VIRT_MACHINE, .parent =3D TYPE_MACHINE, .class_init =3D virt_machine_class_init, .instance_init =3D virt_machine_instance_init, diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 36a2def4109..5559783aebb 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -30,7 +30,7 @@ #define VIRT_SOCKETS_MAX_BITS 2 #define VIRT_SOCKETS_MAX (1 << VIRT_SOCKETS_MAX_BITS) =20 -#define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("virt") +#define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("riscv-virt") typedef struct RISCVVirtState RISCVVirtState; DECLARE_INSTANCE_CHECKER(RISCVVirtState, RISCV_VIRT_MACHINE, TYPE_RISCV_VIRT_MACHINE) --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769855; cv=none; d=zohomail.com; s=zohoarc; b=nhnHMzRo5NUFBGfZVAsKrp9sf3KmExpTkwn+cK2lnlqBNyiwPgFT29uY3tfURJUvxIwkVGGFL0j/Xc8W2M0M6SKwU73r8JBURt2ip0M5ZaFmMAT3uXN0OTzD7ZtHJgzC0SXQL55AEFi9S1xB8mThBH6DG7CzXschPvIyDngsomY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769855; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3Hv9iWfS7mfY+j+Db48HXpOFPwt6LwOOGwuKKSASBkg=; b=ZI5Xd4MmfQpufZV39PtzfLzjWMqp5AtaPgW5KfYFNq08OeGW4jFxRChw8tng2UxI+nH4Y+bTatgkQ07JUikaRJ1oPsE1Rjq5mPK4iVLEb2Qyffqs0zY6zGoc+JP+5lgXmwAnogVo8m/mbod7fMl3o3Hj/rCZjlAPX8Bvuza+xLE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178776985577878.3359009081397; Wed, 26 Aug 2026 11:44:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIb8-0000Xk-O0; Wed, 26 Aug 2026 14:43:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIb6-0000Me-DT for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:40 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIb3-0002Up-DS for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:40 -0400 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-38a0c7e841fso2100683a91.2 for ; Wed, 26 Aug 2026 11:43:37 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769816; x=1788374616; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3Hv9iWfS7mfY+j+Db48HXpOFPwt6LwOOGwuKKSASBkg=; b=gxZRd9XxuLgTruvOXEDrMgpfnIvNhlflvj23vColCHZewrzwXQm9ko4nuoddaZuRVe GnAbwRo7IgHLW7umK3tvGCBy3RmKbtXFpZnJMZiArxJ44vKhqeHlorY6DlkeES0Y3+gg DkZM9NY6M4WYk3TyIatrq9x4W368tGOX62nf2aJyv+imEgvR7seNLOvPmSQOeXVk/Jv3 kT4pTEDoEB1B8chY1rVH+zHw5daWUdAWzO4tXO/moNzwr+d6PJCMqzl0/opfXEha3IP8 mLnaZHqnqn64rRtUjDJVoRQedoCye4ltfDVI7KcDS1VD0MgcOBHnLZyoCJGfROGdx1YV gPXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769816; x=1788374616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=3Hv9iWfS7mfY+j+Db48HXpOFPwt6LwOOGwuKKSASBkg=; b=c0DpTYpNFu6DZ9A5TC7wnRyhEuL6RcW8cqoyCbOLT0KXQWCxvH6lD3veOCjsT6aSw2 c4un7OZ1eFvify4PyKbRsCk4d5lrxwndtFpk7WL/dZUpmAYnsFImc6v3FEPmUPMpcvkb YbAejpN6ttt6olFVCff6dHLIklcMXLUV5XxTi9yQtThWYvuz6ajBwUvM7wne01jcMicO vpEMWCaM5dLHdWjJjngtDgw8bj4tT5i8LDvV9KEuRfD3UL/lDpIDnmc3gaXp3/zS0g1j 1wiYryhCcmrEdSQVzJilgclQM6SSJKqzIslWYY/2B8f97lYW7S1id2gDPGsK/mEv3vTe QgTQ== X-Gm-Message-State: AFuF++loJgHVGheP+f/Hps3V08GYmkrm5IyXlXvpVm0LlRpi0sLQJNlJ YDmO0d3ZzJ2t8EowE9z/Trr+BErYV0i6Zfboo7sS7WxmJsL3zcvy7hp4tkHbQ2WN X-Gm-Gg: AR+sD101kk7lVpLDbLamejl/ZhDDwy9YDbjIINr+ReVI2tYi7gS+QU8lVA7RLuxEOzi NL654ggMQgsASi3ptKhuTcmqq341AzKR4slmGti1KUBmvSw/E5VE8II+6yFEFWreipiYCjeyVrn bMzUSrDqj+F8PdRBR7EZ+bmex+MqSCWr7L8Fj1mLb4el13x2WPm020hKiUJayXw28aYHOuiABQY 5yskqX19mMyQIj3T2wtVhVb8qAGwjyp0kNllBUkxhTPipJgF4AhYQ/HSU5JHsdZBbGWTDLyWDcA Y5W5H2XQNpMAvTTrNvqCiQaNiAcCHcDIDiDKiLQl6y22GZigpueg88FbS6tQbRXAsg87m0rIXBs DcLyCRKINjoQvjUxJxHJVgCtoypN9tlurRarTSJxoJZZTI/7w79nRylORJr2pvBXeSDbWGwKLB9 CoCZbPCrlUl9vBVhpM6DrOCfg4MFeFjYx9+ViYmXvO57b/qupUWhowYwI6H2RMULQ1QeLB+N1z/ BADRFI2BtrKosntlVxQe2E7cMSOcZrO X-Received: by 2002:a17:90a:e70f:b0:38e:49c0:75a7 with SMTP id 98e67ed59e1d1-3966d43471cmr19184220a91.8.1787769815927; Wed, 26 Aug 2026 11:43:35 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 06/13] hw/arm/virt: use unique QOM name Date: Thu, 27 Aug 2026 02:42:20 +0800 Message-ID: <20260826184229.1145-7-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=luoyonggang@gmail.com; helo=mail-pj1-x102a.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769856732158500 Content-Type: text/plain; charset="utf-8" Set TYPE_VIRT_MACHINE to MACHINE_TYPE_NAME("arm-virt") so ARM virt no longer collides with other virt-machine types in one process. Keep the -M / help / migration name as virt-* via machine_class_set_name(). Signed-off-by: Yonggang Luo --- hw/arm/virt.c | 3 ++- include/hw/arm/virt.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index c2ace7706f1..ee71974e67a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -124,13 +124,14 @@ static void arm_virt_compat_default_set(MachineClass = *mc) MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ mc->desc =3D "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Ma= chine"; \ MACHINE_VER_DEPRECATION(__VA_ARGS__); \ + machine_class_set_name(mc, "virt-" MACHINE_VER_STR(__VA_ARGS__)); \ if (latest) { \ mc->alias =3D "virt"; \ } \ } \ static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) =3D \ { \ - .name =3D MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ + .name =3D MACHINE_VER_TYPE_NAME("arm-virt", __VA_ARGS__), \ .parent =3D TYPE_VIRT_MACHINE, \ .class_init =3D MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ .interfaces =3D type_target_specific, \ diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 22e66d1a113..383ee320948 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -215,7 +215,7 @@ struct VirtMachineState { =20 #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) =20 -#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt") +#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("arm-virt") OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE) =20 void virt_acpi_setup(VirtMachineState *vms); --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:50 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769863; cv=none; d=zohomail.com; s=zohoarc; b=V2C6L+t7cR95JH+ukHoYu7ywLIxZ8Kr8lH1c2ivkNxx+XnAFkFNSM3+9L16tXkEjSFPfOJD5YR62TB4lLuSH6Vnedt8i70xh926Nt303ICSgHendTad542aNFtmRqLYtpuRZlZp/TueJ9f/64Lp6GzVNaeFkF1NPrZzIRfE1QTo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769863; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qvSXB6oRdyogOyBMO8/d9ul6EZydtk7qJ/Ia1vJDicE=; b=izzvDzyYC4B6p+cou4wF1YN1u35TISOztYStdzlp6jgtURl07hrKlaZ8mPx+jInWcBKfANwJNLJOvyofUc8GkuMOLiB6WkU58pgOiSLSJvzEiIfql91xOr11LfkXwcMvTAc+a74liJbNViGT840FvFNj3lx6PzOnFROyP4cObgA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178776986382523.161348667078187; Wed, 26 Aug 2026 11:44:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIbG-00015z-P0; Wed, 26 Aug 2026 14:43:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIbF-00014F-PC for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:49 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIbC-0002Wx-G5 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:49 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-3965d3d9ab8so1345630a91.3 for ; Wed, 26 Aug 2026 11:43:46 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769825; x=1788374625; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=qvSXB6oRdyogOyBMO8/d9ul6EZydtk7qJ/Ia1vJDicE=; b=WrdLxbknpsKjm3ZTJmNl3loQ9WKFNrThZAAcAli4yS+YZ3G+CbgZtUaOjIamONLw4q c2ICmy2MhylQS5l5gXafdFyBUrXxq7IFvcx7APiQi1VvQM+A8UIkurRPtbKP3vU5bN++ 06lrq9Ql928clzJduefiHXqfFwLuK8IBU3Hyl20R5fGhbw8GzgpnqbKeUoXrqXx5cMOE o7/Ygp1lAr69Ta9oM2Ogm4NHWRAMsxPAt+MfiK7oPbLmNhHkKaHG7MfLdxOeDCpHoOkd 024RRDpmlEIHebIF3nOrod5Py3jI510pgZvrgrgH1KNeFZ//mmh7furC9WeASpG7AlhM GUhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769825; x=1788374625; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qvSXB6oRdyogOyBMO8/d9ul6EZydtk7qJ/Ia1vJDicE=; b=EocEEBciTZQkdlKKk4ziZNsCpJdf4Y2Uf4rj70ShhWHX+2MZhKMBFWx3ra7++YI4sB yZFezQpdhyrL1BVdt+rTWM/BuOdVtsvjBM0fH6jnoK8AcGnxnEO5FF/xncy5e8lxW0XF fMbRmlgxYa+R8hrNp0pp9v5PMWY8ju/pakYpcweSUG+TnLZiFHH9pTdrSELFKXhncOo+ nhb29fsORVRUureQuPYBMfWLsDeH1S8YjpD5gxbow/TJpn1R8xW8u2NqF/Qmy7nMH54i rN0lYOUh3DNVC4pTEu26+drF8nYIcpfCUeTkIakdgiZf3pc+hMrh6HXHahYbrn9/lR+H eghg== X-Gm-Message-State: AFuF++mRWEj9V6DN0lr8yMpR+VIki0ErfXuicKBip5j7GwDfZpELlZcw 93wZkEtc3RP0LeOX2Ezse5uLUYKTVwpXoHn8zMY53ljEgLdFcwCa1RD+9nCVU1fT X-Gm-Gg: AR+sD124F0kDNPQK+3yxkDrov0McaWGIsBtZdCKVnOqXUqB+UwjzaetM0cz2mwV0ip+ jzJCPdmbCkD7+ozjP/LbhketN6SMdWCNYS1TY5FGeMgGyOwT5LE3OHEB/1e6JlIPT988U2/r+8p VrEqqkHf97gCLKP2MXhnsQu6aggthsY58EhZ9lYB3weiQ0u/JHALxtOC6FU+amFacvol+V2CHq/ IrjN4Y3L56KVpaV0GRrpy6ZW5kcIqfkpblzCCBADl4vTZQCEaDiu2cVEzmfIma/g4UQHzXPMSpc IFj09iZ7qinu/y3LN3z8vn3Fql3rmjMJW6ioRZggwQTtOuoIXMSz+wTRAYx4lwnntt2g3pgeCbp OEI2SJFKGO7Y9ONJBTwqkhoktJoNVCKBsUpU1/t2GEqpVGg/McluIbQc3t4dUPSZ+SttkVglFtk +H9ToQvuOyL81mvr2jNBC7uNA/7p0V5rtdKu8AHdmL59GXxQwjBWr9SEz2tCCKgps2mej6YyxSS I/7LRt1Iz53ocGWGGw32g== X-Received: by 2002:a17:90b:1dce:b0:381:cef1:11ac with SMTP id 98e67ed59e1d1-3966d3e1cfdmr18768363a91.10.1787769824719; Wed, 26 Aug 2026 11:43:44 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 07/13] hw/arm/virt: prefix ACPI helpers with arm_virt_ Date: Thu, 27 Aug 2026 02:42:21 +0800 Message-ID: <20260826184229.1145-8-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=luoyonggang@gmail.com; helo=mail-pj1-x1030.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769864835158500 - virt_acpi_setup and virt_is_acpi_enabled are generic names also used by RISC-V and LoongArch virt. A combined binary cannot export two functions with the same C symbol. - Rename the ARM helpers to arm_virt_acpi_setup and arm_virt_is_acpi_enabled. Leave the trace event virt_acpi_setup unchanged; it is a separate identifier. Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt-acpi-build.c | 4 ++-- hw/arm/virt.c | 12 ++++++------ include/hw/arm/virt.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index f6386088b6f..a4a0d2c9997 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -1556,7 +1556,7 @@ static const VMStateDescription vmstate_virt_acpi_bui= ld =3D { }, }; =20 -void virt_acpi_setup(VirtMachineState *vms) +void arm_virt_acpi_setup(VirtMachineState *vms) { AcpiBuildTables tables; AcpiBuildState *build_state; @@ -1567,7 +1567,7 @@ void virt_acpi_setup(VirtMachineState *vms) return; } =20 - if (!virt_is_acpi_enabled(vms)) { + if (!arm_virt_is_acpi_enabled(vms)) { trace_virt_acpi_setup(); return; } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ee71974e67a..56d7154fed9 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -771,7 +771,7 @@ static void fdt_add_cpu_nodes(VirtMachineState *vms) &bottom_node, CPU_TOPOLOGY_LEVEL_SOCKET); if (cache_at_topo_level) { - if (bottom_node =3D=3D 1 && !virt_is_acpi_enabled(vms)) + if (bottom_node =3D=3D 1 && !arm_virt_is_acpi_enabled(vms)) error_setg( &error_fatal, "Cannot share L1 at socket_id %d." @@ -811,7 +811,7 @@ static void fdt_add_cpu_nodes(VirtMachineState *vms) top_cluster, bottom_cluster, cp= u, &cluster_offset); - if (bottom_cluster =3D=3D 1 && !virt_is_acpi_enabled(vms))= { + if (bottom_cluster =3D=3D 1 && !arm_virt_is_acpi_enabled(v= ms)) { error_setg(&error_fatal, "Cannot share L1 at socket_id %d, cluster_id %d. " "DT limitation on sharing at cache level =3D 1.", @@ -2038,7 +2038,7 @@ static void create_smmuv3_dev_dtb(VirtMachineState *v= ms, DeviceState *dev, hwaddr base =3D platform_bus_get_mmio_addr(pbus, sbdev, 0); MachineState *ms =3D MACHINE(vms); =20 - if (!(vms->bootinfo.firmware_loaded && virt_is_acpi_enabled(vms))) { + if (!(vms->bootinfo.firmware_loaded && arm_virt_is_acpi_enabled(vms)))= { if (object_property_get_bool(OBJECT(dev), "accel", &error_abort)) { error_setg(errp, "SMMUv3 with accel=3Don not supported for DT"= ); return; @@ -2448,7 +2448,7 @@ void virt_machine_done(Notifier *notifier, void *data) pci_bus_add_fw_cfg_extra_pci_roots(vms->fw_cfg, vms->bus, &error_abort); =20 - virt_acpi_setup(vms); + arm_virt_acpi_setup(vms); virt_build_smbios(vms); } =20 @@ -3212,7 +3212,7 @@ static void machvirt_init(MachineState *machine) create_pcie(vms); create_cxl_host_reg_region(vms); =20 - if (aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) { + if (aarch64 && firmware_loaded && arm_virt_is_acpi_enabled(vms)) { vms->acpi_dev =3D create_acpi_ged(vms); vms->generic_error_notifier.notify =3D virt_generic_error_req; notifier_list_add(&acpi_generic_error_notifiers, @@ -3562,7 +3562,7 @@ static void virt_set_oem_table_id(Object *obj, const = char *value, } =20 =20 -bool virt_is_acpi_enabled(const VirtMachineState *vms) +bool arm_virt_is_acpi_enabled(const VirtMachineState *vms) { if (vms->acpi =3D=3D ON_OFF_AUTO_OFF) { return false; diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 383ee320948..2ee61cc5a06 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -218,8 +218,8 @@ struct VirtMachineState { #define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("arm-virt") OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE) =20 -void virt_acpi_setup(VirtMachineState *vms); -bool virt_is_acpi_enabled(const VirtMachineState *vms); +void arm_virt_acpi_setup(VirtMachineState *vms); +bool arm_virt_is_acpi_enabled(const VirtMachineState *vms); =20 #define CLIDR_CTYPE_NO_CACHE 0x00 #define CLIDR_CTYPE_I_CACHE 0x01 --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:51 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769897; cv=none; d=zohomail.com; s=zohoarc; b=QK6Bs+kUtDuk/NRBf90Kx80pk2DEWwSJ+J+k5r+ATJH30mC+zAdBQV83IDf0BL3myujcGktdQAzP0Ln9zXsN03jxJpBGCvsfpQ9CRDSLMTEMR/hHF42U1WRbykst1qbYavu3ue3iPcdvy0BKuFxgVc40vb00uaT1bKmf0PtXWdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769897; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MAgTvhPJuUZv8l3S0IaG46RWM0hrZ4KFv/YgJfLhx0k=; b=OWNrZW0gog12UeEuzn6ts7YkS5Dfe3o9f8ChFx5FXX7Jrqm0fKXdJYp6RpaXHb+VOSBxc/tuMQa2HHetLjXgvzk7hFxEOydQ1m0AuTMkCpBdJTa7sB8EJuUOed0Lvufp9DL74u/NrmsQW4QUOzCcszsCakR+00ySDqErdoWJAY0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769897399602.7682221392612; Wed, 26 Aug 2026 11:44:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIbQ-0001sB-4q; Wed, 26 Aug 2026 14:44:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIbP-0001jM-4g for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:59 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIbL-0002Z8-1O for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:43:58 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-cc1c8d4a959so740797a12.3 for ; Wed, 26 Aug 2026 11:43:54 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769834; x=1788374634; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=MAgTvhPJuUZv8l3S0IaG46RWM0hrZ4KFv/YgJfLhx0k=; b=PHyEWXnTHY/UmOr13InFzmO4sun6gwFjjrr3JoHA4Jp8O1cGvkqiCjfqYlZtqcSjng DlLjWn2Tac04Yaf2QkYNG/1iwB/nCFfZQOzMXJGLIvtRmz44Z2l3ZVlX1PUqxRdTnP1o SRiebGRMYdkpIcuiyfO5AmJdCefE5ABiftaCUO4tBZIg+ONf++m6U9Jwz8eXJar4CzsZ PdtyczIRrMsJin7sJY6S5DWwy+cLSHeaHeR4Ks+5dts7TooWeyeU1nq0gOk8kmLYSMYw pL2FP1BVzNJwPIxezYU6XlxSN4K/PBaCFa4Eqe9cBbWkcJ9VDK0LbqWP168WYBR7o7Vq pnvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769834; x=1788374634; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MAgTvhPJuUZv8l3S0IaG46RWM0hrZ4KFv/YgJfLhx0k=; b=ZOUgJZrBdIcqKWuIQ/BYnokaixx8kYPQAdZTiWKrySXDkSuQcCb0C7q7B4uGmVICP4 IXr4a+uWqRxb+U8T1nTyWWbdHtLQiSRUFeYWGnS8Ux9MYrZvizA4WaJ6UZGM17BvqiB6 5t0Eo6kokW+OAKidsrzF1VkEm3rFRr2kSZr4YTqgfdWR49VaFbZH9eYijQAw6Dh8+hRF F04ovaNSMdGowgIphvbs+93e6T3aNO1Ea6r2EN7Tx7foWWtZWXnxWvtD5uzU+Z3x76Vd 2FkhTxetlT1vkR9Dq3ZXs6f4dxL2zw79Qyyc6typ1x9Ps4EqEGCBupaad2niVz1k6Ehz Xa8g== X-Gm-Message-State: AFuF++njUUEldjDc/Mm5jYsNwGGXp+26BthAOtp9QJZJgpGtDb1RZJ71 vGyQ/w7K82eogz5kn9gjx4HIa2t1A7rcJa9qRQ09ebxXW52cwviiNKSg1rvt+HSrers= X-Gm-Gg: AR+sD1098z2UxoV/9NEDlrEvw+w2cxTBHPVG2QGf/NP0mQH5Oqiub6wiSjMfC+5V08v vf45UrX5cNuQSQgQ8A9Uq3hvAADNWnLDYF8NhR7R0UT6YwG6dwhrZ2VDghUsDt/jtRNwOJXCQMp GbailneZRuGTWgXOZ8HwRoGVc2coOJWyjqGE5WPNtq78hhgBthGruzqZJSh34t5RQfVVdvdtxzG fe7XtCvMWolq36w3YWrq0/5wun6ieEfwp+qVaComt5IWN/rvInS7DlY10dg3dNkVgcqDcdKnLiL AqpD484FAYYZZ3N2sQVtclOxHORiS6pr2y/WTgBGYiOM13wE/KaUcxQscSnqCzwvss3Ioua2PwO oWGLjo0se2WpKOvAeliugdZqwugMXUs3ZomAQYsW2FZ2QqYQjlxriKt8LLF37c8d5/dFj0efOkX cG+jrouYrg3jGnF4WUYyaYXucKX8P0scf4dYSwFvUKy60puIanN4R5TV3FdixndDhaCWTyqsczz EJm4E7XysR9aAEtRLdc8rXJ3WgDsReU X-Received: by 2002:a05:6a21:3a83:b0:3cc:841d:bb26 with SMTP id adf61e73a8af0-3cf8485c070mr16100519637.15.1787769833619; Wed, 26 Aug 2026 11:43:53 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 08/13] hw/riscv/virt: prefix ACPI helpers with riscv_virt_ Date: Thu, 27 Aug 2026 02:42:22 +0800 Message-ID: <20260826184229.1145-9-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x532.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769898919158500 - virt_acpi_setup and virt_is_acpi_enabled collide with ARM virt when both architectures are linked into one qemu-system binary. - Rename the RISC-V helpers to riscv_virt_acpi_setup and riscv_virt_is_acpi_enabled. Leave file-local virt_acpi_build* names unchanged. Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/riscv/virt-acpi-build.c | 2 +- hw/riscv/virt.c | 6 +++--- include/hw/riscv/virt.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 59c454f4f94..832261391d5 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -1017,7 +1017,7 @@ static const VMStateDescription vmstate_virt_acpi_bui= ld =3D { }, }; =20 -void virt_acpi_setup(RISCVVirtState *s) +void riscv_virt_acpi_setup(RISCVVirtState *s) { AcpiBuildTables tables; AcpiBuildState *build_state; diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 9019a0a04d6..c53370a35f5 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1293,8 +1293,8 @@ static void virt_machine_done(Notifier *notifier, voi= d *data) =20 virt_build_smbios(s); =20 - if (virt_is_acpi_enabled(s)) { - virt_acpi_setup(s); + if (riscv_virt_is_acpi_enabled(s)) { + riscv_virt_acpi_setup(s); } } =20 @@ -1652,7 +1652,7 @@ static void virt_set_iommu_sys(Object *obj, Visitor *= v, const char *name, visit_type_OnOffAuto(v, name, &s->iommu_sys, errp); } =20 -bool virt_is_acpi_enabled(RISCVVirtState *s) +bool riscv_virt_is_acpi_enabled(RISCVVirtState *s) { return s->acpi !=3D ON_OFF_AUTO_OFF; } diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 5559783aebb..38ad8b0097e 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -133,9 +133,9 @@ enum { #define FDT_APLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \ 1 + FDT_APLIC_INT_CELLS) =20 -bool virt_is_acpi_enabled(RISCVVirtState *s); +bool riscv_virt_is_acpi_enabled(RISCVVirtState *s); bool virt_is_iommu_sys_enabled(RISCVVirtState *s); -void virt_acpi_setup(RISCVVirtState *vms); +void riscv_virt_acpi_setup(RISCVVirtState *vms); =20 /* * The virt machine physical address space used by some of the devices --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:51 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769869; cv=none; d=zohomail.com; s=zohoarc; b=e6blCLIb0U23IpCfVoYarJ0q1qMVmCq/RsjuNGvtE5cW5p/jKamFbO1UwP4CSAB4RDKic1hJR7odnoGj/mQtK+hTTzrHKkBs2ZAuwmQulNswk7pbui8BoFaRXCAi8/VWoN9/BWbfpLtI8VLXq+poL8lCqLdD+8/NpCOTVNFsfvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769869; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qwzEZxEmFuyhMgoWNMywLma5RZEuBk1uut9/tIFYhTY=; b=DSH3ljpxCvTCMM9LFuTXk7V7waMqxifMh2M1IuDaWmMgwMBxip2nt1jMLmgF6dRVCaMlQVqysRCUQ7qwq9vBojl3N3iaCWLTT+/Ak771l15VSJiP6dqAv50hF7U53iM2e//VxbZjpby/wJnq0MS+Bc1oJi24Q4xebLLWWTGYrak= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769869942740.4047299973956; Wed, 26 Aug 2026 11:44:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIbZ-0002Zl-PS; Wed, 26 Aug 2026 14:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIbX-0002NW-4x for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:07 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIbU-0002b5-7j for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:06 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-cbee846deecso1421112a12.1 for ; Wed, 26 Aug 2026 11:44:03 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769842; x=1788374642; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=qwzEZxEmFuyhMgoWNMywLma5RZEuBk1uut9/tIFYhTY=; b=qvwiQ6OZrXG1J/EbTBIU//8IaUc4bTb6VDIKHOJKSveqI5esEcBSJf7FpVIXjx91A5 lJgySmz3cmTArAnChjc7MRBG6+XjoQWXM0NpsGTjimjaSmXnovzK76QXCtbIPaHfQsqB bDl9746eClKZ1KjYiDwO24O8khNI3AcaxJpEZnmbfsnk8H+xYCvTThsdklCqnD2cLdd9 rYwrRqaEFoOx/gTxPn2taSry0Q+4Vr0E1ba7dHDu0wI+kgk2jffGllBjjgyMDDWtM3y1 OsqhG58x8Tt80RmpvNgzLol5cbYaBHuLVwUSets0Gi5bDmWmMAIVhWjE7fNkDK7hhXzP FHRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769842; x=1788374642; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qwzEZxEmFuyhMgoWNMywLma5RZEuBk1uut9/tIFYhTY=; b=Y72uEEwXrCVLEY3u1lZ8W6TCih7kf1c6h3f6uuyhvQr2RE6WWGh0ah9DkF5pDq5tOR lo1ctFb6dT1lAt5JxfkEQiBmYoJC3tiOIDMLH1vXxjGf4J+z1v8jIHtZtFaaqAytCB7s hCt7HqPWFrhw27mvZQGVhg6t2DiHqZxZrOVdLYMGJt+nsNkH3ltjTAidMi5EZKtFYKxZ lvsumhP/+T+36oTcj044ZF6SbIt52dUh2znDP1Rr185r2mFVIr9NRIeUb/U7nOFqKNDZ mG9XxycaNpwNKjVm7ujkmgIlPaKX9Vu683mRX7gVRTIC/XLzfQrnB0pM53mjxMIibw9C dx9g== X-Gm-Message-State: AFuF++m3sz07UrJpzN0B3t3q+PVQLy8PZIMaiA2DeZs6ymcCXEqRQZkj iTpYqJ/Gr2gO5zP6zHl1ubhuLYMeDZmym+Te7hZLdtHEJ4k/jaJ0imaSEzwKEs0XX3A= X-Gm-Gg: AR+sD12d31SoNu9NTDtAKKK9AABZsOsoseXsuvClCNFh0AMhcIspfCaxZQohUoI4zuV uA3zav5Ovk+PQMAO8OxIf6heO8iyP6VZKWoDeyH62CGma++487Dae3WXQwd6qPlXKxjbJ9R5b7F 1hp3f3N1AQ5RyIDkpZutHc8EwVTBOBbMYW1/uYSqY5kv0wMgemkxjB3zCAPYl632RSr26qVRPoj op7q7XBu4BWc33kDofolHcrj9+cZjT+N/Lx3wcdZv8GdqyHmZSSyzH5RFdklta9lRNG4tR2wcM2 M/U+cyRY3veUICEoYuGyqApJ6QbXQ91taal5KArU+WGxM+jaDvBo17YKLBDN5lJwfo7/uDpjXWS BKaw/9NWJa9EV180y/qXcGTUmlqubUoKl6Kv6tKkWU2S/qHlClc08dovrVxHsPaAPXdSVFcG62Q 9HFB8/Kff4frbbFU/Kg2psAu9XLtxhQramEbxtFnQYPcfTK57cDDWMcRxBxTNntHnrKiOfUN0oi fbA8pyDkmjufkK6ZC+Ymw== X-Received: by 2002:a05:6a20:938c:b0:3b3:216b:2743 with SMTP id adf61e73a8af0-3cf7576c44emr17712748637.4.1787769842497; Wed, 26 Aug 2026 11:44:02 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 09/13] hw/loongarch/virt: prefix ACPI helper with loongarch_virt_ Date: Thu, 27 Aug 2026 02:42:23 +0800 Message-ID: <20260826184229.1145-10-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x533.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769872908158500 - virt_acpi_setup is the same C symbol used by ARM and RISC-V virt. Rename it now so a later combined binary does not need meson -D prefixes for LoongArch. - Rename the file-local virt_is_acpi_enabled to loongarch_virt_is_acpi_enabled to match. Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Song Gao --- hw/loongarch/virt-acpi-build.c | 6 +++--- hw/loongarch/virt.c | 2 +- include/hw/loongarch/virt.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/loongarch/virt-acpi-build.c b/hw/loongarch/virt-acpi-build.c index a0b445f297b..bbbac289b49 100644 --- a/hw/loongarch/virt-acpi-build.c +++ b/hw/loongarch/virt-acpi-build.c @@ -674,7 +674,7 @@ static const VMStateDescription vmstate_acpi_build =3D { }, }; =20 -static bool virt_is_acpi_enabled(LoongArchVirtMachineState *lvms) +static bool loongarch_virt_is_acpi_enabled(LoongArchVirtMachineState *lvms) { if (lvms->acpi =3D=3D ON_OFF_AUTO_OFF) { return false; @@ -682,7 +682,7 @@ static bool virt_is_acpi_enabled(LoongArchVirtMachineSt= ate *lvms) return true; } =20 -void virt_acpi_setup(LoongArchVirtMachineState *lvms) +void loongarch_virt_acpi_setup(LoongArchVirtMachineState *lvms) { AcpiBuildTables tables; AcpiBuildState *build_state; @@ -692,7 +692,7 @@ void virt_acpi_setup(LoongArchVirtMachineState *lvms) return; } =20 - if (!virt_is_acpi_enabled(lvms)) { + if (!loongarch_virt_is_acpi_enabled(lvms)) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 6693dea647b..74c9668b6e6 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -242,7 +242,7 @@ static void virt_done(Notifier *notifier, void *data) LoongArchVirtMachineState *lvms =3D container_of(notifier, LoongArchVirtMachineState, machine_d= one); virt_build_smbios(lvms); - virt_acpi_setup(lvms); + loongarch_virt_acpi_setup(lvms); virt_fdt_setup(lvms); } =20 diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h index d39a9bbf5dd..72268466def 100644 --- a/include/hw/loongarch/virt.h +++ b/include/hw/loongarch/virt.h @@ -132,7 +132,7 @@ struct LoongArchVirtMachineState { =20 #define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("virt") OBJECT_DECLARE_SIMPLE_TYPE(LoongArchVirtMachineState, LOONGARCH_VIRT_MACHI= NE) -void virt_acpi_setup(LoongArchVirtMachineState *lvms); +void loongarch_virt_acpi_setup(LoongArchVirtMachineState *lvms); void virt_fdt_setup(LoongArchVirtMachineState *lvms); =20 static inline bool virt_has_dmsi(LoongArchVirtMachineState *lvms) --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:51 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769874; cv=none; d=zohomail.com; s=zohoarc; b=Yaf9R6X9FBq+maUjQ1F8UXQHn52rhrAl3s6oJGpBz3bQFB2AB0aAGEywJOb4UpAXbUiBMRr74QljMHJw5pLx+9QD+ucHrsxb1ZWMLzCGgauF+wX1uUaOfYjaR239O+mlJgX0N10iD6qiVvl4KxpkkY8cfw6OWGY0bAwT/xDMhk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769874; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eug6luKp4bq+h2AS/jTlsfDJn7/9afiJb85NExHjGfA=; b=N1V882GvnL9c1HSzhfwEuvXxT0Upbdh7PT8y5wNKsvyrXXKRg8s/hAx+Zd4gpZm0XDctLQ2ZDVqiOIl6srOm0YNpQVnh7J7giI/hzZS4HCMjGMx21t5KTuc2SchF5E2IEp2Kl4tyjybR8cQToIheYCMoYn6km+XCBKK7nLi1H7k= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769874698230.77108952119272; Wed, 26 Aug 2026 11:44:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIbi-0002tC-Pc; Wed, 26 Aug 2026 14:44:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIbg-0002pH-9S for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:16 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIbc-0002dG-I1 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:16 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2d712281f8bso10749155ad.1 for ; Wed, 26 Aug 2026 11:44:12 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769851; x=1788374651; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=eug6luKp4bq+h2AS/jTlsfDJn7/9afiJb85NExHjGfA=; b=QIbqgkRxr/pzimwRLzJ0Btotm5k4RcsHs6Q/4GW/rsLZfL4JrPkW1y09tvR8n7LIQs VVqRGGscB6ityjg890dfGQcD5H5cNIZFC829w6UGTbkUdGAt2QAPgphR5AaRe/WYE4vn vOyv8KPjoTO1kRNA11XUW34NVFrcd7ZCJmrdOx6gkbQUHrFk/Ug3TXg2NdX5TlWrQ/r+ mbokCMfVrww5Jpk+t44zmuieRLCwhelVhnGh9MDRJ+CoUfPIeekP5f/NqacvaMGTiGD/ o6Xk7jb1Iwv1ga09uX35pQgedlFQh/or0i4NO/gnaw365aIIMz3dFouaPMhHzVz+Tfob mCgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769851; x=1788374651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=eug6luKp4bq+h2AS/jTlsfDJn7/9afiJb85NExHjGfA=; b=OhqXk1cosLakuRha63dwvrdLcQIEMX0yaXGeWB7DnJFIn5GaFAOK9FXx9GxrgSOgwe 87TVJRhtM1mdtXuu0726+5DwKRBu/eHp5X1SD+GmcS5XANB65Wz6STPH7p7D4Wv4KrN9 scn8KdzgV8fAUYhGSSxwQkXXC6VyJAHVUvl3uBuDmCdiUUb6zA39ho+i40+V2PfXaG2P lC5Ne704mTwQhKhtquYJ3msq7PWsGDX3A60VHYV6dBC9RUaXFjgzyMpepujx2yz0+oEL 4VQkBd9sKJiU+sHD3lfu86DJlSm3vsDq1Hf0tk0hT1BPfT7L4Ko9YvpKVeo+KB9G8w9v Fy4w== X-Gm-Message-State: AFuF++krmVZpBk+CIvTO3jOgIfD5ncIRHQH8H+w6Gx8kAkD9AFFU2/6f QBKVPwL178o3f6WNTw6ghOyK98qq+WvB4hZcKu331BYqSxcn8wt/CvbLOMLqPkiRpSc= X-Gm-Gg: AR+sD11sl4cEM4lR+p5XN7iKhlX7IbhZmrD2/05jdzvT31WZ+xG0ov9NEvqdI4VGPmU E9qvzen5AaTxaP2uVN253PQWSxUlCa7o7iwe4IJJwA4OnORRJ3D8tLPD+ZLzPEmlBK1H/G0DXDX 0OrEIEEnJWIVSHRE8kFbbyjKzBy2iA+AlSvF8ZRamkRntLDqWFdszVNTwEz5hfXofuWVt8GNPqY TxxM9I74Tz7aA09JsrKe5FOOiHXuUYJxoMIpQTsJkX/Nj1b/j7J1KajCLpUgWEY/AlYvAwf6eKq a4YfA5Ip5LhkoSV4/jaMNC9BYX+SujnoOYVXZQq4N7+o6Ip3lCz1jriEFK70G+gK6255G6FOuCU 3Sjifoh1lIz5a+dEYWqB2Rh5NdbCPHhuO8JQszHWCtSzs7cYL1y28mPSXqqd8qSkSp3Mjq9SLs7 EJMPcvq+1RN32ZLPBC7bTn/e2G2XVbXaBP1ZwDHEXiSVKFlIWznuZ53LjPi98es/580OZLIf5PA nMEDute4PeAFYBUQy0LD7EgSgqayjls X-Received: by 2002:a17:903:2392:b0:2d0:cc92:f7a3 with SMTP id d9443c01a7336-2d707a53a0fmr178131955ad.2.1787769851181; Wed, 26 Aug 2026 11:44:11 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 10/13] target/riscv: uniquify TCG crc32, crc32c, and wfi helper names Date: Thu, 27 Aug 2026 02:42:24 +0800 Message-ID: <20260826184229.1145-11-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=luoyonggang@gmail.com; helo=mail-pl1-x633.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769876807158500 Content-Type: text/plain; charset="utf-8" - ARM already exports helper_crc32, helper_crc32c, helper_wfi, and the matching helper_info_* objects. RISC-V used the same DEF_HELPER names, which collide in a combined qemu-system link. - Rename the RISC-V helpers to riscv_crc32, riscv_crc32c, and riscv_wfi so the generated C symbols are unique without meson -D prefixes. Signed-off-by: Yonggang Luo --- target/riscv/helper.h | 6 +++--- target/riscv/tcg/bitmanip_helper.c | 4 ++-- target/riscv/tcg/insn_trans/trans_privileged.c.inc | 2 +- target/riscv/tcg/insn_trans/trans_xlrbr.c.inc | 4 ++-- target/riscv/tcg/op_helper.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index 542b7c264fc..dd4623d2a79 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -84,8 +84,8 @@ DEF_HELPER_FLAGS_1(unzip, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_1(zip, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_2(xperm4, TCG_CALL_NO_RWG_SE, tl, tl, tl) DEF_HELPER_FLAGS_2(xperm8, TCG_CALL_NO_RWG_SE, tl, tl, tl) -DEF_HELPER_FLAGS_2(crc32, TCG_CALL_NO_RWG_SE, tl, tl, tl) -DEF_HELPER_FLAGS_2(crc32c, TCG_CALL_NO_RWG_SE, tl, tl, tl) +DEF_HELPER_FLAGS_2(riscv_crc32, TCG_CALL_NO_RWG_SE, tl, tl, tl) +DEF_HELPER_FLAGS_2(riscv_crc32c, TCG_CALL_NO_RWG_SE, tl, tl, tl) =20 /* Floating Point - Half Precision */ DEF_HELPER_FLAGS_3(fadd_h, TCG_CALL_NO_RWG, i64, env, i64, i64) @@ -135,7 +135,7 @@ DEF_HELPER_1(sret, tl, env) DEF_HELPER_1(mret, tl, env) DEF_HELPER_1(mnret, tl, env) DEF_HELPER_1(ctr_clear, void, env) -DEF_HELPER_1(wfi, void, env) +DEF_HELPER_1(riscv_wfi, void, env) DEF_HELPER_1(wrs_nto, void, env) DEF_HELPER_1(tlb_flush, void, env) DEF_HELPER_1(tlb_flush_all, void, env) diff --git a/target/riscv/tcg/bitmanip_helper.c b/target/riscv/tcg/bitmanip= _helper.c index 1156a87dd31..18ad2fae1c9 100644 --- a/target/riscv/tcg/bitmanip_helper.c +++ b/target/riscv/tcg/bitmanip_helper.c @@ -132,7 +132,7 @@ target_ulong HELPER(xperm8)(target_ulong rs1, target_ul= ong rs2) return do_xperm(rs1, rs2, 3); } =20 -target_ulong HELPER(crc32)(target_ulong rs1, target_ulong sz) +target_ulong HELPER(riscv_crc32)(target_ulong rs1, target_ulong sz) { for (target_ulong i =3D 0; i < sz; i++) { rs1 =3D crc32_table[rs1 & 0xFF] ^ (rs1 >> 8); @@ -141,7 +141,7 @@ target_ulong HELPER(crc32)(target_ulong rs1, target_ulo= ng sz) return rs1; } =20 -target_ulong HELPER(crc32c)(target_ulong rs1, target_ulong sz) +target_ulong HELPER(riscv_crc32c)(target_ulong rs1, target_ulong sz) { for (target_ulong i =3D 0; i < sz; i++) { rs1 =3D crc32c_table[rs1 & 0xFF] ^ (rs1 >> 8); diff --git a/target/riscv/tcg/insn_trans/trans_privileged.c.inc b/target/ri= scv/tcg/insn_trans/trans_privileged.c.inc index a8eaccef67e..0df78e89745 100644 --- a/target/riscv/tcg/insn_trans/trans_privileged.c.inc +++ b/target/riscv/tcg/insn_trans/trans_privileged.c.inc @@ -144,7 +144,7 @@ static bool trans_wfi(DisasContext *ctx, arg_wfi *a) #ifndef CONFIG_USER_ONLY decode_save_opc(ctx, 0); gen_update_pc(ctx, ctx->cur_insn_len); - gen_helper_wfi(tcg_env); + gen_helper_riscv_wfi(tcg_env); return true; #else return false; diff --git a/target/riscv/tcg/insn_trans/trans_xlrbr.c.inc b/target/riscv/t= cg/insn_trans/trans_xlrbr.c.inc index 01da2b6ce1d..795231f0839 100644 --- a/target/riscv/tcg/insn_trans/trans_xlrbr.c.inc +++ b/target/riscv/tcg/insn_trans/trans_xlrbr.c.inc @@ -29,11 +29,11 @@ static bool gen_crc(DisasContext *ctx, arg_r2 *a, #define TRANS_CRC32(NAME, SIZE) \ static bool trans_crc32_##NAME(DisasContext *ctx, arg_r2 *a) \ { if (SIZE =3D=3D 8) { REQUIRE_64BIT(ctx); }; \ - return gen_crc(ctx, a, gen_helper_crc32, tcg_constant_tl(SIZE)); } + return gen_crc(ctx, a, gen_helper_riscv_crc32, tcg_constant_tl(SIZE)= ); } #define TRANS_CRC32C(NAME, SIZE) \ static bool trans_crc32c_##NAME(DisasContext *ctx, arg_r2 *a) \ { if (SIZE =3D=3D 8) { REQUIRE_64BIT(ctx); }; \ - return gen_crc(ctx, a, gen_helper_crc32c, tcg_constant_tl(SIZE)); } + return gen_crc(ctx, a, gen_helper_riscv_crc32c, tcg_constant_tl(SIZE= )); } =20 TRANS_CRC32(b, 1); TRANS_CRC32(h, 2); diff --git a/target/riscv/tcg/op_helper.c b/target/riscv/tcg/op_helper.c index ba3c7da375a..52bcedc7c6e 100644 --- a/target/riscv/tcg/op_helper.c +++ b/target/riscv/tcg/op_helper.c @@ -541,7 +541,7 @@ void helper_ctr_clear(CPURISCVState *env) riscv_ctr_clear(env); } =20 -void helper_wfi(CPURISCVState *env) +void HELPER(riscv_wfi)(CPURISCVState *env) { CPUState *cs =3D env_cpu(env); bool rvs =3D riscv_has_ext(env, RVS); --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:51 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769883; cv=none; d=zohomail.com; s=zohoarc; b=nT8/sih8BZ3KQGXVzbQA58idMjRLkpJy5DlQE2r/fNyyFZ6gZZWscho16aWAeu1Vv6QIYu+OKjelOmUWjQrn3Oat6qnygsLBSgmvLAcqIbQqqL1aJLfdkH7EaSccfjsYNyuHVv7jSUhLNsElo5TfNhHqQx3cA4Peb8ban/KQdRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769883; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g47wJ4WBi7Stp9jnoE21g0pDTQck93gzO7r7wKRbrtQ=; b=IBMCRVba/0Enlf3/xIcv7fwW/lsauiuBbaRqVd7yopKVuSqujdQd6yN44vYkgqVhFaSoURq7rVWLEQ4dii1huS/lfJt8eG21tZ7d0ndapw5L15H9Se/OfD4C41uUkhitN34Tp/exd05faTW2btpiVsyEUvuD8EuprIpSciUrt/E= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769883581398.3256676304652; Wed, 26 Aug 2026 11:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIbr-0003JV-2Z; Wed, 26 Aug 2026 14:44:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIbp-0003A4-CF for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:25 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIbl-0002fR-C1 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:25 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-2ceaf8a1265so18305475ad.2 for ; Wed, 26 Aug 2026 11:44:20 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769860; x=1788374660; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=g47wJ4WBi7Stp9jnoE21g0pDTQck93gzO7r7wKRbrtQ=; b=XgYHvgX45xZdM8qlTPA+GoHN6gu6XkUiK75ar2VZrNQi2hynwWXF+NOR8L5AEI6YQ5 AEeqVZ50wGa4fCWBVasdN2h7tQTYKXnwFrouwas8dG318Ut3NuFIzpIQidCRTq/hB2m0 cOjE/EfrWq9O+hBHRFUckvvCBslzfW0dXAa9N7CKezdJWyOJbG+zI0EnLzE3AWWeoemU ivTXeQ2AnZM/K/5Q+kexIknvUc95HJ02UASEaXnxDp+8YjocrDgoW11GZhI0X7bFM5TZ 6cZraXU3HJTm4WXx65DJPIau5BvcoBBkdcpPaOD7xjMoKvzjDF8Rk0CgGWCfE3QvIk9G /3cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769860; x=1788374660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=g47wJ4WBi7Stp9jnoE21g0pDTQck93gzO7r7wKRbrtQ=; b=Q6+ajtDOeT0Iv/4+u0DFxeFKGnrS9JFoqRbakdXuHx70CkZ8f9AovLsY2spUNwQH7Z YQO87ERUR61wo/FkcLfdIHhtdN79hyDF5Btl2e6QCfhU8tCjQDXifa/RpZoW6pBb1dwY vcJB+LV7Z8F8F38fn4ePEYDCdfbCn6hBWFplI+6ljdjqCvQghfkYtuGBRodu9DbI3c4T s4kJEEWzL7FUt3Z2sD0MpwNbd+kpjX7OJcDKUU9UaUFMVq70vG+KvSjIWZ7jtO00/Wyy nHinBrktvBYIClYalyHfpR+59Ed4/GiHCz5TkwGvl4PT7QB1tC7PKOXZIxzsEJ5E2wFl YOAw== X-Gm-Message-State: AFuF++n6Nu3trYeCJbMPibYhU5tbX4ivVyFiq1FGUfe39QB7fr/edzPZ 0G7PYAlZhuTAAn8SuTHYrX1RquVjYijtrQrSiGNSQmuCZnpqNYuH7hH1tqFw0EwPrLw= X-Gm-Gg: AR+sD13LgKrlZ/+f9Qw17yjgQR1Lx11oqEVgm+ZGNYj5N8GUfG9bWifhr1KJl7J0l0I 1M/jzX5jUreMwhzEzjdVAVUOpDokQRHbxJ+Ps9pj0tuVPTArLewCbmaEFnYYfJB2ccEszK/7y+C pziz/iu/iCKGIWD/HazATXeWkdNC0cCzp4IxcCeVDLNZtUqCCKRdeELTBPiz31iY7pHA4Y5nwaU sQeyQbEPg/eOGqcu9XAP+t4J5zHEYnTKEtsK46DdUCS0S23pErXqPeM5a0XvYMKUpedM8x+hyvr BzCrzEPjayc5BqgajBdqb4u/2EV+ffLcoCuZV6MBGwx6tSHQSDjLAj261SbsAhWe0Nk4rOfKr6x NJ8t2Pw/Ny1s+R9VIL74K3if0SEyemqtVnVbRjYsoWc9kp4hrk9SRPcLdIBgD6ytooQAVx5619g zw1W92hdTgTk3GFy0HXxo6Dm8B5zADzINcQ6m6er+kL0VD4ucouuWyzLU6M9D/06AlX2enLpFX8 B35hKegnhpdtS8liEioZUJgjO80yQWU X-Received: by 2002:a17:902:fc4d:b0:2c6:9f66:d573 with SMTP id d9443c01a7336-2d7079ffd98mr175930535ad.2.1787769859773; Wed, 26 Aug 2026 11:44:19 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 11/13] system/vl: add new option -target Date: Thu, 27 Aug 2026 02:42:25 +0800 Message-ID: <20260826184229.1145-12-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=luoyonggang@gmail.com; helo=mail-pl1-x629.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769885045158500 Content-Type: text/plain; charset="utf-8" - Parse -target with QEMU_OPTION_nouserconfig, right after MODULE_INIT_TARGET_INFO, because later init depends on TargetInfo. - target_info_qom_set_target() takes Error **errp. A name comes from -target or from argv0 (qemu-system-aarch64). qemu-system with no suffix and no -target fails; use -target ? to list names. - Fuzz passes TARGET_NAME instead of relying on a unique TargetInfo. Signed-off-by: Pierrick Bouvier Signed-off-by: Yonggang Luo --- include/qemu/target-info-qom.h | 3 +- qemu-options.hx | 8 ++++ system/vl.c | 36 ++++++++++++---- target-info-qom.c | 77 ++++++++++++++++++++++++++++++---- tests/qtest/fuzz/fuzz.c | 2 +- 5 files changed, 110 insertions(+), 16 deletions(-) diff --git a/include/qemu/target-info-qom.h b/include/qemu/target-info-qom.h index 842cf241e0a..9e56383ea6b 100644 --- a/include/qemu/target-info-qom.h +++ b/include/qemu/target-info-qom.h @@ -10,6 +10,7 @@ #define QEMU_TARGET_INFO_QOM_H =20 #include "qemu/target-info-impl.h" +#include "qapi/error.h" #include "qom/object.h" =20 #define TYPE_TARGET_INFO "target-info" @@ -40,7 +41,7 @@ typedef struct TargetInfoQomClass { =20 OBJECT_DECLARE_TYPE(TargetInfoQom, TargetInfoQomClass, TARGET_INFO) =20 -void target_info_qom_set_target(void); +void target_info_qom_set_target(const char *name, Error **errp); =20 /** * get_machine_types_available: diff --git a/qemu-options.hx b/qemu-options.hx index 34970fffc94..824807be1d8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -24,6 +24,14 @@ SRST Display version information and exit ERST =20 +DEF("target", HAS_ARG, QEMU_OPTION_target, \ + "-target target selects the target architecture ('-target help' for l= ist)\n", + QEMU_ARCH_ALL) +SRST +``-target target`` + Selects target architecture ('-target help' for list) +ERST + DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ "-machine [type=3D]name[,prop=3Dvalue[,...]]\n" " selects emulated machine ('-machine help' for list)\n" diff --git a/system/vl.c b/system/vl.c index 4b1fcd2031f..28c5741c385 100644 --- a/system/vl.c +++ b/system/vl.c @@ -281,6 +281,15 @@ static QemuOptsList qemu_accel_opts =3D { }, }; =20 +static QemuOptsList qemu_target_opts =3D { + .name =3D "target", + .implied_opt_name =3D "target", + .head =3D QTAILQ_HEAD_INITIALIZER(qemu_target_opts.head), + .desc =3D { + { /* end of list */ }, + }, +}; + static QemuOptsList qemu_boot_opts =3D { .name =3D "boot-opts", .implied_opt_name =3D "order", @@ -2856,6 +2865,7 @@ void qemu_init(int argc, char **argv) const char *optarg; MachineClass *machine_class; bool userconfig =3D true; + const char *target_name_option =3D NULL; FILE *vmstate_dump_file =3D NULL; =20 qemu_add_opts(&qemu_drive_opts); @@ -2889,6 +2899,7 @@ void qemu_init(int argc, char **argv) qemu_add_opts(&qemu_semihosting_config_opts); qemu_add_opts(&qemu_fw_cfg_opts); qemu_add_opts(&qemu_action_opts); + qemu_add_opts(&qemu_target_opts); qemu_add_run_with_opts(); module_call_init(MODULE_INIT_OPTS); =20 @@ -2898,13 +2909,6 @@ void qemu_init(int argc, char **argv) os_setup_limits(); =20 module_call_init(MODULE_INIT_TARGET_INFO); - target_info_qom_set_target(); - - module_init_info(qemu_modinfo); - module_allow_arch(target_name()); - - qemu_init_subsystems(); - /* first pass of option parsing */ optind =3D 1; while (optind < argc) { @@ -2919,10 +2923,25 @@ void qemu_init(int argc, char **argv) case QEMU_OPTION_nouserconfig: userconfig =3D false; break; + case QEMU_OPTION_target: + target_name_option =3D optarg; + break; } } } =20 + /* + * Identify target: first from option, then from argv[0]. + * This happens even before handling --help option, because it may con= tain + * entries that are target specific. + */ + target_info_qom_set_target(target_name_option, &error_fatal); + + module_init_info(qemu_modinfo); + module_allow_arch(target_name()); + + qemu_init_subsystems(); + machine_opts_dict =3D qdict_new(); if (userconfig) { qemu_read_default_config_file(&error_fatal); @@ -2946,6 +2965,9 @@ void qemu_init(int argc, char **argv) exit(1); } switch(popt->index) { + case QEMU_OPTION_target: + /* handled previously, ignore it here */ + break; case QEMU_OPTION_cpu: /* hw initialization will check this */ cpu_option =3D optarg; diff --git a/target-info-qom.c b/target-info-qom.c index 68ad734049c..5f7af028749 100644 --- a/target-info-qom.c +++ b/target-info-qom.c @@ -7,6 +7,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/help_option.h" #include "qapi/error.h" #include "qom/object.h" #include "qemu/target-info-impl.h" @@ -87,16 +88,78 @@ const TargetInfo *target_info(void) return target_info_ptr; } =20 -void target_info_qom_set_target(void) +static void set_target_info(const TargetInfo *chosen) { - g_autoptr(GSList) targets =3D object_class_get_list(TYPE_TARGET_INFO, = false); + target_info_ptr =3D chosen; +} + +static void list_targets_available(void) +{ + printf("List of targets available:\n"); + g_autoptr(GSList) targets =3D object_class_get_list_sorted(TYPE_TARGET= _INFO, false); + for (GSList *elem =3D targets; elem; elem =3D elem->next) { + const TargetInfo *ti =3D TARGET_INFO_CLASS(elem->data)->target_inf= o; + + printf("- %s\n", ti->target_name); + } +} + +static bool target_info_matches_name(const TargetInfo *ti, const char *nam= e) +{ + return !strcmp(name, ti->target_name); +} + +/* qemu-system-aarch64[.exe] -> aarch64; qemu-system[.exe] -> NULL. */ +static const char *target_from_argv0(char *base) +{ + if (g_str_has_prefix(base, "qemu-system-")) { + return base + strlen("qemu-system-"); + } + return NULL; +} =20 +void target_info_qom_set_target(const char *name, Error **errp) +{ + g_autoptr(GSList) targets =3D object_class_get_list(TYPE_TARGET_INFO, = false); + g_autofree char *prg_base =3D NULL; size_t num_found =3D g_slist_length(targets); - if (num_found !=3D 1) { - error_setg(&error_fatal, num_found =3D=3D 0 ? - "no target-info is available" : - "more than one target-info is available"); + + if (num_found =3D=3D 0) { + error_setg(errp, "no target-info is available"); + return; + } + + if (!name) { + const char *prg =3D g_get_prgname(); + if (prg && prg[0]) { + char *dot; + + prg_base =3D g_path_get_basename(prg); + dot =3D strrchr(prg_base, '.'); + if (dot && g_ascii_strcasecmp(dot, ".exe") =3D=3D 0) { + *dot =3D '\0'; + } + name =3D target_from_argv0(prg_base); + } + } + + if (name) { + if (is_help_option(name)) { + list_targets_available(); + exit(0); + } + for (GSList *elem =3D targets; elem; elem =3D elem->next) { + const TargetInfo *ti =3D TARGET_INFO_CLASS(elem->data)->target= _info; + if (target_info_matches_name(ti, name)) { + set_target_info(ti); + return; + } + } + error_setg(errp, "target '%s' is not available, " + "use -target ? to list available targets", name); + return; } =20 - target_info_ptr =3D TARGET_INFO_CLASS(targets->data)->target_info; + error_setg(errp, "no target specified, " + "use -target ? to list available targets"); } diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index a3a131c80f8..c992fab4079 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -174,7 +174,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char = ***envp) /* Initialize qgraph and modules */ qos_graph_init(); module_call_init(MODULE_INIT_TARGET_INFO); - target_info_qom_set_target(); + target_info_qom_set_target(fuzz_arch, &error_fatal); module_call_init(MODULE_INIT_FUZZ_TARGET); module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_LIBQOS); --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:51 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769885; cv=none; d=zohomail.com; s=zohoarc; b=RX/oct7+tLyO+NirmzDCwuZSVL5r/NPGn10wFERZdApIA0n05HQaMZAIYPf3jVa8uj10qczBPDsCVDqIckd2W06U9A8cqlN0Q6cuz3H12bJmXZKrVzao6I4rqDY3oc0r7ykSs9WcEt0vxvzdm1v/YjELie/gIzJ0lb85d4JBNhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769885; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ocNlaKj0Aj7r7mfXj5r6DZmfYzPBHg5nq6gU1YFSqCw=; b=nzPs5l1iMhR2w6nA7oy8nIHhCFY/PsHuUafXIFbbNYak0mQksEtCST0ldlLl+viEkt86mjo8a3ervLJh/WFmvOKnf0omP4teiuyHF2fzPXqTuWmmkTZL+PRvfHyjOlP7//JENKlayumzV7NNrYADNL0ZZU/93IazqcrhN5TGP/A= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769885408401.49093693332236; Wed, 26 Aug 2026 11:44:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIc1-0003y5-7w; Wed, 26 Aug 2026 14:44:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIbz-0003sp-C0 for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:35 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIbu-0002k7-Gu for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:35 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2d5cad1a6baso13433975ad.3 for ; Wed, 26 Aug 2026 11:44:30 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769869; x=1788374669; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ocNlaKj0Aj7r7mfXj5r6DZmfYzPBHg5nq6gU1YFSqCw=; b=RpmPGuoigPpQeSw8tqwwXnqLu35NPTQ70J0DiaYeys1i6R+jKYjqPa3YZiOOk1Apmv jv+b3C4G3klxSWhGodg+sTzV07wJIvExibh1RoW08tPRleIhd2NHQI6TMTESgTqlc775 du6KbWRtUD56yxu0TxlLOBg+BtKrgR9+HYY3dHGp7F/alDUVbo+FPup8TJuDUvhMAtVB usfxmwXEwZz6MFkIAldNT5RHPX99YSEUVoaVj8WX46dkj2BVLJGuyGKVzHvIKsewEBLN aRC2fr8Jd92UXL6PtbKswQt2snQcmUGfNXedlILI+Ec/xCIP7KhMOXNJJnmJNz81CV9I fI/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769869; x=1788374669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ocNlaKj0Aj7r7mfXj5r6DZmfYzPBHg5nq6gU1YFSqCw=; b=R2Xgr5QMgp8tsgtPaMMUZVySvNNhR3TfhHJZU9TtDWwTjuLCNaWTjQCJV3dc/kOyM8 /i781sFSHuDNym+xslmaMcptOeVBGysz4cCnPZbx9F4P5rPmCgvod5ChHjzKpXmLxCBD vJlt0qqrWDtNP2aAbNN2adrvfvVjDsGUDiMSchMPCzcbDegIzdfNlevI0cPmQwSgdnCT K6FVACyOauyuIzKj6LEETWmbQs3ytaMGz+6kBZNB2hxhi3g+aYk0VhQke/cnvCfi8Xv1 WkjupDSxPKsaVATo5HPmACGvNeLdxIuOHuJ7pLLm9UbQwSzInQTvkpDkbLAfAcLfzLhJ czFw== X-Gm-Message-State: AFuF++n8FWvGGfniFN+Y89O9LaTsB8RkVzNpK19GndLxaGUacC7gVlkz YMXkrvUlHJyZ95lNsDHWfeVyeW7Qq8LCzYzm1AjEz2W7LSzh36mvbqsuTm1QGa/yZbU= X-Gm-Gg: AR+sD12f3imdPQGJd2TjPJTtxs8KRRdgutKV1ObdlI/tTYy9cht9IxO2jLvvD5Sroks 6HCh96gXGJwQB0bcBoIgCLpyX2v13cuwIDHDRN6PpZAQBKxdioZ6KOuJevU6YdASX0hTTn1RJDN 1dlq6Pv3C9c1xrVT+N1JqKoRORS+hMmJrrkA6vf4R+E4kRVuM18k9n6/vUJjbO7QOfHWEgtzeyH bx1+dEQNTzx11JLPNo/FPJQfaC281hZ97AuK2ZzkrsKObZnv2Un0EzLu45g6MulQrSbuWWleS+N HWgtu/icuXF5Vvw0eifGzVlhptY53q6E8IWgRUjyRhrWv1IOHJxAqylozurAf53hGCVyDC62prS IWLwCmdSCt5HQI9Fgs7MVJc7NiVQ2koEMPJhuiT5bQOrIts9op/+FpIs0e/IQdfiOIKxqmfJx2k Uezkc+uXrMYhSAWvX2FWFfjSebAo6ghgPkun9w9qa/tPg+mkOpIhFkZB1+7YlNs1stXZKGRgl43 BfFamMGYr5mtPTS0lr9Fxg= X-Received: by 2002:a17:903:94c:b0:2cf:8131:75e8 with SMTP id d9443c01a7336-2d707b61486mr164693075ad.13.1787769868770; Wed, 26 Aug 2026 11:44:28 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 12/13] target-info: dispatch CPU QMP, dump, and arm/riscv semihosting Date: Thu, 27 Aug 2026 02:42:26 +0800 Message-ID: <20260826184229.1145-13-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=luoyonggang@gmail.com; helo=mail-pl1-x62a.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1787769887017158500 Content-Type: text/plain; charset="utf-8" - Combined binaries cannot keep one global C symbol per arch for query-cpu-definitions, dump notes, or Angel semihosting. Put those handlers on a process-wide TargetCpuOps table and fill one member at a time. - TARGET_INFO_CPU_OP is type_init (MODULE_INIT_QOM). That runs after target_info_qom_set_target(), so ELF constructors only queue the callback. target_info_register_cpu_op() stores the impl only when cpu_type matches the selected TargetInfo; a duplicate slot is reported and ignored. A NULL member means this target has no handler, not "too early". - Keep the table in target-info.c (common_ss) and filter with target_info()->cpu_type so user-mode can resolve TARGET_INFO_CPU_OP. Take the address of the impl so the same macro stores both function pointers and ops tables. - QMP query-cpu-definitions and query-cpu-model-expansion dispatch from hw/core/machine-qmp-cmds.c. Dump cpu_get_dump_info and cpu_get_note_size dispatch from hw/core/cpu-system.c. Arch handlers are static with an arch prefix (s390_query_*, arm_get_dump_info, ...). ppc and mips drop expansion stubs; the dispatcher errors instead. - Angel semihosting uses CPUSemihostingOps on TargetCpuOps.semihosting. ARM and RISC-V keep a static ops table in common-semi-target.c and register it with TARGET_INFO_CPU_OP. Wrappers in common-semi.h call target_info_cpu_ops()->semihosting. Always compile those files so both tables exist in a combined link. - Drop stubs/qmp-cpu.c and stubs/dump.c: every system binary has the wrappers, and tools do not implement these commands. Keep stubs/qmp-cpu-s390x.c for comparison/baseline. Signed-off-by: Yonggang Luo --- MAINTAINERS | 1 - hw/core/cpu-system.c | 23 +++++++++++ hw/core/machine-qmp-cmds.c | 26 +++++++++++++ include/qemu/target-info-qom.h | 39 +++++++++++++++++++ include/semihosting/common-semi.h | 56 ++++++++++++++++++++++++--- stubs/dump.c | 27 ------------- stubs/meson.build | 2 - stubs/qmp-cpu.c | 21 ---------- target-info.c | 32 +++++++++++++++ target/arm/arch_dump.c | 8 +++- target/arm/arm-qmp-cmds.c | 15 +++++-- target/arm/common-semi-target.c | 23 ++++++++--- target/arm/meson.build | 7 +--- target/i386/arch_dump.c | 8 +++- target/i386/cpu-system.c | 12 ++++-- target/i386/cpu.c | 6 ++- target/loongarch/arch_dump.c | 8 +++- target/loongarch/loongarch-qmp-cmds.c | 15 +++++-- target/mips/system/mips-qmp-cmds.c | 15 +++---- target/ppc/arch_dump.c | 8 +++- target/ppc/ppc-qmp-cmds.c | 15 +++---- target/riscv/arch_dump.c | 8 +++- target/riscv/common-semi-target.c | 25 ++++++++---- target/riscv/meson.build | 4 +- target/riscv/riscv-qmp-cmds.c | 15 +++++-- target/s390x/arch_dump.c | 8 +++- target/s390x/cpu_models_system.c | 15 +++++-- 27 files changed, 311 insertions(+), 131 deletions(-) delete mode 100644 stubs/dump.c delete mode 100644 stubs/qmp-cpu.c diff --git a/MAINTAINERS b/MAINTAINERS index 902db77218e..08e84e4ac6d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3348,7 +3348,6 @@ F: include/system/dump-arch.h F: include/system/dump.h F: qapi/dump.json F: scripts/dump-guest-memory.py -F: stubs/dump.c F: docs/specs/vmcoreinfo.rst F: tests/qtest/vmcoreinfo-test.c F: tests/qtest/dump-test.c diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 14eb4ed87f8..6dfbbac7f24 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -24,7 +24,9 @@ #include "exec/cputlb.h" #include "exec/target_page.h" #include "system/memory.h" +#include "system/dump-arch.h" #include "qemu/target-info.h" +#include "qemu/target-info-qom.h" #include "hw/core/qdev.h" #include "hw/core/qdev-properties.h" #include "hw/core/sysemu-cpu-ops.h" @@ -127,6 +129,27 @@ int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUS= tate *cpu, return (*cpu->cc->sysemu_ops->write_elf64_note)(f, cpu, cpuid, opaque); } =20 +int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks) +{ + const TargetCpuOps *ops =3D target_info_cpu_ops(); + + if (!ops->get_dump_info) { + return -1; + } + return ops->get_dump_info(info, guest_phys_blocks); +} + +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +{ + const TargetCpuOps *ops =3D target_info_cpu_ops(); + + if (!ops->get_note_size) { + return -1; + } + return ops->get_note_size(class, machine, nr_cpus); +} + bool cpu_internal_is_big_endian(CPUState *cpu) { if (cpu->cc->sysemu_ops->internal_is_big_endian) { diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index e6e6ecc31e3..f8297203848 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -449,3 +449,29 @@ void qmp_dump_skeys(const char *filename, Error **errp) } DUMP_SKEYS_INTERFACE_CLASS(oc)->qmp_dump_skeys(filename, errp); } + +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +{ + const TargetCpuOps *ops =3D target_info_cpu_ops(); + + if (!ops->query_cpu_definitions) { + error_setg(errp, + "CPU model definitions are not supported on this target= "); + return NULL; + } + return ops->query_cpu_definitions(errp); +} + +CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType= type, + CpuModelInfo *model, + Error **errp) +{ + const TargetCpuOps *ops =3D target_info_cpu_ops(); + + if (!ops->query_cpu_model_expansion) { + error_setg(errp, + "CPU model expansion is not supported on this target"); + return NULL; + } + return ops->query_cpu_model_expansion(type, model, errp); +} diff --git a/include/qemu/target-info-qom.h b/include/qemu/target-info-qom.h index 9e56383ea6b..438663f9e1b 100644 --- a/include/qemu/target-info-qom.h +++ b/include/qemu/target-info-qom.h @@ -13,6 +13,45 @@ #include "qapi/error.h" #include "qom/object.h" =20 +#include + +typedef struct ArchDumpInfo ArchDumpInfo; +struct GuestPhysBlockList; +typedef struct CPUSemihostingOps CPUSemihostingOps; + +typedef struct TargetCpuOps { + CpuDefinitionInfoList *(*query_cpu_definitions)(Error **errp); + CpuModelExpansionInfo *(*query_cpu_model_expansion)( + CpuModelExpansionType type, CpuModelInfo *model, Error **errp); + int (*get_dump_info)(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_block= s); + ssize_t (*get_note_size)(int class, int machine, int nr_cpus); + const CPUSemihostingOps *semihosting; +} TargetCpuOps; + +/** + * target_info_register_cpu_op: + * @cpu_type: CPU_RESOLVING_TYPE of the registering architecture + * @offset: offsetof(TargetCpuOps, member) for the slot being filled + * @impl: handler or ops table stored at that offset + * + * Combined binaries merge one member at a time so QMP, dump, and + * semihosting (or split QMP files) can register independently. + * MODULE_INIT_QOM runs after target_info_qom_set_target(), so only + * the selected cpu_type is stored. + */ +void target_info_register_cpu_op(const char *cpu_type, size_t offset, + void *impl); +const TargetCpuOps *target_info_cpu_ops(void); + +#define TARGET_INFO_CPU_OP(cpu_type, member, impl) = \ +static void glue(target_info_cpu_op_, impl)(void) = \ +{ = \ + target_info_register_cpu_op((cpu_type), offsetof(TargetCpuOps, member)= , \ + (void *)&(impl)); = \ +} = \ +type_init(glue(target_info_cpu_op_, impl)) + #define TYPE_TARGET_INFO "target-info" =20 #define TYPE_TARGET_SPECIFIC "target-specific" diff --git a/include/semihosting/common-semi.h b/include/semihosting/common= -semi.h index aa511a46f42..f86a855a3dd 100644 --- a/include/semihosting/common-semi.h +++ b/include/semihosting/common-semi.h @@ -34,12 +34,56 @@ #ifndef COMMON_SEMI_H #define COMMON_SEMI_H =20 +#include "exec/cpu-common.h" +#include "qemu/target-info-qom.h" + +typedef struct CPUSemihostingOps { + uint64_t (*arg)(CPUState *cs, int argno); + void (*set_ret)(CPUState *cs, uint64_t ret); + bool (*is_64bit)(CPUArchState *env); + bool (*sys_exit_is_extended)(CPUState *cs); + uint64_t (*stack_bottom)(CPUState *cs); + bool (*has_synccache)(CPUArchState *env); +} CPUSemihostingOps; + void do_common_semihosting(CPUState *cs); -uint64_t common_semi_arg(CPUState *cs, int argno); -void common_semi_set_ret(CPUState *cs, uint64_t ret); -bool is_64bit_semihosting(CPUArchState *env); -bool common_semi_sys_exit_is_extended(CPUState *cs); -uint64_t common_semi_stack_bottom(CPUState *cs); -bool common_semi_has_synccache(CPUArchState *env); + +static inline const CPUSemihostingOps *cpu_semihosting_ops(void) +{ + const CPUSemihostingOps *ops =3D target_info_cpu_ops()->semihosting; + + g_assert(ops); + return ops; +} + +static inline uint64_t common_semi_arg(CPUState *cs, int argno) +{ + return cpu_semihosting_ops()->arg(cs, argno); +} + +static inline void common_semi_set_ret(CPUState *cs, uint64_t ret) +{ + cpu_semihosting_ops()->set_ret(cs, ret); +} + +static inline bool is_64bit_semihosting(CPUArchState *env) +{ + return cpu_semihosting_ops()->is_64bit(env); +} + +static inline bool common_semi_sys_exit_is_extended(CPUState *cs) +{ + return cpu_semihosting_ops()->sys_exit_is_extended(cs); +} + +static inline uint64_t common_semi_stack_bottom(CPUState *cs) +{ + return cpu_semihosting_ops()->stack_bottom(cs); +} + +static inline bool common_semi_has_synccache(CPUArchState *env) +{ + return cpu_semihosting_ops()->has_synccache(env); +} =20 #endif /* COMMON_SEMI_H */ diff --git a/stubs/dump.c b/stubs/dump.c deleted file mode 100644 index df7897b72b1..00000000000 --- a/stubs/dump.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * QEMU dump - * - * Copyright Fujitsu, Corp. 2011, 2012 - * - * Authors: - * Wen Congyang - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * See the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" -#include "system/dump-arch.h" - -int cpu_get_dump_info(ArchDumpInfo *info, - const struct GuestPhysBlockList *guest_phys_blocks) -{ - return -1; -} - -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) -{ - return -1; -} - diff --git a/stubs/meson.build b/stubs/meson.build index 3b2f2680b19..94024aef868 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -68,7 +68,6 @@ if have_system # adding more of these. If the symbol is used in specific_ss, # in particular, consider defining a preprocessor macro via # Kconfig or configs/targets/. - stub_ss.add(files('dump.c')) stub_ss.add(files('cmos.c')) stub_ss.add(files('fw_cfg.c')) if igvm.found() @@ -82,7 +81,6 @@ if have_system stub_ss.add(files('qmp-i386-sev.c')) stub_ss.add(files('qmp-i386-sgx.c')) stub_ss.add(files('qmp-i386-xen.c')) - stub_ss.add(files('qmp-cpu.c')) stub_ss.add(files('qmp-cpu-s390x.c')) stub_ss.add(files('qmp-cpu-s390x-kvm.c')) stub_ss.add(files('hmp-cmd-info_mem.c')) diff --git a/stubs/qmp-cpu.c b/stubs/qmp-cpu.c deleted file mode 100644 index a8c7ee89b9d..00000000000 --- a/stubs/qmp-cpu.c +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -#include "qemu/osdep.h" -#include "qapi/error.h" -#include "qapi/qapi-commands-machine.h" - -CpuModelExpansionInfo * -qmp_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *model, - Error **errp) -{ - error_setg(errp, "CPU model expansion is not supported on this target"= ); - return NULL; -} - -CpuDefinitionInfoList * -qmp_query_cpu_definitions(Error **errp) -{ - error_setg(errp, "CPU model definitions are not supported on this targ= et"); - return NULL; -} diff --git a/target-info.c b/target-info.c index ce7f9797dce..aa4be08bb94 100644 --- a/target-info.c +++ b/target-info.c @@ -7,9 +7,11 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/target-info.h" #include "qemu/target-info-qapi.h" #include "qemu/target-info-impl.h" +#include "qemu/target-info-qom.h" #include "qapi/error.h" =20 const char *target_name(void) @@ -124,3 +126,33 @@ bool target_config_xen(void) { return target_info()->config_xen; } + +static TargetCpuOps target_cpu_ops; + +void target_info_register_cpu_op(const char *cpu_type, size_t offset, + void *impl) +{ + const TargetInfo *ti =3D target_info(); + void **slot; + + g_assert(ti); + g_assert(offset + sizeof(void *) <=3D sizeof(TargetCpuOps)); + g_assert((offset % sizeof(void *)) =3D=3D 0); + + if (strcmp(cpu_type, ti->cpu_type)) { + return; + } + + slot =3D (void **)((char *)&target_cpu_ops + offset); + if (*slot) { + error_report("TargetCpuOps already registered for type '%s' (offse= t %zu)", + cpu_type, offset); + return; + } + *slot =3D impl; +} + +const TargetCpuOps *target_info_cpu_ops(void) +{ + return &target_cpu_ops; +} diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c index 1dd79849c13..e072516bdac 100644 --- a/target/arm/arch_dump.c +++ b/target/arm/arch_dump.c @@ -24,6 +24,7 @@ #include "system/dump.h" #include "cpu-features.h" #include "internals.h" +#include "qemu/target-info-qom.h" =20 /* struct user_pt_regs from arch/arm64/include/uapi/asm/ptrace.h */ struct aarch64_user_regs { @@ -385,7 +386,7 @@ int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, C= PUState *cs, return 0; } =20 -int cpu_get_dump_info(ArchDumpInfo *info, +static int arm_get_dump_info(ArchDumpInfo *info, const GuestPhysBlockList *guest_phys_blocks) { ARMCPU *cpu; @@ -439,7 +440,7 @@ int cpu_get_dump_info(ArchDumpInfo *info, return 0; } =20 -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +static ssize_t arm_get_note_size(int class, int machine, int nr_cpus) { ARMCPU *cpu =3D ARM_CPU(first_cpu); size_t note_size; @@ -459,3 +460,6 @@ ssize_t cpu_get_note_size(int class, int machine, int n= r_cpus) =20 return note_size * nr_cpus; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_dump_info, arm_get_dump_info); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_note_size, arm_get_note_size); diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index 83ec95c290f..c85bde5d79d 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -32,6 +32,7 @@ #include "qobject/qdict.h" #include "qom/qom-qobject.h" #include "cpu.h" +#include "qemu/target-info-qom.h" =20 static GICCapability *gic_cap_new(int version) { @@ -79,9 +80,10 @@ static const char *cpu_model_advertised_features[] =3D { NULL }; =20 -CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType= type, - CpuModelInfo *model, - Error **errp) +static CpuModelExpansionInfo * +arm_query_cpu_model_expansion(CpuModelExpansionType type, + CpuModelInfo *model, + Error **errp) { CpuModelExpansionInfo *expansion_info; const QDict *qdict_in; @@ -216,7 +218,7 @@ static void arm_cpu_add_definition(gpointer data, gpoin= ter user_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *arm_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; @@ -227,3 +229,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error = **errp) =20 return cpu_list; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + arm_query_cpu_definitions); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_model_expansion, + arm_query_cpu_model_expansion); diff --git a/target/arm/common-semi-target.c b/target/arm/common-semi-targe= t.c index 2b77ce9c17b..eccd3735df8 100644 --- a/target/arm/common-semi-target.c +++ b/target/arm/common-semi-target.c @@ -12,7 +12,7 @@ #include "semihosting/common-semi.h" #include "target/arm/cpu-qom.h" =20 -uint64_t common_semi_arg(CPUState *cs, int argno) +static uint64_t arm_common_semi_arg(CPUState *cs, int argno) { ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; @@ -23,7 +23,7 @@ uint64_t common_semi_arg(CPUState *cs, int argno) } } =20 -void common_semi_set_ret(CPUState *cs, uint64_t ret) +static void arm_common_semi_set_ret(CPUState *cs, uint64_t ret) { ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; @@ -34,25 +34,36 @@ void common_semi_set_ret(CPUState *cs, uint64_t ret) } } =20 -bool common_semi_sys_exit_is_extended(CPUState *cs) +static bool arm_common_semi_sys_exit_is_extended(CPUState *cs) { return is_a64(cpu_env(cs)); } =20 -bool is_64bit_semihosting(CPUArchState *env) +static bool arm_is_64bit_semihosting(CPUArchState *env) { return is_a64(env); } =20 -uint64_t common_semi_stack_bottom(CPUState *cs) +static uint64_t arm_common_semi_stack_bottom(CPUState *cs) { ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; return is_a64(env) ? env->xregs[31] : env->regs[13]; } =20 -bool common_semi_has_synccache(CPUArchState *env) +static bool arm_common_semi_has_synccache(CPUArchState *env) { /* Ok for A64, invalid for A32/T32 */ return is_a64(env); } + +static const CPUSemihostingOps arm_semihosting_ops =3D { + .arg =3D arm_common_semi_arg, + .set_ret =3D arm_common_semi_set_ret, + .is_64bit =3D arm_is_64bit_semihosting, + .sys_exit_is_extended =3D arm_common_semi_sys_exit_is_extended, + .stack_bottom =3D arm_common_semi_stack_bottom, + .has_synccache =3D arm_common_semi_has_synccache, +}; + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, semihosting, arm_semihosting_ops); diff --git a/target/arm/meson.build b/target/arm/meson.build index 0369f96b4cc..dfcec55bd97 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -44,13 +44,10 @@ arm_stubs_ss.add(files( arm_user_ss.add(files( 'el2-stubs.c', 'cpregs-omap-stub.c', + 'common-semi-target.c', )) -arm_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', - if_true: files('common-semi-target.c')) =20 -arm_common_system_ss.add(files('cpu.c')) -arm_common_system_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', - if_true: files('common-semi-target.c')) +arm_common_system_ss.add(files('cpu.c', 'common-semi-target.c')) arm_common_system_ss.add(files( 'arch_dump.c', 'arm-powerctl.c', diff --git a/target/i386/arch_dump.c b/target/i386/arch_dump.c index 16e47c4747d..c060b2b4ccb 100644 --- a/target/i386/arch_dump.c +++ b/target/i386/arch_dump.c @@ -16,6 +16,7 @@ #include "system/dump.h" #include "elf.h" #include "system/memory_mapping.h" +#include "qemu/target-info-qom.h" =20 #define ELF_NOTE_SIZE(hdr_size, name_size, desc_size) \ ((DIV_ROUND_UP((hdr_size), 4) \ @@ -394,7 +395,7 @@ int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction = f, CPUState *cs, return cpu_write_qemu_note(f, &cpu->env, s, 0); } =20 -int cpu_get_dump_info(ArchDumpInfo *info, +static int x86_get_dump_info(ArchDumpInfo *info, const GuestPhysBlockList *guest_phys_blocks) { bool lma =3D false; @@ -429,7 +430,7 @@ int cpu_get_dump_info(ArchDumpInfo *info, return 0; } =20 -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +static ssize_t x86_get_note_size(int class, int machine, int nr_cpus) { int name_size =3D 5; /* "CORE" or "QEMU" */ size_t elf_note_size =3D 0; @@ -459,3 +460,6 @@ ssize_t cpu_get_note_size(int class, int machine, int n= r_cpus) =20 return (elf_note_size + qemu_note_size) * nr_cpus; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_dump_info, x86_get_dump_info); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_note_size, x86_get_note_size); diff --git a/target/i386/cpu-system.c b/target/i386/cpu-system.c index c8bbf0cbafd..d2babd1ba09 100644 --- a/target/i386/cpu-system.c +++ b/target/i386/cpu-system.c @@ -29,6 +29,7 @@ #include "qapi/qapi-commands-machine.h" =20 #include "cpu-internal.h" +#include "qemu/target-info-qom.h" =20 /* Return a QDict containing keys for all properties that can be included * in static expansion of CPU models. All properties set by x86_cpu_load_m= odel() @@ -188,10 +189,10 @@ out: return xc; } =20 -CpuModelExpansionInfo * -qmp_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *model, - Error **errp) +static CpuModelExpansionInfo * +x86_query_cpu_model_expansion(CpuModelExpansionType type, + CpuModelInfo *model, + Error **errp) { X86CPU *xc =3D NULL; Error *err =3D NULL; @@ -241,6 +242,9 @@ out: return ret; } =20 +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_model_expansion, + x86_query_cpu_model_expansion); + void cpu_clear_apic_feature(CPUX86State *env) { env->features[FEAT_1_EDX] &=3D ~CPUID_APIC; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5805d33ab92..4e31b8a2a60 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -48,6 +48,7 @@ #include "system/address-spaces.h" #include "hw/core/boards.h" #include "hw/i386/sgx-epc.h" +#include "qemu/target-info-qom.h" #endif #include "system/qtest.h" #include "tcg/tcg-cpu.h" @@ -8191,7 +8192,7 @@ static void x86_cpu_definition_entry(gpointer data, g= pointer user_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *x86_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list =3D get_sorted_cpu_model_list(); @@ -8200,6 +8201,9 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Erro= r **errp) return cpu_list; } =20 +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + x86_query_cpu_definitions); + #endif /* !CONFIG_USER_ONLY */ =20 static uint8_t x86_cpu_get_host_avx10_version(void) diff --git a/target/loongarch/arch_dump.c b/target/loongarch/arch_dump.c index 9d84faef969..af4ab5df5b5 100644 --- a/target/loongarch/arch_dump.c +++ b/target/loongarch/arch_dump.c @@ -22,6 +22,7 @@ #include "elf.h" #include "system/dump.h" #include "internals.h" +#include "qemu/target-info-qom.h" =20 /* struct user_pt_regs from arch/loongarch/include/uapi/asm/ptrace.h */ struct loongarch_user_regs { @@ -142,7 +143,7 @@ int loongarch_cpu_write_elf64_note(WriteCoreDumpFunctio= n f, CPUState *cs, return ret; } =20 -int cpu_get_dump_info(ArchDumpInfo *info, +static int loongarch_get_dump_info(ArchDumpInfo *info, const GuestPhysBlockList *guest_phys_blocks) { info->d_machine =3D EM_LOONGARCH; @@ -152,7 +153,7 @@ int cpu_get_dump_info(ArchDumpInfo *info, return 0; } =20 -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +static ssize_t loongarch_get_note_size(int class, int machine, int nr_cpus) { size_t note_size =3D 0; =20 @@ -162,3 +163,6 @@ ssize_t cpu_get_note_size(int class, int machine, int n= r_cpus) =20 return note_size * nr_cpus; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_dump_info, loongarch_get_dump_i= nfo); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_note_size, loongarch_get_note_s= ize); diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loong= arch-qmp-cmds.c index f053f22bb8c..848ad640aee 100644 --- a/target/loongarch/loongarch-qmp-cmds.c +++ b/target/loongarch/loongarch-qmp-cmds.c @@ -14,6 +14,7 @@ #include "qobject/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qom/qom-qobject.h" +#include "qemu/target-info-qom.h" =20 static void loongarch_cpu_add_definition(gpointer data, gpointer user_data) { @@ -28,7 +29,7 @@ static void loongarch_cpu_add_definition(gpointer data, g= pointer user_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *loongarch_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; @@ -45,9 +46,10 @@ static const char *cpu_model_advertised_features[] =3D { "ptw", NULL }; =20 -CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType= type, - CpuModelInfo *model, - Error **errp) +static CpuModelExpansionInfo * +loongarch_query_cpu_model_expansion(CpuModelExpansionType type, + CpuModelInfo *model, + Error **errp) { Visitor *visitor; CpuModelExpansionInfo *expansion_info; @@ -133,3 +135,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(Cp= uModelExpansionType type, =20 return expansion_info; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + loongarch_query_cpu_definitions); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_model_expansion, + loongarch_query_cpu_model_expansion); diff --git a/target/mips/system/mips-qmp-cmds.c b/target/mips/system/mips-q= mp-cmds.c index b6a2874f2dd..ff78487423b 100644 --- a/target/mips/system/mips-qmp-cmds.c +++ b/target/mips/system/mips-qmp-cmds.c @@ -11,15 +11,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" #include "cpu.h" - -CpuModelExpansionInfo * -qmp_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *model, - Error **errp) -{ - error_setg(errp, "CPU model expansion is not supported on this target"= ); - return NULL; -} +#include "qemu/target-info-qom.h" =20 static void mips_cpu_add_definition(gpointer data, gpointer user_data) { @@ -36,7 +28,7 @@ static void mips_cpu_add_definition(gpointer data, gpoint= er user_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *mips_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; @@ -47,3 +39,6 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **= errp) =20 return cpu_list; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + mips_query_cpu_definitions); diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index 80ac6c3e320..07f0c75c45e 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -17,6 +17,7 @@ #include "elf.h" #include "system/dump.h" #include "system/kvm.h" +#include "qemu/target-info-qom.h" =20 #ifdef TARGET_PPC64 #define ELFCLASS ELFCLASS64 @@ -229,7 +230,7 @@ static const struct NoteFuncDescStruct { =20 typedef struct NoteFuncDescStruct NoteFuncDesc; =20 -int cpu_get_dump_info(ArchDumpInfo *info, +static int ppc_get_dump_info(ArchDumpInfo *info, const struct GuestPhysBlockList *guest_phys_blocks) { PowerPCCPU *cpu; @@ -257,7 +258,7 @@ int cpu_get_dump_info(ArchDumpInfo *info, return 0; } =20 -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +static ssize_t ppc_get_note_size(int class, int machine, int nr_cpus) { int name_size =3D 8; /* "CORE" or "QEMU" rounded */ size_t elf_note_size =3D 0; @@ -313,3 +314,6 @@ int ppc32_cpu_write_elf32_note(WriteCoreDumpFunction f,= CPUState *cs, PowerPCCPU *cpu =3D POWERPC_CPU(cs); return ppc_write_all_elf_notes("CORE", f, cpu, cpuid, s); } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_dump_info, ppc_get_dump_info); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_note_size, ppc_get_note_size); diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index 96228919966..70fca0170b1 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -29,15 +29,7 @@ #include "qapi/qapi-commands-machine.h" #include "cpu-models.h" #include "cpu-qom.h" - -CpuModelExpansionInfo * -qmp_query_cpu_model_expansion(CpuModelExpansionType type, - CpuModelInfo *model, - Error **errp) -{ - error_setg(errp, "CPU model expansion is not supported on this target"= ); - return NULL; -} +#include "qemu/target-info-qom.h" =20 static void ppc_cpu_defs_entry(gpointer data, gpointer user_data) { @@ -53,7 +45,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer us= er_data) QAPI_LIST_PREPEND(*first, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *ppc_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list; @@ -82,3 +74,6 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **= errp) =20 return cpu_list; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + ppc_query_cpu_definitions); diff --git a/target/riscv/arch_dump.c b/target/riscv/arch_dump.c index 12b68799070..7e4b584faa0 100644 --- a/target/riscv/arch_dump.c +++ b/target/riscv/arch_dump.c @@ -20,6 +20,7 @@ #include "cpu.h" #include "elf.h" #include "system/dump.h" +#include "qemu/target-info-qom.h" =20 /* struct user_regs_struct from arch/riscv/include/uapi/asm/ptrace.h */ struct riscv64_user_regs { @@ -161,7 +162,7 @@ int riscv_cpu_write_elf32_note(WriteCoreDumpFunction f,= CPUState *cs, return ret; } =20 -int cpu_get_dump_info(ArchDumpInfo *info, +static int riscv_get_dump_info(ArchDumpInfo *info, const GuestPhysBlockList *guest_phys_blocks) { RISCVCPU *cpu; @@ -187,7 +188,7 @@ int cpu_get_dump_info(ArchDumpInfo *info, return 0; } =20 -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +static ssize_t riscv_get_note_size(int class, int machine, int nr_cpus) { size_t note_size; =20 @@ -199,3 +200,6 @@ ssize_t cpu_get_note_size(int class, int machine, int n= r_cpus) =20 return note_size * nr_cpus; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_dump_info, riscv_get_dump_info); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_note_size, riscv_get_note_size); diff --git a/target/riscv/common-semi-target.c b/target/riscv/common-semi-t= arget.c index aeaeb88d536..aed9dfc5b68 100644 --- a/target/riscv/common-semi-target.c +++ b/target/riscv/common-semi-target.c @@ -12,38 +12,49 @@ #include "cpu.h" #include "semihosting/common-semi.h" =20 -uint64_t common_semi_arg(CPUState *cs, int argno) +static uint64_t riscv_common_semi_arg(CPUState *cs, int argno) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; return env->gpr[xA0 + argno]; } =20 -void common_semi_set_ret(CPUState *cs, uint64_t ret) +static void riscv_common_semi_set_ret(CPUState *cs, uint64_t ret) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; env->gpr[xA0] =3D ret; } =20 -bool is_64bit_semihosting(CPUArchState *env) +static bool riscv_is_64bit_semihosting(CPUArchState *env) { return riscv_cpu_mxl(env) !=3D MXL_RV32; } =20 -bool common_semi_sys_exit_is_extended(CPUState *cs) +static bool riscv_common_semi_sys_exit_is_extended(CPUState *cs) { - return is_64bit_semihosting(cpu_env(cs)); + return riscv_is_64bit_semihosting(cpu_env(cs)); } =20 -uint64_t common_semi_stack_bottom(CPUState *cs) +static uint64_t riscv_common_semi_stack_bottom(CPUState *cs) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; return env->gpr[xSP]; } =20 -bool common_semi_has_synccache(CPUArchState *env) +static bool riscv_common_semi_has_synccache(CPUArchState *env) { return true; } + +static const CPUSemihostingOps riscv_semihosting_ops =3D { + .arg =3D riscv_common_semi_arg, + .set_ret =3D riscv_common_semi_set_ret, + .is_64bit =3D riscv_is_64bit_semihosting, + .sys_exit_is_extended =3D riscv_common_semi_sys_exit_is_extended, + .stack_bottom =3D riscv_common_semi_stack_bottom, + .has_synccache =3D riscv_common_semi_has_synccache, +}; + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, semihosting, riscv_semihosting_ops); diff --git a/target/riscv/meson.build b/target/riscv/meson.build index 42d0f6d538a..5adb6d1c9e7 100644 --- a/target/riscv/meson.build +++ b/target/riscv/meson.build @@ -11,12 +11,10 @@ gen =3D [ riscv_ss =3D ss.source_set() riscv_ss.add(gen) =20 -riscv_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', - if_true: files('common-semi-target.c')) - riscv_ss.add(files( 'cpu.c', 'gdbstub.c', + 'common-semi-target.c', )) =20 riscv_system_ss =3D ss.source_set() diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index 2647deef916..248e6a0eaf0 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -36,6 +36,7 @@ #include "cpu-qom.h" #include "cpu.h" #include "target/riscv/tcg/csr.h" +#include "qemu/target-info-qom.h" =20 static void riscv_cpu_add_definition(gpointer data, gpointer user_data) { @@ -54,7 +55,7 @@ static void riscv_cpu_add_definition(gpointer data, gpoin= ter user_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *riscv_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; GSList *list =3D object_class_get_list(TYPE_RISCV_CPU, false); @@ -154,9 +155,10 @@ err: visit_free(visitor); } =20 -CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType= type, - CpuModelInfo *model, - Error **errp) +static CpuModelExpansionInfo * +riscv_query_cpu_model_expansion(CpuModelExpansionType type, + CpuModelInfo *model, + Error **errp) { CpuModelExpansionInfo *expansion_info; QDict *qdict_out; @@ -225,3 +227,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(Cp= uModelExpansionType type, =20 return expansion_info; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + riscv_query_cpu_definitions); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_model_expansion, + riscv_query_cpu_model_expansion); diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c index 2c26e992959..c0334baa72f 100644 --- a/target/s390x/arch_dump.c +++ b/target/s390x/arch_dump.c @@ -18,6 +18,7 @@ #include "elf.h" #include "system/dump.h" #include "kvm/kvm_s390x.h" +#include "qemu/target-info-qom.h" #include "target/s390x/kvm/pv.h" =20 struct S390xUserRegsStruct { @@ -449,7 +450,7 @@ static void arch_cleanup(DumpState *s) } } =20 -int cpu_get_dump_info(ArchDumpInfo *info, +static int s390_get_dump_info(ArchDumpInfo *info, const struct GuestPhysBlockList *guest_phys_blocks) { info->d_machine =3D EM_S390; @@ -469,7 +470,7 @@ int cpu_get_dump_info(ArchDumpInfo *info, return 0; } =20 -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +static ssize_t s390_get_note_size(int class, int machine, int nr_cpus) { int name_size =3D 8; /* "LINUX" or "CORE" + pad */ size_t elf_note_size =3D 0; @@ -495,3 +496,6 @@ ssize_t cpu_get_note_size(int class, int machine, int n= r_cpus) =20 return (elf_note_size) * nr_cpus; } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_dump_info, s390_get_dump_info); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, get_note_size, s390_get_note_size); diff --git a/target/s390x/cpu_models_system.c b/target/s390x/cpu_models_sys= tem.c index 5b846048675..5470bf55e20 100644 --- a/target/s390x/cpu_models_system.c +++ b/target/s390x/cpu_models_system.c @@ -20,6 +20,7 @@ #include "qapi/qobject-input-visitor.h" #include "qobject/qdict.h" #include "qapi/qapi-commands-machine.h" +#include "qemu/target-info-qom.h" =20 static void list_add_feat(const char *name, void *opaque); =20 @@ -82,7 +83,7 @@ static void create_cpu_model_list(ObjectClass *klass, voi= d *opaque) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +static CpuDefinitionInfoList *s390_query_cpu_definitions(Error **errp) { struct CpuDefinitionInfoListData list_data =3D { .list =3D NULL, @@ -208,9 +209,10 @@ static void cpu_info_from_model(CpuModelInfo *info, co= nst S390CPUModel *model, } } =20 -CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType= type, - CpuModelInfo *model, - Error **errp) +static CpuModelExpansionInfo * +s390_query_cpu_model_expansion(CpuModelExpansionType type, + CpuModelInfo *model, + Error **errp) { Error *err =3D NULL; CpuModelExpansionInfo *expansion_info =3D NULL; @@ -434,3 +436,8 @@ void apply_cpu_model(const S390CPUModel *model, Error *= *errp) applied_model =3D *model; } } + +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_definitions, + s390_query_cpu_definitions); +TARGET_INFO_CPU_OP(CPU_RESOLVING_TYPE, query_cpu_model_expansion, + s390_query_cpu_model_expansion); --=20 2.52.0.windows.1 From nobody Thu Sep 10 13:25:51 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1787769921; cv=none; d=zohomail.com; s=zohoarc; b=WWw5afNOM6Pv5Yc0m+gA2VfqykxnZbuqBtPNFFbJNOPoERV+5BOQT9668ZzHktueal4gZDMgGVaHVEhJz3c1w876YWAkIL13fqVOE2slXCSrWprk9FeHtQ1jgmlJMxUPxto77rCefVi2bZ8hmsToi/Eigh4zQEetxiUMsR+dERs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787769921; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SlgR5G4e0qMheZ9Whg473zPM26cmao6BYvDobt8PbCE=; b=NoL0lwZM9HkNR62++YSE8v2qfRhw9t6nqubtP8D8XF4zWdxPrF4BexW8qSDvapMY4cxvP6pchvbJO6/nx/8/ykxFyLDdZ6ttz5urI6g9kbuXMF3L5hCwZnJ0y2fbrTS+6SFUP2fnHwlZm3Iv8B7TBR65Ncuy21OiWAIkHhad1rA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787769921736621.5567537290705; Wed, 26 Aug 2026 11:45:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wzIc6-0004HR-47; Wed, 26 Aug 2026 14:44:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wzIc4-0004FL-Vu for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:41 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wzIc2-0002mq-Rl for qemu-devel@nongnu.org; Wed, 26 Aug 2026 14:44:40 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-cc149372c14so1015463a12.1 for ; Wed, 26 Aug 2026 11:44:38 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id 5a478bee46e88-3283d60c291sm17681846eec.6.2026.08.26.11.44.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 11:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787769877; x=1788374677; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SlgR5G4e0qMheZ9Whg473zPM26cmao6BYvDobt8PbCE=; b=f789p3dcP5eGN38Auwc/ut6b2IhYQ3N+Jog8exoFFsL3AfolTXtUZeiEZD/a82jcKi ZJCVLFImhrBMYVMyQEBXIel1FksT2Dcg5JS5mjxxCTGqHnkZec54Mcfg4zvJ5nv4fY2L tLPy36t8vQAb+RIpqYyak8lkxqF/oyHMLa08zfxHs87N1/WjgZXQU+zE13Zz6S9aoxuV HJJYmIElgjDuOZRPKSfDH7rPScNyhdDfbhZ0/p+Xr0WRU6qmaVP12UEMVnlO0n0bBW1R DPKGDenDwMbA/FTRh6t7LYDL9dyTN/mJwG6qLMvYCiLg0RlpcmD9geVbGRW8sNtZ1b0K THbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787769877; x=1788374677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SlgR5G4e0qMheZ9Whg473zPM26cmao6BYvDobt8PbCE=; b=oXiLS+YHQ9GYRYN/HBlCfl6DcNN9lDxjsbGa5CvX/FsQGu9i4N3Il+OEwfJ6nOHa6r shzPcbZp3yffVLd5/vq8D1fPgNWAQBdoXE2t1937AtzuTILIO4HyzF+ObJtz/A2sh7Gf PYExYy7jWqrjnNPdwhiJUUlp8O1piJDngYATM9DPGE0TTRvXTs1o11LZEH6xnWfLCHlV 3TmFcyCO0ObC+qCezxygIdb2KZlNo8M+81k22JAnBq4h2MB2TBv3jiVe29xvAa6b9dam oe/zv2fuoNWrVuK/8WtybNQqnHVYSOCLPu8ZNopafDW/Q6q/8+nCpCGcszq1DTZHyKwD CVnw== X-Gm-Message-State: AFuF++mytMj9JhgeXqtzzIB416qaAssUUwZtgVl+K3dOH3jn1Calc0UN wMW2Y/B5Zacqp/w3af2D3cPSekOOvdeUAPk2sp0kskIKzq2TtrlkjqOP4vs7WRJF2dg= X-Gm-Gg: AR+sD10lZctvu+YcnxalKt+IQapWwihwfbMaIkzWkHfmBc1b0odlervmIj9JenGhXqD IqTS8dpwW2ml3fu0u1WK1HBaeJ9d4gFxxm+08egNnpiQte2lNRbKzwpSDl+ugmFPpqb3zv2Bl9l RNPTyUG5Us6FcEfrDI0Zr+KcP2CjUHJScWlOBv6/y5SISEpmUVpVXjwy/b7+18jLOBvgBNLMWZM 6mMSd4sPdJFEzRqlbl2iPisLyu1I2G+el88rp9PGkZAs9M0qN4ArSYEkkeCWlw3dqE54RSmDKZD bb+Oe6h3MPRjjXxriB22Cb8q7ZZQQCsHVnq1v/kBZmd/SMwaq6ADiZfSW8j+nS011sF+sOA0u9Q BJEbs+IPC7zgo0oIMfPtd7Z5GqssCjbDVG5TNCgTff70m8enfWjNZhpMRUjjTC1J7qngkCxQ3dJ HFb+726GpSxUojCtICz2VSSBEC4D6S1r/6IDUlWtQ44xB9d1+zs5aTJsam+hEzkWw8By3DHutqh 5JyhoUzLiBTQ4I6ilX79w== X-Received: by 2002:a05:6a21:390:b0:3cc:b26a:7686 with SMTP id adf61e73a8af0-3cf7628564bmr19886931637.6.1787769877472; Wed, 26 Aug 2026 11:44:37 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , Aurelien Jarno , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, "Michael S. Tsirkin" , Jiaxun Yang , qemu-ppc@nongnu.org, Xianglai Li , David Hildenbrand , Richard Henderson , Palmer Dabbelt , Aleksandar Rikalo , Harsh Prateek Bora , Bibo Mao , Weiwei Li , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Matthew Rosato , Chinmay Rath , Alistair Francis , Alexander Bulekov , Chao Liu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Glenn Miles , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Laurent Vivier , Cornelia Huck , Zhao Liu , Eric Farman , qemu-s390x@nongnu.org, Paolo Bonzini , Stefan Hajnoczi , qemu-arm@nongnu.org, Ilya Leoshkevich , Darren Kenny , Sunil V L , Daniel Henrique Barboza , Ani Sinha , Nicholas Piggin , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Liu Zhiwei , Igor Mammedov Subject: [PATCH v2 13/13] meson: build single binary Date: Thu, 27 Aug 2026 02:42:27 +0800 Message-ID: <20260826184229.1145-14-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260826184229.1145-1-luoyonggang@gmail.com> References: <20260826184229.1145-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x532.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1787769923166158500 Content-Type: text/plain; charset="utf-8" - Add -Dsingle_binary / --enable-single-binary (default true) and --disable-single-binary to gate the combined qemu-system binary. - Map each base arch to a primary softmmu target (arm -> aarch64-softmmu, riscv -> riscv64-softmmu) that supplies arch_srcs. Sibling targets contribute target-info-def.c only. - Apply common_ss and system_ss once against the union of those base-arch configs so constructors and Kconfig stubs are not duplicated. - Build qemu-system only, including on Windows. Do not add qemu-systemw: a GUI twin would keep QEMU exporting data from the .exe into DLLs, and those data exports cannot be delay-loaded (qdev_prop_array and other qdev_prop_*). That would block enabling modules globally on Windows. Signed-off-by: Pierrick Bouvier Signed-off-by: Yonggang Luo --- meson.build | 69 +++++++++++++++++++++++++++++++++-- meson_options.txt | 2 + scripts/meson-buildoptions.sh | 3 ++ 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 449d50f2983..eea54fd0ba3 100644 --- a/meson.build +++ b/meson.build @@ -4249,6 +4249,18 @@ if host_os =3D=3D 'darwin' endif =20 traceable =3D [] +single_binary_arch_objects =3D [] +single_binary_bases_config =3D {} +single_binary_deps =3D [] +single_binary_crates =3D [] +# base arch -> softmmu target that supplies arch_srcs +single_binary_primary =3D { + 'arm': 'aarch64-softmmu', + 'riscv': 'riscv64-softmmu', +} +if not get_option('single_binary') + single_binary_primary =3D {} +endif emulators =3D {} foreach target : target_dirs config_target =3D config_target_mak[target] @@ -4321,8 +4333,6 @@ foreach target : target_dirs endif endif =20 - arch_srcs +=3D files('target-info-def.c') - if target_base_arch in target_arch t =3D target_arch[target_base_arch].apply(config_target, strict: false) arch_srcs +=3D t.sources() @@ -4391,8 +4401,9 @@ foreach target : target_dirs lib_deps +=3D dep.partial_dependency(compile_args: true, includes: tru= e) endforeach =20 + target_info_src =3D files('target-info-def.c') lib =3D static_library('qemu-' + target, - sources: arch_srcs + genh, + sources: target_info_src + arch_srcs + genh, dependencies: lib_deps, objects: objects, include_directories: target_inc, @@ -4400,6 +4411,16 @@ foreach target : target_dirs build_by_default: false) =20 if target.endswith('-softmmu') + if target_base_arch in single_binary_primary + single_binary_bases_config +=3D config_target + single_binary_arch_objects +=3D lib.extract_objects(target_info_src) + if target =3D=3D single_binary_primary[target_base_arch] + single_binary_arch_objects +=3D lib.extract_objects(arch_srcs) + single_binary_deps +=3D arch_deps + single_binary_deps +=3D target_stubs + single_binary_crates +=3D main_rs + endif + endif execs =3D [{ 'name': 'qemu-system-' + target_name, 'win_subsystem': 'console', @@ -4481,6 +4502,47 @@ foreach target : target_dirs endforeach endforeach =20 +if single_binary_arch_objects.length() !=3D 0 + single_binary_objects =3D [] + foreach spec: [[common_ss, common_all], [system_ss, libsystem]] + src =3D spec[0].apply(single_binary_bases_config, strict: false) + single_binary_objects +=3D spec[1].extract_objects(src.sources()) + single_binary_deps +=3D src.dependencies() + endforeach + foreach base, tgt: single_binary_primary + if base in target_common_arch_libs + src =3D target_common_arch[base].apply(single_binary_bases_config, + strict: false) + single_binary_objects +=3D target_common_arch_libs[base].extract_obj= ects( + src.sources()) + single_binary_deps +=3D src.dependencies() + endif + if base in target_common_system_arch_libs + src =3D target_common_system_arch[base].apply(single_binary_bases_co= nfig, + strict: false) + single_binary_objects +=3D target_common_system_arch_libs[base].extr= act_objects( + src.sources()) + single_binary_deps +=3D src.dependencies() + endif + endforeach + single_binary_objects +=3D single_binary_arch_objects + + single_binary_link_args =3D emulator_link_args + single_binary_link_args +=3D enable_modules ? ['@block.syms', '@qemu.sym= s'] : [] + emulator =3D executable('qemu-system', + sources: [single_binary_crates, files('system/main.c')], + dependencies: single_binary_deps + [sdl], + objects: single_binary_objects, + link_depends: [block_syms, qemu_syms], + link_args: single_binary_link_args, + install: true) + emulators +=3D {'qemu-system': emulator} + traceable +=3D [{ + 'exe': 'qemu-system', + 'probe-prefix': 'qemu.system.multi', + }] +endif + # Other build targets =20 if get_option('plugins') @@ -4833,6 +4895,7 @@ if config_all_accel.has_key('CONFIG_TCG') endif endif summary_info +=3D {'target list': ' '.join(target_dirs)} +summary_info +=3D {'single binary': get_option('single_binary')} if have_system summary_info +=3D {'default devices': get_option('default_devices')} summary_info +=3D {'out of process emulation': multiprocess_allowed} diff --git a/meson_options.txt b/meson_options.txt index a07cb47d35e..9d86a46fba7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -91,6 +91,8 @@ option('tcg', type: 'feature', value: 'enabled', description: 'TCG support') option('plugins', type: 'boolean', value: false, description: 'TCG plugins via shared library loading') +option('single_binary', type: 'boolean', value: true, + description: 'combined qemu-system binary') option('debug_tcg', type: 'boolean', value: false, description: 'TCG debugging') option('debug_remap', type: 'boolean', value: false, diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index c003985047c..d8e49111ac7 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -19,6 +19,7 @@ meson_options_help() { printf "%s\n" ' --disable-install-blobs install provided firmware blob= s' printf "%s\n" ' --disable-qom-cast-debug cast debugging support' printf "%s\n" ' --disable-relocatable toggle relocatable install' + printf "%s\n" ' --disable-single-binary combined qemu-system binary' printf "%s\n" ' --docdir=3DVALUE Base directory for documenta= tion installation' printf "%s\n" ' (can be empty) [share/doc]' printf "%s\n" ' --enable-asan enable address sanitizer' @@ -486,6 +487,8 @@ _meson_option_parse() { --disable-seccomp) printf "%s" -Dseccomp=3Ddisabled ;; --enable-selinux) printf "%s" -Dselinux=3Denabled ;; --disable-selinux) printf "%s" -Dselinux=3Ddisabled ;; + --enable-single-binary) printf "%s" -Dsingle_binary=3Dtrue ;; + --disable-single-binary) printf "%s" -Dsingle_binary=3Dfalse ;; --enable-slirp) printf "%s" -Dslirp=3Denabled ;; --disable-slirp) printf "%s" -Dslirp=3Ddisabled ;; --enable-slirp-smbd) printf "%s" -Dslirp_smbd=3Denabled ;; --=20 2.52.0.windows.1