qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v6 13/60] i386/tdx: Validate TD attributes


From: Xiaoyao Li
Subject: Re: [PATCH v6 13/60] i386/tdx: Validate TD attributes
Date: Wed, 6 Nov 2024 09:38:29 +0800
User-agent: Mozilla Thunderbird

On 11/6/2024 4:56 AM, Edgecombe, Rick P wrote:
On Tue, 2024-11-05 at 01:23 -0500, Xiaoyao Li wrote:
-static void setup_td_guest_attributes(X86CPU *x86cpu)
+static int tdx_validate_attributes(TdxGuest *tdx, Error **errp)
+{
+    if ((tdx->attributes & ~tdx_caps->supported_attrs)) {
+            error_setg(errp, "Invalid attributes 0x%lx for TDX VM "
+                       "(supported: 0x%llx)",
+                       tdx->attributes, tdx_caps->supported_attrs);
+            return -1;
+    }
+
+    if (tdx->attributes & TDX_TD_ATTRIBUTES_DEBUG) {

What is going on here? It doesn't look like debug attribute could be set in this
series, so this is dead code I guess. If there is some concern that attributes
that need extra qemu support could be set in QEMU somehow, it would be better to
have a mask of qemu supported attributes and reject any not in the mask.

Good catch and good idea!

Will maintain a mask of supported attributes in QEMU.

+        error_setg(errp, "Current QEMU doesn't support attributes.debug[bit 0] 
"
+                         "for TDX VM");
+        return -1;
+    }
+
+    return 0;
+}





reply via email to

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