mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-01 21:23:59 +00:00
This patch adds support to parse RTCT v2 using the refined board XML schema. The major changes include: - Add the RTCT v2 parser in the acpiparser module. The version of an RTCT is detected automatically to choose the right parser. - Extract software SRAM capabilities of caches into the board XML. - Move the logic that determines the software SRAM base address for the pre-launched VM to the static allocator of GPAs. - Generate software SRAM related macros into misc_cfg.h when necessary. Tracked-On: #6020 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (C) 2021 Intel Corporation. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
#
|
|
|
|
import sys, os
|
|
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
|
|
import common
|
|
|
|
def allocate_ssram_region(board_etree, scenario_etree, allocation_etree):
|
|
# Guest physical address of the SW SRAM allocated to a pre-launched VM
|
|
enabled = common.get_node("//PSRAM_ENABLED/text()", scenario_etree)
|
|
if enabled == "y":
|
|
pre_rt_vms = common.get_node("//vm[vm_type ='PRE_RT_VM']", scenario_etree)
|
|
if pre_rt_vms is not None:
|
|
vm_id = pre_rt_vms.get("id")
|
|
l3_sw_sram = board_etree.xpath("//cache[@level='3']/capability[@id='Software SRAM']")
|
|
if l3_sw_sram:
|
|
start = min(map(lambda x: int(x.find("start").text, 16), l3_sw_sram))
|
|
end = max(map(lambda x: int(x.find("end").text, 16), l3_sw_sram))
|
|
|
|
allocation_vm_node = common.get_node(f"/acrn-config/vm[@id = '{vm_id}']", allocation_etree)
|
|
if allocation_vm_node is None:
|
|
allocation_vm_node = common.append_node("/acrn-config/vm", None, allocation_etree, id = vm_id)
|
|
common.append_node("./ssram/start_gpa", hex(start), allocation_vm_node)
|
|
common.append_node("./ssram/end_gpa", hex(end), allocation_vm_node)
|
|
|
|
def fn(board_etree, scenario_etree, allocation_etree):
|
|
allocate_ssram_region(board_etree, scenario_etree, allocation_etree)
|