public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Markus Frank <m.frank@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v12 6/6] ui: add AMD SEV configuration to Options
Date: Mon, 11 Nov 2024 14:57:13 +0100	[thread overview]
Message-ID: <20241111135713.212601-7-m.frank@proxmox.com> (raw)
In-Reply-To: <20241111135713.212601-1-m.frank@proxmox.com>

By adding a new input panel with an AMD SEV technology selection combo
box and checkboxes for the optional parameters in an advanced section,
the user can configure the amd_sev option via the WebUI's Options tab.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
changes v12:
* nothing changed

 www/manager6/Makefile        |   1 +
 www/manager6/qemu/Options.js |  11 ++++
 www/manager6/qemu/SevEdit.js | 121 +++++++++++++++++++++++++++++++++++
 3 files changed, 133 insertions(+)
 create mode 100644 www/manager6/qemu/SevEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 2c3a822b..801683a3 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -264,6 +264,7 @@ JSSRC= 							\
 	qemu/SSHKey.js					\
 	qemu/ScsiHwEdit.js				\
 	qemu/SerialEdit.js				\
+	qemu/SevEdit.js					\
 	qemu/Smbios1Edit.js				\
 	qemu/SystemEdit.js				\
 	qemu/USBEdit.js					\
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 7b112400..6907699c 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -338,6 +338,17 @@ Ext.define('PVE.qemu.Options', {
 		    },
 		} : undefined,
 	    },
+	    amd_sev: {
+		header: gettext('AMD SEV'),
+		editor: caps.vms['VM.Config.HWType'] ? 'PVE.qemu.SevEdit' : undefined,
+		defaultValue: Proxmox.Utils.defaultText + ' (' + Proxmox.Utils.disabledText + ')',
+		renderer: function(value, metaData, record, ri, ci, store, pending) {
+		    let amd_sev = PVE.Parser.parsePropertyString(value, "type");
+		    if (amd_sev.type === 'std') return 'AMD SEV (' + value + ')';
+		    if (amd_sev.type === 'es') return 'AMD SEV-ES (' + value + ')';
+		    return value;
+		},
+	    },
 	    hookscript: {
 		header: gettext('Hookscript'),
 	    },
diff --git a/www/manager6/qemu/SevEdit.js b/www/manager6/qemu/SevEdit.js
new file mode 100644
index 00000000..db7ff3a8
--- /dev/null
+++ b/www/manager6/qemu/SevEdit.js
@@ -0,0 +1,121 @@
+Ext.define('PVE.qemu.SevInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pveSevInputPanel',
+    onlineHelp: 'qm_memory_encryption',
+
+    viewModel: {
+	data: {
+	    type: '__default__',
+	},
+	formulas: {
+	    sevEnabled: get => get('type') !== '__default__',
+	},
+    },
+
+    onGetValues: function(values) {
+	if (values.delete === 'type') {
+	    values.delete = 'amd_sev';
+	    return values;
+	}
+	if (!values.debug) {
+	    values["no-debug"] = 1;
+	}
+	if (!values["key-sharing"]) {
+	    values["no-key-sharing"] = 1;
+	}
+	delete values.debug;
+	delete values["key-sharing"];
+	let ret = {};
+	ret.amd_sev = PVE.Parser.printPropertyString(values, 'type');
+	return ret;
+    },
+
+
+    setValues: function(values) {
+	if (PVE.Parser.parseBoolean(values["no-debug"])) {
+	    values.debug = 0;
+	}
+	if (PVE.Parser.parseBoolean(values["no-key-sharing"])) {
+	    values["key-sharing"] = 0;
+	}
+	this.callParent(arguments);
+    },
+
+    items: {
+	xtype: 'proxmoxKVComboBox',
+	fieldLabel: gettext('AMD Secure Encrypted Virtualization (SEV)'),
+	labelWidth: 150,
+	name: 'type',
+	value: '__default__',
+	comboItems: [
+	    ['__default__', Proxmox.Utils.defaultText + ' (' + Proxmox.Utils.disabledText + ')'],
+	    ['std', 'AMD SEV'],
+	    ['es', 'AMD SEV-ES (highly experimental)'],
+	],
+	bind: {
+	    value: '{type}',
+	},
+    },
+
+    advancedItems: [
+	{
+	    xtype: 'proxmoxcheckbox',
+	    fieldLabel: gettext('Allow Debugging'),
+	    labelWidth: 150,
+	    name: 'debug',
+	    value: 1,
+	    bind: {
+		hidden: '{!sevEnabled}',
+		disabled: '{!sevEnabled}',
+	    },
+	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    fieldLabel: gettext('Allow Key-Sharing'),
+	    labelWidth: 150,
+	    name: 'key-sharing',
+	    value: 1,
+	    bind: {
+		hidden: '{!sevEnabled}',
+		disabled: '{!sevEnabled}',
+	    },
+	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    fieldLabel: gettext('Enable Kernel Hashes'),
+	    labelWidth: 150,
+	    name: 'kernel-hashes',
+	    deleteDefaultValue: false,
+	    bind: {
+		hidden: '{!sevEnabled}',
+		disabled: '{!sevEnabled}',
+	    },
+	},
+    ],
+});
+
+Ext.define('PVE.qemu.SevEdit', {
+    extend: 'Proxmox.window.Edit',
+
+    subject: gettext('SEV'),
+
+    items: {
+	xtype: 'pveSevInputPanel',
+    },
+
+    width: 400,
+
+    initComponent: function() {
+	let me = this;
+
+	me.callParent();
+
+	me.load({
+	    success: function(response) {
+		let conf = response.result.data;
+		let amd_sev = conf.amd_sev || '__default__';
+		me.setValues(PVE.Parser.parsePropertyString(amd_sev, 'type'));
+	    },
+	});
+    },
+});
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      parent reply	other threads:[~2024-11-11 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 13:57 [pve-devel] [PATCH guest-common/qemu-server/docs/manager v12 0/6] AMD SEV Markus Frank
2024-11-11 13:57 ` [pve-devel] [PATCH guest-common v12 1/6] AbstractConfig: add abstract method to check for resources preventing a snapshot Markus Frank
2024-11-11 13:57 ` [pve-devel] [PATCH qemu-server v12 2/6] add C program to get hardware capabilities from CPUID Markus Frank
2024-11-11 13:57 ` [pve-devel] [PATCH qemu-server v12 3/6] config: add AMD SEV support Markus Frank
2024-11-11 13:57 ` [pve-devel] [PATCH qemu-server v12 4/6] migration: add check_non_migratable_resources function Markus Frank
2024-11-11 13:57 ` [pve-devel] [PATCH docs v12 5/6] add AMD SEV documentation Markus Frank
2024-11-11 13:57 ` Markus Frank [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241111135713.212601-7-m.frank@proxmox.com \
    --to=m.frank@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal