Commit Graph

1500 Commits

Author SHA1 Message Date
Jiaqing Zhao 0016a64655 misc: life_mngr: fix use-after-free in uart channel
LIST_FOREACH() doesn't allow var to be removed or freed within the
loop, but c_dev is freed inside the loop here. gcc 12 also reports
error on it. This patch uses list_foreach_safe() macro instead for
freeing var within the loop safely.

Tracked-On: #8382
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-06-13 15:43:48 +08:00
Kunhui-Li b1b4bc98af config_tools: fix the issue that fail to generate config_summary.rst if enable CAT
currently, configurator will fail to generate config_summary.rst file if
user enable the "Cache Allocation Technology" because note function in rstcloth
is replaced by self.doc.note.

So this patch updates function and usage to fix this issue.

fixs: 9c2d0f8 ("config_tools: replace RstCloth library with class.")
Tracked-On: #8422
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-06-09 18:56:47 +08:00
Jiaqing Zhao 2cf158994b config_tools: remove rstcloth package
9c2d0f8858 ("config_tools: replace RstCloth library with class.")
removes all usage of rstcloth in code, but the rstcloth package is not
removed from acrn-configurator and it will still download dependencies
for rstcloth. This patch simply removes it.

Tracked-On: #8395
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-05-16 12:29:04 +08:00
Kunhui-Li 151305e8c9 config_tools: replace RstCloth library with class.
Currently, Configurator load fail because it needs to download
RstCloth related packages. This patch defines Doc class to replace
RstCloth library to fix this issue.

Tracked-On: #8395
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-05-11 14:49:59 +08:00
Kunhui-Li de188258f6 config_tools: capture the IOError exception
If no TURBO_RATIO_LIMIT and TURBO_ACTIVATION_RATIO MSRs info
on target, board inspector will crash because of the IOError exception.

This patch captures the IOError exception to handle this error.

Tracked-On: #8380
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-05-04 15:10:44 +08:00
Kunhui-Li d83d0fed47 config_tools: filter non-ascii characters in iomem infomation
If we use 5.15 kernel on rpl-p platform, some iomem info dumped with
non-ascii characters, then tool will raise a decode error.

So this patch filters non-ascii characters to handle this error.

Tracked-On: #8388
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-04-25 18:05:26 +08:00
Chenli Wei 31c0362ac4 misc: fix the summary issue after update board xml
The new board xml have add a "module" node under the "processors/die"
which has cause an issue when we run the summary, this patch  use "//"
to select all "cpu_id" under the "processors".

Tracked-On: #8385
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
2023-04-24 23:03:05 +08:00
Jian Jun Chen dde388d82c misc: life_mngr: revise try_receive_message_by_uart
Revise try_receive_message_by_uart to read one char from uart one time.
With this implementation each char can be checked. This can be used to
address the following 2 problems:
1) nosie data: it is found that there is noise data in the uart from
   guest VM when guest startup.
2) split multiple commands

Tracked-On: #8111
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
2022-11-24 09:41:51 +08:00
Junjie Mao f4f828f762 config_tools/schema: fix division operator in error messages
The division operator in XPATH is `div`, not `/`. Fix it in an error
message of the assertions.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-11-22 16:06:48 +08:00
Junjie Mao 4c54dae5cf board_inspector: fix the invocation to rdmsr
Commit ce6500893 ("board_inspector: use executables found under system
paths") unintendedly changes how acpi.py invokes `rdmsr` and that impacts
the type of the execution results and causes incompatible method calls when
the results are parsed.

Convert the invocation back to shell-style.

Fixes: ce6500893 ("board_inspector: use executables found under system paths")
Tracked-On: #8315
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-11-22 15:32:24 +08:00
Xie, nanlin a58d2ebddc misc: Update sample launch scripts into generic_board folder.
Currently we use configurator to generate sample launch scripts and
configuration code, remove old ones and put all generated launch scripts
into generic_board.

Tracked-On: #6690
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2022-11-21 11:51:33 +08:00
yuchuyang 796fb2971c config-tools: board inspector exits if the VMD is configured
Board inspector does not support multiple PCI segment. Stop running and
throw out the message for user to disable VMD from BIOS setting.

Tracked-On: #8327
Signed-off-by: yuchuyang <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-21 10:03:39 +08:00
yuchuyang 9d8ddeabdc config-tools: board inspector does not exit if a usb device is unplugged
Board inspector may throw an error if a usb device is unplugged or
disconnected while extracting usb device information. Print out the
debug message and continue parsing.

Tracked-On: #8325
Signed-off-by: yuchuyang <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-18 19:22:44 +08:00
dependabot[bot] 43aec3d2a3 build(deps-dev): bump vite in /misc/config_tools/configurator
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 2.9.6 to 2.9.13.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v2.9.13/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 16:57:48 +08:00
Junjie Mao ce6500893f board_inspector: use executables found under system paths
Using partial executable paths in the board inspector may cause unintended
results when another executable has the same name and is also detectable in
the search paths.

Introduce a wrapper module (`external_tools`) which locates executables
only under system paths such as /usr/bin and /usr/sbin and converts partial
executable paths to absolute ones before executing them via the subprocess
module. All invocations to `subprocess.run` or `subprocess.Popen`
throughout the board inspector are replaced with `external_tools.run`, with
the only exception being the invocation to the legacy board parser which
already uses an absolute path to the current Python interpreter.

Tracked-On: #8315
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-11-16 11:02:42 +08:00
Junjie Mao 32edd75f7f static_allocator/gpa: deduplicate secondary PCI window list
When one single device being connected after multiple-levels of PCI-to-PCI
bridges, all those bridges may have the same MMIO window. That causes the
current static allocator not to consider that window being occupied because
of how it detects nested MMIO regions.

Remove duplicates in the list of secondary bus MMIO windows to fix that
issue.

Tracked-On: #8312
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-11-15 09:57:51 +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
Chenli Wei 25445eefe7 misc: fix the vCPU number issue of document
Current code use a invalid parameter to print the vCPU number, this
patch use the length of vCPU list to fix the above issue.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
2022-11-14 11:34:15 +08:00
Chenli Wei 174917726d misc: refine the calculate logic of hv_ram_size
The legacy logic use double IVSHMEM_SIZE to calculate the HV RAM, it can't
match the current code.

This patch use the IVSHMEM_SIZE size only.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
2022-11-14 10:41:49 +08:00
yuchuyang 504e49a567 config-tools: generate config_summary.rst
Generate config_summary.rst when saving scneario XML and launch scripts.

Tracked-On: #8300
Signed-off-by: yuchuyang <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-14 09:53:53 +08:00
yuchuyang 638567e425 config-tools: refine print out message after running board inspector
1. Generate success message when there is no critical error.
2. Generate note when there is error(s).

Tracked-On: #8297
Signed-off-by: yuchuyang <yu-chu.yang@intel.com>
2022-11-09 09:19:52 +08:00
hangliu1 808b4f6628 config tool: combine multiple xhci to one line
generate one line of parameter in launch scipt for
multiple xchi configs in scenario.xml.

Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Tracked-On: #6690
2022-11-08 10:43:29 +08:00
yuchuyang 089ea130a7 config-tools: fix virio GPU rendering issue
Fix the following issues:
1. <gpu> and <displays> elements are added to scenario XML when they are not configured.
2. Virtio GPU components disappears after switching to another tab and switching back to
   previous tab.
3. Wrong error message of vertical offset checking.

Improve the error check in virtio_devices.xsd:
1. Every window virtual display need to configure window resolution, horizontal offset
   and vertical offset.
2. Any display's elements need to be configured. The existing code
   only check the first window resolution, horizontal offset, vertical
   offset and monitor id.

Tracked-On: #8292
Signed-off-by: yuchuyang <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-08 09:45:54 +08:00
Junjie Mao 0cee1f8080 static_allocator: skip ACPI objects referring all functions of a PCI device
According to section 6.1.1, ACPI Spec 6.4, _ADR of a device object under
PCI/PCIe bus can use a special function number 0xFFFF to refer to all
functions of a certain device. Such objects will have their own nodes in
the board XML, and that causes build-time issues when a static allocator
attempts to get all BDFs occupied under the root bus because 0xFFFF is not
a valid function number (which ranges from 0 to 7).

This patch skips ACPI devices with such addresses when listing existing
BDFs.

Tracked-On: #8293
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-11-07 16:22:27 +08:00
Yuanyuan Zhao 4083da9470 config_tools: offline CPUs owned by User VMs
When launch a User VM own pCPUs, offline Service VM vCPUs which use
the same pCPUs by launch script.

Tracked-On: #8253
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-04 12:44:54 +08:00
Yuanyuan Zhao 138499f886 config_tools: add own_pcpu widget
Add "exclusively owns physical CPUs" checkbox to pre-launched VMs
and post-launched VMs. RTVM will not display this checkbox.
If this checkbox is set, the VM will use all the pCPUs assigned to
it alone.

Tracked-On: #8253
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-04 12:44:54 +08:00
Chenli Wei ea7e9540a0 misc: update ASRock board XML
This patch update the board.xml for ASRock.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
2022-11-04 12:14:50 +08:00
yuchuyang 3bb70efa12 config-tools: re-rendering the data after importing different board XML
Switch tag in order to trigger the component re-rendering after importing
different board XML.

Tracked-On: #8288
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-04 11:33:02 +08:00
hangliu1 0aa5ec5bda config tool:add debug mode limitation for PMU
In release mode, "GUEST_FLAG_PMU_PASSTHROUGH" is
not generated for specific VM.

Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
Tracked-On:#6690
2022-11-02 15:50:30 +08:00
zhangrouyu e5c1eafba3 doc: update changes to 22.04 on sample app guide
Tracked-On: #8269
Signed-off-by: zhangrouyu <rouyu.zhang@intel.com>
2022-11-01 09:56:07 +08:00
Yang,Yu-chu aada036ac6 config-tools: clean up the vm names which do not exist
Clean up vm_name of vuart and/or VM_NAME of IVSHMEM which is not defined in
//vm/name while loading scenario XML.

Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Rviewed-by: Junjie Mao <junjie.mao@intel.com>
Tracked-On: #8270
2022-10-28 11:17:46 +08:00
zhangrouyu 5a452e5e32 Create a requirements.txt for python package on GSG
Tracked-On: #8269
Signed-off-by: zhangrouyu <rouyu.zhang@intel.com>
2022-10-27 16:15:40 +08:00
Junjie Mao cdf7796a62 Makefile: clean up unnecessary phony targets
Phony targets are mostly for recipes that are expected to be invoked
directly from the command line as a target and will always be executed. As
a result, it is in most cases not appropriate for a real file target to to
depend on a phony one, as that means the file will always be regenerated.

In the Makefile today, however, dependencies on phony targets are common
and cause the hypervisor to be fully rebuilt regardless of whether an
existing build exists or not.

This patch cleans up the following phony targets which are not meant to be
targets from the command line.

  - pre_build: This target has three outputs, namely the prebuild checker,
    the ACPI tables for pre-launched VMs and the serial.conf. It is split
    into three targets, one for each output.

  - headers: This target is an alias of dynamically-generated header
    files. It is replaced with a variable so that targets depending on
    "header" now depends on the actual header files generated.

With this patch, make will only rebuild modified files and targets
depending on them directly or indirectly.

Tracked-On: #8259
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-10-26 14:09:44 +08:00
Kunhui-Li 7c18e26044 config_tools: add assertions for virtio gpu
1. In the full screen mode, a VM supports 4 virtual displays at most.
2. A vm supports 2 virtual windows at most.
3. The monitor ID cannot be duplicated in the full screen mode.
4. All the display elements are in DisplayConfiguration of VMType.xsd. It
cannot be set as required. Using assertions to check if the sub-elements
are set for any type of virtual display accordingly.
 - check if a display has been added and a display type is set.
 - check if monitor ID is set for full screen virtual display.
 - check if resolution and offsets are set for window virtual display.

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-26 08:15:17 +08:00
Kunhui-Li ad17268c5e config_tools: add virtio gpu widget
add virtio gpu widget for the new design.

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-26 08:15:17 +08:00
Kunhui-Li f165ff3b5a config_tools: update the upgrader.py script for virtio gpu
this patch updates the upgrader.py script for virtio gpu.

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-26 08:15:17 +08:00
Kunhui-Li 5554040dbb config_tools: refine virtio gpu in launch script
If display type is "Windows", the generated launch script will follow
the below rule.
"virtio-gpu,geometry=<width>x<height>+<x_off>+<y_off>,geometry=<width>x<height>+<x_off>+<y_off>"

If display type is "Full screen", the generated launch script look like
this. For example:
"virtio-gpu,geometry=fullscreen:0,geometry=fullscreen:1"

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-26 08:15:17 +08:00
Kunhui-Li 4f3a28d29f config_tools: refine virtio gpu device in the schema
this patch refines virtio gpu device in the schema for new design.

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-26 08:15:17 +08:00
Fei Li c76f26bdad life_mngr: permit life_mngr in windows to assign VM name
Permit life_mngr in windows to assign the VM name which configure
in scenario XML.

Tracked-On: #8051
Signed-off-by: Fei Li <fei1.li@intel.com>
2022-10-25 16:01:21 +08:00
Yuanyuan Zhao b5c70650cd config_tool: bdf of ioport serial port
Little fix: bdf format of inport serial port in board_inspector.

Tracked-On: #8235
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
2022-10-21 22:49:55 +08:00
TrellixVulnTeam a4f1a2f185 Adding tarfile member sanitization to extractall() 2022-10-20 14:58:52 +08:00
Yuanyuan Zhao b16aae48d0 config_tools: add pio serial port bdf to config.h
Add bdf info of pio serial port to config.h.

Tracked-On: #8235
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao junjie.mao@intel.com
2022-10-19 17:23:11 +08:00
Yuanyuan Zhao f9e16db9e1 config_tools: board_inspector: parse bdf for ioport serial controler
Add bdf infomation to ioport serial controler.

Tracked-On: #8235
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao junjie.mao@intel.com
2022-10-19 17:23:11 +08:00
Chenli Wei 7ae785a452 misc: refine the allocate logic of offline tool
The current code use VM number to calculate HV_RAM_SIZE, this is not
match the HV logic.

This patch use the max number of trusty VMs to calculate the size of
sworld memory and assume 4M ram / VM to calculate the final ACRN ram
size.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-19 15:58:25 +08:00
Junjie Mao dea357fa3b board-inspector: fix a branch condition that checks existence of HWP
Evaluating an XPATH on a tree results an empty list (rather than None) when
that tree does not contain any matching node. This patch fixes a branch
condition that does not check the XPATH evaluation result properly.

Tracked-On: #8168
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-10-14 15:56:43 +08:00
Junjie Mao 1c532da088 board_inspector: tolerate PCI functions with undefined header layout
While PCIe specification defines only type 0 and type 1 configuration space
headers, there can be cases where a PCI function has a different header
type. As an example, that device itself is under development or is a
special emulated device.

This patch makes the board inspector gracefully skips those PCIe functions
and continue scanning the rest in such cases, as the only impact of the
anomaly is the prevention of ACRN from passing through that PCIe function
to any VM. It is an overkill to crash the board inspector.

Tracked-On: #6689
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-10-14 15:56:43 +08:00
Junjie Mao 7ce49f8c3c config_tools: determine SSRAM_ENABLED automatically
Today users are able to tweak whether the hypervisor includes support to
software SRAM (SSRAM). This, however, gives rise to potential functional
incorrectness when the hypervisor is not built with such support but a
service VM attempts to assign SSRAM to a post-launched VM (which is
possible as the service VM can still see the SSRAM-related ACPI tables). In
such cases the SSRAM assigned to a post-launched VM is not properly
initialized and thus not locked in cache.

As makes little sense for a user to configure the SSRAM support in the
hypervisor in a different way as the presence of SSRAM on hardware, this
patch removes the "SSRAM support" option from the configurator. The config
tools will now automatically enable the SSRAM support if the hardware
supports the feature and disable that otherwise.

Tracked-On: #8231
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-10-14 15:20:48 +08:00
Yang,Yu-chu ce5b4435bc config-tools: add topology extract_display
This method gets connected displays andis add them as child nodes to
a corresponding graphics card.

Tracked-On: #7970
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-14 08:57:42 +08:00
Yang,Yu-chu b235e88f24 config-tools: add new extractors helpers
Add 2 helplers:
1. get_realpath: this method returns the realpath of paramenter
if it's a valid path string
2. get_bdf_from_realpath: this method returns the bus, device, function
number if the parameter is a path to /sys/devices

Tracked-On: #7970
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-10-14 08:57:42 +08:00
Chenli Wei 34e5061418 misc: modify hidden_pdev_list to fix build issue
This patch remove a invalid variable from hidden_pdev_list to fix an
build issue.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@intel.com>
2022-10-08 17:26:08 +08:00