diff --git a/hypervisor/include/public/acrn_common.h b/hypervisor/include/public/acrn_common.h index de460853e..f8a8a76db 100644 --- a/hypervisor/include/public/acrn_common.h +++ b/hypervisor/include/public/acrn_common.h @@ -57,6 +57,7 @@ #define GUEST_FLAG_RT (1UL << 4U) /* Whether the vm is RT-VM */ #define GUEST_FLAG_NVMX_ENABLED (1UL << 5U) /* Whether this VM supports nested virtualization */ #define GUEST_FLAG_SECURITY_VM (1UL << 6U) /* Whether this VM needs to do security-vm related fixup (TPM2 and SMBIOS pt) */ +#define GUEST_FLAG_VCAT_ENABLED (1UL << 7U) /* Whether this VM supports vCAT */ /* TODO: We may need to get this addr from guest ACPI instead of hardcode here */ #define VIRTUAL_SLEEP_CTL_ADDR 0x400U /* Pre-launched VM uses ACPI reduced HW mode and sleep control register */ diff --git a/misc/config_tools/library/common.py b/misc/config_tools/library/common.py index cc5de6115..fc09be4c0 100644 --- a/misc/config_tools/library/common.py +++ b/misc/config_tools/library/common.py @@ -23,7 +23,7 @@ DATACHECK_SCHEMA_FILE = SOURCE_ROOT_DIR + 'misc/config_tools/schema/datachecks.x PY_CACHES = ["__pycache__", "../board_config/__pycache__", "../scenario_config/__pycache__"] GUEST_FLAG = ["0", "0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTHROUGH", "GUEST_FLAG_IO_COMPLETION_POLLING", "GUEST_FLAG_NVMX_ENABLED", "GUEST_FLAG_HIDE_MTRR", - "GUEST_FLAG_RT", "GUEST_FLAG_SECURITY_VM"] + "GUEST_FLAG_RT", "GUEST_FLAG_SECURITY_VM", "GUEST_FLAG_VCAT_ENABLED"] MULTI_ITEM = ["guest_flag", "pcpu_id", "vcpu_clos", "input", "block", "network", "pci_dev", "shm_region", "communication_vuart"] diff --git a/misc/config_tools/library/scenario_cfg_lib.py b/misc/config_tools/library/scenario_cfg_lib.py index 4a2be7cd2..909ac9c65 100644 --- a/misc/config_tools/library/scenario_cfg_lib.py +++ b/misc/config_tools/library/scenario_cfg_lib.py @@ -1044,7 +1044,7 @@ def check_target_connection(vm_id, target_vm_id, target_uart_id, vm_visited, leg raise TargetError("target vm{}'s vuart{} is not present".format(target_vm_id ,target_uart_id)) -def vcpu_clos_check(cpus_per_vm, clos_per_vm, prime_item, item): +def vcpu_clos_check(cpus_per_vm, clos_per_vm, guest_flags, prime_item, item): if not board_cfg_lib.is_rdt_enabled(): return @@ -1052,6 +1052,9 @@ def vcpu_clos_check(cpus_per_vm, clos_per_vm, prime_item, item): common_clos_max = board_cfg_lib.get_common_clos_max() for vm_i,vcpus in cpus_per_vm.items(): + if vm_i in guest_flags and "GUEST_FLAG_VCAT_ENABLED" in guest_flags[vm_i]: + continue + clos_per_vm_len = 0 if vm_i in clos_per_vm: clos_per_vm_len = len(clos_per_vm[vm_i]) diff --git a/misc/config_tools/scenario_config/scenario_item.py b/misc/config_tools/scenario_config/scenario_item.py index b362ced71..662af1a1b 100644 --- a/misc/config_tools/scenario_config/scenario_item.py +++ b/misc/config_tools/scenario_config/scenario_item.py @@ -400,7 +400,7 @@ class VmInfo: scenario_cfg_lib.load_vm_check(self.load_vm, "load_vm") scenario_cfg_lib.guest_flag_check(self.guest_flags, "guest_flags", "guest_flag") err_dic = scenario_cfg_lib.vm_cpu_affinity_check(self.scenario_info, self.cpus_per_vm, "pcpu_id") - scenario_cfg_lib.vcpu_clos_check(self.cpus_per_vm, self.clos_per_vm, "clos", "vcpu_clos") + scenario_cfg_lib.vcpu_clos_check(self.cpus_per_vm, self.clos_per_vm, self.guest_flags, "clos", "vcpu_clos") self.mem_info.check_item() self.os_cfg.check_item() diff --git a/misc/config_tools/schema/VMtypes.xsd b/misc/config_tools/schema/VMtypes.xsd index f05ef821a..6f398815c 100644 --- a/misc/config_tools/schema/VMtypes.xsd +++ b/misc/config_tools/schema/VMtypes.xsd @@ -39,6 +39,7 @@ - ``GUEST_FLAG_RT`` specify that the VM is an RT-VM (real-time) - ``GUEST_FLAG_NVMX_ENABLED`` specify that the VM supports nested virtualization - ``GUEST_FLAG_SECURITY_VM`` specify that the VM needs to do security-vm related +- ``GUEST_FLAG_VCAT_ENABLED`` specify that the VM supports CAT virtualization fixup (TPM2 passthrough and SMBIOS passthrough) @@ -52,6 +53,7 @@ + @@ -85,9 +87,14 @@ to. - Configure each CPU in VMs to a desired CLOS ID in the ``VM`` section of the -scenario file. Follow :ref:`rdt_detection_capabilities` -to identify the maximum supported CLOS ID that can be used. + By default (``GUEST_FLAG_VCAT_ENABLED`` is not specified): +vcpu_clos is per-CPU and it configures each CPU in VMs to a desired CLOS ID in the ``VM`` section of the +scenario file. Follow :ref:`rdt_detection_capabilities` to identify the maximum supported CLOS ID that can be used. + +If ``GUEST_FLAG_VCAT_ENABLED`` is specified: +vcpu_clos is not per-CPU anymore, just a list of physical CLOSIDs (minimum 2) that are assigned to VMs +for vCAT use. Each vcpu_clos will be mapped to a virtual CLOSID, the first vcpu_clos is mapped to virtual +CLOSID 0 and the second is mapped to virtual CLOSID 1, etc. diff --git a/misc/config_tools/schema/config.xsd b/misc/config_tools/schema/config.xsd index cd5031755..49e1617fc 100644 --- a/misc/config_tools/schema/config.xsd +++ b/misc/config_tools/schema/config.xsd @@ -487,6 +487,79 @@ to launch post-launched User VMs. Per VM GUEST_FLAG_NVMX_ENABLED can be set only if CONFIG_NVMX_ENABLED is set. + + + + vCAT can be enabled only when RDT_ENABLED is 'y' and CDP_ENABLED is 'n' + + + + + + Per VM GUEST_FLAG_VCAT_ENABLED can be set only when RDT_ENABLED is 'y' and VCAT_ENABLED is 'y'. + + + + + + For a vCAT VM, number of clos/vcpu_clos elements must be greater than 1! + + + + + + For a vCAT VM, vcpu_clos cannot be set to CLOSID 0, CLOSID 0 is reserved to be used by hypervisor + + + + + + For a vCAT VM, each clos/vcpu_clos must be less than L2/L3 COS_MAX! + + + + + + For a vCAT VM, its clos/vcpu_clos elements cannot contain duplicate values + + + + + + if RDT_ENABLED is 'y', there should not be any CLOS IDs overlap between a vCAT VM and any other VMs + + + diff --git a/misc/config_tools/schema/types.xsd b/misc/config_tools/schema/types.xsd index c7e6e61d9..d1617b025 100644 --- a/misc/config_tools/schema/types.xsd +++ b/misc/config_tools/schema/types.xsd @@ -188,8 +188,14 @@ RDT, setting this option to ``y`` is ignored. Specify whether to enable Code and Data Prioritization (CDP). CDP is an extension of CAT. Set to 'y' to enable the feature or 'n' to disable it. -The 'y' will be ignored when hardware does not support CDP. Default -value ``n``. +The 'y' will be ignored when hardware does not support CDP. + + + + + Specify whether to enable CAT virtualization (vCAT). +Set to 'y' to enable the feature or 'n' to disable it. +The 'y' will be ignored when hardware does not support CAT. diff --git a/misc/config_tools/xforms/config_common.xsl b/misc/config_tools/xforms/config_common.xsl index 0fc699595..7234b1db4 100644 --- a/misc/config_tools/xforms/config_common.xsl +++ b/misc/config_tools/xforms/config_common.xsl @@ -94,10 +94,15 @@ - + - - + + + + + + + diff --git a/misc/config_tools/xforms/lib.xsl b/misc/config_tools/xforms/lib.xsl index 1597cc54b..57345d419 100644 --- a/misc/config_tools/xforms/lib.xsl +++ b/misc/config_tools/xforms/lib.xsl @@ -356,7 +356,7 @@ - +