]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Sep 2015 17:37:41 +0000 (10:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Sep 2015 17:37:41 +0000 (10:37 -0700)
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

drivers/block/virtio_blk.c
drivers/virtio/virtio_balloon.c
drivers/virtio/virtio_mmio.c

index d4d05f064d390772a2f99acbf882eaa983788511..e93899cc6f60be0bd13b45dde3b8d697b7a733c8 100644 (file)
@@ -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,
 };
 
index 82e80e034f250b88993af25bb27434c2a78f8204..7efc32945810e8fdcafa76a6328517f35d65ea3c 100644 (file)
@@ -157,7 +157,9 @@ 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;
-               adjust_managed_page_count(page, -1);
+               if (!virtio_has_feature(vb->vdev,
+                                       VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
+                       adjust_managed_page_count(page, -1);
        }
 
        /* Did we get any? */
@@ -166,14 +168,16 @@ 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]);
-               adjust_managed_page_count(page, 1);
+       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;
 }
 
index 10189b5b627f962cb9a8e9527aae829e27b0aec2..f499d9da72373d04d115caa4b7b4c9e6585ee965 100644 (file)
@@ -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),
        },
 };