From patchwork Fri Jan 31 21:04: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: 861042 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp930715wrr; Fri, 31 Jan 2025 13:11:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVMsWQxi0fgIXrGlZGmvi/jU5k2WjhCHHroCGo2SWptEkSl2HKmyOCJ8FDsGwC03r/I3E0jhg==@linaro.org X-Google-Smtp-Source: AGHT+IEB+9u9QRjmPKG1BQGL3CttLUSgK7l8Cd+gy52yKV4rvKrYt1VKfBkLzdR2CseVndAop7+9 X-Received: by 2002:a05:622a:1189:b0:467:b7de:da8a with SMTP id d75a77b69052e-46fd0a80792mr201844781cf.6.1738357875477; Fri, 31 Jan 2025 13:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738357875; cv=none; d=google.com; s=arc-20240605; b=Ma52k6uys5QZ7m0HhyOrEtRyN2ezjd4JtUrHsiCDLasLpWaW5kpqoTPuEJmZNVjmcg dbV3pWv4f7MWRve+sIWpVXMSf/s5gQ8ZAXSV0ev+rXHgM+WDABJpSsa7Fy8wRKKkZnOK KraXa347xkOMtcYv8pYMVOEXlslSvP2Q5p2nGypOfJNRIU8GnVlttcnGv198awjanzkz SGd5vzAw6R7G4dbILRcAUxkcjtKb3dI/B0Vz89KZ9ovCCwEK64XagRBv3YaIlcx467G5 88lYNRLMAiLpzM3CZXgxJdqc9HuiD+IHLLFk2K4kV5ET1B4smpGnjgu1UgcNy3yNoA6P A65g== 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=15w1nupw+QeCLHgv52eCdDFsKAOjsC/FzZz5ZeEtw0g=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=OrGnlwHFu5lFSJyIsLbME/hCemxzIzxHoWUnXxEswaatBIvictRC+VVHoom6xK7Ndr Ci6umx3PfrL3P/lhhZcvknmlYpyeOnAPJIUZTlGVyKh94itn0cx8/WgQS2LCJ1KWYAb5 CLtm4VyhVbeblD4GiL45ZrpHPROmf8fjIHsAA/BepZfCBsxt2Vuje2jHEQ5mZyDDBla+ ut44cs4WzSALv1TER0i4m8lAln1AS1Lsp8thi7cvNs6VsgQQvKUmAOGnxWL86H+wt9U9 LdiHWDJdm53YmSqZdc9RUbBz0tR4m4jfASnzzsTg/+v4h7l50gtCN9yh5nd1ApllUxQw DFJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EQZemB7Z; 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 d75a77b69052e-46fdf1e4626si45950031cf.595.2025.01.31.13.11.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Jan 2025 13:11:15 -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=EQZemB7Z; 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 1tdyCv-00061t-02; Fri, 31 Jan 2025 16:05:45 -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 1tdyCq-00061I-EP for qemu-devel@nongnu.org; Fri, 31 Jan 2025 16:05:40 -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 1tdyCp-0007n8-0H for qemu-devel@nongnu.org; Fri, 31 Jan 2025 16:05:40 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4363ae65100so29280385e9.0 for ; Fri, 31 Jan 2025 13:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738357537; x=1738962337; 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=15w1nupw+QeCLHgv52eCdDFsKAOjsC/FzZz5ZeEtw0g=; b=EQZemB7ZPz4tY7RRzGIVjXhNZTgc3CBEGid3KzPznhSY0oT66lkPSgO7PezrGSk5SQ vn//uTqpl44kjo5ayrnRhitsmwfzgWj3wLBdrYuC+HPHA5+Q5r5MtD5qfEhJim7pNF6E vm0dEjUXyb0sNEMNMh4hT0TSU1dQuudR0zqf5DfwJYOTXILXYjgVYlk3l0Gg2R0R0lhn modgmA8O5EF4O3EvVZvs6Ea0Rzine5ngaMnEf2yFkCe0lIBJmkJTzoFyM3tTeC7SMB7+ 9XKgpqFV4x3OlB7vcmmTOywV0UENdM+O3eCQsuSerGUFl9rkvXt7tU3Wva8LGMaGsIRq TzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738357537; x=1738962337; 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=15w1nupw+QeCLHgv52eCdDFsKAOjsC/FzZz5ZeEtw0g=; b=rP+5gSE+LNyG4LixaA3zK7GDMhO1paQrs8xSdMb3H7IXWZGGcsFy4sav4syC5AaBn6 AAqawse9WltHH5Wfq7NgJXShTr/0ppKpMO3gs65ZH2cs39ECiYKT8sRCJgJiO0bHT5KI i7Tguygg89bZckZwnCHJvhhh5gtmFu8lnv9WuZqw7LVl4AeOJAQ1GhZx3B/LAoh3GqMf Zu+3oB8NntByi+YiIBs0p3vUX30GJ8B/VoHN7AefB5NJ6aJTpDU37HhHJGfiqtopZslF kNHoV1/Jr9DcD3TF76jEKrN5tRkkazbar6tPoZWxBRtAPfgmtfTUp1Bt+5/qfkvo+eOs D4KQ== X-Gm-Message-State: AOJu0Yw50uCa7bh3RpGuwIElqYDSq7iFFn4h5uD0PLNbdxJp+r/7ZRY1 w1YqyB59a+uGFPvs2Wmjawb5iO3Z1HPC0h5nQY4NLSPj0Yr71lTW459gV3vIWNSHqXY6+sIaXG9 uke8= X-Gm-Gg: ASbGncv1Uq+k0oEJm94/mmCBfQhse5vIRfVRwaqwY7m7rLPV7SnYsKjnW3lxY2cvF9o SEOMmJ2G6rYcnYmjvzIbrMDLfq2diuRgQ1VRwULhjEjTZF/v4jXMzgeAfyjYyOIJ/lA8ztFmMhx 7lHRIOiMd8Ekba6P95AzEPxZpRlCahxzz9j8UOEU+Y0v7Zw/AXPzDtZc9NrPHOZi/y7Id78PRP5 xst/e1a9HQC+Kn/pDpCTUXqOaiJ7JxP46Fvxctn+AaIxhqBe6LUgydppmwIYrFs5CNLIWopt8Xd Njy2dW20VqFKoyc4n7hYKbsAS3gCK3AZWHoeZVuodDV/o7kgM05tzmv0kwYi6Q6viQ== X-Received: by 2002:a7b:c5d7:0:b0:431:542d:2599 with SMTP id 5b1f17b1804b1-438e07cd500mr105141355e9.22.1738357537202; Fri, 31 Jan 2025 13:05:37 -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-38c5c1cf53asm5467812f8f.87.2025.01.31.13.05.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 31 Jan 2025 13:05:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 03/36] hw/mips/loongson3_virt: Invert vCPU creation order to remove &first_cpu Date: Fri, 31 Jan 2025 22:04:46 +0100 Message-ID: <20250131210520.85874-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250131210520.85874-1-philmd@linaro.org> References: <20250131210520.85874-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20250115232952.31166-3-philmd@linaro.org> --- hw/mips/loongson3_virt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 47d112981a2..28d4eaf1e59 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -492,9 +492,8 @@ static void mips_loongson3_virt_init(MachineState *machine) { int i; long bios_size; - MIPSCPU *cpu; + MIPSCPU *cpu = NULL; 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,7 @@ static void mips_loongson3_virt_init(MachineState *machine) pin, cpu->env.irq[ip + 2]); } } - env = &MIPS_CPU(first_cpu)->env; + assert(cpu); /* This variable points to the first created cpu. */ /* Allocate RAM/BIOS, 0x00000000~0x10000000 is alias of 0x80000000~0x90000000 */ memory_region_init_rom(bios, NULL, "loongson3.bios", @@ -640,7 +639,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();