From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
kvm@vger.kernel.org, "Marcelo Tosatti" <mtosatti@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Michael Tokarev" <mjt@tls.msk.ru>
Subject: [PATCH v2 3/3] hw/i386/sgx: Use QDev API
Date: Thu, 15 Feb 2024 15:20:35 +0100 [thread overview]
Message-ID: <20240215142035.73331-4-philmd@linaro.org> (raw)
In-Reply-To: <20240215142035.73331-1-philmd@linaro.org>
Prefer the QDev API over the low level QOM one.
No logical change intended.
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Only build-tested.
---
hw/i386/kvm/sgx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/i386/kvm/sgx.c b/hw/i386/kvm/sgx.c
index 70305547d4..de76397bcf 100644
--- a/hw/i386/kvm/sgx.c
+++ b/hw/i386/kvm/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, NULL, &error_fatal);
}
if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) {
--
2.41.0
next prev parent reply other threads:[~2024-02-15 14:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 14:20 [PATCH v2 0/3] hw/i386: Move SGX under KVM and use QDev API Philippe Mathieu-Daudé
2024-02-15 14:20 ` [PATCH v2 1/3] MAINTAINERS: Cover hw/i386/kvm/ in 'X86 KVM CPUs' section Philippe Mathieu-Daudé
2024-02-15 14:20 ` [PATCH v2 2/3] hw/i386: Move SGX files within the kvm/ directory Philippe Mathieu-Daudé
2024-02-15 14:20 ` Philippe Mathieu-Daudé [this message]
2024-02-21 21:17 ` [PATCH v2 0/3] hw/i386: Move SGX under KVM and use QDev API Philippe Mathieu-Daudé
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=20240215142035.73331-4-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=eduardo@habkost.net \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mjt@tls.msk.ru \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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 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).