Commit Graph

1323 Commits

Author SHA1 Message Date
Wu Zhou 8c38cd5734 dm: add _CPC to guest ACPI pm tables
The optional object _CPC declares an interface that allows OSPM to
transition the processor into a performance state based on a continuous
range of allowable values.

It is associated with HWP on intel CPUs. Although Linux intel_pstate driver
can have its performance managing abilities without _CPC, it may still
need this _CPC table to implement some features such as providing the kernel
multi-core scheduler with core priority info.

As currently we are giving guests a vHWP interface for the multi-core
scheduler, this patch adds _CPC to the guest ACPI. _CPC is written only
when the hypervisor decides the guest should have vHWP, using the
existing pm hypercall ACRN_PMCMD_GET_PX_CNT. The idea is:
- If the VM supports vHWP, then the guest is having continuous p-state.
  Thus it doesn't have a specific px_cnt. The hypercall returns success
  and px_cnt = 0.
- If the VM's p-state is hidden or hv doesn't have its p-state info,
  the hypercall returns fail.

Tracked-On: #8414
Signed-off-by: Wu Zhou <wu.zhou@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
2023-06-09 10:06:42 +08:00
Jiaqing Zhao 6320977788 dm: gvt: add bound check in gvt_init_config()
gvt_init_config() may perform out-of-range read on host_config, add
bound check before accessing it.

Tracked-On: #8382
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
2023-05-18 11:26:17 +08:00
Conghui a715a3222b asyncio: refine the setup ioctl
Remove the common interface for sbuf setup, as it is not accept by
kernel side. Instead, use dedicate setup function for asyncio to init
its sbuf.

Tracked-On: #8209
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-11-25 10:43:34 +08:00
Zhangwei6 b17b5992c8 dm: change the version format
The version info is mainly used to tell the user when and where the binary is
compiled and built, this will change the dm version format.
The dm follows the format:
major.minor-stable/unstable-remote_branch-acrn-commit_date-commit_id-dirty
(tag-current_commit_id) build by author date.
Compare to the hv version, which is:
major.minor-stable/unstable-remote_branch-acrn-commit_date-commit_id-dirty
DBG/REL(tag-current_commit_id) scenario@board build by author date.
The dm doesn't contain DBG/REL because it's given in configurator-tool
only for hv. also not contain scenario and board info.
e.g.
with tag:
$acrn-dm -v
DM: 3.1-stable-release_3.1-2022-09-27-11:15:42-7fad37e02-dirty(tag: v3.1)
build by zhangwei@2022-11-16 07:02:35
without tag:
$acrn-dm -v
DM: 3.2-unstable-master-2022-11-16-14:34:49-11f53d849-dirty
build by zhangwei@2022-11-16 06:49:43

Tracked-On: #8303
Signed-off-by: Zhangwei6 <wei6.zhang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-11-21 13:23:28 +08:00
Xie, nanlin a58d2ebddc misc: Update sample launch scripts into generic_board folder.
Currently we use configurator to generate sample launch scripts and
configuration code, remove old ones and put all generated launch scripts
into generic_board.

Tracked-On: #6690
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2022-11-21 11:51:33 +08:00
Liu Long 0caf1ac0de ACRN:DM: Fix the vhost register kick fd issue.
Add the new parameter for register ioevent function, let the vhost
vq and viothread vq can share the register ioevent common API.

Tracked-On: #8323
Signed-off-by: Liu Long <long.liu@linux.intel.com>
Reviewed-by: Conghui <conghui.chen@intel.com>
2022-11-21 11:18:23 +08:00
Sun Peng 10f25cdab6 dm: vga: remove all the assertion.
To avoid assertions in devicemodel, remove all the assert() in vga.c,
use print error message to check errors.

All the behavior of registers follow this spec:
https://wiki.osdev.org/VGA_Hardware#Graphics_Mode

Tracked-On: #8125
Signed-off-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Huang, Yonghua <yonghua.huang@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-11-02 15:03:35 +08:00
Conghui 0ec9aaea6f dm: support asyncio in ioeventfd
Add a new flag in ioeventfd ioctl to support asyncio. After that, the IO
request will be processed in asyncio path by kernel and hypervisor.

Tracked-On: #8209
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-09-27 16:10:15 +08:00
Conghui 0f599e8d56 dm: add a new page for asyncio
asyncio is a new mechanism in ACRN, which is special for these devices
which need high IO performance. ACRN hypervisor would process the IO
request from User VM in an async mode.

Just like the original IOReq shared page, the devicemodel also create a
page for fastio requests. As the asyncio use the ioeventfd, so the
reuqests are handled in kernel, devicemodel only need to provide the
page.

Tracked-On: #8209
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-09-27 16:10:15 +08:00
Zhao Yakui 3c01a6a0cf ACRN:DM:PT: Add romfile option for rombar on GPU passthrough device
Add the option of "romfile=file_location" to specify the rom file for rombar

Tracked-On: #8175
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2022-09-23 18:12:01 +08:00
Zhao Yakui db7be2c6f6 ACRN:DM:PCI: Add the emulation of PCI rom bar register for passthru device
The pci_reg 0x30 of PCI config_space is used to check whether the PCI rom
bar is supported. When the PCI rom is supported for the device in guest vm,
the 0x30 pci_reg is emulated and it can return the addr/enable bit.

Tracked-On: #8175
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2022-09-23 18:12:01 +08:00
Zhao Yakui 64ecf193e4 ACRN:DM:PCI: Load rom_file and map it into PCI ROMbar
PCI ROM is the firmware specific to PCI device and it is provided by
the device vendor. The PCI rom resides in 0x30 offset of PCI config space.
This can be used to check whether the PCI rom exists. And when it exists,
it can load the firmware from the addr that is obtained from ROM bar addr.

For the user-vm, it will try to load the rom_file for the given PCI device and
enable the VM to access the firmware that is defined in rom_file.

BTW: The emulated rom_file is converted from efi image by using EfiRom. It has
no dependency on the ROM bar of physical PCI devices. Of course if the physical
PCI devices supports the ROM bar, the rom_file can also be dumped from the PCI
rom.

Now this is limited to PCI display device.

V2->V3: Add the function of pci_load_rombar/pci_release_rombar to handle the
	rombar in course of passthrough_init/deinit.

Tracked-On: #8175
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2022-09-23 18:12:01 +08:00
Zhao Yakui 270aaf82d8 ACRN:DM:PCI: Add the support of allocating resource for PCI ROM bar
Now the device model only supports the 0..5 PCI bar for PCI/PCIE devices.
This tries to allocate the PCI_MEM32 resource for PCI ROM bar.

V1->V2: Use the PCI_ROMBAR as bar index and PCIBAR_ROM bar type when calling
the pci_emul_alloc_bar to allocate the guest physical addr for PCI ROM bar.
And it will allocate the resource from PCIBAR_MEM32 region.

V2->V3: Add more comments that describes the parameter of pci_emul_alloc_bar.

Tracked-On: #8175
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2022-09-23 18:12:01 +08:00
Conghui 91cc0d5bf8 dm: iothread: fix bug in iothread handler
Fix the bug in iothread handler, the event should be read out so that the
next epoll_wait not return directly as the fd can still readable.

Tracked-On: #8181
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-09-21 12:29:07 +08:00
Conghui fcd92f1c2f dm: virtio-blk: fix parameter err
Fix the truncate issue for virtio block parameter.

Tracked-On: #8162
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-09-21 12:29:07 +08:00
Marius Rodi 8fe8b15a02 devicemodel: hw: pci: xhci: Remove unnecessary condition
Because of the iteration of i as is, the condition i <= XHCI_MAX_DEVS
always results as true and thus is unnecessary.

When compiling with cflag -Werror this condition will result in a
compilation failure.

Tracked-On: #8114

Signed-off-by: Marius Rodi <marius.rodi@linutronix.de>
2022-09-07 14:08:09 +08:00
Conghui b083341bd9 dm: change virtio-i2c from legacy to modern device
Change virtio-i2c from legacy to modern device according to virtio spec v1.2.

Tracked-On: #8055
Signed-off-by: Liu Long <long.liu@linux.intel.com>
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-25 14:50:24 +08:00
Conghui 7a870e751a dm: change virtio-i2c transfer logic
1. Change i2c message transfer logic according to virtio spec v1.2
2. Other tiny fixes.

Tracked-On: #8055
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-25 14:50:24 +08:00
Zhao Yakui 92034e9f7d ACRN:DM:VGPU: Add more check to avoid no geometry parameter for virtio-gpu
When no geometry parameter is passed for virtio-gpu, it should not be started.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
2022-08-16 15:29:27 +08:00
Zhao Yakui 86eff3c6a1 ACRN:DM:VDisplay: Report the number of connected vscreen for virtio-gpu devices
When multi-display window is initialied/configured, it should report the correct number
to virtio-gpu devides so that it can notify that the Guest_VM can use multi-display.
Otherwise the Guest VM still gets only one display.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
2022-08-16 15:29:27 +08:00
Zhao Yakui 5676cceda0 ACRN:DM:Vdisplay: Render one small bogus texture to fix the display issue in multi render_context
When virtio-gpu is used for guest_vm, ACRN uses the libSDL API to render the framebuffer
submitted from guest virtio-gpu device. The libSDL will cache some op/states related with
3D internally and skip some 3D API. This works well for one display. When multi displays
are enabled, ACRN will create  one SDL_Renderer/SDL_window for each display_window.
As the libSDL caches some states, it can't select the correct 3D shader and show
the garbage when switching among multi SDL_Renderer.

This is one limitation in libSDL.
So one small texture(32x32) is created and rendered so that each time it can reconfigure
the internal state for target texture. This is used to workaround the display issue.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
2022-08-16 15:29:27 +08:00
Sun Peng 65f479c73b dm: vdisplay: multi-vdisplay support.
Allow one VM have more than 1 virtual display for output. Till now, the
max virtual display number is 2. So guest VM can use dual display for
mirror and extend desktop mode. To specify multi-vdisplay, need use
acrn-dm parameters like this:
For fullscreen mode:

virtio-gpu,geometry=fullscreen:monitor_id1,geometry=fullscreen:monitor_id2

For window mode:

virtio-gpu,geometry=<width>x<height>+<x_off>+<y_off>,geometry=<width>x<height>+<x_off>+<y_off>

v1->v2: add pscreen_id outputs for easier debugging.

Tracked-On: #7988
Signed-off-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
2022-08-15 14:44:47 +08:00
Sun Peng ac294c59dd dm: vdisplay: refine vdisplay core concept abstractions
Add new concept "vscreen" to abstract all specs about screen in a
display server. This can provide convenience to add more screens
for one VM.

v1->v2: remove vscr NULL checks.
v2->v3: restore vscreen geometry calibaration to previous version.
        wrap geometry calibaration and create window/render to
        functions.

Tracked-On: #7988
Signed-off-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
2022-08-15 14:44:47 +08:00
Sun Peng 6f22afd9e9 dm: vdisplay: Add physical monitor id check.
vdisplay use physical monitor id(pscreen index) to locate the monitor.
The max index value always is the physical monitor number - 1. For
example, there are 4 physical monitors connected. The monitor id should
be 0, 1, 2 and 3. We need check monitor id that user inputs and make
sure it is in a correct range.

Tracked-On: #7988
Signed-off-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
2022-08-15 14:44:47 +08:00
Sun Peng ddf35fb016 dm: vdisplay: multi-local-mornitor support.
To support full screen mode on one of multi-local-mornitor which
connected to service vm by monitor ID that customer specify. The
monitor ID is specified in acrn-dm's parameter like this:

virtio-gpu,geometry=fullscreen:monitor_id

For window mode, the vdisplay window always be shown on monitor 0,
because the customer can drag the window to anyone monitor. Besides, the
customer can set the monitor by x_off and y_off parameter like this:

virtio-gpu,geometry=<width>x<height>+<x_off>+<y_off>

v1->v2: Add note about zoom to pscreen width & height in fullscreen.
v2->v3: vdpy.width/height for window, used in host, vdpy.guest_width/
guest_height for guest framebuffer, used in guest.

Tracked-On: #7988
Signed-off-by: Sun Peng <peng.p.sun@linux.intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 770ecb399b ACRN:DM:VGPU: Return the parsed scanout_num to virtio_gpu in Guest_VM
Return the parsed scanout_num to guest_vm so that the guest_vm can configure multi-display.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 0606247b02 ACRN:DM:VGPU: Calibrate the offset in dmabuf/pixman_image to display the scanout_window
Sometimes the virtio_gpu in guest_vm doesn't pass the zero coord_x/y for the
displayed framebuffer. In such case the offset should be calibrated for pixman_image/dmabuf
so that it can display the image from the correct image.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 8b55026f9d ACRN:DM:VGPU: virtio-gpu-flush cmds check whether one scanout_win needs to be displayed
The virtio-gpu display will be handled by the below cmd sequence:
1. Virtio_GPU_CMD_CREATE_RESOURCE
2. VIRTIO_GPU_CMD_SET_SCANOUT/SET_SCANOUT_BLOB
3. VIRTIO_GPU_CMD_FLUSH

And the VIRTIO_GPU_CMD_FLUSH will notify the vdisplay module to display the
framebuffer related with the scanout_id. But the virtio_gpu_cmd_flush doesn't
pass the scanout info.Instead it only passes the flushed_region and the
resource_id. So it needs to check whether the scanout_region is covered by the
flushed_region and then decide whether the scanout_win needs to be displayed.

v1->v2: Use the bpp instead of hardcode 4 for offset_calculation

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 6d83cd17f8 ACRN:DM:VGPU: Handle the scanout_id for cursor virtio-gpu-cmd
The virtio-gpu in guest_vm also passes the scanout_id for cursor operation.
So this scanout_id should be used in course of handling cursor operation.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 43626d1803 ACRN:DM:VGPU: Handle the virtio-gpu-cmds based on scanout_id in cmd_request
The scanout_id is included in the below virtio-gpu cmd request.
VIRTIO_GPU_GET_EDID
VIRTIO_GPU_SET_SCANOUT
VIRTIO_GPU_SET_SCANOUT_BLOB
VIRTIO_GPU_GET_DISPLAY_INFO

So the scanout_id and scanout_rect should be handled correctly. And it will
use the scanout_rect instead of resource width/height in course of handling
VIRTIO_GPU_SET_SCANOUT/SCANOUT_BLOB cmd.

v1->v2: change the position to zero when returning response for GET_DISPLAY_INFO

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 516e8ef4b1 ACRN:DM:VGPU: Add virtio_gpu_scanout structure to handle virtio-gpu-cmds correctly
Now it only supports one scanout for virtio-gpu. So the scanout_id is ignored in
course of handling virtio-gpu cmd. In order to handle the virtio-gpu cmd correctly,
it adds the virtio_gpu_scanout structure so that it can record the scanout info.

v1->v2: Refine the field in virtio_gpu_scanout and error message for scanout_id

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui 6407de302c ACRN:DM:VDisplay: vdpy_init connection returns the supported number of vScreen
Vdisplay module will create the gui_window (vScreen) based on the virtio-gpu
parameter. When virtio-gpu device tries to establish the connection with
vdisplay module, it will return the supported number of vScreen.
Then the virtio-gpu device can initialize the correct info for the guest_vm.

BTW: The number is fixed to 1.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Zhao Yakui ad67215d4b ACRN:DM:VDISPLAY: Refine display API to support multi scanout_window
Currenly it can support only one display_win. When virtio-gpu wants to display
the framebuffer from Guest_vm, it will render it into the default win. In order
to support multi-window, the scanout_id is added for display API.
After display API is refined, the vdisplay and virtio-gpu can support the multi-win
independently.

BTW: Now the scanout_id is not implemented in vdisplay module and the virtio-gpu always
passes the zero. It will be implemeneted in the later patches.

Tracked-On: #7988
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Peng Sun <peng.p.sun@linux.intel.com>
2022-08-15 14:44:47 +08:00
Conghui 3dab043344 dm: bugfix for iothread
As the type of pthread_t is unsigned long, so the init value for it
should not be '-1'. When the tid is '-1', it will continue to call
pthread_kill/pthread_join. This is incorrect.

Tracked-On: #7960
Signed-off-by: Conghui <conghui.chen@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-10 22:33:34 +08:00
Chenli Wei 030b2f804c dm: fix the secure coding style violations
There was some secure coding style violations of virtio net and tmp,
this patch add some NULL check to fix these violations.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
2022-08-02 18:01:24 +08:00
Conghui 7d987f9b0f dm: virtio-block: support NO_NOTIFY
disable NOTIFY during getting requests from virtqueue. This will improve
the IO performance.

Tracked-On: #7940
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-02 11:14:54 +08:00
Conghui 1bf3cb61f5 dm: virtio-blk: enable support for iothread
The usage is:

-s <slot> virtio-blk,[iothread,]<filepath>

e.g  -s 3 virtio-blk,iothread,test.img

Tracked-On: #7940
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-02 11:14:54 +08:00
Conghui fa69f79e33 dm: add iothread support in virtio framework
Add ioeventfd and iothread to virtio framework. When a virtio device
claim to support iothread, virtio framework will register a ioeventfd
and add it to iothread's epoll. After that, the new notify will come
through the iothread instead of the vcpu thread. The notify handler will
be called to process the request.

Tracked-On: #7940
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-02 11:14:54 +08:00
Conghui 4fd0a1900a dm: support iothread
Supply a decidate thread, which can moniter a set of fds with epoll,
when the data is ready, call the corresponding callback.

This iothread will be created automatically with the first successful
call to iothread_add,  and will be destroyed in iothread_deinit if it
was created.

Note, currenlty only support one iothread.

Tracked-On: #7940
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-08-02 11:14:54 +08:00
Liu Long 49d6a909cd ACRN:DM: Correct vhost_ext_features network bit
Use the VHOST_NET_F_VIRTIO_NET_HDR in linux system header file,
and set the correct feature bit for Virtio net header.

Tracked-On: #7790
Signed-off-by: Liu Long <long.liu@linux.intel.com>
2022-07-27 07:57:29 +08:00
Liu Long 73c529a903 ACRN:DM: Free virtio_vsock struct resource in deinit function
Free the virtio_vsock struct resource in virtio vsock deinit function
in case memory leak.

Tracked-On: #7759
Signed-off-by: Liu Long <long.liu@linux.intel.com>
2022-07-27 07:57:29 +08:00
Liu Long 6e18d2bd8f ACRN: DM: Fix the vsock error info.
Replace the exclamation mark with period mark in debug info and fix
the Guest CID max value macro.

Tracked-On: #7456
Signed-off-by: Liu Long <long.liu@linux.intel.com>
2022-07-27 07:57:29 +08:00
Ziheng Li eb8bcb06b3 Update copyright year range in code headers
Modified the copyright year range in code, and corrected "int32_tel"
into "Intel" in two "hypervisor/include/debug/profiling.h" and
"hypervisor/include/debug/profiling_internal.h".

Tracked-On: #7559
Signed-off-by: Ziheng Li <ziheng.li@intel.com>
2022-07-15 11:48:35 +08:00
Shiqing Gao 59b6d7b404 dm: verify the "iasl" version
This patch does:
- define IASL_MIN_VER in the top-level Makefile and pass it Device Model
- verify the "iasl" version at run time
  if "iasl" version is older than IASL_MIN_VER, refuse to launch the
  post-launched VM and exit directly.

Tracked-On: #7880

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-07-13 14:01:01 +08:00
Shiqing Gao cc309bd973 dm: refine the detection of "iasl" utility
At run time (on the *target* machine), acrn-dm depends on "iasl" to build
the ACPI tables for post-launched VMs.

This patch does:
- remove the dependency on ASL_COMPILER, which would only be used at build time
- add a new acrn-dm parameter "--iasl <iasl_compiler_path>"
  If "--iasl <iasl_compiler_path>" is specified as the acrn-dm parameter,
  acrn-dm uses <iasl_compiler_path> as the path to the "iasl" compiler;
  otherwise, "which iasl" is used to detect the "iasl" compiler.

  If "iasl" is not found at run time, refuse to launch the post-launched VM
  and exit directly.

v2 -> v3:
 - use "strlen" rather than "strncmp" to check whether asl_compiler
   has been set or not

v1 -> v2:
 - remove "iasl_param" and "with_iasl_param" to simplify the logic

Tracked-On: #7880

Signed-off-by: Victor Sun <victor.sun@intel.com>
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-07-13 14:01:01 +08:00
Geoffroy Van Cutsem ff07ccae0f Makefile: remove old samples (Apollo Lake)
Remove sample files and launch scripts related to the Apollo Lake (APL)
platform since ACRN no longer supports it. Clean the Makefile as well to not
install these files on the target system.

Tracked-On: #6175
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2022-07-05 10:08:40 +08:00
Conghui 18af997373 dm: virtio-console: change STDIO BE attribute
Fix the log format problem in devicemodel when using virtio-console with
'stdio' configuration.
In virtio-console, it will change the STDIO's attributes, and will case
the log message after that not align.
e.g:
	for (i=0; i<3; i++)
		printf('test\n');

	The original output would be like this:

	test
	    test
	        test

	After add 'OPOST' to oflag of STDIO, the output would be like this:

	test
	test
	test

	(OPOST - Enable implementation-defined output processing)

Tracked-On: #7860
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-06-30 17:42:44 +08:00
Liu Long bd8c0de62b ACRN: DM: Fix the MSI mask and unmask bugs.
The patch fix many bugs about the pci msi capabilities.
 1. Fix the clear msi mask bit issues.
 2. Initialize the offset of pci capabilities this variable will used as
 the output of pci_emul_find_capability function.
 3. Replace 16-read with 32-read because both mask and pending are 32bit.
 4. Add mask and pending element in msicap struct and intialize the struct
 value to zero, because we need r/w mask and pending value.

Tracked-On: #7762
Signed-off-by: Liu Long <long.liu@linux.intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-06-14 16:28:50 +08:00
Liu Long 038335367d DM: vsock: fix the memory leakage bug
Fix the memory leakage issue caused by incomplete deinit flow.

Tracked-On: #7759
Signed-off-by: Liu Long <long.liu@linux.intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-06-14 15:10:05 +08:00
Liu Long b2d9112ed5 DM: Add endpoint index value check in doorbell write
Check max ep index in doorbell write function to avoid overwriting
the pci_xhci_dev_emu->eps[XHCI_MAX_ENDPOINTS].

Tracked-On: #7759
Signed-off-by: Liu Long <long.liu@linux.intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2022-06-14 15:10:05 +08:00