It is necessary to notify the VHM and hypervisor on the completion of a VHM
request even when the UOS is in suspend or system reset mode because the VHM and
hypervisor rely on the notification to reset their own states on the
request.
Currently the VHM request state is checked against REQ_STATE_PROCESSING instead
of REQ_STATE_COMPLETE when handling system reset or suspend/resume, leading to a
completed request unnotified, and causing the HV to complain on an occupied VHM
request when it raises a new one.
This patch fixes this issue by properly notifying completed requests to the VHM
& hypervisor. Some concerns are raised during a discussion on the potential
races which does not hurt for now but may in the future. These considerations
and potential solutions are documented as comments for future reference.
Tracked-On: #895
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
there is no git repo, which download from github release,
however, acrn-dm -v will get tag info from this repo, in
such case, the tag info was null.
this patch will fix nul tag, which get it from CL mock build.
Tracked-On: #676
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
some exceptions can happen if westnon or network name service
not started before launch uos guest, like gvt and network exceptions,
which can cause SOS reboot. so add the dependency.
add data partiton check in launch script, for it can be called in every
clearlinux platform.
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
This is the counterpart in DM to the VHM request state update in the
hypervisor. Major changes include:
* Remove accesses to the obsolete 'valid' member.
* Access the 'processed' member using atomic operations.
* Sync the documentation on vhm_request.
In addition, the new state transition also requires a VHM request to be always
handled properly, as there is no 'FAILED' state any more. Instead of crashing
the device model (and thus the UOS as well), the device model should return all
1s or ignore the request when it is to load from or store to an invalid address,
respectively.
Note: there is an issue in vm_system_reset() and vm_suspend_resume() where
completed VHM requests are not properly notified, causing the hypervisor to
complain as it sees uncompleted requests while trying to create a new one. This
issue will be resolved in a separate patch.
v1 -> v2:
* Use macro-defined constants for the default values for invalid PIO/MMIO
reads.
* Change the return type of vmexit_handler_t in DM to void as the return
values are no longer necessary.
* Remove VM_EXITCODE that are no longer used.
Tracked-On: #875
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This patch introduces wrappers to the built-in atomic operations provided by
gcc.
There are two sets of built-in atomic functions available. Before gcc 4.7.0 only
the __sync built-in functions are available, while since 4.7.0 a new set of
built-in functions with the __atomic prefix is introduced as a
replacement. Since the __sync functions will eventually be deprecated, the
__atomic ones are preferred whenever available.
The interfaces provided are listed below, mostly following the naming of the
underlying built-in functions which explain themselves.
atomic_load
atomic_store
atomic_xchg
atomic_cmpxchg
atomic_add_fetch
atomic_sub_fetch
atomic_and_fetch
atomic_xor_fetch
atomic_or_fetch
atomic_nand_fetch
atomic_fetch_add
atomic_fetch_sub
atomic_fetch_and
atomic_fetch_xor
atomic_fetch_or
atomic_fetch_nand
atomic_test_and_set
atomic_clear
atomic_thread_fence
atomic_signal_fence
Tracked-On: #875
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This patch resolves one arcn-dm crash issue when rebooting UOS.
The rootcause is that uart releases unopened backend tty.
One reproduced case is that the board does not support IOC but IOC
feature is enabled in the acrn-dm. After rebooting UOS, crash will
happen.
NOTE: This issue is not related to IOC, it also can be reproduced
with NON-IOC scenario. Just set one invalid PTY to the lpc, then
this issue should be reproduced.
We need re-visit the whole policy for such scenario in future.
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
mevent is added only if uart backend fd refers TTY in uart_opentty.
So we should only delete mevent if uart backend fd refers TTY in uart_closetty.
This issue can be reproduced by below steps
1) acrnd starts UOS
2) run poweroff command in UOS
3) crash happens
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
According to ACPI spec, when system back to working mode from
S3, WAK_STS bit (15) should be set.
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
We do:
- pause target vm
- suspend all virtual devices
- wait for resume notification
- resume all virtual devices
- reset target vm
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
When guest enter/exit S3, we need to do
1. stop watchdog timer when guest enter S3 to avoid watchdog
timer reset guest when guest is in S3 state.
2. reset watchdog timer when guest exit from S3.
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Then, acrnctl could send command to monitor module of DM and call
functions defined in pm ops. One example is: acrnctl resume UOS
after UOS enter S3.
Also add general pm.c and move pm related function to this file.
Signed-off-by: Yan Like <like.yan@intel.com>
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This patch adds new signals about parking brake and Hvac in the signal
definition and signal whitelist.
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Update vSBL with the following new features:
Support watchdog status report when boot.
Update vFastboot version to 0.8
Add a changelog file.
Add a md5sum file of vSBL images.
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
This patch resolves IOC mediator deinit function is blocked due to IOC mediator
core thread enters into sleep by epoll_wait, then pthread_join cannot return.
Trigger an event to wakeup core thread when IOC mediator deinit is invoked.
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
this patch fixes such an information leaking issue:
in case that after a UOS is destroyed, its memroy
will be reclaimed and maybe re-allocated for a new UOS,
then the previous UOS sensitive data in memory may
be leaked to the new UOS.
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
add acrn_guest.service, and modify makefile to install it
into root fs.
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
it can auto check android image, if exists, then launch it;
if not, it will try to luanch clearlinux. it can be used by
acrn_guest.service to auto boot UOS.
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
offline SOS cpus except BSP to let them free for UOS cpu allocation
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
after enable all cpus during sos bootup, there should not be maxcpus option
here
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This reverts commit 47116e8c4b.
if eDP panel connected, something wrong happens:
eDP HDMI1 HDMI2
---------------------------------------------------------
SOS UOS1 UOS1 Good.
SOS UOS1 BAD. SOS is OK. NO show in HDMI1
SOS UOS1 BAD. SOS is OK. NO show in HDMI2
SOS BAD.
This is also a temp solution: if only HDMI2 is connected, SOS will be
shown on HDMI2. But UOS1 is expected in some cases.
Signed-off-by: Xinyun Liu <xinyun.liu@intel.com>
Reviewed-by: Min He <min.he@intel.com>
fix all assign.c integer violations except related
"Implicit conversion: actual to formal param".
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Enable isochronous transfer to support related USB devices
Change-Id: Id9fe0714e937fafc47de090ba6d349713cbe1b8b
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
In the process of implementation for USB isochronous transfer, the
timeout (100ms) is not enough for Plantronics USB headset. So pass
longer timeout (300ms) to function libusb_control_transfer will
make USB headset of Plantronics work.
This change only results a longer execution time in ENUMERATION process
for few devices like Plantronics USB headset which need more time to do
its internal operations. For most USB devices, time less than 100ms are
enough to complete the execution of libusb_control_transfer. So basically
it will not affect the whole system performance.
In the long term, a better solution (eg: async control transfer) will be
introduced to replace current implementation.
Change-Id: I380e0cc337ec5741b1e4ce989abacce826b7dde4
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
BCD code is USB Specification Release Number in Binaray-Coded
Decimal. Add some BCD codes for some USB devices.
Change-Id: I40f04ef2ebaf5b0da554ff8f432415e8e3cebe01
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Add microframe index register support, which is an important timing
component for isochronous transport.
Change-Id: I615664275b539cfb713d7795edd3f213b0302b92
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Handle the LIBUSB_TRANSFER_STALL error comes from libusb.
Change-Id: Id6911e9aaffafb256def5265a0ed9778b147d99a
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Current ring buffer processing logic assumes every transaction
will be submited to physical device before next transaction
coming. So it use two states 0 (free) and 1 (used) to represent
the state of every data block in the ring buffer. With the help
of the two state, the ring buffer could accept and process data
normally.
But this logic is not proper for ISOC transfer, which generally
submits many transactions even none of them arrive the physical
device. So this patch uses three values to represent the state
of data block in the ring buffer:
USB_XFER_BLK_FREE: this block could be filled with new data;
USB_XFER_BLK_HANDLING: this block is submited to physical device
but response from device is still not received;
USB_XFER_BLK_HANDLED: this block has been processed by physical
device.
The new logic will do different things for each state, which will
make the ISOC transfer work successfully.
Change-Id: I5559cae24c739633289742d64dd51751797b81a7
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
The xHCI speed emulation is not right, which will cause failure
during enumeration of certain USB device. This patch is used to
fix it.
Change-Id: I2d996298983882ed6921a75a10dec9e8684a393e
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Refine the logic of usb interface state transition.
The libusb uses two pair of APIs to deal with usb interface:
1. libusb_claim_interface & libusb_detach_kernel_driver;
2. libusb_release_interface & libusb_attach_kernel_driver.
The calling sequences of those APIs are very important, so this
patch add some error handling code to make this process more
robust.
Change-Id: I0f7950aae806dee9a21f16cc293f51609eede0d8
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This patch is used to add support for USB 3.0 devices. Currently
USB 3.0 disk is supported and tested successfully.
Change-Id: I3fbfbe9c28bc4b14af0417104f8fa822f9758908
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
There are many 'short packet' warnings in the UOS kernel dmesg output,
which are result from bad short packet identification algorithm. This
patch is used to fix it.
Change-Id: Idfa0b87fc96893b80d5c9fe8dab4db35aa5bfe84
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Original code will reset the whole USB device when xHCI Reset
Endpoint command is received, this behavior is not right. This
patch is used to fix it.
And according to xhci spec 4.6.8, if the endpoint is not in the
halted state, xHC should reject to execute this command and the
Context State Error should be returned. This patch also add this
logic.
Change-Id: I55a5918148d82d103fb3eb27d582f9676f9f61d3
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Mainly change the logs for transfer submission and completion,
which are very important parts in USB emulation code.
Change-Id: I4e04f1426e164ca3693e70946ed51380201e49ee
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This patch correct the USB request type which set wrong direction in
original code. It caused these important usb control transfer packets
send to phsical USB devices via libusb_control_transfer instead of
calling standard libusb APIs, likes libusb_set_configuration. From
libusb document, this is not the correct way:
"You should always use this function rather than formulating your own
SET_CONFIGURATION control request. This is because the underlying
operating system needs to know when such changes happen."
Change-Id: I7a6aade326220bee3b685086584920dacd37f87c
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
While fixing the MISRA C violations related to integral types, we have unified
the type of the following data:
uint8_t:
phys_pin, virt_pin, vpic_pin, ioapic_pin, vioapic_pin
uint16_t:
vm_id, pcpu_id, vcpu_id, vpid
uint32_t:
vector, irq
This patch revisits the types of the fields in vhm_request as well as the
structures used as parameters in the hypercalls, and make them aligned with the
types the hypervisor uses for such data. Reserved fields are added to keep the
size and layout of the structures. Implicit paddings are also made explicit as
reserved fields.
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
acrn-manager message structure has a flexible member
payload[0], that risks to out-of-boundary memory access,
and usage of uninitialized variable.
And the req/ack message pairs has various types, which
extend mngr_msg. mngr_send_msg() requires programmer cast
the type of input messages to struct mngr_msg, that is
inconvenient.
We replace payload[0] with an union, which contains all
payload data. So that type cast for mngr_send_msg() is no
longer needed. And we can avoid potential out-of-boundary
memory accessing and using of uninitialized variable
Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
fix integer type violations,keep some violations which
related to hypcall and msix_entry_index.
V1->V2:1.modified API_MAJOR_VERSION from Makefile
2.sync acrn_common.h changed to device model
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This function add high level reset_vdev function. Which is
implemented to call deinit/init pairing to emulate the virtual
device reset operation.
This patch also add the system reset which keep the UOS RAM
content functionality to DM.
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Guest has erquirement to support system/full reboot and S3. Which could
trigger different reset path in guest
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
GUEST_CFG_OFFSET is used to pass the memory top info from DM
to HV. The address should be in E820 reserved range to prevent
guest use it for other purpose.
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
We should keep variable name in function declaration. It makes
things clearer and easier to be understood.
Signed-off-by: Jie Deng <jie.deng@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
There has one new DRD driver followed usb role framework which is just
upstreamed to Linux community. This patch updates the xHCI DM to be
compatible with it. DM DRD code follows DRD spec to implement and make
it more reasonable.
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>