Since PR #7113 has landed, we also remove PLATFORM_RAM_SIZE in the related
Python code, schema and all existing scenario XML files.
Tracked-On: #6690
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
With the launch script generation script rewritten, some other files under
launch_config are no longer used. This patch removes these obsoleted files.
Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
The launch script generator today (and the scripts that it generates) is
fundamentally built on the concept of PCI device classes, with the
restriction that at most one PCI function per class can be passed through
to a post-launched VM. This has put inproper constraint on the scenarios
users can set up, especially on server platforms or those with SR-IOV
capable devices.
As it is too tedious to change such deep-rooted concept, this patch
rewrites the launch script generator and refines the structure of the
generated scripts so that PCI functions are identified only by their
BDF.
This change serves as a mandatory step to align the way how passthrough
devices are configured for pre-launched and post-launched VMs, which
eventually allows us to present a unified view in the configurator for
assigning passthrough device.
v2 -> v3:
* Rename sos_id to service_vm_id and user_vmid to user_vm_id.
* Refine a couple of info messages in the launch script template.
v1 -> v2:
* Fix wording issues identified during review.
* Exit when the out_dir is an existing regular file.
Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
When the virtio-XXX pci devices fall back to legacy PCI intx,
the pci_irq_assert is called to inject the interrupt and then
the pci_irq_deassert is used to mark the completion of PCI interrupt.
Currently the HV vIOAPIC uses the pin_state for the interrupt injection
of legacy PCI intx. In such case it will fail to inject the PCI legacy
intx and the guest system fails to be booted when adding the boot option
of "pci=nomsi".
PCI legacy INTx usually use active low level trigger mode as it is Open-Drain
state and allows multitple interrupt signals to share a single line.
https://wiki.osdev.org/PCI_Local_Bus_Signals
In such case DM needs to set the correct state for the PCI device so that the
HV vIOAPIC can help to inject the PCI legacy intx.
BTW: When the MSI/MSIX is used for PCI device, it uses another mechanism
to inject the interrupt. It is harmless to configure the initial state.
Tracked-On: #7124
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
'mevent_lmutex' is initialized as default type,
while attempting to recursively lock on this
kind of mutext results in undefined behaviour.
Recursively lock on 'mevent_lmutex' can be detected
in mevent thread when user tries to trigger system
reset from user VM, in this case, user VM reboot hang.
The backtrace for this issue:
#1 in mevent_qlock () at core/mevent.c:93
#2 in mevent_delete_even at core/mevent.c:357
===>Recursively LOCK
#3 in mevent_delete_close at core/mevent.c:387
#4 in acrn_timer_deinit at core/timer.c:106
#5 in virtio_reset_dev at hw/pci/virtio/virtio.c:171
#6 in virtio_console_reset at
hw/pci/virtio/virtio_console.c:196
#7 in virtio_console_destroy at
hw/pci/virtio/virtio_console.c:1015
#8 in virtio_console_teardown_backend at
hw/pci/virtio/virtio_console.c:1042
#9 in mevent_drain_del_list () at
core/mevent.c:348 ===> 1st LOCK
#10 in mevent_dispatch () at core/mevent.c:472
#11 in main at core/main.c:1110
So the root cause is:
mevent_mutex lock is recursively locked by mevent thread
itself (#9 for this first lock and #2 for recursively lock),
which is not allowed for mutex with default attribute.
This patch changes the mutex type of 'mevent_lmutex'
from default to "PTHREAD_MUTEX_RECURSIVE", because
recrusively lock shall be allowed as user of mevent
may call mevent functions (where mutex lock maybe required)
in teardown callbacks.
Tracked-On: #7133
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This patch adds ENOTTY and ENOSYS to indicate undefined and obsoleted
request hyercall respectively, and uses ENOTTY as error code for undefined
hypercall instead of EINVAL to consistent with the ACRN kernel's return
value.
Tracked-On: #7029
Signed-off-by: Wen Qian <qian.wen@intel.com>
Signed-off-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
The current code does not always check the return value of function
ioctl called in ACRN userspace, and lack of error message printing
to help debug.
This code fixes it by checking the return value of ioctl, and adding
function errormsg to return a string describing of the error code.
Tracked-On: #7029
Signed-off-by: Wen Qian <qian.wen@intel.com>
Signed-off-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
PR #7115 removed ``IVSHMEM_ENABLED`` and ``IVSHMEM_REGION`` from
``types.xsd``. We'll need to update the documentation to reflect this
change, but for now we need to remove the doc build error.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Rewrite the configuration of ivshmem in scenario.xml according to
the format of new UI design.
Tracked-On: #6690
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
According to the new design of DX, implement ivshmem configuration
and generate hv related files.
Tracked-On: #6690
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
The coding guideline rule C-ST-04 requires that
a 'if' statement followed by one or more 'else if'
statement shall be terminated by an 'else' statement
which contains either appropriate action or a comment.
Tracked-On: #6776
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Now the vept table was allocate dynamically, but the table size of vept
was calculated by the CONFIG_PLATFORM_RAM_SIZE which was predefined by
config tool.
It's not complete change and can't support single binary for different
boards/platforms.
So this patch will replace the CONFIG_PLATFORM_RAM_SIZE and get the
top ram size from hv_E820 interface for vept.
Tracked-On: #6690
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
Now the EPT module use predefined parameter "CONFIG_PLATFORM_RAM_SIZE"
to calculate the ept table size.
After change the EPT table to dynamic allocate to support single binary
for different boards/platforms, the ept table size should dynamic
calculate too.
So this patch replace CONFIG_PLATFORM_RAM_SIZE by the hv_e820_ram_size
to get the RAM info on run time.
Tracked-On: #6690
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
CONFIG_PLATFORM_RAM_SIZE is predefined by config tool and mmu use it to
calculate the table size and predefine the ppt table.
This patch will change the ppt to allocate dynamically and get the table
size by the hv_e820_ram_size interface which could get the RAM
info on run time and replace the CONFIG_PLATFORM_RAM_SIZE.
Tracked-On: #6690
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
The e820 module could get the RAM info on run time, but the RAM size
and MAX address was limited by CONFIG_PLATFORM_RAM_SIZE which was
predefined by config tool.
Current solution can't support single binary for different boards or
platforms and the CONFIG_PLATFORM_RAM_SIZE can't matching the RAM size
if user have not update config tools setting after the device changed.
So this patch remove the CONFIG_PLATFORM_RAM_SIZE and calculate ram
size on run time.
Tracked-On: #6690
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
The 'serial.conf' file need to be put in /etc/, but it is currently being
installed in $(libdir)/acrn/. We therefore ask the user to manually copy that
file over to the /etc/ folder. This patch fixes that by installing
'serial.conf' directly there.
Tracked-On: #7107
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Libcjson package is needed to build command monitor of DM,
so this should be installed in the user's development machine.
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Libcjson package is needed by command monitor of DM, so this
should be installed in the target platform.
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Libvirt or kata container needs to send some commands
(such as VM destory command) to the DM instance of User VM
through command monitor socket, they will specify the socket
path and pass this path name to DM instance through DM parameter.
In this patch, add new DM parameter (cmd_monitor) to get socket
path from libvirt or kata container. If cmd_monitor is specified,
it initialize and deinitialize command monitor in DM main loop.
v2-->v3:
Include command monitor initialization and deinitialization.
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This monitor module is to initialize socket intance, register
handlers to handle command from socket message, close socket,
free socket instance:
init_cmd_monitor: initialize socket intance and register handlers
to handle command.
deinit_cmd_monitor: close socket and free socket instance.
In this patch DM makefile is updated to build command monitor.
v1--v2:
Update socket path and update log message format.
Parse JSON format command message using libcjson lib APIs.
v2-->v3:
Use socket path length MACRO.
Update JSON format command message to {"command": "xxx"}.
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
The command handler is to implement handlers for each command,
currently, two handler is implemented for command monitor:
user_vm_destroy_handler: the handler is for user VM destroy command,
which shuts down to standard post-launched user VM forcefully.
user_vm_blkrescan_handler: the handler is for user VM blkrescan
command, which rescan virtio-blk device to revalidate and update
the backend file for user VM.
v1--v2:
Update log message format.
Generate JSON format ack message using libcjson lib APIs.
v2-->v3:
Update ACK message to {"ack": 0} or {"ack": -1}
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
The command module provides interfaces to find a command
intance, register handler for specified command, dispatch
command and invoke related handler.
find_command: find a command instance by name.
register_command_handler: register the handler for one
command instance.
dispatch_command_handlers: dispatch the command and invoke
registered handler.
v1-->v2:
Only support single handler for one command instance.
v2-->v3:
Remove command id.
Add error check to avoid regiter handler to command
instance which has handler.
Update the second parameter type of register_command_handler
to avoid unnecessary type conversion.
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
The socket module is to provide interfaces below, the unix domain
socket can be created by command monitor for the communication
between DM instance and libvirt daemon or kata container:
init_socket: allocate a new socket instance according to socket path
deinit_socket: free a socket instance
open_socket: open one unix domain socket server, initialize a
socket, create one thread to listen to client, another thread to
poll message from client.
close_socket: close one unix domain socket server
find_socket_client: find socket client instance according to fd
write_socket_char: send message through unix domain socket server
v1--v2:
Update some log message format and copyright format.
v2-->v3:
Update SOCKET_MAX_CLIENT to 1H since the socket instance of
command monitor only have one client (libvirt or kata container).
Tracked-On: #5921
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
Since PR 7081 has updated the dm parameter`lapic_pt` usage,
according to the new design, we add the`--rtvm` parameter
for Hard RT in launch script generation logic.
Tracked-On: #6690
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Enable `lapic_pt` automatically for rtvm for better performance.
Reserve `--lapic_pt` for future use. If VM is not in realtime mode,
`--lapic_pt` will cause a warning.
Tracked-On: #6690
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
category based on different log levels:
1) If the board inspector show CRITICAL error messages, it means that the
board inspector tool exit instantly and generate no file.
2) If the board inspector show ERROR messages, it means that the board
inspector will generate the board XML file successfully, but several conditions
may result in ACRN build or boot failure cannot continue execution due to the error.
3) If the board inspector show WARNING messages, this means that the board inspector
generate the board XML file successfully, but this board XML file is lack of
some feature which could still boot ACRN but loss some features.
4) If the board inspector show INFO messages, this means that board inspector
printed out some normal information.
5) If the board inspector show DEBUG messages, this means that it is used to
debug board inspector workflow.
v1->v2
1. Keep the assertions or exceptions under the acpiparser, inspectorlib
and smbiosparser directory.
2. Exit after all check_deps() completes instead of any unsatisfied dep
is identified.
3. As Amy's advice, Replace the message "{board_xml} saved successfully" with
the message "SUCCESS: Board configuration file <file name> generated successfully
and saved to <path>."
To do:
Print all messages using the colored font.
Tracked-On: #6689
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Bring all the cores up in the beginning of the board_inspector.py
It is expected to run board_inspector in clean and native environment.
To resolve the issue that user may run other jobs which puts cores
offline, bringing up all cores online so tool can run cpuid to extract
all available cores information.
Tracked-On: #7119
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Clarify that ``cpu-checker`` is the package that you install to get the
``kvm-ok`` tool used in these instructions.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
For platforms which have apicv post-interrupt capability;
ACRN would use posted-interrupt to notify another vCPU which in non-root mode;
or sync interrupt for itself when it in root-mode.However,QEMU could not handle this properly.
So, remove the post-interrupt capability in qemu cmdline.
Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
Reviewed-By: Li, Fei <fei1.Li@intel.com>
A shortcut to find the :ref:`labelname` value to link to an HTML page is
to view the source .rst file for that page. This patch tweaks the
conf.py to do just that.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
In function mk_dir(), handler 'dir' returned
by opendir() is not released before function
return and results in memory leakage.
Tracked-On: #7098
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
In function probe_disk_log_file(), handler 'dir'
returned by opendir() is not released before
function return and results in memory leakage.
Tracked-On: #7098
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
By default, pCPU is allowed to request software SRAM buffer
from given region in TCC buffer driver only if this pCPU is
set in the target region's CPU affinity configuration.
This check shall be disabled for software SRAM virtualization
usage in ACRN service VM, because software SRAM buffers are
requested by ACRN DM on behalf of user VM, but ACRN DM and
user VM may run on different CPUs while the target software
SRAM region may be configured only for pCPUs that user VM runs on.
This patch turns off such affinity check in TCC driver when
initializing vSSRAM for user VM.
Tracked-On: #7010
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
In 10-processors.py, level_types is an unordered dictionary from level type
encodings to human-readable terms, not a list. It is thus illegal to access the
highest level using the `[-1]` notation.
This patch fixes this by calculating the highest level in level_types and use
that level as the index instead.
Tracked-On: #6689
Fixes: b5b22bf98 ("board_inspector: avoid hard-coded topo level names")
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Sometimes the memory to be allocated is not at the end of an entry,
that means we have to break one enty into 2 smaller entries, there
are two ways to add the new entry to hv_e820, adds to the end or
insert it.
The initial e820 table is ordered, that's why the e820_alloc_memory
interface asssum all entries was sorted, but add new entry to the
end will break the orde of hv_e820.
So we use insert_e820_entry to replace the add_e820_entry, the new
interfeac will keep the orde and users do not need sort again after
alloc region
Tracked-On: #6690
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Chenli Wei<chenli.wei@linux.intel.com>
HC_GET_PLATFORM_INFO hypercall is not supported anymore,
hence to remove related function and data structure definition.
Tracked-On: #6690
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
The current mac detection logic only check whether there are parameters
after tap opt. Don't care whether the parameter is MAC or not, then
mac_provided will be set to 1, which will disable the mac_seed setting
when using sub parameters
This patch will check opt and fix the above issue.
Tracked-On: #6690
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
Manually specifying MAX_IOAPIC_NUM and MAX_IOAPIC_LINES in a scenario XML
is still usable as a workaround on boards without IOAPIC (e.g. emulated
ones) or when the board inspector does not collect IOAPIC information
correctly.
This patch takes user-specified values of those items if
provided. Otherwise the automatically calculated values will be used
instead, as is done today.
Tracked-On: #6986
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Today the config.h/config.mk generators do not put a newline after an entry
without a value, which causes the generated files ill-formed.
This patch fixes the issue by putting a newline at the end of an entry
unconditionally.
Tracked-On: #6355
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
In XSL a string variable can be nul, the empty string or a non-empty
string. While `$var != ''` ensures that `var` is a non-empty string,
`$var = ''` is true only when `var` holds the empty string. In other words,
`$var = ''` and `$var != ''` can be both false if `var` evaluates to nul.
As a result, the config.h/config.mk generating scripts does not use the
given default value if the explicit value is nul.
This patch fixes the incorrect comparison in the XSL scripts that handles
default values, so that the default value behaves as expected.
Tracked-On: #6355
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
The board configuration generator assumes all PCI BARs are programmed when
the board inspector runs, which is sometimes not the case. Unprogrammed
BARs will be reported using plain texts wrapped by angle brackets in the
output of `lspci`.
This patch gracefully skips the unprogrammed BARs and continues when
parsing the output of `lspci`, in order to avoid build-time failures due to
unprogrammed BARs.
Tracked-On: #6355
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
While the terms to refer to CPU topology levels are originally borrowed
from MSR listings in SDMs (i.e. thread, core, die and package), we now
align the topology information with the CPUID topology enumeration
leaf (which does not have a "package" level) in the
implementation. However, some hard-coded level types are not updated
accordingly, leading to strangely organized nodes in the generated board
XML.
This patch refines the CPU extractor of the board inspector by removing
such hard code. Also the XPATH counting the total number of threads is
refined to tolerate the variance of reported intermediate levels.
Tracked-On: #6689
Signed-off-by: Junjie Mao <junjie.mao@intel.com>