Commit Graph

34 Commits

Author SHA1 Message Date
Zhangwei6 056f4abcfb config_tools: fix pre_launch VM ACPI table
Current acpi table adopts the DWordAddressSpace to
present the PCI hole above 4G. It is not correct,
because DWordAddressSpace is used to present the
mem space below 4G.
Follow the ACPI spec, modify to QWordAddressSpace here.

Refer: 19.6.22. CreateQWordField (Create 64-Bit Buffer Field)

Tracked-On: #8552
Signed-off-by: Zhangwei6 <wei6.zhang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2024-02-04 15:36:02 +08:00
Kunhui-Li ba80272503 config_tools: ACPI table needs to be generated automatedly for Pre-launched VM
Currently, for pre-launched VM, ACPI table is generated only when "reboot=acpi"
is added to cmdline in the scenario file. This patch removes this check support
that ACPI table must be generated automatedly for the Pre-launched VM.

Tracked-On: #8546
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2024-01-04 11:26:12 +08:00
Zhang Chen 930e5904af config_tools: Fix TPM2 parameter issue
When enable TPM2 tag in acrn scenario file, can't pass compile:
File "../hypervisor/../misc/config_tools/acpi_gen/bin_gen.py", line 128, in tpm2_acpi_gen
    ctype_data.start_method_specific_parameters[i] = int(start_method_parameters[i], 16)
ValueError: invalid literal for int() with base 16: '\n        '

Fix this issue in tpm2_acpi_gen.

Tracked-On: #8516

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-10-10 16:27:06 +08:00
Chenli Wei 6d57f8254b misc: rename common.py to avoid private library conflict
The offline tool use a utility libary and use "common" to named it, this
name conflict with some customer's local library, so we rename it to a
better and clear name.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
2022-11-14 12:03:51 +08:00
Junjie Mao 4369896549 config_tools: acpi_gen: generate vRTCT instead of copying a physical one
As the last step to simplify the steps to enable software SRAM passthrough
to a pre-launched RT VM, this patch generates a virtual RTCT which only
contains a compatibility entry (to indicate that the format of the RTCT is
v2) and a couple of SSRAM or SSRAM waymask entries to report the software
SRAM blocks that pre-launched VM has access. That follows the practice how
ACRN device model generates virtual RTCT for post-launched VMs today.

In case RTCT v1 is used physically, this patch still generates a v2 RTCT
for the pre-launched VM but does not add an SSRAM waymask entry there
due to lack of information.

Tracked-On: #7947
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-08-05 07:36:40 +08:00
Junjie Mao eff353700e config_tools: acpi_gen: refactor ACPI table generation logic
While functionally correct, the ACPI table (mostly DSDT) generation logic
in asl_gen.py contains multiple occurrences that share the same code
structure as follows:

    cls = <class of the table>
    length = ctypes.sizeof(cls)
    data = bytearray(length)
    res = cls.from_buffer(data)
    <setting multiple fields in res>

To minimize code duplication, this patch refactors the logic by abstracting
the creation of an ACPI table into a method which returns a newly created
object of the given class after setting the specified fields.

Tracked-On: #7947
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-08-05 07:36:40 +08:00
Ziheng Li eb8bcb06b3 Update copyright year range in code headers
Modified the copyright year range in code, and corrected "int32_tel"
into "Intel" in two "hypervisor/include/debug/profiling.h" and
"hypervisor/include/debug/profiling_internal.h".

Tracked-On: #7559
Signed-off-by: Ziheng Li <ziheng.li@intel.com>
2022-07-15 11:48:35 +08:00
Shiqing Gao 3eb1237db3 config_tools: verify "iasl" version against IASL_MIN_VER
To avoid hardcoding the minimum "iasl" version in multiple places, IASL_MIN_VER
is defined in the top-level Makefile and is passed to config_tools.

This patch verifies "iasl" version against IASL_MIN_VER directly in
config_tools.

Tracked-On: #7880

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
2022-07-13 14:01:01 +08:00
Shiqing Gao 3f0fae81b2 config_tools: use ASL_COMPILER as the path to the "iasl" compiler
At build time (on the *dev* machine), config_tools depends on "iasl" to
generate the binary of ACPI tables for pre-launched VMs.

This patch does:
- pass ASL_COMPILER to config_tools
  By default, ASL_COMPILER is initialized by "which iasl" at build time.
  User could override it by specifying ASL_COMPILER as the build option,
  like below:
    make BOARD=xxxx SCENARIO=yyyy ASL_COMPILER=/usr/local/bin/iasl

- use ASL_COMPILER as the path to the "iasl" compiler in config_tools

v1 -> v2:
 - add a check to make sure ASL_COMPILER is initialized to a value

Tracked-On: #7880

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
2022-07-13 14:01:01 +08:00
Junjie Mao 4fe6cae877 config_tools: track whether each vCPU is used for real-time or not
According to DX recommendations, this patch adds a Boolean item to each
vCPU which allows users to specify the vCPUs intended for
real-time-critical tasks. This information will be used to organize other
widgets (CAT-related ones for now) in the configurator to tell apart
real-time ones from the others for better clarity.

All vCPUs are by default not real-time-critical, except those in the RT VMs
which are.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-04-21 10:08:53 +08:00
hangliu1 7bcc5b7383 config tool:add support for bootargs missing
Bugfix:bootargs is optional parameter, which may be not
present in xml as a node, asl_gen.py needs to process
that case.

Tracked-On: #7307
Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
2022-04-19 13:20:08 +08:00
Zhou, Wu 423312881d config-tools: extract the SSRAM area size
The GPA SSRAM area size in pre-launched VMs was hard-coded to 8MB.

Since this area is mapped from host SSRAM area, it will cause compile
problem when host's SSRAM area is larger than 8MB.

To solve this issue, we have to calculate SSRAM area's size in
gpa.py, and generate a macro PRE_RTVM_SW_SRAM_MAX_SIZE for HV
to use.

PRE_RTVM_SW_SRAM_START_GPA/END_GPA can be calculated by end/size
in HV, so they are removed.

When SSRAM is not configured in the system, PRE_RTVM_SW_SRAM_MAX_SIZE
is set to 0.

Crl_bin is not needed in guest. So it's size is removed in bin_gen.py.

Tracked-On: #7212

Signed-off-by: Zhou, Wu <wu.zhou@intel.com>
2022-04-18 16:47:23 +08:00
hangliu1 0068d4e826 config tool: remove guest_flags in user interface
The concept of guest_flags is hard to understand for users.
So turn guest_flags into several parameters in config tool
user interface, list as below:

GUEST_FLAG_LAPIC_PASSTHROUGH ---> lapic_passthrough
GUEST_FLAG_IO_COMPLETION_POLLING ---> io_completion_polling
GUEST_FLAG_VCAT_ENABLED ---> virtual_cat_support
GUEST_FLAG_SECURE_WORLD_ENABLED ---> secure_world_support
GUEST_FLAG_HIDE_MTRR ---> hide_mtrr_support
GUEST_FLAG_NVMX_ENABLED ---> nested_virtualization_support
GUEST_FLAG_SECURITY_VM ---> security_vm
GUEST_FLAG_RT ---> vm_type(RTVM)
GUEST_FLAG_TEE ---> vm_type(TEE_VM)
GUEST_FLAG_REE ---> vm_type(REE_VM)

In addition, HV global parameter NVMX_ENABLE is removed
from user interface, when config tool detects more than
one VM with nested_virtualization_support, NVMX_ENABLE is
assigned as 'y' automatically.

v1->v2:
*Rebase on the latest xml schema checking change
*Remove "all rights reserved" from the license header in guest_flags.py

v2->v3:
*Change the name of the new config items to CAPITAL_CASE style
*Combine guest flag policy to an XPATH in guest_flags.py
*Use count() to directly deduce NVMX_ENABLED in config_common.xsl and
update `boolean-by-key-value` to process 'true'

v3->v4:
*Change the name of the new config items to lower_case style
*Change guest_flag_node to allocation_vm_node in guest_flags.py
*Separate value case and key case for boolean-by-key-value

Tracked-On: #6690
Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-03-02 15:50:23 +08:00
Kunhui-Li 1034443796 config_tools: fix the issue that fail to get apic_id node
Update the XPATH of apic_id to tolerate the variance of reported
intermediate levels.

Tracked-On: #7159
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-03-02 11:31:28 +08:00
hangliu1 816a88f7f7 config tool: add load_order and redefine vm_type
This patch includes:
1.add load_order(PRE_LAUNCHED_VM/SERVICE_VM/POST_LAUNCHED_VM) parameter
2.change vm_type parameter to values as RTVM, STANDARD_VM, TEE, REE
  TEE and REE are hide in UI.
3.deduce vm severity in vm_configuration from vm_type and load_order

This patch not includes:
change for scenario_config and functions called by scenario_config about checking

v2->v3:
*Refine template load_order

v1->v2:
*Change variable name from vm_type to load_order
*Change LoadOptionType to LoadOrderType
*Change VMOptionsType to VMType
*Add TEE_VM/REE_VM description
*Refine acrn:is-pre-launched-vm

Tracked-On: #6690
Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-02-22 16:25:27 +08:00
Zhou, Wu 48adda150c config-tools: move the pre RTVM's SSRAM base GPA
The pre-rtvm uses the RTCT tab to determine it's SSRAM address.
It was origionally duplicated from the host, and keeped its address
and layout.

To move the SSRAM area in ve820, we have to modify the guest's RTCT
tab first.

This patch uses the board_inspector's RTCT module to parse the host's
RTCT tab, and calculate the offset, then modifies the SSRAM/bin enties,
and saves it to the new RTCT bin file.

Tracked-On: #6674

Signed-off-by: Zhou, Wu <wu.zhou@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-11-08 13:13:14 +08:00
Hu Fenglin f65a87585b deb-pkg: add acrn-hypervisor and acrn-board-inspector into debian package
1. "make clean && make BOARD=nuc11tnbi5  SCENARIO=shared" will generate the acrn debian package.
 2. "make clean && make board_inspector" will generate the acrn board_inspector debian package

Tracked-On: #6688
Signed-off-by: Hu Fenglin <fenglin.hu@intel.com>
2021-11-02 15:31:18 +08:00
Victor Sun b80b1dde25 config_tools: add PnP uart and rtc for pre-launched VM
In commit of 7cc9c8fe06
the pre-launched VM was set to ACPI HW Reduced platform, then the IRQ
would be allocated from 0 for PCI MSI devices. The Intel igb/igc driver
might get IRQ 8 when do request irq which would conflict with the irq
of RTC device:
    [ 14.264954] genirq: Flags mismatch irq 8. 00000000 (enp0s8-TxRx-3) vs.
                 00000000 (rtc0)
    [ 14.265411] ------------[ cut here ]------------
    [ 14.265508] kernel BUG at drivers/pci/msi.c:376!
    [ 14.265610] invalid opcode: 0000 [#1] PREEMPT SMP
    [ 14.265710] CPU: 0 PID: 296 Comm: connmand Not tainted 5.10.52-acrn-sos
                 -dirty #72
    [ 14.265863] RIP: 0010:free_msi_irqs+0x182/0x1b0

This patch will specify some legacy PnP device like UART and RTC in ACPI
DSDT table of pre-launched VM, so that IRQs from IOAPIC pin 4/3/8 could be
preserved before MSI device requesting IRQs.

Tracked-On: #6704

Signed-off-by: Victor Sun <victor.sun@intel.com>
2021-10-25 13:35:09 +08:00
Junjie Mao aceae3a30f config_tools: update vTPM2 revision to 4
According to TCG ACPI specification (version 1.2), the current revision of
TPM2 table, which has the optional log area fields, is 4. This patch
updates the revision of vTPM2 accordingly.

Tracked-On: #6288
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-10-21 12:58:43 +08:00
Yang,Yu-chu 8f2ede9cfd config-tools: pci devices' io-ports passthrough
Pass through the io-ports for the passthrough pci devices of
pre-launched VM.

Three parts to support this feature:
1. Identical map the pci devices io-port address for pre-launched VM
2. Set the io-ports address range to DSDT
3. Avoid to allocate the bar index for VMSIX

Tracked-On: #6620
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-09-26 09:21:11 +08:00
Yang,Yu-chu c10ac227cc config-tools: remove unused package and add nosec to subprocess
The subprocess module is needed for calling package from python script.
Add #nosec for subprocess module importing.

Tracked-On: #6342
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-08-13 16:11:42 +08:00
Yang,Yu-chu d997f4bbc1 config-tools: refine bin_gen.py and create virtual TPM2 acpi table
Create virtual acpi table of tpm2 based on the raw data if the TPM2
device is presented and the passthrough tpm2 is enabled.

Refine the arguments of bin_gen.py. The --board and --scenario take the
path to the XMLs as the argument. The allocation.xml is needed for
bin_gen.py to generate tpm2 acpi table.

Refine the condition of tpm2_acpi_gen. The tpm2 device "MSFT0101" can be
present in device id or compatible_id(CID). Check both attributes and
child node of tpm2 device.

Tracked-On: #6320
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-08-11 14:45:55 +08:00
Fei Li a705ff2dac hv: relocate ACPI DATA address to 0x7fe00000
Relocate ACPI address to 0x7fe00000 and ACPI NVS to 0x7ff00000 correspondingly.
In this case, we could include TPM event log region [0x7ffb0000, 0x80000000)
into ACPI NVS.

Tracked-On: #6320
Signed-off-by: Fei Li <fei1.li@intel.com>
2021-08-11 14:45:55 +08:00
Junjie Mao d2543720a5 config_tools: adjust the layout of vACPI images
The current vACPI image layout reserves 512 bytes for vDSDT. Given the fact
that the size of vDSDT of a pre-launched VM grows when more devices are
assigned to the VM, this size limit can be easily exceeded. As an example,
a single pass-through TSN NIC requires 291 bytes in vDSDT to define device
objects representing its PCS (Physical Coding Sublayer), which means the
current reserved space for vDSDT does not allow two TSN NICs to be assigned
to the same VM.

This patch enlarges the reserved space for vDSDT to 2432 bytes by moving
the MCFG and MADT spaces. 768 bytes are still reserved for MADT which
is sufficient to encode the LAPIC information for more than 64 vCPUs.

This patch is added in v2 of the series.

Tracked-On: #6287
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-08-09 09:05:01 +08:00
Junjie Mao 07c2f604ae config_tools: generate vDSDT according to allocated resources
This patch generates vDSDT for pre-launched VMs based on the scenario
configuration and static allocation results. The vDSDT contains the
following objects.

  * A device object representing the root PCI bus which has the same
    location and name as the object in physical DSDT. This object contains
    device identification objects such as _HID, _CID, _BBN and _UID, the
    _CRS object encoding the bus numbers and PCI hole regions, and the _PRT
    object encoding the routing from vPCI device pins to virtual interrupt
    lines.

  * For each pass-through device assigned to the VM, a device object is
    created based on the AML template of that device in board XML (if
    exists). The _ADR object is rewritten with the vBDF..

v1 -> v2:
  * In order to replace the current static vDSDT, the AML templates in
    board XMLs now include objects that are referenced by other devices as
    well.
  * When TPM is assigned, the corresponding device object in DSDT (if
    exists) will be copied.
  * Add the _S5 control method to vDSDT, as is done in the static DSDT
    sources.
  * The old vDSDT generation routine and the static DSDT sources it uses
    are removed.

v2 -> v3:
  * Only follow 'uses', 'is used by' or 'consumes resources by'
    dependencies.
  * Organize the device objects in vDSDT according to the scopes they are
    in.

Tracked-On: #6287
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-08-09 09:05:01 +08:00
Kunhui-Li 005dacbbae config_tools: enlarge max size to store RTCT table
Enlarge the max size to store the PTCT/RTCT table to 1k bytes
because the size of RTCT table exceeded the original max size
0x1100 - 0xF00 which makes RTCT table overlap other ACPI tables.

Tracked-On: #6303
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-07-19 10:11:11 +08:00
Shuang Zheng 2247aeed69 config_tools: add RTCT table support in pre-launched VMs
add RTCT table integrated with ACPI binary for pre-launched
VMs.

Tracked-On: #6015

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
2021-06-01 09:11:03 +08:00
dongshen a3d06929e7 config-tools: retrieve physical APIC IDs and use them to fill in the ACPI MADT table
Retrieve physical APIC IDs from board xml file and use them to fill in the ACPI MADT table
for pre-Launched VMs.

Note that the config-tool will throw an error if the processors/die/core/thread tags are absent.
User needs to run board_inspector.py to regenerate the board xml file when this commit is merged,
if the processors/die/core/thread tags are missing in the board xml file.

Tracked-On: #6020
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
Yonghua Huang 9facbb43b3 config-tool: rename PSRARM to SSRAM
'psram' and 'PSRAM' are legacy names and replaced
  with 'ssram' and 'SSRAM' respectively.

Tracked-On: #6012
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuang Zheng <shuang.zheng@intel.com>
2021-05-17 14:31:42 +08:00
Shuang Zheng e1f7824004 config_tools: update condition for bootargs error check
add bootargs error check only when kernel type is KERNEL_BZIMAGE.

Tracked-On: #5689

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
2021-02-09 09:00:46 +08:00
Xie, nanlin 0b6840d1be acrn-config: Update generated configuration source code
1.Reorg generated configuration source code structure
2.Upstream generated configuration source code based on generic board infomation
3.Update license date from 2020 to 2021

Tracked-On: #5644
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2021-02-02 16:53:56 +08:00
Xie, nanlin f7772a98ee acrn-config: Rename acpi generated asl folder name from VMx to ACPI_VMx
Tracked-On: #5644
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2021-01-29 15:04:09 +08:00
Shuang Zheng d891e2929b acrn-config: add fusa_partition scenario on ehl-crb-b board
add fusa_partition scenario with 1 pre-launched Zephyr and 1 pre-launched
RTVM for ehl-crb-b board.

v2: fix the issue for build failure for partition mode by error check of
bootargs.

Tracked-On: #5665

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2021-01-29 11:06:41 +08:00
Xie, nanlin 97c9b24030 acrn-config: Reorg config tool folder
Remove vm_configs folder and move all the XML files and generic code example into config_tools/data

Tracked-On: #5644
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2021-01-27 11:08:28 +08:00