<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/virtio, branch v5.19</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.19</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.19'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-06-27T12:05:35Z</updated>
<entry>
<title>virtio_ring: make vring_create_virtqueue_split prettier</title>
<updated>2022-06-27T12:05:35Z</updated>
<author>
<name>Deming Wang</name>
<email>wangdeming@inspur.com</email>
</author>
<published>2022-06-22T19:23:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c7cc29aaebf9eaa543b4c70801e0ecef1101b3c8'/>
<id>urn:sha1:c7cc29aaebf9eaa543b4c70801e0ecef1101b3c8</id>
<content type='text'>
Add some spaces to vring_alloc_queue(make it look prettier).

Signed-off-by: Deming Wang &lt;wangdeming@inspur.com&gt;
Message-Id: &lt;20220622192306.4371-1-wangdeming@inspur.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_mmio: Restore guest page size on resume</title>
<updated>2022-06-27T12:05:35Z</updated>
<author>
<name>Stephan Gerhold</name>
<email>stephan.gerhold@kernkonzept.com</email>
</author>
<published>2022-06-21T11:06:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e0c2ce8217955537dd5434baeba061f209797119'/>
<id>urn:sha1:e0c2ce8217955537dd5434baeba061f209797119</id>
<content type='text'>
Virtio devices might lose their state when the VMM is restarted
after a suspend to disk (hibernation) cycle. This means that the
guest page size register must be restored for the virtio_mmio legacy
interface, since otherwise the virtio queues are not functional.

This is particularly problematic for QEMU that currently still defaults
to using the legacy interface for virtio_mmio. Write the guest page
size register again in virtio_mmio_restore() to make legacy virtio_mmio
devices work correctly after hibernation.

Signed-off-by: Stephan Gerhold &lt;stephan.gerhold@kernkonzept.com&gt;
Message-Id: &lt;20220621110621.3638025-3-stephan.gerhold@kernkonzept.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_mmio: Add missing PM calls to freeze/restore</title>
<updated>2022-06-27T12:05:35Z</updated>
<author>
<name>Stephan Gerhold</name>
<email>stephan.gerhold@kernkonzept.com</email>
</author>
<published>2022-06-21T11:06:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ed7ac37fde33ccd84e4bd2b9363c191f925364c7'/>
<id>urn:sha1:ed7ac37fde33ccd84e4bd2b9363c191f925364c7</id>
<content type='text'>
Most virtio drivers provide freeze/restore callbacks to finish up
device usage before suspend and to reinitialize the virtio device after
resume. However, these callbacks are currently only called when using
virtio_pci. virtio_mmio does not have any PM ops defined.

This causes problems for example after suspend to disk (hibernation),
since the virtio devices might lose their state after the VMM is
restarted. Calling virtio_device_freeze()/restore() ensures that
the virtio devices are re-initialized correctly.

Fix this by implementing the dev_pm_ops for virtio_mmio,
similar to virtio_pci_common.

Signed-off-by: Stephan Gerhold &lt;stephan.gerhold@kernkonzept.com&gt;
Message-Id: &lt;20220621110621.3638025-2-stephan.gerhold@kernkonzept.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio: disable notification hardening by default</title>
<updated>2022-06-24T06:49:48Z</updated>
<author>
<name>Jason Wang</name>
<email>jasowang@redhat.com</email>
</author>
<published>2022-06-22T01:29:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c346dae4f3fbce51bbd4f2ec5e8c6f9b91e93163'/>
<id>urn:sha1:c346dae4f3fbce51bbd4f2ec5e8c6f9b91e93163</id>
<content type='text'>
We try to harden virtio device notifications in 8b4ec69d7e09 ("virtio:
harden vring IRQ"). It works with the assumption that the driver or
core can properly call virtio_device_ready() at the right
place. Unfortunately, this seems to be not true and uncover various
bugs of the existing drivers, mainly the issue of using
virtio_device_ready() incorrectly.

So let's add a Kconfig option and disable it by default. It gives
us time to fix the drivers and then we can consider re-enabling it.

Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Message-Id: &lt;20220622012940.21441-1-jasowang@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Cornelia Huck &lt;cohuck@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio: Remove unnecessary variable assignments</title>
<updated>2022-06-24T06:49:48Z</updated>
<author>
<name>Bo Liu</name>
<email>liubo03@inspur.com</email>
</author>
<published>2022-06-17T05:59:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=03d9571706942fa653a4975709820596d13563c7'/>
<id>urn:sha1:03d9571706942fa653a4975709820596d13563c7</id>
<content type='text'>
In function vp_modern_probe(), "pci_dev" is initialized with the
value of "mdev-&gt;pci_dev", so assigning "pci_dev" to "mdev-&gt;pci_dev"
is unnecessary since they store the same value.

Signed-off-by: Bo Liu &lt;liubo03@inspur.com&gt;
Message-Id: &lt;20220617055952.5364-1-liubo03@inspur.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_ring : keep used_wrap_counter in vq-&gt;last_used_idx</title>
<updated>2022-06-24T06:49:48Z</updated>
<author>
<name>huangjie.albert</name>
<email>huangjie.albert@bytedance.com</email>
</author>
<published>2022-06-17T02:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a7722890fdfb2aaeb6b02d68bb0f1e411e58d539'/>
<id>urn:sha1:a7722890fdfb2aaeb6b02d68bb0f1e411e58d539</id>
<content type='text'>
the used_wrap_counter and the vq-&gt;last_used_idx may get
out of sync if they are separate assignment，and interrupt
might use an incorrect value to check for the used index.

for example:OOB access
ksoftirqd may consume the packet and it will call:
virtnet_poll
	--&gt;virtnet_receive
		--&gt;virtqueue_get_buf_ctx
			--&gt;virtqueue_get_buf_ctx_packed
and in virtqueue_get_buf_ctx_packed:

vq-&gt;last_used_idx += vq-&gt;packed.desc_state[id].num;
if (unlikely(vq-&gt;last_used_idx &gt;= vq-&gt;packed.vring.num)) {
         vq-&gt;last_used_idx -= vq-&gt;packed.vring.num;
         vq-&gt;packed.used_wrap_counter ^= 1;
}

if at the same time, there comes a vring interrupt，in vring_interrupt:
we will call:
vring_interrupt
	--&gt;more_used
		--&gt;more_used_packed
			--&gt;is_used_desc_packed
in is_used_desc_packed, the last_used_idx maybe &gt;= vq-&gt;packed.vring.num.
so this could case a memory out of bounds bug.

this patch is to keep the used_wrap_counter in vq-&gt;last_used_idx
so we can get the correct value to check for used index in interrupt.

v3-&gt;v4:
- use READ_ONCE/WRITE_ONCE to get/set vq-&gt;last_used_idx

v2-&gt;v3:
- add inline function to get used_wrap_counter and last_used
- when use vq-&gt;last_used_idx, only read once
  if vq-&gt;last_used_idx is read twice, the values can be inconsistent.
- use last_used_idx &amp; ~(-(1 &lt;&lt; VRING_PACKED_EVENT_F_WRAP_CTR))
  to get the all bits below VRING_PACKED_EVENT_F_WRAP_CTR

v1-&gt;v2:
- reuse the VRING_PACKED_EVENT_F_WRAP_CTR
- Remove parameter judgment in is_used_desc_packed,
because it can't be illegal

Signed-off-by: huangjie.albert &lt;huangjie.albert@bytedance.com&gt;
Message-Id: &lt;20220617020411.80367-1-huangjie.albert@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost</title>
<updated>2022-06-11T23:32:47Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-11T23:32:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=abe71eb32f3051f461d2975c674c0857549d0b93'/>
<id>urn:sha1:abe71eb32f3051f461d2975c674c0857549d0b93</id>
<content type='text'>
Pull virtio fixes from Michael Tsirkin:
 "Fixes all over the place, most notably fixes for latent bugs in
  drivers that got exposed by suppressing interrupts before DRIVER_OK,
  which in turn has been done by 8b4ec69d7e09 ("virtio: harden vring
  IRQ")"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  um: virt-pci: set device ready in probe()
  vdpa: make get_vq_group and set_group_asid optional
  virtio: Fix all occurences of the "the the" typo
  vduse: Fix NULL pointer dereference on sysfs access
  vringh: Fix loop descriptors check in the indirect cases
  vdpa/mlx5: clean up indenting in handle_ctrl_vlan()
  vdpa/mlx5: fix error code for deleting vlan
  virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
  vdpa/mlx5: Fix syntax errors in comments
  virtio-rng: make device ready before making request
</content>
</entry>
<entry>
<title>virtio: Fix all occurences of the "the the" typo</title>
<updated>2022-06-09T04:26:16Z</updated>
<author>
<name>Bo Liu</name>
<email>liubo03@inspur.com</email>
</author>
<published>2022-06-09T03:11:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=acb0055e187334554398a381a16de72f1a3d47bb'/>
<id>urn:sha1:acb0055e187334554398a381a16de72f1a3d47bb</id>
<content type='text'>
There are double "the" in message in file virtio_mmio.c
and virtio_pci_modern_dev.c, fix it.

Signed-off-by: Bo Liu &lt;liubo03@inspur.com&gt;
Message-Id: &lt;20220609031106.2161-1-liubo03@inspur.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed</title>
<updated>2022-06-08T12:56:03Z</updated>
<author>
<name>chengkaitao</name>
<email>pilgrimtao@gmail.com</email>
</author>
<published>2022-06-02T00:55:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a58a7f97ba11391d2d0d408e0b24f38d86ae748e'/>
<id>urn:sha1:a58a7f97ba11391d2d0d408e0b24f38d86ae748e</id>
<content type='text'>
The reference must be released when device_register(&amp;vm_cmdline_parent)
failed. Add the corresponding 'put_device()' in the error handling path.

Signed-off-by: chengkaitao &lt;pilgrimtao@gmail.com&gt;
Message-Id: &lt;20220602005542.16489-1-chengkaitao@didiglobal.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio: replace arch_has_restricted_virtio_memory_access()</title>
<updated>2022-06-06T06:22:01Z</updated>
<author>
<name>Juergen Gross</name>
<email>jgross@suse.com</email>
</author>
<published>2022-06-06T06:09:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3f9dfbebdc48cebfbda738f6f3d1dbf6d7232f90'/>
<id>urn:sha1:3f9dfbebdc48cebfbda738f6f3d1dbf6d7232f90</id>
<content type='text'>
Instead of using arch_has_restricted_virtio_memory_access() together
with CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS, replace those
with platform_has() and a new platform feature
PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS.

Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Reviewed-by: Oleksandr Tyshchenko &lt;oleksandr_tyshchenko@epam.com&gt;
Tested-by: Oleksandr Tyshchenko &lt;oleksandr_tyshchenko@epam.com&gt; # Arm64 only
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Borislav Petkov &lt;bp@suse.de&gt;
</content>
</entry>
</feed>
