Commit Graph

5308 Commits

Author SHA1 Message Date
Li Fei1 80c7da8f1c hv: vioapic: expose ioapic to guest unconditionally
Some OSes assume the platform must have the IOAPIC. For example:
Linux Kernel allocates IRQ force from GSI (0 if there's no PIC and IOAPIC) on x86.
And it thinks IRQ 0 is an architecture special IRQ, not for device driver. As a
result, the device driver may goes wrong if the allocated IRQ is 0 for RTVM.

This patch expose vIOAPIC to RTVM with LAPIC passthru even though the RTVM can't
use IOAPIC, it servers as a place holder to fullfil the guest assumption.

After vIOAPIC has exposed to guest unconditionally, the 'ready' field could be
removed since we do vIOAPIC initialization for each guest.

Tracked-On: #4691
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-07-10 19:33:46 +08:00
Wei Liu f2479f6489 acrn-config: update passtrough device config for ehl-crb-b launch xmls
1.Update passtrough device config for ehl-crb-b launch xmls.

Tracked-On: #5016
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-07-10 18:58:55 +08:00
Wei Liu 83d64c506f acrn-config: support 6 VMs for ehl-crb-b industry xml
Add support 6 VMs for ehl-crb-b industry xml.

Tracked-On: #5015
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-07-10 18:58:55 +08:00
David B. Kinder aa45937860 doc: Update contribution guide instructions
While changes to documentation can be submitted directly as PRs, changes
to code must be first submitted for approval to the developer mailing
list.  Update the contribution guidelines to talk about this.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-07-08 10:52:57 -07:00
Shuo A Liu bdbf135708 dm: Fix wrong hugetlb_lv_max
hugetlb_lv_max will get wrong value if the HUGETLB_LV2 mount failed.
Once hugetlb_lv_max is wrong, the following code logic messes up.

Tracked-On: #4937
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2020-07-08 15:32:15 +08:00
Sun Peng 6edd21c1dc dm: Data Stolen Memory (DSM) passthrough support for GVT-d on TGL
The way of passing DSM address on TGL is the same with on EHL.
Adding these code to support GVT-d on TGL.

Tracked-On: #5020
Signed-off-by: Sun Peng <peng.p.sun@intel.com>
Acked-by: Yu Wang yu1.wang@intel.com
2020-07-08 13:19:05 +08:00
Conghui Chen 6722132233 acrn-config: enable more VMs in TGL xml
Add more VMs in xml.
Enable vuart0 for VM1.

Tracked-On: #5013
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2020-07-08 10:16:34 +08:00
Conghui Chen 213cd4e2b2 acrn-config: enlarge ram size
enlarge ram size, otherwise, there would be compile issue for tgl.

Tracked-On: #5013
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2020-07-08 10:16:34 +08:00
Shuo A Liu 0b03a2a75a acrn-config: update EHL CRB configs
BIOS version: EHLSFWI1.R00.2224.A00.2005281500

Tracked-On: #4937
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
2020-07-06 13:48:12 +08:00
Shuang Zheng 2c6fad00ee acrn-config: add MBA delay support in acrn config app
MBA_DELAY/CLOS_MASK show be exposed only if "MBA"/"L2" or "L3" existed
in rdt resource supoorted in board xml;
The default value of MBA_DELAY is 0;
The numbers of MAB_DELAY/CLOS_MASK entries is determined by:
If CDP is not enabled, the number of entries for CLOS_MASK and MBA_DELAY
is the min of CLOS_MAX of all RDT resources;
If CDP is enabled,  divide the CLOS_MAX values for L3 and L2 resources
by 2 and then find the min of all RDT resources to get common_clos_max,
the number of entries for CLOS_MASK is common_clos_max*2,
the number of entries for MBA_DELAY is comm_clos_max.

Tracked-On: #4943
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
2020-07-06 13:48:12 +08:00
Wei Liu 6e2f8e2a03 acrn-config: refine sanity check for RDT/MBA
Refine sanity check for RDT CLOS and MBA Delay.

Tracked-On: #4943
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Reviewed-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
2020-07-06 13:48:12 +08:00
Wei Liu 30750fa7d5 acrn-config: update the LICENSE year in config tool
Update the LICENSE year for hv files which generate by config tool.

Tracked-On: #5004
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-07-06 13:43:15 +08:00
Wei Liu f716d8a2ad acrn-config: remove unnecessary check for pci.ids
The pci.ids database should be already prepared while tools of 'lspci'
were correctly installed and this check for pci.ids should be removed.

Tracked-On: #4989
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-07-06 13:43:15 +08:00
Wei Liu 76745ccc18 acrn-config: improvement sanity check for vuart1 target id settings
For the base of vuart 1 is not an invalid com base, the tools will check
the target vuart id and it's VM id if matches the other VM's. If they do
not match the error message will report to re-configuration.

Tracked-On: #4991
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2020-07-06 13:43:15 +08:00
David B. Kinder 854d8fa46e doc: tweak link in waag tutorial
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-07-04 14:35:56 -07:00
fangfang.shen 880be9f7ef doc:update WaaG GSG based on Ubuntu.
Signed-off-by: fangfang.shen <fangfang.shen@intel.com>
2020-07-04 14:05:10 -07:00
Mingqiang Chi b1357cdc0d hv:use spinlock_irqsave_obtain api for uart
replace spinlock_obtain/spinlock_release with spinlock_irqsave_obtain
and spinlock_irqrestore_release to avoid dead lock for uart module.

this uart lock may be accessed in ISR context like this path:
   dispatch_interrupt->pr_err/pr_xxx or printf
   ->console_write->uart16550_puts

Tracked-On: #4958

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-07-03 17:41:17 +08:00
Minggui Cao 0080c6ca72 tools: improve Makefile to build life-mngr
1. add life-mngr as a target in misc/Makefile, so it is
convenient to build and used in Yocto system.
2. add install target in life-mngr/Makefile to be packaged
into device file-system.

Tracked-On: #4870
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2020-07-02 13:51:34 +08:00
Li Fei1 41805eb2e8 hv: vpci: minor refine about MSI/MSI-X de-initialization
About the MSI/MSI-X Capability, there're some fields of it would never been changed
once they had been initialized. So it's no need to reset them once the vdev instance
is still used. What need to reset are the fields which would been changed by guest
at runtime.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2020-07-02 13:03:36 +08:00
Mingqiang Chi 3b120807c9 hv:rename vioapic.mtx to vioapic.lock
rename vioapic.mtx to vioapic.lock

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-07-02 09:40:29 +08:00
Mingqiang Chi 7751c7933d hv:unify spin_lock initialization
will follow this convention for spin lock initialization:
-- for simple global variable locks, use this style:
   static spinlock_t xxx_spinlock = {.head = 0U, .tail = 0U,}
-- for the locks inside a data structure, need to call
   spinlock_init to initialize.

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-07-02 09:40:29 +08:00
Mingqiang Chi 7b32fce06f hv:use spinlock_irqsave_obtain api for vpic
replace spinlock_obtain/spinlock_release with spinlock_irqsave_obtain
and spinlock_irqrestore_release to avoid dead lock for vpic module.

this vpic lock may be accessed in ISR context like this path:
  dispatch_interrupt->do_softirq->softirq_handlers
  ->ptirq_softirq->ptirq_handle_intx->vpic_set_irqline

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2020-07-02 09:40:29 +08:00
Qian Wang aee4515ff0 HV: restrict conditions to assign/deassign pcidev
hv: hypercall: restrict the condition to assign/deassign a pci device to
a post-launched VM for safety

For the safety of post-launched VMs, pci devices assignments should
occur only when VM is being created (at VM_CREATED STATUS), and pci
devices de-assignment should occur only when VM is being created or
shutdown/reset (at VM_CREATED or VM_PAUSED status)

Tracked-On: #4995
Acked-by: Eddie Done <eddie.dong@intel.com>
Reviewed-by: Li Fei <Fei1.Li@intel.com>
Signed-off-by: Wang Qian <qian1.wang@intel.com>
2020-07-01 16:19:05 +08:00
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