Commit Graph

6115 Commits

Author SHA1 Message Date
Helmut Buchsbaum e88955392f Makefile: lifemngr: split linux and windows build
* Split linux and windows build of lifemngr to be able to build
  them independently.
* Install life_mngr.service
* Avoid the following Makefile error output by explicitly checking
  Windows cross compiler availability:

make[4]: x86_64-w64-mingw32-gcc: Command not found
make[4]: [Makefile:47: all-win] Error 127 (ignored)

Tracked-On: #5660
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
2021-05-20 10:02:33 +08:00
Helmut Buchsbaum b673bc36b1 Makefile: honor BUILD_VERSION and BUILD_TAG
Use BUILD_VERSION an BUILD_TAG variable also for hypervisor,
acrnprobe and crashlog. This eases build from an archive without
git available.

Tracked-On: #6035
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
2021-05-20 10:02:33 +08:00
Helmut Buchsbaum 596f27bad3 Makefile: Make builds reproducible
Make builds reproducible by honoring SOURCE_DATE_EPOCH and USER
environment variables in the respective Makefiles. Just follow the
recommendations at https://reproducible-builds.org/

Build tools (e.g. Debian packaging, Yocto) use this to ensure reproducibility
of packages.

Tracked-On: #6035
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
2021-05-20 10:02:33 +08:00
Rong Liu 3db4491e1c hv: PTM: Create virtual root port
Create virtual root port through add_vdev hypercall. add_vdev
identifies the virtual device to add by its vendor id and device id, then
call the corresponding function to create virtual device.

	-create_vrp(): Find the right virtual root port to create
by its secondary bus number, then initialize the virtual root port.
And finally initialize PTM related configurations.

	-destroy_vrp(): nothing to destroy

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Jason Chen <jason.cj.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu d57bf51c89 hv: PTM: Add virtual root port
Add virtual root port that supports the most basic pci-e bridge and root port operations.

	- init_vroot_port(): init vroot_port's basic registers.

	- deinit_vroot_port(): reset vroot_port

	- read_vroot_port_cfg(): read from vroot_port's virtual config space.

	- write_vroot_port_cfg(): write to vroot_port's virtual config space.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Jason Chen <jason.cj.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu df64877c50 dm: PTM: Check PTM root has more than one child
Add one more sanity check: If the root port has more than
	one child, we won't enable PTM on the guest.
	This is not necessarily an error.  We flag it as
	error just because we don't have this type of hw
	configuration at development time thus this configuration
	is not tested.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu 721c866d63 dm: PTM: Enable ptm on passthru device
If user sets enable_ptm option on passthru device, passthru device
	calls ptm_probe() to check and enable ptm on passthru device.  If error
	is found during sanity check, ptm will not be enabled in the guest
	and an error will be reported to user.  However, this doesn't
	prevent user from launching guest and passing through the device to the guest.
	If no error is found, PTM is enabled in the guest and the
	passthru device will connect to virtual root port (which acts as PTM
	root) instead of virtual host bridge.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu 7e93f31e2c dm: PTM: Add virtual root port to vm
If PTM can be enabled on passthru device, a virtual root port
	is added to vm to act as ptm root.  And the passthru device is
	connected to the virtual root port instead of the virtual host bridge.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu d5d792aa96 dm: PTM: Check if hw supports ptm
This patch probes whether hw supports ptm.  It is used to check whether ptm
	can be enabled on the passthru pci device.  It checks whether passthru
	device support PTM requestor capability, then check whether its upstream
	root port support PTM root role.  Errors are reported to user if sanity
	check fails.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu a7b0d9848f dm: PTM: Get # of children of a pci bridge or pci bus
Add functionality to build and cache pci hierarchy, which are mainly
    used to retrieve # of children of pci bridge or pci bus.

    get_device_count_on_bus(): get # of child devices on a pci bus
    get_device_count_on_bridge(): recursively get # of child devices on a pci bridge
    scan_pci(): build and cache pci hierarchy
    pci_find_root_port(): find root port of a pci device
    clean_pci_cache(): free pci cache
    scan_pci_test(): test of scan pci hierarchy (disabled)

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu d3185f8a0c dm: PTM: Add a few pci utility functions
Add a few pci utility functions to help easy access of pci
    functionalities.
    1. pci_find_capability(): find position of specified pci capability register
    2. pci_find_ext_cap(): find extend capability register position from cap_id
    3. pci_pcie_type(): find pci-e device type
    4. is_root_port(): check whether pdev is a pci root port
    5. is_bridge(): check whether pdev is a bridge

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Yin Fengwei 1e033f9d89 build: fix dm and acrn_crashlog build error with gcc-11
Unify two functions definitions/declarifications:
  Update the parameters from char array to char pointer.
to fix the build issue:
  probeutils.c:61:29: error: argument 1 of type 'char *' declared
  as a pointer [-Werror=array-parameter=]

Initialize local variable "c" to fix build issue:
  core/mevent.c:122:21: error: 'c' may be used uninitialized
  [-Werror=maybe-uninitialized]

Tracked-On: #5993
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2021-05-19 11:38:18 +08:00
Junjie Mao 54fc26875e config_tools: update board XMLs of ehl-crb-b and tgl-rvp
This patch applies the latest board inspector on ehl-crb-b and tgl-rvp to
generate additional information to the board XMLs.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-19 09:10:46 +08:00
Junjie Mao 99f15a27c2 board_inspector/acpiparser: enable parsing RTCT v2
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>
2021-05-19 08:53:38 +08:00
Benjamin Fitch c0fef0b1fb doc: editing in using_serial_port.rst
Signed-off-by: Benjamin Fitch <benjamin.fitch@intel.com>
2021-05-18 15:49:33 -07:00
fuzhongl d8443bedb0 Doc: update using serial port
Add PCIe serial port enabling part on NUC; which doesn't
have the internal serial console header.

Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
2021-05-18 11:38:56 -07:00
Liang Yi 6805510d77 hv/mod_timer: refine timer interface
1. do not allow external modules to touch internal field of a timer.
2. make timer mode internal, period_in_ticks will decide the mode.

API wise:
1. the "mode" parameter was taken out of initialize_timer().
2. a new function update_timer() was added to update the timeout and
   period fields.
3. the timer_expired() function was extended with an output parameter
   to return the remaining cycles before expiration.

Also, the "fire_tsc" field name of hv_timer was renamed to "timeout".
With the new API, however, this change should not concern user code.

Tracked-On: #5920

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-05-18 16:43:28 +08:00
Liang Yi 3547c9cd23 hv/mod_timer: make timer into an arch-independent module
x86/timer.[ch] was moved to the common directory largely unchanged.

x86 specific code now resides in x86/tsc_deadline_timer.c and its
interface was defined in hw/hw_timer.h. The interface defines two
functions: init_hw_timer() and set_hw_timeout() that provides HW
specific initialization and timer interrupt source.

Other than these two functions, the timer module is largely arch
agnostic.

Tracked-On: #5920
Signed-off-by: Rong Liu <rong2.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-05-18 16:43:28 +08:00
Liang Yi 51204a8d11 hv/mod_timer: separate delay functions from the timer module
Modules that use udelay() should include "delay.h" explicitly.

Tracked-On: #5920
Signed-off-by: Rong Liu <rong2.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2021-05-18 16:43:28 +08:00
Liang Yi 5a2b89b0a4 hv/mod_timer: split tsc handling code from timer.
Generalize and split basic cpu cycle/tick routines from x86/timer:
- Instead of rdstc(), use cpu_ticks() in generic code.
- Instead of get_tsc_khz(), use cpu_tickrate() in generic code.
- Include "common/ticks.h" instead of "x86/timer.h" in generic code.
- CYCLES_PER_MS is renamed to TICKS_PER_MS.

The x86 specific API rdstc() and get_tsc_khz(), as well as TSC_PER_MS
are still available in arch/x86/tsc.h but only for x86 specific usage.

Tracked-On: #5920
Signed-off-by: Rong Liu <rong2.liu@intel.com>
Signed-off-by: Yi Liang <yi.liang@intel.com>
2021-05-18 16:43:28 +08:00
Tao Yuhong c2df3f7940 DM: mmio dev: remove hard code device index
mmio_devs[0] is hard code for acpidev_pt, and mmio_devs[1] for
mmiodev_pt. Use mmio_dev_idx as index of mmio_devs[], to remove hard
code.
Remove hpa, gpa, size information from mmio_dev_ops, add acrn_mmiodev into
mmio_dev, to record hpa, gpa and size information for each passthough
mmio device.

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-05-18 15:49:30 +08:00
Tao Yuhong 12f5a78800 DM: mmio dev: allocate GPA resource for mmio device
The mmio devices use hard code GPA base, allocating GPA base resource
for them instead.

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-05-18 15:49:30 +08:00
Tao Yuhong 63dd23bc9e DM: TPM: Do not set VTPM and passthough TPM simultaneously
The TPM information in ACPI table is for both VPTM and passthough TPM,
so only one TPM device is allowed.

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-05-18 15:49:30 +08:00
Tao Yuhong cb8a6a7514 DM: tpm: remove fixed value TPM_CRB_MMIO_ADDR
The GPA of TPM device has fixed value TPM_CRB_MMIO_ADDR, remove
TPM_CRB_MMIO_ADDR and allocate GPA base for TPM device

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-05-18 15:49:30 +08:00
Tao Yuhong f1c2eca1dc DM: support mmio dev gpa resource allocation
The ACPI MMIO devices, like TPM, has a fixed base GPA. Sould support
GPA resource allocating for MMIO devices. GPA region
0xF0000000~0xFE000000 is not used, can allocate GPA from it.

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-05-18 15:49:30 +08:00
Tao Yuhong 606704eff6 DM: Fix deinit_mmio_devs() conflicting type
There is "void deinit_mmio_devs()" in ./devicemodel/hw/mmio/core.c,
but "int deinit_mmio_devs()" in ./devicemodel/include/mmio_dev.h

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2021-05-18 15:49:30 +08:00
Zide Chen 440ee23878 config-tools: guest_flag must be assigned with a valid value
commit 873ed752d ("misc: sanity check VM config for nested virtualization")
requires that the guest_flag tag can't be empty, or it will fail to build.

This patch changes all instances of "<guest_flag></guest_flag>"
to "<guest_flag>0</guest_flag>".

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
2021-05-18 13:44:54 +08:00
Yonghua Huang 00b3a28d5d hv: update RTCT parser to support RTCT version 2
RTCT has been updated to version 2,
  this patch updates hypervisor RTCT parser to support
  both version 1 and version 2 of RTCT.

Tracked-On: #6020
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Jason CJ Chen <jason.cj.chen@intel.com>
2021-05-17 17:19:11 +08:00
Yonghua Huang daccad241f dm: fix minor comment in acrn_create_e820_table
'pSRAM' is legacy name and replaced with 'SSRAM'

Tracked-On: #6015
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2021-05-17 15:34:57 +08:00
Yonghua Huang 32d6a72ea2 doc: clean legacy software SRAM names
psram is legacy name of SSRAM, rename it to ssram

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2021-05-17 15:34:57 +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
Zide Chen c9982e8c7e hv: nested: setup emulated VMX MSRs
We emulated these MSRs:

- MSR_IA32_VMX_PINBASED_CTLS
- MSR_IA32_VMX_PROCBASED_CTLS
- MSR_IA32_VMX_PROCBASED_CTLS2
- MSR_IA32_VMX_EXIT_CTLS
- MSR_IA32_VMX_ENTRY_CTLS
- MSR_IA32_VMX_BASIC: emulate VMCS revision ID, etc.
- MSR_IA32_VMX_MISC

For the following MSRs, we pass through the physical value to L1 guests:

- MSR_IA32_VMX_EPT_VPID_CAP
- MSR_IA32_VMX_VMCS_ENUM
- MSR_IA32_VMX_CR0_FIXED0
- MSR_IA32_VMX_CR0_FIXED1
- MSR_IA32_VMX_CR4_FIXED0
- MSR_IA32_VMX_CR4_FIXED1

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-16 19:05:21 +08:00
Zide Chen 4930992118 hv: nested: implement the framework for VMX MSR emulation
Define LIST_OF_VMX_MSRS which includes a list of MSRs that are visible to
L1 guests if nested virtualization is enabled.
- If CONFIG_NVMX_ENABLED is set, these MSRs are included in
  emulated_guest_msrs[].
- otherwise, they are included in unsupported_msrs[].

In this way we can take advantage of the existing infrastructure to
emulate these MSRs.

Tracked-On: #5923
Spick igned-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-16 19:05:21 +08:00
Zide Chen 97df220f49 hv: vmsr: emulate IA32_FEATURE_CONTORL MSR for nested virtualization
In order to support nested virtualization, need to expose the "Enable VMX
outside SMX operation" bit to L1 hypervisor.

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-16 19:05:21 +08:00
Junjie Mao 6ba4ac58cd config_tools/schema: add example data checks
This patch introduces the XML schema `datachecks.xsd` which is the central
place to specify and check assumptions on board characteristics and
scenario settings. Each assumption is expressed as an XSD assertion with
annotation of error severity (e.g. info, warning or error) and detailed
descriptions.

At compile time, the board and scenario XMLs are combined (by putting the
children of the root node together) can checked against the
schema. Assertion failures are categorized according to the defined
severity. Currently only errors will block compilation by outputing the
descriptions of the violated assertions.

The objective of this patch is the introduce the framework to document,
manage and check assumptions. A better way to present assumption violations
to end users (either on the command line or in the configuration editor) is
out of the scope of this series and will be considered in the future.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 0aa899271d board_inspector/extractors: extract device information
This patch extracts information on devices and put them under the
`/acrn-config/devices` node in the board XML.

The generated XML looks like the following:

  <devices>
    <bus type="system">
      <acpi_object>\_SB_</acpi_object>
      <bus id="PNP0A08" type="pci" address="0x0" description="...">
        <vendor>0x8086</vendor>
        <identifier>0x591f</identifier>
        <subsystem_vendor>0x1028</subsystem_vendor>
        <subsystem_identifier>0x07a1</subsystem_identifier>
        <class>0x060000</class>
        <acpi_object>\_SB_.PCI0</acpi_object>
        <resource type="bus_number" min="0x0" max="0x3e" len="0x3f"/>
        <resource type="io_port" min="0x0" max="0xcf7" len="0xcf8"/>
        <resource type="io_port" min="0xcf8" max="0xcf8" len="0x8"/>
        <resource type="io_port" min="0xd00" max="0xffff" len="0xf300"/>
        <resource type="memory" min="0x10000" max="0x1ffff" len="0x0"/>
        <resource type="memory" min="0xa0000" max="0xbffff" len="0x20000"/>
        <resource type="memory" min="0xc0000" max="0xc3fff" len="0x4000"/>
        <resource type="memory" min="0xc4000" max="0xc7fff" len="0x4000"/>
        ...
        <capability id="vendor_specific"/>
        <device address="0x1"> ... </device>
        ...
      <bus>
    <bus>
    <device> ... <device>
  <devices>

The hierarchy of devices are based on the hierarchy of device objects in
the ACPI namespace (which is established by interpreting the ACPI DSDT and
SSDT tables). Typically most device objects are under the predefined
`_SB_` (i.e. System Bus) object under which an object representing the PCI
root complex (`\_SB_.PCI0` in the example above) can be found. The PCI
devices attached to bus 0 are listed as children of the PCI root complex
node.

For each bus or device, the board inspector tries best to parse the
information from both ACPI device objects and PCI configuration space to
extract the following:

- the model (via `_HID` object and PCI vendor ID, device ID and class code),
- assigned resources (via `_CRS` object and PCI BARs),
- capabilities (via the PCI capability list)

v1 -> v2:
 - Fix references to undeclared modules or variables.
 - Make the ACPI extractor advanced and not enabled by default.
 - Extract the secondary I/O and memory-mapped I/O addresses of bridges.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 52ee5827e1 board_inspector/extractors: extract memory layout
This patch extracts information on mapping of available RAM and put them
under the `/acrn-config/memory` node in the board XML. Each range of
available RAM is represented by its start (host physical) address, end
address and size (in byte).

The following is an example of the generated XML.

  <memory>
    <range start="0x0000000000000000" end="0x0000000000057fff" size="360448"/>
    <range start="0x0000000000059000" end="0x000000000009dfff" size="282624"/>
    <range start="0x0000000000100000" end="0x00000000c9ff9fff"
    size="3387924480"/>
    <range start="0x00000000c9ffc000" end="0x00000000d984afff"
    size="260370432"/>
    <range start="0x00000000dbdff000" end="0x00000000dbdfffff" size="4096"/>
    <range start="0x0000000100000000" end="0x000000041dffffff"
    size="13388218368"/>
  </memory>

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao ffe213359c board_inspector/extractors: extract cache topology and capabilities
This patch extracts information on cache topology and capabilities and put
them under the `/acrn-config/caches` node in the board XML in the following
manner.

  <caches>
    <cache level="1" id="0x0" type="1">
      <cache_size>32768</cache_size>
      <line_size>64</line_size>
      <ways>8</ways>
      <sets>64</sets>
      <partitions>1</partitions>
      <self_initializing>1</self_initializing>
      <fully_associative>0</fully_associative>
      <write_back_invalidate>0</write_back_invalidate>
      <cache_inclusiveness>0</cache_inclusiveness>
      <complex_cache_indexing>0</complex_cache_indexing>
      <processors>
        <processor>0x0</processor>
        <processor>0x1</processor>
      </processors>
    </cache>
    <cache level="1" id="0x0" type="2"> ... </cache>
    <cache level="1" id="0x1" type="1"> ... </cache>
    <cache level="1" id="0x1" type="2"> ... </cache>
    ...
    <cache level="2" id="0x0" type="3"> ... </cache>
    <cache level="2" id="0x1" type="3"> ... </cache>
    ...
    <cache level="3" id="0x0" type="3"> ... </cache>
  </caches>

Each cache block is represented by a separate `cache` node identified by
its level, cache ID and type (as reported by CPUID). More information, such
as the size, characteristics and capabilities, are attached as children of
the node.

The current implementation fetches cache information solely from the CPUID
leaf 4H. In the future more cache-related information, such as those in the
ACPI RTCT tables, will be appended here.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 3e3120d342 board_inspector/extractors: extract CPU topology and models
This patch extracts information on CPU topology and capability and put them
under the `/acrn-config/processors` node in the board XML.

The added information can be divided into two categories.

1. The topology of CPUs like the following. Each thread (which is a leaf
   node in the topology) contains its addresses (i.e. CPU ID, APIC ID,
   x2APIC ID) and model identifiers (i.e. family, model, stepping IDs, core
   types and native model ID).

    <die id="0">
      <core id="0x0">
        <thread id="0x0">
          <cpu_id>0</cpu_id>
          <apic_id>0x0</apic_id>
          <x2apic_id>0x0</x2apic_id>
          <family_id>0x6</family_id>
          <model_id>0x9e</model_id>
          <stepping_id>0x9</stepping_id>
          <core_type></core_type>
          <native_model_id></native_model_id>
	</thread>
        <thread id="0x1"> ... </thread>
      </core>
      <core id="0x1">
        <thread id="0x2"> ... </thread>
        <thread id="0x3"> ... </thread>
      </core>
      <core id="0x2">
        <thread id="0x4"> ... </thread>
        <thread id="0x5"> ... </thread>
      </core>
      <core id="0x3">
        <thread id="0x6"> ... </thread>
        <thread id="0x7"> ... </thread>
      </core>
    </die>

2. The CPU models identified by the quadruple (family_id, model_id,
   core_type, native_model_id). Each model is described by its brandstring
   and capabilities, both of which are fetched from CPUID leaves.

    <model description="Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz">
      <family_id>0x6</family_id>
      <model_id>0x9e</model_id>
      <core_type></core_type>
      <native_model_id></native_model_id>
      <capability id="sse3"/>
      <capability id="pclmulqdq"/>
      <capability id="dtes64"/>
      <capability id="monitor"/>
      ...
    </model>

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 4d3a765708 board_inspector/extractors: framework to support extractors
This patch makes the `run.py` enumerate and invoke all extractors (whose
name should be `##-<name>.py` where `##` is a decimal number for ordering)
under the extractors/ directory. Only some helper subroutines are added in
this patch; the actual extractors will be added in the subsequent patches
in this series.

v1 -> v2:
 - Allow an extractor to be classified as advanced by defining the variable
   `advanced` to True. Advanced extractors are not enabled by default and
   can be invoked by passing `--advanced` to the board inspector.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao b3921137c2 board_inspector/smbiosparser: add SMBIOS table parsers
This patch adds a parser of SMBIOS tables. The tables are fetched from
/sys/firmware/dmi/tables on target board. The parser comes from
BITS (https://biosbits.org/) without modifications, except how the raw
SMBIOS tables are read.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 3a395bb342 board_inspector/pcieparser: add PCIe config space parser
This patch adds a parser of PCI-compatible configuration space read from
sysfs. The headers and capability lists are fully parsed, but only a couple
of capabilities are parsed completely. Parsing of additional capabilities
will be added on an on-demand basis.

v1 -> v2:
 - Fix a typo that causes incorrect parsing of BAR types
 - Parse capability structures using from_buffer_copy instead of
   from_address

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 0215603812 board_inspector/acpiparser: add DSDT/SSDT parser
This patch adds a parser and interpreter of ACPI DSDT/SSDT tables in
AML (ACPI Machine Language) in order to understand the complete device
layout and resource allocation.

Kindly note that the interpreter is still experimental and not yet
complete.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 6276e5759a board_inspector/memmapparser: add parser of e820 memory maps
This patch adds a parser of the physical E820 memory maps fetched from
/sys/firmware/memmap.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 598be99dc2 board_inspector/cpuparser: add CPUID parsers
This patch adds a parser of CPU identification information reported by the
CPUID instruction.

The framework is based on the CPUID parsing facilities in
BITS (https://biosbits.org/), but with the following changes.

1. The CPUID data is fetched by executing the `cpuid` utility, rather than
   executing the `cpuid` instruction. This avoids introducing any
   additional library or Python/C extension and gets a CPUID leaf on all
   physical cores in one shot.

2. Parsers of CPUID leaves 0x10, 0x1A and 0x1F are added. New fields in
   existing leaves are also added.

3. A wrapper function, named `parse_cpuid`, is added as the single API that
   allows other modules to get an arbitrary CPUID leaf or subleaf.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao 05c738a480 board_inspector/lib: fix compatibility issues in unpack.py
Starting from Python 3.0 the following changes to the language are
effective:

1. The integer types `int` and `long` have been unified as `int`. See
   `https://www.python.org/dev/peps/pep-0237/` for details.
2. The `.iterkeys` method is removed from the `dict` class. See
   `https://www.python.org/dev/peps/pep-3106/` for details.

This patch updates `unpack.py`, originally from BITS, so that it can be
used in Python 3.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao e6e61a4979 board_inspector/legacy: fix a copy destination error
Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Junjie Mao bd4ddbd31d board-inspector: reorganize the scripts
This patch reorganize the files of the board inspector as follows.

1. Rename the directory name from `target` to `board_inspector`, in order to
   align with the name used in ACRN documentation.
2. Move the scripts that generate the current board XML into the `legacy`
   sub-directory. The legacy nodes will be removed after transitioning to the
   new board XML schema completely,
3. Add the main script `cli.py` which is the command line interface of the board
   inspector.

v1 -> v2:
 - Rename `run.py` to `cli.py`.

Tracked-On: #5922
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2021-05-16 19:02:00 +08:00
Yonghua Huang 9c79e2ebdc dm: clean legacy software SRAM names
Remove below legacy SSRAM names:

  psram -> ssram
  ptct -> rtct

Tracked-On: #6015
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2021-05-16 10:08:48 +08:00
Yonghua Huang e9870893a3 hv: rename some software SRAM local names
For simplification purpose, use 'ssram' instead of
 'software sram' for local names inside rtcm module.

Tracked-On: #6015
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-16 10:08:17 +08:00