Commit Graph

6274 Commits

Author SHA1 Message Date
Victor Sun
e5aa63b08e config_tools: update ehl-crb-b xml with new uart
The debug uart of mmio@0xfe042000 has been switched to pci uart at 0:19.2,
so change the board file accordingly.

Tracked-On: #6348

Signed-off-by: Victor Sun <victor.sun@intel.com>
2021-08-04 09:13:35 +08:00
Victor Sun
f5594a0ddc HV: debug: support 64bit BAR pci uart with 32bit space
Currently the HV console does not support PCI UART with 64bit BAR, but in the
case that the BAR is in 64bit and the BAR space is below 4GB (i.e. the high
32bit address of the 64bit BAR is zero), HV should be able to support it.

Tracked-On: #6334

Signed-off-by: Victor Sun <victor.sun@intel.com>
2021-08-02 16:49:37 +08:00
Yifan Liu
8cb18fb6fd hv: SMBIOS: add check before SMBIOS probing
The SMBIOS passthrough is supposed to work under UEFI environment.
Previous patches assumes UEFI environment but it may cause problems on
some platforms. This patch adds checking before probing SMBIOS table to
avoid this problem.

Tracked-On: #6345
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
2021-08-02 16:07:43 +08:00
Fei Li
89c25b008a hv: vpci: modify Interrupt Line Register as writable
According to PCIe Spec, for a RW register bits, If the optional feature
that is associated with the bits is not implemented, the bits are permitted
to be hardwired to 0b. However Zephyr would use INTx Line Register as writable
even this PCI device has no INTx, so emulate INTx Line Register as writable.

Tracked-On: #6330
Signed-off-by: Fei Li <fei1.li@intel.com>
2021-07-29 17:18:19 +08:00
Fei Li
9948dea338 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-07-29 15:52:56 +08:00
Tao Yuhong
2e5aa8be99 HV: MMIODEV: delete memory resource before add it to pre-launched VM
If mmio resource is included in ACPI DATA e820 entry, it is will be
mapped to RAM first. Then pre-launched VM can't map mmio resource GPA
to its MMIO HPA.

Tracked-On: #6320
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2021-07-28 13:54:22 +08:00
Junjie Mao
48c070c88e config_tools: adjust the end of TPM log area
The log area of TPM is typically placed as part of the ACPI data region in
e820. This patch follows this convention by adjusting how the virtual TPM
log area base address is allocated.

Tracked-On: #6320
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-28 13:52:12 +08:00
Kunhui-Li
2db0b235b7 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-28 13:50:16 +08:00
Yifan Liu
9fbef0df69 config-tools: Update tgl-rvp.xml
Update tgl-rvp.xml to latest version.

Tracked-On: #6320
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Yang,Yu-chu
dce3142cfc config-tools: refine bin_gen.py arguments and tpm2_acpi_gen
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-07-26 16:51:30 +08:00
Junjie Mao
7439ac1a92 board_inspector: extract Compatible IDs of devices
In addition to the mandatory _HID (Hardware ID), the ACPI spec also defines
an optional _CID (Compatible ID) object for device identification.

This patch enhances the ACPI extractor by parsing the _CID objects of devices as
well.

Tracked-On: #6320
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Yifan Liu
6030211122 hv: SMBIOS passthrough for prelaunched VM
This patch passthrough native SMBIOS information to prelaunched VM.
Currently this is enabled by default, the config-tool switch will be
added later.

Tracked-On: #6320
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
2021-07-26 16:51:30 +08:00
Yang,Yu-chu
796f11a064 config-tools: create virtual acpi of passthrough tpm2
Create virtual acpi table of tpm2 based on the raw data if the tpm2
device is presented and the passthrough tpm2 is enabled.

Tracked-On: #6320
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-07-26 16:51:30 +08:00
Yang,Yu-chu
2940b8a31e config-tools: generate the log area data of tpm2
Insert the passthrough tpm2 datas to mmiodevs of vm_configurations.c

Tracked-On: #6320
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-07-26 16:51:30 +08:00
Yang,Yu-chu
15fa9f95ca config-tools: allocae log area start address
If passthrugh TPM2 is enabled and the log area is present, allocates
the log_area_start_address with the size log_area_minimum_length(256K).

Tracked-On: #6320
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-07-26 16:51:30 +08:00
Yang,Yu-chu
40eaff9569 config-tools: add tpm2 acpi parser to board_inspector
Create python script tpm2 which parse the tpm2 acpi table datas. Add
this parsed data to the <device id="MSFT0101" description="TPM 2.0 Device"> of board.xml.

Tracked-On: #6320
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
3c707408ec board_inspector: check if BAR base is 0
It is seen occasionally that a memory/port BAR of a PCI device is
programmed with the address 0 which is clearly invalid. This patch
gracefully handles this case by printing an error to warn the users that
this device cannot be passed through to any VM.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
7f3016e678 board_inspector: fix scope opening in the AML parser
According to section 19 of ACPI spec 6.4, the following clauses open name
scopes (in addition to the Scope clauses).

  - Function
  - Device
  - Method
  - Power Resource
  - Thermal Zone

The current AML parser only opens a scope when parsing DefMethod and
DefDevice, however. This patch fixes the AML parsing by opening a scope on
visiting a DefPowerRes or DefThermalZone clause.

Note: Functions in ASL are equivalent to Methods at AML level.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
a65d162b15 board_inspector: fix unregisteration of conditionally disabled objects
The current ConditionallyUnregisterSymbolVisitor has the following two
issues.

  1. The visitor will crash when a DefIfElse node is not fully parsed due
     to failed deferred expansion.
  2. Nested DefIfElse of disabled blocks are still checked and one of its
     branch may still take effect.

This patch fixes those issues by checking the predicates of a DefIfElse
block only when conditionally_hidden is False and check existence of
TermList and DefElse clauses.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
631d628178 board_inspector: fix an opcode peek issue
When parsing a sequence of clauses, it is not necessary to peek an opcode
from the current stream unless that sequence starts with one. Peeking an
opcode is even an error when the actual clause is empty (e.g. as a
TermList).

This patch makes the SequenceFactory only peeking at the next opcode when
the grammar expects one.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
60da7d6bfd board_inspector: improve readability and performance of AML parser
This patch refines the AML parser to improve its readability and
performance in the following ways.

  1. A Tree object now has the parts of the corresponding object being
     member fields. As an example, a Tree with label `DefMethod` now has
     members `NameString`, `MethodFlags` and `TermList`.
  2. It is now possible to assign names each part of an object. The grammar
     is updated to assign different names to the parts with the same type
     in the same object.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
6e79479a0a board_inspector: always defer parsing of method bodies
The current ACPI AML parser can generate incorrect AST if a DSDT/SSDT
satisfies the following:

  1. The body of a method invokes a NameString that is defined later.
  2. Before the method that NameString is also defined but in an outer
     scope and with a different number of parameter.

Since method bodies hardly define any further symbol that is referenced
outside the method itself, this patch forces the parsing of method bodies
to be deferred to the second pass when all symbols have been declared.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
0395a8adf9 board_inspector: Access I/O registers on-demand and properly
The current implementation of I/O buffers have the following issues.

  1. I/O buffers are filled with values on creation. This may be fine for
     memory-mapped I/O regions, but could be a problem to port I/O regions
     and indexed I/O regions.

  2. While not commonly seen, it IS witnessed that some devices only allow
     its MMIO registers to be accessed with certain width. Accessing such
     registers with a larger width will not be handled by the device,
     causing SW to get all 1's rather than the actual values in these
     registers.

This patch resolves the issues above as follows. I/O buffers now do not
access any register on creation. Instead, the register is accessed only
upon requests. Also the access width of these registers are followed to
ensure that the registers are accessed properly.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
6f3bfa80b1 board_inspector: interpret DefDivide in DSDT/SSDT
DefDevide is now enountered when interpreting host DSDT/SSDT. This patch
implements the interpretation.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Junjie Mao
d333ae50d7 board_inspector: return from method call invocation on DefReturn
The current implementation of the AML interpreter continues interpreting a
method after meeting a DefReturn object, which is incorrect. This patch
fixes this issue.

Tracked-On: #6298
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-07-26 16:51:30 +08:00
Tao Yuhong
ab82f67cb9 HV: TPM: check tpm2 start method and event log
If TPM device is passthrough to pre-launched VM, need check its
start method and event log settings in native TPM2 ACPI table.
Because when connect different TPM devices, TPM start method can
change in native ACPI table. And event log address change in native
ACPI table is expected by BIOS updating. Need fixup pre-launched
VM's ACPI table and vm_config if they are misaligned with native
platform. We add acrn_vm_fixup() in prepare_vm(), where the acrn_vm
structure is not created. This is suitable for checking between
vm_config and HW real configurations, and try fixup for native ACPI
updating.

Tracked-On: #6320
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2021-07-26 16:51:30 +08:00
Tao Yuhong
5976c58792 DM: add mmio resource to acrn_mmiodev
The mmiores[3] is added in acrn_mmiodev, this is the DM land part of
the change.

Tracked-On: #6320
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2021-07-26 16:51:30 +08:00
Tao Yuhong
e3a55de27b HV: add mmiodev resource in acrn_mmiodev data structure
mmiodev can have more than one mmio resource, so mmiores[3] is embedded
into mmiodev

Tracked-On: #6320
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2021-07-26 16:51:30 +08:00
Victor Sun
c0fb538f07 HV: vm_load: build vrsdp after VM image loaded
The vRSDP region of pre-launched VM is located at 0xf2400, it could be
overlapped with the memory space of the raw image so be overriden by
raw image loading. In this case VM would be failed to find ACPI table.
This patch fix this issue by loading raw image first and then building
vRSDP later.

Tracked-On: #6305

Signed-off-by: Victor Sun <victor.sun@intel.com>
2021-07-16 20:41:54 +08:00
David B. Kinder
02350da926 doc: update known issues in 2.5 release notes
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2021-06-28 18:37:14 -07:00
wenlingz
2b913c39e6 version:v2.5
Signed-off-by: wenlingz <wenling.zhang@intel.com>
2021-06-25 14:11:51 +08:00
David B. Kinder
cd4dc73ca5 doc: push doc updates for v2.5 release
Cumulative changes to docs since the release_2.5 branch was made

Tracked-On: #5692

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2021-06-24 21:19:05 -07:00
Kunhui-Li
7e9d625425 config_tools: remove nuc11tnbi5 scenario xml except industry.xml
Remove hybrid.xml, hybrid_rt.xml, logical_partition.xml and
industry_launch_2uos.xml files because validation team found
that these scenario files not working. And these documents will be
resubmitted after them are verified successfully.

Tracked-On: #6244

Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-06-24 14:43:08 +08:00
Kunhui-Li
25fa3466c5 config_tools: modify README file
1. Update python script name that is executed to generate board xml file
from run.py to cli.py in README file.
2. Update the OS requirement under native Linux in
misc/config_tools/board_inspector/README file.

Tracked-On: #6134
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-06-17 10:31:11 +08:00
Victor Sun
9aff6b1fbd config_tools: Revert "update scenario xml" for MAX_MSIX_TABLE_NUM
This reverts commit 24af7f8f9d which leaves
MAX_MSIX_TABLE_NUM item as empty for most of platforms except ehl-crb-b and
expect config tool to calculate a correct MAX_MSIX_TABLE_NUM for hypervisor
use. Unfortunately current config tool just calculate maximum native MSIX
number without evaluating the maximum MSI vectors that ACRN needed for vMSIX
emulation, thus introduce big risk on the device vMSIX table initialization.

If customer has special device that need larger MAX_MSIX_TABLE_NUM to enable
ACRN, he can input the number in his own scenario file.

Tracked-On: #6186

Signed-off-by: Victor Sun <victor.sun@intel.com>
2021-06-17 10:23:32 +08:00
Victor Sun
0321f6c4bc HV: remove unused multiboot.h
The multiboot.h has not been deleted in commit of "HV: modularization:
rename multiboot.h to boot.h" by mistake when do rebase, remove it.

Tracked-On: #5661

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-06-11 16:43:13 +08:00
Long Liu
8d81914350 ACRN: DM: Free the console in the unify API
Use the teardown API as the unify free console API in virtio console,
in case the console have already been freed by deinit when the teardwon
API is called.

Tracked-On: #6157
Signed-off-by: Liu Long <long.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-06-11 16:05:49 +08:00
Kunhui-Li
24af7f8f9d config_tools: update scenario xml
1. Update the value of the tag MAX_MSIX_TABLE_NUM from 64 to empty
for all scenario xml except ehl-crb-b board.
2. Update the value of the tag MAX_MSIX_TABLE_NUM to 96 for the
scenario xml on the ehl-crb-b board.

Tracked-On: #6186

Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-06-11 14:30:52 +08:00
Kunhui-Li
d63083a285 config_tools: update scenario xml
Update the value of the tag MAX_PT_IRQ_ENTRIES from 64 to 128
in TGL-RVP scenario xml.

Tracked-On: #6185

Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-06-11 14:30:52 +08:00
Kunhui-Li
814419beb8 config_tools: update clang-format file
Remove the AlwaysBreakTemplateDeclarations setting in clang-format file
to fix the issue about "make defconfig".

Tracked-On: #6199

Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-06-11 13:40:58 +08:00
Yang,Yu-chu
5bec1e8b1d config-tools: allocate the first unused bar for vmsix
A vmsix supported passthrough device expects the first unused bar region
for vmsix. Pop the first unused_bar_index in gpa.py instead.

Reference code: init_vmsix_on_msi of hypervisor\dm\vpci\vmsix_on_msi.c

Tracked-On: #6192
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-06-11 10:31:38 +08:00
Rong Liu
d33a8afc75 dm: get native rootport's max payload
Get and save native root port's max payload in dev cap register in
vrp_config data structure which will be used to configure vrp's max
payload by hv.

Tracked-On: #5915

Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-06-11 10:13:06 +08:00
Rong Liu
a302dca80b hv: add max payload to vrp
It seems important that passthru device's max payload settings match
the settings on the native device otherwise passthru device may not work.
So we have to set vrp's max payload capacity as native root port
otherwise we may accidentally change passthru device's max payload
since during guest OS's pci device enumeration, pass-thru device will
renegotiate its max payload's setting with vrp.

Tracked-On: #5915

Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-06-11 10:13:06 +08:00
Jie Deng
dba49b38df hv: add bitmap_clear_lock of split-lock after completing emulation
Suppose the current vcpu is 0, the other vcpus (1, 2, 3) may wait on the
"get_split_lock", the current vcpu need clear the ACRN_REQUEST_SPLIT_LOCK
explicitly here after finishing the emulation. Otherwise, it make cause
dead lock. for example:
	1. Once vcpu 0 "put_split_lock", let's say vcpu 1 will "get_split_lock".
	2. vcpu 1 call "vcpu_make_request" to pause vcpu 0, 2, 3.
	3. vcpu 1's VCPU_EVENT_SPLIT_LOCK is still not cleared because
	   the vcpu 0 called "vcpu_make_request" ever.
	4. All vcpus will wait for VCPU_EVENT_SPLIT_LOCK in acrn_handle_pending_request.
We should avoid this dead lock case.

Please note: this patch is only for release 2.5 test.

Tracked-On: #6051
Signed-off-by: Jie Deng <jie.deng@intel.com>
2021-06-10 13:00:15 +08:00
Jie Deng
070385c4f6 hv: using a dedicate lock
On the original WaaG, split-lock was rarely triggered by WaaG kernel.
We didn't find any problems when removing this patch. So this patch
was discarded in the final patch set merge.

Now, the latest Windows graphic driver will trigger lots of
split-lock very frequently. The test team reports this patch will
affect the stability.

Add this patch back to improve stability by using a dedicate lock.

Please note: This patch is only for release 2.5 test.

Tracked-On: #6051
Signed-off-by: Jie Deng <jie.deng@intel.com>
2021-06-10 13:00:15 +08:00
Shuang Zheng
1e478fc6a9 config_tools: add hybrid, hybrid_rt, logical partition scenario on adl board
add hybrid, hybrid_rt, logical_partition scenario and add launch
config xml on adl-s-crb board, add launch config xml on adl-rvp board.

Tracked-On: #5929
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
2021-06-10 11:00:32 +08:00
Kunhui-Li
d4b5db93e4 config_tools: clean up the board folders
1. Remove apl-up2, apl-up2-n3350, apl-mrb, nuc6cayh board
   folders from the latest code base.
2. Copy tgl-rvp.xml to generic_board.xml.

Tracked-On: #6175

Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
2021-06-10 09:54:25 +08:00
Shuo A Liu
bef6dbc238 hv: WA ACRN-6886: Interrupt the target CPU and let it do PI with VMENTRY
Tracked-On: #5866
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
2021-06-09 17:07:37 +08:00
Yonghua Huang
59635fb984 dm: fix memory leakage risk in create_and_inject_vrtct
Reading native RTCT failure induces leakage of
 memory pointered by 'buf'.

Tracked-On: #6157
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2021-06-09 13:37:22 +08:00
Yonghua Huang
cb59ac1cfe dm: remove redundant null check in unregister_mem_init
return value 'err' of mmio_rb_lookup() being 0 ensures
  'entry' is not NULL, hence checking it before 'free(entry)'
  is unnecessary.

Tracked-On: #6157
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2021-06-09 10:41:03 +08:00