<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/virt/acrn, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/virt/acrn?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/virt/acrn?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-07-08T13:42:10Z</updated>
<entry>
<title>virt: acrn: using for_each_set_bit to simplify the code</title>
<updated>2022-07-08T13:42:10Z</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2022-07-04T12:50:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e5535ff173318775f2c52b7f072bb3abf03b5b0f'/>
<id>urn:sha1:e5535ff173318775f2c52b7f072bb3abf03b5b0f</id>
<content type='text'>
It's more cleanly to use for_each_set_bit() instead of opencoding it.

Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Signed-off-by: Fei Li &lt;fei1.li@intel.com&gt;
Link: https://lore.kernel.org/r/20220704125044.2192381-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: Prefer array_size and struct_size over open coded arithmetic</title>
<updated>2022-04-26T15:20:10Z</updated>
<author>
<name>Len Baker</name>
<email>len.baker@gmx.com</email>
</author>
<published>2021-10-29T17:27:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=746f1b0ac5bf6ecfb71674af210ae476aa714f46'/>
<id>urn:sha1:746f1b0ac5bf6ecfb71674af210ae476aa714f46</id>
<content type='text'>
As noted in the "Deprecated Interfaces, Language Features, Attributes,
and Conventions" documentation [1], size calculations (especially
multiplication) should not be performed in memory allocator (or similar)
function arguments due to the risk of them overflowing. This could lead
to values wrapping around and a smaller allocation being made than the
caller was expecting. Using those allocations could lead to linear
overflows of heap memory and other misbehaviors.

So, use the array_size() helper to do the arithmetic instead of the
argument "count * size" in the vzalloc() function.

Also, take the opportunity to add a flexible array member of struct
vm_memory_region_op to the vm_memory_region_batch structure. And then,
change the code accordingly and use the struct_size() helper to do the
arithmetic instead of the argument "size + size * count" in the kzalloc
function.

This code was detected with the help of Coccinelle and audited and fixed
manually.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments

Acked-by: Fei Li &lt;fei1.li@intel.com&gt;
Signed-off-by: Len Baker &lt;len.baker@gmx.com&gt;
Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: fix a memory leak in acrn_dev_ioctl()</title>
<updated>2022-03-18T12:49:59Z</updated>
<author>
<name>Xiaolong Huang</name>
<email>butterflyhuangxx@gmail.com</email>
</author>
<published>2022-03-08T09:20:47Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ecd1735f14d6ac868ae5d8b7a2bf193fa11f388b'/>
<id>urn:sha1:ecd1735f14d6ac868ae5d8b7a2bf193fa11f388b</id>
<content type='text'>
The vm_param and cpu_regs need to be freed via kfree()
before return -EINVAL error.

Fixes: 9c5137aedd11 ("virt: acrn: Introduce VM management interfaces")
Fixes: 2ad2aaee1bc9 ("virt: acrn: Introduce an ioctl to set vCPU registers state")
Signed-off-by: Xiaolong Huang &lt;butterflyhuangxx@gmail.com&gt;
Signed-off-by: Fei Li &lt;fei1.li@intel.com&gt;
Link: https://lore.kernel.org/r/20220308092047.1008409-1-butterflyhuangxx@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: obtain pa from VMA with PFNMAP flag</title>
<updated>2022-03-18T12:49:56Z</updated>
<author>
<name>Yonghua Huang</name>
<email>yonghua.huang@intel.com</email>
</author>
<published>2022-02-28T02:22:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8a6e85f75a83d16a71077e41f2720c691f432002'/>
<id>urn:sha1:8a6e85f75a83d16a71077e41f2720c691f432002</id>
<content type='text'>
 acrn_vm_ram_map can't pin the user pages with VM_PFNMAP flag
 by calling get_user_pages_fast(), the PA(physical pages)
 may be mapped by kernel driver and set PFNMAP flag.

 This patch fixes logic to setup EPT mapping for PFN mapped RAM region
 by checking the memory attribute before adding EPT mapping for them.

Fixes: 88f537d5e8dd ("virt: acrn: Introduce EPT mapping management")
Signed-off-by: Yonghua Huang &lt;yonghua.huang@intel.com&gt;
Signed-off-by: Fei Li &lt;fei1.li@intel.com&gt;
Link: https://lore.kernel.org/r/20220228022212.419406-1-yonghua.huang@intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: Remove unsued acrn_irqfds_mutex.</title>
<updated>2022-03-18T12:49:49Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2022-03-08T12:27:15Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fbeac3dfc762871e72676a065ddd13e5087f26ab'/>
<id>urn:sha1:fbeac3dfc762871e72676a065ddd13e5087f26ab</id>
<content type='text'>
acrn_irqfds_mutex is not used, never was.

Remove acrn_irqfds_mutex.

Fixes: aa3b483ff1d71 ("virt: acrn: Introduce irqfd")
Cc: Fei Li &lt;fei1.li@intel.com&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Link: https://lore.kernel.org/r/YidLo57Kw/u/cpA5@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>all: replace find_next{,_zero}_bit with find_first{,_zero}_bit where appropriate</title>
<updated>2022-01-15T16:47:31Z</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2021-08-14T21:17:03Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b5c7e7ec7d3418af2544452b45cc67297c857a86'/>
<id>urn:sha1:b5c7e7ec7d3418af2544452b45cc67297c857a86</id>
<content type='text'>
find_first{,_zero}_bit is a more effective analogue of 'next' version if
start == 0. This patch replaces 'next' with 'first' where things look
trivial.

Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Tested-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
</content>
</entry>
<entry>
<title>virt: acrn: Introduce interfaces for virtual device creating/destroying</title>
<updated>2021-10-05T14:14:10Z</updated>
<author>
<name>Shuo Liu</name>
<email>shuo.a.liu@intel.com</email>
</author>
<published>2021-09-23T08:41:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=424f1ac2d832f31a2814c799bd50decf6a9f8e74'/>
<id>urn:sha1:424f1ac2d832f31a2814c799bd50decf6a9f8e74</id>
<content type='text'>
The ACRN hypervisor can emulate a virtual device within hypervisor for a
Guest VM. The emulated virtual device can work without the ACRN
userspace after creation. The hypervisor do the emulation of that device.

To support the virtual device creating/destroying, HSM provides the
following ioctls:
  - ACRN_IOCTL_CREATE_VDEV
    Pass data struct acrn_vdev from userspace to the hypervisor, and inform
    the hypervisor to create a virtual device for a User VM.
  - ACRN_IOCTL_DESTROY_VDEV
    Pass data struct acrn_vdev from userspace to the hypervisor, and inform
    the hypervisor to destroy a virtual device of a User VM.

These new APIs will be used by user space code vm_add_hv_vdev and
vm_remove_hv_vdev in
https://github.com/projectacrn/acrn-hypervisor/blob/master/devicemodel/core/vmmapi.c

Signed-off-by: Shuo Liu &lt;shuo.a.liu@intel.com&gt;
Signed-off-by: Fei Li &lt;fei1.li@intel.com&gt;
Link: https://lore.kernel.org/r/20210923084128.18902-3-fei1.li@intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: Introduce interfaces for MMIO device passthrough</title>
<updated>2021-10-05T14:14:10Z</updated>
<author>
<name>Shuo Liu</name>
<email>shuo.a.liu@intel.com</email>
</author>
<published>2021-09-23T08:41:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=29a9f27574692a71c04fd41ca4bbf8eae842af13'/>
<id>urn:sha1:29a9f27574692a71c04fd41ca4bbf8eae842af13</id>
<content type='text'>
MMIO device passthrough enables an OS in a virtual machine to directly
access a MMIO device in the host. It promises almost the native
performance, which is required in performance-critical scenarios of
ACRN.

HSM provides the following ioctls:
  - Assign - ACRN_IOCTL_ASSIGN_MMIODEV
    Pass data struct acrn_mmiodev from userspace to the hypervisor, and
    inform the hypervisor to assign a MMIO device to a User VM.

  - De-assign - ACRN_IOCTL_DEASSIGN_PCIDEV
    Pass data struct acrn_mmiodev from userspace to the hypervisor, and
    inform the hypervisor to de-assign a MMIO device from a User VM.

These new APIs will be used by user space code vm_assign_mmiodev and
vm_deassign_mmiodev in
https://github.com/projectacrn/acrn-hypervisor/blob/master/devicemodel/core/vmmapi.c

Signed-off-by: Shuo Liu &lt;shuo.a.liu@intel.com&gt;
Signed-off-by: Fei Li &lt;fei1.li@intel.com&gt;
Link: https://lore.kernel.org/r/20210923084128.18902-2-fei1.li@intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: Do hcall_destroy_vm() before resource release</title>
<updated>2021-07-27T14:48:45Z</updated>
<author>
<name>Shuo Liu</name>
<email>shuo.a.liu@intel.com</email>
</author>
<published>2021-07-22T06:27:36Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=4c4c1257b844ffe5d0933684e612f92c4b78e120'/>
<id>urn:sha1:4c4c1257b844ffe5d0933684e612f92c4b78e120</id>
<content type='text'>
The ACRN hypervisor has scenarios which could run a real-time guest VM.
The real-time guest VM occupies dedicated CPU cores, be assigned with
dedicated PCI devices. It can run without the Service VM after boot up.
hcall_destroy_vm() returns failure when a real-time guest VM refuses.
The clearing of flag ACRN_VM_FLAG_DESTROYED causes some kernel resource
double-freed in a later acrn_vm_destroy().

Do hcall_destroy_vm() before resource release to drop this chance to
destroy the VM if hypercall fails.

Fixes: 9c5137aedd11 ("virt: acrn: Introduce VM management interfaces")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Shuo Liu &lt;shuo.a.liu@intel.com&gt;
Signed-off-by: Fei Li &lt;fei1.li@intel.com&gt;
Link: https://lore.kernel.org/r/20210722062736.15050-1-fei1.li@intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>virt: acrn: Fix document of acrn_msi_inject()</title>
<updated>2021-03-24T07:26:30Z</updated>
<author>
<name>Shuo Liu</name>
<email>shuo.a.liu@intel.com</email>
</author>
<published>2021-03-11T01:52:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=1c15b334ca34dd22a19e1c595908fc860523be64'/>
<id>urn:sha1:1c15b334ca34dd22a19e1c595908fc860523be64</id>
<content type='text'>
This fixes below build warning with extra build checks.

$ make W=1

../drivers/virt/acrn/vm.c:105: warning: expecting prototype for
acrn_inject_msi(). Prototype was for acrn_msi_inject() instead

Fixes: c7cf8d27244f ("virt: acrn: Introduce interrupt injection interfaces")
Signed-off-by: Shuo Liu &lt;shuo.a.liu@intel.com&gt;
Link: https://lore.kernel.org/r/20210311015206.19715-1-shuo.a.liu@intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
