mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 13:08:42 +00:00
Change Service VM to supervisor role
1. Enable Service VM to power off or restart the whole platform even when RTVM is running. 2. Allow Service VM stop the RTVM using acrnctl tool with option "stop -f". 3. Add 'Service VM supervisor role enabled' option in ACRN configurator Tracked-On: #8618 Signed-off-by: YuanXin-Intel <xin.yuan@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
parent
512c98fd79
commit
e4b1584577
@ -830,8 +830,7 @@ vm_loop(struct vmctx *ctx)
|
||||
break;
|
||||
}
|
||||
|
||||
/* RTVM can't be reset */
|
||||
if ((VM_SUSPEND_SYSTEM_RESET == vm_get_suspend_mode()) && (!is_rtvm)) {
|
||||
if (VM_SUSPEND_SYSTEM_RESET == vm_get_suspend_mode()) {
|
||||
vm_system_reset(ctx);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ static void handle_stop(struct mngr_msg *msg, int client_fd, void *param)
|
||||
ack.msgid = msg->msgid;
|
||||
ack.timestamp = msg->timestamp;
|
||||
|
||||
if (msg->data.acrnd_stop.force && !is_rtvm) {
|
||||
if (msg->data.acrnd_stop.force) {
|
||||
pr_info("%s: setting VM state to %s\n", __func__, vm_state_to_str(VM_SUSPEND_POWEROFF));
|
||||
vm_set_suspend_mode(VM_SUSPEND_POWEROFF);
|
||||
ack.data.err = 0;
|
||||
|
@ -1012,13 +1012,10 @@ passthru_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
pciaccess_cleanup();
|
||||
free(ptdev);
|
||||
|
||||
if (!is_rtvm) {
|
||||
/* Let the HV to deassign the pt device for RTVM, In this case, the RTVM
|
||||
* could still be alive if DM died.
|
||||
*/
|
||||
/*Let device model to deassign pt device for all VMs, including RTVM if the Service VM plays
|
||||
*supervisor role.*/
|
||||
vm_deassign_pcidev(ctx, &pcidev);
|
||||
}
|
||||
if (!is_rtvm && phys_bdf) {
|
||||
if (phys_bdf) {
|
||||
memset(reset_path, 0, sizeof(reset_path));
|
||||
snprintf(reset_path, 40,
|
||||
"/sys/bus/pci/devices/0000:%02x:%02x.%x/reset",
|
||||
|
@ -1048,9 +1048,8 @@ void pause_vm(struct acrn_vm *vm)
|
||||
uint16_t i;
|
||||
struct acrn_vcpu *vcpu = NULL;
|
||||
|
||||
/* For RTVM, we can only pause its vCPUs when it is powering off by itself */
|
||||
if (((!is_rt_vm(vm)) && (vm->state == VM_RUNNING)) ||
|
||||
((is_rt_vm(vm)) && (vm->state == VM_READY_TO_POWEROFF)) ||
|
||||
if (((is_severity_pass(vm->vm_id)) && (vm->state == VM_RUNNING)) ||
|
||||
(vm->state == VM_READY_TO_POWEROFF) ||
|
||||
(vm->state == VM_CREATED)) {
|
||||
foreach_vcpu(i, vm, vcpu) {
|
||||
zombie_vcpu(vcpu, VCPU_ZOMBIE);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <asm/lapic.h>
|
||||
#include <asm/guest/assign.h>
|
||||
#include <asm/guest/ept.h>
|
||||
#include <asm/guest/vm.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <hypercall.h>
|
||||
#include <errno.h>
|
||||
@ -69,11 +70,6 @@ bool is_hypercall_from_ring0(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static bool is_severity_pass(uint16_t target_vmid)
|
||||
{
|
||||
return SEVERITY_SERVICE_VM >= get_vm_severity(target_vmid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief offline vcpu from Service VM
|
||||
*
|
||||
|
@ -233,6 +233,11 @@ static inline uint16_t vmid_2_rel_vmid(uint16_t service_vmid, uint16_t vmid) {
|
||||
return (vmid - service_vmid);
|
||||
}
|
||||
|
||||
static inline bool is_severity_pass(uint16_t target_vmid)
|
||||
{
|
||||
return SEVERITY_SERVICE_VM >= get_vm_severity(target_vmid);
|
||||
}
|
||||
|
||||
void make_shutdown_vm_request(uint16_t pcpu_id);
|
||||
bool need_shutdown_vm(uint16_t pcpu_id);
|
||||
int32_t shutdown_vm(struct acrn_vm *vm);
|
||||
|
@ -70,7 +70,7 @@
|
||||
/* ACRN guest severity */
|
||||
enum acrn_vm_severity {
|
||||
SEVERITY_SAFETY_VM = 0x40U,
|
||||
SEVERITY_RTVM = 0x30U,
|
||||
SEVERITY_RTVM = RTVM_SEVERITY_LEVEL,
|
||||
SEVERITY_SERVICE_VM = 0x20U,
|
||||
SEVERITY_STANDARD_VM = 0x10U,
|
||||
};
|
||||
|
@ -63,6 +63,11 @@
|
||||
<xs:documentation>Enable multiboot2 protocol support (with multiboot1 downward compatibility). If multiboot1 meets your requirements, disable this feature to reduce hypervisor code size.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="SERVICE_VM_SUPERVISOR_ENABLED" type="Boolean" default="n">
|
||||
<xs:annotation acrn:title="Enable Service VM supervisor role" acrn:views="advanced">
|
||||
<xs:documentation>Enable Service VM to play the supervisor role. If Enabled, the severity level of Service VM is higher than RTVM.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="SPLIT_LOCK_DETECTION_ENABLED" type="Boolean" default="n">
|
||||
<xs:annotation acrn:title="Enable split lock detection" acrn:views="advanced">
|
||||
<xs:documentation>Enable detection of split locks. A split lock can negatively affect an application's real-time performance. If a lock is detected, an alignment check exception #AC occurs.</xs:documentation>
|
||||
|
@ -79,6 +79,10 @@
|
||||
<xsl:with-param name="value" select="'y'" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:call-template name="boolean-by-key">
|
||||
<xsl:with-param name="key" select="'SERVICE_VM_SUPERVISOR_ENABLED'" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:call-template name="boolean-by-key">
|
||||
<xsl:with-param name="key" select="'SPLIT_LOCK_DETECTION_ENABLED'" />
|
||||
</xsl:call-template>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<xsl:call-template name="cpu_affinity" />
|
||||
<xsl:call-template name="rdt" />
|
||||
<xsl:call-template name="vm0_passthrough_tpm" />
|
||||
<xsl:call-template name="service_vm_super_role" />
|
||||
<xsl:call-template name="vm_config_pci_dev_num" />
|
||||
<xsl:call-template name="vm_boot_args" />
|
||||
</xsl:template>
|
||||
@ -172,6 +173,17 @@
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="service_vm_super_role">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//SERVICE_VM_SUPERVISOR_ENABLED = 'y'">
|
||||
<xsl:value-of select="acrn:define('RTVM_SEVERITY_LEVEL', '0x10', 'U')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="acrn:define('RTVM_SEVERITY_LEVEL', '0x30', 'U')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="vm_config_pci_dev_num">
|
||||
<xsl:for-each select="vm">
|
||||
<xsl:if test="acrn:pci-dev-num(@id)">
|
||||
|
Loading…
Reference in New Issue
Block a user