From patchwork Wed May 1 18:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 13651067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 120EEC25B4F for ; Wed, 1 May 2024 18:33:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2Ej3-0001P4-C0; Wed, 01 May 2024 14:30:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Eig-0000wv-GM for qemu-devel@nongnu.org; Wed, 01 May 2024 14:30:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Eic-0003hC-Ik for qemu-devel@nongnu.org; Wed, 01 May 2024 14:30:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714588213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ke0YNYbnoXN8Yjpeec2ghn7fsjIWg8CqwiI8sUJouLY=; b=NFSi+ySgFngx/OKVzgHIR8yodWdJMU4ksUcUW4wR/ORj/hFHndVcXYEvNrI7cmXkR3IMtG O6eV4q7nXz3T0W7jqZe0O821nkVUtHMX0/sfPurg7sKJrS+ezw85BB2XzLCfCjto1Tlz/v VA30ZQ8Sf4WjsMQwl0ESfPSydYFl25s= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-Ewdeei-uOr6t6kUQ2jwBjw-1; Wed, 01 May 2024 14:30:03 -0400 X-MC-Unique: Ewdeei-uOr6t6kUQ2jwBjw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F7543C0274D; Wed, 1 May 2024 18:30:00 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 176846958; Wed, 1 May 2024 18:29:50 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Peter Maydell , Nicholas Piggin , Richard Henderson , Yanan Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Halil Pasic , Laurent Vivier , qemu-arm@nongnu.org, Daniel Henrique Barboza , Eduardo Habkost , qemu-ppc@nongnu.org, David Gibson , Ilya Leoshkevich , Eric Farman , Christian Borntraeger , "Michael S. Tsirkin" , Paolo Bonzini , Marcel Apfelbaum , David Hildenbrand , qemu-s390x@nongnu.org, =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= Subject: [PATCH 11/14] hw: skip registration of outdated versioned machine types Date: Wed, 1 May 2024 19:27:56 +0100 Message-ID: <20240501182759.2934195-12-berrange@redhat.com> In-Reply-To: <20240501182759.2934195-1-berrange@redhat.com> References: <20240501182759.2934195-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.897, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This calls the MACHINE_VER_DELETION() macro in the machine type registration method, so that when a versioned machine type reaches the end of its life, it is no longer registered with QOM and thus cannot be used. The actual definition of the machine type should be deleted at this point, but experience shows that can easily be forgotten. By skipping registration the manual code deletion task can be done at any later date. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth --- hw/arm/virt.c | 1 + hw/m68k/virt.c | 1 + hw/ppc/spapr.c | 1 + hw/s390x/s390-virtio-ccw.c | 1 + include/hw/i386/pc.h | 1 + 5 files changed, 5 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e2e10523a3..0786f82da6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -123,6 +123,7 @@ static void arm_virt_compat_set(MachineClass *mc) }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \ + MACHINE_VER_DELETION(__VA_ARGS__); \ type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ } \ type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 37bb36b385..cda199af8f 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -356,6 +356,7 @@ type_init(virt_machine_register_types) }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \ + MACHINE_VER_DELETION(__VA_ARGS__); \ type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ } \ type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7f5412f2ed..2aad99a2f2 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4808,6 +4808,7 @@ static void spapr_machine_latest_class_options(MachineClass *mc) }; \ static void MACHINE_VER_SYM(register, spapr, __VA_ARGS__)(void) \ { \ + MACHINE_VER_DELETION(__VA_ARGS__); \ type_register(&MACHINE_VER_SYM(info, spapr, __VA_ARGS__)); \ } \ type_init(MACHINE_VER_SYM(register, spapr, __VA_ARGS__)) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 289a687434..723021f644 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -862,6 +862,7 @@ bool css_migration_enabled(void) }; \ static void MACHINE_VER_SYM(register, ccw, __VA_ARGS__)(void) \ { \ + MACHINE_VER_DELETION(__VA_ARGS__); \ type_register_static(&MACHINE_VER_SYM(info, ccw, __VA_ARGS__)); \ } \ type_init(MACHINE_VER_SYM(register, ccw, __VA_ARGS__)) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index acc17c7dac..a605f223d5 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -337,6 +337,7 @@ extern const size_t pc_compat_2_0_len; }; \ static void MACHINE_VER_SYM(register, namesym, __VA_ARGS__)(void) \ { \ + MACHINE_VER_DELETION(__VA_ARGS__); \ type_register(&MACHINE_VER_SYM(info, namesym, __VA_ARGS__)); \ } \ type_init(MACHINE_VER_SYM(register, namesym, __VA_ARGS__));