From patchwork Thu Jan 25 05:55:40 2024 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: 765939 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp2458596wrx; Wed, 24 Jan 2024 21:57:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7/n+Xnh7wrAydCe/YjQwVWh+sKGN8ODgS+RJRUFp8XGBqMc9Wgdqry1H9REKmFjbsPwyS X-Received: by 2002:a05:6808:d51:b0:3bd:c29e:9338 with SMTP id w17-20020a0568080d5100b003bdc29e9338mr575167oik.28.1706162222590; Wed, 24 Jan 2024 21:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706162222; cv=none; d=google.com; s=arc-20160816; b=haHhQw6UfBqRvt9jMx8nxY157FceCf2g/6ubF8X+YOo6I2hFANaumGm5tFLpkBAWRa ipQfaBtHCnIwPyp2pCslsF3KsD9UMNiXubI/7xItlrg++EOh8+hWY50g4my0cHs/Pfj6 8ZFiBRFhX1Sy+j7wwFaBEZ/3oTIQUFQrECNe6LBM2NAmlW41DjxfXn4lNXf0nsuK5EgQ Hx+eRTQ0FtmzgDR4K+0QlL5uldtCosj7TA5PihPnZAws3i4iC3TGr7uhURpcvi1OpIYn xQ7uw5YYPfzU1N5zsIKp/Qak8Am40Y9miYChquNeVXW1O8lCXWnH6YbyXmVtvtbdEmyK 1ZAQ== 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=Gkow43WWl5V6H8QLUuDhGBGmx/UArXnxCzhocw6DFQw=; fh=mgkM7j5chzFeBdbp6jSghBOXKGtgf9vcQQUOsrmpdjA=; b=L3v3Pd+Z2NGG/y9uJpEebdRSK5SicdmAz4rl5C32SMASK6hjZaPN4ssxtN1QIoaZ4V pf6WJlME3y72ktwivyhwyn1eEVnygQzGgB8eOd6vbL824K9qdFDH+2SbzzgvPjK4hoXY ECocmGWIZ3IphB55jrBFmEp4diTwXqzLGcLRo/Rvrql90gHnNc9tpYAtsuaS01gnmmg6 Pfol7YHvDlrJPkwGaVriY+SxXFOKNtLBpV46z+3DOlkaYNiSuGQwXb6R58J0InliXjrg rlrYg+KmBY3pK2yTE+YnMtlO0Ro8d4fxhXMFLZotWvRsiAej6FndzyUhGeCihKdyWlm/ H/RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MSXfe48S; 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 n1-20020ac85a01000000b0042a4f92229dsi5439835qta.271.2024.01.24.21.57.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2024 21:57:02 -0800 (PST) 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=MSXfe48S; 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 1rSsiW-0003I5-0m; Thu, 25 Jan 2024 00:56:00 -0500 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 1rSsiT-0003HG-L9 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:55:57 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSsiS-00016q-3I for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:55:57 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40eb033c1b0so44445895e9.2 for ; Wed, 24 Jan 2024 21:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706162153; x=1706766953; 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=Gkow43WWl5V6H8QLUuDhGBGmx/UArXnxCzhocw6DFQw=; b=MSXfe48SzhIzxgIUwQuWi1PlbtR4vLrLSb5TL45jPhm1AZ4ruhZ9UexPQmPgu+W03s MB4fxp+ZNe2DxfK62LkxQmdtERTeaxJPc25c8wf4u8avuxT4gccBN3KmMriXuDa0Gs9v VsU2RXu7mD7mmoDrTDMArdSzFGnCpDXAPniDHSfcpUt4LvWGz4/OO4XTtAQMSXc45TQh TenmjMeXXDqNlyqMKC1xiC2jxecWQj5HeLzyCJ8ivdqCRiBL0UM3PoiGtMTC/iSh+1dR 2JshvHTADl+cJlwSzeEdmxU/RY8duAlv2IzydHy3BsduM3HogecxKH8dJIf6fqLJXQq3 pz4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706162153; x=1706766953; 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=Gkow43WWl5V6H8QLUuDhGBGmx/UArXnxCzhocw6DFQw=; b=buBS0cj2/yzbxNVIPUbyNOQUBDBOlpFXwdlQR5q8vMBb6I4HhQ+o8cBK6hWdo5B9v0 pfXoThTFtQ/bFHHnrSGkorhJ0/OjdXvZfpu9NP7gPlgyiqEr79guN3DguZ9QLG7RbzgG HfNTD2r5+XajCqJjMe7daAb2L4WvPIuPPMCCHXWdgRciAkr9LUPp7bnwJ6wvMC/u1L80 EJ3FDtar0uUkRfSEuw+ZZK5oZFtIOjjDtNgPRZE3a+TIL1Vpj1N6a/1xs1DUYLrAuXil FUG5IWTe8K1nUY93C5enGIzAP3QlxuJsn2Xgyj/Nli97E0JaQ5IVUXaJPDkytSy+J2Ng 6JpA== X-Gm-Message-State: AOJu0Ywf0aH3Ji37XXaKbn1bflhg24BaVyonzMyU0EfKZcWhwn/zOun6 cDhlssyVli3E/xX7eTopSF3SKBkayJje76ysc6VPbxzazZ3l07il9zuxU4rkdTJtALQNq95RVhk K X-Received: by 2002:a05:600c:34ce:b0:40e:5bb8:7fb1 with SMTP id d14-20020a05600c34ce00b0040e5bb87fb1mr175548wmq.47.1706162153220; Wed, 24 Jan 2024 21:55:53 -0800 (PST) Received: from m1x-phil.lan (lec62-h02-176-184-19-125.dsl.sta.abo.bbox.fr. [176.184.19.125]) by smtp.gmail.com with ESMTPSA id he7-20020a05600c540700b0040ead97f70dsm1228336wmb.24.2024.01.24.21.55.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 21:55:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= , qemu-arm@nongnu.org, Andrew Jeffery , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Gavin Shan Subject: [PATCH v3 1/5] hw/arm/aspeed: Remove dead code Date: Thu, 25 Jan 2024 06:55:40 +0100 Message-ID: <20240125055544.79405-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240125055544.79405-1-philmd@linaro.org> References: <20240125055544.79405-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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 Remove copy/paste typo from commit 6c323aba40 ("hw/arm/aspeed: Adding new machine Tiogapass in QEMU"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan --- hw/arm/aspeed.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index cc59176563..4bc292ff84 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -1301,7 +1301,6 @@ static void aspeed_machine_tiogapass_class_init(ObjectClass *oc, void *data) mc->default_ram_size = 1 * GiB; mc->default_cpus = mc->min_cpus = mc->max_cpus = aspeed_soc_num_cpus(amc->soc_name); - aspeed_soc_num_cpus(amc->soc_name); }; static void aspeed_machine_sonorapass_class_init(ObjectClass *oc, void *data) From patchwork Thu Jan 25 05:55:41 2024 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: 765943 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp2458887wrx; Wed, 24 Jan 2024 21:58:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxkJu8RH170jM6zKu6g5SeuMYfEknmEJ8c7keU7YhLcy2uGlUff9jBXmA4HG3PxyUu7L6H X-Received: by 2002:a05:6808:301f:b0:3bd:cc24:c02e with SMTP id ay31-20020a056808301f00b003bdcc24c02emr482857oib.16.1706162302561; Wed, 24 Jan 2024 21:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706162302; cv=none; d=google.com; s=arc-20160816; b=cw6HVVrBCIKc2TlmoXlX+E5alPIvxyJ6LBxeYW3ANSFuJKWX1DV4JBgxxXksoyiF0K qPWKvmzcqQL7YMQ9UzEOL0j00Vzb08ucXI5oFFp5Z83pJZG6h3XsmRcnT9AaDnwq7Hyo ZWUwSjxbkez3/h9V12I47Ky5y8AARMUfPcCKrr3PEhJzb79uHXhHISPoNrGeQVCbe0zJ NOqZTPLjEmTJVnoUBe1qlhsKK11/l/IBryYJufUufjqdjym7NHgOxuVAQBr1Evwz33t5 U07/xoejvfA9ab9kPq6Wh64uZisvpyyjMkg4V6XaimfBPJwf4vLldRLbyCoHSG2u7GWW 8H3w== 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=LJEHUrHwrIT1rKWRwjxDbaX0Pfnq9aLQleOdaQTs5wo=; fh=FNlwegs1oJP6A4COwutP1+wiMlDn5TeDvVO/NojbsqU=; b=MsI0Z9pgzew0wW8wj1R0nqOQzKFG8T1GMRugFe9ktnDnfsiP7fWOu0ubPyvhIWcgJp 2Xj28TfIIF4AcVgMIbZMYTm08BV1PeCivfbKI9sMhZaYIA9korZ92y64CUjm7Y4gVjN4 3HJeJGauNusk8MeY++xKVB6HGrj0Op2n5KA/uYJMMS1dwIcN0YCCvaesEwbZ8r9G68wB AJag5WHwgWRfJcqQWBVyiNKkQQKy9vnmmvkst+s/DSegAnxXwEkKedE/lX+VUnT/1w0b +S/cy2Xuf7pLMTgN8rBXGrm01tRXQmrbPxnSoQAKkmrTbeW7f5WvIhqaGaxyAguTlMCv qeWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzZS1YwB; 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 h7-20020ac85847000000b0042a52afce6dsi4792143qth.55.2024.01.24.21.58.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2024 21:58:22 -0800 (PST) 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=QzZS1YwB; 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 1rSsia-0003Io-K2; Thu, 25 Jan 2024 00:56:04 -0500 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 1rSsiY-0003IO-P4 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:02 -0500 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 1rSsiW-00017c-LH for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:02 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40ed252edd7so617125e9.0 for ; Wed, 24 Jan 2024 21:56:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706162159; x=1706766959; 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=LJEHUrHwrIT1rKWRwjxDbaX0Pfnq9aLQleOdaQTs5wo=; b=QzZS1YwBmtBz3ojbAGMurPXeDuyjSwwAegyNdVCF3farpbgdKjFSKsy/eRgwkcsUB3 Ak5G0fgXwhvjFIvODWpQeAg4yqATEwimOFucOBAf1RxzsbluoeCtQgEvF0O8jsjAXbaN BIay5ZUcfFbz/BRtwa1vLGNgs68OT/P0xRSIeVHDK5sYYPojanN3yQcajVqf5uT37bWp swvK1WkE2aSZ6SFgP7IBLRHUyXRFYcFRpL3R5CyxqP85XQ5jWA5WiJs28SCBhwd/QFJM zV3w2n+m398sszlDEcKq+b4lI2xgxlfpDDzOR/VR4lmcafle5/eoVZz5WVOPwQRbUb9h eOHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706162159; x=1706766959; 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=LJEHUrHwrIT1rKWRwjxDbaX0Pfnq9aLQleOdaQTs5wo=; b=KEfRKUC5HP9p1Ckt33fzXEVAYLqx7P+A12exg0mH0v/pd3vHYN5ns8eIekocHVAq3L A4UAx3+WHv7xxHrqbDarSHWz4EICOBuouEcWAb+EPzxq0OGz427Nf8cJtvQk3Yd61tJk /N4aNFLJoOAu9I5PyoW8Pl39rvkkkAsAiYPLgHLMv/htiGiNUud5W7LEHHK+7aV8xf1l Tf655xEd9yZTsogxeg/V7NYvR7nY2tU6OwskFZiAqg4PGiq6aweb9w5EQcwtLRA/Ex4j jv0qWzxSD/PSs7XYqegESPdutSTSlTkMmj0sUbICVaSvtyic37DEtm+OeotsvIejHkzo 8+XA== X-Gm-Message-State: AOJu0Yw2jojCWBeMMCPV/77l19Gj1g4c/4lLHjVYD7aDEoBS0A7MlAIt 3spht01mFjmeJHRg5j5yj127N/VDAwNQcqllWLGg8likomd4X2FojjW6El1t/iYVL+CeNBOzEVO 9 X-Received: by 2002:a05:600c:a41:b0:40e:89fe:255b with SMTP id c1-20020a05600c0a4100b0040e89fe255bmr109927wmq.160.1706162159016; Wed, 24 Jan 2024 21:55:59 -0800 (PST) Received: from m1x-phil.lan (lec62-h02-176-184-19-125.dsl.sta.abo.bbox.fr. [176.184.19.125]) by smtp.gmail.com with ESMTPSA id fk15-20020a05600c0ccf00b0040e9f7dadc6sm1246791wmb.25.2024.01.24.21.55.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 21:55:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= , qemu-arm@nongnu.org, Andrew Jeffery , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gavin Shan Subject: [PATCH v3 2/5] hw/arm/aspeed: Set default CPU count using aspeed_soc_num_cpus() Date: Thu, 25 Jan 2024 06:55:41 +0100 Message-ID: <20240125055544.79405-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240125055544.79405-1-philmd@linaro.org> References: <20240125055544.79405-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=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 commit b7f1a0cb76 ("arm/aspeed: Compute the number of CPUs from the SoC definition") Aspeed machines use the aspeed_soc_num_cpus() helper to set the number of CPUs. Use it for the ast1030-evb (commit 356b230ed1 "aspeed/soc: Add AST1030 support") and supermicrox11-bmc (commit 40a38df55e "hw/arm/aspeed: Add board model for Supermicro X11 BMC") machines. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Reviewed-by: Gavin Shan --- hw/arm/aspeed.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 4bc292ff84..5b01a4dd28 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -1212,6 +1212,8 @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc, amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON; amc->i2c_init = palmetto_bmc_i2c_init; mc->default_ram_size = 256 * MiB; + mc->default_cpus = mc->min_cpus = mc->max_cpus = + aspeed_soc_num_cpus(amc->soc_name); } static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc, @@ -1586,11 +1588,12 @@ static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc, mc->init = aspeed_minibmc_machine_init; amc->i2c_init = ast1030_evb_i2c_init; mc->default_ram_size = 0; - mc->default_cpus = mc->min_cpus = mc->max_cpus = 1; amc->fmc_model = "sst25vf032b"; amc->spi_model = "sst25vf032b"; amc->num_cs = 2; amc->macs_mask = 0; + mc->default_cpus = mc->min_cpus = mc->max_cpus = + aspeed_soc_num_cpus(amc->soc_name); } static void aspeed_machine_qcom_dc_scm_v1_class_init(ObjectClass *oc, From patchwork Thu Jan 25 05:55:42 2024 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: 765940 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp2458597wrx; Wed, 24 Jan 2024 21:57:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/MoVeCDygzESPwAdzKUEIo5SX3xNLzWea9cAqXbzJtKZH39z3Y6qpsT6LmQ6p0PWNc4co X-Received: by 2002:a05:620a:28d3:b0:783:54e5:6428 with SMTP id l19-20020a05620a28d300b0078354e56428mr1256415qkp.9.1706162222666; Wed, 24 Jan 2024 21:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706162222; cv=none; d=google.com; s=arc-20160816; b=D9Ou/XVMcfG0pY24XqvQ8p7TdYLb97pQtjElxeDJmKAqZAJt8M1xqC/9ml4sYLA8tJ x8qDetIJrEWl6YwcrqqO3dcU658kWq07iyuwErQHlRdSrcNg/7UOP+Z28et7+AZIWca5 olXpR5PLYlLaLIfaTHsXgVuWdLA3Mvf5ifbAtjEzK+GEtsrtS+p5/IhpqCgZ/ATbPjpo 6fSNeF+PlBZLyK123mImXowbcFEW1HNJDriaLhC1AFZ65cz+ou9pC8u5uHN6vnJ/owNi oY2dgI6oUg2RjMuNtM6rDLmvX8vf6YBam05CZxJ/PPUk8V1CzyhmtexS//P1jprooddz I0Jw== 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=QNfhqMn/7H2JfeWtmxECGiPrj1Y1rofAyE4BiaQU4SY=; fh=mgkM7j5chzFeBdbp6jSghBOXKGtgf9vcQQUOsrmpdjA=; b=XVgI/x1ihPCH4IlTmddiLgtomLLg5OhwzBBIi8QVmhDVwlZMYKOanOeKP9ZaRWc9UN dDo5Se3R+38W8FPZTt/EOHDMyfGeZFtznLK2EMZhZfaovR8kKJNtBvksTFxMxz4F9nvs rXIE8Wg0hIW3+GYxI2F4K/nZuCOfuXATF0QEdW+HPUq3ifb/sZm08hrqjiWFbk2g2JOl If9NlvvMhBk0kJbGMSlZb6Yh+0t5/vm1q/QO9cTUpXkoPyKHrLyHf0ZpdaeX6T6Hfk/U 9Pj49nwm5sRwNkBtrlrfDuXO85FZuep3hAE4BIVww0iF9ggFZmVeG60Ux1+uWOYlyyXQ n0ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sPc1cilO; 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 j11-20020a37c24b000000b00783a6e87c49si6243685qkm.175.2024.01.24.21.57.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2024 21:57:02 -0800 (PST) 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=sPc1cilO; 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 1rSsig-0003Ke-UA; Thu, 25 Jan 2024 00:56:10 -0500 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 1rSsif-0003Jq-Mw for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:09 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSsic-00018I-97 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:09 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40e76626170so69884135e9.2 for ; Wed, 24 Jan 2024 21:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706162165; x=1706766965; 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=QNfhqMn/7H2JfeWtmxECGiPrj1Y1rofAyE4BiaQU4SY=; b=sPc1cilOChH3JpCpyzRlp+5TeKZssyJkXjkhvvztNSeu5eHmhYfb8U+Z9hyHUTpsBr PwyTfEA4X2dwf5rgM5NSArzU3eqlKWxzhdN1Ge3bU4hnmy6Dua6Tok4usUqxDGy1LPAC ekHzvmWXndbt55uD4zL1gZtoT3HmH8tuQHFweOHAAGUvflz7i27BXldyZXiLFwWZphRs oh1ynrJf5JGzXxrsy/AKbkSW4qrJmh+fJoJhgslDQvdIGRWTvvNQnUc0i6tArLJKIrnv feDDRkMob0jdofxD+Z5AmUlksT0da9W7Vjkji/PrQY3HWSN00ZphggOeHRPc7QW/27EE z7IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706162165; x=1706766965; 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=QNfhqMn/7H2JfeWtmxECGiPrj1Y1rofAyE4BiaQU4SY=; b=v3WCdFtiyX8cbc5baPrl8FlUEkQ0UOjEH2Xez+ovDqEMIneb7jUDWLTR97kUmJqDEq Ig8sIMPGGQE7qA+VTUSUucsmyVPPLWMSI5UMeNU+9m1wnhK6Vczwamvo4sdjSX4S8NfY Pix6ZheAfDwLxgMoSeVC2jkqA0guoQREb6xjSIa3FfeTXBeLsYZ8cfLYFb6VFW37+Cip bqm876nSguBhlrR64+KI9ckjuYuW7XLE85tRfYsMaQcistel2JXqZFU9nantSsRc/c9X 0mJblTssG5vXvtTigI1H/ZDODh0W+tvGoQeyWMI3ySL6n8RwHS3n9eL8HuzDxtTq8wT7 p55w== X-Gm-Message-State: AOJu0YxhOXb3mjXwn84pvOZHsc/zN1gFBGLXJQ6lHHiy/OCVSG2MR1ey 6fqq+cLFV5zsJlRupt5fmCKtK64HN/p4ISy7gGRUWNBCTwQB/PQIEIxwMsR5cB2ZPZ1mdMgJ0iS b X-Received: by 2002:a7b:cb8a:0:b0:40e:5cb5:916c with SMTP id m10-20020a7bcb8a000000b0040e5cb5916cmr156743wmi.129.1706162164694; Wed, 24 Jan 2024 21:56:04 -0800 (PST) Received: from m1x-phil.lan (lec62-h02-176-184-19-125.dsl.sta.abo.bbox.fr. [176.184.19.125]) by smtp.gmail.com with ESMTPSA id je1-20020a05600c1f8100b0040e5cf9a6c7sm1277836wmb.13.2024.01.24.21.56.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 21:56:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= , qemu-arm@nongnu.org, Andrew Jeffery , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Gavin Shan Subject: [PATCH v3 3/5] hw/arm/aspeed: Init CPU defaults in a common helper Date: Thu, 25 Jan 2024 06:55:42 +0100 Message-ID: <20240125055544.79405-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240125055544.79405-1-philmd@linaro.org> References: <20240125055544.79405-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 Rework aspeed_soc_num_cpus() as a new init_cpus_defaults() helper to reduce code duplication. Reviewed-by: Cédric Le Goater Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/aspeed.c | 71 +++++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 43 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 5b01a4dd28..d2d490a6d1 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -1141,10 +1141,14 @@ static void aspeed_machine_class_props_init(ObjectClass *oc) "Change the SPI Flash model"); } -static int aspeed_soc_num_cpus(const char *soc_name) +static void aspeed_machine_class_init_cpus_defaults(MachineClass *mc) { - AspeedSoCClass *sc = ASPEED_SOC_CLASS(object_class_by_name(soc_name)); - return sc->num_cpus; + AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(mc); + AspeedSoCClass *sc = ASPEED_SOC_CLASS(object_class_by_name(amc->soc_name)); + + mc->default_cpus = sc->num_cpus; + mc->min_cpus = sc->num_cpus; + mc->max_cpus = sc->num_cpus; } static void aspeed_machine_class_init(ObjectClass *oc, void *data) @@ -1176,8 +1180,7 @@ static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data) amc->num_cs = 1; amc->i2c_init = palmetto_bmc_i2c_init; mc->default_ram_size = 256 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_quanta_q71l_class_init(ObjectClass *oc, void *data) @@ -1193,8 +1196,7 @@ static void aspeed_machine_quanta_q71l_class_init(ObjectClass *oc, void *data) amc->num_cs = 1; amc->i2c_init = quanta_q71l_bmc_i2c_init; mc->default_ram_size = 128 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); } static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc, @@ -1212,8 +1214,7 @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc, amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON; amc->i2c_init = palmetto_bmc_i2c_init; mc->default_ram_size = 256 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); } static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc, @@ -1231,8 +1232,7 @@ static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc, amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON; amc->i2c_init = palmetto_bmc_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); } static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data) @@ -1248,8 +1248,7 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data) amc->num_cs = 1; amc->i2c_init = ast2500_evb_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_yosemitev2_class_init(ObjectClass *oc, void *data) @@ -1266,8 +1265,7 @@ static void aspeed_machine_yosemitev2_class_init(ObjectClass *oc, void *data) amc->num_cs = 2; amc->i2c_init = yosemitev2_bmc_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_romulus_class_init(ObjectClass *oc, void *data) @@ -1283,8 +1281,7 @@ static void aspeed_machine_romulus_class_init(ObjectClass *oc, void *data) amc->num_cs = 2; amc->i2c_init = romulus_bmc_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_tiogapass_class_init(ObjectClass *oc, void *data) @@ -1301,8 +1298,7 @@ static void aspeed_machine_tiogapass_class_init(ObjectClass *oc, void *data) amc->num_cs = 2; amc->i2c_init = tiogapass_bmc_i2c_init; mc->default_ram_size = 1 * GiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_sonorapass_class_init(ObjectClass *oc, void *data) @@ -1318,8 +1314,7 @@ static void aspeed_machine_sonorapass_class_init(ObjectClass *oc, void *data) amc->num_cs = 2; amc->i2c_init = sonorapass_bmc_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_witherspoon_class_init(ObjectClass *oc, void *data) @@ -1335,8 +1330,7 @@ static void aspeed_machine_witherspoon_class_init(ObjectClass *oc, void *data) amc->num_cs = 2; amc->i2c_init = witherspoon_bmc_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data) @@ -1355,8 +1349,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data) ASPEED_MAC3_ON; amc->i2c_init = ast2600_evb_i2c_init; mc->default_ram_size = 1 * GiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data) @@ -1374,8 +1367,7 @@ static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data) amc->macs_mask = ASPEED_MAC2_ON; amc->i2c_init = witherspoon_bmc_i2c_init; /* Same board layout */ mc->default_ram_size = 1 * GiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_g220a_class_init(ObjectClass *oc, void *data) @@ -1392,8 +1384,7 @@ static void aspeed_machine_g220a_class_init(ObjectClass *oc, void *data) amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON; amc->i2c_init = g220a_bmc_i2c_init; mc->default_ram_size = 1024 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_fp5280g2_class_init(ObjectClass *oc, void *data) @@ -1410,8 +1401,7 @@ static void aspeed_machine_fp5280g2_class_init(ObjectClass *oc, void *data) amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON; amc->i2c_init = fp5280g2_bmc_i2c_init; mc->default_ram_size = 512 * MiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_rainier_class_init(ObjectClass *oc, void *data) @@ -1429,8 +1419,7 @@ static void aspeed_machine_rainier_class_init(ObjectClass *oc, void *data) amc->macs_mask = ASPEED_MAC2_ON | ASPEED_MAC3_ON; amc->i2c_init = rainier_bmc_i2c_init; mc->default_ram_size = 1 * GiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; #define FUJI_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) @@ -1451,8 +1440,7 @@ static void aspeed_machine_fuji_class_init(ObjectClass *oc, void *data) amc->i2c_init = fuji_bmc_i2c_init; amc->uart_default = ASPEED_DEV_UART1; mc->default_ram_size = FUJI_BMC_RAM_SIZE; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; #define BLETCHLEY_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) @@ -1472,8 +1460,7 @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data) amc->macs_mask = ASPEED_MAC2_ON; amc->i2c_init = bletchley_bmc_i2c_init; mc->default_ram_size = BLETCHLEY_BMC_RAM_SIZE; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); } static void fby35_reset(MachineState *state, ShutdownCause reason) @@ -1515,6 +1502,7 @@ static void aspeed_machine_fby35_class_init(ObjectClass *oc, void *data) amc->i2c_init = fby35_i2c_init; /* FIXME: Replace this macro with something more general */ mc->default_ram_size = FUJI_BMC_RAM_SIZE; + aspeed_machine_class_init_cpus_defaults(mc); } #define AST1030_INTERNAL_FLASH_SIZE (1024 * 1024) @@ -1592,8 +1580,7 @@ static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc, amc->spi_model = "sst25vf032b"; amc->num_cs = 2; amc->macs_mask = 0; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); } static void aspeed_machine_qcom_dc_scm_v1_class_init(ObjectClass *oc, @@ -1612,8 +1599,7 @@ static void aspeed_machine_qcom_dc_scm_v1_class_init(ObjectClass *oc, amc->macs_mask = ASPEED_MAC2_ON | ASPEED_MAC3_ON; amc->i2c_init = qcom_dc_scm_bmc_i2c_init; mc->default_ram_size = 1 * GiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static void aspeed_machine_qcom_firework_class_init(ObjectClass *oc, @@ -1632,8 +1618,7 @@ static void aspeed_machine_qcom_firework_class_init(ObjectClass *oc, amc->macs_mask = ASPEED_MAC2_ON | ASPEED_MAC3_ON; amc->i2c_init = qcom_dc_scm_firework_i2c_init; mc->default_ram_size = 1 * GiB; - mc->default_cpus = mc->min_cpus = mc->max_cpus = - aspeed_soc_num_cpus(amc->soc_name); + aspeed_machine_class_init_cpus_defaults(mc); }; static const TypeInfo aspeed_machine_types[] = { From patchwork Thu Jan 25 05:55:43 2024 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: 765941 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp2458708wrx; Wed, 24 Jan 2024 21:57:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEw8tbVoVIdWEdzABxdjk2clC9LCzD0c7EufBThgtz79/2YMP17ul2XJfcOWEjZ3KNcj7tD X-Received: by 2002:a54:4109:0:b0:3bd:d667:dab1 with SMTP id l9-20020a544109000000b003bdd667dab1mr422262oic.93.1706162254039; Wed, 24 Jan 2024 21:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706162254; cv=none; d=google.com; s=arc-20160816; b=kwTtphpIfSXJsGiWmH29FvAtmuue+pjrIPzZO95a/4Ld5OAG1JqVSdcJI9fyQ4Yyij pZ0/jguBGR256ZNmpLRQgYK6btx9ZLJiW4bTzz0ukj479qF3EZ/Jwqilq15NiLZTXr7F Nnf/HmvBaavpXpQgV/cf5VQkgzDulRegy7WtrQiiyiOCk61j9Vn2n3X9TiLwfPR8WVX/ HoE1vI6l54pS1OIh3pldkNgjleyamgZEupODgpYcYGOLZa6IsJ1YcT6UgLpP/XqFzq91 PdrVOHGUfXju5Kq7uzYR1zyb3J8spJ5fcj/VG72CjFS9NzBcLOvYUSFdy9T1pQR6PwUq UIOg== 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=34UBB3mcO7ZaMebRDdhjL43nDYc+kT1XdddwXkamjjk=; fh=mgkM7j5chzFeBdbp6jSghBOXKGtgf9vcQQUOsrmpdjA=; b=Nah0hO6mEs2yEbaA3YWVOjDSqdbvGmrv8VG1G+uh0uMIqVN+SsCtbpWcdsilSxjpxM oUJ5V2qxvT8WqB5yKE1UPOz/UlRr0xfVxjoEsH1byQY+qh6wv0wKRx2dLhNcFB41p6rL bN8VL6tn5j5VHJ0so/YlVLCyVDxBFSG19Cw7U/RhDaPwaD2tA8+w7bIZwG3bEsR3H1F0 1mVQF26TJxAeq4C/zOYR8/07E1BvNhhgtA3M8Yud9EfAw+ASMKS9SVHCXoSw42kc0RkS s2G2M21RI7kuV4Fbcq/4A5gfyeFNG6XeGo26JGEYutGNgI7wchVZ18NMDmGHf7lUi+KQ 8mng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AJOD2qsj; 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 y6-20020a05622a004600b0042a5b09c32dsi3703101qtw.483.2024.01.24.21.57.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2024 21:57:34 -0800 (PST) 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=AJOD2qsj; 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 1rSsil-0003Lj-61; Thu, 25 Jan 2024 00:56:15 -0500 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 1rSsij-0003L2-N8 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:13 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSsii-0001HZ-52 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:13 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40e86a9fc4bso80881115e9.2 for ; Wed, 24 Jan 2024 21:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706162170; x=1706766970; 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=34UBB3mcO7ZaMebRDdhjL43nDYc+kT1XdddwXkamjjk=; b=AJOD2qsjuOMgUJiH6dXazUzrsg/oRCT1tB4R/7yEF/0RaNOzUfVjq3HOGmPNG+/WiL UdFpYJtGpUKw8fhlt43gfmC+IFFQdXQ0Jsat+XLZPizuWrWS/WEjUSVRBepwuG+10c7V ETE89q5RY163sfNKEzuuc9nm/cq9+v1hqBbPL4UdCXWOlApGzunKvB+Xkx2Sl5JXDgNH yPwRSItNdmczWqP7zP4IVwo5USpkOfONsVvKFbsW8jDu+bahKOXf665RqwaNc00ViKlL jfd5fRSefZWYIRHr0Z9Qrc3B0g+zTFJiBXH8O6d5P+Oo2IBU7vWaduJbncVhItKcstw7 PDEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706162170; x=1706766970; 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=34UBB3mcO7ZaMebRDdhjL43nDYc+kT1XdddwXkamjjk=; b=NpaUO8eznochg3qMmiwWW8oEdp42Er2KJIz6WIMrKQLoISDhj2EpM2iq3e/lGdn8Xm h8aC/17nxlA1+eIMEUpysfKDXRuG9fz72Y8gvgLtGTbjcND3wdb6yDHwYvPKXbOkD22C 87vp80tpg6H9Lk2VBBYsWt5HHOiGRh49ZNcWbEIkBiY9rGmiKRGgY823oqXAhn163dlt xgtCF7eEaSnJjpWxzbYgHBSePKWBk6sCv1CP3KFgqQRi0/5eH2m7+e7wv+THYVx/4juf hpOjPv4vevCBAZ0/BDO+ErtUGRtdO9ABiXbcu3LbpdjXmhLYPRaTVFKt5usTvBwpRtyQ k4WA== X-Gm-Message-State: AOJu0YzgANhksaBBLls5rNY5PHZHspTWkX08eK9uaB6YwWvJs/4U8c7R jCTh7uNtW2TNtTrfQox1/jLTA3/Dt6ojH3sL5OyukGeZHUnnlpeLjuc9dhhztUC1U4/aYPtM6Vm b X-Received: by 2002:a05:600c:3c8c:b0:40e:c4f8:bdf with SMTP id bg12-20020a05600c3c8c00b0040ec4f80bdfmr180379wmb.31.1706162170518; Wed, 24 Jan 2024 21:56:10 -0800 (PST) Received: from m1x-phil.lan (lec62-h02-176-184-19-125.dsl.sta.abo.bbox.fr. [176.184.19.125]) by smtp.gmail.com with ESMTPSA id c6-20020a05600c0a4600b0040e621feca9sm1241668wmq.17.2024.01.24.21.56.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 21:56:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= , qemu-arm@nongnu.org, Andrew Jeffery , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Gavin Shan Subject: [PATCH v3 4/5] hw/arm/aspeed: Introduce aspeed_soc_cpu_type() helper Date: Thu, 25 Jan 2024 06:55:43 +0100 Message-ID: <20240125055544.79405-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240125055544.79405-1-philmd@linaro.org> References: <20240125055544.79405-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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 In order to alter AspeedSoCClass::cpu_type in the next commit, introduce the aspeed_soc_cpu_type() helper to retrieve the per-SoC CPU type from AspeedSoCClass. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan --- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast10x0.c | 2 +- hw/arm/aspeed_ast2400.c | 3 ++- hw/arm/aspeed_ast2600.c | 3 ++- hw/arm/aspeed_soc_common.c | 5 +++++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index cb832bc1ee..a060a59918 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -143,6 +143,7 @@ struct AspeedSoCClass { qemu_irq (*get_irq)(AspeedSoCState *s, int dev); }; +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc); enum { ASPEED_DEV_SPI_BOOT, diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 8becb146a8..dca601a3f9 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -211,7 +211,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) /* AST1030 CPU Core */ armv7m = DEVICE(&a->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 256); - qdev_prop_set_string(armv7m, "cpu-type", sc->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc)); qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); object_property_set_link(OBJECT(&a->armv7m), "memory", OBJECT(s->memory), &error_abort); diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c index ad76035528..3baf95916d 100644 --- a/hw/arm/aspeed_ast2400.c +++ b/hw/arm/aspeed_ast2400.c @@ -156,7 +156,8 @@ static void aspeed_ast2400_soc_init(Object *obj) } for (i = 0; i < sc->num_cpus; i++) { - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); } snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 386a88d4e0..b264433cf0 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -158,7 +158,8 @@ static void aspeed_soc_ast2600_init(Object *obj) } for (i = 0; i < sc->num_cpus; i++) { - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); } snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c index 828f61093b..36ca189ce9 100644 --- a/hw/arm/aspeed_soc_common.c +++ b/hw/arm/aspeed_soc_common.c @@ -18,6 +18,11 @@ #include "hw/char/serial.h" +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc) +{ + return sc->cpu_type; +} + qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev) { return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev); From patchwork Thu Jan 25 05:55:44 2024 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: 765944 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp2458889wrx; Wed, 24 Jan 2024 21:58:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMLMB5m4tR7Q0F3SaJXsoO0qTz4UBRbTOZVFxM4qKHLFlttIxO3z5Ai09uOodp1t6SZ760 X-Received: by 2002:a05:620a:298c:b0:783:9ae3:7bb4 with SMTP id r12-20020a05620a298c00b007839ae37bb4mr641746qkp.79.1706162302671; Wed, 24 Jan 2024 21:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706162302; cv=none; d=google.com; s=arc-20160816; b=dO94DKQezCjEz8of6boSJu6Ua91nJqHvOrk+1/pEUbozD60xyLAB7xekPIWKASUSMu yigUARmPpi9HYjSRbQdQFjVuI/CtBNyHj1+1aHfIYwVkcONxXxooeh5pB3M65XvV5KQu 8SPUS31kpGOj1t9Y6GmhfGJvbTwkNum1ov2/XtmCmiC0tqelyfO0Rvbo1uO+OSSlFGSi Ymmv+H9j9tzXA/bz3gkeme3svpzoDHoSLZ/A5rM5SVvkG0EAFiwZUS1kqHXHT9T0PT6G WCMgwMrpAkccf6hORo913Xps3wBhPIfG50g/PFwJwvosPuJDwlOpHmSr8efy4TJZ8Nqt xB4Q== 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=rKDbGwEXvltki2wl7qUZU0z++HxczA7j4HHaOXKhPHg=; fh=mgkM7j5chzFeBdbp6jSghBOXKGtgf9vcQQUOsrmpdjA=; b=NtD9qe9YMUM81kXpDip56XU6MBt1po5aUgAzyPsK9rEODSRTM5cqolxgLUU2Uc4TUY SL+KXXVqhdwDsmU+sazv7FGxAk0EjNL90wy5xBbiTeCxQMhhxZ+08Rj4Dz/mncEZuLpn SSDgUu04Y6eQGIy4JHGtjF7/Egdr+DSkxSNUpIqjwGMB0CaWal3JUmYKRWsml27VoLNf jDswvf9g1i+yLIvsm45PWPED83X8a1K0XO3azvnDS/3pNtUP0Q/XSRwp5vybGOdvQuDA RSYanmprV0A8DjurWsaBP6VtOTkCZ7Z6F3HjK1Cga32T2nUP9ansez9Ra/iOS7vAa/qL fWgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zGc/uNZZ"; 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 dv15-20020a05620a1b8f00b00783a1756958si8858413qkb.602.2024.01.24.21.58.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2024 21:58:22 -0800 (PST) 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="zGc/uNZZ"; 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 1rSsis-0003Pe-By; Thu, 25 Jan 2024 00:56:22 -0500 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 1rSsip-0003OK-So for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:19 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSsio-0001JH-58 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 00:56:19 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40e86a9fc4bso80881935e9.2 for ; Wed, 24 Jan 2024 21:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706162176; x=1706766976; 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=rKDbGwEXvltki2wl7qUZU0z++HxczA7j4HHaOXKhPHg=; b=zGc/uNZZuYA2Bv/bIf5InCq0tv4CBJGTogFrFQOZKdf+0eZZlgFN6MeXNNkhMaHlu0 WCFCEAuHH+GzmV0uCv/Vp2pSiIZFwrz2UpLLx1GQ/xB5Z1zVsM6iQgKmw+1wnCyeUxdX KyZAm15KAVuF6iSC8g5W8T4eS2eFlgWR8hsWfVjXm3VDvH2Azi3o6BNy/KcrxmZmraHA rddus7ELPQxQlS6lg8PHXUxkWYDvBZFNrI+pWjMSMLnlfi1D6jh/pUOI+1p7iAMWpH/E /7oD4R53a1tNPFoeXsNUI/zgu9Zci5KZXW/QZ+JduGbocbTxyXw+yFCujaG8YvXV3x8P lXYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706162176; x=1706766976; 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=rKDbGwEXvltki2wl7qUZU0z++HxczA7j4HHaOXKhPHg=; b=afNbXobTqIRXqnsBNCK9aFDZ0bskMUAUphP83rJhRmTANpxkahWYcbmv2mKATMoVhi a3NlyfonNN8MbMc4sqLNnAYVO9FOlOHyagZphX4N1Oo6aYeWxzO6VKGrXGIVfoMmPnXX qJ9LqlBYtYad4BPVSNy96Widf+WQy2P1JFS1ophPLO78zcaUePvV8KIYv30IBtUcEat8 kbO40Tbr+87fIVQSc+YwWtCyVzbMsxhf5mEEGlm/UhSDEd8j2Kl6q6NpBBzBQyJUT6jX i5goZggzd5qTJgNqMbSRebRZ3IDsnXcwx9dWj4NrKyzGB/bT+FPsmCUzO8O0C4HvMLzO lvcQ== X-Gm-Message-State: AOJu0Ywytqxek3JOVPWEFCcXT73ggN7KpE/YvkS26blZ9GfHQ0zAo/Gh aBUy+2p7wGJem+t8hzWy+gMFzAsUiFJLGQjXrGQ21BLhtJvIjHfnvtpVs3AsIzRmv+vNVRJUA73 k X-Received: by 2002:a05:600c:3581:b0:40e:6a5c:826a with SMTP id p1-20020a05600c358100b0040e6a5c826amr182613wmq.25.1706162176449; Wed, 24 Jan 2024 21:56:16 -0800 (PST) Received: from m1x-phil.lan (lec62-h02-176-184-19-125.dsl.sta.abo.bbox.fr. [176.184.19.125]) by smtp.gmail.com with ESMTPSA id fk15-20020a05600c0ccf00b0040e9f7dadc6sm1247688wmb.25.2024.01.24.21.56.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 21:56:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= , qemu-arm@nongnu.org, Andrew Jeffery , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Gavin Shan Subject: [PATCH v3 5/5] hw/arm/aspeed: Check for CPU types in machine_run_board_init() Date: Thu, 25 Jan 2024 06:55:44 +0100 Message-ID: <20240125055544.79405-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240125055544.79405-1-philmd@linaro.org> References: <20240125055544.79405-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 Aspeed SoCs use a single CPU type (set as AspeedSoCClass::cpu_type). Convert it to a NULL-terminated array (of a single non-NULL element). Set MachineClass::valid_cpu_types[] to use the common machine code to provide hints when the requested CPU is invalid (see commit e702cbc19e ("machine: Improve is_cpu_type_supported()"). Reviewed-by: Cédric Le Goater Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/aspeed_soc.h | 3 ++- hw/arm/aspeed.c | 1 + hw/arm/aspeed_ast10x0.c | 6 +++++- hw/arm/aspeed_ast2400.c | 12 ++++++++++-- hw/arm/aspeed_ast2600.c | 6 +++++- hw/arm/aspeed_soc_common.c | 5 ++++- 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index a060a59918..0db5a41e71 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -128,7 +128,8 @@ struct AspeedSoCClass { DeviceClass parent_class; const char *name; - const char *cpu_type; + /** valid_cpu_types: NULL terminated array of a single CPU type. */ + const char * const *valid_cpu_types; uint32_t silicon_rev; uint64_t sram_size; uint64_t secsram_size; diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index d2d490a6d1..fc8355cdce 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -1149,6 +1149,7 @@ static void aspeed_machine_class_init_cpus_defaults(MachineClass *mc) mc->default_cpus = sc->num_cpus; mc->min_cpus = sc->num_cpus; mc->max_cpus = sc->num_cpus; + mc->valid_cpu_types = sc->valid_cpu_types; } static void aspeed_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index dca601a3f9..c3b5116a6a 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -417,13 +417,17 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */ + NULL + }; DeviceClass *dc = DEVICE_CLASS(klass); AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc); dc->realize = aspeed_soc_ast1030_realize; sc->name = "ast1030-a1"; - sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); /* TODO cortex-m4f */ + sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev = AST1030_A1_SILICON_REV; sc->sram_size = 0xc0000; sc->secsram_size = 0x40000; /* 256 * KiB */ diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c index 3baf95916d..8829561bb6 100644 --- a/hw/arm/aspeed_ast2400.c +++ b/hw/arm/aspeed_ast2400.c @@ -503,6 +503,10 @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("arm926"), + NULL + }; AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc); @@ -511,7 +515,7 @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) dc->user_creatable = false; sc->name = "ast2400-a1"; - sc->cpu_type = ARM_CPU_TYPE_NAME("arm926"); + sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev = AST2400_A1_SILICON_REV; sc->sram_size = 0x8000; sc->spis_num = 1; @@ -527,6 +531,10 @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("arm1176"), + NULL + }; AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc); @@ -535,7 +543,7 @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) dc->user_creatable = false; sc->name = "ast2500-a1"; - sc->cpu_type = ARM_CPU_TYPE_NAME("arm1176"); + sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev = AST2500_A1_SILICON_REV; sc->sram_size = 0x9000; sc->spis_num = 2; diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index b264433cf0..46baba0e41 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -629,13 +629,17 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a7"), + NULL + }; DeviceClass *dc = DEVICE_CLASS(oc); AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc); dc->realize = aspeed_soc_ast2600_realize; sc->name = "ast2600-a3"; - sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); + sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev = AST2600_A3_SILICON_REV; sc->sram_size = 0x16400; sc->spis_num = 2; diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c index 36ca189ce9..123a0c432c 100644 --- a/hw/arm/aspeed_soc_common.c +++ b/hw/arm/aspeed_soc_common.c @@ -20,7 +20,10 @@ const char *aspeed_soc_cpu_type(AspeedSoCClass *sc) { - return sc->cpu_type; + assert(sc->valid_cpu_types); + assert(sc->valid_cpu_types[0]); + assert(!sc->valid_cpu_types[1]); + return sc->valid_cpu_types[0]; } qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev)