mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-06 06:02:20 +00:00
config_tools: add vcat support for configurator
add vcat support Tracked-On: #6691 Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
parent
6182b192c6
commit
12b3701bdb
@ -54,8 +54,14 @@
|
|||||||
<!--left title-->
|
<!--left title-->
|
||||||
<div v-for="(POLICY,index) in CACHE_ALLOCATION.data.POLICY">
|
<div v-for="(POLICY,index) in CACHE_ALLOCATION.data.POLICY">
|
||||||
<div v-if="index===0&&CACHE_ALLOCATION.real_time_count>0">Real-time</div>
|
<div v-if="index===0&&CACHE_ALLOCATION.real_time_count>0">Real-time</div>
|
||||||
<div v-if="index===CACHE_ALLOCATION.real_time_count">Standard</div>
|
<div v-if="index===CACHE_ALLOCATION.real_time_count&&CACHE_ALLOCATION.cat_count>0">Standard</div>
|
||||||
|
<div v-if="index===CACHE_ALLOCATION.cat_count">Virtual CAT</div>
|
||||||
|
<text v-if="index<CACHE_ALLOCATION.cat_count">
|
||||||
{{ POLICY.VM }} vCPU {{ POLICY.VCPU }}{{ POLICY.TYPE === 'Unified' ? '' : "_" + POLICY.TYPE }}
|
{{ POLICY.VM }} vCPU {{ POLICY.VCPU }}{{ POLICY.TYPE === 'Unified' ? '' : "_" + POLICY.TYPE }}
|
||||||
|
</text>
|
||||||
|
<text v-else>
|
||||||
|
{{ POLICY.VM }}
|
||||||
|
</text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
@ -70,10 +76,13 @@
|
|||||||
<div>
|
<div>
|
||||||
<!--right table-->
|
<!--right table-->
|
||||||
<div v-for="(POLICY,index) in CACHE_ALLOCATION.data.POLICY">
|
<div v-for="(POLICY,index) in CACHE_ALLOCATION.data.POLICY">
|
||||||
<div style="height: 33px;width: 100%;background: #bfbfbf"
|
<div class="policyDisabledBlock"
|
||||||
v-if="index===CACHE_ALLOCATION.real_time_count && CACHE_ALLOCATION.real_time_count>0"></div>
|
v-if="index===CACHE_ALLOCATION.real_time_count && CACHE_ALLOCATION.real_time_count>0"></div>
|
||||||
|
<div class="policyDisabledBlock"
|
||||||
|
v-if="index===CACHE_ALLOCATION.cat_count && CACHE_ALLOCATION.cat_count>0"></div>
|
||||||
<HexBlockRangeSelector
|
<HexBlockRangeSelector
|
||||||
v-model="POLICY.CLOS_MASK"
|
v-model="POLICY.CLOS_MASK"
|
||||||
|
:isVcat="index>=CACHE_ALLOCATION.cat_count"
|
||||||
:max="CACHE_ALLOCATION.capacity_mask_length"
|
:max="CACHE_ALLOCATION.capacity_mask_length"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -93,6 +102,10 @@ import _ from "lodash";
|
|||||||
import {vueUtils, fieldProps} from "@lljj/vue3-form-naive";
|
import {vueUtils, fieldProps} from "@lljj/vue3-form-naive";
|
||||||
import HexBlockRangeSelector from "./CAT/HexBlockRangeSelector.vue";
|
import HexBlockRangeSelector from "./CAT/HexBlockRangeSelector.vue";
|
||||||
|
|
||||||
|
function count(source, target) {
|
||||||
|
return (source.match(new RegExp(target, 'g')) || []).length;
|
||||||
|
}
|
||||||
|
|
||||||
// noinspection JSUnusedLocalSymbols
|
// noinspection JSUnusedLocalSymbols
|
||||||
export default {
|
export default {
|
||||||
name: "CAT",
|
name: "CAT",
|
||||||
@ -110,6 +123,7 @@ export default {
|
|||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
vueUtils.setPathVal(this.rootFormData, 'FEATURES.RDT.VCAT_ENABLED', value)
|
vueUtils.setPathVal(this.rootFormData, 'FEATURES.RDT.VCAT_ENABLED', value)
|
||||||
|
this.updateCatInfo()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SSRAM_ENABLED: {
|
SSRAM_ENABLED: {
|
||||||
@ -176,13 +190,13 @@ export default {
|
|||||||
alert('Can\'t generate default settings for this region(due to too many realtime cpu)')
|
alert('Can\'t generate default settings for this region(due to too many realtime cpu)')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let policyKey in CACHE_REGION.data.POLICY) {
|
for (let policyIndex = 0; policyIndex < CACHE_REGION.data.POLICY.length; policyIndex++) {
|
||||||
if (policyKey < CACHE_REGION.real_time_count) {
|
if (policyIndex < CACHE_REGION.real_time_count) {
|
||||||
CACHE_REGION.data.POLICY[policyKey].CLOS_MASK = '0x' + parseInt(
|
CACHE_REGION.data.POLICY[policyIndex].CLOS_MASK = '0x' + parseInt(
|
||||||
'0'.repeat(policyKey) + '1' + '0'.repeat(CACHE_REGION.capacity_mask_length - policyKey - 1),
|
'0'.repeat(policyIndex) + '1' + '0'.repeat(CACHE_REGION.capacity_mask_length - policyIndex - 1),
|
||||||
2).toString(16)
|
2).toString(16)
|
||||||
} else {
|
} else {
|
||||||
CACHE_REGION.data.POLICY[policyKey].CLOS_MASK = '0x' + parseInt(
|
CACHE_REGION.data.POLICY[policyIndex].CLOS_MASK = '0x' + parseInt(
|
||||||
'0'.repeat(CACHE_REGION.real_time_count) + '1'.repeat(CACHE_REGION.capacity_mask_length - CACHE_REGION.real_time_count),
|
'0'.repeat(CACHE_REGION.real_time_count) + '1'.repeat(CACHE_REGION.capacity_mask_length - CACHE_REGION.real_time_count),
|
||||||
2).toString(16)
|
2).toString(16)
|
||||||
}
|
}
|
||||||
@ -208,15 +222,20 @@ export default {
|
|||||||
//
|
//
|
||||||
// FEATURES.SSRAM.SSRAM_ENABLED
|
// FEATURES.SSRAM.SSRAM_ENABLED
|
||||||
// Software SRAM:
|
// Software SRAM:
|
||||||
// get CAT info from board xml
|
|
||||||
|
|
||||||
|
// get settings from formData
|
||||||
let RDT_ENABLED = this.RDT_ENABLED === 'y'
|
let RDT_ENABLED = this.RDT_ENABLED === 'y'
|
||||||
|
let CDP_ENABLED = this.CDP_ENABLED === 'y'
|
||||||
|
let VCAT_ENABLED = this.VCAT_ENABLED === 'y'
|
||||||
|
|
||||||
if (!RDT_ENABLED) {
|
if (!RDT_ENABLED) {
|
||||||
this.CAT_INFO = null
|
this.CAT_INFO = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get CAT info from board xml
|
||||||
let board_cat_info = window.getBoardData().CAT_INFO;
|
let board_cat_info = window.getBoardData().CAT_INFO;
|
||||||
let CDP_ENABLED = this.CDP_ENABLED === 'y'
|
|
||||||
|
|
||||||
// noinspection JSUnusedLocalSymbols
|
// noinspection JSUnusedLocalSymbols
|
||||||
let board_cat_info_example = [
|
let board_cat_info_example = [
|
||||||
@ -239,6 +258,13 @@ export default {
|
|||||||
{"VM": "POST_VM_5", "VCPU": 2}
|
{"VM": "POST_VM_5", "VCPU": 2}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let vCats = []
|
||||||
|
// noinspection JSUnusedLocalSymbols
|
||||||
|
let vCatsExample = [
|
||||||
|
{"VM": "VM_C", "VCPU": 0, "CLOS_MASK": 2}
|
||||||
|
]
|
||||||
|
|
||||||
window.getCurrentScenarioData().vm.map((vmConfig) => {
|
window.getCurrentScenarioData().vm.map((vmConfig) => {
|
||||||
if (
|
if (
|
||||||
!vmConfig.hasOwnProperty('cpu_affinity') ||
|
!vmConfig.hasOwnProperty('cpu_affinity') ||
|
||||||
@ -248,6 +274,18 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
|
if (
|
||||||
|
VCAT_ENABLED &&
|
||||||
|
vmConfig.hasOwnProperty('virtual_cat_support') &&
|
||||||
|
vmConfig.virtual_cat_support === "y"
|
||||||
|
) {
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
|
vCats.push({"VM": vmConfig.name, "VCPU": 0, "CLOS_MASK": vmConfig.virtual_cat_number})
|
||||||
|
// for enabled virtual_cat_support vm, it doesn't need set CAT
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vmConfig.cpu_affinity.pcpu.map((pcpu, index) => {
|
vmConfig.cpu_affinity.pcpu.map((pcpu, index) => {
|
||||||
if (!pcpu_vms.hasOwnProperty(pcpu.pcpu_id)) {
|
if (!pcpu_vms.hasOwnProperty(pcpu.pcpu_id)) {
|
||||||
pcpu_vms[pcpu.pcpu_id] = {'y': [], 'n': []}
|
pcpu_vms[pcpu.pcpu_id] = {'y': [], 'n': []}
|
||||||
@ -355,7 +393,10 @@ export default {
|
|||||||
1: {"Code": '0xff0', "Data": '0x00f'} // CDP_ENABLED
|
1: {"Code": '0xff0', "Data": '0x00f'} // CDP_ENABLED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scenario_cat_data.hasOwnProperty(cat_region_info.level) && scenario_cat_data[cat_region_info.level].hasOwnProperty(cat_region_info.id)) {
|
if (
|
||||||
|
scenario_cat_data.hasOwnProperty(cat_region_info.level) &&
|
||||||
|
scenario_cat_data[cat_region_info.level].hasOwnProperty(cat_region_info.id)
|
||||||
|
) {
|
||||||
let current_region_scenario_cat_data = scenario_cat_data[cat_region_info.level][cat_region_info.id];
|
let current_region_scenario_cat_data = scenario_cat_data[cat_region_info.level][cat_region_info.id];
|
||||||
// noinspection JSUnusedLocalSymbols
|
// noinspection JSUnusedLocalSymbols
|
||||||
let current_region_scenario_cat_data_example = {
|
let current_region_scenario_cat_data_example = {
|
||||||
@ -364,15 +405,15 @@ export default {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
for (let i = 0; i < current_region_scenario_cat_data.POLICY.length; i++) {
|
for (let i = 0; i < current_region_scenario_cat_data.POLICY.length; i++) {
|
||||||
let current_policies = current_region_scenario_cat_data.POLICY[i]
|
let currentRegionScenarioPolicy = current_region_scenario_cat_data.POLICY[i]
|
||||||
if (!vmCPUClosMasks.hasOwnProperty(current_policies.VM)) {
|
if (!vmCPUClosMasks.hasOwnProperty(currentRegionScenarioPolicy.VM)) {
|
||||||
vmCPUClosMasks[current_policies.VM] = {}
|
vmCPUClosMasks[currentRegionScenarioPolicy.VM] = {}
|
||||||
}
|
}
|
||||||
if (!vmCPUClosMasks[current_policies.VM].hasOwnProperty(current_policies.VCPU)) {
|
if (!vmCPUClosMasks[currentRegionScenarioPolicy.VM].hasOwnProperty(currentRegionScenarioPolicy.VCPU)) {
|
||||||
vmCPUClosMasks[current_policies.VM][current_policies.VCPU] = {}
|
vmCPUClosMasks[currentRegionScenarioPolicy.VM][currentRegionScenarioPolicy.VCPU] = {}
|
||||||
}
|
}
|
||||||
if (["Unified", "Code", "Data"].indexOf(current_policies.TYPE) >= 0) {
|
if (["Unified", "Code", "Data"].indexOf(currentRegionScenarioPolicy.TYPE) >= 0) {
|
||||||
vmCPUClosMasks[current_policies.VM][current_policies.VCPU][current_policies.TYPE] = current_policies.CLOS_MASK
|
vmCPUClosMasks[currentRegionScenarioPolicy.VM][currentRegionScenarioPolicy.VCPU][currentRegionScenarioPolicy.TYPE] = currentRegionScenarioPolicy.CLOS_MASK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,15 +424,25 @@ export default {
|
|||||||
"POLICY": []
|
"POLICY": []
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCATPolicy(cpu_policies_line, line_type) {
|
function addCATPolicy(cpu_policies_line, line_type, vcat_mask_length = null) {
|
||||||
cpu_policies_line['TYPE'] = line_type;
|
cpu_policies_line['TYPE'] = line_type;
|
||||||
let clos_mask = "0x" + parseInt('1'.repeat(cat_region_info.capacity_mask_length), 2).toString(16);
|
let clos_mask = "0x" + parseInt('1'.repeat(
|
||||||
|
// if vcat_mask_length is null
|
||||||
|
vcat_mask_length === null ?
|
||||||
|
// filled by capacity_mask_length
|
||||||
|
cat_region_info.capacity_mask_length :
|
||||||
|
// filled by vcat_mask_length
|
||||||
|
vcat_mask_length
|
||||||
|
), 2).toString(16);
|
||||||
if (
|
if (
|
||||||
vmCPUClosMasks.hasOwnProperty(cpu_policies_line.VM) &&
|
vmCPUClosMasks.hasOwnProperty(cpu_policies_line.VM) &&
|
||||||
vmCPUClosMasks[cpu_policies_line.VM].hasOwnProperty(cpu_policies_line.VCPU) &&
|
vmCPUClosMasks[cpu_policies_line.VM].hasOwnProperty(cpu_policies_line.VCPU) &&
|
||||||
vmCPUClosMasks[cpu_policies_line.VM][cpu_policies_line.VCPU].hasOwnProperty(line_type)
|
vmCPUClosMasks[cpu_policies_line.VM][cpu_policies_line.VCPU].hasOwnProperty(line_type)
|
||||||
) {
|
) {
|
||||||
clos_mask = vmCPUClosMasks[cpu_policies_line.VM][cpu_policies_line.VCPU][line_type];
|
let scenario_clos_mask = vmCPUClosMasks[cpu_policies_line.VM][cpu_policies_line.VCPU][line_type];
|
||||||
|
if (vcat_mask_length === null || count(Number.parseInt(scenario_clos_mask).toString(2), '1') === vcat_mask_length) {
|
||||||
|
clos_mask = scenario_clos_mask
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cpu_policies_line['CLOS_MASK'] = clos_mask;
|
cpu_policies_line['CLOS_MASK'] = clos_mask;
|
||||||
cat_region_info.data.POLICY.push(cpu_policies_line)
|
cat_region_info.data.POLICY.push(cpu_policies_line)
|
||||||
@ -415,15 +466,28 @@ export default {
|
|||||||
return CDP_ENABLED ? 2 * cpu_policies.length : cpu_policies.length
|
return CDP_ENABLED ? 2 * cpu_policies.length : cpu_policies.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add rt vm policy
|
||||||
cat_region_info.real_time_count = 0
|
cat_region_info.real_time_count = 0
|
||||||
for (let i = 0; i < cat_region_info.processors.length; i++) {
|
for (let i = 0; i < cat_region_info.processors.length; i++) {
|
||||||
let cpu_policies = _.cloneDeep(pcpu_vms[cat_region_info.processors[i]] ? pcpu_vms[cat_region_info.processors[i]]['y'] || [] : []);
|
let pcpu_id = cat_region_info.processors[i];
|
||||||
|
let cpu_policies = _.cloneDeep(pcpu_vms[pcpu_id] ? pcpu_vms[pcpu_id]['y'] || [] : []);
|
||||||
cat_region_info.real_time_count += addPolicy(cpu_policies)
|
cat_region_info.real_time_count += addPolicy(cpu_policies)
|
||||||
}
|
}
|
||||||
|
// add std vm policy
|
||||||
|
cat_region_info.cat_count = _.cloneDeep(cat_region_info.real_time_count)
|
||||||
for (let i = 0; i < cat_region_info.processors.length; i++) {
|
for (let i = 0; i < cat_region_info.processors.length; i++) {
|
||||||
let cpu_policies = _.cloneDeep(pcpu_vms[cat_region_info.processors[i]] ? pcpu_vms[cat_region_info.processors[i]]['n'] || [] : []);
|
let pcpu_id = cat_region_info.processors[i];
|
||||||
addPolicy(cpu_policies)
|
let cpu_policies = _.cloneDeep(pcpu_vms[pcpu_id] ? pcpu_vms[pcpu_id]['n'] || [] : []);
|
||||||
|
cat_region_info.cat_count += addPolicy(cpu_policies)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add cat vm policy
|
||||||
|
if (cat_region_info.processors.indexOf(0) !== -1) {
|
||||||
|
for (let i = 0; i < vCats.length; i++) {
|
||||||
|
addCATPolicy(_.cloneDeep(vCats[i]), 'Unified', vCats[i].CLOS_MASK)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.CAT_INFO = board_cat_info;
|
this.CAT_INFO = board_cat_info;
|
||||||
@ -459,6 +523,12 @@ export default {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.policyDisabledBlock {
|
||||||
|
height: 33px;
|
||||||
|
width: 100%;
|
||||||
|
background: #bfbfbf
|
||||||
|
}
|
||||||
|
|
||||||
/*noinspection CssUnusedSymbol*/
|
/*noinspection CssUnusedSymbol*/
|
||||||
.form-check {
|
.form-check {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1,55 +1,68 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Slider v-model="hexField" :merge="-1" :max="max" :tooltips="false"/>
|
<Slider v-model="hexField" :max="max" :tooltips="false" :options="sliderOptions"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Slider from '@vueform/slider'
|
import Slider from '@vueform/slider'
|
||||||
|
|
||||||
|
function count(source, target) {
|
||||||
|
return (source.match(new RegExp(target, 'g')) || []).length;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "HexBlockRangeSelector",
|
name: "HexBlockRangeSelector",
|
||||||
components: {
|
components: {
|
||||||
Slider,
|
Slider,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
sliderOptions() {
|
||||||
|
let options = {}
|
||||||
|
if (this.isVcat) {
|
||||||
|
options['behaviour'] = 'drag-fixed'
|
||||||
|
}
|
||||||
|
return options
|
||||||
|
},
|
||||||
hexField: {
|
hexField: {
|
||||||
get() {
|
get() {
|
||||||
let strBin = parseInt(this.modelValue).toString(2)
|
let str_bin = Number.parseInt(this.modelValue).toString(2);
|
||||||
let rangeStart = 0;
|
let block_length = str_bin.length;
|
||||||
for (let i = strBin.length - 1; i >= 0; i--) {
|
let block_enabled_length = count(str_bin, "1");
|
||||||
if (strBin[i] === '0') {
|
|
||||||
rangeStart++
|
let start = 0
|
||||||
|
let end = 0
|
||||||
|
|
||||||
|
if (block_length > this.max) {
|
||||||
|
if (block_enabled_length >= this.max) {
|
||||||
|
str_bin = "1".repeat(this.max);
|
||||||
} else {
|
} else {
|
||||||
break
|
str_bin = "0".repeat(this.max - block_enabled_length) + "1".repeat(block_enabled_length);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (block_length < this.max) {
|
||||||
|
str_bin = "0".repeat(this.max - block_length) + str_bin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let rangeEnd = strBin.length;
|
|
||||||
return [this.max - rangeEnd, this.max - rangeStart]
|
start = str_bin.indexOf("1") !== -1 ? str_bin.indexOf("1") : 0;
|
||||||
|
end = start + count(str_bin, "1");
|
||||||
|
|
||||||
|
// noinspection UnnecessaryLocalVariableJS
|
||||||
|
let result = [start, end]
|
||||||
|
return result
|
||||||
|
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
if (value[0] - value[1] === 0) {
|
if (value[0] - value[1] === 0) {
|
||||||
this.hexField = this.lastVal;
|
this.hexField = this.lastVal;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.lastVal = value;
|
this.lastVal = this.hexField
|
||||||
let result = ""
|
let result = '0'.repeat(value[0]) + '1'.repeat(value[1] - value[0]) + '0'.repeat(this.max - value[1])
|
||||||
for (let i = 0; i < this.max; i++) {
|
result = (parseInt(result, 2).toString(16))
|
||||||
let tmp = null;
|
let zeroPadding = '0'.repeat(Number.parseInt('1'.repeat(this.max), 2).toString(16).length - result.length)
|
||||||
if (i < value[0]) {
|
result = '0x' + zeroPadding + result
|
||||||
tmp = '0'
|
|
||||||
} else if (i < value[1]) {
|
|
||||||
tmp = '1'
|
|
||||||
} else if (i >= value[1]) {
|
|
||||||
tmp = '0'
|
|
||||||
} else {
|
|
||||||
debugger
|
|
||||||
throw new Error('???')
|
|
||||||
}
|
|
||||||
result += tmp;
|
|
||||||
}
|
|
||||||
console.log(result)
|
|
||||||
result = '0x' + (parseInt(result, 2).toString(16))
|
|
||||||
console.log(result)
|
console.log(result)
|
||||||
this.$emit("update:modelValue", result);
|
this.$emit("update:modelValue", result);
|
||||||
}
|
}
|
||||||
@ -59,6 +72,9 @@ export default {
|
|||||||
return {lastVal: [0, 1]}
|
return {lastVal: [0, 1]}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
isVcat: {
|
||||||
|
type: Boolean
|
||||||
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user