ccw.c (e70f971a6c1230138843d7ab82267e4a5aaf6bda) | ccw.c (909a6254edaa8d0b0e3f1c0a623862e73d1842e9) |
---|---|
1/* 2 * vfio based subchannel assignment support 3 * 4 * Copyright 2017 IBM Corp. 5 * Copyright 2019 Red Hat, Inc. 6 * 7 * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> 8 * Xiao Feng Ren <renxiaof@linux.vnet.ibm.com> --- 576 unchanged lines hidden (view full) --- 585 /* Call the class init function for subchannel. */ 586 if (cdc->realize) { 587 cdc->realize(cdev, vcdev->vdev.sysfsdev, &err); 588 if (err) { 589 goto out_err_propagate; 590 } 591 } 592 | 1/* 2 * vfio based subchannel assignment support 3 * 4 * Copyright 2017 IBM Corp. 5 * Copyright 2019 Red Hat, Inc. 6 * 7 * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> 8 * Xiao Feng Ren <renxiaof@linux.vnet.ibm.com> --- 576 unchanged lines hidden (view full) --- 585 /* Call the class init function for subchannel. */ 586 if (cdc->realize) { 587 cdc->realize(cdev, vcdev->vdev.sysfsdev, &err); 588 if (err) { 589 goto out_err_propagate; 590 } 591 } 592 |
593 if (vfio_device_get_name(vbasedev, errp) < 0) { 594 return; 595 } 596 |
|
593 vbasedev->ops = &vfio_ccw_ops; 594 vbasedev->type = VFIO_DEVICE_TYPE_CCW; | 597 vbasedev->ops = &vfio_ccw_ops; 598 vbasedev->type = VFIO_DEVICE_TYPE_CCW; |
595 vbasedev->name = g_strdup_printf("%x.%x.%04x", vcdev->cdev.hostid.cssid, 596 vcdev->cdev.hostid.ssid, 597 vcdev->cdev.hostid.devid); | |
598 vbasedev->dev = dev; 599 600 /* 601 * All vfio-ccw devices are believed to operate in a way compatible with 602 * discarding of memory in RAM blocks, ie. pages pinned in the host are 603 * in the current working set of the guest driver and therefore never 604 * overlap e.g., with pages available to the guest balloon driver. This 605 * needs to be set before vfio_get_device() for vfio common to handle --- 80 unchanged lines hidden (view full) --- 686 DEFINE_PROP_END_OF_LIST(), 687}; 688 689static const VMStateDescription vfio_ccw_vmstate = { 690 .name = "vfio-ccw", 691 .unmigratable = 1, 692}; 693 | 599 vbasedev->dev = dev; 600 601 /* 602 * All vfio-ccw devices are believed to operate in a way compatible with 603 * discarding of memory in RAM blocks, ie. pages pinned in the host are 604 * in the current working set of the guest driver and therefore never 605 * overlap e.g., with pages available to the guest balloon driver. This 606 * needs to be set before vfio_get_device() for vfio common to handle --- 80 unchanged lines hidden (view full) --- 687 DEFINE_PROP_END_OF_LIST(), 688}; 689 690static const VMStateDescription vfio_ccw_vmstate = { 691 .name = "vfio-ccw", 692 .unmigratable = 1, 693}; 694 |
695static void vfio_ccw_instance_init(Object *obj) 696{ 697 VFIOCCWDevice *vcdev = VFIO_CCW(obj); 698 699 vcdev->vdev.fd = -1; 700} 701 702#ifdef CONFIG_IOMMUFD 703static void vfio_ccw_set_fd(Object *obj, const char *str, Error **errp) 704{ 705 vfio_device_set_fd(&VFIO_CCW(obj)->vdev, str, errp); 706} 707#endif 708 |
|
694static void vfio_ccw_class_init(ObjectClass *klass, void *data) 695{ 696 DeviceClass *dc = DEVICE_CLASS(klass); 697 S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass); 698 699 device_class_set_props(dc, vfio_ccw_properties); | 709static void vfio_ccw_class_init(ObjectClass *klass, void *data) 710{ 711 DeviceClass *dc = DEVICE_CLASS(klass); 712 S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass); 713 714 device_class_set_props(dc, vfio_ccw_properties); |
715#ifdef CONFIG_IOMMUFD 716 object_class_property_add_str(klass, "fd", NULL, vfio_ccw_set_fd); 717#endif |
|
700 dc->vmsd = &vfio_ccw_vmstate; 701 dc->desc = "VFIO-based subchannel assignment"; 702 set_bit(DEVICE_CATEGORY_MISC, dc->categories); 703 dc->realize = vfio_ccw_realize; 704 dc->unrealize = vfio_ccw_unrealize; 705 dc->reset = vfio_ccw_reset; 706 707 cdc->handle_request = vfio_ccw_handle_request; 708 cdc->handle_halt = vfio_ccw_handle_halt; 709 cdc->handle_clear = vfio_ccw_handle_clear; 710 cdc->handle_store = vfio_ccw_handle_store; 711} 712 713static const TypeInfo vfio_ccw_info = { 714 .name = TYPE_VFIO_CCW, 715 .parent = TYPE_S390_CCW, 716 .instance_size = sizeof(VFIOCCWDevice), | 718 dc->vmsd = &vfio_ccw_vmstate; 719 dc->desc = "VFIO-based subchannel assignment"; 720 set_bit(DEVICE_CATEGORY_MISC, dc->categories); 721 dc->realize = vfio_ccw_realize; 722 dc->unrealize = vfio_ccw_unrealize; 723 dc->reset = vfio_ccw_reset; 724 725 cdc->handle_request = vfio_ccw_handle_request; 726 cdc->handle_halt = vfio_ccw_handle_halt; 727 cdc->handle_clear = vfio_ccw_handle_clear; 728 cdc->handle_store = vfio_ccw_handle_store; 729} 730 731static const TypeInfo vfio_ccw_info = { 732 .name = TYPE_VFIO_CCW, 733 .parent = TYPE_S390_CCW, 734 .instance_size = sizeof(VFIOCCWDevice), |
735 .instance_init = vfio_ccw_instance_init, |
|
717 .class_init = vfio_ccw_class_init, 718}; 719 720static void register_vfio_ccw_type(void) 721{ 722 type_register_static(&vfio_ccw_info); 723} 724 725type_init(register_vfio_ccw_type) | 736 .class_init = vfio_ccw_class_init, 737}; 738 739static void register_vfio_ccw_type(void) 740{ 741 type_register_static(&vfio_ccw_info); 742} 743 744type_init(register_vfio_ccw_type) |