diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-04 21:56:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-04 21:56:36 -0500 |
commit | a83b04232cec52a8a93700ab7f17a09500c558b8 (patch) | |
tree | af908027b4c52728d30fe2ab0b7f18600d8c956d /samples | |
parent | ee5e001196d1345b8fee25925ff5f1d67936081e (diff) | |
parent | 0cfd027be1d6def4a462cdc180c055143af24069 (diff) |
Merge tag 'vfio-v5.1-rc1' of git://github.com/awilliam/linux-vfio
Pull VFIO updates from Alex Williamson:
- Switch mdev to generic UUID API (Andy Shevchenko)
- Fixup platform reset include paths (Masahiro Yamada)
- Fix usage of MINORMASK (Chengguang Xu)
- Remove noise from duplicate spapr table unsets (Alexey Kardashevskiy)
- Restore device state after PM reset (Alex Williamson)
- Ensure memory translation enabled for PCI ROM access (Eric Auger)
* tag 'vfio-v5.1-rc1' of git://github.com/awilliam/linux-vfio:
vfio_pci: Enable memory accesses before calling pci_map_rom
vfio/pci: Restore device state on PM transition
vfio/spapr_tce: Skip unsetting already unset table
samples/vfio-mdev/mtty: expand minor range when registering chrdev region
samples/vfio-mdev/mdpy: expand minor range when registering chrdev region
samples/vfio-mdev/mbochs: expand minor range when registering chrdev region
vfio: expand minor range when registering chrdev region
vfio: platform: reset: fix up include directives to remove ccflags-y
vfio-mdev: Switch to use new generic UUID API
Diffstat (limited to 'samples')
-rw-r--r-- | samples/vfio-mdev/mbochs.c | 8 | ||||
-rw-r--r-- | samples/vfio-mdev/mdpy.c | 8 | ||||
-rw-r--r-- | samples/vfio-mdev/mtty.c | 17 |
3 files changed, 17 insertions, 16 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index ca7960adf5a3..b038aa9f5a70 100644 --- a/samples/vfio-mdev/mbochs.c +++ b/samples/vfio-mdev/mbochs.c | |||
@@ -1448,13 +1448,13 @@ static int __init mbochs_dev_init(void) | |||
1448 | { | 1448 | { |
1449 | int ret = 0; | 1449 | int ret = 0; |
1450 | 1450 | ||
1451 | ret = alloc_chrdev_region(&mbochs_devt, 0, MINORMASK, MBOCHS_NAME); | 1451 | ret = alloc_chrdev_region(&mbochs_devt, 0, MINORMASK + 1, MBOCHS_NAME); |
1452 | if (ret < 0) { | 1452 | if (ret < 0) { |
1453 | pr_err("Error: failed to register mbochs_dev, err: %d\n", ret); | 1453 | pr_err("Error: failed to register mbochs_dev, err: %d\n", ret); |
1454 | return ret; | 1454 | return ret; |
1455 | } | 1455 | } |
1456 | cdev_init(&mbochs_cdev, &vd_fops); | 1456 | cdev_init(&mbochs_cdev, &vd_fops); |
1457 | cdev_add(&mbochs_cdev, mbochs_devt, MINORMASK); | 1457 | cdev_add(&mbochs_cdev, mbochs_devt, MINORMASK + 1); |
1458 | pr_info("%s: major %d\n", __func__, MAJOR(mbochs_devt)); | 1458 | pr_info("%s: major %d\n", __func__, MAJOR(mbochs_devt)); |
1459 | 1459 | ||
1460 | mbochs_class = class_create(THIS_MODULE, MBOCHS_CLASS_NAME); | 1460 | mbochs_class = class_create(THIS_MODULE, MBOCHS_CLASS_NAME); |
@@ -1483,7 +1483,7 @@ failed2: | |||
1483 | class_destroy(mbochs_class); | 1483 | class_destroy(mbochs_class); |
1484 | failed1: | 1484 | failed1: |
1485 | cdev_del(&mbochs_cdev); | 1485 | cdev_del(&mbochs_cdev); |
1486 | unregister_chrdev_region(mbochs_devt, MINORMASK); | 1486 | unregister_chrdev_region(mbochs_devt, MINORMASK + 1); |
1487 | return ret; | 1487 | return ret; |
1488 | } | 1488 | } |
1489 | 1489 | ||
@@ -1494,7 +1494,7 @@ static void __exit mbochs_dev_exit(void) | |||
1494 | 1494 | ||
1495 | device_unregister(&mbochs_dev); | 1495 | device_unregister(&mbochs_dev); |
1496 | cdev_del(&mbochs_cdev); | 1496 | cdev_del(&mbochs_cdev); |
1497 | unregister_chrdev_region(mbochs_devt, MINORMASK); | 1497 | unregister_chrdev_region(mbochs_devt, MINORMASK + 1); |
1498 | class_destroy(mbochs_class); | 1498 | class_destroy(mbochs_class); |
1499 | mbochs_class = NULL; | 1499 | mbochs_class = NULL; |
1500 | } | 1500 | } |
diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c index 96e7969c473a..cc86bf6566e4 100644 --- a/samples/vfio-mdev/mdpy.c +++ b/samples/vfio-mdev/mdpy.c | |||
@@ -752,13 +752,13 @@ static int __init mdpy_dev_init(void) | |||
752 | { | 752 | { |
753 | int ret = 0; | 753 | int ret = 0; |
754 | 754 | ||
755 | ret = alloc_chrdev_region(&mdpy_devt, 0, MINORMASK, MDPY_NAME); | 755 | ret = alloc_chrdev_region(&mdpy_devt, 0, MINORMASK + 1, MDPY_NAME); |
756 | if (ret < 0) { | 756 | if (ret < 0) { |
757 | pr_err("Error: failed to register mdpy_dev, err: %d\n", ret); | 757 | pr_err("Error: failed to register mdpy_dev, err: %d\n", ret); |
758 | return ret; | 758 | return ret; |
759 | } | 759 | } |
760 | cdev_init(&mdpy_cdev, &vd_fops); | 760 | cdev_init(&mdpy_cdev, &vd_fops); |
761 | cdev_add(&mdpy_cdev, mdpy_devt, MINORMASK); | 761 | cdev_add(&mdpy_cdev, mdpy_devt, MINORMASK + 1); |
762 | pr_info("%s: major %d\n", __func__, MAJOR(mdpy_devt)); | 762 | pr_info("%s: major %d\n", __func__, MAJOR(mdpy_devt)); |
763 | 763 | ||
764 | mdpy_class = class_create(THIS_MODULE, MDPY_CLASS_NAME); | 764 | mdpy_class = class_create(THIS_MODULE, MDPY_CLASS_NAME); |
@@ -787,7 +787,7 @@ failed2: | |||
787 | class_destroy(mdpy_class); | 787 | class_destroy(mdpy_class); |
788 | failed1: | 788 | failed1: |
789 | cdev_del(&mdpy_cdev); | 789 | cdev_del(&mdpy_cdev); |
790 | unregister_chrdev_region(mdpy_devt, MINORMASK); | 790 | unregister_chrdev_region(mdpy_devt, MINORMASK + 1); |
791 | return ret; | 791 | return ret; |
792 | } | 792 | } |
793 | 793 | ||
@@ -798,7 +798,7 @@ static void __exit mdpy_dev_exit(void) | |||
798 | 798 | ||
799 | device_unregister(&mdpy_dev); | 799 | device_unregister(&mdpy_dev); |
800 | cdev_del(&mdpy_cdev); | 800 | cdev_del(&mdpy_cdev); |
801 | unregister_chrdev_region(mdpy_devt, MINORMASK); | 801 | unregister_chrdev_region(mdpy_devt, MINORMASK + 1); |
802 | class_destroy(mdpy_class); | 802 | class_destroy(mdpy_class); |
803 | mdpy_class = NULL; | 803 | mdpy_class = NULL; |
804 | } | 804 | } |
diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c index f6732aa16bb1..1c77c370c92f 100644 --- a/samples/vfio-mdev/mtty.c +++ b/samples/vfio-mdev/mtty.c | |||
@@ -156,15 +156,15 @@ static const struct file_operations vd_fops = { | |||
156 | 156 | ||
157 | /* function prototypes */ | 157 | /* function prototypes */ |
158 | 158 | ||
159 | static int mtty_trigger_interrupt(uuid_le uuid); | 159 | static int mtty_trigger_interrupt(const guid_t *uuid); |
160 | 160 | ||
161 | /* Helper functions */ | 161 | /* Helper functions */ |
162 | static struct mdev_state *find_mdev_state_by_uuid(uuid_le uuid) | 162 | static struct mdev_state *find_mdev_state_by_uuid(const guid_t *uuid) |
163 | { | 163 | { |
164 | struct mdev_state *mds; | 164 | struct mdev_state *mds; |
165 | 165 | ||
166 | list_for_each_entry(mds, &mdev_devices_list, next) { | 166 | list_for_each_entry(mds, &mdev_devices_list, next) { |
167 | if (uuid_le_cmp(mdev_uuid(mds->mdev), uuid) == 0) | 167 | if (guid_equal(mdev_uuid(mds->mdev), uuid)) |
168 | return mds; | 168 | return mds; |
169 | } | 169 | } |
170 | 170 | ||
@@ -1032,7 +1032,7 @@ static int mtty_set_irqs(struct mdev_device *mdev, uint32_t flags, | |||
1032 | return ret; | 1032 | return ret; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | static int mtty_trigger_interrupt(uuid_le uuid) | 1035 | static int mtty_trigger_interrupt(const guid_t *uuid) |
1036 | { | 1036 | { |
1037 | int ret = -1; | 1037 | int ret = -1; |
1038 | struct mdev_state *mdev_state; | 1038 | struct mdev_state *mdev_state; |
@@ -1442,7 +1442,8 @@ static int __init mtty_dev_init(void) | |||
1442 | 1442 | ||
1443 | idr_init(&mtty_dev.vd_idr); | 1443 | idr_init(&mtty_dev.vd_idr); |
1444 | 1444 | ||
1445 | ret = alloc_chrdev_region(&mtty_dev.vd_devt, 0, MINORMASK, MTTY_NAME); | 1445 | ret = alloc_chrdev_region(&mtty_dev.vd_devt, 0, MINORMASK + 1, |
1446 | MTTY_NAME); | ||
1446 | 1447 | ||
1447 | if (ret < 0) { | 1448 | if (ret < 0) { |
1448 | pr_err("Error: failed to register mtty_dev, err:%d\n", ret); | 1449 | pr_err("Error: failed to register mtty_dev, err:%d\n", ret); |
@@ -1450,7 +1451,7 @@ static int __init mtty_dev_init(void) | |||
1450 | } | 1451 | } |
1451 | 1452 | ||
1452 | cdev_init(&mtty_dev.vd_cdev, &vd_fops); | 1453 | cdev_init(&mtty_dev.vd_cdev, &vd_fops); |
1453 | cdev_add(&mtty_dev.vd_cdev, mtty_dev.vd_devt, MINORMASK); | 1454 | cdev_add(&mtty_dev.vd_cdev, mtty_dev.vd_devt, MINORMASK + 1); |
1454 | 1455 | ||
1455 | pr_info("major_number:%d\n", MAJOR(mtty_dev.vd_devt)); | 1456 | pr_info("major_number:%d\n", MAJOR(mtty_dev.vd_devt)); |
1456 | 1457 | ||
@@ -1487,7 +1488,7 @@ failed2: | |||
1487 | 1488 | ||
1488 | failed1: | 1489 | failed1: |
1489 | cdev_del(&mtty_dev.vd_cdev); | 1490 | cdev_del(&mtty_dev.vd_cdev); |
1490 | unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK); | 1491 | unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK + 1); |
1491 | 1492 | ||
1492 | all_done: | 1493 | all_done: |
1493 | return ret; | 1494 | return ret; |
@@ -1501,7 +1502,7 @@ static void __exit mtty_dev_exit(void) | |||
1501 | device_unregister(&mtty_dev.dev); | 1502 | device_unregister(&mtty_dev.dev); |
1502 | idr_destroy(&mtty_dev.vd_idr); | 1503 | idr_destroy(&mtty_dev.vd_idr); |
1503 | cdev_del(&mtty_dev.vd_cdev); | 1504 | cdev_del(&mtty_dev.vd_cdev); |
1504 | unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK); | 1505 | unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK + 1); |
1505 | class_destroy(mtty_dev.vd_class); | 1506 | class_destroy(mtty_dev.vd_class); |
1506 | mtty_dev.vd_class = NULL; | 1507 | mtty_dev.vd_class = NULL; |
1507 | pr_info("mtty_dev: Unloaded!\n"); | 1508 | pr_info("mtty_dev: Unloaded!\n"); |