From patchwork Wed Jan 15 23:29:41 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: 13941045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9F48C02183 for ; Wed, 15 Jan 2025 23:31:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCq2-00061a-4C; Wed, 15 Jan 2025 18:30:18 -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 1tYCpr-0005rY-I4 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:09 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCpk-0004ky-Q8 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:03 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-38a34e8410bso164628f8f.2 for ; Wed, 15 Jan 2025 15:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983799; x=1737588599; 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=IAnsUgZcwbLVJsP/XsIEi+0G7e096dCuqBuVIP59Z6k=; b=U38IV2GEb/wluFa0/+zkSWXPjq3nsrV0j0XsryBu2FxqXqxctc/5+7lAwE8BJts0x6 IXhZ1eL74lsQTTYOn6LYaL6NJ3/iihOg+c8oOh+W06pAW6df3cHGGfV9JK9TaD4aqlhP ihZOZ06icQfGjHPyF5jDA/OEXMzYEe6BKVafnx2nvzCRAwQKDGEhbqPque0Pt5ccof9D Q0CMCQdFA7Xw90TB+D8B2PjL/OIkAp6+1s2Sjiae0frGkIn/swoBEltj3bH8/fy0uTKh doqEN1hD4osZSFb0DTXWj6sb7sqdwKsTwCv9Iirs2/ZsLlwte/eRPcAsJRMqzHr8WY7z tm1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983799; x=1737588599; 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=IAnsUgZcwbLVJsP/XsIEi+0G7e096dCuqBuVIP59Z6k=; b=g9zGvFgfz+a9+UvP3NPhVxfl/y0pqb/CDlF4FyPW/G07camhrU5XYabaGpL3k2TtuW pQ9MCAOTFMuxMKLRz4MofN9mxeFE7PnKlHs8daia4LsyBP4AfHuRd1oint8WbSN0U/uS aydy1bbzsMEzCfaJGpg4IK7unrruYy1Rf4xL2qQ1oW8Z0xR8YstItQBBNSGHDWn6itpZ iWykNrGg/onFqBNwF1HBpOWXv2YpwhytEbxEzQxSKnKFMLcEv1ysn4Y1M0bxb2zb9hD9 w5ho6FOr3jFf+cMwuVgd0QLyC1Bt7H4uSoMRN1tve5eWVCjYPxgBBVeBII+SyaIMNiZh A++w== X-Gm-Message-State: AOJu0YwnmZKvq/Jo8Z0fVsbgGpTXiAB2irY9we5yTkjVssGWrpQpHkoW AkSavXuntJk6/fVPCfRdzuspzDt8ffgdjLbH31jHqmDasQDJfiOUut0uf/+aDZIDv/jhA0Ol+zg vUnw= X-Gm-Gg: ASbGnctVur+PXVpz9bI/GBNaoI9SRJSCI+/MU4k9sCfY058V7gyU8oQjwziEecz0qvX 56htgLqiMGlVv4DXucdNjG0xf6z5+3vrzUPQD7fDXcdpyYwfx4lWz6YaUtQOyVH9iqBHjPA8YKm wgh4mMGk7rfGTOkS9YokC4nV1Il06W18bevGibGJLzStG7BxwvZB79GVVSzzc35+ACqOifmaGeC E6v6buRT8n+iHrfmFGWRQuhUZgFxbWXt2VyRYuqQcZyQj+tfaINA0cJLUUS9wcNRvEb5LVXJthO e8OhgnU87S0M5ppo5nBwARQJ56Fsats= X-Google-Smtp-Source: AGHT+IHb1KTnaXuK6ME5yCwJClco1y813M6gd98dhSCAyEDFU76dOcyH/7eug+1THIJpaDVs7fIiPg== X-Received: by 2002:a5d:6da4:0:b0:385:de67:2269 with SMTP id ffacd0b85a97d-38a8730e04amr26216975f8f.36.1736983798887; Wed, 15 Jan 2025 15:29:58 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b7f79sm19196267f8f.69.2025.01.15.15.29.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:29:58 -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 01/11] hw/mips/loongson3_virt: Factor generic_cpu_reset() out Date: Thu, 16 Jan 2025 00:29:41 +0100 Message-ID: <20250115232952.31166-2-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org main_cpu_reset() is misleadingly named "main": it resets all vCPUs, with a special case for the first vCPU. Factor generic_cpu_reset() out of main_cpu_reset(), allowing to remove one &first_cpu use. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_virt.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index f3cc7a8376f..47d112981a2 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -399,25 +399,33 @@ static uint64_t load_kernel(CPUMIPSState *env) return kernel_entry; } -static void main_cpu_reset(void *opaque) +static void generic_cpu_reset(void *opaque) { MIPSCPU *cpu = opaque; CPUMIPSState *env = &cpu->env; cpu_reset(CPU(cpu)); - /* Loongson-3 reset stuff */ if (loaderparams.kernel_filename) { - if (cpu == MIPS_CPU(first_cpu)) { - env->active_tc.gpr[4] = loaderparams.a0; - env->active_tc.gpr[5] = loaderparams.a1; - env->active_tc.gpr[6] = loaderparams.a2; - env->active_tc.PC = loaderparams.kernel_entry; - } env->CP0_Status &= ~((1 << CP0St_BEV) | (1 << CP0St_ERL)); } } +static void main_cpu_reset(void *opaque) +{ + generic_cpu_reset(opaque); + + if (loaderparams.kernel_filename) { + MIPSCPU *cpu = opaque; + CPUMIPSState *env = &cpu->env; + + env->active_tc.gpr[4] = loaderparams.a0; + env->active_tc.gpr[5] = loaderparams.a1; + env->active_tc.gpr[6] = loaderparams.a2; + env->active_tc.PC = loaderparams.kernel_entry; + } +} + static inline void loongson3_virt_devices_init(MachineState *machine, DeviceState *pic) { @@ -572,7 +580,7 @@ static void mips_loongson3_virt_init(MachineState *machine) /* Init internal devices */ cpu_mips_irq_init_cpu(cpu); cpu_mips_clock_init(cpu); - qemu_register_reset(main_cpu_reset, cpu); + qemu_register_reset(i ? generic_cpu_reset : main_cpu_reset, cpu); if (!kvm_enabled()) { hwaddr base = ((hwaddr)node << 44) + virt_memmap[VIRT_IPI].base; From patchwork Wed Jan 15 23:29:42 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: 13941049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D43CC02183 for ; Wed, 15 Jan 2025 23:31:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCq4-0006CB-3s; Wed, 15 Jan 2025 18:30:20 -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 1tYCpv-0005sl-8r for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:13 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCpr-0004x7-T3 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:10 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3863703258fso939192f8f.1 for ; Wed, 15 Jan 2025 15:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983804; x=1737588604; 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=642TEQtW37S8xYU3EVMOt0HBBzzyTYdBusCSNo5Ytkw=; b=jGwUn6j1zUqj7NzaVbQ1zjMgPVPAe/wY5+Js1C0HHm8/yL7HJsEff/kSgPh/6hTRN2 X0V4ddH+2DRW245x2a4Q3lux6vpGI6LeTpBnJsS9Z4EV8/3Xi/y1pb23mU0R2vP3R9Q2 eCxliXP+RSPr6JU2MljxYQrQ1ETOePrDCesn/KuwWw2rcf6rZB2gVuzdRTQHP+X4rTm0 83TdZjkjsBxzHDWVznoQNecdIjXFuspcKjmc+mFyciVvRgwsNCP+0W9RsZncD2AVyQo6 mVoPkeprh0C3X6L+tB9QyU7AzggbkSynhrWS1EuNc6VcNL/ENqA5RaYCeEQja8dwvP5K /oTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983804; x=1737588604; 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=642TEQtW37S8xYU3EVMOt0HBBzzyTYdBusCSNo5Ytkw=; b=EDjDskIUpjQ8JVwvgpoHIYw5JJsjww/mWzDFuyWaHE7JAO1ddLICCONf+GQqbK7Tzj h7teqHQELUEtIGiTXBmpIk21YEVBmml894svH4SdgHSGBX8jBx+AELy0u31F4S3HwUkW w/hAc1pN9jgfWjOelDqclkgYEnPo9/zu2NHNNtUaOIB1fKhKYr4nfNxEDSXdYpO9/662 noML3ahIZHm1mFy21+WbhoQLFPn/h+jHF1oDdLbsyY380x20nlWFKOhgP+lwpTD9RmaU YBGOqWJUdgBC8doSLS2fV3+i5zcaiL2aH3vdIMmpBWYVsD9mi0BZ9MXTBulY+OcVyJPr ZCpA== X-Gm-Message-State: AOJu0YyhQWP3Tdg7plW5vGhh/63muj/Yz5CRngKCDhBNaOJSDk+zjLkV xBOUYEThR9Sopg9HEGsP7OL2tBXvuuyLlcyIUs5rmSr3GRH6FWhgV1Fw4kU35Pe2zp2VQeYLZml ys6w= X-Gm-Gg: ASbGncsSBzba0ovHmrt5y90+32dvUx3xBh+IeH+Z6hj5ZjpcnURDeRIJAU9q3TeHhb8 29vFlvRWJ5QYSr3jwamibNOmf75E1KTOExcvEWL+lwqop9tpCnnPpavfCGkUDygBLCnIX/UdK+W Dx02/b8mFT3vVq5REUzrKyfHP7Vsd2NSpUoDyxPgSeSYSHJL3SSOi8A1H1BwIZdVC229mkJPiib BZJgyjREf/TuHFvW07tN98scTGkWnyeCHO6M0DR2fh96XWPy29S/ww01r9wQsCrE0J2yLp10GL1 /XTj4mp65dYU4hXtNMIEEm84p+2GD1g= X-Google-Smtp-Source: AGHT+IG/0Brsn/U67VMP5gilyuaj4yYaOKu8K28jvEwce46XWJgRfEWtb9yIh/IZVE2UYcJTNCq0hA== X-Received: by 2002:a5d:47c4:0:b0:38a:5dc4:6dcd with SMTP id ffacd0b85a97d-38bec5075ebmr426747f8f.22.1736983804123; Wed, 15 Jan 2025 15:30:04 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d090sm18658080f8f.2.2025.01.15.15.30.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:02 -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 Subject: [PATCH v2 02/11] hw/mips/loongson3_virt: Invert vCPU creation order to remove &first_cpu Date: Thu, 16 Jan 2025 00:29:42 +0100 Message-ID: <20250115232952.31166-3-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::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Create vCPUs from the last one to the first one. No need to use the &first_cpu global since we already have it referenced. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/loongson3_virt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 47d112981a2..488eba495cd 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -494,7 +494,6 @@ static void mips_loongson3_virt_init(MachineState *machine) long bios_size; MIPSCPU *cpu; Clock *cpuclk; - CPUMIPSState *env; DeviceState *liointc; DeviceState *ipi = NULL; char *filename; @@ -569,7 +568,7 @@ static void mips_loongson3_virt_init(MachineState *machine) cpuclk = clock_new(OBJECT(machine), "cpu-refclk"); clock_set_hz(cpuclk, DEF_LOONGSON3_FREQ); - for (i = 0; i < machine->smp.cpus; i++) { + for (i = machine->smp.cpus - 1; i >= 0; --i) { int node = i / LOONGSON3_CORE_PER_NODE; int core = i % LOONGSON3_CORE_PER_NODE; int ip; @@ -609,7 +608,6 @@ static void mips_loongson3_virt_init(MachineState *machine) pin, cpu->env.irq[ip + 2]); } } - env = &MIPS_CPU(first_cpu)->env; /* Allocate RAM/BIOS, 0x00000000~0x10000000 is alias of 0x80000000~0x90000000 */ memory_region_init_rom(bios, NULL, "loongson3.bios", @@ -640,7 +638,7 @@ static void mips_loongson3_virt_init(MachineState *machine) loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; - loaderparams.kernel_entry = load_kernel(env); + loaderparams.kernel_entry = load_kernel(&cpu->env); init_boot_rom(); init_boot_param(); From patchwork Wed Jan 15 23:29:43 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: 13941043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B20CC02185 for ; Wed, 15 Jan 2025 23:31:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCq5-0006It-HI; Wed, 15 Jan 2025 18:30:21 -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 1tYCpz-0005zJ-8q for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:17 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCpx-0004zB-I5 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:15 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385eed29d17so195562f8f.0 for ; Wed, 15 Jan 2025 15:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983811; x=1737588611; 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=w8NsqtuLl1GgOwQ9maEwkOukw0Aj0PDgWtnDGfLDaJk=; b=qybltCIF8Ck2xiYYHKD7TVWAEeIt11y+MkS73utu2awsyqFWLRnyxgbL/AOI7bmXx9 4pAsSUxaKPubihAKED2DuXhPtB/yQ+S/yHQKIfKhvT4iIcsSfFQwUqI2DQ5ngZU7Q3r1 P2V6H/FA8dTN5bjEc1+zkYqiMQajxMtbCS0ht0Qm9DdEb1F+ktAyehhKNcfmaL10Czen iy35ZR5FTawV7Ca7dAMFjz3IConk8owWP9DPg/Off3uhES1dB/BmqNhXbLgHPqy+/bmZ WPevIdOpnPkHBc3XyCcw9h3OPeKSSCkST1QIJuMBDqVr9gvLBeviyFqW0Seh6W2OVCDs g4QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983811; x=1737588611; 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=w8NsqtuLl1GgOwQ9maEwkOukw0Aj0PDgWtnDGfLDaJk=; b=W7993d+wpI4K0n3lOhlX2xddeQkt7qSrAcJdkDeaPggSDlDrh1wB3Q0pFPSa0+cs/j xLrByFAyXuGujnKzgQf3NcAw6LxdzZEnh5Ke57JvPoqAOGqGojjL8SgsDGFKa75sFCup yMVU4BakclJWdCWnbZdqDOEmssYq5WVRfyxe4HVLwkQH82oGU1Gh2t4tL2HoTMP0jsv9 tzFQByMnl2vcKL0UijAzo/vmQopNVG68vSG4U+Vc01xK9Ka/PitMs7XBwsmUz9jCsRkv 5bEU28xFOGPgdQl8LmJDDdGZgWSpR/HrTvjkU6h8S3FtUEekbnIDjVjXzRexyMhlMBjP +hbg== X-Gm-Message-State: AOJu0YyzFWkIUGavr2f/nfrHNCuY4ma/xRWi5IF0Giaid4f7NHaBLSST mDjGbHMRkHCsi/v4iu5f4n1gYmOVXZulagsz0FRyn4H1EqG7ABK6tbtQmNBxflwf1dNjOXbXCwA dexU= X-Gm-Gg: ASbGncsM7FS6CQ98zRbrHY+cMLIPxeT6pkksfs+hoeq6DTQwHJfo8zSVitdKuDdev9d 8FGmyzhNAbgQER7vqBnf2Ep4Kq+KbTomcWPeCn2TJQz9dbkU4ug05fN9odgQcX55kLp3xDsIDVu SVmF5pflA/3Ql8CsvwaWndCo695fInzIqpcb1alI9RQrrZZ6RzdJaFz0JoGeNKgpBV7UYq/+z9O /jufPaSqrObTgFsxG7jb0MnELWgB2pHJ/BG7YbnotYdFHc193jE+A+4ikijAgiSRhwx64fbTpn1 yPLT/YsBpt0YTySuPeDuOpeeEknONFI= X-Google-Smtp-Source: AGHT+IFlvvWU/rYo0Hn5ghljSG01sHTWrZy8h5HRp1NieDgzKRL+nFNbigfAyDnlU3Q+jzpAs10t+A== X-Received: by 2002:a5d:64a8:0:b0:385:e429:e591 with SMTP id ffacd0b85a97d-38a8730a6bdmr30749043f8f.23.1736983810210; Wed, 15 Jan 2025 15:30:10 -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-437c749a127sm39220785e9.7.2025.01.15.15.30.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:09 -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 03/11] hw/mips/loongson3_virt: Have fw_conf_init() access local loaderparams Date: Thu, 16 Jan 2025 00:29:43 +0100 Message-ID: <20250115232952.31166-4-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::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 'loaderparams' is declared statically. Let fw_conf_init() access its 'cpu_freq' and 'ram_size' fields. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_virt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 488eba495cd..1f5952d7082 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -280,7 +280,7 @@ static void fw_cfg_boot_set(void *opaque, const char *boot_device, fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); } -static void fw_conf_init(unsigned long ram_size) +static void fw_conf_init(void) { static const uint8_t suspend[6] = {128, 0, 0, 129, 128, 128}; FWCfgState *fw_cfg; @@ -289,9 +289,9 @@ static void fw_conf_init(unsigned long ram_size) fw_cfg = fw_cfg_init_mem_wide(cfg_addr, cfg_addr + 8, 8, 0, NULL); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)current_machine->smp.cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)current_machine->smp.max_cpus); - fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, loaderparams.ram_size); fw_cfg_add_i32(fw_cfg, FW_CFG_MACHINE_VERSION, 1); - fw_cfg_add_i64(fw_cfg, FW_CFG_CPU_FREQ, get_cpu_freq_hz()); + fw_cfg_add_i64(fw_cfg, FW_CFG_CPU_FREQ, loaderparams.cpu_freq); fw_cfg_add_file(fw_cfg, "etc/system-states", g_memdup2(suspend, sizeof(suspend)), sizeof(suspend)); @@ -632,9 +632,9 @@ static void mips_loongson3_virt_init(MachineState *machine) * Please use -L to set the BIOS path and -bios to set bios name. */ + loaderparams.cpu_freq = get_cpu_freq_hz(); + loaderparams.ram_size = ram_size; if (kernel_filename) { - loaderparams.cpu_freq = get_cpu_freq_hz(); - loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; @@ -660,7 +660,7 @@ static void mips_loongson3_virt_init(MachineState *machine) exit(1); } - fw_conf_init(ram_size); + fw_conf_init(); } loongson3_virt_devices_init(machine, liointc); From patchwork Wed Jan 15 23:29:44 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: 13941046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58A37C02180 for ; Wed, 15 Jan 2025 23:31:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCq5-0006HO-4J; Wed, 15 Jan 2025 18:30:21 -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 1tYCq2-00066h-Ra for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:18 -0500 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 1tYCq1-00052X-91 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:18 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3862ca8e0bbso270003f8f.0 for ; Wed, 15 Jan 2025 15:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983815; x=1737588615; 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=lQE5apo0BwOCfvKDAYCRzW+MfDklvN0VdczsmfqZ8+c=; b=g2aXa7dTkqWaCOGs3xMpKwOIa4gh63hN0eHbpPgcbDPNmr90aSHOmHkaxt1qNuctEc I8oqfZz6RuDW1T08xd6yZDqnIhFdOcM28YZUXOU16JGtavUFrGB+DscKsjq0xaaQUmkM GFJDK1OA2Vb1Xh6FXUA8i8JwnTJ/15/rGkJPc+2Zcizew3TLFR124lHiD5Whtig7kofu NX8392GB4sMTrnVAGNIsYXvPoGp61jIHlF581mRpqaeChk7/uNqkjputdoEJF+95IrKw b7TSWBreQbu6gQ5VQJxRxypZeG0J4Suvgc+YuvaO5M5YQg+lw2PY+pkP7FKlk2TTM6eQ 7y+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983815; x=1737588615; 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=lQE5apo0BwOCfvKDAYCRzW+MfDklvN0VdczsmfqZ8+c=; b=B+5W+g0C7c5sjk7EcbFRVBwvxbZfAIhk9dFf7BdLGOtk9wnNnA4FH2QTcquJA8sWT6 ZMZdcY9kPIcRANWe4FUUqZDcY1Uk6pw0OmnKeeUQhQZVaR7GtOT4zyN3K1ltNftlhv6N JxgrtoVHLqRoisFPk4fOoQjGE3JPL4rUlK5KcbgFFmJcYazywnUG3jiPxjssYEAM9DnU n/t0lg0uvQ6y3WX+2rKGyFqMP5tlX7/XqcDROdoIKO2gBfSRtzAoGxb3Rg6Te9BAoS6V H5DUMwloylRTTd/yS3dXzjp5333H/kP5xQfCoLXdzDbS7lwymM65bW8z6DFDD5GcdU5H ZfxA== X-Gm-Message-State: AOJu0YzhrYu8HxekkhzQ8yeI2Dl4cqdAIeV3kkcwkRAIQlpoD8W36ynV rfyVh7bnLQh4kmG3NBBEGp2EXMiiXFKqWwvrV06qVWDL/DTucgy3socs60aovNoiHzuabgwx6p2 hAZk= X-Gm-Gg: ASbGncuStcKSWFE6Blm28NXWPJZaQoZrmhBnq+6Bk4ZdiWtVe2K0lw5zM2K+xafWbNX uVWLr9ry7AvKM7GABFRmGWM/rpWwLCa0Zk674sl18Xj8No50CMQRKCmzovy/ihHRDgJLN4XlIeQ YF2GgfCLdDeFcenA9B3hWLEUN++IrCBWPh0aPY6yw1bEt+EFK7XPC+pJosy2HydEAFIoxinDAKq QwBjXa55zI3rwJGyVN9lSeTiY572fKH/DKR8sZV12x/tiMYq/5ai+CL0ftOkEYXsdvqp0fMF3yb /VzMHDtI8DJwqxtxjSg6YHDKIYrBV38= X-Google-Smtp-Source: AGHT+IFlVLkcGIhwUJu3Yrlfva+Jv9uwjPcqHOeDjhlAm5gZICd70ZEhCL2aObmd1Nb2cNDe/vXmhA== X-Received: by 2002:a05:6000:4618:b0:385:f560:7916 with SMTP id ffacd0b85a97d-38a8732aeefmr32441179f8f.35.1736983815580; Wed, 15 Jan 2025 15:30:15 -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-437c7499932sm38704655e9.7.2025.01.15.15.30.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:14 -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 04/11] hw/mips/loongson3_virt: Pass CPU argument to get_cpu_freq_hz() Date: Thu, 16 Jan 2025 00:29:44 +0100 Message-ID: <20250115232952.31166-5-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::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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Pass the first vCPU as argument, allowing to remove another &first_cpu global use. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_virt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 1f5952d7082..9c2001295d1 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -153,7 +153,7 @@ static const MemoryRegionOps loongson3_pm_ops = { #define DEF_LOONGSON3_FREQ (800 * 1000 * 1000) -static uint64_t get_cpu_freq_hz(void) +static uint64_t get_cpu_freq_hz(const MIPSCPU *cpu) { #ifdef CONFIG_KVM int ret; @@ -164,7 +164,7 @@ static uint64_t get_cpu_freq_hz(void) }; if (kvm_enabled()) { - ret = kvm_vcpu_ioctl(first_cpu, KVM_GET_ONE_REG, &freq_reg); + ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_ONE_REG, &freq_reg); if (ret >= 0) { return freq * 2; } @@ -632,7 +632,7 @@ static void mips_loongson3_virt_init(MachineState *machine) * Please use -L to set the BIOS path and -bios to set bios name. */ - loaderparams.cpu_freq = get_cpu_freq_hz(); + loaderparams.cpu_freq = get_cpu_freq_hz(cpus[0]); loaderparams.ram_size = ram_size; if (kernel_filename) { loaderparams.kernel_filename = kernel_filename; From patchwork Wed Jan 15 23:29:45 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: 13941044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67740C02180 for ; Wed, 15 Jan 2025 23:31:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqP-0006hU-Pc; Wed, 15 Jan 2025 18:30:42 -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 1tYCqK-0006gS-Pz for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:37 -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 1tYCq6-00053o-Qh for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:36 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso1439415e9.3 for ; Wed, 15 Jan 2025 15:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983821; x=1737588621; 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=YgJvGryqr3TkhFMqWrnYlBHew87iojgecT5lYXi9GM4=; b=djwMv1LIRlf7QNERrWm2SeoWBEWsigMGeox1R48QQVRzzLYydGNNM+9z1P7ZU/btFk VaJ9fYG5PUTyq0mU19aYX6qgSW/5d0OuYUcFloOsR9eKdnI/IOZOc43rMVW/bRRyAqwz u8gqlBN+KZoXfVWbxgo0LzPwWL20toa8jkiM1pjqFg1wKXvbi9BUB3SE/0XBYbB+QMU6 9hUozVlQlNiY2B6kawYHOkSv2bhgYUFyctCeCb51Q57rQECt5pDJjmk4eJjlayyX6jTO Ns1z1Vi3M1e4CQQby9rdA7AYETpq+XIeZRaUa8ZLujrZGOUXizkiPssKZvRCuVUjJHoU OGLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983821; x=1737588621; 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=YgJvGryqr3TkhFMqWrnYlBHew87iojgecT5lYXi9GM4=; b=tV1vALRMGiSmTshRT3As3YB3wBIjUxqh2IJTrGY6J1gCpfIIdvfygYskaDGZwSLHbR gj6jXbXC8vc1g3VDLQk1e66up+0wRUdmzXiZHwQns7A/q646th1Wv3739HOeZUdVDgmd Etw8LYniOQTyB4LsNfP90mDs8wZsLMuvalqtLnDH7s1CsmoxK+b0g/COVwLpucih3sqg Z4vWobjwRKcq2w3oVybYm6NQIoqIAZeNROoK3bOLOw4vvW6KM3bC1tFc1ws1vn77wzEX RihO8CWru9MGJpAZ1s/3MB4EUrCzLjK+UmoWq9YQ/DtB12luyG3XrCuDtS4OK3WCrPez Pa0g== X-Gm-Message-State: AOJu0YxM7OkfmA22MRLotZwJjj/QQGEIqElbYsyJE6dZlK62MpYfjkvi 4ynN0vnf5oAJZV2CtdhH5RMo2xRFbWf1LssNUrD3XGPbmw8MxNdvHYEYZWlgz/igu75Nd+eq6FB WZUI= X-Gm-Gg: ASbGnculw7PQiykLcN4h4i4vWjRM/PYdudnWxAWORkVC3PZaqGPvMTmVeZltEES1Two ELlz2dhcLRR864QdJg3Yp3whThBbdp23lbwHmg9Z8AkRu1FWrilCC43t/achWQqIkHkxumZrzPJ hAW1TZzMCFAHi7MYpkOEv9nxeB1Y19nIcr80IoPkO8ueP7KFW1fZvXSggdaaqagfdw0GM7lcBbz W97I01uDVWa25eIFutPVWEdwwOXBTFzK+f6ytXgDCNRzbe29sO93jQQVPEgFWCy06/UPwHcbFAp UmyOkBjW6Tg3gVxVx0/eHeWTmJ9CoG4= X-Google-Smtp-Source: AGHT+IFaL3Ly6JWCEejEEl8fQLFuRbcc+IgJeiSblgNLC+gpl6eZe9dfD6XQDLZ6jGMtfevNB7/tzQ== X-Received: by 2002:a05:6000:1566:b0:385:f1f2:13f1 with SMTP id ffacd0b85a97d-38a87303e63mr4962500f8f.22.1736983820818; Wed, 15 Jan 2025 15:30:20 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d0b1sm18999137f8f.12.2025.01.15.15.30.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:20 -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 05/11] hw/mips/loongson3_bootp: Include missing headers Date: Thu, 16 Jan 2025 00:29:45 +0100 Message-ID: <20250115232952.31166-6-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::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_PASS=-0.001, T_SPF_HELO_TEMPERROR=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org MemMapEntry is declared in "exec/hwaddr.h", cpu_to_le32() in "qemu/bswap.h". These headers are indirectly included via "cpu.h". Include them explicitly in order to avoid when removing "cpu.h": In file included from ../../hw/mips/loongson3_bootp.c:27: hw/mips/loongson3_bootp.h:234:14: error: unknown type name 'MemMapEntry' 234 | extern const MemMapEntry virt_memmap[]; | ^ hw/mips/loongson3_bootp.c:33:18: error: call to undeclared function 'cpu_to_le32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 33 | c->cputype = cpu_to_le32(Loongson_3A); | ^ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_bootp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/mips/loongson3_bootp.c b/hw/mips/loongson3_bootp.c index b97b81903b7..712439c2575 100644 --- a/hw/mips/loongson3_bootp.c +++ b/hw/mips/loongson3_bootp.c @@ -21,6 +21,8 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/cutils.h" +#include "qemu/bswap.h" +#include "exec/hwaddr.h" #include "cpu.h" #include "hw/boards.h" #include "hw/mips/loongson3_bootp.h" 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: 13941052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7D67C02183 for ; Wed, 15 Jan 2025 23:31:52 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IEoSTJBHsYg7leDeCnDocAEQmUZIj2fh0NU5NOQTVPXivbL7hvzH2SuuOH8+O7zwwgkDjLOSg== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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, From patchwork Wed Jan 15 23:29:47 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: 13941050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1C87C02183 for ; Wed, 15 Jan 2025 23:31:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqY-0006re-EI; Wed, 15 Jan 2025 18:30:51 -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 1tYCqP-0006iD-W3 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:42 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCqM-00054s-Fj for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:40 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4361f664af5so2560555e9.1 for ; Wed, 15 Jan 2025 15:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983830; x=1737588630; 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=BRQx0SkOCPWyQiRMduvrQcrReIn+M/C8yaM71k53eWQ=; b=MD072fNfggVuLh8kkvaHTJ9t46asxgcvx/iQKupeijLdAfgr3uqxGCcl6K/4iuk+Uy xacoYB6k25MCnRlij/yxPj5LFSTdUR8jhmWby4ANpElufdmKFiRvg3aha4drJ6/9rQz3 cuEK117e7NXQaoQ5WPVLACiZBGlomMQOMQxdZHb99AR6BULvhQFc6rm6ci+LQLGapHO4 cBDFWC9VcpokF4ejhCsWADdQSpGnrLmTtt5l39VmXuPp3AbsxXOmk1xB0g376DeaRFHq VjGM+GgkUyHpmG7qcOTQJwnM7LCLk4YNTYapFuxzHO52MP86FSAkCoPAaaZkCkMRNa9x 7exA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983830; x=1737588630; 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=BRQx0SkOCPWyQiRMduvrQcrReIn+M/C8yaM71k53eWQ=; b=OIojuwl2b2Ugnxb05/CWGHMR1RsD3fS9QgASJpcgKYgUNRFREk7+F+12GIVjIZxrIG 5TeV++tkNBkeiUEai6KgZurThle04aHbnq94ngh2vxMFxw2fuIBHUqGHOEi+TVCcuX3w AMLJyyUcnF2TZBI6MlM3+f2AJRQh1MsSy+KFsfqZPpEn6ZSYt+fSh0oCh7KKJC1nyRbR Qp53c3fsdkiyOL3C8PInPd/fnBH2JgVuFzEe3Qi4cIf03xDUdVTepBEKkvcHwtosQNRe 34g/Xam/YZ86c44KzTTaLE3sk/1sI+GjjAx5bhjzwyV1/36DbH9bpj5W/SV+ao+0V4nv 5l4w== X-Gm-Message-State: AOJu0YyxfgWZckzU+A0awig8PZ/80u9HIIBJ4bsTcO9yZ+s1EXsXk8zf 9qftM+71CYGDMG7ON5FFSsSRwiEzQQq0FvMzCU+tj+9kEh7kGbbbRt8A9DTd4xDgnjpD1uPEe92 gv3Y= X-Gm-Gg: ASbGnctjoEbQmkel9ZahYevi9LgcH7oiDe584DGZzHEAW/EkDeSPCrRKQAYUMG4O3w2 2rsdiGnzxJ14K5i2HoNilHmXAJN2YK1g9eYIpc9pG0upq7nZVh+q7oSabNSOydg00oJeyBx0d9k 1qAq7fLRcyrwY+k5Fnu2wFEroF2fGBAIyUlz+XfJbw8DvOZTXXGyc8oHGojt/ZFyXBFiqgIzqcY NrmwmvIBFY40kCSkjAsgxyePfmpF8NHMHeOZoED6NxO10j0s0J8WhKasjAYLXRESPWRQqobcen1 SVKYTUGLuTJRZjWNnGGT0j+yzY19uJc= X-Google-Smtp-Source: AGHT+IH6GvWohGKr1oWh06khHkQDZX6EiyaZ7GIFVzj8Xgtb55wE8/gSn9Kv4JxvIbKxN7Pm0dDEAA== X-Received: by 2002:a05:600c:3ca4:b0:436:6460:e680 with SMTP id 5b1f17b1804b1-436e26c3331mr272373125e9.16.1736983830075; Wed, 15 Jan 2025 15:30:30 -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-437c74c475csm39595935e9.20.2025.01.15.15.30.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:29 -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 07/11] hw/mips/loongson3_virt: Propagate cpu_count to init_boot_param() Date: Thu, 16 Jan 2025 00:29:47 +0100 Message-ID: <20250115232952.31166-8-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Remove one use of the 'current_machine' global. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_virt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 93700a1612e..46b298f6d72 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -173,7 +173,7 @@ static uint64_t get_cpu_freq_hz(const MIPSCPU *cpu) return DEF_LOONGSON3_FREQ; } -static void init_boot_param(void) +static void init_boot_param(unsigned cpu_count) { static void *p; struct boot_params *bp; @@ -184,8 +184,7 @@ static void init_boot_param(void) bp->efi.smbios.vers = cpu_to_le16(1); 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, + init_loongson_params(&(bp->efi.smbios.lp), p, cpu_count, loaderparams.cpu_freq, loaderparams.ram_size); rom_add_blob_fixed("params_rom", bp, @@ -642,7 +641,7 @@ static void mips_loongson3_virt_init(MachineState *machine) loaderparams.kernel_entry = load_kernel(&cpu->env); init_boot_rom(); - init_boot_param(); + init_boot_param(machine->smp.cpus); } else { filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: LOONGSON3_BIOSNAME); From patchwork Wed Jan 15 23:29:48 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: 13941047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B17E7C02180 for ; Wed, 15 Jan 2025 23:31:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqW-0006nx-AW; Wed, 15 Jan 2025 18:30:48 -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 1tYCqP-0006iB-Vu for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:42 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCqM-00054y-FQ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:40 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso1603225e9.0 for ; Wed, 15 Jan 2025 15:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983834; x=1737588634; 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=fM8QVpnVbNxu0PP9F/y6d561pLUgSoGsgnDh4Rg5A+E=; b=OnxdvwQjwE/deAOnM1K7e8f6Umekr7xUzo6Uvh6dsvpRUTePSNQ5g4r0aqhkrMPwnP oU+KZzIcTFCzCBjSuXF7/096Lb3T8h/wZqr8nRDDDkgrGONh3qirRUNMEJhUsVdj5ju9 yChAva72d4oJvYWDriu+OaTj9Yy61E6aDP7tGBIGraYLrGgznP0/w3NScCIRxvvrCQac Snn47jblud2k2J7uk4cb3RhjQ+cmmeZ4/5e4Ub4sSgY1ME1r5YxE9DSLwDFzXeBwS+Xy ZdO2jiiiKTGJ+03gmTLsWm+TtVphVpmo8Izr91wuhGWCqukpmh7pZlFpY+JEduVFWmFW zwBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983834; x=1737588634; 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=fM8QVpnVbNxu0PP9F/y6d561pLUgSoGsgnDh4Rg5A+E=; b=AfVieOnPaGdTZJZewIAzMwu4neOCCAxKXPl3VUFXxqxFmIphOg3IharQStPmy1HJu9 ku2ddT7pFoN3tutoPmAgzLTDJJda9IFeVYOc83jZKI69zkneRhuZ3rn4CdHHeeBc7Cfc iihqyB8I+RX9RFqrGLkuaqyA1ci6EYm2i6hWESTLO85rG3BimoHs1l0js4kttZ5Q1gjU EP4EKnwdWWUfMbYrUQvcoEUwTyJlUoHFkwqsghMI3K7HyP6ZhAhVYfHLgqFNHw6Y7JFg 8DDYdNd0XW2VXlB74k4Kdjh8AzRsPJ/zgJRnUSnf7R/DKe8s8oY+xscDxNmLauZqAteH SPRg== X-Gm-Message-State: AOJu0Yxo6FrGkU66OVaiXSLDfZoPymkvLGxaOoU6/UKAnnUBtCBC+VzJ hW6+v53L3XtqD5RZnTLeyIUNzrq/+f9RVDO+dGurGvrQU+MnQk6D6ySrLPfRpKOVlYShlQ9+Sth WXaE= X-Gm-Gg: ASbGncsValyjgZZDWQmQCTBbr37H46MhzuzK57HQsNk+0jOuhhOOCQmwOGXz/O4b06x a5D0GWa2L5nSaZJ2CkoLrl+9FEIs4yG2tsJPqfp5I069C2BW2B9GnbbcgZpfJl/jOglpaGJ8Fwx RW0epHiZ4uiTsglqWjYfJl4R2NqjRKRwcoida4p0xBqfcwPfWz8aTy/4ZdssigIEUS928pN6JtY CdmJQ6Q0oDY9Wus1wFkj3GrQ6Al95su1czZN1gL6ZdT+ou6am2QNoX72Ja3KAQgM7HpLaBAqDyP HCCEXWPtV70VLkM0PXLnI38cvVIDP2M= X-Google-Smtp-Source: AGHT+IG5Rw3meZcPTpFQZvHiTYRV2SIeQt5p2vF2D6q5+u7IY8f0TDR/BQd1Ppa5RxgJXAtHKm2pjQ== X-Received: by 2002:a05:600c:4744:b0:434:a7e7:a1ca with SMTP id 5b1f17b1804b1-436e26f043dmr261071995e9.20.1736983834635; Wed, 15 Jan 2025 15:30:34 -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-437c753caf3sm38034465e9.38.2025.01.15.15.30.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:34 -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 08/11] hw/mips/loongson3_bootp: Propagate processor_id to init_cpu_info() Date: Thu, 16 Jan 2025 00:29:48 +0100 Message-ID: <20250115232952.31166-9-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_bootp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/mips/loongson3_bootp.c b/hw/mips/loongson3_bootp.c index 91b58a71a68..1aab26df69e 100644 --- a/hw/mips/loongson3_bootp.c +++ b/hw/mips/loongson3_bootp.c @@ -27,12 +27,12 @@ #include "hw/mips/loongson3_bootp.h" static void init_cpu_info(void *g_cpuinfo, uint32_t cpu_count, - uint64_t cpu_freq) + uint32_t processor_id, uint64_t cpu_freq) { struct efi_cpuinfo_loongson *c = g_cpuinfo; c->cputype = cpu_to_le32(Loongson_3A); - c->processor_id = cpu_to_le32(MIPS_CPU(first_cpu)->env.CP0_PRid); + c->processor_id = cpu_to_le32(processor_id); if (cpu_freq > UINT_MAX) { c->cpu_clock_freq = cpu_to_le32(UINT_MAX); } else { @@ -115,7 +115,7 @@ 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_count, cpu_freq); + init_cpu_info(p, MIPS_CPU(first_cpu)->env.CP0_PRid, 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); From patchwork Wed Jan 15 23:29:49 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: 13941048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DE5DC02180 for ; Wed, 15 Jan 2025 23:31:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqe-0007KV-6X; Wed, 15 Jan 2025 18:30:56 -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 1tYCqX-0006rN-Ri for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:49 -0500 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 1tYCqV-00057K-DT for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:49 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-436637e8c8dso2310685e9.1 for ; Wed, 15 Jan 2025 15:30:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983839; x=1737588639; 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=LPfEuWSADruS/h30T44F0SKsyqf+Ay7mwCICSC78CDM=; b=gTuRMLt939VkP72k11a48XpbFTX0cKKLjK3VcXYqrkvEeXPiTbK2FxwTAVdtU8kg/r WJ0eyZ6tG72KJz7QrFdllx+6/02RJHNlGhE4Lz5ydA/EnQhYTNl+I5urpEHoPXYooMF5 Vw+l9f+2zNDyOWhylCj8M7RUBgqRHjdd4+PpZbJ6El2/4R9rQ1iY0zo3edFCllPccKDf R8Iv0VOOF6SIwb2BIazSWgxl0+PQIb00J6IYC9nHMkRpnHWd5FtmoZBaUvXTOkdOirmo bHf7lrE2AMy+01Fa6iNMwdB8xMv2GCijA4C4vu8SBM6BP1n2N+o/drQQmgRtoa/OMv6H ohTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983839; x=1737588639; 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=LPfEuWSADruS/h30T44F0SKsyqf+Ay7mwCICSC78CDM=; b=AkWugjzyL5YsBY1baR2mV8x8KuhM48N6QJib1k+fC8XqkjyOluWuQojIdHggLvH99g q6LIAv6KNmr8BMCbVSDxJchtQbvBdJqDsOHuEpDbcWZpUFKLoP2LSv6c0+6YP+6yF7yf IsiTtvZYTe9+uH7ehZmb5/ljDskSPwW0bktjr/mF7qJZ7j7EASCVxuVJJBdDNlYETcRo g6/Cn1DONnaNKb5O9aao36fJdU4dDyADthmUV4wHZCTvLfRLGjBLdy1SxPfT46ykW3VD 9lXxIIEubd8rAjlSjEg2lbCuiKM6V3NTBLd70Y8wolxIkQfFgh06/FEve3zVbfqjUxYt UyoA== X-Gm-Message-State: AOJu0YyvPh2coe9bPtFzTsrCKK8FCeKX/t3672tZ6GoIZ6gdQhQPTQd4 /hzly0pAo6EJkutDDTeaN4uoF/Rc+bU9wlvcApz/ZGjvnlLcg51qRF5V8U8tp4jgpMf4pxntiFn AkgM= X-Gm-Gg: ASbGncuPqXwg6J8v+WYofLuvM1bq5mGjnBcOYBmjBMGihuzmMfvzpwRjYH+Skdfc8gq 1o0FoawRPafNLfKxTO8ih10Bni4n2b6GnTrB4eCFEzPQlHJgQuiG1QPQtOJ1IZL+PNcyPn4DS/B OvJ3ka4AF5lqygv6m5MNau3h8Gg3Jm7fWgF73Y07y1OblgDue9VUUygKYLerCVRDrfsMgkfkUxU UD/7+lcx/gKnQbbCVjoidApDvttLaRjiV+ZnpwMK41f5Ftd1K6jl3NO0VftquzL1MVqK3oIgNtZ WmJw9/rXi8AJ2p6eb73OsKhZJUXjWxw= X-Google-Smtp-Source: AGHT+IFkYieEgvAkCaAW0lBC7oadYK/agKj99REyjPiW4Wdbkx4U0xW5R9uvhrpNbu8Vj3C9fQD/ow== X-Received: by 2002:a05:600c:4455:b0:434:f623:a004 with SMTP id 5b1f17b1804b1-436e26adfd7mr241108485e9.16.1736983839148; Wed, 15 Jan 2025 15:30:39 -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-437c74c4751sm38628335e9.19.2025.01.15.15.30.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:38 -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 09/11] hw/mips/loongson3_virt: Propagate processor_id to init_loongson_params() Date: Thu, 16 Jan 2025 00:29:49 +0100 Message-ID: <20250115232952.31166-10-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::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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Remove one &first_cpu use in hw/mips/loongson3_bootp.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_bootp.h | 2 +- hw/mips/loongson3_bootp.c | 5 ++--- hw/mips/loongson3_virt.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/mips/loongson3_bootp.h b/hw/mips/loongson3_bootp.h index ee6340e42c1..9dc325a8557 100644 --- a/hw/mips/loongson3_bootp.h +++ b/hw/mips/loongson3_bootp.h @@ -233,7 +233,7 @@ enum { extern const MemMapEntry virt_memmap[]; void init_loongson_params(struct loongson_params *lp, void *p, - uint32_t cpu_count, + uint32_t cpu_count, uint32_t processor_id, 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 1aab26df69e..67812666c5b 100644 --- a/hw/mips/loongson3_bootp.c +++ b/hw/mips/loongson3_bootp.c @@ -23,7 +23,6 @@ #include "qemu/cutils.h" #include "qemu/bswap.h" #include "exec/hwaddr.h" -#include "cpu.h" #include "hw/mips/loongson3_bootp.h" static void init_cpu_info(void *g_cpuinfo, uint32_t cpu_count, @@ -112,10 +111,10 @@ static void init_special_info(void *g_special) } void init_loongson_params(struct loongson_params *lp, void *p, - uint32_t cpu_count, + uint32_t cpu_count, uint32_t processor_id, uint64_t cpu_freq, uint64_t ram_size) { - init_cpu_info(p, MIPS_CPU(first_cpu)->env.CP0_PRid, cpu_count, cpu_freq); + init_cpu_info(p, cpu_count, processor_id, 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 46b298f6d72..4924ea88eda 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -185,6 +185,7 @@ static void init_boot_param(unsigned cpu_count) init_reset_system(&(bp->reset_system)); p += ROUND_UP(sizeof(struct boot_params), 64); init_loongson_params(&(bp->efi.smbios.lp), p, cpu_count, + MIPS_CPU(first_cpu)->env.CP0_PRid, loaderparams.cpu_freq, loaderparams.ram_size); rom_add_blob_fixed("params_rom", bp, From patchwork Wed Jan 15 23:29:50 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: 13941053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36308C02180 for ; Wed, 15 Jan 2025 23:32:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqf-0007RM-IM; Wed, 15 Jan 2025 18:30:57 -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 1tYCqY-0006rv-6t for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:50 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCqV-00059n-FU for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:49 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-38632b8ae71so269765f8f.0 for ; Wed, 15 Jan 2025 15:30:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983844; x=1737588644; 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=oBmzOwwa/rqiVq09wwGIeAFFq9Z7MiUbusM3HZSK1Bs=; b=lryqALIrnpwG61/VosLmHrbIcLUlJEewhsfGiOZPEJ5l1Ak4YFwCmu8n6dTlkBTcxi HK1ZwaEcRTNWXmY7jTIN4TsO01Vovg+TsGCs5yrPKMOKay6RyoBLW2IopxdB50lJF3We 1FaSPkNZnqQ8IWRxOXndZNy/zVrFVY4Pqa0GVU8RwXKLONt4bqiWFTtAvFUAxgbse94m qG5SXHJHObYM4JzyFXXYPforbSj4TdjzO8vA/uLC3j81Tt+lVoRIGqjFCtxtiWlloaxD 5XX2Hw6lrQMxSdLibS2Cc4dnBZuobpNbMqunQRpA8dZd6siG69Ab+59iyo99pxvwJf2D iTpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983844; x=1737588644; 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=oBmzOwwa/rqiVq09wwGIeAFFq9Z7MiUbusM3HZSK1Bs=; b=q02SgzyvpJscXg00n7xkncyq8hjgWsVwIGoVGBmhO8OaJqBfkonhi/13SH0pFAe8+y 1dGhBRYAMz4IJoUoN2QvpEYTmNJ3wASMLrWl4oPC7/SVQcsWKiZ8Wve/uEfJrkj2j29c 3vFa5lAXjuMASd7M+5rvjWqNjYAM1H0RArXgwmYiJNyVhcY2gFXnzs8lziLz11DbDSMY JXlDs5exjp2HI+k2MO1emfjYj6lndN6IPKghhrYGV8a/ZvOTu5xv+mw9Ad1RfZrs+tHJ Bo0XPrSlQIojF0klzvXRCibKE9zlIX8JiJ8goVEMoqkvnqh5iLSNejpU3jQbS5Fdcspw WHRQ== X-Gm-Message-State: AOJu0YyJnwwitVA6ofgAFxschWGeN2oIrxLsYCW3zZfaSRYEaiEP/ZIt 55BBhSo0PD95klJQFs7yBnPdAfae/xbidwcxA/9kdZDXdqJNKkBqDLx5DGw0p67EaaEZirRYli9 bsa0= X-Gm-Gg: ASbGncszoryALlvEbWlR+/c3uvM+fhTNaKj/gnnAIF/2bCXpsXpHgY6OgYLkmR+Ilpu cTK+lAnk5tP23xGk5WH9ZINHwCxI/7w649WHMq0qR8rSTnGMpwsn3iuFNTfGJObZwliwWdG0l/x 2o16vfPPTyAuBiwbfOGddW68UjU2MnorM8ccwQLhFsGQwUkrr6DP79fojIeGeuckS6nB5iYnWCJ sXHKFUgejfVAO2nZukf5Aw4rt3iEClHX6hqvGQ/RKvBWwnZTJR+JiVxhjNOb4Th0vzScFNrcJMM a6kaEIKhAVYOWbYd3DCQE4a213DThvU= X-Google-Smtp-Source: AGHT+IECMYKwfs99AUPDlyT8MMED+2wzNOLIBYVrN8sF9XcniKU6ROqXqL3JmUp6tLqBjgHn7pBeNw== X-Received: by 2002:a05:6000:144d:b0:388:e377:8a1b with SMTP id ffacd0b85a97d-38a8730cc78mr28628549f8f.28.1736983843838; Wed, 15 Jan 2025 15:30:43 -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-437c74aca93sm39607455e9.13.2025.01.15.15.30.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:43 -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 10/11] hw/mips/loongson3_virt: Propagate %processor_id to init_boot_param() Date: Thu, 16 Jan 2025 00:29:50 +0100 Message-ID: <20250115232952.31166-11-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::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Propagate %processor_id from mips_loongson3_virt_init() where we have a reference to the first vCPU, so use it instead of the &first_cpu global. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/loongson3_virt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 4924ea88eda..7d6369876ba 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -173,7 +173,7 @@ static uint64_t get_cpu_freq_hz(const MIPSCPU *cpu) return DEF_LOONGSON3_FREQ; } -static void init_boot_param(unsigned cpu_count) +static void init_boot_param(unsigned cpu_count, uint32_t processor_id) { static void *p; struct boot_params *bp; @@ -184,8 +184,7 @@ static void init_boot_param(unsigned cpu_count) bp->efi.smbios.vers = cpu_to_le16(1); init_reset_system(&(bp->reset_system)); p += ROUND_UP(sizeof(struct boot_params), 64); - init_loongson_params(&(bp->efi.smbios.lp), p, cpu_count, - MIPS_CPU(first_cpu)->env.CP0_PRid, + init_loongson_params(&(bp->efi.smbios.lp), p, cpu_count, processor_id, loaderparams.cpu_freq, loaderparams.ram_size); rom_add_blob_fixed("params_rom", bp, @@ -642,7 +641,7 @@ static void mips_loongson3_virt_init(MachineState *machine) loaderparams.kernel_entry = load_kernel(&cpu->env); init_boot_rom(); - init_boot_param(machine->smp.cpus); + init_boot_param(machine->smp.cpus, cpus[0]->env.CP0_PRid); } else { filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: LOONGSON3_BIOSNAME); From patchwork Wed Jan 15 23:29:51 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: 13941051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 445CDC02180 for ; Wed, 15 Jan 2025 23:31:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYCqh-0007aZ-2f; Wed, 15 Jan 2025 18:30:59 -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 1tYCqc-0007BS-92 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:54 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYCqa-0005CY-DT for qemu-devel@nongnu.org; Wed, 15 Jan 2025 18:30:53 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-437a92d7b96so2243365e9.2 for ; Wed, 15 Jan 2025 15:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736983850; x=1737588650; 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=7DNHrtCXUBQyNp6czmCeP9tPr+zdqB+MqJBbYxRNIgo=; b=hamJ5yiL2K5FJXt7utojqV+Mx+ldY8x2X4cVS8CIzEo/fzXHucf0Dd/oGxtWhLo9dc ABE5dn3fYoGaRdim3oLXSPxZ4rrKgj8u26EhV3HKHbaKZiqSpbeYBygKFH0qIS6kzf2l eL8jPyt4fXpRvy/cuSIl+liXtlJiH75oCxkvaXZK/XtUDhQe2mFnZFzrpWuJuTCyiu0A J+L/mrC+DGYwzZFVoNq720waxEoTToJNfv8VkzYT5wzXvQtAF/jdABjcFygY6PXSNg6t fpAK/linUFoXHRq3xCFdg9z+SESnASSgjb+DzuwN6Y30f6j1S6FCKvRHawbM50rckDYB Vtqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736983850; x=1737588650; 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=7DNHrtCXUBQyNp6czmCeP9tPr+zdqB+MqJBbYxRNIgo=; b=R5jkC/Y4aWFmPFGV2Mio2QCDaxPng/ZP9bI0IL5k7xIcVnZDMd95H6g6pGIkdEAO7g EfhrouUcwKa1hs0ZS+Dku3PGvBIi50USMC+YB0kFoSdcSYV7nhLjhjMwzQ7bAmACjoM/ rZcQayQu1iKo8lfOvDvIWdNWWvyZ2RfpZvBgrmGPs62hMo2X9xYZTUIzJfcmjucwd+r0 QriiFWYEJseVAJ35kRz4aYeY9ikxkkfHDNvHOrLemosumpLmuahNddPD74xGiXAvd81I X8exdrQwOmRYdIXWFV4dIPMqp4hT11MM7OrQEKo9RChADu8emlKtlIF61LS0LksAUy+k mu2g== X-Gm-Message-State: AOJu0YyGbRnev1J61TJ7zviARtA4mtoiP16Cwz+i2zEBGYXW4Z0aIdyN hDMA9aBd0YqweeuRij5vC9LePZcco6kkqWa6YCOP7WOoWJ4fzwSpGE9tfQDA8bRXkiu07L3ZDhE +xlc= X-Gm-Gg: ASbGncsesiauDmiSBJHiEoTw+L23unJ1zmNUcE/7K/w27LlygvUwlFeL5dXE/Th+koq XiCw10AVNS00eozpRmeiJKHii/Jm+oPiUjg11ymQhSNiME4Sh86oSYNL132eeedSAlRE8psz60x Ebqbje+b2E5nmCWdeao8yvNZkAlfK0e/FFeslWkjE4yTp8DankYiX44oeR1m4sZhqLEoAAZPn+j AIXy/QM6WoKftfmmSeXXzEdgbCrulvID2AT5KrWkAEFUr46VgLZFXCs7hhkUWUNnZOKmvX5pgd/ jIRWohC50cESCnLATz30sAVMmsur0qg= X-Google-Smtp-Source: AGHT+IE8BvobjsS4J1B0Sa/UkwX8XRTPMB7NVtCNm0yz1CwICFnZHzJL4qV0gSkbmaYtIC154XStEQ== X-Received: by 2002:a05:600c:5112:b0:434:a386:6cf with SMTP id 5b1f17b1804b1-436e267f77amr270344785e9.2.1736983849976; Wed, 15 Jan 2025 15:30:49 -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-437c74bfa35sm38536625e9.18.2025.01.15.15.30.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jan 2025 15:30:48 -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 11/11] hw/mips/loongson3_bootp: Move to common_ss[] Date: Thu, 16 Jan 2025 00:29:51 +0100 Message-ID: <20250115232952.31166-12-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org loongson3_bootp.c doesn't contain any target-specific code and can be build generically, move it to common_ss[]. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/mips/meson.build b/hw/mips/meson.build index fcbee53bb32..31dbd2bf4d9 100644 --- a/hw/mips/meson.build +++ b/hw/mips/meson.build @@ -1,7 +1,8 @@ mips_ss = ss.source_set() mips_ss.add(files('bootloader.c', 'mips_int.c')) common_ss.add(when: 'CONFIG_FW_CFG_MIPS', if_true: files('fw_cfg.c')) -mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loongson3_virt.c')) +common_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c')) +mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_virt.c')) mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c')) mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))