From patchwork Tue Dec 31 20:22:05 2024 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: 854401 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7089509wrq; Tue, 31 Dec 2024 12:23:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXRGMUcvGg0YkEOpQ02OppLQH0TvWoREAW3IXihYK041vZ0wn8HDHQb/7ERltfohyGH6dXxxg==@linaro.org X-Google-Smtp-Source: AGHT+IG6pqfhDlcwfAMPBOw4P7D4gbJALFAjWf4jSUZ+uQJnBxEp0mYxeOslZZKUzpqX+kQ4pi4z X-Received: by 2002:a05:620a:1706:b0:7b6:ebc6:181a with SMTP id af79cd13be357-7b9ba7f68d8mr5710063385a.41.1735676624571; Tue, 31 Dec 2024 12:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735676624; cv=none; d=google.com; s=arc-20240605; b=GPyAwBzvPIRQqFIOvOcs3/VAMDJmN7MZrvl4pZebNWM4YypL4e02aUDSoUKu3eCsNs aG2oTW81W1ChPDDxyIkZomKg5z7t87Ye9gYns1JNr4EZ2gUOcfgXZbLiJermWC4lZ+i2 lLQj30rxRp4BEF8lMWwQu9HnWe1NLPzO1NbtyfW3pPgtlWI7efcXHXqiMymkCTfilXnm Devt6snu8/YUe8XR16UxGEk/F0DzOuQ8Dg31CDZvqv3iCcwM7+NJfFDiKIO3oW/YFqdi 3RhPT1ckmgNdoc5nl3/W4iIXMKqZKhbEXYSyGXkjUXL5M+XOAyFnLso7K5d4bUQb1V87 p/5g== 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=9UzpwHwbOoYdzO4Z1to6i1SI44M6INou8CYiONK44XQ=; fh=9ryy5d9yM4+mge+SJGod7b/IwVykaYdArJ0wPRnwp4o=; b=i4QjHwN4B5PB+BeVoJu2aJXMY5ADM38wCgU8s8I7+wkPQzm75y1dqBjgjK1pp+MtGn PZjNQ+vF9PcsailC/7jCLmVW7KWoUPvt5naQNMJmNS9qyrB90nrvGGSP7rK8DfnNa1YS Zp0lh/ytQ2Gc8LS10OPQhlH+1KzNf8bgDv9VxcU7Zr0GOgr+73tUBlbVnkUZdaTR6XEp +A8JgxBEnIjtqCZPmu0dfnxJx09GIP+kRFquXJAhegRZpD369dJ9IeQQ4PeHuK9cfpV6 4ytrMdItmpsW0pDEwvmgzW5rBPwjYShMf0/Ye4KT8CP+mYG0zifcmn2aLa8wWyy0gRKV dXTQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W+hNRuPU; 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-46a3ec058a7si89884581cf.712.2024.12.31.12.23.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Dec 2024 12:23:44 -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=W+hNRuPU; 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 1tSilc-0002M3-TM; Tue, 31 Dec 2024 15:23:04 -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 1tSilb-0002La-FN for qemu-devel@nongnu.org; Tue, 31 Dec 2024 15:23:03 -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 1tSilZ-0000qF-PI for qemu-devel@nongnu.org; Tue, 31 Dec 2024 15:23:03 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-436202dd730so74017235e9.2 for ; Tue, 31 Dec 2024 12:23:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735676579; x=1736281379; 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=9UzpwHwbOoYdzO4Z1to6i1SI44M6INou8CYiONK44XQ=; b=W+hNRuPUlDM1UKHUN/m3lWuKpEgcRgzZWFZ30DcU6NtSIOUpuMEQSRs1DwG152X74U 7FRaQ9Ptcx2jKW8/emrU63Jn74TocIIWtvicRtsxXzEreTYweYlXyhjq09KWNSjLWnuj m9Xhgjj3uNvsNwFwbmL4xLGEojTsVHz3s52sVgJjOjQoKPD3Lpy5yNWdaJwE5r9Jnxnt +pouPKzaFcHTOP1c983aojZ0pkLpXMIwMNNEVOnZn0FasDtAu30R+n/5NYkmBsaeyIi1 MzU5/Ntw4qjS4UICvUNeKOiA030itOX0h65K4sGDZTWVRNo0YTa6+gc00eNbC4fFcPNT TFzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735676579; x=1736281379; 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=9UzpwHwbOoYdzO4Z1to6i1SI44M6INou8CYiONK44XQ=; b=fWbuKh512ICV315Ey3RI+EiDhKfP5LNE1hzLUhhz4hhUTzL+9ueJh3PC8rJlboxEFQ 3eLCR+dj1zqsRXvcu8X8XT/HHQgnIJfQdkzJnJQcAsWkooHzfv9XQoPD16PKMm4+VZaO QRq2JZauTnNXETvYP26WJ8Ws1IPZmPmNv1OnG7HzbDMZIEuLJvb0PSQtcZe1vex0rFoM XQwxiXW0Lk8BzPvGjAkrEGiBBalqd+P//mlTpRGhSJ7Ut984h9xy7KkgNT5wnvysBFlP gGyDhSt08/2nIIydRIltCjokeEmg+YYlSmT6m20YpX2392+bW5XruQ7KUTs/CEOT+WRI 0q4A== X-Gm-Message-State: AOJu0YwvAtYF+auebCNVWjdn4FjRSuCq1QfgDVJB0BPJ921AMabiYqiV g798YJnUap1F7KeD74HHUVUPA9d3L5o9xZDlN6vnC9NMYbb6I7mpcDMNL1dHrxpUqZfrBXjgGdT k+r4= X-Gm-Gg: ASbGncvhlpDuVsI28g38M00I/Wur5g8cE2GW2d2b15pozxScVBM2cwNadsrSuYcvqiv Od+XKDWXxdq0qq8D+9FKr0Pku4EewZqg38SSQkvTQetgwIvUPUxq9eaMGUzUF5SelJVgNV7Ic/C OFv4bDf0eK0v/xq6HoEFkambbJLno3JId5dBC01TwIZFxtz7se4sAvXZD9fuxOvo8R9LU7AFRAJ i2SMHUtyaNkIx/4AsFR50zwVVmcImS/cCyktTdIJtp4rnTOcroGTvVSbFEK7tODDSGDcv2F5qL8 xzFfm+ljcMsSuWU1tOW1ic7opYIgBjU= X-Received: by 2002:a5d:6da3:0:b0:385:fb59:8358 with SMTP id ffacd0b85a97d-38a223fd8c8mr30036251f8f.53.1735676579330; Tue, 31 Dec 2024 12:22:59 -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-38a1c89e150sm33551345f8f.66.2024.12.31.12.22.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 31 Dec 2024 12:22:58 -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?= , Anton Johansson , Alistair Francis , "Edgar E. Iglesias" , Richard Henderson Subject: [PULL 06/29] hw/microblaze: Propagate CPU endianness to microblaze_load_kernel() Date: Tue, 31 Dec 2024 21:22:05 +0100 Message-ID: <20241231202228.28819-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241231202228.28819-1-philmd@linaro.org> References: <20241231202228.28819-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Pass vCPU endianness as argument so we can load kernels with different endianness (different from the qemu-system-binary builtin one). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson Message-Id: <20241107012223.94337-3-philmd@linaro.org> --- hw/microblaze/boot.h | 4 ++-- hw/microblaze/boot.c | 8 ++++---- hw/microblaze/petalogix_ml605_mmu.c | 2 +- hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +- hw/microblaze/xlnx-zynqmp-pmu.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/microblaze/boot.h b/hw/microblaze/boot.h index 5a8c2f79750..d179a551a69 100644 --- a/hw/microblaze/boot.h +++ b/hw/microblaze/boot.h @@ -2,8 +2,8 @@ #define MICROBLAZE_BOOT_H -void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, - uint32_t ramsize, +void microblaze_load_kernel(MicroBlazeCPU *cpu, bool is_little_endian, + hwaddr ddr_base, uint32_t ramsize, const char *initrd_filename, const char *dtb_filename, void (*machine_cpu_reset)(MicroBlazeCPU *)); diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 966fb2cb2a3..3854bc2291b 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -114,8 +114,8 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) return addr - 0x30000000LL; } -void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, - uint32_t ramsize, +void microblaze_load_kernel(MicroBlazeCPU *cpu, bool is_little_endian, + hwaddr ddr_base, uint32_t ramsize, const char *initrd_filename, const char *dtb_filename, void (*machine_cpu_reset)(MicroBlazeCPU *)) @@ -144,13 +144,13 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, /* Boots a kernel elf binary. */ kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, &entry, NULL, &high, NULL, - TARGET_BIG_ENDIAN, EM_MICROBLAZE, 0, 0); + !is_little_endian, EM_MICROBLAZE, 0, 0); base32 = entry; if (base32 == 0xc0000000) { kernel_size = load_elf(kernel_filename, NULL, translate_kernel_address, NULL, &entry, NULL, NULL, NULL, - TARGET_BIG_ENDIAN, EM_MICROBLAZE, 0, 0); + !is_little_endian, EM_MICROBLAZE, 0, 0); } /* Always boot into physical ram. */ boot_info.bootstrap_pc = (uint32_t)entry; diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c index deab275495d..8b44be75a22 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -204,7 +204,7 @@ petalogix_ml605_init(MachineState *machine) cpu->cfg.pvr_regs[5] = 0xc56be000; cpu->cfg.pvr_regs[10] = 0x0e000000; /* virtex 6 */ - microblaze_load_kernel(cpu, MEMORY_BASEADDR, ram_size, + microblaze_load_kernel(cpu, true, MEMORY_BASEADDR, ram_size, machine->initrd_filename, BINARY_DEVICE_TREE_FILE, NULL); diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index 4a969af1a01..2c0d8c34cd2 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -129,7 +129,7 @@ petalogix_s3adsp1800_init(MachineState *machine) create_unimplemented_device("xps_gpio", GPIO_BASEADDR, 0x10000); - microblaze_load_kernel(cpu, ddr_base, ram_size, + microblaze_load_kernel(cpu, !TARGET_BIG_ENDIAN, ddr_base, ram_size, machine->initrd_filename, BINARY_DEVICE_TREE_FILE, NULL); diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c index 567aad47bfc..bdbf7328bf4 100644 --- a/hw/microblaze/xlnx-zynqmp-pmu.c +++ b/hw/microblaze/xlnx-zynqmp-pmu.c @@ -172,7 +172,7 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine) qdev_realize(DEVICE(pmu), NULL, &error_fatal); /* Load the kernel */ - microblaze_load_kernel(&pmu->cpu, XLNX_ZYNQMP_PMU_RAM_ADDR, + microblaze_load_kernel(&pmu->cpu, true, XLNX_ZYNQMP_PMU_RAM_ADDR, machine->ram_size, machine->initrd_filename, machine->dtb,