qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/4] i386/sev: Switch to use confidential_guest_kvm_init()


From: Xiaoyao Li
Subject: Re: [PATCH 2/4] i386/sev: Switch to use confidential_guest_kvm_init()
Date: Tue, 19 Mar 2024 10:12:26 +0800
User-agent: Mozilla Thunderbird

On 3/19/2024 5:51 AM, Paolo Bonzini wrote:
On Thu, Feb 29, 2024 at 7:01 AM Xiaoyao Li <xiaoyao.li@intel.com> wrote:

Use confidential_guest_kvm_init() instead of calling SEV specific
sev_kvm_init(). As a bouns, it fits to future TDX when TDX implements
its own confidential_guest_support and .kvm_init().

Move the "TypeInfo sev_guest_info" definition and related functions to
the end of the file, to avoid declaring the sev_kvm_init() ahead.

Delete the sve-stub.c since it's not needed anymore.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
Changes from rfc v1:
- check ms->cgs not NULL before calling confidential_guest_kvm_init();
- delete the sev-stub.c;

Queued, with just one small simplification that can be done on top:

thank you, Paolo!

diff --git a/target/i386/sev.c b/target/i386/sev.c
index e89d64fa52..b8f79d34d1 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -851,18 +851,13 @@ sev_vm_state_change(void *opaque, bool running,
RunState state)

  static int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
  {
-    SevGuestState *sev
-        = (SevGuestState *)object_dynamic_cast(OBJECT(cgs), TYPE_SEV_GUEST);
+    SevGuestState *sev = SEV_GUEST(cgs);
      char *devname;
      int ret, fw_error, cmd;
      uint32_t ebx;
      uint32_t host_cbitpos;
      struct sev_user_data_status status = {};

-    if (!sev) {
-        return 0;
-    }
-
      ret = ram_block_discard_disable(true);
      if (ret) {
          error_report("%s: cannot disable RAM discard", __func__);

It looks good.

Thanks!

Paolo




reply via email to

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