mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
virtio/vhost: new features for 4.8
- New vsock device support in host and guest - Platform IOMMU support in host and guest, including compatibility quirks for legacy systems. - Misc fixes and cleanups. Signed-off-by: Michael S. Tsirkin <[email protected]> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJXofvbAAoJECgfDbjSjVRpUTIH/iEoK9h636tBayXy0PXkPby0 6fMaRFy6H1HgEttgDhJE8Pqg/ba3qaW9Em0fHyFq7Mp2waFHAZ8hAT8phC6TAK3c CIBnfzyyuI8u3N9SnNOfelPVcwCBfuALuuTsXB/rwKbYQEVv+U5Rdt3Vyx9+lXkj P005klz7PfqxFhQrrnj4Eh7VawtHwmMuLH8YoWpCZpM71dHPo6eL+3ftKwhH2boo qK86uVprwba03Pewpm13vQnotemfVfUUkjXd4EJpG3dx7E0KZosuj0ZG9OV8mPGQ Cl2gBdUhocdJgeUnAHmf6tumYi9KFlYfy6xLy44YMmN7FL3E9nQjaKZp25UKfiM= =ztIm -----END PGP SIGNATURE----- Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost Pull virtio/vhost updates from Michael Tsirkin: - new vsock device support in host and guest - platform IOMMU support in host and guest, including compatibility quirks for legacy systems. - misc fixes and cleanups. * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: VSOCK: Use kvfree() vhost: split out vringh Kconfig vhost: detect 32 bit integer wrap around vhost: new device IOTLB API vhost: drop vringh dependency vhost: convert pre sorted vhost memory array to interval tree vhost: introduce vhost memory accessors VSOCK: Add Makefile and Kconfig VSOCK: Introduce vhost_vsock.ko VSOCK: Introduce virtio_transport.ko VSOCK: Introduce virtio_vsock_common.ko VSOCK: defer sock removal to transports VSOCK: transport-specific vsock_transport functions vhost: drop vringh dependency vop: pull in vhost Kconfig virtio: new feature to detect IOMMU device quirk balloon: check the number of available pages in leak balloon vhost: lockless enqueuing vhost: simplify work flushing
This commit is contained in:
commit
0803e04011
28 changed files with 3765 additions and 201 deletions
|
|
@ -207,6 +207,8 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
|
|||
num = min(num, ARRAY_SIZE(vb->pfns));
|
||||
|
||||
mutex_lock(&vb->balloon_lock);
|
||||
/* We can't release more pages than taken */
|
||||
num = min(num, (size_t)vb->num_pages);
|
||||
for (vb->num_pfns = 0; vb->num_pfns < num;
|
||||
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
|
||||
page = balloon_page_dequeue(vb_dev_info);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,10 @@ struct vring_virtqueue {
|
|||
#define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq)
|
||||
|
||||
/*
|
||||
* The interaction between virtio and a possible IOMMU is a mess.
|
||||
* Modern virtio devices have feature bits to specify whether they need a
|
||||
* quirk and bypass the IOMMU. If not there, just use the DMA API.
|
||||
*
|
||||
* If there, the interaction between virtio and DMA API is messy.
|
||||
*
|
||||
* On most systems with virtio, physical addresses match bus addresses,
|
||||
* and it doesn't particularly matter whether we use the DMA API.
|
||||
|
|
@ -133,10 +136,18 @@ struct vring_virtqueue {
|
|||
*
|
||||
* For the time being, we preserve historic behavior and bypass the DMA
|
||||
* API.
|
||||
*
|
||||
* TODO: install a per-device DMA ops structure that does the right thing
|
||||
* taking into account all the above quirks, and use the DMA API
|
||||
* unconditionally on data path.
|
||||
*/
|
||||
|
||||
static bool vring_use_dma_api(struct virtio_device *vdev)
|
||||
{
|
||||
if (!virtio_has_iommu_quirk(vdev))
|
||||
return true;
|
||||
|
||||
/* Otherwise, we are left to guess. */
|
||||
/*
|
||||
* In theory, it's possible to have a buggy QEMU-supposed
|
||||
* emulated Q35 IOMMU and Xen enabled at the same time. On
|
||||
|
|
@ -1099,6 +1110,8 @@ void vring_transport_features(struct virtio_device *vdev)
|
|||
break;
|
||||
case VIRTIO_F_VERSION_1:
|
||||
break;
|
||||
case VIRTIO_F_IOMMU_PLATFORM:
|
||||
break;
|
||||
default:
|
||||
/* We don't understand this bit. */
|
||||
__virtio_clear_bit(vdev, i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue