From patchwork Wed Jan 15 23:29:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 857646 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp2733010wrc; Wed, 15 Jan 2025 15:31:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWWOm1G5dr9468LqJV3i2awKE6IQFe/QA6AlDnSX9UMZTsOP4EJq89MHqOBvNANCI5m2noJBA==@linaro.org X-Google-Smtp-Source: AGHT+IFJQoioSPb8NmDi30FxBI0jtIfUpXnlfNOH578WqVI55zKNLZcqAhDmzt1sFTvFz1MIk6sl X-Received: by 2002:a05:620a:404b:b0:7b7:142d:53d4 with SMTP id af79cd13be357-7bcd97a41e7mr4607960785a.39.1736983913023; Wed, 15 Jan 2025 15:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736983913; cv=none; d=google.com; s=arc-20240605; b=JjCtK2FY+oizUpJCCDdncIFE5/Q3JcNJ1pvT5gE5hbkUHgh1Zf3s3k4p08ZUrfAvV4 sAIm9Mahnv2670I6uey0U3Oy1cBjmoFELuRmNOCsgvXEGq6djXxkesWIU4rfInJ6X+me 8Zl9ZDeo2kHF0W1kBSQL3vdX6ywlM4hNLhbB9GJCa8BHXLSchtKAJunp1qFQGHfzpBuU 1yJ1WQrYf4sAiPCvwcJfJDN1dzXg8/23IUSesBNBtfrfxXR7S85VW605P50BaRotmX0q IezzrSOKNm1QTo8OI91/OfA8NrR+E1q67xwdvJVpUGNvsCD3bPIkMxXCGC/qk8+PcWPr TfXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QsJrlKcmyvOLkMfarrkKos3o50mVd3SgHzi3eR8aV2I=; fh=vbC9XRCEPtWLeFY5dMetP0+DZx7J3Hlgl6kGR/4t3xg=; b=ccR+9irDt/2QkjvjmgdiJwJgxzHjg0W/jxlz20GkRQhPvAUhzoO543N2MeIx7/wsfq JACkQDzTqkQEK+vifGQi8niDR7QqOXtSJ2MGC8Vg4ywrJ5ErDAeBPz9ne51OFQr08Wc2 17UM0pn/Y3GKtDtDabWf3zS5/yFdkMKzzpLkDFx7NtJa7RWCgrz/WfE4TWFqM2KGSKNF aZG9Z0YTxqtGs91AHr/KQdUDvo/wqu4pw+l04rTJdBeixH/PZy1Hc4d7bMhwCRf7QiFB u69nHwxy484tSzybeJzXyvFYN78tAEp+J8zjPfwhVoisXSghvCNo3itUevZJC98BkOrN wPcg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cUl8XFNn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7bce322b35asi1691000185a.74.2025.01.15.15.31.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Jan 2025 15:31:53 -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=cUl8XFNn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqb-00076H-Sr; Wed, 15 Jan 2025 18:30:54 -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 1tYCqV-0006kV-LX for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:48 -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 1tYCqM-000558-Ss for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:41 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso1474665e9.2 for ; Wed, 15 Jan 2025 15:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983825; x=1737588625; 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=QsJrlKcmyvOLkMfarrkKos3o50mVd3SgHzi3eR8aV2I=; b=cUl8XFNnO852Ns/G1H0Vfb1U6cSGeW7ivwiGtrHeC4LWkHoSxLQ2zWfIEqtvf+IaAH 1QGphKsMoNmZrnZwTwm8fpZxjNVmEElRt++sk/9LYE+rjMLCk38D/m5p0gR6zp/bQUJD bVptUqNr2xh4JU85O1+VNcYrHtTtM37o1QUAHSdexsfu9Enfhlip9a61OMKxFnOScULD AJmhGgsgM16jdQvnFPYQotn60Y55hVV9jctu5HyZUJ0+hTe7DMC6s+Hdj1wpqWu+/o98 31GwrCYJ0rTeyBPml3E6/jpohm1zQh/3+SLshWcZXJFw9MvnqrdL9Xs58prCj5XHCjMT qgNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983825; x=1737588625; 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=QsJrlKcmyvOLkMfarrkKos3o50mVd3SgHzi3eR8aV2I=; b=sVsUlhDXGDKKmmKnLPL2WQ8/CtLPCuowVhFwD0JisS0GBHkWnY+3Pxkzr6rMqWrs2+ e5/D354fBt5kch55/5FSTUBlq+7sV/paG2a9XO2wnJmvbEhxlTL4iKQrWWBEASjmLVPR gAUCZvRkzsEGwRYpkhaD6ZIE4XpKHhxwfe2biTO7+JKcGdfHzLXKlTdJPpqdPdwMAQI+ gRtNSc5L37WhbxggdyAv6pVvDEoy+YUqF1N2zAfueysivsXFLfdoyHruHce4YJw3+Rpl TyMu1lkBOJ/Xe8UD9nU5HRiEsyRJBCCtNDfNcMyg0SfRp4zyOvHkI0+oA8aADNfNhDhv vLdQ== X-Gm-Message-State: AOJu0YwQ2eyNlzFOnMgsMxpg7vaKMspTNtSCm9FXYVk+fJs54CTnE+v/ zC2PZ2Gb4selGP4aJh4t28w2HzRFCbD/E0gWLGV/ZKcyJX13c8ZFMbMHpRW3yJOjMQA00X6JWsv 9msE= X-Gm-Gg: ASbGncuTRy1+/A3NadzAuLK4v2zpV7DJSWRzB3SJDwqcNUddSqRu8Amn014cYavUKKM alF6Fqhzbc+SdsafFqBm1ipUJPlG2Pcr0uZETylhHzZ4pahwjtjFl7AhpVzQL3cxgUHtKm2Qt9V 3YdiDUUm6j9LxoxRAuK22tYYtb2oswJXYkk46nIq8Soh8+0ePGcbVEGBuW05TJgSZ34j1hvBXrO iZtjoV6yxVcwwkTdxwiY1u4WROQx4v2EA8D0Tm6egNiHGHxdWQiE0wjUTkBU5ywOcLGIQjA0/1S /lApr3bILsh6cnnBRrtn3vFmHeSqxno= X-Received: by 2002:a05:600c:3b2a:b0:434:f623:9ff3 with SMTP id 5b1f17b1804b1-436e26a8c3cmr303390935e9.15.1736983825453; Wed, 15 Jan 2025 15:30:25 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c749935fsm39454605e9.3.2025.01.15.15.30.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Huacai Chen , Richard Henderson Subject: [PATCH v2 06/11] hw/mips/loongson3: Propagate cpu_count to init_loongson_params() Date: Thu, 16 Jan 2025 00:29:46 +0100 Message-ID: <20250115232952.31166-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250115232952.31166-1-philmd@linaro.org> References: <20250115232952.31166-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 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 Propagate the %cpu_count from the machine file, allowing to remove the "hw/boards.h" dependency (which is machine specific) from loongson3_bootp. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_bootp.h | 1 + hw/mips/loongson3_bootp.c | 11 ++++++----- hw/mips/loongson3_virt.c | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/mips/loongson3_bootp.h b/hw/mips/loongson3_bootp.h index 9091265df7f..ee6340e42c1 100644 --- a/hw/mips/loongson3_bootp.h +++ b/hw/mips/loongson3_bootp.h @@ -233,6 +233,7 @@ enum { extern const MemMapEntry virt_memmap[]; void init_loongson_params(struct loongson_params *lp, void *p, + uint32_t cpu_count, uint64_t cpu_freq, uint64_t ram_size); void init_reset_system(struct efi_reset_system_t *reset); diff --git a/hw/mips/loongson3_bootp.c b/hw/mips/loongson3_bootp.c index 712439c2575..91b58a71a68 100644 --- a/hw/mips/loongson3_bootp.c +++ b/hw/mips/loongson3_bootp.c @@ -24,10 +24,10 @@ #include "qemu/bswap.h" #include "exec/hwaddr.h" #include "cpu.h" -#include "hw/boards.h" #include "hw/mips/loongson3_bootp.h" -static void init_cpu_info(void *g_cpuinfo, uint64_t cpu_freq) +static void init_cpu_info(void *g_cpuinfo, uint32_t cpu_count, + uint64_t cpu_freq) { struct efi_cpuinfo_loongson *c = g_cpuinfo; @@ -40,8 +40,8 @@ static void init_cpu_info(void *g_cpuinfo, uint64_t cpu_freq) } c->cpu_startup_core_id = cpu_to_le16(0); - c->nr_cpus = cpu_to_le32(current_machine->smp.cpus); - c->total_node = cpu_to_le32(DIV_ROUND_UP(current_machine->smp.cpus, + c->nr_cpus = cpu_to_le32(cpu_count); + c->total_node = cpu_to_le32(DIV_ROUND_UP(cpu_count, LOONGSON3_CORE_PER_NODE)); } @@ -112,9 +112,10 @@ static void init_special_info(void *g_special) } void init_loongson_params(struct loongson_params *lp, void *p, + uint32_t cpu_count, uint64_t cpu_freq, uint64_t ram_size) { - init_cpu_info(p, cpu_freq); + init_cpu_info(p, cpu_count, cpu_freq); lp->cpu_offset = cpu_to_le64((uintptr_t)p - (uintptr_t)lp); p += ROUND_UP(sizeof(struct efi_cpuinfo_loongson), 64); diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 9c2001295d1..93700a1612e 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -185,6 +185,7 @@ static void init_boot_param(void) init_reset_system(&(bp->reset_system)); p += ROUND_UP(sizeof(struct boot_params), 64); init_loongson_params(&(bp->efi.smbios.lp), p, + current_machine->smp.cpus, loaderparams.cpu_freq, loaderparams.ram_size); rom_add_blob_fixed("params_rom", bp,