[PATCH] hw/riscv/virt.c: Make block devices default to virtio

Sunil V L posted 1 patch 5 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240620064718.275427-1-sunilvl@ventanamicro.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bmeng.cn@gmail.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
hw/riscv/virt.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] hw/riscv/virt.c: Make block devices default to virtio
Posted by Sunil V L 5 months, 1 week ago
RISC-V virt is currently missing default type for block devices. Without
this being set, proper backend is not created when option like -cdrom
is used. So, make the virt board's default block device type be
IF_VIRTIO similar to other architectures.

We also need to set no_cdrom to avoid getting a default cdrom device.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
 hw/riscv/virt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 8675c3a7d1..b0871b7f81 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1764,6 +1764,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     mc->init = virt_machine_init;
     mc->max_cpus = VIRT_CPUS_MAX;
     mc->default_cpu_type = TYPE_RISCV_CPU_BASE;
+    mc->block_default_type = IF_VIRTIO;
+    mc->no_cdrom = 1;
     mc->pci_allow_0_address = true;
     mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
     mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
-- 
2.34.1
Re: [PATCH] hw/riscv/virt.c: Make block devices default to virtio
Posted by Alistair Francis 5 months ago
On Thu, Jun 20, 2024 at 4:48 PM Sunil V L <sunilvl@ventanamicro.com> wrote:
>
> RISC-V virt is currently missing default type for block devices. Without
> this being set, proper backend is not created when option like -cdrom
> is used. So, make the virt board's default block device type be
> IF_VIRTIO similar to other architectures.
>
> We also need to set no_cdrom to avoid getting a default cdrom device.
>
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  hw/riscv/virt.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 8675c3a7d1..b0871b7f81 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1764,6 +1764,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>      mc->init = virt_machine_init;
>      mc->max_cpus = VIRT_CPUS_MAX;
>      mc->default_cpu_type = TYPE_RISCV_CPU_BASE;
> +    mc->block_default_type = IF_VIRTIO;
> +    mc->no_cdrom = 1;
>      mc->pci_allow_0_address = true;
>      mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
>      mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
> --
> 2.34.1
>
>
Re: [PATCH] hw/riscv/virt.c: Make block devices default to virtio
Posted by Alistair Francis 5 months ago
On Thu, Jun 20, 2024 at 4:48 PM Sunil V L <sunilvl@ventanamicro.com> wrote:
>
> RISC-V virt is currently missing default type for block devices. Without
> this being set, proper backend is not created when option like -cdrom
> is used. So, make the virt board's default block device type be
> IF_VIRTIO similar to other architectures.
>
> We also need to set no_cdrom to avoid getting a default cdrom device.
>
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/riscv/virt.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 8675c3a7d1..b0871b7f81 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1764,6 +1764,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>      mc->init = virt_machine_init;
>      mc->max_cpus = VIRT_CPUS_MAX;
>      mc->default_cpu_type = TYPE_RISCV_CPU_BASE;
> +    mc->block_default_type = IF_VIRTIO;
> +    mc->no_cdrom = 1;
>      mc->pci_allow_0_address = true;
>      mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
>      mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
> --
> 2.34.1
>
>
Re: [PATCH] hw/riscv/virt.c: Make block devices default to virtio
Posted by Daniel Henrique Barboza 5 months, 1 week ago

On 6/20/24 3:47 AM, Sunil V L wrote:
> RISC-V virt is currently missing default type for block devices. Without
> this being set, proper backend is not created when option like -cdrom
> is used. So, make the virt board's default block device type be
> IF_VIRTIO similar to other architectures.
> 
> We also need to set no_cdrom to avoid getting a default cdrom device.
> 
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

>   hw/riscv/virt.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 8675c3a7d1..b0871b7f81 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1764,6 +1764,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>       mc->init = virt_machine_init;
>       mc->max_cpus = VIRT_CPUS_MAX;
>       mc->default_cpu_type = TYPE_RISCV_CPU_BASE;
> +    mc->block_default_type = IF_VIRTIO;
> +    mc->no_cdrom = 1;
>       mc->pci_allow_0_address = true;
>       mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
>       mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;