Re: [PATCH v2 04/13] hw/riscv/fdt_common, virt.c: add create_fdt_pcie()

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:
> The pcie FDT is quite tedious but can be parametrized into a helper.
> This is going to benefit only the 'virt' board for now but it will be
> used by the 'riscv-server-ref' board in the near future too.
> 
> Some other changes made:
> 
> - FDT related macros are moved to fdt-common.h.  Only a couple are being
>    used by the helper ATM but more will be added in the next patches;
> - an RISCVAIAType enum is created.  There are several FDTs that depends
>    on the active AIA type being used, and we want a way to represent the
>    different AIA modes that doesn't re-use the 'virt' specific VIRT_AIA_*
>    macros.  The enum vals are equivalent by design - we want "s->aia_type"
>    to be used by 'virt' when calling the fdt helpers, and other boards
>    will use "AIA_*" macros in their code.
> 
> No FDT changes made.
> 
> Signed-off-by: Daniel Henrique Barboza <[email protected]>
> ---
>   hw/riscv/fdt-common.c         | 108 ++++++++++++++++++++++++++++++++++
>   hw/riscv/virt.c               | 108 ++--------------------------------
>   include/hw/riscv/fdt-common.h |  26 ++++++++
>   include/hw/riscv/virt.h       |  15 -----
>   4 files changed, 140 insertions(+), 117 deletions(-)


> diff --git a/include/hw/riscv/fdt-common.h b/include/hw/riscv/fdt-common.h
> index 37a1544706..bee8b85597 100644
> --- a/include/hw/riscv/fdt-common.h
> +++ b/include/hw/riscv/fdt-common.h
> @@ -11,6 +11,27 @@
>   
>   #include "target/riscv/cpu.h"
>   
> +#define FDT_PCI_ADDR_CELLS    3
> +#define FDT_PCI_INT_CELLS     1
> +#define FDT_PLIC_ADDR_CELLS   0
> +#define FDT_PLIC_INT_CELLS    1
> +#define FDT_APLIC_INT_CELLS   2
> +#define FDT_APLIC_ADDR_CELLS  0
> +#define FDT_IMSIC_INT_CELLS   0
> +#define FDT_MAX_INT_CELLS     2
> +#define FDT_MAX_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
> +                                 1 + FDT_MAX_INT_CELLS)
> +#define FDT_PLIC_INT_MAP_WIDTH  (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
> +                                 1 + FDT_PLIC_INT_CELLS)
> +#define FDT_APLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
> +                                 1 + FDT_APLIC_INT_CELLS)

I'm a bit suspiscious these numbers will always match for
any machine. No objection although.
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.