qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] hw/i386: Move SGX under KVM and use QDev API
@ 2024-02-15 14:20 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é
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-15 14:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Richard Henderson,
	Paolo Bonzini, kvm, Marcelo Tosatti, Marcel Apfelbaum,
	Philippe Mathieu-Daudé

- Update MAINTAINERS
- Move SGX files with KVM ones
- Use QDev API

Supersedes: <20240213071613.72566-1-philmd@linaro.org>

Philippe Mathieu-Daudé (3):
  MAINTAINERS: Cover hw/i386/kvm/ in 'X86 KVM CPUs' section
  hw/i386: Move SGX files within the kvm/ directory
  hw/i386/sgx: Use QDev API

 MAINTAINERS                  |  1 +
 hw/i386/{ => kvm}/sgx-epc.c  |  0
 hw/i386/{ => kvm}/sgx-stub.c |  0
 hw/i386/{ => kvm}/sgx.c      | 14 ++++++--------
 hw/i386/kvm/meson.build      |  3 +++
 hw/i386/meson.build          |  2 --
 6 files changed, 10 insertions(+), 10 deletions(-)
 rename hw/i386/{ => kvm}/sgx-epc.c (100%)
 rename hw/i386/{ => kvm}/sgx-stub.c (100%)
 rename hw/i386/{ => kvm}/sgx.c (95%)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] MAINTAINERS: Cover hw/i386/kvm/ in 'X86 KVM CPUs' section
  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 ` Philippe Mathieu-Daudé
  2024-02-15 14:20 ` [PATCH v2 2/3] hw/i386: Move SGX files within the kvm/ directory Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-15 14:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Richard Henderson,
	Paolo Bonzini, kvm, Marcelo Tosatti, Marcel Apfelbaum,
	Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a24c2b51b6..b526a08015 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -490,6 +490,7 @@ L: kvm@vger.kernel.org
 S: Supported
 F: docs/system/i386/amd-memory-encryption.rst
 F: docs/system/i386/sgx.rst
+F: hw/i386/kvm/
 F: target/i386/kvm/
 F: target/i386/sev*
 F: scripts/kvm/vmxcap
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] hw/i386: Move SGX files within the kvm/ directory
  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 ` Philippe Mathieu-Daudé
  2024-02-15 14:20 ` [PATCH v2 3/3] hw/i386/sgx: Use QDev API Philippe Mathieu-Daudé
  2024-02-21 21:17 ` [PATCH v2 0/3] hw/i386: Move SGX under KVM and use " Philippe Mathieu-Daudé
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-15 14:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Richard Henderson,
	Paolo Bonzini, kvm, Marcelo Tosatti, Marcel Apfelbaum,
	Philippe Mathieu-Daudé

Per hw/i386/Kconfig:

  config SGX
      bool
      depends on KVM

So move SGX related files under kvm/ for clarity.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/{ => kvm}/sgx-epc.c  | 0
 hw/i386/{ => kvm}/sgx-stub.c | 0
 hw/i386/{ => kvm}/sgx.c      | 0
 hw/i386/kvm/meson.build      | 3 +++
 hw/i386/meson.build          | 2 --
 5 files changed, 3 insertions(+), 2 deletions(-)
 rename hw/i386/{ => kvm}/sgx-epc.c (100%)
 rename hw/i386/{ => kvm}/sgx-stub.c (100%)
 rename hw/i386/{ => kvm}/sgx.c (100%)

diff --git a/hw/i386/sgx-epc.c b/hw/i386/kvm/sgx-epc.c
similarity index 100%
rename from hw/i386/sgx-epc.c
rename to hw/i386/kvm/sgx-epc.c
diff --git a/hw/i386/sgx-stub.c b/hw/i386/kvm/sgx-stub.c
similarity index 100%
rename from hw/i386/sgx-stub.c
rename to hw/i386/kvm/sgx-stub.c
diff --git a/hw/i386/sgx.c b/hw/i386/kvm/sgx.c
similarity index 100%
rename from hw/i386/sgx.c
rename to hw/i386/kvm/sgx.c
diff --git a/hw/i386/kvm/meson.build b/hw/i386/kvm/meson.build
index a4a2e23c06..c9c7adea77 100644
--- a/hw/i386/kvm/meson.build
+++ b/hw/i386/kvm/meson.build
@@ -13,6 +13,9 @@ i386_kvm_ss.add(when: 'CONFIG_XEN_EMU', if_true: files(
   'xenstore_impl.c',
   ))
 
+i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'),
+                                if_false: files('sgx-stub.c'))
+
 i386_ss.add_all(when: 'CONFIG_KVM', if_true: i386_kvm_ss)
 
 xen_stubs_ss = ss.source_set()
diff --git a/hw/i386/meson.build b/hw/i386/meson.build
index b9c1ca39cb..d7318b83e4 100644
--- a/hw/i386/meson.build
+++ b/hw/i386/meson.build
@@ -17,8 +17,6 @@ i386_ss.add(when: 'CONFIG_Q35', if_true: files('pc_q35.c'))
 i386_ss.add(when: 'CONFIG_VMMOUSE', if_true: files('vmmouse.c'))
 i386_ss.add(when: 'CONFIG_VMPORT', if_true: files('vmport.c'))
 i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iommu.c'))
-i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'),
-                                if_false: files('sgx-stub.c'))
 
 i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c'))
 i386_ss.add(when: 'CONFIG_PC', if_true: files(
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] hw/i386/sgx: Use QDev API
  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é
  2024-02-21 21:17 ` [PATCH v2 0/3] hw/i386: Move SGX under KVM and use " Philippe Mathieu-Daudé
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-15 14:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Richard Henderson,
	Paolo Bonzini, kvm, Marcelo Tosatti, Marcel Apfelbaum,
	Philippe Mathieu-Daudé, Michael Tokarev

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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/3] hw/i386: Move SGX under KVM and use QDev API
  2024-02-15 14:20 [PATCH v2 0/3] hw/i386: Move SGX under KVM and use QDev API Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2024-02-15 14:20 ` [PATCH v2 3/3] hw/i386/sgx: Use QDev API Philippe Mathieu-Daudé
@ 2024-02-21 21:17 ` Philippe Mathieu-Daudé
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-21 21:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Richard Henderson,
	Paolo Bonzini, kvm, Marcelo Tosatti, Marcel Apfelbaum

On 15/2/24 15:20, Philippe Mathieu-Daudé wrote:
> - Update MAINTAINERS
> - Move SGX files with KVM ones
> - Use QDev API
> 
> Supersedes: <20240213071613.72566-1-philmd@linaro.org>
> 
> Philippe Mathieu-Daudé (3):
>    MAINTAINERS: Cover hw/i386/kvm/ in 'X86 KVM CPUs' section
>    hw/i386: Move SGX files within the kvm/ directory
>    hw/i386/sgx: Use QDev API

Ping?



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-21 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2 3/3] hw/i386/sgx: Use QDev API Philippe Mathieu-Daudé
2024-02-21 21:17 ` [PATCH v2 0/3] hw/i386: Move SGX under KVM and use " 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).