Commit Graph

1978 Commits

Author SHA1 Message Date
David B. Kinder d764edbf83 doc: update GRUB menu image in partition mode doc
Replace the askew photo of a GRUB screen with a ``code-block:: console``
directive.

Tracked-On: #1160

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-10-25 10:43:20 -07:00
Kaige Fu 61a9ca2053 Documentation: Add tutorial about how to use partition mode on UP2
This patch adds tutorial about all the steps you need to take in order to use
partition mode with ACRN hypervisor on UP2.

Tracked-On: #1160
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2018-10-25 10:14:36 -07:00
David B. Kinder bc7b06ae2f doc: update Memory management HLD
Update HLD documentation with HLD 0.7 section 3.3 (Memory Management).
Add a referenced target link to hv-cpu-virt.rst

Tracked-on: #1590

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-10-25 10:04:10 -07:00
CHEN Gang 2f8c31f6b4 tools: acrn-crashlog: update the documents
This patch updates the documents according to the latest implementation
of crashlogctl.

Tracked-On: #1024
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
2018-10-25 10:03:40 -07:00
Jian Jun Chen 655132fc8e dm: virtio: remove unused vbs_kernel_init
Tracked-On: #1364
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 15:39:57 +08:00
Yin Fengwei eb265809af DM: multiboot info address in DM for elf loader is wrong.
The () was missed during the patch refine. This patch add it.

Tracked-On: #1465
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 15:39:40 +08:00
Liang Yang 80e02c9708 DM USB: xHCI: Fix an potential array out of range issue.
When usb device numbers reach up to XHCI_MAX_SLOTS. The slot_allocated
array will get out of range. This patch is used to fix this issue.

Tracked-On: #1479
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 13:46:05 +08:00
Liang Yang 84c0c87842 DM USB: xHCI: Fix a potential NULL pointer issue.
After excap pointer is assigned, it should be checked whether it's
possible to get assignment for NULL pointer or not. This patch
fixes this issue.

Tracked-On: #1479
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 13:46:05 +08:00
Mingqiang Chi 1568a4c095 hv:Remove deadcode 'vm_lapic_from_pcpuid'
This api is not used, remove it.

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-10-25 13:45:40 +08:00
Huihuang Shi 46d198244f HV:vcpu fix "Pointer param should be declared pointer to const"
Fix violations whose parameter can be read-only.
This patch only fix the parameter whose name is vcpu.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:45:14 +08:00
Huihuang Shi ea32c34ae1 HV:fix "Pointer param should be declared pointer to const"
Fix violations for function whose parameter can be read-only.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:45:14 +08:00
Huihuang Shi d79007ae70 HV:add const to bitmap_test parameter addr
bitmap_test parameter addr should be read-only,
the addr is in the asm code "output" region,
change it to the "input" region.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:45:14 +08:00
Yin Fengwei 482a4dcc02 DM: correct the predefine DM option string.
That string was changed by accident and introduced the removed
items.

Tracked-On: #1465
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:44:09 +08:00
Yin Fengwei 85bec0d0d1 hv: Move the guest_sw_loader() call from vcpu to vm
guest software loading is per VM instead of vcpu. So we move it
from prepare_vcpu to prepare_vm. And make sure it's called for
all VMs for partition mode.

Tracked-On: #1565
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:43:46 +08:00
Yin Fengwei 4f19b3b875 hv: Prepare the gdt table for VM
For VMs of partition mode, there is no guarantee 1:1 mapping
between gpa and hpa, we need to copy the native gdt table to
each VM's memory.

Tracked-On: #1565
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:43:46 +08:00
Zhi Jin ad1ef7ba1b samples: enable pstore via the sos kernel cmdline
Enable pstore via the sos kernel cmdline, as ABL doesn't
reserve memory and pass parameters for pstore.

Tracked-On: #1024
Signed-off-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2018-10-25 13:43:25 +08:00
xiaojin2 6d076caaa6 tools: acrn-crashlog: remove unsafe apis in usercrash
Since strlen/vsnprintf/ato* api are not safe, so use strnlen instead of
strlen, use vasprintf instead of vsnprintf and use strtol instead of
atoi.

Tracked-On: #1254
Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Huang Yonghua <yonghua.huang@intel.com>
Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-10-25 13:43:04 +08:00
Yonghua Huang 8f7fa50d5a hv: fix mapping between GSI Num#2 and PIC IRQ #0
route GSI number#2 to PIC IRQ#0, as by default IRQ for
 8254 timer is connected to I/O APIC Pin #2 and PIC Pin #0

Tracked-On: #861
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:42:45 +08:00
Binbin Wu 96f8becca6 dm: bios: update vSBL to v1.0
New feature:
	Update vFastboot to v1.0
	Boot time optimization
	Support Crash mode, which uses vFastboot in vSBL as Crash mode target.
	Support Ramooops.

Tracked-On: #968, #1578, #1579, #1580
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2018-10-25 13:42:12 +08:00
Sainath Grandhi 09193c3913 hv: x2apic support for acrn
All the platforms supported by ACRN supports x2APIC. So enabled
x2APIC for ACRN hv. Removed any code that is needed for xAPIC mode
of operation.

Tracked-On: #1455
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed by:  Yonghua Huang <yonghua.huang@intel.com>
2018-10-25 13:41:29 +08:00
Jason Chen CJ 19abb419c6 launch_uos.sh: make sure cpu offline by retry
if acrnd or acrn_guest service enabled, launch_uos.sh will be called
early time during system boot up, while a pci driver module may be
insmod and disable cpu hotplug in short time, which could make
cpu offline fail, we need check it to make sure cpu offline real happen
before hypercall to disable vcpu.

Tracked-On: https://github.com/projectacrn/acrn-hypervisor/issues/1584
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-10-25 13:37:43 +08:00
Minggui Cao 241d5a684e HV: fix bug by improving intr delay timer handling
1. it need delete intr delay timer when its ptdev entry
is deactivated to avoid the timer still active;

2. if the dequeued entry will be added by delay timer,
it need reset current variable "entry" to find next one,
or it could be returned and handled (if it is the last one)
, then the entry's IRQ can come again, and it'll cause its
timer added twice.

Tracked-On: #1476
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:30:47 +08:00
Minggui Cao 4228c81b3f DM: compare unsigned numbers to avoid overflow.
compare the two unsigned numbers to avoid delta calculation overflow.
It could happen during UOS warm root, which can trigger a "fake"
interrupt storm.

Tracked-On: #1476
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:30:47 +08:00
Kaige Fu d29937374a tools: acrnd: Stop all vms when SOS shutdown/reboot
When SOS shutdown/reboot, systemd will send SIGTERM to acrnd. We should catch up
this signal and stop all vms gracefully.

BTW, this path also fix the following error when stop acrnd service by removing
ExecStop config. Systemd will send SIGTERM signal to process by default.

systemd[9378]: acrnd.service: Failed to execute command: No such file or directory
systemd[9378]: acrnd.service: Failed at step EXEC spawning /usr/bin/killall: No such file or directory
-- Subject: Process /usr/bin/killall could not be executed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /usr/bin/killall could not be executed and failed.
--
-- The error number returned by this process is 2.

Tracked-On: #1563
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
2018-10-25 13:30:14 +08:00
Junjie Mao 7b06be9e2c HV: checkpatch: add configurations to customize checkpatch.pl
ACRN hypervisor follows MISRA-C which has some inconsistencies with the Linux
kernel coding style. Namely,

    * Braces are required even for single-statement blocks.
    * Zero-initialisers to global variables are allowed.
    * Line limit is 120 instead of 80.

This patch adds a .checkpatch.conf so that checkpatch.pl stops warning on the
exceptions above when invoked under the root directory of the acrn-hypervisor
repository.

The coding style documentation is updated accordingly.

Tracked-On: #1557
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2018-10-24 18:20:36 +08:00
Jie Deng 7195537a6b dm: virtio-net: replace banned functions
sscanf and strcpy are banned according to the security requirements.
So replace them with their safe alternative.

Tracked-on: #1496
Signed-off-by: Jie Deng <jie.deng@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-24 18:16:37 +08:00
Jie Deng 7579678dd6 dm: add const declaration for dm_strto* APIs
These APIs are wrap of standard strto* APIs. The first parameters in
these APIs should be declared as "const" since they have never been
changed so that they can also be used when passing a variable declared
as const char *

Fixes: e1dab512c2 ("dm: add string convert API")
Tracked-on: #1496

Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-24 18:16:37 +08:00
Huang, Yang bd97e5cbe2 dm: rpmb: Support RPMB mode config from launch.sh
physical RPMB is accessed if "phisycal_rpmb" is specified
in launch.sh.
Also it reserves some RPMB area with a fixed size(32KB) for
AttKB and future usage, which is RO for UOS.

Tracked-On: #1544
Signed-off-by: Huang, Yang <yang.huang@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-10-24 18:15:14 +08:00
Huihuang Shi 107eaa3ab0 HV:fix MACRO value mismatch
The commit id "c5f4c5" translats from enum to macro, the content
is not correct,fixed now.

Tracked-On: #1553
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
2018-10-24 18:13:57 +08:00
yuhong.tao@intel.com a853c05546 tools: acrnctl: fix: resume default wakeup reason is CBC_WK_RSN_BTN
UOS requires an wakeup reason when resumed from S3 suspend. If user
use "acrnctl resume [VMNAME]" without an reason, 0x0 will be used
as default reason, and this is not work. We can use CBC_WK_RSN_BTN
instead.

Tracked-On: #1550
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
2018-10-24 18:13:10 +08:00
Zide Chen a6677e6e69 hv: create new file core.c and pci.c
- move the functions to access physical PCI configuration space from
  pci_pt.c to the new file dm/hw/pci.c, so they can be accessed in
  sharing mode as well. The new folder dm/hw is created in order to
  move APIs talking to physical PCI devices out of dm/vpci.
- move the common vpci code from header file pci_priv.h to core.c.
- move file include/dm/vpci/vpci.h one level up. It seems the folder
  include/dm/vpci is not necessary.
- This patch only moves code around, and doesn't make any logical
  changes. Besides removes the static keyword from pci_pdev_read_cfg()
  and pci_pdev_write_cfg()

Tracked-On: #1568
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-10-24 18:11:02 +08:00
Zide Chen 4741fcfff2 hv: pci_priv.h code cleanup
- move most of the content of pci_priv.h to include/dm/pci.h.
  This allows other code outside dm/vpci to be able to share these macros.
- code cleanup: fix alignments etc.

Tracked-On: #1568
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-10-24 18:11:02 +08:00
Li, Fei1 a43ff9ce98 hv: timer: add debug information for add_timer
If a timer added more than once, assert the debug information.

Tracked-On: #1546
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-10-23 11:40:38 +08:00
Signed-off-by: Aviad Nissel 7ca1a7de7d dm: launch_uos.sh add virtio_mei mediator
Detect if SOS kernel mei drivers supports virtualization,
via driver hbm version 2.2
If yes use virtio_mei mediator for the mei device
otherwise fallback to passthrou mode.
Note that HBM version is not sufficient identification

Tracked-On: #1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 201e5cec0a dm: mei: enable virtio_mei compilation
Add virtio_mei to the Makefile

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler d4b9bd599d dm: mei: add module initialization
Register virtio device virtio-mei.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Tracked-On: #1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler f6e6e8584e dm: mei: implement vmei_start/stop()
In vmei_start() the HBM host client is created,
it handles HBM protocol.
The HBM client is a management object and
is not exposed by the mei native driver.
The communication between TX and RX threads
is handed via internal pipe(2).
Second, we connect all fixed address clients as the mei
protocol doesn't provide connection mechanism for them,
they appear always connected.
Last, the hw_ready is set.

Define virtio_mei_ops, ass all the handlers are now available.

Tracked-On: #1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 6a1f824229 dm: mei: implement rx flow.
Rx is triggered from epoll event (mevent), a host client
is retrieved from associated event data. P proper mei message header is
attached to the packet and sent to the virtio FE device.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 50ecd93b24 dm: mei: implement tx flow
TX from virtio driver is handled firt via
virio tx notify handler vmei_notify_tx(),
placed into host clinet tx circular buffer.
TX thread will then write the data to the device.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 483a893e57 dm: mei: implement HBM protocol handler
Implement the FW part of the HBM protocol.
Currently the support version is 2.0.
The HBM protocol handles client management, such
initialization handshake, connection, power management,
and the flow control.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 98c6b7a692 dm: mei: add native io handlers
Add read write and connect handler,
that perform io peration on SOS /dev/meiX
device.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 3abbf10e55 dm: mei: add me clients enumeration
ME client enumeration is received from sysfs attributes
of the native device.

V3: Use bounded functions.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 7cbb3872a2 dm: mei: add virtio cfgread/cfgwrite handlers.
mei mediator perform reset handshake via
the cfgread/write handlers and provide access
to fw status registers.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Signed-off-by: Aviad Nissel f462601b0a dm: mei: add reset handlers
There are multiple types of resets that need to be handled
by the mei device.
The reset may be initiated from both sides host or fw.
The host requests reset on probe and remove,
power state transaction, and errors,
while ME FW may request reset upon error.
If the native device undergo reset the host application
has to be notified.

Tracked-On: #1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler a632ac3dae dm: mei: add client management infrastructure
1. virtio_mei structure represents an instance of mei device.
2. vmei_me_client represents an ME application in the MEI FW.
3. vmei_host_client represent a host application talking to the
ME application, ME application can support multiple connections.
4. Add debug helpers

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 445f419304 dm: mei: add virtio configuration
The virtio has two virtio queues, TX and RX.
TX have two segment buffers one for header and one for data.
The virtio_mei declares host buffer of size 128 slots, each
slot is a 4 bytes value.
For synchronization hw_ready and host_reset configuration flags
are used that emulates mei reset flow.
And last fw status registers must be also readable via virtio
mei device.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 0dc7adfbac dm: mei: add sysfs read functions
mei requires reading of u8, u32 and uuid
sysfs files.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler b8d53d17d5 dm: mei: add reference counter functions
mei handles objects on the list, hence reference counting
infrastructure is required for easier multithreading.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 6a96878e0b dm: types: add container_of macro
Add standard container_of macro to access
the parent struct pointer.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Alexander Usyskin 4e057c32d2 dm: mei: add guid handling functions
libuuid sports only uuid (big endian encoding),
though mei requires guids (little endian encoding).
The base types are based on <linux/uuid.h> header.

Tracked-On: #1536
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00