[PATCH rfcv3 08/11] qemu: make hard reboot as the TDX default reboot mode

Zhenzhong Duan posted 11 patches 2 years, 2 months ago
There is a newer version of this series
[PATCH rfcv3 08/11] qemu: make hard reboot as the TDX default reboot mode
Posted by Zhenzhong Duan 2 years, 2 months ago
From: Chenyi Qiang <chenyi.qiang@intel.com>

Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
 src/qemu/qemu_driver.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 86e8efbfcb..ba1bb4ecb1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2013,7 +2013,9 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
     /* Take hard reboot as the highest priority.
      * This is for TDX which is not allowed to warm reboot.
      */
-    if (hardRequested)
+    if ((vm->def->sec &&
+         vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX) ||
+        hardRequested)
         ret = qemuDomainRebootMonitor(vm, isReboot, true);
 
     if (!ret)
@@ -3617,7 +3619,12 @@ processGuestPanicEvent(virQEMUDriver *driver,
         G_GNUC_FALLTHROUGH;
 
     case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
-        qemuDomainSetFakeReboot(vm, true);
+        if (vm->def->sec &&
+            vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX) {
+            qemuDomainSetHardReboot(vm, true);
+        } else {
+            qemuDomainSetFakeReboot(vm, true);
+        }
         qemuProcessShutdownOrReboot(vm);
         break;
 
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH rfcv3 08/11] qemu: make hard reboot as the TDX default reboot mode
Posted by Daniel P. Berrangé 2 years, 1 month ago
On Mon, Nov 27, 2023 at 04:55:18PM +0800, Zhenzhong Duan wrote:
> From: Chenyi Qiang <chenyi.qiang@intel.com>
> 
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> ---
>  src/qemu/qemu_driver.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 86e8efbfcb..ba1bb4ecb1 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2013,7 +2013,9 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
>      /* Take hard reboot as the highest priority.
>       * This is for TDX which is not allowed to warm reboot.
>       */
> -    if (hardRequested)
> +    if ((vm->def->sec &&
> +         vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX) ||
> +        hardRequested)
>          ret = qemuDomainRebootMonitor(vm, isReboot, true);
>  
>      if (!ret)
> @@ -3617,7 +3619,12 @@ processGuestPanicEvent(virQEMUDriver *driver,
>          G_GNUC_FALLTHROUGH;
>  
>      case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
> -        qemuDomainSetFakeReboot(vm, true);
> +        if (vm->def->sec &&
> +            vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX) {
> +            qemuDomainSetHardReboot(vm, true);
> +        } else {
> +            qemuDomainSetFakeReboot(vm, true);
> +        }
>          qemuProcessShutdownOrReboot(vm);

I suspect we'll need todo this with SEV too, since IIUC it does not
permit soft reboot either.

>          break;
>  
> -- 
> 2.34.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
RE: [PATCH rfcv3 08/11] qemu: make hard reboot as the TDX default reboot mode
Posted by Duan, Zhenzhong 2 years ago

>-----Original Message-----
>From: Daniel P. Berrangé <berrange@redhat.com>
>Subject: Re: [PATCH rfcv3 08/11] qemu: make hard reboot as the TDX
>default reboot mode
>
>On Mon, Nov 27, 2023 at 04:55:18PM +0800, Zhenzhong Duan wrote:
>> From: Chenyi Qiang <chenyi.qiang@intel.com>
>>
>> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
>> ---
>>  src/qemu/qemu_driver.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index 86e8efbfcb..ba1bb4ecb1 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -2013,7 +2013,9 @@ qemuDomainReboot(virDomainPtr dom,
>unsigned int flags)
>>      /* Take hard reboot as the highest priority.
>>       * This is for TDX which is not allowed to warm reboot.
>>       */
>> -    if (hardRequested)
>> +    if ((vm->def->sec &&
>> +         vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX)
>||
>> +        hardRequested)
>>          ret = qemuDomainRebootMonitor(vm, isReboot, true);
>>
>>      if (!ret)
>> @@ -3617,7 +3619,12 @@ processGuestPanicEvent(virQEMUDriver
>*driver,
>>          G_GNUC_FALLTHROUGH;
>>
>>      case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
>> -        qemuDomainSetFakeReboot(vm, true);
>> +        if (vm->def->sec &&
>> +            vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX)
>{
>> +            qemuDomainSetHardReboot(vm, true);
>> +        } else {
>> +            qemuDomainSetFakeReboot(vm, true);
>> +        }
>>          qemuProcessShutdownOrReboot(vm);
>
>I suspect we'll need todo this with SEV too, since IIUC it does not
>permit soft reboot either.

Yes, unluckily I have no SEV env to see if hard reboot also works for SEV.

Thanks
Zhenzhong
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org