From nobody Sat Nov 23 10:51:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1730942618927353.8583682715197; Wed, 6 Nov 2024 17:23:38 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D9B121543; Wed, 6 Nov 2024 20:23:37 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C3F991581; Wed, 6 Nov 2024 20:22:54 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 277A6156E; Wed, 6 Nov 2024 20:22:51 -0500 (EST) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0C17C15BC for ; Wed, 6 Nov 2024 20:22:41 -0500 (EST) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3807dd08cfcso357747f8f.1 for ; Wed, 06 Nov 2024 17:22:40 -0800 (PST) Received: from localhost.localdomain ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed9ea4ebsm236852f8f.69.2024.11.06.17.22.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 06 Nov 2024 17:22:38 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730942560; x=1731547360; darn=lists.libvirt.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=gVNNU4zI0zabCVfTlK35ClBmqCQUm+VaEpaZeazC3V0=; b=DCWeuV1/oBP6U9v7gtZ6MAywd5iJcgpR7wzvQ0WQXFUx3m5Oh5gbdhEPQR6I9s2azN TwP/NbenrmFmYLefJr1RE3w/XDtgJf15VIRXKuoVs2FsiWYKYKo5oJ71A4ARvBUMgSgO 4V9TwgP7vf7v5LU5kGeQlPpmUxtB6hDXVOjpWz5VGnAYb98uOfmf8UaGtbYN70Cv9JZH CRnuhx5w0RUJd4He0znYKjSv6tMEOC/9ffn+vnwwV0bI+vgO0+KKJ+GR6BppDfQw/9DH lqWhfGk6ELSJPS0834zcuYzCGvdNP7qKGARgu9CzYkoc6V05ZYhZ78XGFPw5WFGuJQ5A ylug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730942560; x=1731547360; 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=gVNNU4zI0zabCVfTlK35ClBmqCQUm+VaEpaZeazC3V0=; b=YT2RrNq+h3a/0JIL5aW2ae+w8TaD3wXRgpTJtW7vcdOUBWy/6XeaftWVkoDab2kzqq Ve5DCLmNPRxk1jIOnY/YrdnKUNx83nZbxs5mzgvVFZckJlPzdcAoUizv+Q3A7sV/V4Uo AXzOeOaU9ZHDh6PgUFsFrAEK/uWUQxk9VPSSrgMFMUCj3WvmK5pLc4BFzdzKAQ0pLnPK CB8cVC6OqcQEXNKhlrbkfDaxnZ7IMLi2ZJEh4F/66nE/cPC7fts0CJwBvHrfppi7OUss 7BVCFob3H+zQBPrpgBE5nn1dL7bvP7dGCIUW+IGaxemZLcb+Gb6rvr9OBkyKzxs9vZy9 5Gmg== X-Forwarded-Encrypted: i=1; AJvYcCVajqqHPTw3BJia8MWoEVaMWIPVxHekucKbbcjZaaMRYW5+l6CGwmYNELhbr+U9atK9zTrxXw==@lists.libvirt.org X-Gm-Message-State: AOJu0YwBG32ZAwKKoHI+i1dHJvwbHWiZsebkQLNzfR3LR5K16Pp6MTYj bzsWoBGAbp8JJ6nmBsUbVXAugWKUJw+JJufhzqdWQ3/dRvzv8Mj19pGBW04n/pY= X-Google-Smtp-Source: AGHT+IHF/9u9vSjDc+iEMUU6zgLXg7t6PjmliJiRoRxwDU3e6wJ2JwVCJkzlXO5nfGZCw6iVBJR1xw== X-Received: by 2002:a05:6000:1fad:b0:37d:5130:b380 with SMTP id ffacd0b85a97d-381c7a5e114mr24972810f8f.23.1730942559815; Wed, 06 Nov 2024 17:22:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Subject: [PATCH v2 02/16] hw/microblaze: Propagate CPU endianness to microblaze_load_kernel() Date: Thu, 7 Nov 2024 01:22:08 +0000 Message-ID: <20241107012223.94337-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241107012223.94337-1-philmd@linaro.org> References: <20241107012223.94337-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TGBCK5VHBH55HZU5S37ZJMQZAAFZDYUO X-Message-ID-Hash: TGBCK5VHBH55HZU5S37ZJMQZAAFZDYUO X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Paolo Bonzini , Thomas Huth , Jason Wang , devel@lists.libvirt.org, qemu-ppc@nongnu.org, Alistair Francis , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Edgar E. Iglesias" , qemu-arm@nongnu.org, Peter Maydell , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis , "Edgar E . Iglesias" X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1730942620303116600 Content-Type: text/plain; charset="utf-8" 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=C3=A9 Reviewed-by: Anton Johansson Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias Message-Id: <20241105130431.22564-9-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 5a8c2f7975..d179a551a6 100644 --- a/hw/microblaze/boot.h +++ b/hw/microblaze/boot.h @@ -2,8 +2,8 @@ #define MICROBLAZE_BOOT_H =20 =20 -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 ed61e483ee..3675489fa5 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; } =20 -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, hwadd= r ddr_base, /* Boots a kernel elf binary. */ kernel_size =3D 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 =3D entry; if (base32 =3D=3D 0xc0000000) { kernel_size =3D 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 =3D (uint32_t)entry; diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_= ml605_mmu.c index 61e47d8398..d2b2109065 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] =3D 0xc56be000; cpu->cfg.pvr_regs[10] =3D 0x0e000000; /* virtex 6 */ =20 - 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/petal= ogix_s3adsp1800_mmu.c index 6c0f5c6c65..8110be8371 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -129,7 +129,7 @@ petalogix_s3adsp1800_init(MachineState *machine) =20 create_unimplemented_device("xps_gpio", GPIO_BASEADDR, 0x10000); =20 - 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-pm= u.c index 567aad47bf..bdbf7328bf 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); =20 /* 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, --=20 2.45.2