Commit Graph

5485 Commits

Author SHA1 Message Date
Shuo A Liu 2276f1c43d hv: Change to a permissive check with broken DMAR table
From the VT-d spec 8.3:
If a DRHD structure with INCLUDE_PCI_ALL flag Set is reported for a
Segment, it must be enumerated by BIOS after all other DRHD structures
for the same Segment.

However, some broken BIOS violate the rules. To bring up ACRN with them,
change the ASSERT to a permissive check to unblock the BIOS limitation.
Also, scan the DRHD list to find the one who has INCLUDE_PCI_ALL flag.

Tracked-On: #4937
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
2020-06-30 13:59:38 +08:00
Shuo A Liu 03e18ec492 hv: Refine dmar parsing code
Replace dmar_iterate_tbl() by a direct for loop. Handle the
dmar_unit_cnt and handle_one_drhd() of each DRHD in the direct for loop.

Also tune some function definitions to save LOC.

Tracked-On: #4937
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
2020-06-30 13:59:38 +08:00
wenlingz eb14ebd967 version:2.1-unstable
Signed-off-by: wenlingz <wenling.zhang@intel.com>
2020-06-28 11:13:14 +08:00
Shuo A Liu 025df6d44c hv: use SELF IPI Register for self IPI in X2APIC mode
According to SDM 10.12.11, we can know this register is dedicated to the
purpose of sending self-IPIs with the intent of enabling a highly
optimized path for sending self-IPIs. Also sending the IPI via the Self
Interrupt Register ensures that interrupt is delivered to the processor
core. Specifically completion of the WRMSR instruction to the SELF IPI
register implies that the interrupt has been logged into the IRR.

Tracked-On: #4937
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-28 10:33:22 +08:00
Shuo A Liu 0397cb7174 hv: Fix the interrupts lost issue with PI support
Currently, not all platforms support posted interrupt processing of both
VT-x and VT-d. On EHL, VT-d doesn't support posted interrupt processing.
So in such scenario, is_pi_capable() in vcpu_handle_pi_notification()
will bypass the PIR pending bits check which might cause a self-NV-IPI
lost.

With commit "bf1ff8c98 (hv: Offload syncing PIR to vIRR to processor
hardware)", the syncing PIR to vIRR is postponed and it is handled by a
self-NV-IPI in the following VMEnter. The process looks like,
a) vcpu A accepts a virtual interrupt ->
   1) ACRN_REQUEST_EVENT is set
   2) corresponding bit in PIR is set
   3) Posted Interrupt ON bit is set
b) vcpu A does virtual interrupt injection on resume path due to
   the pending ACRN_REQUEST_EVENT ->
   1) hypervisor disables host interrupt
   2) ACRN_REQUEST_EVENT is cleared
   3) a self-NV-IPI is sent via ICR of LAPIC.
   4) IRR bit of the self-NV-IPI is set
c) (VM-ENTRY) vcpu A returns into non-root mode
   1) host interrupt enable(by HW)
   2) posted interrupt processing clears the ON bit, sync PIR to vIRR
   3) deliver the virtual interrupt if guest rflags.IF=1
d) (VM-EXIT) vcpu A traps due to a instruction execution (e.g. HLT)
   1) host interrupt disable(by HW)
   2) hypervisor enable host interrupt

Above illustrates a normal process of the virtual interrupt injection
with cpu PI support. However, a failing case is observed. The failing
case is that the self-NV-IPI from b-3 is not accepted by the core until
a timing between d-1 and d-2. b-4 happening between d-1 and d-2 is
observed by debug trace. So the self-NV-IPI will be handled in root-mode
which cannot do the syncing PIR to vIRR processing. Due to the bug
described in the first paragraph, vcpu_handle_pi_notification() cannot
succeed the virtual interrupt injection request. This patch fix it by
removing the wrong check in vcpu_handle_pi_notification() because
vcpu_handle_pi_notification() only happens on platform with cpu PI
support.

Here are some cost data for sending IPI via LAPIC ICR regsiter.
Normally, the cycles between ICR write and IRR got set is 140~260,
which is not accurate due to the MSR read overhead.
And from b-3 to c is about 560 cycles. So b-4 happens during this
period. But in bad case, b-4 doesn't happen even c is triggered.
The worse case i captured is that ICR write and IRR got set costs more
than 1900 cycles. Now, the best GUESS of the huge cost of IPI via ICR is
the ACPI bus arbitration(refer to SDM 10.6.3, 10.7 and Figure 10-17).

Tracked-On: #4937
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-28 10:33:22 +08:00
David B. Kinder 055fe2c615 doc: update Ubuntu GSG with 2.0 fixes
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-24 09:50:57 -07:00
David B. Kinder 7dd4061bcc doc: add 2.0 to doc version selector
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-24 09:32:28 -07:00
fuzhongl eabb512ded DOC: v2.0 release notes
Add fixed issues and known issues in release note.

Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-24 08:43:21 -07:00
fangfang.shen c2187f20c2 doc: update Ubuntu GSG for ACRN V2.0.
Signed-off-by: fangfang.shen <fangfang.shen@intel.com>
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-24 08:30:35 -07:00
Vijay Dhanraj da2200167b acrn-config: Add missing MBA_delay configuration in scenario xml
This patch adds support to configure MBA delay values from
scenario xml files just as it is done for CAT mask. This will
improve user experience when configuring RDT resource mask
values.

Tracked-On: #4943
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-06-24 09:54:00 +08:00
David Kinder b5e3bb0547
edit bug issue template 2020-06-22 18:06:47 -07:00
David Kinder 0749251397
Update but report template 2020-06-22 17:58:58 -07:00
Xie, Nanlin e5d38349e4 Update issue templates 2020-06-23 08:49:43 +08:00
Yin Fengwei ef5c1b5481 Build: disable zero length array warning
We hit following build error when using gcc10:
  arch/x86/page.c:240:48: error: array subscript is outside
  array bounds of 'struct page[0][1]' [-Werror=array-bounds]

It happens with gcc10 on different Linux distributions.

Regarding the case that ACRN depends on zero length array in
sevaral places, we disable the zero length array warning by
gcc option.

Tracked-On: #4810
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2020-06-23 08:39:34 +08:00
Yuan Liu 215829fd7e doc: refine ivshmem architecture diagram
refine the dm-land and hypervisor-land flows

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
2020-06-22 11:30:21 -07:00
David B. Kinder b82e6146c4 doc: more release notes 2.0 edits
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-22 10:14:09 -07:00
Li Fei1 da7c2ba3e9 hv: ept: wrap a function to do guest ept flush
Wrap a function to do guest ept flush. This function doesn't do real EPT flush.
It just make the EPT flush request and do the real flush just before vcpu vmenter.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2020-06-22 16:25:03 +08:00
Li Fei1 82f9233d4a hv: vpci: a minor fix about is_zombie_vf
Now we check whether a device is zombie by the ->user != NULL.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2020-06-21 12:07:15 +08:00
David B. Kinder cfad047bd0 doc: update broken link to AGL download
Tracked-On: #4504

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-19 15:02:03 -07:00
Mingqiang Chi 1b84741a56 rename vm_lock/vlapic_state in VM structure
rename:
   vlapic_state-->vlapic_mode
   vm_lock -->  vlapic_mode_lock
   check_vm_vlapic_state --> check_vm_vlapic_mode

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-06-19 16:13:20 +08:00
Mingqiang Chi 0bd6555cab remove pci_device_lock in pci.c
-- remove unnecessary lock in pci_mmcfg_read_cfg and
   pci_mmcfg_write_cfg since the mmio operation is atomic
   if the offest is aligned with 1/2/4 bytes.
-- move pci_is_valid_access to pci.h

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-06-19 16:13:20 +08:00
Mingqiang Chi d808031a04 remove spin lock for micro code update
remove spin lock for micro code update since the guest
operating system will take lock

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-06-19 16:13:20 +08:00
Mingqiang Chi ac65898f35 cleanup spin lock in vtd.c
move dm_unit->lock into dmar_issue_qi_request

Tracked-On: #4958

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-06-19 16:13:20 +08:00
Mingqiang Chi 67a7c355ec cleanup spin lock in irq.c
-- move exception_lock to dump.c
-- optimize the lock usage in request_irq

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-06-19 16:13:20 +08:00
Mingqiang Chi d0a4052518 remove dead code in io.h
remove thess APIs:
   set64
   set32
   set16
   set8

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-06-19 16:13:20 +08:00
yuhong.tao@intel.com aff687896b HV: Fix split-locked access detection is disabled by default
The commit 'HV: Config Splitlock Detection to be disable' allows
using CONFIG_ENFORCE_TURNOFF_AC to turn off splitlock #AC. If
CONFIG_ENFORCE_TURNOFF_AC is not set, splitlock #AC should be turn on

Tracked-On: #4962
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2020-06-19 09:22:58 +08:00
David B. Kinder d479894ce4 doc: restore lists inside of notes
Lists inside of a note are displayed properly now, thanks to #4966 so
let's put some back in.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-18 13:54:00 -07:00
David B. Kinder 9ff0d30ad6 doc: fix style for lists in note
Fix CSS style for lists inside a note.  Previously the first list item
would overlap in the note heading box.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-18 13:33:01 -07:00
David B. Kinder 922129cad4 doc: consistent spelling of passthrough
Attempt to replace all the variations of "pass-thru", "pass thru", "pass
through", and "pass-through" to be "passthrough" (except for doc labels
and in code or API uses)

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-18 12:46:26 -07:00
David B. Kinder 380cd7f33e doc: update 2.0 release notes
Updates from reviewer comments included

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-18 11:02:37 -07:00
Wei Liu 96d1cbf7f3 acrn-config: modify the linux like uos type to yocto
Modify the linux like uos type to yocto.

Tracked-On: #4901
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
2020-06-18 16:02:23 +08:00
Yuan Liu c8891cb670 dm: fixed an issue that VM can't communicate with peer after rebooting/shutdown
Due to there is no inter-vm communication shared memory management
module, so each acrn-dm will call shm_unlink when VM rebooting/shutdown.
It causes one issue that if one of the two VMs is rebooting/shutdown,
the VM can't communicate with the peer again.

Currently, we don't release the shared memory to fix this issue.

Tracked-On: #4853
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-06-18 14:07:34 +08:00
Conghui Chen 2a4c59db74 hv: add check for BASIC VMX INFORMATION
Check bit 48 in IA32_VMX_BASIC MSR, if it is 1, return error, as we only
support Intel 64 architecture.

SDM:
Appendix A.1 BASIC VMX INFORMATION

Bit 48 indicates the width of the physical addresses that may be used for the
VMXON region, each VMCS, anddata structures referenced by pointers in a
VMCS (I/O bitmaps, virtual-APIC page, MSR areas for VMX transitions). If
the bit is 0, these addresses are limited to the processor’s
physical-address width.2 If the bit is 1, these addresses are limited to
32 bits. This bit is always 0 for processors that support Intel 64
architecture.

Tracked-On: #4956
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2020-06-18 14:05:56 +08:00
Conghui Chen 906284eec8 hv: remove unnecessary debug symbols
remove unnecessary debug symbols.

Tracked-On: #4956
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2020-06-18 14:05:56 +08:00
Conghui Chen f4292752b0 hv: remove check for OSXSAVE in host
We always assume the physical platform has XSAVE, and we always enable
XSAVE at the beginning, so, no need to check the OXSAVE in host.

Tracked-On: #4956
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2020-06-18 14:05:56 +08:00
Conghui Chen 53f74f18ac hv: remove repeated assignment
remove repeated assignment for vmcs_pa.

Tracked-On: #4956
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2020-06-18 14:05:56 +08:00
Victor Sun ca9e98cc74 HV: add board and scenario info in log
As build variants for different board and different scenario growing, users
might make mistake on HV binary distributions. Checking board/scenario info
from log would be the fastest way to know whether the binary matches. Also
it would be of benifit to developers for confirming the correct binary they
are debugging.

Tracked-On: #4946

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-18 13:05:42 +08:00
Qian Wang 882c9d5d76 HV: refine pci_find_vdev with hash
hv: pci: refine pci_find_vdev with hash

1. Refined pci_find_vdev with BDF-hashing for better performance

Tracked-On: #4857
Signed-off-by: Wang Qian <qian1.wang@intel.com>
Reviewed-by: Li Fei <Fei1.Li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-18 12:58:40 +08:00
Qian Wang 8fb8d81935 HV: refine pci_lookup_drhd_for_pbdf with hash
hv: pci: refine pci_lookup_drhd_for_pbdf with hash

1. Added an auxiliary function pci_find_pdev using hash to find pdev
with pbdf, thus pci_lookup_drhd_for_pbdf will have a better performance

Tracked-On: #4857
Signed-off-by: Wang Qian <qian1.wang@intel.com>
Reviewed-by: Li Fei <Fei1.Li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-18 12:58:40 +08:00
Qian Wang f58bf1f03f HV: rename pci_pdev_array to pci_pdevs
hv: pci: rename pci_pdev_array to pci_pdevs to make it clearer

Tracked-On: #4857
Signed-off-by: Wang Qian <qian1.wang@intel.com>
Reviewed-by: Li Fei <Fei1.Li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-18 12:58:40 +08:00
Victor Sun 780c87d9da doc: add hv parameter usage
The hv parameter could be configured in GRUB menu, currently we support
"uart=" parameter to override uart settings.

The patch also has modifications on tutorial of using_grub.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-17 21:10:42 -07:00
Victor Sun 5119fa0673 doc: add using grub tutorial
The GRUB could be used to boot ACRN hypervisor in direct boot mode.

Signed-off-by: Victor Sun <victor.sun@intel.com>
2020-06-17 21:10:42 -07:00
David B. Kinder 137f7d67e7 doc: v2.0 release notes
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-17 20:34:22 -07:00
David B. Kinder 86eb68a1e7 doc: open external links in new tab
As a UX improvement, use a separate tab when opening links to external
sites (use the same tab for internal links).  Also, use rel=noopener
attribute to improve security when linking to external sites.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-17 15:58:49 -07:00
David B. Kinder 91cbe6c984 doc: fix presentation of kata containers tutorial
Fixed a few layout issues and added link to mailing list

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-16 12:24:47 -07:00
Geoffroy Van Cutsem 398d639fa5 doc: Update Kata Containers tutorial to ACRN v2.0
Update the "Run Kata Containers on a Service VM" tutorial to use ACRN v2.0. It
also uses Ubuntu 20.04 as the baseline instead of Ubuntu 18.04. The Kata
Containers installation method is different as there are no pre-built binaries
for Ubuntu 20.04 yet, so using the 'kata-deploy' approach instead which is more
generic.

Changed link to slideshare.net for the referenced TCM presentation.

Tracked-On: #4944
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-06-16 12:00:48 -07:00
Geoffroy Van Cutsem c84f3f9a97 doc: update the summary table for all ACRN scenario
Update the table summarizing all ACRN scenario that are defined. The SDC
also offers the opportunity to run a Kata Containers VM and that was missing
from the description.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2020-06-16 11:35:02 -07:00
Binbin Wu 417ce1b32d dm: passthru: add support to allocate a bar for vmsix on msi emulation
New option "vmsix_on_msi,<bar_id>" is added to specify the passthrough
device needs vMSI-X emulation based on MSI capability.
If vMSI-X on MSI emulation is needed, a virtual BAR will be allocated.

Also, fix a logic error on when to setup INTx.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-16 08:52:56 +08:00
Binbin Wu 68b5616a52 dm: passthru: add acpi support for tsn devices
Add needed ACPI tables for TSN device.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-16 08:52:56 +08:00
Binbin Wu 6be27cdcab hv: vmsi: add vmsix on msi emulation support
Some passthrough devices require multiple MSI vectors, but don't
support MSI-X. In meanwhile, Linux kernel doesn't support continuous
vector allocation.
On native platform, this issue can be mitigated by IOMMU via interrupt
remapping. However, on ACRN, there is no vIOMMU.
vMSI-X on MSI emulation is one solution to mitigate this problem on ACRN.

This patch adds MSI-X emulation on MSI capability.
For the device needs to do MSI-X emulation, HV will hide MSI capability
and present MSI-X capability to guest.

The guest driver may need to modify to reqeust MSI-X vector.
For example:
        ret = pci_alloc_irq_vectors(pdev, 1, STMMAC_MSI_VEC_MAX,
-                                   PCI_IRQ_MSI);
+                                   PCI_IRQ_MSI | PCI_IRQ_MSIX);

To enable MSI-X emulation, the device should:
- 1. The device should be in vmsix_on_msi_devs array.
- 2. Support MSI, but don't support MSI-X.
- 3. MSI capability should support per-vector mask.
- 4. The device should have an unused BAR.
- 5. The device driver should not rely on PBA for functionality.

Tracked-On: #4831
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-06-16 08:52:56 +08:00