From patchwork Mon Jan 13 00:47:39 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: 856905 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1213811wrc; Sun, 12 Jan 2025 16:51:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXK/Avv7shRAt+oIu3LkOYWZdTg96+GxX7jrst3o8JFn6z3Jd23fUmNfcr6F0JMdq3nrTNCAw==@linaro.org X-Google-Smtp-Source: AGHT+IFQkTwKMlvjgHVym/q7WgODup2mu9st2IL8ga16xk6s/rZNpDWrta3H9IROZXqFQRxbtTzn X-Received: by 2002:a05:622a:15c8:b0:467:67db:ef72 with SMTP id d75a77b69052e-46c71028f78mr335353301cf.27.1736729511835; Sun, 12 Jan 2025 16:51:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736729511; cv=none; d=google.com; s=arc-20240605; b=ACcYF4w/7HYLYUnEZkrt1om+opnwf+TseVWuIszCs422hI1CvY1Dqb7D85nlitr90z IIxBT6cTJeCtPLZhQAsWZf37zJf5DzsVFiL6c5hXJ2w1qRN0lIJAO5x695nl8M+QMm2x cRlPYBrisxNAtmtueEalHdZFglufzv+SbNPwbKvuDDmokFmzkaXeGMGFujDN2d0I3VkB rE6LK7kx+wXG0Wf+sJ3qy78tos/Jusll8FDE9nEXYePPDLnkK5BtH7Kbqj3jdVZwnSrY OmvCR7y9YHeVLjI6+3GGZKWgJJoyMWYw+kM4z3B3g94xZOYZAEDa5XeOZv15MHiKKYMw BLMA== 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=zLpUfFvaCy7mLELhl3n8PPeN1TDF+RaDGuZ4JtW2qZE=; fh=NAziacGX1oLRG5aXR1KEGKyZTrl+lhslKvmHcMEZt5Y=; b=h6rs6iGmJyhigMAv/9KyrROBO2u3aygAQuW92G8jGx2RYjX6lEatzViiIVY6SVeg34 +wkHluMSoK4mr7QFt9Csske2/Uj4yLR0Xl9PplDu7ALTUl3+I9Izz3ZX85ZC8a/kBmOH CV9FAZ1/mdaojsfOUMXF/9j/qtQlDTmVuA2CQupQpTPLSWPhsdIfigzOtPCL4SEtHGUw 5nuo+r0li2LTO55fDvrccn5NoO3aypbpQkx92y6e07G9xPfvW9EyAmX/WduKFOHud9dT QL+Jms4AVBCvjyu2Ed3+lKlM4aFpTWMGLAaFzcOtNq8uepB1nVD0OuJiuvgtu+TeB3Zy hdDw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UvFUxL2h; 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-46c87412d83si77638781cf.483.2025.01.12.16.51.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2025 16:51:51 -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=UvFUxL2h; 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 1tX8dp-0005pi-0J; Sun, 12 Jan 2025 19:49:17 -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 1tX8dm-0005ga-MQ for qemu-devel@nongnu.org; Sun, 12 Jan 2025 19:49:14 -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 1tX8dl-0000qf-1s for qemu-devel@nongnu.org; Sun, 12 Jan 2025 19:49:14 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385ddcfc97bso3205405f8f.1 for ; Sun, 12 Jan 2025 16:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736729351; x=1737334151; 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=zLpUfFvaCy7mLELhl3n8PPeN1TDF+RaDGuZ4JtW2qZE=; b=UvFUxL2hU+4OuNAHFD+jKvnzFDzoaBO77LB/PjGiTqBhha2d7rzvHLviXBKyqxqAUH 4ljN0SxzbPFoKWS/OihII25N9NmNFAAF1k/xxof/mF9L0gc0kFlSNv9VewfaMxD6QROr SqfpoVjMSj7saT90JqgupL4Z33MwutFzW0+WJZtRm7agspwSpd/M8etJuODgecoCAjUc Kb+gJ3rHIUoqrXvkrsUKs/6JfScl2TjuVReXI9ts3pQpDPthGrBUiAWx3E+iacNJgnx/ GimTfta9y43+2/WsjW2v1WazzOgLX3/3HT914wuuPICHSHEVV7OifLewyUaRb2Gwej7H rPZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736729351; x=1737334151; 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=zLpUfFvaCy7mLELhl3n8PPeN1TDF+RaDGuZ4JtW2qZE=; b=HP7ZSmJpcdnS+jflUtMpRMDVpfw9Q5nJye8u1op7xqVsS10Hc00/MIK60nMVjZs+kT SGzp5FYNKTC6/G29XMjKK7gxKxZQiN7cpESfytTAvOE+uA0iNrBTATZAhWC3RVV9Icr/ GTXWxNGGTUOcPMFMW+/6FEax29j9nH0+FFyPKBeipceF6t/WAjuNKhM5/MoZHcdtewJC 68zj6ztZsXuedvPXkd/LOqVcuM0obdxkBPjotRpzbkE5d/odtt0iV5w/l4eysB+kBeoh cF6EeaiAirZPl2mGwH2kKoXDOuDATqvoLgQi9wn/NPyHrhW9UcL1qVILpsqjXzCLmkYF vDWg== X-Gm-Message-State: AOJu0YzgA1mVwJRMrmGZ12XlYE9Co64zMLuF6PtIwn+9j7QX3J277wUe ZVUlTABPEFt81kjb/x7Nx/JfElh/YkeXZ35kdjpWQG/YhNtsVc7EqT4rSmGSg4SUUP+U4TJHqa/ 93zg= X-Gm-Gg: ASbGncu6SJfb+4FS6JMZO7glaU/vSwtJBhWfHXL1Bw+hs064id1/jQkjZxAJ8Znejgw OUCFBXhc3vwyyWvY2F8S5GSPx2v+2IiHbuVDl1pf2vT0S4RkwQZWM48uM9lFmPTxeKGxX1sBm3N ZF6XkYUZFJb5wAMXyyLS5hF7ZiwYDuLHuPYhReWx4N9lskD5aZQAhkZE3U+Q8ELoIyj9jLKkxei lpjDIS/SF5WPL2xkK0k/2PNT7O8i9oTmDMfauZzuTlUhvHCPPbbS51DU+1b5Wm+3sDH9nFEMeWK qkpcE+ixdleigD8wd03sweMrpy42V/M= X-Received: by 2002:a5d:47af:0:b0:38b:dbeb:63a2 with SMTP id ffacd0b85a97d-38bdbeb64acmr1820182f8f.55.1736729350992; Sun, 12 Jan 2025 16:49: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-436e9d8fc51sm127732735e9.7.2025.01.12.16.49.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Jan 2025 16:49:09 -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?= , Aleksandar Rikalo , Huacai Chen , Paul Burton , Aurelien Jarno , Jiaxun Yang Subject: [PATCH 14/23] hw/mips/bootloader: Propagate CPU to bl_gen_jump_kernel() Date: Mon, 13 Jan 2025 01:47:39 +0100 Message-ID: <20250113004748.41658-15-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113004748.41658-1-philmd@linaro.org> References: <20250113004748.41658-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Propagate the target agnostic CPU pointer to the publicly declared bl_gen_jump_kernel() function. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/mips/bootloader.h | 2 +- hw/mips/bootloader.c | 14 +++++++------- hw/mips/boston.c | 2 +- hw/mips/fuloong2e.c | 2 +- hw/mips/malta.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/hw/mips/bootloader.h b/include/hw/mips/bootloader.h index daa2b92e249..6b58eafb8bc 100644 --- a/include/hw/mips/bootloader.h +++ b/include/hw/mips/bootloader.h @@ -13,7 +13,7 @@ #include "target/mips/cpu-qom.h" void bl_gen_jump_to(const MIPSCPU *cpu, void **ptr, target_ulong jump_addr); -void bl_gen_jump_kernel(void **ptr, +void bl_gen_jump_kernel(const MIPSCPU *cpu, void **ptr, bool set_sp, target_ulong sp, bool set_a0, target_ulong a0, bool set_a1, target_ulong a1, diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index 6f055228392..9804051ab2d 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -256,7 +256,7 @@ void bl_gen_jump_to(const MIPSCPU *cpu, void **p, target_ulong jump_addr) bl_gen_nop(&cpu->env, p); /* delay slot */ } -void bl_gen_jump_kernel(void **p, +void bl_gen_jump_kernel(const MIPSCPU *cpu, void **p, bool set_sp, target_ulong sp, bool set_a0, target_ulong a0, bool set_a1, target_ulong a1, @@ -265,22 +265,22 @@ void bl_gen_jump_kernel(void **p, target_ulong kernel_addr) { if (set_sp) { - bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_SP, sp); + bl_gen_load_ulong(&cpu->env, p, BL_REG_SP, sp); } if (set_a0) { - bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A0, a0); + bl_gen_load_ulong(&cpu->env, p, BL_REG_A0, a0); } if (set_a1) { - bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A1, a1); + bl_gen_load_ulong(&cpu->env, p, BL_REG_A1, a1); } if (set_a2) { - bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A2, a2); + bl_gen_load_ulong(&cpu->env, p, BL_REG_A2, a2); } if (set_a3) { - bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A3, a3); + bl_gen_load_ulong(&cpu->env, p, BL_REG_A3, a3); } - bl_gen_jump_to(MIPS_CPU(first_cpu), p, kernel_addr); + bl_gen_jump_to(cpu, p, kernel_addr); } void bl_gen_write_ulong(void **p, target_ulong addr, target_ulong val) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 63dc654192a..3a06b776fe8 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -352,7 +352,7 @@ static void gen_firmware(void *p, hwaddr kernel_entry, hwaddr fdt_addr) * a2/$6 = 0 * a3/$7 = 0 */ - bl_gen_jump_kernel(&p, + bl_gen_jump_kernel(MIPS_CPU(first_cpu), &p, true, 0, true, (int32_t)-2, true, fdt_addr, true, 0, true, 0, kernel_entry); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 16b6a5129e7..b87622ee6e3 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -179,7 +179,7 @@ static void write_bootloader(CPUMIPSState *env, uint8_t *base, /* Second part of the bootloader */ p = (uint32_t *)(base + 0x040); - bl_gen_jump_kernel((void **)&p, + bl_gen_jump_kernel(MIPS_CPU(first_cpu), (void **)&p, true, ENVP_VADDR - 64, true, 2, true, ENVP_VADDR, true, ENVP_VADDR + 8, diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 37be2330eda..fe9e06f48f4 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -678,7 +678,7 @@ static void bl_setup_gt64120_jump_kernel(void **p, uint64_t run_addr, cpu_mips_phys_to_kseg1(NULL, 0x1be00000 + 0xcfc), tswap32(ldl_be_p(pci_pins_cfg))); - bl_gen_jump_kernel(p, + bl_gen_jump_kernel(MIPS_CPU(first_cpu), p, true, ENVP_VADDR - 64, /* * If semihosting is used, arguments have already