From patchwork Wed May 24 14:58: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: 685356 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297344wrt; Wed, 24 May 2023 07:59:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Rj9EzRkJbIiLCAvIUMM4gQ2AqbcPy1H+N/74+aJ8IBTetSaR9BWaGX+s2n5j5bBnMHzjU X-Received: by 2002:a05:622a:189e:b0:3f4:cfed:96bd with SMTP id v30-20020a05622a189e00b003f4cfed96bdmr27117035qtc.21.1684940398686; Wed, 24 May 2023 07:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940398; cv=none; d=google.com; s=arc-20160816; b=HdmbZwWBWLknPrScQG16C5EhQKl9ad3EE1VkU2vcVZjrf3+ToX328JqJavQonm18x9 vpi8uLfNiG8HuzCnKLJTYuCPaFsbyXc6kT7FGYuTpa0y4sFy+asPOKET29vvkg1+D1yN hbZ7JBGKV7KJT4eKxOoM/FTsNYbfg4vzEm42Tw5JKM41UoZWqFDn5lLJ9n7NRymMJsKo pqvj5tVue2smT3HzWSWP+Zw39EqeCRsw86CrDyG3eB+dcx1/m7C+R4zkkhU+pgPT2ekb JRfD1GMC0qVtxYVja5eDvso7W0ZzIr9tEbivXuPfFKlqbpvOeA1em+F216V/rrIoZITB vZag== 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=/NFMmQbEi4QeLl7La/O/5nvyHdFAh48mXBKmtpD+Yyc=; b=OTxlBtum1xWP0FT+nIr0D8u9+X3J0nmdyh88TkbiFSVsltJDMvVE3PgiNEO+50KaLh l6YXtlHts5039AdvFwqzGQi1qiMimdNHAJNqwLRm5Mz72jNkFqDCmJpYKJP/9ZFvesNA EPdl+g4sXrz33vhh7YUXJLrgbsUaVK6mqyfop6Xg6y9U+TjdtrzXMtypMsXzC96izw4/ X6j2QBgkM5egFxb+4zEBrLlR4QZ/bli8BZAIkTcrkFdr3beCrU6PAhymNu1Z/OoLsiap JFBQyUBOHr+ObyJ8a0VSzkeGHJt5If048x/Y6CRZ7Cm6eFKivBRzBNIpFPdIRquhKx9H oNdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YI1szJ4v; 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 g1-20020ac87d01000000b003e8b45a453fsi6573495qtb.631.2023.05.24.07.59.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 07:59:58 -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=YI1szJ4v; 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 1q1pxe-0006J8-F1; Wed, 24 May 2023 10:59:36 -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 1q1pxa-0006G6-1H for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:30 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxS-0006GV-O5 for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:24 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30a95ec7744so942380f8f.3 for ; Wed, 24 May 2023 07:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940354; x=1687532354; 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=/NFMmQbEi4QeLl7La/O/5nvyHdFAh48mXBKmtpD+Yyc=; b=YI1szJ4vjL0nLMYmSZAFXKFGmys/qnEFB6DRj6D1iCpxTgkjlqbtmUmtLMTfE1gvuH 21eOV6wiKwBnGxJ6D9yxQvIiAUxCYbCwQkVIEJRwEpqfOk54ul6JjRyi43iIYQ8c4QjC j0S5dsse6AuVqaNFnnqloNv/OezbqhUGRlmeH+o4Vgb+m099AaoomaBVFb6OsTx5gWWc Cyz44YiWOiaFp8ptPukuiGGvgVzJepGPgesRz0CUycpa9kH1zboPKjhyTKBpQMFTHIGB O9DJvisqqZIt4os8Cy2pH2s+AjI7/yv5QBydd2Md45xsfQU5DRRPXo+vDQRkun29Gb4+ Xh9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940354; x=1687532354; 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=/NFMmQbEi4QeLl7La/O/5nvyHdFAh48mXBKmtpD+Yyc=; b=D9JLF1f+kHOHO4dc4w/Ld+9cwLrSBnZgyp8e0yxxuosTaJ0q4MbLPgvrXrwk/rtyze 1EHT9Ly2Qu1HATYWkZSfPrPpb8LCyWgRSCV2PaqE6ykEZq52ll1plVQipD0W3pqqEK7c sqXXK72fVbzvQSW9B/KYw/uuLqm0EoVoxDog8NzuvKzaZqD2wfsHNoCg9OUZs6yQ6Oyd pqd4/GG12MZflqRXAr5601PKRlUqHkH/flNkolPrnN8yUmEy+2vxeWc6Z3MGlf0WYWVS Q9QKAw6AjN5x4ZotUhXIh8znYvggQ0OfsblDB/nBGlxbpSHcugKY4YxgTuslKx+2O5Dl 9vjw== X-Gm-Message-State: AC+VfDyXRYyLSfoZ2uoKdiREWVosZRpIfOWa+ANM9rEg7T/K2OSnIIOs +JnXAJlo1JHmWqzMkA09cRs0Fb6K5Q3kD09k+x1cQQ== X-Received: by 2002:a5d:5505:0:b0:301:8551:446a with SMTP id b5-20020a5d5505000000b003018551446amr105802wrv.2.1684940354651; Wed, 24 May 2023 07:59:14 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id s5-20020a1cf205000000b003f180d5b145sm2576037wmc.40.2023.05.24.07.59.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 01/10] hw/arm/realview: Simplify using 'break' statement Date: Wed, 24 May 2023 16:58:57 +0200 Message-Id: <20230524145906.33156-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 The 'break' statement terminates the execution of the nearest enclosing 'for' statement in which it appears. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/realview.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index a5aa2f046a..a52ff35084 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -88,7 +88,6 @@ static void realview_init(MachineState *machine, I2CBus *i2c; int n; unsigned int smp_cpus = machine->smp.cpus; - int done_nic = 0; qemu_irq cpu_irq[4]; int is_mpcore = 0; int is_pb = 0; @@ -294,14 +293,13 @@ static void realview_init(MachineState *machine, for(n = 0; n < nb_nics; n++) { nd = &nd_table[n]; - if (!done_nic && (!nd->model || - strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) { + if (!nd->model || strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0) { if (is_pb) { lan9118_init(nd, 0x4e000000, pic[28]); } else { smc91c111_init(nd, 0x4e000000, pic[28]); } - done_nic = 1; + break; } else { if (pci_bus) { pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL); From patchwork Wed May 24 14:58:58 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: 685361 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297853wrt; Wed, 24 May 2023 08:00:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZXmd20HWEgDTybpQ24ZUnHH7zGJ4NvsENzrPVnMqbYlUJA5XF9/lgVwl3bicu8avzx/d2 X-Received: by 2002:a05:622a:1911:b0:3f3:96a3:c753 with SMTP id w17-20020a05622a191100b003f396a3c753mr25611113qtc.11.1684940444853; Wed, 24 May 2023 08:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940444; cv=none; d=google.com; s=arc-20160816; b=NUU0brWxk0ph+uFBqNyClx8eoLtt4aN7DNWZpLzrGjh3ny4rLiZKYzzkTQ4aWknVSG KZXIwn5yyC4uJlg0u4PfCvCz/yhmnaa/jly5SRDv/Zvcf+WIOz5r16Q66TrGkDMHPbqm yvkntHZUlgOT/u9edvJPufrgZNY/RQzQnibqsMYSCDrg7y3sThjgJEgb2rAh1UANIP96 9DwZpNePkAf/fPHmydQUp/97fOFNI6cf2GWEmIfnOzgb2tzkix4GC3VDHeVtAFF9Fiuq /rF1DpYwShEwScxzHOiI7u+zfY+9efOmECTgO38ZL84ZAumWgd2Rypp7Ym/bWirp5dp4 B8Gw== 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=Wrroi3k5iuAqhp3rZjOPVM512Ek393zKHUtZlhcG5AM=; b=RPjGGO0YVnCJmpsA7rAxUZjYsFp6fw7RC0LBwBueBTXXPSu5W3/ZiegNsGL2GBSAlT KFea75OJir9CK8jvuLlEElweQXX+4sIZQoKWAhabQpfFZB7J2RvsYEcw5Ad7Bzr9DFz9 LQDlc8PXyJsKRpP0P9gCGu4Rl1Qp6OydGoM8NA953L/TC8LtkqS8OTRjpyfUBSfNpSo2 7xRzwroCypABo2vE/eUzgV216jABynBt3WE88aasYaD2oqQ+khSjI9zq00pTTM43i9En e7xVHqW6slpDNX0jGtnXMyuyefJdUkq5boZiDBO1vo10c4gaffUIvlt/RHxQ9BZytWVD Hmcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhIgSqyF; 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 i4-20020ac85c04000000b003f5166f2ca1si6653223qti.675.2023.05.24.08.00.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:00:44 -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=FhIgSqyF; 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 1q1pxn-0006Mi-8w; Wed, 24 May 2023 10:59:44 -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 1q1pxc-0006Ha-Bk for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:32 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxT-0006J3-G8 for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:30 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f6077660c6so9294215e9.0 for ; Wed, 24 May 2023 07:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940360; x=1687532360; 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=Wrroi3k5iuAqhp3rZjOPVM512Ek393zKHUtZlhcG5AM=; b=FhIgSqyFLQVvdUM7l3cSO7l/VrYg8L70lkSforxW0whol7C2jzTrLB1QG30HayLf7o b/r8qXQpw8JRFDs1xYW+cTVGC41J9c91x90QYx5d1g/lp3nAVEQktdn7VHdeJFKluV6W hd15oxJpGV6Pb1NE/06IKrIOLrv0HybDMpE3C4M8qjBXAXZHIx/dMztjZ6l+ihoOZNHr P8OYPVig5Zntp6Hy5XQD1e48mR5sxc4ZAvownZw/JJXXXdPMs2bSr6fORqOMt+qp+NzP iBjYEOh6RIqwM9+qfuG3g3qbp+5Yg13kvQ+HEgpumKHJf1msZsWBXz9VKTzRWRqxqobu +nWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940360; x=1687532360; 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=Wrroi3k5iuAqhp3rZjOPVM512Ek393zKHUtZlhcG5AM=; b=MibJ5dKx7BB+pUW72EoFTxOGLmRH3rrWU15A/M0pKWSpB4IDsCcv28ne+1AOHQ/yqe A34aM4SmTvnhxPQJXaY/yYrcuJAHhKJBOJOCRYPwYtumUe1DN6H7VkWSe31Zyg4xBOvO mpuR+KU+eWRn43tEmnxwP2z9uCIN0NCp3GN9p1aWU41Psk0KvlVCMU2+GYPxcVvgZDBK bG0LhCzpCORhVg9IJkb8e+ZqTNAkOhdt9tSgSyMFXMwb1WDr11JdKqeNpAeotcAuVCX+ CyG4yNvU9yazJ3iuhpbBA691wz6vs4YToM/+C8ULPOkVXlH90cTBCcGWRfe1XkMbBvYB JfPg== X-Gm-Message-State: AC+VfDxT9avJ/Tc6d0A0u0vMjaEnIRYFIXX87z/+nDH0Sun8Zb8cjnRA kGgH7jywRmDhQrVhoAn0HFRGSh3SslhaEjldnhCUFA== X-Received: by 2002:a05:600c:2244:b0:3f5:176:c398 with SMTP id a4-20020a05600c224400b003f50176c398mr5021wmm.31.1684940360379; Wed, 24 May 2023 07:59:20 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id i1-20020a05600c354100b003f61177faffsm4636402wmq.0.2023.05.24.07.59.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 02/10] hw/arm/realview: Declare QOM types using DEFINE_TYPES() macro Date: Wed, 24 May 2023 16:58:58 +0200 Message-Id: <20230524145906.33156-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. Replace the type_init() / type_register_static() combination. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 50 ++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index a52ff35084..07a80d0de3 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -412,12 +412,6 @@ static void realview_eb_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); } -static const TypeInfo realview_eb_type = { - .name = MACHINE_TYPE_NAME("realview-eb"), - .parent = TYPE_MACHINE, - .class_init = realview_eb_class_init, -}; - static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -430,12 +424,6 @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); } -static const TypeInfo realview_eb_mpcore_type = { - .name = MACHINE_TYPE_NAME("realview-eb-mpcore"), - .parent = TYPE_MACHINE, - .class_init = realview_eb_mpcore_class_init, -}; - static void realview_pb_a8_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -446,12 +434,6 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); } -static const TypeInfo realview_pb_a8_type = { - .name = MACHINE_TYPE_NAME("realview-pb-a8"), - .parent = TYPE_MACHINE, - .class_init = realview_pb_a8_class_init, -}; - static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -463,18 +445,24 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); } -static const TypeInfo realview_pbx_a9_type = { - .name = MACHINE_TYPE_NAME("realview-pbx-a9"), - .parent = TYPE_MACHINE, - .class_init = realview_pbx_a9_class_init, +static const TypeInfo realview_machine_types[] = { + { + .name = MACHINE_TYPE_NAME("realview-eb"), + .parent = TYPE_MACHINE, + .class_init = realview_eb_class_init, + }, { + .name = MACHINE_TYPE_NAME("realview-eb-mpcore"), + .parent = TYPE_MACHINE, + .class_init = realview_eb_mpcore_class_init, + }, { + .name = MACHINE_TYPE_NAME("realview-pb-a8"), + .parent = TYPE_MACHINE, + .class_init = realview_pb_a8_class_init, + }, { + .name = MACHINE_TYPE_NAME("realview-pbx-a9"), + .parent = TYPE_MACHINE, + .class_init = realview_pbx_a9_class_init, + } }; -static void realview_machine_init(void) -{ - type_register_static(&realview_eb_type); - type_register_static(&realview_eb_mpcore_type); - type_register_static(&realview_pb_a8_type); - type_register_static(&realview_pbx_a9_type); -} - -type_init(realview_machine_init) +DEFINE_TYPES(realview_machine_types) From patchwork Wed May 24 14:58:59 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: 685362 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297919wrt; Wed, 24 May 2023 08:00:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6d78vv0TNzATkfU9R1qjAwafO8BaC9j++vPc8Q43VEuIQX4xv5lqL+c4G6wgrRBz86aPL3 X-Received: by 2002:ac8:5fd6:0:b0:3f6:be32:63e8 with SMTP id k22-20020ac85fd6000000b003f6be3263e8mr6351699qta.55.1684940451668; Wed, 24 May 2023 08:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940451; cv=none; d=google.com; s=arc-20160816; b=NFElb0JGGmIZP25IqpJ4IY+qRWIOH7N+SBq1uIvP0d15y8hr7u3io2TTTNWvQ9oI6p R6FBGh7zBgqWHDRh3OWdPu/KbH9HoHP61d2uu3uAqE19eCV9UHnhTmpUZhOvYQYLp5p7 iZ9Yq8PrKNWtgN1yfu0D0Hc8fqgCOdld/IW3BGvIHPktQJTBgkDB5SvnoOu3SjSctHux CkpEUit7UsT8vpUMg7MdIaSsuX9UVhCVscSJAPAM4rvwRaJH7AFAGzhwHgqkc6IRaLx6 nIqbr6Pr6UqAXwA7/295OYhOQGDyqvHGuZfIEBdLsNi5CcEoTNFdK5q8XCbRbV0d2qt6 z2Yg== 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=50SL7zbNGl/fD7oTGtJ8qBrDyfPUgCnUWKs/hQwlad4=; b=ko7UaSNXcJpEwotP0mOZzBg+Aukamr/0cH1Ug527rb86Q1ELHmrDCHhjnTmuQJ+7lD WmgbLGjysvbvMKBeQuSW0onbh4vnKEoWteuHOpYFfY24tz2fpVA8vH7H5o+nVmUYmsPW Jox2oCn978e0Q/oqLTK4pk/qDGEq98JBrqh8RJAUbt6NemeQDtwV5rBwe0b5LJlPD0c/ A4Y+F9U00DIxQHF8i+cukgP0TykuovIn0S0YLdVmrR/YW5HgpJjYURxSS5is1okbL9uR 5S/zbo2klIS9leBUwEo+cHM5aVyd12tddEY7rwNsLJ+9tGSnCIAOskDz/lzD1cEiyB4Q b70Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NP0MhVp9; 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 g1-20020ac87d01000000b003f541337f13si6581748qtb.689.2023.05.24.08.00.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:00: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=NP0MhVp9; 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 1q1pxs-0006Uz-PN; Wed, 24 May 2023 10:59:48 -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 1q1pxc-0006Hf-Eo for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:32 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxZ-0006N3-O5 for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:32 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30aa1eb95a0so936528f8f.1 for ; Wed, 24 May 2023 07:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940365; x=1687532365; 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=50SL7zbNGl/fD7oTGtJ8qBrDyfPUgCnUWKs/hQwlad4=; b=NP0MhVp96M6zkPmX0TGWKygB31Bd/ybIuSWwGmRVrkhPSHTg9+mpoiBof0mDbwlaYq T+HDIO+jixPETamR3yEt8XXovaZ+PtGlOqF5BBf1eiqdadY2V2+Ebc+y2R/Hal1Zua// HXyq86MTGAPh+dIXlcg+oFB+0Gl8knr0ysZencIGWOThoBWv8Rjg7td8k9U5xTK8mLKR 9VWGibobVKNpJuxJk+QQLl0sY2z7cxanCXEin3+ojkcZwl0iMoYBoaG9l1ewfx96lf7n 1nGdLmpEyuZfA4Edy1o1/JReOhR64hY6qmNDx3dPvKZVmpam0DUuyx4A8bb9rTtXuxtc xCYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940365; x=1687532365; 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=50SL7zbNGl/fD7oTGtJ8qBrDyfPUgCnUWKs/hQwlad4=; b=PliLg8icqs9ct7LDyTptB2U2WgYVjmTt7svRlx0QQv2DoG5wiEhMXtGscPyYNRKpa1 Lq38qFRSl8WCSDS+noxuHoGSUEtKFjHNBTw8pequoj08Fd/tReBHs/KR5UEe+hSd2ubb o4oYPrvOktY439Sx+gMhJj9CXiRsSF4Nsgb1oDWEw+DiqicWuHq2OEVTLXdvIL6wurzq TO3CHVM+qSl15e8/4JbFqC1GxGHwn1c7D3FwPL1c7iuRJpZat0aWC0hOSqRgKCx0QIct qqPAcaRXB81SCvRuS0LdPv3lOnLKMaKEo/LWZMrxpQ6aFtZoRAinhUsvd/+qrUp8VIwq Tn8w== X-Gm-Message-State: AC+VfDwbfmTcFzt1HTjRNVO5qEaz8Ep8xlLLm8GYMqLB/um4qhhuvPg+ gBPROPVUD3a5yxf+dMAnd2k+c1qzpC3mraQ/GmUhgA== X-Received: by 2002:a5d:5002:0:b0:2f6:bf04:c8cc with SMTP id e2-20020a5d5002000000b002f6bf04c8ccmr27678wrt.55.1684940365713; Wed, 24 May 2023 07:59:25 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id n1-20020a5d4001000000b003062ad45243sm14826928wrp.14.2023.05.24.07.59.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 03/10] hw/arm/realview: Introduce abstract RealviewMachineClass Date: Wed, 24 May 2023 16:58:59 +0200 Message-Id: <20230524145906.33156-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Introduce the abstract QOM TYPE_REALVIEW_MACHINE to handle fields common to all Realview machines. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 07a80d0de3..f0a8a93b08 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -30,6 +30,15 @@ #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" +struct RealviewMachineClass { + MachineClass parent_obj; +}; +typedef struct RealviewMachineClass RealviewMachineClass; + +#define TYPE_REALVIEW_MACHINE MACHINE_TYPE_NAME("realview-common") +DECLARE_CLASS_CHECKERS(RealviewMachineClass, + REALVIEW_MACHINE, TYPE_REALVIEW_MACHINE) + #define SMP_BOOT_ADDR 0xe0000000 #define SMP_BOOTREG_ADDR 0x10000030 @@ -448,20 +457,25 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) static const TypeInfo realview_machine_types[] = { { .name = MACHINE_TYPE_NAME("realview-eb"), - .parent = TYPE_MACHINE, + .parent = TYPE_REALVIEW_MACHINE, .class_init = realview_eb_class_init, }, { .name = MACHINE_TYPE_NAME("realview-eb-mpcore"), - .parent = TYPE_MACHINE, + .parent = TYPE_REALVIEW_MACHINE, .class_init = realview_eb_mpcore_class_init, }, { .name = MACHINE_TYPE_NAME("realview-pb-a8"), - .parent = TYPE_MACHINE, + .parent = TYPE_REALVIEW_MACHINE, .class_init = realview_pb_a8_class_init, }, { .name = MACHINE_TYPE_NAME("realview-pbx-a9"), - .parent = TYPE_MACHINE, + .parent = TYPE_REALVIEW_MACHINE, .class_init = realview_pbx_a9_class_init, + }, { + .name = TYPE_REALVIEW_MACHINE, + .parent = TYPE_MACHINE, + .class_size = sizeof(RealviewMachineClass), + .abstract = true, } }; From patchwork Wed May 24 14:59:00 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: 685364 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp298423wrt; Wed, 24 May 2023 08:01:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4P0QF6lfFPkBk+NHgyQYPA7EH/HcT3ZECQ/EYz/bTcJ3BBZqBpUqSRPxRHjimjOlsqMTCC X-Received: by 2002:ad4:596f:0:b0:623:66d3:e546 with SMTP id eq15-20020ad4596f000000b0062366d3e546mr26604393qvb.17.1684940496760; Wed, 24 May 2023 08:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940496; cv=none; d=google.com; s=arc-20160816; b=RfjnjxrRtY+0OOlBSXsn5nNI74HfeBIj+3q0+X5C2FSXiymEw2Ic/Zi/tBvJU9Dg5c BY86EnJk1t6nNPo6+sq9isO/MT6yS+3W+VngJzc/WUy01BlcNMdSz6dEiJbN1CKqC2d+ w37d8hs2JFjnyGEPje8gN1e0E6OH1c+DYnC9i8DHRWepRoz3iZeqj3tkuT24iY1zlltc d9WRJUY5mk2JwBT8/eL79X6lVxNw7Li3jlZMT3jiHd/Lbh54IfElpKszEgiOvBtLiByo QhEOArZ3k0tJf+/6WXwDycumR7/Rc9xSo1grMsT3JZCyYGJdbRqfzYia8fSOFceLTnqi nFmQ== 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=PydogO+S2zKNTlFPp3mMYMrTOfo1Vgivo42WoSUjgRg=; b=erm7DHyKRD/lvc2buZ5IzUPncnsUGnLOE3/XP7xcj+Fj3s/NmlBkY0HX1r5mwrY6Ex Uk1CWi7oMzHFkRrFqheM+D+diiPqMR5flODvvuvJZ26rPqE3/wd3EdL6BE7/KF8jTAJa CEBe/qBc7T/EnpAc4r7SwXCWSkFJDqTtUZ25zBWRJ7AXBQH92H5g7+x2ndStgKOidSAH l+MfORlKeGby5b1HWE9W2DyczNVhlzWsviv5hHuA/bxTstwckWlf8mylrCN47FVakxMQ ULDR267JfDnTihrHLkvErUtlPYGIWG/PJjeGBCv7Dc3udxRBMoxZYajdtB3mEJvt3IAo lv2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E7sOogTi; 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 f21-20020ac859d5000000b003f52fa443besi6971999qtf.746.2023.05.24.08.01.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:01:36 -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=E7sOogTi; 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 1q1pxt-0006X8-GS; Wed, 24 May 2023 10:59:49 -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 1q1pxe-0006JD-Dc for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:36 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxc-0006PT-C4 for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:33 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f607766059so11691865e9.3 for ; Wed, 24 May 2023 07:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940371; x=1687532371; 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=PydogO+S2zKNTlFPp3mMYMrTOfo1Vgivo42WoSUjgRg=; b=E7sOogTiv9Y4kFslJcA9lUcIb+HVt34jqG1gfk/jOyTxLEV/idizywt0a+uNW6kho5 M7gCzXbtMw+WtVSvzp/HGH0ArrUmQ6RUpyjI1iv/lR3bMy0fW6h0C1HBTnURRqDHZUjh A4oIY4DdCkPDW42HLhvBToC1miDHYOa+9SVBlHOyoDq+CxBRKFc3YQ4us2naLZ4uJz2k FUvKwIHbpdUazrBribvg8ac6J+IWQICtb8bxKx05QurgjcMTo7nht98a5RQL+r8+iJcH /Wgnz1L7fYkQVLvqcJblMXfylARGUbN8nhLjL5sYd351K2usywllzODlPHBxMPsvTF6j e0SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940371; x=1687532371; 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=PydogO+S2zKNTlFPp3mMYMrTOfo1Vgivo42WoSUjgRg=; b=At69EO71kl/g8bk6+TZKa4u4l22UY3N1MNWy16AkqnZ2Q0049Z8jQVqKqCg+ye95ti LW2dlogeiS9N+uX5HwLnS/dSkwWyJ+f7y3ezHpHUbthu3JOWa0OTWgykT7Gcv4GyhVN2 j9CpO8c8vo0xLIgU7+QljgNqyotwiAklV84puZxylKicnfVhXUd8jdxkCrzBOyDsk9Mb P3eh3AsWWfIkcNI22qkzhSxdF3eGoxcu8tBMqpBE6lO1P7q/KQrphUoFhwllG77NHxOd 7bucTQiv4prV7by6QR50M0auM/LuhP6eVx1tutGNaLGuUvMt7TYppj925xkwvZwW/CbS kb5Q== X-Gm-Message-State: AC+VfDxTwFCpczxNo5bxngkBBPHKHkYPolJvWhYB3O+WQ9Mg4fp4Ww20 OyWAS+RdsO4An6VsQCttWa85SdvwxhLFMwcYxJi4lQ== X-Received: by 2002:a7b:c411:0:b0:3f4:f7c2:d681 with SMTP id k17-20020a7bc411000000b003f4f7c2d681mr33149wmi.29.1684940370857; Wed, 24 May 2023 07:59:30 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id x15-20020a1c7c0f000000b003f4268f51f5sm2670695wmc.0.2023.05.24.07.59.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 04/10] hw/arm/realview: Factor realview_common_class_init() out Date: Wed, 24 May 2023 16:59:00 +0200 Message-Id: <20230524145906.33156-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Introduce realview_common_class_init() where we'll set fields common to all Realview classes. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index f0a8a93b08..6970e8a469 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -410,6 +410,13 @@ static void realview_pbx_a9_init(MachineState *machine) realview_init(machine, BOARD_PBX_A9); } +static void realview_common_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->ignore_memory_transaction_failures = true; +} + static void realview_eb_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -417,7 +424,6 @@ static void realview_eb_class_init(ObjectClass *oc, void *data) mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)"; mc->init = realview_eb_init; mc->block_default_type = IF_SCSI; - mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); } @@ -429,7 +435,6 @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) mc->init = realview_eb_mpcore_init; mc->block_default_type = IF_SCSI; mc->max_cpus = 4; - mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); } @@ -439,7 +444,6 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) mc->desc = "ARM RealView Platform Baseboard for Cortex-A8"; mc->init = realview_pb_a8_init; - mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); } @@ -450,7 +454,6 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9"; mc->init = realview_pbx_a9_init; mc->max_cpus = 4; - mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); } @@ -475,6 +478,7 @@ static const TypeInfo realview_machine_types[] = { .name = TYPE_REALVIEW_MACHINE, .parent = TYPE_MACHINE, .class_size = sizeof(RealviewMachineClass), + .class_init = realview_common_class_init, .abstract = true, } }; From patchwork Wed May 24 14:59:01 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: 685359 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297748wrt; Wed, 24 May 2023 08:00:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5J+R+7X5NDEtT4p0tMiEVwYc/jAoJLN7o2fPhPCGYE2oaZ6Sx1vQIoDFCzqT4o/kDiTEyO X-Received: by 2002:a05:620a:7e4:b0:75b:23a1:366a with SMTP id k4-20020a05620a07e400b0075b23a1366amr6050628qkk.43.1684940434273; Wed, 24 May 2023 08:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940434; cv=none; d=google.com; s=arc-20160816; b=DyS1691v6IBdVc925WxQhAweacBTwhiDJ+L/qSehn3ch+2SDvylQA7derr3JipgKX5 +uZaoPqWFqm1OXAMzMPFG9rkZw13oz3Ru1KEwGrO1A4QE5oDHkqRLxjyDuQF5AAaFQU0 THijsVwVMhYDbyQwl0DYbsipI+UWyQvsF6AgXkCeNhdydl6/pOPyH4pYHRGnHw7UTW59 hJVjW1Ts9g7h4jjyZVgkhlL7NLHczFHUGJUvAnU5EH2aNcSmknBv1B/5JlLbcOhawHWg pCbVwdP/IrHq4XCp6jt3wtXcjO25/1cUneTonnamtW5shm5Xwoy3HDP1GN5xjZFgrsHc jf1Q== 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=CfORvZBj5XwZqX1kEUcED15b0r2EiIZE5rk0MEhjkUo=; b=qFxmKZzYyy6hBPMiCK8PzfWc+EI24zGtbtBWNtWG/E6gK5IUQJS0HjHilzBktJM7sy KRFz784Tpcbqy5JcgMrpE2qqg9447ybMlSG4zLn+1lbz6+rAiLwldZNeYfRLr2dIgRup pBh07tMifkUMft3GHyxcLLKu4ripViLn+9Go68ZTaC/7L+DwkJXPICGV9QJwWT18QCMy rsf9DDvNxsgNDq0w6LYxwsMGx/dIZAxXwzdMHGYN8LKPjk0/oudJTNHziYqiIkPapoIz cpcaG8LVS33GvxkzcLp79PRuxmhGaw8GnTpLZ3XxpBR9G0qv5t6xmAUeVjrOVTS9ibru CWeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mq9JmfFV; 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 x21-20020ae9f815000000b0075c6a873e8csi117227qkh.271.2023.05.24.08.00.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:00:34 -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=mq9JmfFV; 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 1q1pxs-0006VB-Pf; Wed, 24 May 2023 10:59:48 -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 1q1pxl-0006Mg-7H for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:41 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxi-0006E9-5J for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:40 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-30a1fdde3d6so924128f8f.0 for ; Wed, 24 May 2023 07:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940376; x=1687532376; 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=CfORvZBj5XwZqX1kEUcED15b0r2EiIZE5rk0MEhjkUo=; b=mq9JmfFVIPtMkazqFVBrVylL5+DHxpG5GJ4QiW7FgaaC9d400bIeiRKryf3Uexuf85 avPFTOrfFNooiHadQFcUCWI+JgSPKvGMa0o5lQ2BwM5ZacfESNRffxQjjB94pBOvNOCb 4GJfKMzezb+HmrbKepN0nRGAA6shDl2SvqRxPEkoBwOYibu4P4geCnPUpi1L/kMjf/Eg 1zeKNdNbNCPnkkNgE4l17X1p+hQkOGYnKR2cFO9wnAuedj1Ly8UfrEqT5tykeR0+2m9l aNMKmFll2t67K8zyg0dHK8WtK82G431Qw4IjBGAfuyUBG19/HJM99vMlHQk1QGZHpp++ pZeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940376; x=1687532376; 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=CfORvZBj5XwZqX1kEUcED15b0r2EiIZE5rk0MEhjkUo=; b=FPvXhGoF1q+jVS0tJCa5VgxR44MIKuMLf0wHoBNbjwalVyPth8qIBoxnk8+jHC+rA+ G5MJALuiKr25EI1CbHJUyDtkf2GFrfFxgiit+Nt9Wr5Q1HTE8uD/udbRlRYmzyLhH2cV 3VK3yUHh+evtvHIcrDIWH1iD6lIrDOXTWAHZMViIp6WrUz1dVvT+aMCfCBj1sM/eOhBu 9kYed+S0PIwp33Pl5pLlPLHcgNFxHVZWt9vXYZh8+wURgxVxHikHmjgNmyxcAuWL58wS BM26F9onSscoQRcKqaiTvnJGKYY0/3RTM/yEjovh9RfNWLp9AaBo/Xt8TCwLJxU89WLV 97cw== X-Gm-Message-State: AC+VfDzJSvn6ZClOmogc1QpUSeYhb1aTf35kzDAEqKYDYO0zX9mS2o90 xS6WE5FJIkGnyR7O2ilZvW9T/NUt95hnGcb1jVAEaA== X-Received: by 2002:a5d:6852:0:b0:2f9:4fe9:74bb with SMTP id o18-20020a5d6852000000b002f94fe974bbmr55626wrw.40.1684940376052; Wed, 24 May 2023 07:59:36 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id c14-20020a056000104e00b00307b5376b2csm14621462wrx.90.2023.05.24.07.59.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 05/10] hw/arm/realview: Move 'board_id' to RealviewMachineClass Date: Wed, 24 May 2023 16:59:01 +0200 Message-Id: <20230524145906.33156-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Instead of having each machine instance resolve its board ID, set it once in their class_init() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 6970e8a469..c354ce0cfa 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -32,6 +32,8 @@ struct RealviewMachineClass { MachineClass parent_obj; + + int board_id; }; typedef struct RealviewMachineClass RealviewMachineClass; @@ -49,7 +51,6 @@ static struct arm_boot_info realview_binfo = { .smp_bootreg_addr = SMP_BOOTREG_ADDR, }; -/* The following two lists must be consistent. */ enum realview_board_type { BOARD_EB, BOARD_EB_MPCORE, @@ -57,13 +58,6 @@ enum realview_board_type { BOARD_PBX_A9, }; -static const int realview_board_id[] = { - 0x33b, - 0x33b, - 0x769, - 0x76d -}; - static void split_irq_from_named(DeviceState *src, const char* outname, qemu_irq out1, qemu_irq out2) { DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ); @@ -81,6 +75,7 @@ static void split_irq_from_named(DeviceState *src, const char* outname, static void realview_init(MachineState *machine, enum realview_board_type board_type) { + RealviewMachineClass *rmc = REALVIEW_MACHINE_GET_CLASS(machine); ARMCPU *cpu = NULL; CPUARMState *env; MemoryRegion *sysmem = get_system_memory(); @@ -385,7 +380,7 @@ static void realview_init(MachineState *machine, memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, ram_hack); realview_binfo.ram_size = ram_size; - realview_binfo.board_id = realview_board_id[board_type]; + realview_binfo.board_id = rmc->board_id; realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0); arm_load_kernel(ARM_CPU(first_cpu), machine, &realview_binfo); } @@ -420,41 +415,49 @@ static void realview_common_class_init(ObjectClass *oc, void *data) static void realview_eb_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)"; mc->init = realview_eb_init; mc->block_default_type = IF_SCSI; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); + rmc->board_id = 0x33b; } static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Emulation Baseboard (ARM11MPCore)"; mc->init = realview_eb_mpcore_init; mc->block_default_type = IF_SCSI; mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); + rmc->board_id = 0x33b; } static void realview_pb_a8_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Platform Baseboard for Cortex-A8"; mc->init = realview_pb_a8_init; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); + rmc->board_id = 0x769; } static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9"; mc->init = realview_pbx_a9_init; mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); + rmc->board_id = 0x76d; } static const TypeInfo realview_machine_types[] = { From patchwork Wed May 24 14:59:02 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: 685357 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297568wrt; Wed, 24 May 2023 08:00:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65zFPo7un8KQ0PargjoRif3BymbhvL9AfIPgOHXAbRbu14d5VzKErHTdQjFK5KkzycaFHj X-Received: by 2002:a05:6214:c46:b0:5f1:606b:a9ca with SMTP id r6-20020a0562140c4600b005f1606ba9camr24094521qvj.37.1684940419217; Wed, 24 May 2023 08:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940419; cv=none; d=google.com; s=arc-20160816; b=SJ2hvIgeWhDCTzgwjjxbHWrBtnApS/yMBY9/LCd03LdhTWyTmq8LrMjBf+fafCTnLf IpccBZV6a2GOM1RLBmIeEfxpjdnoYvpuriwrDJ6nFTZcgKMCQPwL98o4HUZxmhpUhWZG LIMO5TZX1IoSmKi9BtzsTUpnDGioljXkckcb6rWIhLvbeWfLHsEiylXOYMKSVJdvtLIR uuA4LGPwm9vdDLM8jWxs5sRK6Gu0B2PUgvVVSzsfHYtTsZWsMFHSZn4ldA/NqcwdJofh A1Pv7LEvMpgGPL/1EL6zS/qmqnl+YJ6BPTx/xN9/4KSXfnmooVrECdHLwgVUoXam0gJI x95A== 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=5SG+4qtQqEV95gLJ8RAujBOb32EOZfukr8uo1CCxUpw=; b=t/5BOzL18f6XbaVuVreMpofE+rXuMWW17xiNnuoVQV1l3O8vFnbZK27HW/0mcw422S Zb15R089+LmRZ+L2z3ovFyRqXfItP6heht61t7E6rgSX3MNvns2RgbQcaG3DQmfxEu+2 16H1FTFXP/SlCCnKjwnI+6eH+eJwq+IP8V32gFKFqImbiONOEeG6Y8+B/yjx9UwYIunz YaPAumi9FATQySF2DGPLMwTnd2sCG57SJ979FriWkDlBLMzAgrbEUu19fxPE02e6Fz2s VOlhk80FUcp/6kPyDmjbl8m2j80qoxp3bamJbchabS3O4XDrrp1mlvZ3baSeYIs631qP +Eaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vO+3YZby; 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 g6-20020a0562141cc600b005e1ec628c64si6652960qvd.52.2023.05.24.08.00.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:00:19 -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=vO+3YZby; 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 1q1pxv-0006Xs-7C; Wed, 24 May 2023 10:59:51 -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 1q1pxp-0006Pv-84 for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:46 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxm-0006UP-My for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:43 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-30950eecc1eso965597f8f.0 for ; Wed, 24 May 2023 07:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940381; x=1687532381; 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=5SG+4qtQqEV95gLJ8RAujBOb32EOZfukr8uo1CCxUpw=; b=vO+3YZby3t6mHgWKph7afN9yFxbDrF5IvvP32Yo14fNXQ96X9GQMB9+9XQyaDjl2BD 1FEMtC/QZ/F+MQ0zRcPp6C5dcu6UK1cPMFOKnRek2GqBNuYfQJXn2is1ZfrgO4wEzDyK Gv5bp2EFVdLfP3n/Bgz/fQaNluZ8OXi4bVy3cRECWE8SBKceVwPUN5SI1VEYdPEXvnZh GVxxQW9u0jUsCLKFdvrStEcrUdDKGvUcc1Kpzi+Lfi9LSjO5Qe0H3yiYR64nlOixjL5N s5ynd/r10YjK/5SgHoZuTA+UJ0V6WhsrgSRxiETN6OufoyCJcnXi6+CxhmeACLyM9g9b WUqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940381; x=1687532381; 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=5SG+4qtQqEV95gLJ8RAujBOb32EOZfukr8uo1CCxUpw=; b=SWFxKCX1Hw1wmgdt+L4avfcVt9DSQpGFXGbzXfGL26Q7gjjrQXOe089FWtCmZYElEv VKpN5YTIGp7e9C2nr0FxIkN2Ele3Cya2TjnL26eBa+Y74wwMP1bUJKJRMB0GTyiiLLOd GFv7+/3Hb6vNgQnPTElJ6CRC938hzfXn+3w68l7ela6Exhc74SGaO19Jj0cSTkw8Ryoq johdQ7221MwMfmhQhhMQ87zig95CGks6jLbO3cVH8kyrjdCdwyT9NUqj1rHRy9Dy8hpH FGKjnSHCxXcMHkQ6RZoCcrWW6MIA7MJiNdS200a6fPf18o8WgY42Q3OKGqe/zyVbt8FC Cpmg== X-Gm-Message-State: AC+VfDzyUoK9PhPGr7qj27mcrl6XHr5Cxhe+a58Z9zmlImh0RoQ3l3of 1KDO0rgxkGvK0Crk2tY+vFdDzjVZzMLRDb2uzqgfBw== X-Received: by 2002:adf:dccc:0:b0:306:2cf5:79dc with SMTP id x12-20020adfdccc000000b003062cf579dcmr52483wrm.35.1684940381245; Wed, 24 May 2023 07:59:41 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id l9-20020a05600012c900b003078354f774sm14618282wrx.36.2023.05.24.07.59.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 06/10] hw/arm/realview: Move 'is_pb' to RealviewMachineClass Date: Wed, 24 May 2023 16:59:02 +0200 Message-Id: <20230524145906.33156-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Instead of having each machine instance set whether EP/PB, set it once in their class_init() handler. Arguably this could be extracted from the board_id field. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index c354ce0cfa..1a3a64e0ce 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -34,6 +34,7 @@ struct RealviewMachineClass { MachineClass parent_obj; int board_id; + bool is_pb; }; typedef struct RealviewMachineClass RealviewMachineClass; @@ -94,7 +95,7 @@ static void realview_init(MachineState *machine, unsigned int smp_cpus = machine->smp.cpus; qemu_irq cpu_irq[4]; int is_mpcore = 0; - int is_pb = 0; + bool is_pb = rmc->is_pb; uint32_t proc_id = 0; uint32_t sys_id; ram_addr_t low_ram_size; @@ -109,11 +110,9 @@ static void realview_init(MachineState *machine, periphbase = 0x10100000; break; case BOARD_PB_A8: - is_pb = 1; break; case BOARD_PBX_A9: is_mpcore = 1; - is_pb = 1; periphbase = 0x1f000000; break; } @@ -446,6 +445,7 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) mc->init = realview_pb_a8_init; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); rmc->board_id = 0x769; + rmc->is_pb = true; } static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) @@ -458,6 +458,7 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); rmc->board_id = 0x76d; + rmc->is_pb = true; } static const TypeInfo realview_machine_types[] = { From patchwork Wed May 24 14:59:03 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: 685360 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297790wrt; Wed, 24 May 2023 08:00:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61AmM1Wi6dYwNBZNQy8y5VhsEus7UywInyvMJ6cZ2sbC8aVKGmyUfXvcBvu+d7/ez1owL+ X-Received: by 2002:a37:6402:0:b0:75b:23a1:d862 with SMTP id y2-20020a376402000000b0075b23a1d862mr8115742qkb.36.1684940438328; Wed, 24 May 2023 08:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940438; cv=none; d=google.com; s=arc-20160816; b=jSSuDROkKarvmmrEIg0ledYnaN0uJg61K39Sc0b3TpxyXGfqsle8/bwk0Ly/TOMsAE JkctZz5a6hEyuDvbE0/v612PSftOcRIOy02mWDD62ZAHixhTjsXwrq0I7cX4gzj/Y05s jmA6/kER9dlxz7mUBgMQwOvAdiqL/WV6UntvsBbe61mnH3kKU/rWb18/ZtLNKTypdqTG eyTHJIlOAZGhleVpEnI2grUkxmWwcCXsZ3rVhHrbTCsXirKXSqRMCIfFaPUPqRkGziRa z1NbzL1M1HLDfN5rCBUQLl1oEy+TfJByzyPmW0QIvDK9EGZyUoAUv584qyD1VmZ8Yrfj Ottg== 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=oFNQ0ujjXIJFfhKAnMzFQFaSo5jFHy/7Nt5oxClCYqE=; b=qPFr3rasZFl9dYDuaPYOI74k9UKlV0ueaBKGMFsHeIr58MT7f3Ewaay+SmP3i3aJrp Tjv8y4snlUDgfQdgf06LsKSVGYhbjvowvh+CIB3nQwEIO5qRf6wfScHzci6fM4S7pac8 J+iLMssQX2mSApsV/8IZPqgQ6TfFrzk9VxE6js9OTE+17lxNrOiJR8T/dU9vriN2ZSzZ QzQKxvj4vJFWpv+lTFg45G5awrSuwZCvnln1p4WCAqiUX8KcEIlt83Gp1qimRF+mswNA +9zG+euKaeC02WxudMWWjI9n6wcCh3HbxfBLnRHMAyt+7fZ+RrsOpH4ohROw+Mq8i0Od nf+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VBGF3GLN; 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 g6-20020a05620a13c600b0074a0dda7456si6265748qkl.209.2023.05.24.08.00.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:00:38 -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=VBGF3GLN; 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 1q1pxy-0006cA-Vf; Wed, 24 May 2023 10:59:54 -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 1q1pxt-0006XD-VE for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:49 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxs-0006Wd-8b for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:49 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f42ba32e24so9283605e9.3 for ; Wed, 24 May 2023 07:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940386; x=1687532386; 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=oFNQ0ujjXIJFfhKAnMzFQFaSo5jFHy/7Nt5oxClCYqE=; b=VBGF3GLN8LqGOK5xgXvZTNUmB6OxS3Ja5TjqS3poPLOoF7QtZUM4ZDqy8TNunTgBiz 2ZtP322fZ/nny2lmW6SMa626uRx+eOjfjyfsg0Cm7ThI4epvuYsaYERBNSsj3MWZNyXL mxSYX32DE9dkmtg/f6MXe9VR0JE/3YSBuGPCfcbWhTmvAJjrETYG0J3srJ+uiyDcZDGr beRRjMKJNIm8FYGGs5e2i86Sot6uy0Ty+wr2M+t8l6vyq1lShp2Amp1l78FpgNvN8BOg v/B5GWQlnkGtSh9TffxfE4G1MtGrTZNDlFOcqIfkq5ZAeLtWdTuIZee1yS/xqZ45x+0b CkRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940386; x=1687532386; 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=oFNQ0ujjXIJFfhKAnMzFQFaSo5jFHy/7Nt5oxClCYqE=; b=cPzx8nLh43kK8aLT4iHCtdoXWmk1Tz9V1AkOvSQvH4gel95k4GTy9tnQyAbpXZ+GPr EsxwZFRE9aCDSrz9ujubP7bas3DvQuZB5ySl7y+c90WLzaqdNEhhktu053bLYZQacbIZ /E7YpwinKnV/0Ttn/syPmyjL8eDnmoUHkEoyKGoD+WFgk5OkNSDnbrk/nqcehGu5/tKi W6apKTqMgWd7W80aiaPHCvwEOvhp/nwrl1kM4Mdj41ynKoJ6XmmORD+gCTGkfnNLfY3j cHMSUlEgEg6crMNLZ8KD4VOeMr3Z29HjFQI9RjCbnsvHsrpkd+NN5zkH0f/lvPI1oBG3 HlXA== X-Gm-Message-State: AC+VfDzZHGxJMwTR21ah9aJxQHbkY3LKBBlMbRovyLMW66FzD1XqSTrb kt+RiNdLoFVKE2ko3UXJDqBQR0y9sADUTquf/vA6HA== X-Received: by 2002:a1c:4b03:0:b0:3f6:41f:5a68 with SMTP id y3-20020a1c4b03000000b003f6041f5a68mr17906wma.29.1684940386542; Wed, 24 May 2023 07:59:46 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id o4-20020a05600c378400b003f6050d35c9sm2608530wmr.20.2023.05.24.07.59.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 07/10] hw/arm/realview: Move 'mpcore_periphbase' to RealviewMachineClass Date: Wed, 24 May 2023 16:59:03 +0200 Message-Id: <20230524145906.33156-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 Instead of having each machine instance resolve whether it is MPCORE based and its peripheral base address, set it once in their class_init() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 1a3a64e0ce..8a3b5a48b1 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -35,6 +35,7 @@ struct RealviewMachineClass { int board_id; bool is_pb; + hwaddr mpcore_periphbase; }; typedef struct RealviewMachineClass RealviewMachineClass; @@ -94,26 +95,21 @@ static void realview_init(MachineState *machine, int n; unsigned int smp_cpus = machine->smp.cpus; qemu_irq cpu_irq[4]; - int is_mpcore = 0; + bool is_mpcore = rmc->mpcore_periphbase != 0; bool is_pb = rmc->is_pb; uint32_t proc_id = 0; uint32_t sys_id; ram_addr_t low_ram_size; ram_addr_t ram_size = machine->ram_size; - hwaddr periphbase = 0; switch (board_type) { case BOARD_EB: break; case BOARD_EB_MPCORE: - is_mpcore = 1; - periphbase = 0x10100000; break; case BOARD_PB_A8: break; case BOARD_PBX_A9: - is_mpcore = 1; - periphbase = 0x1f000000; break; } @@ -129,8 +125,8 @@ static void realview_init(MachineState *machine, } if (is_pb && is_mpcore) { - object_property_set_int(cpuobj, "reset-cbar", periphbase, - &error_fatal); + object_property_set_int(cpuobj, "reset-cbar", + rmc->mpcore_periphbase, &error_fatal); } qdev_realize(DEVICE(cpuobj), NULL, &error_fatal); @@ -191,13 +187,13 @@ static void realview_init(MachineState *machine, qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); busdev = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(busdev, &error_fatal); - sysbus_mmio_map(busdev, 0, periphbase); + sysbus_mmio_map(busdev, 0, rmc->mpcore_periphbase); for (n = 0; n < smp_cpus; n++) { sysbus_connect_irq(busdev, n, cpu_irq[n]); } - sysbus_create_varargs("l2x0", periphbase + 0x2000, NULL); + sysbus_create_varargs("l2x0", rmc->mpcore_periphbase + 0x2000, NULL); /* Both A9 and 11MPCore put the GIC CPU i/f at base + 0x100 */ - realview_binfo.gic_cpu_if_addr = periphbase + 0x100; + realview_binfo.gic_cpu_if_addr = rmc->mpcore_periphbase + 0x100; } else { uint32_t gic_addr = is_pb ? 0x1e000000 : 0x10040000; /* For now just create the nIRQ GIC, and ignore the others. */ @@ -434,6 +430,7 @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); rmc->board_id = 0x33b; + rmc->mpcore_periphbase = 0x10100000; } static void realview_pb_a8_class_init(ObjectClass *oc, void *data) @@ -459,6 +456,7 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); rmc->board_id = 0x76d; rmc->is_pb = true; + rmc->mpcore_periphbase = 0x1f000000; } static const TypeInfo realview_machine_types[] = { From patchwork Wed May 24 14:59:04 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: 685358 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297734wrt; Wed, 24 May 2023 08:00:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rRZAG+Vu7T/povEOs8Xkt7SMzQDMtVgfN9bc96HTIxI1slUi81TRA3mN4QOY2TABtXhBy X-Received: by 2002:a05:620a:4729:b0:75b:23a1:8e61 with SMTP id bs41-20020a05620a472900b0075b23a18e61mr9143763qkb.50.1684940433160; Wed, 24 May 2023 08:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940433; cv=none; d=google.com; s=arc-20160816; b=e9Q1PaRXzfIW7/SkcjQM4LYELFdcR/YVkXimgbUbMcAJ1Z3ZhGuYU0fU/UgV01DiRO C6Ka0RbBbC3WmRGRykNDYfyQEW2R8jUHEqYaIKEtRrzXx9GfEJdjznmOwK1O5OxeGkuM hqO7q1Kda9/QTwk4GwYaDc3WsXfyEKSJ1KgGctPEaSfZY6gHpFi8NVQV0EyjCGcGgX/r XpviKYIQ6bOU2JfN3UFIYTDZQgkzaFjjjy2wdTml7AiEfATrVhICIr/tdYD+1jUsl0R0 jfFXsLtK5kedWl0cKCC8buyeiHPkzRzHdJXj35UVoMKKSojT2p4Ki+WIVCxlgaCy7/tZ nW2g== 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=vXln/1eI6qFBBphN0wAdNEHB1hgU4t96Zx44NnYHfMg=; b=LXhDkxgNN+bmCo5QffRBesaGW1lhfLKNrlU/gfCbS1x+WDFAfc+ttqMFVZC13W7Id+ OqaCdvZaNucDIIZRqN02WpkK+kWLvmX4KOP6O79TUBYelUZtRTYCuCmAibVxjxr8Uqmg GGH8Le+kLA/NWazxu1Nzkgly081yQQtBzVN2bvJO6lgVYewrCjOslU/on9Pc/3hs71u8 JuOcpwwesirpAlNXeNI3cdH9JqvvvFa6Zv/kS2iiDcWYZ8CNRcxkHFa9ThLiC6dO+oeq Ls3L9pWA10qPfHxxWsRMPTSb1lmik8WimKryIAUz2WHBYS/Q8E8uB1Qk+mvCMYMXOp2/ VNgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aUQOiuM8; 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 p10-20020a05620a132a00b0074a44b93927si6010136qkj.272.2023.05.24.08.00.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:00:33 -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=aUQOiuM8; 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 1q1py1-0006kc-4C; Wed, 24 May 2023 10:59:57 -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 1q1pxz-0006eF-QO for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:55 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1pxy-0006XJ-CF for qemu-devel@nongnu.org; Wed, 24 May 2023 10:59:55 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3094871953bso697798f8f.0 for ; Wed, 24 May 2023 07:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940393; x=1687532393; 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=vXln/1eI6qFBBphN0wAdNEHB1hgU4t96Zx44NnYHfMg=; b=aUQOiuM8khuFhFB5866CK13bpsMuZVoiPDRsMlOHnDSlH98FUuOS09p5oU4QKvF2IU mbWDVtEZVE2s9Qm4F9+TWAT/bvYgsVFJCc9WBLa5vPfefuYDORL4lWIOL5dcCpbnNEPq ggoHcFI/LvKSBIL6j27y0bOqACrdGDc8RXyW2F+KBCrd7wxFKB9ly4xNNtpjf6GyFXuj +uKBjNfWK3epULafF2V4W+8vS+DKZ/aIXEXQECV5iy36hoLZQIyZgx//insbriqiS6y6 As0ze+lawE0xLzKNWL332NFe3hQSCPQLbnDEVrufD408INHNjio9EzOoa39ytYw960sY tn+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940393; x=1687532393; 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=vXln/1eI6qFBBphN0wAdNEHB1hgU4t96Zx44NnYHfMg=; b=YPH40rt52bgMwt9cCpX+9fFbGZgJOuOo03bRoFi6yX+xWuTVcXXw2zlyiAn1Y5Ql7W eHz9BgBfbirNtMX4YYmEgxLISqsiBXN8Pgos+oQUdFyy9hCDfjcOpt7S0hzXcntopvmM yvfmw8nFAQjkfTxTsBdaytpu3bWiYl9qdOP+0m+oCw/OW1r+MUyNCdKzAL0Z+ZttbeE7 1Tv7ZsxgFxYnnlTVqCh5trIScLFdGykvf7Kj7dFgwS78AVCkPP6pG0y+s1M7HB8KZRpQ fufrTpsSsBrAUimiHDHcps90/vdyUadGpXQmutaoZbHCZiOYeEkJAJlwcA/D6dx70zjK r5Xw== X-Gm-Message-State: AC+VfDxSbAk+C2OJHUS+Qi5WsYHF4DxsvOHk9MxXtcudtKeu9rUeQoIJ Z9Ue52bkU74VqcJReS3lXncN9vgMqKpOBeDKmJURHQ== X-Received: by 2002:a5d:6889:0:b0:306:30ea:a072 with SMTP id h9-20020a5d6889000000b0030630eaa072mr29449wru.53.1684940392785; Wed, 24 May 2023 07:59:52 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id j1-20020a056000124100b003047ea78b42sm14758972wrx.43.2023.05.24.07.59.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 08/10] hw/arm/realview: Move 'loader_start' to RealviewMachineClass Date: Wed, 24 May 2023 16:59:04 +0200 Message-Id: <20230524145906.33156-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Instead of having each machine instance resolve its loader start address, set it once in their class_init() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 8a3b5a48b1..917a1b22df 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -36,6 +36,7 @@ struct RealviewMachineClass { int board_id; bool is_pb; hwaddr mpcore_periphbase; + hwaddr loader_start; }; typedef struct RealviewMachineClass RealviewMachineClass; @@ -376,7 +377,7 @@ static void realview_init(MachineState *machine, realview_binfo.ram_size = ram_size; realview_binfo.board_id = rmc->board_id; - realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0); + realview_binfo.loader_start = rmc->loader_start; arm_load_kernel(ARM_CPU(first_cpu), machine, &realview_binfo); } @@ -443,6 +444,7 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); rmc->board_id = 0x769; rmc->is_pb = true; + rmc->loader_start = 0x70000000; } static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) From patchwork Wed May 24 14:59:05 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: 685365 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp298602wrt; Wed, 24 May 2023 08:01:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7EwMno61kk71v8Ygt6JUqYpzFhPlcn0jy50KC6j7JF4Lm/lX8+Uo5+JbSTXVAJWW8M2mOg X-Received: by 2002:a05:6214:4008:b0:623:855a:9239 with SMTP id kd8-20020a056214400800b00623855a9239mr23482815qvb.26.1684940512209; Wed, 24 May 2023 08:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940512; cv=none; d=google.com; s=arc-20160816; b=BgG68KzZAbPc56DZs/Kkad8n71WBeFmHq3WMBtEMb6O7JAZn+UzLlfB/qGaAedvZOA 8T6ak7J3I1LdwqHQqEsM4OBRepm1CJtD6bA9x3lwOU98RmHFqGXWWbnn3e5g+qQ8cby9 Wjm0SlD60pR6AB/yFuFQySpnax5XNgR7qHMMrHTheVEOsZ3PJKuG2uCRDkgIUSUldcwi nB9PMk0arY3wuMfUdGM7EHGpgppnVS7B0ZX1JlGoUUnxxTFAfOi1MABUe/XHldbcDWiI SHtKVOldUS8PXNQ9mOQKzEqVlSzCfF0v++z28eJ3IT2Umnlz6v7dNqoxLIAzbGJPNE3t mEkg== 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=mkUxPfgunl3171HVbZ04V4mGlWy5lVrjE2KtHggEcpE=; b=oO6Yllo0t770BjL0y24zucciYDKF6vaXDMGGxQrEf4VmXM+1tTq3pbJKIG41x3gSRW uHv8/1popw+g4tv38oSgu8OUYBqmRMXNud6W4B1dhHakL4DYhVwNYhYpo1KyGh4mPT8R 2iF91OyxosfbhR/itoS0oSr+MLX8y8vV4S55LEQTtIS9+gFAejc2VCX0UKsc+egxR3Dr mB77vhMUKSnHhCVUI2oVFWvJFwAIlgnwIOAKgG0Z6tJzGu6eU2bZJsbBVln/EIOTGZsG uFiyUln1F05uLGAL1NWYlG2W/ofoZiAgZsfvNk+kRn9B5yxizGk6MRNfwfaICKPwQF9A km8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dsRaViDu; 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 r6-20020a0562140c4600b005e6073c7faasi6631095qvj.225.2023.05.24.08.01.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:01:52 -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=dsRaViDu; 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 1q1py7-0006vB-Sp; Wed, 24 May 2023 11:00:03 -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 1q1py6-0006tj-LP for qemu-devel@nongnu.org; Wed, 24 May 2023 11:00:02 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1py4-0006YU-S8 for qemu-devel@nongnu.org; Wed, 24 May 2023 11:00:02 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f603d4bc5bso12488475e9.3 for ; Wed, 24 May 2023 08:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940398; x=1687532398; 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=mkUxPfgunl3171HVbZ04V4mGlWy5lVrjE2KtHggEcpE=; b=dsRaViDu/uGfGzKQ+/hybnBXxuMs8bn7JOsECmoJkLmcGCsHvYrAIQxdqlf0FZZj30 NeoWdHbmpJUmpYKIxeFpnM2+ypHIm3laMcHCC8oUa3Mu2JS+NH5qBQF/hCiQKk4XGKF9 XYZrCN6xpJQE7aTn1CalLBAzmnMl10c1pjaiJGyg4zSec7jiBuIuLJWKHEFoYmEhiwsz 8OtjKjtZVV7u0lzZrlTy21jqooVYYbpPb4wKQ/6fXkyuPM8CVMwppSgIYt1nH2JeHZiL Y7JFgweZI60asp6uYctAuzRgAMHjsyTfjKJq9Vt8CiNyKTrua9anysZzQDkZa12x8m4/ nQzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940398; x=1687532398; 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=mkUxPfgunl3171HVbZ04V4mGlWy5lVrjE2KtHggEcpE=; b=QhszjcaDbPaYztjX7/93zBhnp4utG4l3IxZrivUYWPpOLEJwsg7+pKckBvOZK11zL+ +B9EqGqVDh6KLTm5pcIobhKDBg0JLRvoTIWCbvlAAG1/JPLagPoVlllA9iHzqaiOzufZ lPocE3/AiVR2fs01PJLyTK2DFMSc7abyX/fp8vQPnD8pMpL6OhK9SH/qHYbrp/LcdE6+ NbHZALWqU23fugik4mWEt7ifBDw07SEaIrKD8aNHcARrhNnfXePPFfnjgTn0d68g8ID3 T0JcvKOBYC+TLzmXod1sQUWHXyaI/tYNIDFqDrtKE9srXXvck9MIW5Qa0MAscsdyC5ya R5rA== X-Gm-Message-State: AC+VfDwZKG4Grsif9jopp6VYWJLjqHyT3e6aZ/nWvzeiPiqJtVSpTcrT 3S8M6zK6gEoFI7UgWvL7OaaxZjQ025PG019cTAXMWA== X-Received: by 2002:a7b:c40a:0:b0:3f1:72fb:461a with SMTP id k10-20020a7bc40a000000b003f172fb461amr104066wmi.2.1684940398197; Wed, 24 May 2023 07:59:58 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id f21-20020a7bc8d5000000b003f60a446fe5sm2613241wml.29.2023.05.24.07.59.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 07:59:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 09/10] hw/arm/realview: Use generic realview_common_machine_init() Date: Wed, 24 May 2023 16:59:05 +0200 Message-Id: <20230524145906.33156-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 The realview_board_type enum is now unused. Remove it and have all instances use the common realview_common_machine_init() method. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 917a1b22df..b7bb384000 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -54,13 +54,6 @@ static struct arm_boot_info realview_binfo = { .smp_bootreg_addr = SMP_BOOTREG_ADDR, }; -enum realview_board_type { - BOARD_EB, - BOARD_EB_MPCORE, - BOARD_PB_A8, - BOARD_PBX_A9, -}; - static void split_irq_from_named(DeviceState *src, const char* outname, qemu_irq out1, qemu_irq out2) { DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ); @@ -75,8 +68,7 @@ static void split_irq_from_named(DeviceState *src, const char* outname, qdev_get_gpio_in(splitter, 0)); } -static void realview_init(MachineState *machine, - enum realview_board_type board_type) +static void realview_common_machine_init(MachineState *machine) { RealviewMachineClass *rmc = REALVIEW_MACHINE_GET_CLASS(machine); ARMCPU *cpu = NULL; @@ -103,17 +95,6 @@ static void realview_init(MachineState *machine, ram_addr_t low_ram_size; ram_addr_t ram_size = machine->ram_size; - switch (board_type) { - case BOARD_EB: - break; - case BOARD_EB_MPCORE: - break; - case BOARD_PB_A8: - break; - case BOARD_PBX_A9: - break; - } - for (n = 0; n < smp_cpus; n++) { Object *cpuobj = object_new(machine->cpu_type); @@ -381,30 +362,11 @@ static void realview_init(MachineState *machine, arm_load_kernel(ARM_CPU(first_cpu), machine, &realview_binfo); } -static void realview_eb_init(MachineState *machine) -{ - realview_init(machine, BOARD_EB); -} - -static void realview_eb_mpcore_init(MachineState *machine) -{ - realview_init(machine, BOARD_EB_MPCORE); -} - -static void realview_pb_a8_init(MachineState *machine) -{ - realview_init(machine, BOARD_PB_A8); -} - -static void realview_pbx_a9_init(MachineState *machine) -{ - realview_init(machine, BOARD_PBX_A9); -} - static void realview_common_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + mc->init = realview_common_machine_init; mc->ignore_memory_transaction_failures = true; } @@ -414,7 +376,6 @@ static void realview_eb_class_init(ObjectClass *oc, void *data) RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)"; - mc->init = realview_eb_init; mc->block_default_type = IF_SCSI; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); rmc->board_id = 0x33b; @@ -426,7 +387,6 @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Emulation Baseboard (ARM11MPCore)"; - mc->init = realview_eb_mpcore_init; mc->block_default_type = IF_SCSI; mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); @@ -440,7 +400,6 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Platform Baseboard for Cortex-A8"; - mc->init = realview_pb_a8_init; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); rmc->board_id = 0x769; rmc->is_pb = true; @@ -453,7 +412,6 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) RealviewMachineClass *rmc = REALVIEW_MACHINE_CLASS(oc); mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9"; - mc->init = realview_pbx_a9_init; mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); rmc->board_id = 0x76d; From patchwork Wed May 24 14:59:06 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: 685363 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp298359wrt; Wed, 24 May 2023 08:01:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6HFK79lK69M79MpR/BFqcBcqRAENpSV5Wztup1SmMnPEbNQfhQHAbdKyMiiE+8+qGrgUZY X-Received: by 2002:a05:622a:1316:b0:3f6:b7c9:e443 with SMTP id v22-20020a05622a131600b003f6b7c9e443mr9742398qtk.1.1684940491553; Wed, 24 May 2023 08:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940491; cv=none; d=google.com; s=arc-20160816; b=wKzfAnuz3ZU9rgqFYnTUP4I6sl11qS4tpwsTcI/NBuMmDLGpV4+FXWiEGXKl26gVZu EXDWwIDOuscqBBTjkiS7ztynZH3L4FNl7ptMk6apnEREvh3YOELlviMWu8ur9zriOa7Q RkzSoK0MJfIR0+j3i/I9pLC46H8xo+F5URaf3N47eCZXQ7sV9hDnOWGJw3ypjPz+oDZw CSWdBg01xDqiZaryK1NmK7Gdmnz1Wh+gEWYPQhg0iha72HIUQctHZm2EEIsvl+fFTvGN jgqXbE9/FV/8kb7nrAukZEoxcDz1iMGkOE49ucOK9rRDsgcjTo99KdoWhwxhHnPBzYxP rXvA== 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=kk8jHY5mepVVbmOZAIHsqrtCCvRurLEnDXO0jm3/hbc=; b=to+eWREUimtlkzBvNbmkZWERWNZqrHMq2734dMgswd6YzRtJMJQItp+VRmyUlcHteE fdK+c8JKtpVZVWK1RaB3gUgIEoOmhdIm3YxGrMswXuzNSjSkzAoAzBhGr0aQqz3SpKGp Ck75E0BU3XgfqB2D5TAxxtNHZmrwWrJbInk4PtE9AgabR2O/gEFs8MWoMWVS+nXt7T8x Dxfk7BpsUM9zys4ak/8HHkZuFr3V3cx3UlCG1+sJzUoR4Xk/JtLDF0876rdUop6U8ewf hO3CdBz5PYoKj/1BX3HBe0nDxuMeXiVOAnc5jd+KkQ6gGcAmHkn7T/C1nsOwPwn3mLaC J8Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AIrhM3Au; 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 l12-20020a05622a050c00b003f6ecf7d37dsi571744qtx.427.2023.05.24.08.01.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 08:01:31 -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=AIrhM3Au; 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 1q1pyK-0007GI-8K; Wed, 24 May 2023 11:00:16 -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 1q1pyE-000779-9w for qemu-devel@nongnu.org; Wed, 24 May 2023 11:00:10 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1py9-0006gJ-DM for qemu-devel@nongnu.org; Wed, 24 May 2023 11:00:09 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-309382efe13so686595f8f.2 for ; Wed, 24 May 2023 08:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684940403; x=1687532403; 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=kk8jHY5mepVVbmOZAIHsqrtCCvRurLEnDXO0jm3/hbc=; b=AIrhM3Aulmqe+FCp8DksBqIW4DT3ESrVWIMlILTFSkxfKoMmVp6JCBk4yVuhNz7mtn KH0Dvh3c+XMMvdWJVWSJQ+Su2c4+Wy6/jhPyvMsSQVPoIfkmB3+mEQ/bF+JgwFBVvgjw hyi1Avw3bX6i+MvP35JxoyI1475l+5wo3kFzpm65KTPvV41H3V1B0sphd4o1vI2lDy9F trQi5xesM8+Pt3BYIkbqxS8Ap0hPZ/TZ5rwhsRmOsJT/EoMaUUA0QtB9tCMoGJAYMhKR vlqB7ilghf7BWB9G1kJsVBZtN9Cm2wL3Ht+BrOcuJ5TOJn01AC8wcNC4vgJoU4XvE+yn iAxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684940403; x=1687532403; 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=kk8jHY5mepVVbmOZAIHsqrtCCvRurLEnDXO0jm3/hbc=; b=eUym+cVIyF36di8kKnYFxP05MxmiyO4+BjxI/Ms0Uz6juz0C1s44FrlD8HmJ7QpgHi CZV9hKseRHraziN0GeKWVz/sWPqyLvCD/K0LYRekmLvxAYBaBVnlGY+50WAo0FeZR1fW sjYMhAQnEOxinCiD9QiPbZLd3f4YeNjQHOQ5xJkH6cGqMm6T6OkB1IOL4PTOEBcMly7z MGD/AJ6Z+vjgx0fNA824wV3rThJU+gcmv/1WaM4qCIKD6/xbndOUTgxP0JKoS3Wq5wKa zYkHEYYt/IO0Aid6Mw+vLIc7rFm+bKWpaxB4ni9BQZnYwWUIXVKQFpobOXXssnliXy+I P4dg== X-Gm-Message-State: AC+VfDzFoxhUlKEF820r/Csn1Ex0wXC1IBJPLqq//GX2TukcZEYjLFfe OeU65+O0CwoT9aH8mu3EgglBEdZaQjOVoXpPZGk1WQ== X-Received: by 2002:adf:ee05:0:b0:306:2b83:2d32 with SMTP id y5-20020adfee05000000b003062b832d32mr49767wrn.43.1684940403553; Wed, 24 May 2023 08:00:03 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-193.dsl.sta.abo.bbox.fr. [176.184.31.193]) by smtp.gmail.com with ESMTPSA id q3-20020adff783000000b002e61e002943sm14656962wrp.116.2023.05.24.08.00.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 08:00:03 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 10/10] hw/arm/realview: Set MachineClass::default_nic in machine_class_init() Date: Wed, 24 May 2023 16:59:06 +0200 Message-Id: <20230524145906.33156-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230524145906.33156-1-philmd@linaro.org> References: <20230524145906.33156-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Mark the default NIC via the new MachineClass->default_nic setting so that the machine-defaults code in vl.c can decide whether the default NIC is usable or not (for example when compiling with the "--without-default-devices" configure switch). Inspired-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/realview.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index b7bb384000..0b2d6b82c8 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -70,6 +70,7 @@ static void split_irq_from_named(DeviceState *src, const char* outname, static void realview_common_machine_init(MachineState *machine) { + MachineClass *mc = MACHINE_GET_CLASS(machine); RealviewMachineClass *rmc = REALVIEW_MACHINE_GET_CLASS(machine); ARMCPU *cpu = NULL; CPUARMState *env; @@ -274,7 +275,7 @@ static void realview_common_machine_init(MachineState *machine) for(n = 0; n < nb_nics; n++) { nd = &nd_table[n]; - if (!nd->model || strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0) { + if (!nd->model || strcmp(nd->model, mc->default_nic) == 0) { if (is_pb) { lan9118_init(nd, 0x4e000000, pic[28]); } else { @@ -378,6 +379,7 @@ static void realview_eb_class_init(ObjectClass *oc, void *data) mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)"; mc->block_default_type = IF_SCSI; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); + mc->default_nic = "smc91c111"; rmc->board_id = 0x33b; } @@ -390,6 +392,7 @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_SCSI; mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); + mc->default_nic = "smc91c111"; rmc->board_id = 0x33b; rmc->mpcore_periphbase = 0x10100000; } @@ -401,6 +404,7 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) mc->desc = "ARM RealView Platform Baseboard for Cortex-A8"; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); + mc->default_nic = "lan9118"; rmc->board_id = 0x769; rmc->is_pb = true; rmc->loader_start = 0x70000000; @@ -414,6 +418,7 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9"; mc->max_cpus = 4; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); + mc->default_nic = "lan9118"; rmc->board_id = 0x76d; rmc->is_pb = true; rmc->mpcore_periphbase = 0x1f000000;