On 4/2/2025 6:41 PM, Daniel P. Berrangé wrote:
On Tue, Apr 01, 2025 at 09:01:48AM -0400, Xiaoyao Li wrote:
KVM mandates kernel_irqchip to be split mode.
Set it to split mode automatically when users don't provide an explicit
value, otherwise check it to be the split mode.
Suggested-by: Daniel P. Berrangé <berra...@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao...@intel.com>
---
target/i386/kvm/tdx.c | 8 ++++++++
1 file changed, 8 insertions(+)
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 0d30506c2021..4128f27d6b64 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -16,6 +16,7 @@
#include "qapi/error.h"
#include "qom/object_interfaces.h"
#include "crypto/hash.h"
+#include "system/kvm_int.h"
#include "system/runstate.h"
#include "system/system.h"
#include "exec/ramblock.h"
@@ -390,6 +391,13 @@ static int tdx_kvm_init(ConfidentialGuestSupport *cgs,
Error **errp)
return -EINVAL;
}
+ if (kvm_state->kernel_irqchip_split == ON_OFF_AUTO_AUTO ) {
Nitpick, no need for a space before the ')' ...
+ kvm_state->kernel_irqchip_split = ON_OFF_AUTO_ON;
+ } else if(kvm_state->kernel_irqchip_split != ON_OFF_AUTO_ON) {
..and need a space between 'if' and '('
Thanks for catching these coding style issue. Will fix them in the next
version.
+ error_setg(errp, "TDX VM requires kernel_irqchip to be split");
+ return -EINVAL;
+ }
+
Note for self - 'tdx_kvm_init' is called by 'confidential_guest_kvm_init',
which is called by 'kvm_arch_init', which is called by 'kvm_init' *before*
it processes "kvm_state->kernel_irqchip_split == ON_OFF_AUTO_AUTO" to set
the default. So this change is correctly taking priority over the default
behaviour.
if (!tdx_caps) {
r = get_tdx_capabilities(errp);
if (r) {
--
2.34.1
With regards,
Daniel