All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Xiao Guangrong" <xiaoguangrong.eric@gmail.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Greg Kurz" <groug@kaod.org>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Song Gao" <gaosong@loongson.cn>,
	"Xiaojuan Yang" <yangxiaojuan@loongson.cn>
Subject: Re: [PATCH 02/10] memory-device: Introduce memory_devices_init()
Date: Tue, 30 May 2023 15:24:16 +0200	[thread overview]
Message-ID: <ab0b1cf4-b4a7-8ebe-81f9-d85317d16c35@redhat.com> (raw)
In-Reply-To: <2e51c9e4-3716-5f55-b006-30a40b0ea0da@redhat.com>

On 30.05.23 15:04, David Hildenbrand wrote:
> On 30.05.23 14:29, Philippe Mathieu-Daudé wrote:
>> Hi David,
>>
>> On 30/5/23 13:38, David Hildenbrand wrote:
>>> Let's intrduce a new helper that we will use to replace existing memory
>>> device setup code during machine initialization. We'll enforce that the
>>> size has to be > 0.
>>>
>>> Once all machines were converted, we'll only allocate ms->device_memory
>>> if the size > 0.
>>>
>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>> ---
>>>     hw/mem/memory-device.c         | 14 ++++++++++++++
>>>     include/hw/mem/memory-device.h |  2 ++
>>>     2 files changed, 16 insertions(+)
>>
>>
>>> diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
>>> index 48d2611fc5..6e8a10e2f5 100644
>>> --- a/include/hw/mem/memory-device.h
>>> +++ b/include/hw/mem/memory-device.h
>>> @@ -16,6 +16,7 @@
>>>     #include "hw/qdev-core.h"
>>>     #include "qapi/qapi-types-machine.h"
>>>     #include "qom/object.h"
>>> +#include "exec/hwaddr.h"
>>>     
>>>     #define TYPE_MEMORY_DEVICE "memory-device"
>>>     
>>> @@ -113,5 +114,6 @@ void memory_device_plug(MemoryDeviceState *md, MachineState *ms);
>>>     void memory_device_unplug(MemoryDeviceState *md, MachineState *ms);
>>>     uint64_t memory_device_get_region_size(const MemoryDeviceState *md,
>>>                                            Error **errp);
>>> +void memory_devices_init(MachineState *ms, hwaddr base, uint64_t size);
>>
>>
>> While hw/mem/memory-device.c contains the implementation, all callers
>> are expected to be around Machine object, right? Thus maybe this _init()
>> could be declared in "hw/boards.h", already included by machines
>> (eventually renaming as machine_init_memory_devices() ). Then machines
>> implementation don't have to all include "hw/mem/memory-device.h".
> 
> Some (arm, i386) want to call the hotplug handle functions either way,
> so they'll still have to include that header.
> 
> But sure, we can rename to machine_init_memory_devices() and declare it
> include/hw/boards.h!

FWIW, I went with "machine_memory_devices_init()", to mach the style of 
"machine_run_board_init()".

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2023-05-30 13:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 11:38 [PATCH 00/10] memory-device: Some cleanups David Hildenbrand
2023-05-30 11:38 ` [PATCH 01/10] memory-device: Unify enabled vs. supported error messages David Hildenbrand
2023-05-30 12:30   ` Philippe Mathieu-Daudé
2023-05-30 11:38 ` [PATCH 02/10] memory-device: Introduce memory_devices_init() David Hildenbrand
2023-05-30 12:18   ` Philippe Mathieu-Daudé
2023-05-30 12:29   ` Philippe Mathieu-Daudé
2023-05-30 13:04     ` David Hildenbrand
2023-05-30 13:24       ` David Hildenbrand [this message]
2023-05-30 11:38 ` [PATCH 03/10] hw/arm/virt: Use memory_devices_init() David Hildenbrand
2023-05-30 12:19   ` Philippe Mathieu-Daudé
2023-05-30 11:38 ` [PATCH 04/10] hw/ppc/spapr: " David Hildenbrand
2023-05-30 12:32   ` Philippe Mathieu-Daudé
2023-05-30 11:38 ` [PATCH 05/10] hw/loongarch/virt: " David Hildenbrand
2023-05-30 12:20   ` Philippe Mathieu-Daudé
2023-05-30 12:29   ` Song Gao
2023-05-30 11:38 ` [PATCH 06/10] hw/i386/pc: " David Hildenbrand
2023-05-30 12:33   ` Philippe Mathieu-Daudé
2023-05-30 11:38 ` [PATCH 07/10] hw/i386/acpi-build: Rely on machine->device_memory when building SRAT David Hildenbrand
2023-05-30 12:21   ` Philippe Mathieu-Daudé
2023-05-30 11:38 ` [PATCH 08/10] hw/i386/pc: Remove PC_MACHINE_DEVMEM_REGION_SIZE David Hildenbrand
2023-05-30 12:22   ` Philippe Mathieu-Daudé
2023-05-30 13:07   ` Michael S. Tsirkin
2023-05-30 13:11     ` David Hildenbrand
2023-05-30 13:41       ` David Hildenbrand
2023-05-30 14:46         ` Michael S. Tsirkin
2023-05-30 13:43       ` Philippe Mathieu-Daudé
2023-05-30 11:38 ` [PATCH 09/10] memory-device: Refactor memory_device_pre_plug() David Hildenbrand
2023-05-30 11:38 ` [PATCH 10/10] memory-device: Track used region size in DeviceMemoryState David Hildenbrand
2023-05-30 12:23   ` Philippe Mathieu-Daudé
2023-05-30 11:41 ` [PATCH 00/10] memory-device: Some cleanups David Hildenbrand
2023-06-22 20:13 ` Michael S. Tsirkin
2023-06-23 12:39   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab0b1cf4-b4a7-8ebe-81f9-d85317d16c35@redhat.com \
    --to=david@redhat.com \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=eduardo@habkost.net \
    --cc=gaosong@loongson.cn \
    --cc=groug@kaod.org \
    --cc=harshpb@linux.ibm.com \
    --cc=imammedo@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=xiaoguangrong.eric@gmail.com \
    --cc=yangxiaojuan@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.