qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/3] hw/riscv/virt: Add memory hotplugging and virtio-md-p


From: Björn Töpel
Subject: Re: [PATCH v2 1/3] hw/riscv/virt: Add memory hotplugging and virtio-md-pci support
Date: Mon, 27 May 2024 13:49:11 +0200

Daniel Henrique Barboza <dbarboza@ventanamicro.com> writes:

> On 5/21/24 07:56, Björn Töpel wrote:
>> From: Björn Töpel <bjorn@rivosinc.com>
>> 
>> Virtio-based memory devices (virtio-mem/virtio-pmem) allows for
>> dynamic resizing of virtual machine memory, and requires proper
>> hotplugging (add/remove) support to work.
>> 
>> Add device memory support for RISC-V "virt" machine, and enable
>> virtio-md-pci with the corresponding missing hotplugging callbacks.
>> 
>> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
>> ---
>>   hw/riscv/Kconfig       |  2 +
>>   hw/riscv/virt.c        | 83 +++++++++++++++++++++++++++++++++++++++++-
>>   hw/virtio/virtio-mem.c |  5 ++-
>>   3 files changed, 87 insertions(+), 3 deletions(-)
>> 
>> diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
>> index a2030e3a6ff0..08f82dbb681a 100644
>> --- a/hw/riscv/Kconfig
>> +++ b/hw/riscv/Kconfig
>> @@ -56,6 +56,8 @@ config RISCV_VIRT
>>       select PLATFORM_BUS
>>       select ACPI
>>       select ACPI_PCI
>> +    select VIRTIO_MEM_SUPPORTED
>> +    select VIRTIO_PMEM_SUPPORTED
>>   
>>   config SHAKTI_C
>>       bool
>> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
>> index 4fdb66052587..443902f919d2 100644
>> --- a/hw/riscv/virt.c
>> +++ b/hw/riscv/virt.c
>> @@ -53,6 +53,8 @@
>>   #include "hw/pci-host/gpex.h"
>>   #include "hw/display/ramfb.h"
>>   #include "hw/acpi/aml-build.h"
>> +#include "hw/mem/memory-device.h"
>> +#include "hw/virtio/virtio-mem-pci.h"
>>   #include "qapi/qapi-visit-common.h"
>>   #include "hw/virtio/virtio-iommu.h"
>>   
>> @@ -1407,6 +1409,7 @@ static void virt_machine_init(MachineState *machine)
>>       DeviceState *mmio_irqchip, *virtio_irqchip, *pcie_irqchip;
>>       int i, base_hartid, hart_count;
>>       int socket_count = riscv_socket_count(machine);
>> +    hwaddr device_memory_base, device_memory_size;
>>   
>>       /* Check socket count limit */
>>       if (VIRT_SOCKETS_MAX < socket_count) {
>> @@ -1420,6 +1423,12 @@ static void virt_machine_init(MachineState *machine)
>>           exit(1);
>>       }
>>   
>> +    if (machine->ram_slots > ACPI_MAX_RAM_SLOTS) {
>> +        error_report("unsupported amount of memory slots: %"PRIu64,
>> +                     machine->ram_slots);
>
> Let's also add the maximum amount allowed in this message, e.g. this error:
>
> $ (...) -m 2G,slots=512,maxmem=8G
> qemu-system-riscv64: unsupported amount of memory slots: 512
>
> could be something like:
>
> qemu-system-riscv64: unsupported amount of memory slots (512), maximum 
> amount: 256
>
>
> LGTM otherwise. Thanks,

Thanks for getting back!

Sure! I'll fix this in the next rev.


Björn



reply via email to

[Prev in Thread] Current Thread [Next in Thread]