Commit Graph

5162 Commits

Author SHA1 Message Date
Zide Chen f6a7206200 acrn-dm: fix corner cases in acrn_parse_cpu_affinity()
- re-arange the code to make static code analysis tool happy.

- If no valid conversion could be performed, a zero value is returned
  (0L) from strtol(), so add a sanity check "isdigit(cp[0])" to ensure
  that it won't unexpectedly parse CPU 0 if the string starts or ends
  with the valid delimiters ',' or '-', for example:

  -- cpu_affinity 1,
  -- cpu_affinity ,1

Tracked-On: #4616
Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-29 11:51:09 +08:00
wenlingz 0f6d11866b Modify Makefile to add acrn.bin after install
Tracked-On: #4842
Signed-off-by: wenlingz <wenling.zhang@intel.com>
2020-05-29 10:31:16 +08:00
Yuan Liu aeae464980 Implement creation and removal of inter-vm shared memory
The shared memory will be created when a post-launched VM which
specified ivshmem v1 device starts, the same shared memory name
will only create a shared memory region.

The shared memory will be removed when all post-launched VMs
that opened it close the shared memory object.

v2: Support one post-launched VM can configure multiple ivshmem
    devices

Tracked-On: #4853
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2020-05-29 09:28:24 +08:00
Yuan Liu cb816f7f65 Introduce ACRN Inter-VM Virtualization
Support shared memory based inter-vm communication for ACRN
post-launched VMs. The ivshmem mediator emulates one standard
PCI device which expose the shared memory region through its BAR2.
The shared memory region is allocated through Linux shm mechanism and
post-launched VM needs to specify the shm name and size as the acrn-dm
parameter, the VMs have same shm name parameter can communicate over
the shared memory.

For first stage, only support shared memory. Consider to support
notification(interrupt) in future.

To add a ivshmem device in device model, the usage as below
-s N,ivshmem,shm_name,shm_size

v2: Implement the ivshmem MMIO registers emulation

v3: Refine code style
    Add ivshmem device usage
    Refine MMIO register return value

v4: Refine comments
    Use logger interfaces to print logs

Tracked-On: #4853
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2020-05-29 09:28:24 +08:00
Helmut Buchsbaum 884e9fc911 Revert "dm: acpi: add PSDS table in ACPI table"
This reverts commit 59e2de4805.

Since PSDS table format does not meet the expectations on all boards
providing a PSDS, such as e.g. Kontron COMe-mAL10 based boards, remove
exposure of PSDS table for now.

Tracked-On: #4846
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
2020-05-29 09:03:52 +08:00
Xie, nanlin af52ed6e5d CODEOWNERS: Update the maintainer of misc folder
Tracked-On: #3419

Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2020-05-28 13:47:31 +08:00
Li Fei1 ce3451827a hv: vpci: add vmsix capability registers rw permission control
Guest may write a MSI-X capability register with only RW bits setting on. This works
well on native since the hardware will make sure RO register bits could not over-write.
However, the software needs more efforts to achieve this. This patch does this by
defining a RW permission mapping base on bits. When a guest tries to write a MSI-X
Capability register, only modify the RW bits on vCFG space.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2020-05-28 13:44:18 +08:00
Li Fei1 ea0ba47b02 hv: vpci: add vmsi capability registers rw permission control
Guest may write a MSI capability register with only RW bits setting on. This works
well on native since the hardware will make sure RO register bits could not over-write.
However, the software needs more efforts to achieve this. This patch does this by
defining a RW permission mapping base on bits. When a guest tries to write a MSI
Capability register, only modify the RW bits on vCFG space.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2020-05-28 13:44:18 +08:00
Helmut Buchsbaum ccbabb4ce8 dm: bzimage: dynamically adapt to ramdisk size
To remove the limit of 4MB ramdisk size simply adjust layout
dynamically according to ramdisk size rounded up to a 4K boundary.
This enables ramdisk based virtual machines which tend to have
large ramdisk memory requirements (128MB and above).

Tracked-On: #4840
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
2020-05-28 08:49:47 +08:00
Vijay Dhanraj d03df0c7e2 HV: Fix MP Init sequence hang by adding a delay
As per the BWG a delay should be provided between the
INIT IPI and Startup IPI. Without the delay observe hangs
on certain platforms during MP Init sequence. So Setting
a delay of 10us between assert INIT IPI and Startup IPI.

Also, as per SDM section 10.7 the the de-assert INIT IPI is
only used for Pentium and P6 processors. This is not applicable
for Pentium4 and Xeon processors so removing this sequence.

Tracked-On: #4835
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-27 13:34:59 +08:00
Minggui Cao 8c090c71ca HV: fix bug to clear guest flags after it not used
in shutdown_vm, it uses guest flags when handling the phyiscal
CPUs whose LAPIC is pass-through. So if it is cleared first,
the related vCPUs and pCPUs can not be switched to correct state.

so move the clear action after the flags used.

Tracked-On: #4848
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2020-05-27 11:35:47 +08:00
Binbin Wu 454bb14348 hv: vtd: remove some unnecessary check
1. context_entry couldn't be NULL in iommu_attach_device since bus
number is checked before the call.
2. root_entry couldn't be NULL in iommu_detach_device since bus number
is checked before the call.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-27 11:27:42 +08:00
Binbin Wu e9901b3edd hv: vtd: add a function to check valid of dmar unit
Add a function dmar_unit_valid to check if the input dmar uint is valid
or not.

A valid dmar_unit should not be NULL, or ignore flag should not be set.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-27 11:27:42 +08:00
Binbin Wu 3009d9399f hv: vtd: cleanup snoop control related code
Snoop control will not be turned on by hypervisor, delete snoop control
related code.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-27 11:27:42 +08:00
Binbin Wu a94c3ef763 hv: vtd: init DMAR/IR table address when register
Initialize root_table_addr/ir_table_addr of dmar uint when register the dmar uint.
So no need to check if they are initialzed or not later.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-27 11:27:42 +08:00
Helmut Buchsbaum b7f667a3ba dm: Do not link to zlib
Since zlib is not used, remove linking to it. This reduces build
dependencies.

Tracked-On: #4838
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
2020-05-26 14:01:54 +08:00
Minggui Cao 564984570c HV: explicitly init lock variable before using it
1. though "pci_device_lock" & "logmsg_ctl.lock" are set to 0 when
  system dose memory initialization, it is better to explicitly init
  them before using.
2. unify the usage of spinlock_init

Tracked-On: #4827
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-26 10:26:59 +08:00
Zhao Yakui 6c02a8d5ed ACRN/DM: Initialize the igd_lpc bridge to ISA_BRIDGE to make Linux guest happy
Currently the class type of igd_lpc bridge PCI device is not initialized.
In such case the guest driver doesn't detect the platform correctly when it
is in GVT-d mode. Then the linux i915 driver can't work.

Tracked-On: #4745
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2020-05-25 11:08:25 +08:00
Zhao Yakui bca83efee8 ACRN/DM: Reset the passthrough device to fix garbage display issue
Currently the DM will return the passthrough device to SOS when the DM
needs to be terminated. But the device is not reset. In such case it
will cause the garbage display issue when the GPU passthrough device
is returned.

Tracked-On: #4719
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2020-05-25 11:08:25 +08:00
David B. Kinder 4db42c1c7f doc: fix rst-columns display
Using ``.. rst-class:: rst-columns`` wasn't processed correctly because
of an error in the acrn-custom.css file.  Fix that, update the
documentation guidelines, and make use of the multi-column display in
documents where the toctree created a long list.  Now it will
appear in columns.

Also tweaked the toctree listing to use bold for the first-level items
(making a multi-column display look better, particularly when it has
subsections).

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-05-21 15:08:15 -07:00
Deb Taylor c606d060ec Doc: Grammatical edits to GVT-d docs.
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2020-05-21 17:17:16 -04:00
David B. Kinder 102aba8bc8 doc: Add visual OpenStack setup instructions
Update the OpenStack/libvirt tutorial with detailed instructions with
screen shots. Add patch file mention in the instructions to the docs
area so it's accessible.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-05-21 08:48:36 -07:00
Vijay Dhanraj 290886d4d0 acrn-config: Platform xml file support to run ACRN on QEMU
This patch adds xml file, both board as well scenario files
that are need to run ACRN on top of QEMU as a nested hypervisor.

Currently support is only for SDC scenario.

Tracked-On: #3198
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-21 15:34:38 +08:00
Vijay Dhanraj 2175c17c97 acrn-config: Set defaults on empty leaf for generated <board>.xml file
This patch sets defaults similar to generic platform configuration
when leaf features like PM_INFO, S3_INFO, S5_INFO, DRHD_INFO, CPU_BRAND,
CX_INFO, PX_INFO, MMCFG_BASE_INFO are not generated via either target
offline tool or user supplies empty field in case of emulation.

Tracked-On: #3198
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-21 15:34:38 +08:00
Binbin Wu 6c05af8ded hv: ptirq : fix a bug in ptirq_release_entry
The mask valuei 0x3F was added to prevent out of range in array access.
However, it should not be hardcoded.
Since in ptirq_alloc_entry_id, the valid allocated id is no greater
than CONFIG_MAX_PT_IRQ_ENTRIES, it will not cause out of range array
access without mask.
So this patch removes the mask.

Also, use bitmap_clear_lock instead of bitmap_clear_nolock becuase there
could be the chance that more than 1 core to access a same 64bit var.

Tracked-On: #4828
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-21 15:24:25 +08:00
Shuo A Liu 9a15ea82ee hv: pause all other vCPUs in same VM when do wbinvd emulation
Invalidate cache by scanning and flushing the whole guest memory is
inefficient which might cause long execution time for WBINVD emulation.
A long execution in hypervisor might cause a vCPU stuck phenomenon what
impact Windows Guest booting.

This patch introduce a workaround method that pausing all other vCPUs in
the same VM when do wbinvd emulation.

Tracked-On: #4703
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-21 15:21:29 +08:00
Minggui Cao a335679ce9 Makefile: remove 'clean' when building HV/DM
1. not need 'clean' when building ACRN-HV/DM each time
2. correct efi-stub wrong dependency

Tracked-On: #2412
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2020-05-21 15:12:21 +08:00
Minggui Cao 42d5533e6f HV: makefile: to avoid duplicated build libs
1. improve makefile to avoid duplicated build libs when make
in acrn-hypervisor/hypervisor directory to build HV only.

2. for debug/release library just select one makefile to build

Tracked-On: #2412
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2020-05-21 15:12:21 +08:00
Mingqiang Chi f994b5ffaf hv:cleanup vcpu state
-- remove VCPU_PAUSED and resume_vcpu
-- remove vcpu->prev_state in vcpu structure
-- rename pause_vcpu to zombie_vcpu

Tracked-On: #4320
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-05-21 15:08:49 +08:00
Shuo A Liu 8287cfac6c hv: debug: reboot directly when issue 'reboot' shell cmd
Tracked-On: #4817
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-21 14:57:22 +08:00
Junming Liu 3ccbb20087 doc:add tutorial about enabling GVT-d
Previous tutorial "Enable GPU Passthrough on the Skylake NUC"
is out of date, so delete it here.

v2 -> v1:
add attached file

Signed-off-by: Junming Liu <junming.liu@intel.com>
2020-05-20 11:58:19 -04:00
Li Fei1 53af096726 hv: ptirq: refine find_ptirq_entry by hashing
Refine find_ptirq_entry by hashing instead of walk each of the PTIRQ entries one by one.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong<eddie.dong@Intel.com>
2020-05-20 16:04:16 +08:00
Yonghua Huang 63c019c6d2 hv: Add 64 bits hash function
This patch adds hash function to hash 64bit value.

Tracked-On: #4550
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong<eddie.dong@Intel.com>
2020-05-20 16:04:16 +08:00
Wei Liu fca8750ba6 acrn-config: generate console=ttyS0 for PRE Launched VM
Remove pre-launched VM console setting in scenario xml and leave it
configured in bootargs directly.

Tracked-On: #4808
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-20 13:51:31 +08:00
Wei Liu 65c0cc7362 acrn-config: remove rootfs item from PRE Launched VM
The bootarg of rootfs for pre-launched VM is for Linux only and it
should not limited to physical block device which is selectable from
native rootfs list, it might be a USB or RAM device that "X" is variable
in root=/dev/sdX or /dev/ramX. So remove the rootfs setting in XML and
leave it configured in kernel bootargs directly.
Given the SOS must be Linux and its rootfs must be a physical block
device, rootfs item tag is still reserved in xml for SOS VM section.

Tracked-On: #4808
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-20 13:51:31 +08:00
Wei Liu 3ecaa62510 acrn-config: remove configurable="0" for hybrid scenario config
remove configurable="0" for hybrid scenario pci_devs of Pre Launched VM.

Tracked-On: #4808
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-20 13:51:31 +08:00
Wei Liu 39ab45f06b acrn-config: generate pci_dev.c file for logical partition
With current acrn-config code, there would be no pci_dev.c generated
if no PCI devices were selected. This would cause a bug for logical_partition
scenario because of an old pci_dev.c is already in the folder and involved
for compiling. The configure tool should override the pci_dev.c, in this case,
to avoid building error.

Tracked-On: #4813
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-20 13:36:03 +08:00
Deb Taylor 9d3f2066c1 Doc: Grammatical edits to CPU Virtualization doc.
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2020-05-18 19:03:52 -04:00
Zide Chen 87adc93c96 doc: update cpu affinity related docs
Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-18 11:13:37 -04:00
fuzhongl c271fc022a Doc: Supported hardware update
Update some scenario typo info for NUC6CAYH

Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
2020-05-18 11:12:06 -04:00
Wei Liu 8b736cc131 acrn-config: generate correct IRQ for VUART1
As VUART is not supported PCI VUART, use native PCI ttySn's IRQ for
VUART1 would cause communication failed, allocate a free IRQ for it.

Tracked-On: #4798
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-15 13:25:09 +08:00
Wei Liu f644b3705b acrn-config: refine the 'vm_name' parameter for launch script
Use post_vm_id$(relative id) to identify each post-launched VM to
make sure simultaneous launching successfully.

Tracked-On: #4797
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-15 13:25:09 +08:00
Shuang Zheng 515c70010f acrn-config: add board and default config xmls for ehl
add board xml and default scenario config xmls and launch config
xmls for ElkhartLake boards.

Tracked-On: #4798
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
2020-05-15 13:25:09 +08:00
Wei Liu 8ebf89eaa8 acrn-config: refinement acrn-dm arguments for "Soft RT/Hard RT" VMs
Assign the right acrn-dm arguments for "Soft RT/Hard RT" VMs by
'uos_type' in webUI item tag.

Tracked-On: #4799
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-15 13:25:09 +08:00
Wei Liu d4c9a5fa77 acrn-config: refine ttys type for mapping MMIO
add ttys type for mapping MMIO

Tracked-On: #4798
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-15 13:25:09 +08:00
Wei Liu 843579adf1 acrn-config: remove 'idle=halt' from sos bootargs
Remove "idle=halt" from SOS boot args since the param could be handled
automatically by acrn-config according to CPU scheduler setting.

Tracked-On: #3854
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-05-15 13:25:09 +08:00
Yonghua Huang 3391bffb27 hv:fix rtvm hang with maxcpus=0/1 in bootargs
RTVM (with lapic PT) boots hang when maxcpus is
 assigned a value less than the CPU number configured
 in hypervisor.

 In this case, vlapic_state(per VM) is left in TRANSITION
 state after BSP boot, which blocks interupts to be injected
 to this UOS.

Tracked-On: #4803
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Li, Fei <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-05-15 10:09:13 +08:00
Mingqiang Chi 4d3221a7f3 acrn-dm: add some logs for vm state transition
add logs for vm state transition to help
analyze some problems.

Tracked-On: #4098
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2020-05-15 10:06:23 +08:00
David B. Kinder e58609ad1f doc: remove duplicate 1.6 version menu choice
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-05-14 12:24:26 -07:00
Yuan Liu a99858e9f6 doc: Update acrn edk2 download path
Update acrn edk2 source code download path for WaaG
secure boot feature

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
2020-05-14 08:50:55 -07:00