Re: [PATCH v2 10/13] hw/riscv/device-common, virt.c: add create_platform_bus()

Philippe Mathieu-Daudé <[email protected]>
Newsgroups org.nongnu.qemu-riscv,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 26/8/26 18:48, Daniel Henrique Barboza wrote:
> There will be code repetition instances added by the 'riscv-server-ref'
> board w.r.t device creation and initialization.  Instead of waiting for
> that code to land we're adding helpers beforehand.  The idea is to make
> the new board code shorter and more palatable for reviewers.
> 
> A new 'device-common' file is created for such helpers.  We'll start
> with the platform bus, a nice piece of software that only the 'virt'
> board uses so far, and the 'riscv-server-ref' will use to support TPM
> devices.
> 
> Signed-off-by: Daniel Henrique Barboza <[email protected]>
> ---
>   hw/riscv/device-common.c         | 48 ++++++++++++++++++++++++++++++++
>   hw/riscv/meson.build             |  1 +
>   hw/riscv/virt.c                  | 31 ++++-----------------
>   include/hw/riscv/device-common.h | 19 +++++++++++++
>   4 files changed, 73 insertions(+), 26 deletions(-)
>   create mode 100644 hw/riscv/device-common.c
>   create mode 100644 include/hw/riscv/device-common.h


> diff --git a/include/hw/riscv/device-common.h b/include/hw/riscv/device-common.h
> new file mode 100644
> index 0000000000..f91c39511f
> --- /dev/null
> +++ b/include/hw/riscv/device-common.h
> @@ -0,0 +1,19 @@
> +/*
> + * RISC-V board helpers for FDT generation.
> + *
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef RISCV_DEVICE_COMMON_H
> +#define RISCV_DEVICE_COMMON_H
> +
> +#include "exec/hwaddr.h"
> +#include "hw/core/qdev.h"
> +
> +DeviceState *create_platform_bus(DeviceState *irqchip,
> +                                 const MemMapEntry *platform_bus_mem,
> +                                 int platform_bus_base_irq,
> +                                 int platform_bus_num_irqs);

Ditto 'riscv_' prefix.

> +#endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.