* [PATCH] hw/i386/sgx: Use QDev API
@ 2024-02-13 7:16 Philippe Mathieu-Daudé
2024-02-15 9:22 ` Michael Tokarev
2024-02-15 9:31 ` Michael Tokarev
0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-13 7:16 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Eduardo Habkost, Michael S. Tsirkin, qemu-trivial,
Richard Henderson, Marcel Apfelbaum, Philippe Mathieu-Daudé
Prefer the QDev API over the low level QOM one.
No logical change intended.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/sgx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
index 70305547d4..9176040f8f 100644
--- a/hw/i386/sgx.c
+++ b/hw/i386/sgx.c
@@ -286,7 +286,6 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)
SGXEPCState *sgx_epc = &pcms->sgx_epc;
X86MachineState *x86ms = X86_MACHINE(pcms);
SgxEPCList *list = NULL;
- Object *obj;
memset(sgx_epc, 0, sizeof(SGXEPCState));
if (!x86ms->sgx_epc_list) {
@@ -300,16 +299,15 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)
&sgx_epc->mr);
for (list = x86ms->sgx_epc_list; list; list = list->next) {
- obj = object_new("sgx-epc");
+ DeviceState *dev = qdev_new(TYPE_SGX_EPC);
/* set the memdev link with memory backend */
- object_property_parse(obj, SGX_EPC_MEMDEV_PROP, list->value->memdev,
- &error_fatal);
+ object_property_parse(OBJECT(dev), SGX_EPC_MEMDEV_PROP,
+ list->value->memdev, &error_fatal);
/* set the numa node property for sgx epc object */
- object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP, list->value->node,
- &error_fatal);
- object_property_set_bool(obj, "realized", true, &error_fatal);
- object_unref(obj);
+ object_property_set_uint(OBJECT(dev), SGX_EPC_NUMA_NODE_PROP,
+ list->value->node, &error_fatal);
+ qdev_realize_and_unref(dev, &error_fatal);
}
if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) {
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/i386/sgx: Use QDev API
2024-02-13 7:16 [PATCH] hw/i386/sgx: Use QDev API Philippe Mathieu-Daudé
@ 2024-02-15 9:22 ` Michael Tokarev
2024-02-15 9:31 ` Michael Tokarev
1 sibling, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2024-02-15 9:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Eduardo Habkost, Michael S. Tsirkin, qemu-trivial,
Richard Henderson, Marcel Apfelbaum
13.02.2024 10:16, Philippe Mathieu-Daudé:
> Prefer the QDev API over the low level QOM one.
> No logical change intended.
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Picked up for trivial-patches.
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/i386/sgx: Use QDev API
2024-02-13 7:16 [PATCH] hw/i386/sgx: Use QDev API Philippe Mathieu-Daudé
2024-02-15 9:22 ` Michael Tokarev
@ 2024-02-15 9:31 ` Michael Tokarev
2024-02-15 14:07 ` Philippe Mathieu-Daudé
1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2024-02-15 9:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Eduardo Habkost, Michael S. Tsirkin, qemu-trivial,
Richard Henderson, Marcel Apfelbaum
13.02.2024 10:16, Philippe Mathieu-Daudé :
> Prefer the QDev API over the low level QOM one.
> No logical change intended.
...
> /* set the numa node property for sgx epc object */
> - object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP, list->value->node,
> - &error_fatal);
> - object_property_set_bool(obj, "realized", true, &error_fatal);
> - object_unref(obj);
> + object_property_set_uint(OBJECT(dev), SGX_EPC_NUMA_NODE_PROP,
> + list->value->node, &error_fatal);
> + qdev_realize_and_unref(dev, &error_fatal);
This does not work. Here's the function prototype:
bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp);
I'd say a v2 is in order.
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/i386/sgx: Use QDev API
2024-02-15 9:31 ` Michael Tokarev
@ 2024-02-15 14:07 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-15 14:07 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Paolo Bonzini, Eduardo Habkost, Michael S. Tsirkin, qemu-trivial,
Richard Henderson, Marcel Apfelbaum
On 15/2/24 10:31, Michael Tokarev wrote:
> 13.02.2024 10:16, Philippe Mathieu-Daudé :
>> Prefer the QDev API over the low level QOM one.
>> No logical change intended.
> ...
>> /* set the numa node property for sgx epc object */
>> - object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP,
>> list->value->node,
>> - &error_fatal);
>> - object_property_set_bool(obj, "realized", true, &error_fatal);
>> - object_unref(obj);
>> + object_property_set_uint(OBJECT(dev), SGX_EPC_NUMA_NODE_PROP,
>> + list->value->node, &error_fatal);
>> + qdev_realize_and_unref(dev, &error_fatal);
>
> This does not work. Here's the function prototype:
>
> bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error
> **errp);
I was surprised because all my local tests passed, but then I
realized 'config SGX depends on KVM' and I'm on Darwin... Sorry.
>
> I'd say a v2 is in order.
>
> /mjt
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-15 14:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 7:16 [PATCH] hw/i386/sgx: Use QDev API Philippe Mathieu-Daudé
2024-02-15 9:22 ` Michael Tokarev
2024-02-15 9:31 ` Michael Tokarev
2024-02-15 14:07 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).