From nobody Wed Apr 2 13:08:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1743263072550275.36544648631923; Sat, 29 Mar 2025 08:44:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tyYLh-0003fU-7P; Sat, 29 Mar 2025 11:43:53 -0400 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 1tyYLK-0003bb-Mw for qemu-devel@nongnu.org; Sat, 29 Mar 2025 11:43:31 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyYLI-0003Bm-0A for qemu-devel@nongnu.org; Sat, 29 Mar 2025 11:43:30 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id BD8D34E6036; Sat, 29 Mar 2025 16:43:24 +0100 (CET) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id hdVUEhX8Btmg; Sat, 29 Mar 2025 16:43:22 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id C01E34E602E; Sat, 29 Mar 2025 16:43:22 +0100 (CET) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <87fd654be0c91a1ebd3b0c2c1a2beca0c480f546.1743262839.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 1/2] system/datadir: Add new type constant for DTB files To: qemu-devel@nongnu.org Cc: Edgar E. Iglesias , Paolo Bonzini Date: Sat, 29 Mar 2025 16:43:22 +0100 (CET) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1743263078225019101 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently DTB files are mixed with ROMs under BIOS type. Separate them under a new type constant and turn defines into an enum while at it. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/microblaze/boot.c | 2 +- hw/ppc/ppc440_bamboo.c | 2 +- hw/ppc/sam460ex.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- include/qemu/datadir.h | 13 +++++++++---- system/datadir.c | 3 ++- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 60b4ef0abe..4a9c9df318 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -130,7 +130,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, bool is= _little_endian, dtb_arg =3D current_machine->dtb; /* default to pcbios dtb as passed by machine_init */ if (!dtb_arg && dtb_filename) { - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); + filename =3D qemu_find_file(QEMU_FILE_TYPE_DTB, dtb_filename); } =20 boot_info.machine_cpu_reset =3D machine_cpu_reset; diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 099fda3909..6fff0d8afb 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -64,7 +64,7 @@ static int bamboo_load_device_tree(MachineState *machine, uint32_t tb_freq =3D 400000000; uint32_t clock_freq =3D 400000000; =20 - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FI= LE); + filename =3D qemu_find_file(QEMU_FILE_TYPE_DTB, BINARY_DEVICE_TREE_FIL= E); if (!filename) { return -1; } diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 7dc3b309c8..327fac440f 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -142,7 +142,7 @@ static int sam460ex_load_device_tree(MachineState *mach= ine, uint32_t clock_freq =3D CPU_FREQ; int offset; =20 - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FI= LE); + filename =3D qemu_find_file(QEMU_FILE_TYPE_DTB, BINARY_DEVICE_TREE_FIL= E); if (!filename) { error_report("Couldn't find dtb file `%s'", BINARY_DEVICE_TREE_FIL= E); exit(1); diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 17115be74d..c9969ae48a 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -146,7 +146,7 @@ static int xilinx_load_device_tree(MachineState *machin= e, /* Try the local "ppc.dtb" override. */ fdt =3D load_device_tree("ppc.dtb", &fdt_size); if (!fdt) { - path =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TRE= E_FILE); + path =3D qemu_find_file(QEMU_FILE_TYPE_DTB, BINARY_DEVICE_TREE= _FILE); if (path) { fdt =3D load_device_tree(path, &fdt_size); g_free(path); diff --git a/include/qemu/datadir.h b/include/qemu/datadir.h index 21f9097f58..16db3d8cd3 100644 --- a/include/qemu/datadir.h +++ b/include/qemu/datadir.h @@ -1,12 +1,17 @@ #ifndef QEMU_DATADIR_H #define QEMU_DATADIR_H =20 -#define QEMU_FILE_TYPE_BIOS 0 -#define QEMU_FILE_TYPE_KEYMAP 1 +typedef enum { + QEMU_FILE_TYPE_BIOS, + QEMU_FILE_TYPE_KEYMAP, + QEMU_FILE_TYPE_DTB, +} QemuFileType; + /** * qemu_find_file: * @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS) - * or QEMU_FILE_TYPE_KEYMAP (for keymaps). + * QEMU_FILE_TYPE_KEYMAP (for keymaps) + * QEMU_FILE_TYPE_DTB (for device tree blobs). * @name: Relative or absolute file name * * If @name exists on disk as an absolute path, or a path relative @@ -20,7 +25,7 @@ * * Returns: a path that can access @name, or NULL if no matching file exis= ts. */ -char *qemu_find_file(int type, const char *name); +char *qemu_find_file(QemuFileType type, const char *name); void qemu_add_default_firmwarepath(void); void qemu_add_data_dir(char *path); void qemu_list_data_dirs(void); diff --git a/system/datadir.c b/system/datadir.c index c9237cb5d4..e450b84ce9 100644 --- a/system/datadir.c +++ b/system/datadir.c @@ -30,7 +30,7 @@ static const char *data_dir[16]; static int data_dir_idx; =20 -char *qemu_find_file(int type, const char *name) +char *qemu_find_file(QemuFileType type, const char *name) { int i; const char *subdir; @@ -44,6 +44,7 @@ char *qemu_find_file(int type, const char *name) =20 switch (type) { case QEMU_FILE_TYPE_BIOS: + case QEMU_FILE_TYPE_DTB: subdir =3D ""; break; case QEMU_FILE_TYPE_KEYMAP: --=20 2.41.3 From nobody Wed Apr 2 13:08:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174326307929943.16456593064936; Sat, 29 Mar 2025 08:44:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tyYLh-0003fe-Cy; Sat, 29 Mar 2025 11:43:53 -0400 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 1tyYLK-0003bc-NO for qemu-devel@nongnu.org; Sat, 29 Mar 2025 11:43:31 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyYLH-0003CP-Ac for qemu-devel@nongnu.org; Sat, 29 Mar 2025 11:43:30 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id C4FF04E6039; Sat, 29 Mar 2025 16:43:25 +0100 (CET) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id LrP7dcC-nOmZ; Sat, 29 Mar 2025 16:43:23 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id CACC24E6031; Sat, 29 Mar 2025 16:43:23 +0100 (CET) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 2/2] pc-bios: Move device tree files in their own subdir To: qemu-devel@nongnu.org Cc: Edgar E. Iglesias , Paolo Bonzini Date: Sat, 29 Mar 2025 16:43:23 +0100 (CET) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1743263080634019100 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We have several device tree files already and may have more in the future so add a new dtb subdirectory and move device tree files there so they are not mixed with ROM binaries. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 +- pc-bios/{ =3D> dtb}/bamboo.dtb | Bin pc-bios/{ =3D> dtb}/bamboo.dts | 0 pc-bios/{ =3D> dtb}/canyonlands.dtb | Bin pc-bios/{ =3D> dtb}/canyonlands.dts | 0 pc-bios/dtb/meson.build | 23 +++++++++++++++++++++ pc-bios/{ =3D> dtb}/petalogix-ml605.dtb | Bin pc-bios/{ =3D> dtb}/petalogix-ml605.dts | 0 pc-bios/{ =3D> dtb}/petalogix-s3adsp1800.dtb | Bin pc-bios/{ =3D> dtb}/petalogix-s3adsp1800.dts | 0 pc-bios/meson.build | 23 +-------------------- system/datadir.c | 4 +++- 12 files changed, 28 insertions(+), 24 deletions(-) rename pc-bios/{ =3D> dtb}/bamboo.dtb (100%) rename pc-bios/{ =3D> dtb}/bamboo.dts (100%) rename pc-bios/{ =3D> dtb}/canyonlands.dtb (100%) rename pc-bios/{ =3D> dtb}/canyonlands.dts (100%) create mode 100644 pc-bios/dtb/meson.build rename pc-bios/{ =3D> dtb}/petalogix-ml605.dtb (100%) rename pc-bios/{ =3D> dtb}/petalogix-ml605.dts (100%) rename pc-bios/{ =3D> dtb}/petalogix-s3adsp1800.dtb (100%) rename pc-bios/{ =3D> dtb}/petalogix-s3adsp1800.dts (100%) diff --git a/MAINTAINERS b/MAINTAINERS index d54b5578f8..9349950527 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1569,7 +1569,7 @@ F: hw/pci-host/ppc440_pcix.c F: hw/display/sm501* F: hw/ide/sii3112.c F: hw/rtc/m41t80.c -F: pc-bios/canyonlands.dt[sb] +F: pc-bios/dtb/canyonlands.dt[sb] F: pc-bios/u-boot-sam460ex-20100605.bin F: roms/u-boot-sam460ex F: docs/system/ppc/amigang.rst diff --git a/pc-bios/bamboo.dtb b/pc-bios/dtb/bamboo.dtb similarity index 100% rename from pc-bios/bamboo.dtb rename to pc-bios/dtb/bamboo.dtb diff --git a/pc-bios/bamboo.dts b/pc-bios/dtb/bamboo.dts similarity index 100% rename from pc-bios/bamboo.dts rename to pc-bios/dtb/bamboo.dts diff --git a/pc-bios/canyonlands.dtb b/pc-bios/dtb/canyonlands.dtb similarity index 100% rename from pc-bios/canyonlands.dtb rename to pc-bios/dtb/canyonlands.dtb diff --git a/pc-bios/canyonlands.dts b/pc-bios/dtb/canyonlands.dts similarity index 100% rename from pc-bios/canyonlands.dts rename to pc-bios/dtb/canyonlands.dts diff --git a/pc-bios/dtb/meson.build b/pc-bios/dtb/meson.build new file mode 100644 index 0000000000..7a71835bca --- /dev/null +++ b/pc-bios/dtb/meson.build @@ -0,0 +1,23 @@ +dtbs =3D [ + 'bamboo.dtb', + 'canyonlands.dtb', + 'petalogix-ml605.dtb', + 'petalogix-s3adsp1800.dtb', +] + +dtc =3D find_program('dtc', required: false) +if dtc.found() + foreach out : dtbs + f =3D fs.replace_suffix(out, '.dts') + custom_target(f, + build_by_default: have_system, + input: files(f), + output: out, + install: get_option('install_blobs'), + install_dir: qemu_datadir / 'dtb', + command: [ dtc, '-q', '-I', 'dts', '-O', 'dtb', + '-o', '@OUTPUT@', '@INPUT0@' ]) + endforeach +else + install_data(dtbs, install_dir: qemu_datadir / 'dtb') +endif diff --git a/pc-bios/petalogix-ml605.dtb b/pc-bios/dtb/petalogix-ml605.dtb similarity index 100% rename from pc-bios/petalogix-ml605.dtb rename to pc-bios/dtb/petalogix-ml605.dtb diff --git a/pc-bios/petalogix-ml605.dts b/pc-bios/dtb/petalogix-ml605.dts similarity index 100% rename from pc-bios/petalogix-ml605.dts rename to pc-bios/dtb/petalogix-ml605.dts diff --git a/pc-bios/petalogix-s3adsp1800.dtb b/pc-bios/dtb/petalogix-s3ads= p1800.dtb similarity index 100% rename from pc-bios/petalogix-s3adsp1800.dtb rename to pc-bios/dtb/petalogix-s3adsp1800.dtb diff --git a/pc-bios/petalogix-s3adsp1800.dts b/pc-bios/dtb/petalogix-s3ads= p1800.dts similarity index 100% rename from pc-bios/petalogix-s3adsp1800.dts rename to pc-bios/dtb/petalogix-s3adsp1800.dts diff --git a/pc-bios/meson.build b/pc-bios/meson.build index 34d6616c32..34d8cc4f33 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -86,31 +86,10 @@ blobs =3D [ 'vof-nvram.bin', ] =20 -dtc =3D find_program('dtc', required: false) -foreach f : [ - 'bamboo.dts', - 'canyonlands.dts', - 'petalogix-s3adsp1800.dts', - 'petalogix-ml605.dts', -] - out =3D fs.replace_suffix(f, '.dtb') - if dtc.found() - custom_target(f, - build_by_default: have_system, - input: files(f), - output: out, - install: get_option('install_blobs'), - install_dir: qemu_datadir, - command: [ dtc, '-q', '-I', 'dts', '-O', 'dtb', - '-o', '@OUTPUT@', '@INPUT0@' ]) - else - blobs +=3D out - endif -endforeach - if get_option('install_blobs') install_data(blobs, install_dir: qemu_datadir) endif =20 subdir('descriptors') +subdir('dtb') subdir('keymaps') diff --git a/system/datadir.c b/system/datadir.c index e450b84ce9..f96f8fc264 100644 --- a/system/datadir.c +++ b/system/datadir.c @@ -44,9 +44,11 @@ char *qemu_find_file(QemuFileType type, const char *name) =20 switch (type) { case QEMU_FILE_TYPE_BIOS: - case QEMU_FILE_TYPE_DTB: subdir =3D ""; break; + case QEMU_FILE_TYPE_DTB: + subdir =3D "dtb/"; + break; case QEMU_FILE_TYPE_KEYMAP: subdir =3D "keymaps/"; break; --=20 2.41.3