virtio: fixes and features 4.3
virtio-mmio can now be auto-loaded through acpi. virtio blk supports extended partitions. total memory is better reported when using virtio balloon with auto-deflate. cache control is re-enabled when using virtio-blk in modern mode. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJV7/iUAAoJECgfDbjSjVRpzRIIAMJz5enk2FbyiOsky5THASqK rWAEx+Jz5Av3FVM99W+Fs8dmXrBGkCTyRgmX3mZx+pGNhOsLjc6xHElTekzwQBas 18oFsQDTWk0rPZkO7X6/OY3GgHyq8VSI/2kW+yKMYj4k/gAaGV+Azf0m5DGMp4wn rngevvcDSkFEN2Gjxbi3MWT8sJ9Br/EFg6KzKUOiOycHh/rQZsaQK6tq4kpUZkil 2wvXspQY6ix2fD558gsiqUv6l8yZ9mXVgxtyRcnxjfM+8jr+qtqai8yVGCAC5krh 50RXrR22tN/6aLYuvtPj46+Y0dleCMEwW2rSmcw5h5yr3B/0ylnZ1YNp6vlFyv0= =8xQ2 -----END PGP SIGNATURE----- Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost Pull virtio updates from Michael Tsirkin: "Virtio fixes and features for 4.3: - virtio-mmio can now be auto-loaded through acpi. - virtio blk supports extended partitions. - total memory is better reported when using virtio balloon with auto-deflate. - cache control is re-enabled when using virtio-blk in modern mode" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio_balloon: do not change memory amount visible via /proc/meminfo virtio_ballon: change stub of release_pages_by_pfn virtio-blk: Allow extended partitions virtio_mmio: add ACPI probing virtio-blk: use VIRTIO_BLK_F_WCE and VIRTIO_BLK_F_CONFIG_WCE in virtio1
This commit is contained in:
Коммит
daf0e1ed57
|
@ -478,8 +478,7 @@ static int virtblk_get_cache_mode(struct virtio_device *vdev)
|
|||
struct virtio_blk_config, wce,
|
||||
&writeback);
|
||||
if (err)
|
||||
writeback = virtio_has_feature(vdev, VIRTIO_BLK_F_WCE) ||
|
||||
virtio_has_feature(vdev, VIRTIO_F_VERSION_1);
|
||||
writeback = virtio_has_feature(vdev, VIRTIO_BLK_F_WCE);
|
||||
|
||||
return writeback;
|
||||
}
|
||||
|
@ -657,6 +656,7 @@ static int virtblk_probe(struct virtio_device *vdev)
|
|||
vblk->disk->private_data = vblk;
|
||||
vblk->disk->fops = &virtblk_fops;
|
||||
vblk->disk->driverfs_dev = &vdev->dev;
|
||||
vblk->disk->flags |= GENHD_FL_EXT_DEVT;
|
||||
vblk->index = index;
|
||||
|
||||
/* configure queue flush support */
|
||||
|
@ -840,7 +840,7 @@ static unsigned int features_legacy[] = {
|
|||
static unsigned int features[] = {
|
||||
VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
|
||||
VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
|
||||
VIRTIO_BLK_F_TOPOLOGY,
|
||||
VIRTIO_BLK_F_WCE, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
|
||||
VIRTIO_BLK_F_MQ,
|
||||
};
|
||||
|
||||
|
|
|
@ -157,6 +157,8 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
|
|||
}
|
||||
set_page_pfns(vb->pfns + vb->num_pfns, page);
|
||||
vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
|
||||
if (!virtio_has_feature(vb->vdev,
|
||||
VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
|
||||
adjust_managed_page_count(page, -1);
|
||||
}
|
||||
|
||||
|
@ -166,13 +168,15 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
|
|||
mutex_unlock(&vb->balloon_lock);
|
||||
}
|
||||
|
||||
static void release_pages_by_pfn(const u32 pfns[], unsigned int num)
|
||||
static void release_pages_balloon(struct virtio_balloon *vb)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Find pfns pointing at start of each page, get pages and free them. */
|
||||
for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) {
|
||||
struct page *page = balloon_pfn_to_page(pfns[i]);
|
||||
for (i = 0; i < vb->num_pfns; i += VIRTIO_BALLOON_PAGES_PER_PAGE) {
|
||||
struct page *page = balloon_pfn_to_page(vb->pfns[i]);
|
||||
if (!virtio_has_feature(vb->vdev,
|
||||
VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
|
||||
adjust_managed_page_count(page, 1);
|
||||
put_page(page); /* balloon reference */
|
||||
}
|
||||
|
@ -206,7 +210,7 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
|
|||
if (vb->num_pfns != 0)
|
||||
tell_host(vb, vb->deflate_vq);
|
||||
mutex_unlock(&vb->balloon_lock);
|
||||
release_pages_by_pfn(vb->pfns, vb->num_pfns);
|
||||
release_pages_balloon(vb);
|
||||
return num_freed_pages;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
#define pr_fmt(fmt) "virtio-mmio: " fmt
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -732,12 +733,21 @@ static struct of_device_id virtio_mmio_match[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(of, virtio_mmio_match);
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
static const struct acpi_device_id virtio_mmio_acpi_match[] = {
|
||||
{ "LNRO0005", },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match);
|
||||
#endif
|
||||
|
||||
static struct platform_driver virtio_mmio_driver = {
|
||||
.probe = virtio_mmio_probe,
|
||||
.remove = virtio_mmio_remove,
|
||||
.driver = {
|
||||
.name = "virtio-mmio",
|
||||
.of_match_table = virtio_mmio_match,
|
||||
.acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче