From patchwork Tue Oct 10 09:28:57 2023 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: 731446 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1641854wrw; Tue, 10 Oct 2023 02:33:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7XNpQRpRhMG9F7WlTBghuQ2qe4U5NoSRoig53s3ufGxCDhQpMHaAS1D2OuqMxG0jJMvI1 X-Received: by 2002:a37:ac01:0:b0:774:1641:d60f with SMTP id e1-20020a37ac01000000b007741641d60fmr18915515qkm.41.1696930431946; Tue, 10 Oct 2023 02:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696930431; cv=none; d=google.com; s=arc-20160816; b=ypZ78hTYuXOPnHh0S3DeWXew3B9ZZLi21KLhTREvoPcVuOqMlR8uA0CpEq1th1a5Nf IeA7JM92jeY2NGrUX/WF8AMB8PHTAKP/6iDMKGJjVjCS8Vt0emcORbP2D1lSApmjmoAv NFs3fOUluO/whjyVCw5SVIdYIxbn9RrW8rCvvZDSN3ojUdrMN43I+dMuKVqB3bUYX8a+ LiRF6XpFIxGu1rFKNqSmNqcOcLKMftjliDnCEZzKsp3R5Hj23w9rDUxG/kGwftqicbYm KkyAbJhbFqKYEZNgm0i28EhKqXuuzp0pgtFMGoAKxzhdLU2m8ENxNx3eZL2l2pP1lE2K aU/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=7WiHkuSW70dwreiTW00ZFUbfeyH/7vFgJnStNjqec/s=; fh=iupQBrmerAoZOw8v6swRnyYBx+6KhbF7AbBF1Jawaz4=; b=ddPx0NbMomhIKOu9K/1mp66PN2uF/D14x4YnnPobGIt/XtgVOOL3IwYcYdiDM30cum mHFBnVrdTrbM9fyDNRl8mg7yhuI0l+xo19N8bL1HwR2q5s8EPibPQE0eDX8sq9JlGnAL 3OegMF0IEfmlCVwWkeME74Hb8q92tyHHan0dvK1zq5tKaGHYDYxJjiX1FgDCavKAFK21 h8UTh5XcepClkVoeCb/q1DqP9d3jE8W91uz8Ac7RarHlRmVXT5nEqOMBvOSAs69BQmTK jwLk5Nh+QNWHQ7NVgve7SHuJSnSPUR9nHVmBYPtwMCNgNY+9EIII6HOMaWuDVmAGTbiM YSnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qr7H9Mw2; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m13-20020a05620a214d00b007758f54999bsi7078511qkm.626.2023.10.10.02.33.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2023 02:33:51 -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=Qr7H9Mw2; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qq95d-0003zA-MR; Tue, 10 Oct 2023 05:31:45 -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 1qq95B-0001gg-6R for qemu-devel@nongnu.org; Tue, 10 Oct 2023 05:31:17 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qq958-0008OR-CQ for qemu-devel@nongnu.org; Tue, 10 Oct 2023 05:31:15 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-53b32dca0bfso8277354a12.0 for ; Tue, 10 Oct 2023 02:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696930269; x=1697535069; 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=7WiHkuSW70dwreiTW00ZFUbfeyH/7vFgJnStNjqec/s=; b=Qr7H9Mw2UayX2EDnksa4AT4/hbEJVgjpTtAsgFWkCcpEh93+GaNp8FLpGYdq8Vcnwf 9Dy99nguGqzXGl/I3Zz5bjjJb6+iS2J0th5aFpWT2h45KveVaGJzMoPoSgz1iiXmkA6j DmR79nNwex5LM+5LkqBujWwduAUUHDy39YAj1vKWrBo1y+qPWqqIhfwHkxPiRfAWdOEx nYnhFxgxrB6VVSYuOFO1Dt8nQhoSAhNPax/PKzmjPMIxLZZLYMjJsmiV3SJKoAWxX8TF shLaFQ758toImPWBqIlJPkExajWgi8R4MbUZpwsq9QOOkQdT92jy3lUppI/upNwyy8A5 mSPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696930269; x=1697535069; 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=7WiHkuSW70dwreiTW00ZFUbfeyH/7vFgJnStNjqec/s=; b=AsdcQoZDKjqajBfKhddPxnC32a1d8VPRFZlkZaAAk5hGjmS4jRsp0WnAUUcwdA0945 P0cepowGcimhUcq6PPz6/k7IrWOZyeDfCJG3n8mwf25QVV2RVdI2GfPvnR7vHxd4vlDd DangnW/h9vLIhM0fHZ7PVa2ceZIs54j9AvmJky5pX+8QN0GWK8ZhxQXUybepbiG9H1C+ iPaPpLeG3e7O98bjQUawU6HhyS0ErXPysKbi0Ej6raTAAwJGWnnRTfQL50mKY+FmXqJ6 a7mVAT75fWPY4UNBsd6lIT8v3CiiUl4zMVid3qLCItHptzSJjor1wJM0lDZyrcprrMw5 adEA== X-Gm-Message-State: AOJu0YzzcQKLGgfQB5+WweSlc83t1P8HdUUxQIG5IyfWls4befKOf2Ul QcwENyue+UwNaN1lizQ13Wc1hCqm1TBqFHBqEDlh0g== X-Received: by 2002:aa7:d1d9:0:b0:531:157d:ba2d with SMTP id g25-20020aa7d1d9000000b00531157dba2dmr13586266edp.4.1696930269123; Tue, 10 Oct 2023 02:31:09 -0700 (PDT) Received: from m1x-phil.lan (aif79-h01-176-172-113-148.dsl.sta.abo.bbox.fr. [176.172.113.148]) by smtp.gmail.com with ESMTPSA id b11-20020aa7c90b000000b00536246d1eadsm7353953edt.41.2023.10.10.02.31.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Oct 2023 02:31:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , "Michael S. Tsirkin" , Song Gao , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Laurent Vivier , Bastian Koppelmann , qemu-arm@nongnu.org, Jiaxun Yang , Ilya Leoshkevich , Yoshinori Sato , Paolo Bonzini , Weiwei Li , Nicholas Piggin , qemu-riscv@nongnu.org, "Edgar E. Iglesias" , Bin Meng , Yanan Wang , Palmer Dabbelt , Alistair Francis , Aleksandar Rikalo , Daniel Henrique Barboza , Marek Vasut , Peter Maydell , qemu-ppc@nongnu.org, Michael Rolnik , Max Filippov , Mark Cave-Ayland , Laurent Vivier , Stafford Horne , Thomas Huth , Chris Wulff , Sergio Lopez , Xiaojuan Yang , Richard Henderson , Liu Zhiwei , Artyom Tarasenko , Daniel Henrique Barboza , Eduardo Habkost , Brian Cain , Marcel Apfelbaum , Aurelien Jarno , qemu-s390x@nongnu.org Subject: [PATCH 15/18] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE() Date: Tue, 10 Oct 2023 11:28:57 +0200 Message-ID: <20231010092901.99189-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231010092901.99189-1-philmd@linaro.org> References: <20231010092901.99189-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=philmd@linaro.org; helo=mail-ed1-x531.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=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: 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 Since the OBJECT_DECLARE_CPU_TYPE() macro uses the abstract ArchCPU type, when declaring multiple CPUs of the same ArchCPU type we get an error related to the indirect G_DEFINE_AUTOPTR_CLEANUP_FUNC() use within OBJECT_DECLARE_TYPE(): target/mips/cpu-qom.h:31:1: error: redefinition of 'glib_autoptr_clear_ArchCPU' OBJECT_DECLARE_CPU_TYPE(MIPS64CPU, MIPSCPUClass, MIPS64_CPU) ^ include/hw/core/cpu.h:82:5: note: expanded from macro 'OBJECT_DECLARE_CPU_TYPE' OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME); ^ include/qom/object.h:237:5: note: expanded from macro 'OBJECT_DECLARE_TYPE' G_DEFINE_AUTOPTR_CLEANUP_FUNC(InstanceType, object_unref) \ ^ /usr/include/glib-2.0/glib/gmacros.h:1371:3: note: expanded from macro 'G_DEFINE_AUTOPTR_CLEANUP_FUNC' _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func) ^ /usr/include/glib-2.0/glib/gmacros.h:1354:36: note: expanded from macro '_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS' static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (TypeName *_ptr) \ ^ /usr/include/glib-2.0/glib/gmacros.h:1338:49: note: expanded from macro '_GLIB_AUTOPTR_CLEAR_FUNC_NAME' #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName ^ :54:1: note: expanded from here glib_autoptr_clear_ArchCPU ^ target/mips/cpu-qom.h:30:1: note: previous definition is here OBJECT_DECLARE_CPU_TYPE(MIPS32CPU, MIPSCPUClass, MIPS32_CPU) ^ Avoid that problem by expanding the OBJECT_DECLARE_TYPE() macro within OBJECT_DECLARE_CPU_TYPE(). Signed-off-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson --- include/hw/core/cpu.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index e02bc5980f..ab724fab3a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -79,7 +79,12 @@ DECLARE_CLASS_CHECKERS(CPUClass, CPU, */ #define OBJECT_DECLARE_CPU_TYPE(CpuInstanceType, CpuClassType, CPU_MODULE_OBJ_NAME) \ typedef struct ArchCPU CpuInstanceType; \ - OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME); + typedef struct CpuClassType CpuClassType; \ + \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuInstanceType, object_unref) \ + \ + DECLARE_OBJ_CHECKERS(CpuInstanceType, CpuClassType, \ + CPU_MODULE_OBJ_NAME, TYPE_##CPU_MODULE_OBJ_NAME) typedef enum MMUAccessType { MMU_DATA_LOAD = 0,