Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 847BAEEC2B0 for ; Mon, 23 Feb 2026 23:56:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vufmG-0004IU-6P; Mon, 23 Feb 2026 18:55:48 -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 1vufmE-0004IH-JN; Mon, 23 Feb 2026 18:55:46 -0500 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 1vufmC-000760-9k; Mon, 23 Feb 2026 18:55:46 -0500 Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 13708596A0A; Tue, 24 Feb 2026 00:55:38 +0100 (CET) X-Virus-Scanned: amavis at eik.bme.hu Received: from zero.eik.bme.hu ([127.0.0.1]) by localhost (zero.eik.bme.hu [127.0.0.1]) (amavis, port 10028) with ESMTP id R09405UlWcLw; Tue, 24 Feb 2026 00:55:32 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 940B65969FD; Tue, 24 Feb 2026 00:55:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 913F45969FC; Tue, 24 Feb 2026 00:55:32 +0100 (CET) Date: Tue, 24 Feb 2026 00:55:32 +0100 (CET) From: BALATON Zoltan To: Ruslan Ruslichenko cc: =?ISO-8859-15?Q?Alex_Benn=E9e?= , Thomas Huth , qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, artem_mygaiev@epam.com, volodymyr_babchuk@epam.com, takahiro.nakata.wr@renesas.com, "Edgar E . Iglesias" , Ruslan_Ruslichenko@epam.com, philmd@linaro.org, wangyanan55@huawei.com, zhao1.liu@intel.com, pbonzini@redhat.com, Bernhard Beschow Subject: Re: [PATCH v2 19/33] hw/core/machine: add '-hw-dtb' option for machine In-Reply-To: Message-ID: References: <20260219143332.3316679-1-ruslichenko.r@gmail.com> <20260219144901.3317747-1-ruslichenko.r@gmail.com> <87y0kj4mr3.fsf@draig.linaro.org> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="3866299591-506529974-1771890007=:59426" Content-ID: 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-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3866299591-506529974-1771890007=:59426 Content-Type: text/plain; CHARSET=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT Content-ID: On Mon, 23 Feb 2026, Ruslan Ruslichenko wrote: > On Mon, Feb 23, 2026 at 2:23 PM Alex Bennée wrote: >> >> Thomas Huth writes: >> >>> Hi! >>> >>> On 19/02/2026 15.48, Ruslan Ruslichenko wrote: >>>> From: Ruslan Ruslichenko >>>> Add new '-hw-dtb' command-line option and corresponding >>>> MachineState property. >>>> The 'hw-dtb' option allows to specify a Device tree >>>> binary with hardware description which Qemu should >>>> emulate. >>>> Signed-off-by: Ruslan Ruslichenko >>>> --- >>>> hw/core/machine.c | 19 +++++++++++++++++++ >>>> include/hw/core/boards.h | 1 + >>>> qemu-options.hx | 9 +++++++++ >>>> system/vl.c | 3 +++ >>>> 4 files changed, 32 insertions(+) >>>> diff --git a/hw/core/machine.c b/hw/core/machine.c >>>> index d4ef620c17..affd24cd49 100644 >>>> --- a/hw/core/machine.c >>>> +++ b/hw/core/machine.c >>>> @@ -363,6 +363,20 @@ static void machine_set_dtb(Object *obj, const char *value, Error **errp) >>>> ms->dtb = g_strdup(value); >>>> } >>>> +static char *machine_get_hw_dtb(Object *obj, Error **errp) >>>> +{ >>>> + MachineState *ms = MACHINE(obj); >>>> + >>>> + return g_strdup(ms->hw_dtb); >>>> +} >>>> + >>>> +static void machine_set_hw_dtb(Object *obj, const char *value, Error **errp) >>>> +{ >>>> + MachineState *ms = MACHINE(obj); >>>> + >>>> + ms->hw_dtb = g_strdup(value); >>>> +} >>>> + >>>> static char *machine_get_dumpdtb(Object *obj, Error **errp) >>>> { >>>> MachineState *ms = MACHINE(obj); >>>> @@ -1145,6 +1159,11 @@ static void machine_class_init(ObjectClass *oc, const void *data) >>>> object_class_property_set_description(oc, "dtb", >>>> "Linux kernel device tree file"); >>>> + object_class_property_add_str(oc, "hw-dtb", >>>> + machine_get_hw_dtb, machine_set_hw_dtb); >>>> + object_class_property_set_description(oc, "hw-dtb", >>>> + "A device tree binary used to describe the hardware to QEMU"); >>> >>> Do the hardware dtbs differ from the ones that are passed to the Linux >>> kernel? If not, I think you likely could use the existing "dtb" >>> property for your new feature? >> >> They have to - the normal DTB cannot define the whole system because its >> only concerned with reporting what the kernel can see to the kernel and >> not defining the whole system including what the firmware sees. >> > > Yes, Indeed. > Normal DTB was explored, but there is not enough information to create > QEMU models from it. > Thus we need to have a separate device tree. What additional data is needed that's not present in dtb from firmware and what if that additional data is passed to the kernel? I think the kernel would just ignore the additional data that it doesn't need so one dtb might be enough even if it has to be more detailed than what the kernel normally gets. If that works we don't need a separate option. This series seems to be more complex than Bernhard's e500-fdt experiment (I've linked to that in ) Bernhard's patch only added minimal support for creating devices from fdt and then put additional logic in the devices instead of handling them in generic code. Would such an approach lead to simpler fdt handling? If not why is the additional complexity needed? Regards, BALATON Zoltan --3866299591-506529974-1771890007=:59426--