From patchwork Tue Mar 25 15:40:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 876009 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp2725229wrb; Tue, 25 Mar 2025 08:41:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXaRkdK/bQ1RoEM8yGLGDZeeZ/SwYBLkqwiWjna4BoXHXkR3trQM9cX7ZMBehJFmoKp9raVmg==@linaro.org X-Google-Smtp-Source: AGHT+IHaP1fI6AmVZzbCo4XrNG7nBx1yn4HbdrmPpJ4eaFeWH5BTxfRz5YROjtMx+e2rZmy3ylzM X-Received: by 2002:a05:622a:2489:b0:476:af54:5038 with SMTP id d75a77b69052e-4771ddaafa7mr247355471cf.22.1742917316138; Tue, 25 Mar 2025 08:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742917316; cv=none; d=google.com; s=arc-20240605; b=S1z7Teg3SeBLarrdobRxSBqquC/TB5grTfCcSsWntxMqlQBp1q8WVp0PXKmjwwwGwL adK6HZUut3UI9V3lyt0UYXdrSUPE0ZWBS8gqFJuv0sd/1bREziCWKZf70AOxPjRTelhb APrUUDi7x5xl0oUa29YgAJawcI9nz4tdJzuCD4yBwMxdTf8kEqCsDIj9RrC9nn3Z2bxG HUYyuCDcgVN6xbfTI/tKLNOZ5Lb2PnRmzpK6OeJS2ZeiVSBuH6uP23EQjJ8popL2XrwB DQkv9WKRypxMGcCiY9Cv12QWqdYqbKl/Cbt0MLhWJqXjpOxHGA6Wj6LJhJzDhnu+oSIt NtjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B9EcvePMMiziHxvQ+1Uv0hWd3cavq64til709QLPVTs=; fh=K2SYTwc7Og3VuqX/TveJuCvsY6BHxWLBhQWLYUw+e9A=; b=kuKSuDqmNnUCk3dHx5aAwSqcgt+KbUKbFEnPfuAf8hLKPIQXuMP+jhAdQ8XB0GTCQr aYocB5v2p7vvTpv5AKny5EwqZVpwBvEaMjwRj/l+1QhemH+lCcGslv1Yx/Sp9/5x/hbn hW+878sPUPNxuDNkD2Y8+cAYRu1rcm2RASUMAq55ilJbIA5pAWMXv46jv4YUiEiavX5M yVA2/1cOqH2VYWoycZ+kOaW5/VQ2/EbsaIw56FTdVEBqQ8T92nrVOb7qdOjog7oqa+hD If6/0OYQMW7oc8z/i2xctpbljz2+QEOTHhvTyRFmjQyFmsu3+FdO5kmBJX5W+nsaw/BC FnZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gt4d5Zxd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4771d17ef29si95458081cf.172.2025.03.25.08.41.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Mar 2025 08:41:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gt4d5Zxd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tx6P0-0003oe-PT; Tue, 25 Mar 2025 11:41:19 -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 1tx6Oy-0003o2-4x for qemu-devel@nongnu.org; Tue, 25 Mar 2025 11:41:16 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tx6Ou-00046l-FL for qemu-devel@nongnu.org; Tue, 25 Mar 2025 11:41:15 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43cfba466b2so53877155e9.3 for ; Tue, 25 Mar 2025 08:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742917270; x=1743522070; 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; bh=B9EcvePMMiziHxvQ+1Uv0hWd3cavq64til709QLPVTs=; b=Gt4d5ZxdsOyWr5a01vlFwq9CFfwHxjTGoDXCLshNR2/whoLCc4pKLLOUs+zrDl1Aa2 AkbyLhd305lpxVoyeYazb9C0I2SNUnuh0zmIvii/kVNkbhGiRx/tCCcBWP6yPNfkJAuW 4zc/cmi9tXnMBRRIMxMQnusX0xo1NbyIaX+8B19GrPgU7kDIi7MqnLmBB+R4ToHaDmn9 6jrIHWlsyf0sr8OCWv/kXcxIzY9l3lx5NGacS8JD8LnmBFzGmqV3fKelOAwzw4ssaza1 267RMHMht7sgQIlKKBx3E8pxM1Zlo1xpCYXuGCXnb5Fp4eKfQcqFJIM6ozvrgHUqHFRx qEDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742917270; x=1743522070; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B9EcvePMMiziHxvQ+1Uv0hWd3cavq64til709QLPVTs=; b=ne+AKGyjAktMHpK+dPfOL9GtI9nrZ0RPW1TmmM3MYE71pvRzLqdbO+J88Blm/6x1wa LEdbkMTIlH1ffT71jbeHqNiRlpMa0aFxF4S9KDApAjSjpimmeU71ljSQBUTAJdT5XoEq vOOEd/s3nuy5ESIizYsdF9HGmYy8abDECobbzRcsvo/s2mSAG054Ne6w98XzBq4o1l4m 9ro9cbg2be95F9128Udk3MayVQTV5JPYOXlHZT8tSreUNSW0k79o1PxE+wsyQd2hqNI5 psYRX2MEcnju7r6keSv7el8U0Xsa2C90aIfEaugMaV4zzmJOS30tdlv3hAPxw8hrWD9R HnPA== X-Gm-Message-State: AOJu0YyUIccSL1zl0ZAnidbJVM4eKgTexz9tRghJDerjdb8dxn0cj5Fr TOCqQhI95+Qmlh1CGRropwXmd9HUIcvc74sMOOzs0XHBsl1CMiOTpjqmMXy5r5E66E4PXuIL5MK 8 X-Gm-Gg: ASbGncvUB/a+y/tnDyYah6msT52NCnGaLkMDDl7vqV3lXSxE3i3nY2CVXOoxxsCY5Um wOjasAhJ6WbJ3SCZjT8/5eN2yIrjkIoE1FXEgQdE58HKLEEo6R0Kp170CxkTN+2m57ZrZhseSWq ig9XYVH2lJoKxO0hoBZDPKOSAgj0Njk8DJFVaUU6lgb3c6CQluHGM/P+D8sbLj3PNGz4GqOA2Gu sDruj/514l/kZtfEtdoPJr5eTQpzdUrI0kfR/MEE1yZ/OCPaEoZdz5j2wlR9vbEPdW4R8i1dDIh tqyzuHQ0/y/DhS4AtunK15dbBOBsnhH0BfV7jUM84MQiyqXU9EY3v4uz2QuanzGTgWNEkvW2QKS VqV4JIDq1eO0cd+dXQ9g= X-Received: by 2002:a05:6000:4188:b0:391:487f:27e7 with SMTP id ffacd0b85a97d-3997f947b9dmr11810016f8f.55.1742917270166; Tue, 25 Mar 2025 08:41:10 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9955c0sm13861946f8f.3.2025.03.25.08.41.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 25 Mar 2025 08:41:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Pierrick Bouvier , Zhao Liu , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , Jiaxun Yang , Aurelien Jarno , Aleksandar Rikalo , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , Richard Henderson Subject: [PATCH-for-10.1 2/8] target/mips: Declare CPU QOM types using DEFINE_TYPES() macro Date: Tue, 25 Mar 2025 16:40:52 +0100 Message-ID: <20250325154058.92735-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250325154058.92735-1-philmd@linaro.org> References: <20250325154058.92735-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- target/mips/cpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index b207106dd79..097554fd8ae 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -597,17 +597,21 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) #endif /* CONFIG_TCG */ } -static const TypeInfo mips_cpu_type_info = { - .name = TYPE_MIPS_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(MIPSCPU), - .instance_align = __alignof(MIPSCPU), - .instance_init = mips_cpu_initfn, - .abstract = true, - .class_size = sizeof(MIPSCPUClass), - .class_init = mips_cpu_class_init, +static const TypeInfo mips_cpu_types[] = { + { + .name = TYPE_MIPS_CPU, + .parent = TYPE_CPU, + .instance_size = sizeof(MIPSCPU), + .instance_align = __alignof(MIPSCPU), + .instance_init = mips_cpu_initfn, + .abstract = true, + .class_size = sizeof(MIPSCPUClass), + .class_init = mips_cpu_class_init, + } }; +DEFINE_TYPES(mips_cpu_types) + static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data) { MIPSCPUClass *mcc = MIPS_CPU_CLASS(oc); @@ -632,7 +636,6 @@ static void mips_cpu_register_types(void) { int i; - type_register_static(&mips_cpu_type_info); for (i = 0; i < mips_defs_number; i++) { mips_register_cpudef_type(&mips_defs[i]); }