From patchwork Mon Jan 13 00:47:37 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: 856904 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1213516wrc; Sun, 12 Jan 2025 16:50:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUJQeI9V1yedlnJ/JCH1sdvAxRwwFrjrwBxjqik6xHH5Ick3cVvseMGOieM+m7/ia4lfAYukw==@linaro.org X-Google-Smtp-Source: AGHT+IET1gOkljLfsrQydlVcB66DrAd86RbvIC5bZjBSgNFJtdr5RYf6z47iwREF2jiXJ00TAwNF X-Received: by 2002:a05:622a:1911:b0:466:9861:3e9c with SMTP id d75a77b69052e-46c71030790mr284530201cf.31.1736729418587; Sun, 12 Jan 2025 16:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736729418; cv=none; d=google.com; s=arc-20240605; b=aV+32gKQU0fgHQUz327fUnbprvwYcDvWi6dtYdRsMUjjEZSx5yySojW/wKEjrPWhEL UgpnfjY1nciWS9HRXHwNVCb46Q75OuNdUzx3RJtLz2VPS8/D/Qu9d0vEYJUConh1j0jE wnqLKPqlADX410TMtcbEMOoyu6h0M+l/TsgBAw1M8d0WUHOGQOO+tP2mEaQ799sJR6/a uwtOJaM06K/xD5/z5IqDAWhGs8dW2o8itkg2khyeD/gXdJ5MQO+qxfa5AUk3xZwupVX1 Rkh36F84vVSfpz7PIgNKEiWE4nHmzPtmRhdArm5SkVUqP8CS8/TJr+Wika7HiznaOgNh D95g== 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=hxBO2LM7TvF6Z9ULUfgrFZWB9JLE9hlbq/zhhRtO/AA=; fh=NAziacGX1oLRG5aXR1KEGKyZTrl+lhslKvmHcMEZt5Y=; b=dHeQR2CmtQnBbz8bQps+WKv2YrGvznTQ+qgdVtogngDTqgLq29nY1GYzX58n5Fex5D G2GPtJZ3QbSUM7DtZ9UZkzPgoOI8nsYBNLCi8CGXTz6AVxBDgcdNP7R9/AU57ZLgk/l7 J+YkU2fQ9qJVGurdxby1fQuXRIHhcPIG7mlZBlqloy59om1b/wkEvQ5pLZxfphoF73dp a+qV5hhW8RqaoHW2zWJgcglIe9zIgpk16f5ioFHeh5xlNUNaYBAAEnXe8RFyGYH6Cej0 VTuqpKAjPDwfPdCaICTMUfvj/vyVLExUYt3muW00A389lI216ADHnGYUyWrKNSd4k/qB HqdQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KeEnAnvT; 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-46c873e4d9fsi77923241cf.213.2025.01.12.16.50.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2025 16:50:18 -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=KeEnAnvT; 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 1tX8di-0005Uk-VU; Sun, 12 Jan 2025 19:49:11 -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 1tX8dc-0005Pf-U6 for qemu-devel@nongnu.org; Sun, 12 Jan 2025 19:49:05 -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 1tX8db-0000ox-3D for qemu-devel@nongnu.org; Sun, 12 Jan 2025 19:49:04 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-436249df846so25760475e9.3 for ; Sun, 12 Jan 2025 16:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736729341; x=1737334141; 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=hxBO2LM7TvF6Z9ULUfgrFZWB9JLE9hlbq/zhhRtO/AA=; b=KeEnAnvTJtnE0VCP/COko3HRcNzVTGcopuRsfi6MIxO4X/Atn0IkVOtXHLk9obIYWA +SK0asXgmFMDx01bQJGtCRDeosKZJQz7kO4EFr/ZJMJKSNs9MQAJ1FschRWJEUobH2NF ljtSRpEr5UAn2ZjDR1YQrXc+1QT1yasgtXdNzIJ2tgBxZ3L2h+FK+ijASZ5SVoBs2YjA eU6Ifm1rXL8oAdS9oGi/TlM6OXmjTstGg1xCCMvqHKrb6rTCmWO0luseMvwd3dpIcJp0 o3hZo2/HZDo64PPIAM043Gxy1RcTI7D5sV7dXhm5fb3EHdVy4bvCzbkL2zLBuhDH4AVq 9j1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736729341; x=1737334141; 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=hxBO2LM7TvF6Z9ULUfgrFZWB9JLE9hlbq/zhhRtO/AA=; b=ihsAaM5tiaIbJ0gmZhQvcq1heHZmmm7ucc6gjI0iOFerjbrN/59Na5YYz2jDZ4h/Wd +pSHyXXG8Zbxa7+ujYx77Y4ydxPBbivSg9SycBgAroASFMe4IgPajjD+n/W/maeVzDgp 3W+aw9MlTCbp8cjcdekNfWsTny5qddPnYmuHi/xRreCjq/kb2he4SsMzAFJBlMxpF2t3 2xoieD7svE6j740MwG467JWXTwli3Y9dv/cyNY6GZtHgXzegiUrod01m1nmEbgQViSY3 O6k8fYw8FXIZdETsS3UAFrnaI8srHEArpkV6XF6Hy1ys7eMx21haPVGVsn5wu+BhlQ7n NGIg== X-Gm-Message-State: AOJu0YzBqwejtMh8JY3sL9VaR5jZ8eRuI/Zal0gMH7eBigO50YRms8n0 5QyIZrZsJ6ZSB/8Y/bgLmfX5zYGhgTvzxdXALOETZgX67O+2pv5z5RKN2Fkexg+5I3tvYu9C+XG w3CI= X-Gm-Gg: ASbGncseEPnJwA3HmjtbqGGuLwb9WZ0Gdz4ABJ4LVLw/Qg4iRn8kNSOm+HMa/Q9rYFS w5MvUks1b/Funnr0Xnl8RMhkbIiR+rbStgcvEibpyXPvXdQ+aZ7wH1tZu3xNId2hNgWhKLzSlgX 5dx8HCVA1gw4nPugGi8V7Us6nC/fp8YkxIdHMuebzAK9UksfNHTjDLV0Dn7k/1s/qaD3pyI/XVR MdtkABvrRJY8w7aEnFL/ILiZ0z0ZQCUOo+r5gUXAeDXM5wPqItslJA1O/TDvdbwimR0a5FShK3W Ijww4Knrm016ZGG/TuSjI0rYpdPY5Lo= X-Received: by 2002:a05:600c:3b99:b0:434:f925:f5c9 with SMTP id 5b1f17b1804b1-436e266dfe9mr148100005e9.6.1736729341154; Sun, 12 Jan 2025 16:49:01 -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-436e2dc08eesm162988605e9.10.2025.01.12.16.48.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Jan 2025 16:49:00 -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 12/23] hw/mips/bootloader: Propagate CPU env to bl_gen_load_ulong() Date: Mon, 13 Jan 2025 01:47:37 +0100 Message-ID: <20250113004748.41658-13-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::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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Propagate the target specific CPU env to the locally declared bl_gen_load_ulong() function. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/bootloader.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index 95ee59f33c9..e29eb5e92f3 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -238,19 +238,20 @@ static void bl_gen_dli(const CPUMIPSState *env, void **p, bl_gen_ori(p, rt, rt, extract64(imm, 0, 16)); } -static void bl_gen_load_ulong(void **p, bl_reg rt, target_ulong imm) +static void bl_gen_load_ulong(const CPUMIPSState *env, void **p, + bl_reg rt, target_ulong imm) { - if (bootcpu_supports_isa(&MIPS_CPU(first_cpu)->env, ISA_MIPS3)) { - bl_gen_dli(&MIPS_CPU(first_cpu)->env, p, rt, imm); /* 64bit */ + if (bootcpu_supports_isa(env, ISA_MIPS3)) { + bl_gen_dli(env, p, rt, imm); /* 64bit */ } else { - bl_gen_li(&MIPS_CPU(first_cpu)->env, p, rt, imm); /* 32bit */ + bl_gen_li(env, p, rt, imm); /* 32bit */ } } /* Helpers */ void bl_gen_jump_to(void **p, target_ulong jump_addr) { - bl_gen_load_ulong(p, BL_REG_T9, jump_addr); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_T9, jump_addr); bl_gen_jalr(&MIPS_CPU(first_cpu)->env, p, BL_REG_T9); bl_gen_nop(&MIPS_CPU(first_cpu)->env, p); /* delay slot */ } @@ -264,19 +265,19 @@ void bl_gen_jump_kernel(void **p, target_ulong kernel_addr) { if (set_sp) { - bl_gen_load_ulong(p, BL_REG_SP, sp); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_SP, sp); } if (set_a0) { - bl_gen_load_ulong(p, BL_REG_A0, a0); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A0, a0); } if (set_a1) { - bl_gen_load_ulong(p, BL_REG_A1, a1); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A1, a1); } if (set_a2) { - bl_gen_load_ulong(p, BL_REG_A2, a2); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A2, a2); } if (set_a3) { - bl_gen_load_ulong(p, BL_REG_A3, a3); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A3, a3); } bl_gen_jump_to(p, kernel_addr); @@ -284,8 +285,8 @@ void bl_gen_jump_kernel(void **p, void bl_gen_write_ulong(void **p, target_ulong addr, target_ulong val) { - bl_gen_load_ulong(p, BL_REG_K0, val); - bl_gen_load_ulong(p, BL_REG_K1, addr); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, val); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K1, addr); if (bootcpu_supports_isa(&MIPS_CPU(first_cpu)->env, ISA_MIPS3)) { bl_gen_sd(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0); } else { @@ -296,13 +297,13 @@ void bl_gen_write_ulong(void **p, target_ulong addr, target_ulong val) void bl_gen_write_u32(void **p, target_ulong addr, uint32_t val) { bl_gen_li(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, val); - bl_gen_load_ulong(p, BL_REG_K1, addr); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K1, addr); bl_gen_sw(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0); } void bl_gen_write_u64(void **p, target_ulong addr, uint64_t val) { bl_gen_dli(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, val); - bl_gen_load_ulong(p, BL_REG_K1, addr); + bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K1, addr); bl_gen_sd(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0); }