Commit Graph

5524 Commits

Author SHA1 Message Date
dongshen 01c66eb4b3 acrn-config: add support for P2SB bridge passthrough
This patch is to support direct assignment of P2SB bridge to one pre-launched
VM for EHL. User can configure this per-VM attribute in scenario xml:
    <mmio_resources desc="MMIO resources.">
         <p2sb>y</p2sb>
    </mmio_resources>

Set p2sb to y to passthru P2SB bridge to VM, and n otherwise.

Tracked-On: #5221
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-09-01 09:35:50 +08:00
dongshen 10d4773f1d hv: add a new field pt_p2sb_bar to struct acrn_vm_config
On EHL platform, we need to pass through P2SB bridge to pre-launched VM.
Use pt_p2sb_bar to indicate whether to passthru p2sb bridge to pre-launched VM
or not.

Tracked-On: #5221
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-09-01 09:35:50 +08:00
dongshen 678d8c1665 acrn-config: fix build issue for mrb board
Add missing IVSHMEM tag in mrb board xml file to fix build issue

Correct misspelled function name

Use better error messages

Tracked-On: #5221
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-09-01 09:35:50 +08:00
Shuang Zheng 58a71b67ab acrn-config: make HV_RAM_SIZE include IVSHMEM_SHM_SIZE
Because ivshmem memory uses hv memory, if the ivshmem feature is
enabled, HV_RAM_SIZE will include IVSHMEM_SHM_SIZE.

Tracked-On: #4853

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-09-01 09:35:16 +08:00
Yonghua Huang 07ed6841f5 dm:Remove deprecated terms
- remove usages of maste/slave:

Tracked-On: #5249
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2020-09-01 09:30:08 +08:00
Yonghua Huang c03623f3fb hv[v2]: Remove deprecated term in vPIC submodule
This patch cleanup below deprecated terms:
  'master' -> 'primary'
  'slave'  -> 'secondary'

v2 update:
      Refine comments.

Tracked-On: #5249
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2020-09-01 09:30:08 +08:00
Stanley Chang d55813e80b hv: passthru DHRD-ignored device
When trying to passthru a DHRD-ignored PCI device,
iommu_attach_device shall report success. Otherwise,
the assign_vdev_pt_iommu_domain will result in HV panic.
Same for iommu_detach_device case.

Tracked-On: #5240
Signed-off-by: Stanley Chang <stanley.chang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-09-01 09:29:25 +08:00
Nishioka, Toshiki 57ce23034c acrn-config: add hybrid_rt scenario xml config for ehl-crb-b
add hybrid_rt scenario for the ElkhartLake CRB board so that user can
launch Yocto Linux as pre-launched VM.

Tracked-On: #5238

Signed-off-by: "Nishioka, Toshiki" <toshiki.nishioka@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-09-01 09:01:52 +08:00
Shuo A Liu 902ed60806 hv: Restrain several hypercalls which may impact target VM
Some hypercalls to a target VM are only acceptable in some certain
states, else it impacts target VM. Add some restrictive status checks to
avoid that.

Tracked-On: #5208
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-09-01 09:00:45 +08:00
Shuo A Liu e587f029de hv: Add severity check against SOS hypercalls
Virtual interrupts injection and memory mapping operations can impact
target VM. By design, these type of operations from lower severity VM
to higher severity VM should be blocked by the hypervisor.

While the hypercalls are the interface between SOS VM and the
hypervisor, severity checks can be implemented at the beginning of
hypercalls needed.

Added severity checks in below hypercalls:
  * hcall_set_vm_memory_regions()
  * hcall_notify_ioreq_finish()
  * hcall_set_irqline()
  * hcall_inject_msi()
  * hcall_write_protect_page()

Tracked-On: #5208
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-09-01 09:00:45 +08:00
Yuan Liu 91e2fcfecf dm: implement ivshmem inter-vm communication for hv-land
This patch is used to create and destroy an ivshmem device which
is emulated in hypervisor.

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-08-28 16:53:12 +08:00
Yuan Liu 1d084073d6 dm: refine ivshmem creation and destruction
add create_ivshmem_from_dm and destroy_ivshmem_from_dm for
ivshmem device creation and destruction in dm-land

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-08-28 16:53:12 +08:00
Yuan Liu a977d35e0c dm: add new ioctl to create and destroy a device
Add IC_CREATE_DEVICE and IC_DESTROY_DEVICE ioctls to create and
destroy an emulated device in hypervisor

v3: change IC_CREATE_DEVICE and IC_DESTROY_DEVICE to IC_CREATE_HV_VDEV
    and IC_DESTROY_HV_VDEV

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-08-28 16:53:12 +08:00
Yuan Liu 1b711ed629 hv: ignore the initialization of vdevs whose vbdf is unassigned
if device configuration vbdf is unassigned, then the corresponding
vdev will not be initialized, instead, the vdev will be initialized
by device model through hypercall.

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-08-28 16:53:12 +08:00
Yuan Liu 6d0f0ebd8a hv: implement ivshmem device creation and destruction
For ivshmem vdev creation, the vdev vBDF, vBARs, shared memory region
name and size are set by device model. The shared memory name and size
must be same as the corresponding device configuration which is configured
by offline tool.

v3: add a comment to the vbar_base member of the acrn_vm_pci_dev_config
    structure that vbar_base is power-on default value

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-08-28 16:53:12 +08:00
Yuan Liu 8a34cf03ca hv: add new hypercalls to create and destroy an emulated device in hypervisor
Add HC_CREATE_VDEV and HC_DESTROY_VDEV two hypercalls that are used to
create and destroy an emulated device(PCI device or legacy device) in hypervisor

v3: 1) change HC_CREATE_DEVICE and HC_DESTROY_DEVICE to HC_CREATE_VDEV
       and HC_DESTROY_VDEV
    2) refine code style

v4: 1) remove unnecessary parameter
    2) add VM state check for HC_CREATE_VDEV and HC_DESTROY hypercalls

Tracked-On: #4853

Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-08-28 16:53:12 +08:00
Wei Liu 52bb9d6983 acrn-config: add .clos to vm_configurations.c
1.Create board files for ehl-crb-b
2.Add .clos to vm_configurations.c

Tracked-On: #5229
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-08-28 16:44:06 +08:00
Wei Liu 29ac258134 acrn-config: code refactoring for CAT/MBA
1.Modify clos_mask and mba_delay as a member of the union type.
2.Move HV_SUPPORTED_MAX_CLOS ,MAX_CACHE_CLOS_NUM_ENTRIES and
MAX_MBA_CLOS_NUM_ENTRIES to misc_cfg.h file.

Tracked-On: #5229
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-08-28 16:44:06 +08:00
Wei Liu 7eb103478a acrn-config: add MAX_CACHE_CLOS_NUM_ENTRIES/MAX_MBA_CLOS_NUM_ENTRIES macros
1.Add macro MAX_CACHE_CLOS_NUM_ENTRIES for CAT, and MAX_MBA_CLOS_NUM_ENTRIES for MBA.

 MAX_MBA_CLOS_NUM_ENTRIES:
  Max number of Cache Mask entries corresponding to each CLOS.
  This can vary if CDP is enabled vs disabled, as each CLOS entry will have corresponding
  cache mask values for Data and Code when CDP is enabled.

 MAX_CACHE_CLOS_NUM_ENTRIES:
  Max number of MBA delay entries corresponding to each CLOS.

2.Move VMx_VCPU_CLOS macro to misc_cfg.h head file.

Tracked-On: #5229
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-08-28 16:44:06 +08:00
dongshen a425730f64 acrn-config: rename MAX_PLATFORM_CLOS_NUM to HV_SUPPORTED_MAX_CLOS
HV_SUPPORTED_MAX_CLOS:
 This value represents the maximum CLOS that is allowed by ACRN hypervisor.
 This value is set to be least common Max CLOS (CPUID.(EAX=0x10,ECX=ResID):EDX[15:0])
 among all supported RDT resources in the platform. In other words, it is
 min(maximum CLOS of L2, L3 and MBA). This is done in order to have consistent
 CLOS allocations between all the RDT resources.

Tracked-On: #5229
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-08-28 16:44:06 +08:00
Wei Liu 3674179701 acrn-config: add MMIO type for debug UART
Tracked-On: #4937
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
2020-08-27 13:31:17 +08:00
Yin Fengwei d0e06c4f80 hv: debug: Enable MMIO UART support
New board, EHL CRB, does not have legacy port IO UART. Even the PCI UART
are not work due to BIOS's bug workaround(the BARs on LPSS PCI are reset
after BIOS hand over control to OS). For ACRN console usage, expose the
debug UART via ACPI PnP device (access by MMIO) and add support in
hypervisor debug code.

Another special thing is that register width of UART of EHL CRB is
1byte. Introduce reg_width for each struct console_uart.

Tracked-On: #4937
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
2020-08-27 13:31:17 +08:00
Shuang Zheng 0c07999ec2 acrn-config: add IVSHMEM config in hybrid_rt of tgl-rvp
add IVSHMEM config in hybrid_rt scenario on tgl-rvp board.

Tracked-On: #4853

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-08-27 09:02:56 +08:00
Shuang Zheng ae6e107d9c acrn-config: add maxcpus to sos kernel cmdline in hybrid scenario
We use sos kernel cmdline maxcpus to limit the pCPU number of SOS
for hybrid or hybrid_rt scenarios by vcpu numbers calculation.

v2: add SOS CPU affinity calculation by total pCPU plus pCPUs
    occupied by pre-launched VMs when no pcpuid configured
    in SOS.

Tracked-On: #5216

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2020-08-27 08:56:44 +08:00
Zide Chen f945fe27ab doc: remove UEFI/de-privilege boot mode from docs
Also clear Linux is no longer supported either as SOS or post-launched VM kernel.

- When it mentions clear Linux, mostly replaced by Ubuntu.
- remove all contents re/lated to "UEFI boot".
- remove the term de-privilege mode, and direct mode as well.

Tracked-On: #5197
Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-08-26 16:37:41 -07:00
zhanqi 75ecc0e3b1 misc/packaging: remove efi support
Tracked-On: #5022

Signed-off-by: zhanqi <sherry.qi.zhang@intel.com>
2020-08-26 16:29:27 +08:00
Mingqiang Chi 53b11d1048 refine hypercall
-- use an array to fast locate the hypercall handler
   to replace switch case.
-- uniform hypercall handler as below:
   int32_t (*handler)(sos_vm, target_vm, param1, param2)

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2020-08-26 14:55:24 +08:00
Victor Sun 7935354864 acrn-config: add cfl-k700-i7 industry xmls
Add cfl-k700-i7 board xml and its industry xml to support ACRN industry
scenario on cfl-k700-i7 board.

Tracked-On: #5212

Signed-off-by: Victor Sun <victor.sun@intel.com>
2020-08-26 13:46:56 +08:00
Geoffroy Van Cutsem f8883f43e9 hv: enhance help text for the scenario option in Kconfig
Enhance the help text that accompanies the CONFIG_SCENARIO symbol in Kconfig

Tracked-On: #5203
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2020-08-26 08:51:50 +08:00
David B. Kinder 066744ce5d doc: update FAQ
Remove obsolete information and Clear Linux/UEFI references.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-08-25 17:50:37 -07:00
Shuo A Liu 62287cdb48 acrn-config: Enable pre-launch VM sharing CPU with other VMs
CPU sharing between pre-launch VMs and SOS, post-launch VMs were
forbidden.

Remove the limitation.

Tracked-On: #5153
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
2020-08-26 08:49:41 +08:00
David B. Kinder a32074cda1 doc: update docbuild instructions for 2.2 release
Remove mention of Clear Linux

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-08-25 17:13:43 -07:00
Geoffroy Van Cutsem 32fc0dc2a7 doc: add hybrid_rt to "What is ACRN"
Add description of the new Hybrid RT (hybrid_rt) scenario to the "What is ACRN"
documentation.

Tracked-On: #5203
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2020-08-25 17:08:31 -07:00
Zide Chen 456dd43187 doc: remove the vboot module design example from sw_design_guidelines.rst
Since de-privilege boot mode is removed and vboot module is completely
rewritten.

Tracked-On: #5197
Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-08-25 14:42:26 -07:00
Shuang Zheng e46c5ac350 acrn-config: support configuration for Inter-VM communication
This patch is to support the Inter-VM communication by IVSHMEM
in config tool.
Users can configure IVSHMEM_ENABLE to enable or disable Inter-VM
communication by IVSHMEM; users can configure the name, size,
communication VM IDs of the IVSHMEM devices in the VM settings of
scenario xmls, then config tool will generate the related IVSHMEM
configurations for Inter-VM communication.
The config tool will do sanity check including when saving the xmls:
the format of shared memory region configuration is
[name],[size],[VM ID]:[VM ID](:[VM ID]...);
the max size of the name is 32 bytes;
the names should not be duplicated;
the mininum value of shared memory region size is 2M;
the value of shared memory region is a power of 2;
the size of share memory region should not extended the size of
available ram.

Tracked-On: #4853

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-08-24 13:58:38 +08:00
Shuang Zheng 4665a17f72 acrn-config: add inter-vm config in config app
Shared memory regoins can be added or deleted or updated from
scenario settings in config app  with sanity check.

v2: move IVSHMEM config to hv->FEATURES->IVSHMEM

Tracked-On: #4853

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-08-24 13:58:38 +08:00
Shuang Zheng 9d27ec2df0 acrn-config: update config xmls to add Inter-VM configs
add IVSHMEM_ENABLED and IVSHMEM_REGION in scenario xmls to support
Inter-VM communications configuration for VMs.

v2: move IVSHMEM config into <FEATURES> section

Tracked-On: #4853

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-08-24 13:58:38 +08:00
zhanqi 735619f5c2 misc:update packaging tool,add pre-check scripts/ add patch function /optimize
Tracked-On: #5022

Signed-off-by: zhanqi <sherry.qi.zhang@intel.com>
2020-08-24 09:12:45 +08:00
Tao Yuhong 54f6a6e221 TGL: pre-launched VM0 tpm passthrough
Enable TPM passthrough configuration for pre-launched VM feature, on
TGL, by adding 'tgl-rvp' to TPM_PASSTHRU_BOARD.

Tracked-On: #5205
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2020-08-22 17:45:38 +08:00
Shuang Zheng e6c1b89ffa acrn-config: get the max number with integer list
Get the max number with integer list to instead string 'number'.

Tracked-On: #5199

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-08-22 17:42:22 +08:00
Geoffroy Van Cutsem 49711b48e3 doc: add explanation about ACRN modes and scenarios
Add more explanations about the various ACRN modes of operation and how they are
used to construct more complex scenarios.

Tracked-On: #5196
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2020-08-21 13:25:11 -07:00
Tao Yuhong 2a6ab5f4ea acrn-config: add hybrid_rt scenario xml config for TGL
Add ./misc/acrn-config/xmls/config-xmls/tgl-rvp/hybrid_rt.xml

Tracked-On: #5185
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2020-08-21 14:41:29 +08:00
David B. Kinder e74cf71eb7 doc: spelling and grammar fixes
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-08-20 08:09:21 -07:00
Shuo A Liu 7602304692 hv: Fix thread status mess if wake_thread() happens in transition stage
2abbb99f6a ("hv: make thread status more accurate") introduced a
transition stage, marked as var be_blocking, between RUNNING->BLOCKED
of thread status. wake_thread() does not work in this transition stage
because it only checks thread->status.

Need to check thread->be_blocking as well in wake_thread(). When
wake_thread() happens in the transition stage, the previous sleep
operation rolled back.

Tracked-On: #5190
Fixes: 2abbb99f6a ("hv: make thread status more accurate")
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
2020-08-20 10:32:31 +08:00
fuzhongl 5409d14e08 acrn-config: update TGL platform and SOS RAM size
The default memory is 16G on TGL; the value of PLATFORM_RAM_SIZE and
SOS_RAM_SIZE is a little small in default xml.

Tracked-On: #5184
Reviewed-by: Victor Sun  <victor.sun@intel.com>
Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
2020-08-20 10:06:31 +08:00
Li Fei1 7b38829576 doc: update document for "--acpidev_pt" and "--mmiodev_pt" features
Add guild how to add ACPI device and MMIO device passthrough support through
the cmdline.

Signed-off-by: Li Fei1 <fei1.li@intel.com>
2020-08-19 15:52:02 -07:00
Shiqing Gao 24b89eb8c4 doc: update coding guidelines
- add a rule for pointer arithmetic operation
 - add a rule about ABI conformance
 - update GCC reference

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
2020-08-19 15:49:35 -07:00
Yuan Liu f60896951b hv: change log level for find_match_mmio_node
Replace pr_fatal with pr_info to reduce printing logs

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-08-19 15:06:15 +08:00
Yuan Liu 43683c7fc9 hv: implement ivshmem device-specific registers emulation
Ivshmem device defines four registers including Interrupt Mask, Interrupt
Status, IVPostion and Doorbell. The first two are useless and no emulation
is required. The latter two are used for interrupts and will be implemented
in the future.

This patch also introduces a new priv_data member for structure pci_vdev,
it can be used to find an ivshmem device through pci_vdev.

v2: refine code style

v3: 1) add @pre for ivshmem_mmio_handler function
    2) refine code style

v4: 1) set ivshmem registers default value when vBAR mapping
    2) change find_ivshmem_device to set_ivshmem_device

v5: 1) change set_ivshmem_device to find_and_set_ivshmem_device
    2) add a ASSERT to check if the vdev->priv_data is set successfully

v6: change find_and_set_ivshmem_device to create_ivshmem_device

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-08-19 15:06:15 +08:00
Yuan Liu b6661e48d8 hv: implement configuration space operations of ivshmem device
Implement read_vdev_cfg/write_vdev_cfg operations for ivshmem deivce

v2: read_vdev_cfg/write_vdev_cfg always return zero, the ivshmem device
    only emulated in HV.

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-08-19 15:06:15 +08:00