Hi Drew,

On 26-10-2026 23:17, Drew Fustini wrote:
> From: Nicolas Pitre <[email protected]>
> 
> Add CBQRI controllers to the RISC-V virt machine. The device properties
> can be fully configured from the command line:
> 
>   $ qemu-system-riscv64 -M virt ... \
>       -device riscv.cbqri.capacity,mmio_base=0x04828000[,...]
>       -device riscv.cbqri.bandwidth,mmio_base=0x04829000[,...]
> 
> The mmio_base option is mandatory, the others are optional.
> 
> Many -device arguments as wanted can be provided as long as their
> mmio regions don't conflict.
> 
> To see all possible options:
> 
>   $ qemu-system-riscv64 -device riscv.cbqri.capacity,help
>   riscv.cbqri.capacity options:
>     alloc_op_config_limit=<bool> -  (default: true)
>     alloc_op_flush_rcid=<bool> -  (default: true)
>     alloc_op_read_limit=<bool> -  (default: true)
>     at_code=<bool>         -  (default: true)
>     at_data=<bool>         -  (default: true)
>     max_mcids=<uint16>     -  (default: 256)
>     max_rcids=<uint16>     -  (default: 64)
>     mmio_base=<uint64>     -  (default: 0)
>     mon_evt_id_none=<bool> -  (default: true)
>     mon_evt_id_occupancy=<bool> -  (default: true)
>     mon_op_config_event=<bool> -  (default: true)
>     mon_op_read_counter=<bool> -  (default: true)
>     ncblks=<uint16>        -  (default: 16)
>     target=<str>
> 
>   $ qemu-system-riscv64 -device riscv.cbqri.bandwidth,help
>   riscv.cbqri.bandwidth options:
>     alloc_op_config_limit=<bool> -  (default: true)
>     alloc_op_read_limit=<bool> -  (default: true)
>     at_code=<bool>         -  (default: true)
>     at_data=<bool>         -  (default: true)
>     max_mcids=<uint16>     -  (default: 256)
>     max_rcids=<uint16>     -  (default: 64)
>     mmio_base=<uint64>     -  (default: 0)
>     mon_evt_id_none=<bool> -  (default: true)
>     mon_evt_id_rdonly_count=<bool> -  (default: true)
>     mon_evt_id_rdwr_count=<bool> -  (default: true)
>     mon_evt_id_wronly_count=<bool> -  (default: true)
>     mon_op_config_event=<bool> -  (default: true)
>     mon_op_read_counter=<bool> -  (default: true)
>     nbwblks=<uint16>       -  (default: 1024)
>     target=<str>
> 
> Boolean options correspond to hardware capabilities that can be disabled
> 
> Signed-off-by: Nicolas Pitre <[email protected]>
> Reviewed-by: Daniel Henrique Barboza <[email protected]>
> Signed-off-by: Drew Fustini <[email protected]>
> ---
>  hw/core/sysbus-fdt.c | 4 ++++
>  hw/riscv/virt.c      | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
> index 12238570b5e1..265917ef573e 100644
> --- a/hw/core/sysbus-fdt.c
> +++ b/hw/core/sysbus-fdt.c
> @@ -35,6 +35,7 @@
>  #include "hw/core/platform-bus.h"
>  #include "hw/display/ramfb.h"
>  #include "hw/uefi/var-service-api.h"
> +#include "hw/riscv/cbqri.h"
>  #include "hw/arm/fdt.h"
>  #include "hw/watchdog/sbsa_gwdt.h"
>  
> @@ -142,6 +143,9 @@ static const BindingEntry bindings[] = {
>      TYPE_BINDING(TYPE_RAMFB_DEVICE, no_fdt_node),
>      TYPE_BINDING(TYPE_UEFI_VARS_SYSBUS, add_uefi_vars_node),
>      TYPE_BINDING(TYPE_WDT_SBSA, no_fdt_node),
> +    /* RISC-V CBQRI controllers have no generic device tree node */
> +    TYPE_BINDING(TYPE_RISCV_CBQRI_BC, no_fdt_node),
> +    TYPE_BINDING(TYPE_RISCV_CBQRI_CC, no_fdt_node),
>      TYPE_BINDING("", NULL), /* last element */
>  };
>  
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index d4b501802f60..dbc0f8cfc8d7 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -57,6 +57,7 @@
>  #include "hw/pci-host/gpex.h"
>  #include "hw/display/ramfb.h"
>  #include "hw/acpi/aml-build.h"
> +#include "hw/riscv/cbqri.h"
>  #include "qapi/qapi-visit-common.h"
>  #include "hw/virtio/virtio-iommu.h"
>  #include "hw/uefi/var-service-api.h"
> @@ -1157,6 +1158,8 @@ static void virt_machine_class_init(ObjectClass *oc, 
> const void *data)
>  #ifdef CONFIG_TPM
>      machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
>  #endif
> +    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RISCV_CBQRI_BC);
> +    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RISCV_CBQRI_CC);

When the controller device is created dynamically through the QEMU command 
line, the
corresponding device tree node must also be created. As I do not see the 
implementation
to add the DT node in this series, Could you please clarify how it is created.?

Thanks,
Prajwal N
>  
>      object_class_property_add_bool(oc, "aclint", virt_get_aclint,
>                                     virt_set_aclint);
> 


Reply via email to