Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

virtio/s390: add indirection to indicators access

This will come in handy soon when we pull out the indicators from
virtio_ccw_device to a memory area that is shared with the hypervisor
(in particular for protected virtualization guests).

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Michael Mueller <mimu@linux.ibm.com>
Tested-by: Michael Mueller <mimu@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

authored by

Halil Pasic and committed by
Heiko Carstens
22a4a639 01b3fb1e

+25 -15
+25 -15
drivers/s390/virtio/virtio_ccw.c
··· 68 68 void *airq_info; 69 69 }; 70 70 71 + static inline unsigned long *indicators(struct virtio_ccw_device *vcdev) 72 + { 73 + return &vcdev->indicators; 74 + } 75 + 76 + static inline unsigned long *indicators2(struct virtio_ccw_device *vcdev) 77 + { 78 + return &vcdev->indicators2; 79 + } 80 + 71 81 struct vq_info_block_legacy { 72 82 __u64 queue; 73 83 __u32 align; ··· 348 338 ccw->cda = (__u32)(unsigned long) thinint_area; 349 339 } else { 350 340 /* payload is the address of the indicators */ 351 - indicatorp = kmalloc(sizeof(&vcdev->indicators), 341 + indicatorp = kmalloc(sizeof(indicators(vcdev)), 352 342 GFP_DMA | GFP_KERNEL); 353 343 if (!indicatorp) 354 344 return; 355 345 *indicatorp = 0; 356 346 ccw->cmd_code = CCW_CMD_SET_IND; 357 - ccw->count = sizeof(&vcdev->indicators); 347 + ccw->count = sizeof(indicators(vcdev)); 358 348 ccw->cda = (__u32)(unsigned long) indicatorp; 359 349 } 360 350 /* Deregister indicators from host. */ 361 - vcdev->indicators = 0; 351 + *indicators(vcdev) = 0; 362 352 ccw->flags = 0; 363 353 ret = ccw_io_helper(vcdev, ccw, 364 354 vcdev->is_thinint ? ··· 667 657 * We need a data area under 2G to communicate. Our payload is 668 658 * the address of the indicators. 669 659 */ 670 - indicatorp = kmalloc(sizeof(&vcdev->indicators), GFP_DMA | GFP_KERNEL); 660 + indicatorp = kmalloc(sizeof(indicators(vcdev)), GFP_DMA | GFP_KERNEL); 671 661 if (!indicatorp) 672 662 goto out; 673 - *indicatorp = (unsigned long) &vcdev->indicators; 663 + *indicatorp = (unsigned long) indicators(vcdev); 674 664 if (vcdev->is_thinint) { 675 665 ret = virtio_ccw_register_adapter_ind(vcdev, vqs, nvqs, ccw); 676 666 if (ret) ··· 679 669 } 680 670 if (!vcdev->is_thinint) { 681 671 /* Register queue indicators with host. */ 682 - vcdev->indicators = 0; 672 + *indicators(vcdev) = 0; 683 673 ccw->cmd_code = CCW_CMD_SET_IND; 684 674 ccw->flags = 0; 685 - ccw->count = sizeof(&vcdev->indicators); 675 + ccw->count = sizeof(indicators(vcdev)); 686 676 ccw->cda = (__u32)(unsigned long) indicatorp; 687 677 ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_IND); 688 678 if (ret) 689 679 goto out; 690 680 } 691 681 /* Register indicators2 with host for config changes */ 692 - *indicatorp = (unsigned long) &vcdev->indicators2; 693 - vcdev->indicators2 = 0; 682 + *indicatorp = (unsigned long) indicators2(vcdev); 683 + *indicators2(vcdev) = 0; 694 684 ccw->cmd_code = CCW_CMD_SET_CONF_IND; 695 685 ccw->flags = 0; 696 - ccw->count = sizeof(&vcdev->indicators2); 686 + ccw->count = sizeof(indicators2(vcdev)); 697 687 ccw->cda = (__u32)(unsigned long) indicatorp; 698 688 ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_CONF_IND); 699 689 if (ret) ··· 1103 1093 vcdev->err = -EIO; 1104 1094 } 1105 1095 virtio_ccw_check_activity(vcdev, activity); 1106 - for_each_set_bit(i, &vcdev->indicators, 1107 - sizeof(vcdev->indicators) * BITS_PER_BYTE) { 1096 + for_each_set_bit(i, indicators(vcdev), 1097 + sizeof(*indicators(vcdev)) * BITS_PER_BYTE) { 1108 1098 /* The bit clear must happen before the vring kick. */ 1109 - clear_bit(i, &vcdev->indicators); 1099 + clear_bit(i, indicators(vcdev)); 1110 1100 barrier(); 1111 1101 vq = virtio_ccw_vq_by_ind(vcdev, i); 1112 1102 vring_interrupt(0, vq); 1113 1103 } 1114 - if (test_bit(0, &vcdev->indicators2)) { 1104 + if (test_bit(0, indicators2(vcdev))) { 1115 1105 virtio_config_changed(&vcdev->vdev); 1116 - clear_bit(0, &vcdev->indicators2); 1106 + clear_bit(0, indicators2(vcdev)); 1117 1107 } 1118 1108 } 1119 1109