Commit Graph

1303 Commits

Author SHA1 Message Date
Yan, Like 3d6ff0e5f4 tools: acrntrace: save trace data file under current dir by default
Current implementation save trace data files on tmpfs by default, acrntrace
would use up all the physical mem, which can affect system functioning.
This commit changes default location for trace data file to current dir, and
removes the codes for space reservation, which is not necessary.

Signed-off-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
2018-07-25 12:03:41 +08:00
David B. Kinder 3abfdbab72 doc: add script for syncing acrn-kernel for API gen
API doc generation includes kernel components provided by ACRN that live
in the acrn-kernel repo (not the acrn-hypervisor repo). We need to
include fetching the latest acrn-kernel sources when we do doc
generation, and update the documentation to mention we now need the
acrn-kernel repo as a sibling folder for the acrn-hypervisor repo
contents.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-07-24 17:20:43 -07:00
Xiangyang Wu 363a84c7b8 DOC:GSG: Fix few mistakes about updating acrn.conf and efibootmgr options
During setting up ACRN hypervisor, SOS and UOC on the
intel® NUC (NUC6CAYH) board, there are few mistakes
about updating acrn.conf and efibootmgr options, this
will lead to fail to set up ACRN hypervisor, SOS and UOS
on the NUC.

About updating acrn.conf, add "hugepagesz=1G hugepages=2"
About efibootmgr options, string parameter of option "-L"
needs to add double quotation marks; "uart=disabled" in
the option "-u" since there is no serial port on NUC.

Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
2018-07-24 09:04:35 -07:00
Victor Sun f18a02ac61 HV: misra cleanup for platform acpi info
- fix misra integral type violations;

- change struct initilization style to make code more readable;

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-24 13:45:43 +08:00
Victor Sun ee13110278 HV: change wake vector address to accommodate sbl
- The previous wake vector address just work for ABL, need to change it
  to accommodate the latest SBL;

- Fix wrong bit width value in the pm1a gas;

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-24 13:45:43 +08:00
Xinyun Liu 4344832700 Revert "DM sample: force enabling HDMI1 and HDMI2 connectors"
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>
2018-07-24 12:49:31 +08:00
Li, Fei1 f7f04ba67f hv: mmu: minor fix about hv mmu && ept modify
1. fix some description for hv mmu_modify
2. add pml4_page input parameter for ept_mr_modify to keep align with
ept_mr_add and ept_mr_del which will support add or delete MR for trusty.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-24 12:48:45 +08:00
Li, Fei1 502e3e2e65 hv: mmu: refine set guest memory region API
1. rename set_vm_memmap to set_vm_memory_region
2. split ept_mmap into ept_mr_add and ept_mr_del

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-24 12:48:45 +08:00
Xiangyang Wu 27fbf9b215 HV:treewide:Fixing pointer castings
In the hypervisor, there are many casts from
an void pointer to integer pointer, then from
integer pointer to structure pointer.
These pointer castings are detected by static analysis
tool. All pointer casts are violations, There are
some duplicated pointer cast. This will make deviation
analysis complex.
BTW, there are one useless pointer casting and one
wrong pointer casting in the hypervisor.

Remvoe duplicated pointer casts to make deviation analysis
simple;
Remove one useless pointer casting;
Update one wrong pointer casting.

Note: There are many void type pointer casts, non-void type
pointer is casted to void type pointer, char type pointer casts,
non-char type pointer is casted to char type pointer. These pointer
casting is need by the memory management module, IO moudle etc.
Deviation analysis will be made and recoded in the analysis report.

V1-->V2:
	Fix mixing pointer and array voilation.
V2-->V3:
	Remvoe pointer casting from integer pointer into
	non-void/non-char pointer directly;
	Remove redundant type conversion.

Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-07-24 10:56:24 +08:00
Zide Chen a368b57eca hv: fix typo in relocation code
Fixed a typo in 621425da20 ("hv: further fix to configurable
relocation"). It shoud allocate fixed address if CONFIG_RELOC is
not defined.
2018-07-24 10:17:01 +08:00
Junjie Mao b35e330995 HV: make: check CONFIG_RELEASE=y for release build
Currently we reply on CONFIG_RELEASE=n to determine if a debug version should be
built. Though this holds due to the configuration overriding in kconfig.mk, this
only applies to make >= 3.82. For make 3.81, $(eval $(call xxx)) does not work
as expected, and thus CONFIG_RELEASE is undefined for debug builds.

Instead of checking CONFIG_RELEASE=n, this patch checks CONFIG_RELEASE=y
instead, which is guaranteed without relying on the behavior of $(eval $(call
xxx)).

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2018-07-24 10:11:30 +08:00
Yang, Yu-chu da0f28c6de HV: Bracket for the same level of precendence
The plus and minor have the same level of precedence. The Misra-C
considers it as a violation. Added brackets in between addition and
substraction oprators.

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-24 10:10:39 +08:00
Yang, Yu-chu 91337da5a1 HV: logical and high level precedence expression needs brackets
Added brackets for expression to make it easy to understand and
reduce the mistake of precedence. The rule is applied to the
mixed same level of prevedence opeartors, high level presedence
operators and logical expression.

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-24 10:10:39 +08:00
Yang, Yu-chu 7aec6799a1 HV: Clean up the unused or legacy code-like comment
Removed comment out unused code in vmexit.c, sprintf.c and vmcall.c
Minor fix in vmx.c to prevent Misra-c consider it as a piece of
code.

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-24 10:10:39 +08:00
David B. Kinder c776137169 doc: fix doc error filter patterns
Changes to hypercall.h altered the error pattern match used to decide if
doxygen errors are "expected".  Update the pattern match.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-07-23 10:42:55 -07:00
Shiqing Gao fb8bce1ba7 hv: treewide: fix 'Array has no bounds specified'
- explicitly declare the array size to fix the violation 'Array has no
  bounds specified'

- minor changes for comments style

v1 -> v2:
 * add the definition for exit reasons from 0x39 to 0x40 based on "SDM
    APPENDIX C VMX BASIC EXIT REASONS"

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-23 12:00:46 +08:00
Victor Sun af194bcd00 HV: fix bug of restore rsp context
We should use movq to restore rsp instead of mov.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-23 10:37:13 +08:00
Binbin Wu 4fd870f718 hv: efi: remove multiple defined struct efi_ctx & dt_addr_t
In current code, struct efi_ctx and dt_addr_t are defined in two places.
This patch removes one copy of the definitions.

Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Jack Ren <jack.ren@intel.com>
2018-07-23 10:35:32 +08:00
Zide Chen d5be735978 hv: correct the way to check if a MSR is a fixed MTRR register
The fixed MTRR MSR numbers are not contiguous, so it's not correct
to justify it by checking if it falls in certain range.

This patch fixes this issue by removing is_fixed_range_mtrr()
and use get_index_of_fixed_mtrr() to loop fixed_mtrr_map[]
and compare individual MSR values.

Also removed the unused function get_subrange_end_of_fixed_mtrr()

Signed-off-by: Zide Chen <zide.chen@intel.com>
2018-07-23 10:34:47 +08:00
Huihuang Shi bd6979925c fix assign.c interger violations
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>
2018-07-23 10:31:57 +08:00
Junjie Mao f0a3585ebf HV: common: cleanup of remaining integral-type issues
This is the final cleanup of the integral type related issues, reported by the
static checker, under common/, mostly including

    * make explicit the narrowings of vm_ids passed by register.
    * work around the confusion of the static checker by abstracting
      sub-expressions to local variables.

The remaining reports that are not trivial to suppress will be in the scope of a
separate document.

v1 -> v2:

    * Instead of converting vm_ids inside hcall_xxx, update the prototypes of
      these functions and do the conversion in vmcall_vmexit_handler.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-23 10:23:49 +08:00
Junjie Mao 112b5b820c HV: guest: cleanup of remaining integral type violations
Clean up most reported integral-type-related violations still existing under
arch/x86/guest/. The remaining reports that are not trivial to suppress will be
explained in separate documents.

Also move acpi_info outside acrn_common.h as the structure is no longer shared
with DM.

v1 -> v2:

    * Move struct acpi_info to bsp_extern.h

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-23 10:23:49 +08:00
Junjie Mao 1a1ee93656 HV: hypercall: make hypercall functions return int32_t
The error code in the hypervisor is 32-bit signed integers. To reduce implicit
conversions, this patch make hcall_xxx returns int32_t, and finally converts it
to uint64_t when assigned to rax whose semantics is properly defined in C99.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-23 10:23:49 +08:00
Junjie Mao ad73bb511c HV: treewide: unify the type of bit-field members
Qualified or unqualified int or bool are the only types allowed for bit-field
members in C99, and MISRA C further forbids using plain int.

Use uint32_t (which is equivalent to unsigned int) for all bit-field members.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-23 10:23:49 +08:00
Huihuang Shi c0b55cdf1b HV:vtd:fix all integer related violations
Fix vtd.h and vtd.c all integer violations.

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-07-23 10:22:32 +08:00
Huihuang Shi 4c941ed47b HV:vtd.h fixed inline function violations
Inline function have some violations with parentheses
and return type casting.Fixed it.

V1->V2:modified the parameter to ther letter case
V2->V3:move the delcaration to the inner and reduce suffix UL to U

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-23 10:22:32 +08:00
Huihuang Shi a17653b3cc HV:transfer DMAR_[GS]ET_BITSLICE to inline function
Transfer DMAR_[GS]ET_BITSLICE to inline function
to limit the parameter type and return type.

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-07-23 10:22:32 +08:00
David B. Kinder e2ad788f63 doc: clean up tools docs
Made the titles consistent across the tools (some had capital letters).
Fixed heading levels in acrnctl/acrnd doc  (had two H1 headings).
Changed a text-based drawing to use graphviz.
Some general grammar tweaks as well.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-07-20 11:42:21 -07:00
Shuo Liu 38b9b7d37c HV: cpuid: Disable Intel RDT for guest OS
Now the Intel RDT emulation is working in progress. So disable it
for temporary solution to avoid guest OS running with incorrect RDT
configuration.

Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-20 11:59:56 +08:00
Xiaoguang Wu 9ac1be2c5e DM USB: enable isochronous transfer
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu b95f93927b DM USB: temporary solution for corner case of control transfer
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu 3389e83177 DM USB: add some BCD codes
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu b9597d4fa8 DM USB: xHCI: add microframe index(MFINDEX) register emulation support
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu a49d483cd0 DM USB: process LIBUSB_TRANSFER_STALL error
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu 640d896508 DM USB: change TRB ring processing logic for ISOC transfer
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu d24213db2d DM USB: xHCI: fix xhci speed emulation logic
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu d6cc701c89 DM USB: refine logic of toggling interface state
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu 531712405e DM USB: xHCI: add support for USB 3.0 devices
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu 8317dea64c DM USB: fix guest kernel short packets warning
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu 7431a9021c DM USB: add code for error processing
add error processing logic for error code from libusb.

Change-Id: I39883ddcb0ad80bcd8304b887cd4d2f32da3fa22
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu 00fbfd6da3 DM USB: fix an USB endpoint reset flow issue
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu cb938870b4 DM USB: modify some logs to help debug
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>
2018-07-20 10:42:34 +08:00
Xiaoguang Wu aecb67bcea DM USB: support multiple interfaces USB device
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>
2018-07-20 10:42:34 +08:00
Li, Fei1 38e2e45d83 hv: ept: move EPT PML4 table allocation to create_vm
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-20 10:40:32 +08:00
Li, Fei1 1815a1bb01 hv: ept: store virtual address of EPT PML4 table
Most of the time, we use the virtual address of EPT PMl4 table,
not physical address.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-20 10:40:32 +08:00
Minggui Cao 23a5c74ac7 HV: handle integral issues as MISRA-C report
mainly focus on: like U/UL as unsigned suffix;
char and int mix usage; also change some function's params
for data type consistent.

Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-20 10:39:46 +08:00
Shiqing Gao 0252ae9e11 hv: treewide: fix 'No definition in system for prototyped procedure'
- Remove those APIs without definition

- Minor changes to make sure the line length is less than 80

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-20 10:38:32 +08:00
Xiangyang Wu d28fff2b06 HV:treewide:Update the type of return value and parameters of atomic operations
There are many type conversions in the atomic
operations invoking reported by static analysis tool. These
type conversions voilate MISRA C.

To keep uniform naming convention, rename atomic operation
function names:
atomic_set_int/long --> atomic_set32/64;
atomic_clear_int/long --> atomic_clear32/64;
atomic_load --> atomic_load32;
atomic_store --> atomic_store32;
atomic_swap --> atomic_swap32;
atomic_readandclear --> atomic_readandclear32;
atomic_inc --> atomic_inc32;
atomic_dec --> atomic_dec32;
atomic_cmpxchg --> atomic_cmpxchg32;
atomic_xadd --> atomic_xadd32.
Update the type of atomic_load32/64, atomic_store32/64,
atomic_swap32/64, atomic_cmpxchg32/6.
Update related variables and callers.

Note: the type of return value and parameters of atomic_xadd32/64
still keep signed int/long since caller pass
negative variable to atomic_xadd32/64;

V1-->V2:
	Add comments for atomic_set/clear to differ from
	bitmap_set/clear.

Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Reviewed-by: Junjie.Mao <junjie.mao@intel.com>
2018-07-19 14:39:47 +08:00
Yan, Like 3aa7d59497 hv: check eptp value before calling free_ept_mem()
There is chance to destroy vm whose ept table was not created, for
example, dm fails to setup mem for vm. In this case, it's better
to check the value of eptp before calling free_ept_mem() rather than
relying on assertion in the function.

Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-07-19 14:39:18 +08:00
Junjie Mao 3571afc683 HV: hypercall: revisit types in structure parameters
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>
2018-07-19 14:38:15 +08:00