diff options
Diffstat (limited to 'drivers/s390')
34 files changed, 956 insertions, 261 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 86b6f1cc1b1..a1d3ddba99c 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
| @@ -22,6 +22,9 @@ | |||
| 22 | #include <linux/hdreg.h> | 22 | #include <linux/hdreg.h> |
| 23 | #include <linux/async.h> | 23 | #include <linux/async.h> |
| 24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
| 25 | #include <linux/debugfs.h> | ||
| 26 | #include <linux/seq_file.h> | ||
| 27 | #include <linux/vmalloc.h> | ||
| 25 | 28 | ||
| 26 | #include <asm/ccwdev.h> | 29 | #include <asm/ccwdev.h> |
| 27 | #include <asm/ebcdic.h> | 30 | #include <asm/ebcdic.h> |
| @@ -45,6 +48,7 @@ | |||
| 45 | * SECTION: exported variables of dasd.c | 48 | * SECTION: exported variables of dasd.c |
| 46 | */ | 49 | */ |
| 47 | debug_info_t *dasd_debug_area; | 50 | debug_info_t *dasd_debug_area; |
| 51 | static struct dentry *dasd_debugfs_root_entry; | ||
| 48 | struct dasd_discipline *dasd_diag_discipline_pointer; | 52 | struct dasd_discipline *dasd_diag_discipline_pointer; |
| 49 | void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); | 53 | void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); |
| 50 | 54 | ||
| @@ -71,6 +75,8 @@ static void dasd_return_cqr_cb(struct dasd_ccw_req *, void *); | |||
| 71 | static void dasd_device_timeout(unsigned long); | 75 | static void dasd_device_timeout(unsigned long); |
| 72 | static void dasd_block_timeout(unsigned long); | 76 | static void dasd_block_timeout(unsigned long); |
| 73 | static void __dasd_process_erp(struct dasd_device *, struct dasd_ccw_req *); | 77 | static void __dasd_process_erp(struct dasd_device *, struct dasd_ccw_req *); |
| 78 | static void dasd_profile_init(struct dasd_profile *, struct dentry *); | ||
| 79 | static void dasd_profile_exit(struct dasd_profile *); | ||
| 74 | 80 | ||
| 75 | /* | 81 | /* |
| 76 | * SECTION: Operations on the device structure. | 82 | * SECTION: Operations on the device structure. |
| @@ -121,7 +127,7 @@ struct dasd_device *dasd_alloc_device(void) | |||
| 121 | device->state = DASD_STATE_NEW; | 127 | device->state = DASD_STATE_NEW; |
| 122 | device->target = DASD_STATE_NEW; | 128 | device->target = DASD_STATE_NEW; |
| 123 | mutex_init(&device->state_mutex); | 129 | mutex_init(&device->state_mutex); |
| 124 | 130 | spin_lock_init(&device->profile.lock); | |
| 125 | return device; | 131 | return device; |
| 126 | } | 132 | } |
| 127 | 133 | ||
| @@ -159,6 +165,7 @@ struct dasd_block *dasd_alloc_block(void) | |||
| 159 | init_timer(&block->timer); | 165 | init_timer(&block->timer); |
| 160 | block->timer.function = dasd_block_timeout; | 166 | block->timer.function = dasd_block_timeout; |
| 161 | block->timer.data = (unsigned long) block; | 167 | block->timer.data = (unsigned long) block; |
| 168 | spin_lock_init(&block->profile.lock); | ||
| 162 | 169 | ||
| 163 | return block; | 170 | return block; |
| 164 | } | 171 | } |
| @@ -222,19 +229,44 @@ static int dasd_state_known_to_new(struct dasd_device *device) | |||
| 222 | return 0; | 229 | return 0; |
| 223 | } | 230 | } |
| 224 | 231 | ||
| 232 | static struct dentry *dasd_debugfs_setup(const char *name, | ||
| 233 | struct dentry *base_dentry) | ||
| 234 | { | ||
| 235 | struct dentry *pde; | ||
| 236 | |||
| 237 | if (!base_dentry) | ||
| 238 | return NULL; | ||
| 239 | pde = debugfs_create_dir(name, base_dentry); | ||
| 240 | if (!pde || IS_ERR(pde)) | ||
| 241 | return NULL; | ||
| 242 | return pde; | ||
| 243 | } | ||
| 244 | |||
| 225 | /* | 245 | /* |
| 226 | * Request the irq line for the device. | 246 | * Request the irq line for the device. |
| 227 | */ | 247 | */ |
| 228 | static int dasd_state_known_to_basic(struct dasd_device *device) | 248 | static int dasd_state_known_to_basic(struct dasd_device *device) |
| 229 | { | 249 | { |
| 250 | struct dasd_block *block = device->block; | ||
| 230 | int rc; | 251 | int rc; |
| 231 | 252 | ||
| 232 | /* Allocate and register gendisk structure. */ | 253 | /* Allocate and register gendisk structure. */ |
| 233 | if (device->block) { | 254 | if (block) { |
| 234 | rc = dasd_gendisk_alloc(device->block); | 255 | rc = dasd_gendisk_alloc(block); |
| 235 | if (rc) | 256 | if (rc) |
| 236 | return rc; | 257 | return rc; |
| 237 | } | 258 | block->debugfs_dentry = |
| 259 | dasd_debugfs_setup(block->gdp->disk_name, | ||
| 260 | dasd_debugfs_root_entry); | ||
| 261 | dasd_profile_init(&block->profile, block->debugfs_dentry); | ||
| 262 | if (dasd_global_profile_level == DASD_PROFILE_ON) | ||
| 263 | dasd_profile_on(&device->block->profile); | ||
| 264 | } | ||
| 265 | device->debugfs_dentry = | ||
| 266 | dasd_debugfs_setup(dev_name(&device->cdev->dev), | ||
| 267 | dasd_debugfs_root_entry); | ||
| 268 | dasd_profile_init(&device->profile, device->debugfs_dentry); | ||
| 269 | |||
| 238 | /* register 'device' debug area, used for all DBF_DEV_XXX calls */ | 270 | /* register 'device' debug area, used for all DBF_DEV_XXX calls */ |
| 239 | device->debug_area = debug_register(dev_name(&device->cdev->dev), 4, 1, | 271 | device->debug_area = debug_register(dev_name(&device->cdev->dev), 4, 1, |
| 240 | 8 * sizeof(long)); | 272 | 8 * sizeof(long)); |
| @@ -253,6 +285,9 @@ static int dasd_state_basic_to_known(struct dasd_device *device) | |||
| 253 | { | 285 | { |
| 254 | int rc; | 286 | int rc; |
| 255 | if (device->block) { | 287 | if (device->block) { |
| 288 | dasd_profile_exit(&device->block->profile); | ||
| 289 | if (device->block->debugfs_dentry) | ||
| 290 | debugfs_remove(device->block->debugfs_dentry); | ||
| 256 | dasd_gendisk_free(device->block); | 291 | dasd_gendisk_free(device->block); |
| 257 | dasd_block_clear_timer(device->block); | 292 | dasd_block_clear_timer(device->block); |
| 258 | } | 293 | } |
| @@ -260,6 +295,9 @@ static int dasd_state_basic_to_known(struct dasd_device *device) | |||
| 260 | if (rc) | 295 | if (rc) |
| 261 | return rc; | 296 | return rc; |
| 262 | dasd_device_clear_timer(device); | 297 | dasd_device_clear_timer(device); |
| 298 | dasd_profile_exit(&device->profile); | ||
| 299 | if (device->debugfs_dentry) | ||
| 300 | debugfs_remove(device->debugfs_dentry); | ||
| 263 | 301 | ||
| 264 | DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device); | 302 | DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device); |
| 265 | if (device->debug_area != NULL) { | 303 | if (device->debug_area != NULL) { |
| @@ -609,21 +647,13 @@ void dasd_enable_device(struct dasd_device *device) | |||
| 609 | /* | 647 | /* |
| 610 | * SECTION: device operation (interrupt handler, start i/o, term i/o ...) | 648 | * SECTION: device operation (interrupt handler, start i/o, term i/o ...) |
| 611 | */ | 649 | */ |
| 612 | #ifdef CONFIG_DASD_PROFILE | ||
| 613 | 650 | ||
| 614 | struct dasd_profile_info_t dasd_global_profile; | 651 | unsigned int dasd_global_profile_level = DASD_PROFILE_OFF; |
| 615 | unsigned int dasd_profile_level = DASD_PROFILE_OFF; | ||
| 616 | 652 | ||
| 617 | /* | 653 | #ifdef CONFIG_DASD_PROFILE |
| 618 | * Increments counter in global and local profiling structures. | 654 | struct dasd_profile_info dasd_global_profile_data; |
| 619 | */ | 655 | static struct dentry *dasd_global_profile_dentry; |
| 620 | #define dasd_profile_counter(value, counter, block) \ | 656 | static struct dentry *dasd_debugfs_global_entry; |
| 621 | { \ | ||
| 622 | int index; \ | ||
| 623 | for (index = 0; index < 31 && value >> (2+index); index++); \ | ||
| 624 | dasd_global_profile.counter[index]++; \ | ||
| 625 | block->profile.counter[index]++; \ | ||
| 626 | } | ||
| 627 | 657 | ||
| 628 | /* | 658 | /* |
| 629 | * Add profiling information for cqr before execution. | 659 | * Add profiling information for cqr before execution. |
| @@ -634,30 +664,121 @@ static void dasd_profile_start(struct dasd_block *block, | |||
| 634 | { | 664 | { |
| 635 | struct list_head *l; | 665 | struct list_head *l; |
| 636 | unsigned int counter; | 666 | unsigned int counter; |
| 637 | 667 | struct dasd_device *device; | |
| 638 | if (dasd_profile_level != DASD_PROFILE_ON) | ||
| 639 | return; | ||
| 640 | 668 | ||
| 641 | /* count the length of the chanq for statistics */ | 669 | /* count the length of the chanq for statistics */ |
| 642 | counter = 0; | 670 | counter = 0; |
| 643 | list_for_each(l, &block->ccw_queue) | 671 | if (dasd_global_profile_level || block->profile.data) |
| 644 | if (++counter >= 31) | 672 | list_for_each(l, &block->ccw_queue) |
| 645 | break; | 673 | if (++counter >= 31) |
| 646 | dasd_global_profile.dasd_io_nr_req[counter]++; | 674 | break; |
| 647 | block->profile.dasd_io_nr_req[counter]++; | 675 | |
| 676 | if (dasd_global_profile_level) { | ||
| 677 | dasd_global_profile_data.dasd_io_nr_req[counter]++; | ||
| 678 | if (rq_data_dir(req) == READ) | ||
| 679 | dasd_global_profile_data.dasd_read_nr_req[counter]++; | ||
| 680 | } | ||
| 681 | |||
| 682 | spin_lock(&block->profile.lock); | ||
| 683 | if (block->profile.data) | ||
| 684 | block->profile.data->dasd_io_nr_req[counter]++; | ||
| 685 | if (rq_data_dir(req) == READ) | ||
| 686 | block->profile.data->dasd_read_nr_req[counter]++; | ||
| 687 | spin_unlock(&block->profile.lock); | ||
| 688 | |||
| 689 | /* | ||
| 690 | * We count the request for the start device, even though it may run on | ||
| 691 | * some other device due to error recovery. This way we make sure that | ||
| 692 | * we count each request only once. | ||
| 693 | */ | ||
| 694 | device = cqr->startdev; | ||
| 695 | if (device->profile.data) { | ||
| 696 | counter = 1; /* request is not yet queued on the start device */ | ||
| 697 | list_for_each(l, &device->ccw_queue) | ||
| 698 | if (++counter >= 31) | ||
| 699 | break; | ||
| 700 | } | ||
| 701 | spin_lock(&device->profile.lock); | ||
| 702 | if (device->profile.data) { | ||
| 703 | device->profile.data->dasd_io_nr_req[counter]++; | ||
| 704 | if (rq_data_dir(req) == READ) | ||
| 705 | device->profile.data->dasd_read_nr_req[counter]++; | ||
| 706 | } | ||
| 707 | spin_unlock(&device->profile.lock); | ||
| 648 | } | 708 | } |
| 649 | 709 | ||
| 650 | /* | 710 | /* |
| 651 | * Add profiling information for cqr after execution. | 711 | * Add profiling information for cqr after execution. |
| 652 | */ | 712 | */ |
| 713 | |||
| 714 | #define dasd_profile_counter(value, index) \ | ||
| 715 | { \ | ||
| 716 | for (index = 0; index < 31 && value >> (2+index); index++) \ | ||
| 717 | ; \ | ||
| 718 | } | ||
| 719 | |||
| 720 | static void dasd_profile_end_add_data(struct dasd_profile_info *data, | ||
| 721 | int is_alias, | ||
| 722 | int is_tpm, | ||
| 723 | int is_read, | ||
| 724 | long sectors, | ||
| 725 | int sectors_ind, | ||
| 726 | int tottime_ind, | ||
| 727 | int tottimeps_ind, | ||
| 728 | int strtime_ind, | ||
| 729 | int irqtime_ind, | ||
| 730 | int irqtimeps_ind, | ||
| 731 | int endtime_ind) | ||
| 732 | { | ||
| 733 | /* in case of an overflow, reset the whole profile */ | ||
| 734 | if (data->dasd_io_reqs == UINT_MAX) { | ||
| 735 | memset(data, 0, sizeof(*data)); | ||
| 736 | getnstimeofday(&data->starttod); | ||
| 737 | } | ||
| 738 | data->dasd_io_reqs++; | ||
| 739 | data->dasd_io_sects += sectors; | ||
| 740 | if (is_alias) | ||
| 741 | data->dasd_io_alias++; | ||
| 742 | if (is_tpm) | ||
| 743 | data->dasd_io_tpm++; | ||
| 744 | |||
| 745 | data->dasd_io_secs[sectors_ind]++; | ||
| 746 | data->dasd_io_times[tottime_ind]++; | ||
| 747 | data->dasd_io_timps[tottimeps_ind]++; | ||
| 748 | data->dasd_io_time1[strtime_ind]++; | ||
| 749 | data->dasd_io_time2[irqtime_ind]++; | ||
| 750 | data->dasd_io_time2ps[irqtimeps_ind]++; | ||
| 751 | data->dasd_io_time3[endtime_ind]++; | ||
| 752 | |||
| 753 | if (is_read) { | ||
| 754 | data->dasd_read_reqs++; | ||
| 755 | data->dasd_read_sects += sectors; | ||
| 756 | if (is_alias) | ||
| 757 | data->dasd_read_alias++; | ||
| 758 | if (is_tpm) | ||
| 759 | data->dasd_read_tpm++; | ||
| 760 | data->dasd_read_secs[sectors_ind]++; | ||
| 761 | data->dasd_read_times[tottime_ind]++; | ||
| 762 | data->dasd_read_time1[strtime_ind]++; | ||
| 763 | data->dasd_read_time2[irqtime_ind]++; | ||
| 764 | data->dasd_read_time3[endtime_ind]++; | ||
| 765 | } | ||
| 766 | } | ||
| 767 | |||
| 653 | static void dasd_profile_end(struct dasd_block *block, | 768 | static void dasd_profile_end(struct dasd_block *block, |
| 654 | struct dasd_ccw_req *cqr, | 769 | struct dasd_ccw_req *cqr, |
| 655 | struct request *req) | 770 | struct request *req) |
| 656 | { | 771 | { |
| 657 | long strtime, irqtime, endtime, tottime; /* in microseconds */ | 772 | long strtime, irqtime, endtime, tottime; /* in microseconds */ |
| 658 | long tottimeps, sectors; | 773 | long tottimeps, sectors; |
| 774 | struct dasd_device *device; | ||
| 775 | int sectors_ind, tottime_ind, tottimeps_ind, strtime_ind; | ||
| 776 | int irqtime_ind, irqtimeps_ind, endtime_ind; | ||
| 659 | 777 | ||
| 660 | if (dasd_profile_level != DASD_PROFILE_ON) | 778 | device = cqr->startdev; |
| 779 | if (!(dasd_global_profile_level || | ||
| 780 | block->profile.data || | ||
| 781 | device->profile.data)) | ||
| 661 | return; | 782 | return; |
| 662 | 783 | ||
| 663 | sectors = blk_rq_sectors(req); | 784 | sectors = blk_rq_sectors(req); |
| @@ -672,29 +793,392 @@ static void dasd_profile_end(struct dasd_block *block, | |||
| 672 | tottime = ((cqr->endclk - cqr->buildclk) >> 12); | 793 | tottime = ((cqr->endclk - cqr->buildclk) >> 12); |
| 673 | tottimeps = tottime / sectors; | 794 | tottimeps = tottime / sectors; |
| 674 | 795 | ||
| 675 | if (!dasd_global_profile.dasd_io_reqs) | 796 | dasd_profile_counter(sectors, sectors_ind); |
| 676 | memset(&dasd_global_profile, 0, | 797 | dasd_profile_counter(tottime, tottime_ind); |
| 677 | sizeof(struct dasd_profile_info_t)); | 798 | dasd_profile_counter(tottimeps, tottimeps_ind); |
| 678 | dasd_global_profile.dasd_io_reqs++; | 799 | dasd_profile_counter(strtime, strtime_ind); |
| 679 | dasd_global_profile.dasd_io_sects += sectors; | 800 | dasd_profile_counter(irqtime, irqtime_ind); |
| 680 | 801 | dasd_profile_counter(irqtime / sectors, irqtimeps_ind); | |
| 681 | if (!block->profile.dasd_io_reqs) | 802 | dasd_profile_counter(endtime, endtime_ind); |
| 682 | memset(&block->profile, 0, | 803 | |
| 683 | sizeof(struct dasd_profile_info_t)); | 804 | if (dasd_global_profile_level) { |
| 684 | block->profile.dasd_io_reqs++; | 805 | dasd_profile_end_add_data(&dasd_global_profile_data, |
| 685 | block->profile.dasd_io_sects += sectors; | 806 | cqr->startdev != block->base, |
| 686 | 807 | cqr->cpmode == 1, | |
| 687 | dasd_profile_counter(sectors, dasd_io_secs, block); | 808 | rq_data_dir(req) == READ, |
| 688 | dasd_profile_counter(tottime, dasd_io_times, block); | 809 | sectors, sectors_ind, tottime_ind, |
| 689 | dasd_profile_counter(tottimeps, dasd_io_timps, block); | 810 | tottimeps_ind, strtime_ind, |
| 690 | dasd_profile_counter(strtime, dasd_io_time1, block); | 811 | irqtime_ind, irqtimeps_ind, |
| 691 | dasd_profile_counter(irqtime, dasd_io_time2, block); | 812 | endtime_ind); |
| 692 | dasd_profile_counter(irqtime / sectors, dasd_io_time2ps, block); | 813 | } |
| 693 | dasd_profile_counter(endtime, dasd_io_time3, block); | 814 | |
| 815 | spin_lock(&block->profile.lock); | ||
| 816 | if (block->profile.data) | ||
| 817 | dasd_profile_end_add_data(block->profile.data, | ||
| 818 | cqr->startdev != block->base, | ||
| 819 | cqr->cpmode == 1, | ||
| 820 | rq_data_dir(req) == READ, | ||
| 821 | sectors, sectors_ind, tottime_ind, | ||
| 822 | tottimeps_ind, strtime_ind, | ||
| 823 | irqtime_ind, irqtimeps_ind, | ||
| 824 | endtime_ind); | ||
| 825 | spin_unlock(&block->profile.lock); | ||
| 826 | |||
| 827 | spin_lock(&device->profile.lock); | ||
| 828 | if (device->profile.data) | ||
| 829 | dasd_profile_end_add_data(device->profile.data, | ||
| 830 | cqr->startdev != block->base, | ||
| 831 | cqr->cpmode == 1, | ||
| 832 | rq_data_dir(req) == READ, | ||
| 833 | sectors, sectors_ind, tottime_ind, | ||
| 834 | tottimeps_ind, strtime_ind, | ||
| 835 | irqtime_ind, irqtimeps_ind, | ||
| 836 | endtime_ind); | ||
| 837 | spin_unlock(&device->profile.lock); | ||
| 838 | } | ||
| 839 | |||
| 840 | void dasd_profile_reset(struct dasd_profile *profile) | ||
| 841 | { | ||
| 842 | struct dasd_profile_info *data; | ||
| 843 | |||
| 844 | spin_lock_bh(&profile->lock); | ||
| 845 | data = profile->data; | ||
| 846 | if (!data) { | ||
| 847 | spin_unlock_bh(&profile->lock); | ||
| 848 | return; | ||
| 849 | } | ||
| 850 | memset(data, 0, sizeof(*data)); | ||
| 851 | getnstimeofday(&data->starttod); | ||
| 852 | spin_unlock_bh(&profile->lock); | ||
| 853 | } | ||
| 854 | |||
| 855 | void dasd_global_profile_reset(void) | ||
| 856 | { | ||
| 857 | memset(&dasd_global_profile_data, 0, sizeof(dasd_global_profile_data)); | ||
| 858 | getnstimeofday(&dasd_global_profile_data.starttod); | ||
| 859 | } | ||
| 860 | |||
| 861 | int dasd_profile_on(struct dasd_profile *profile) | ||
| 862 | { | ||
| 863 | struct dasd_profile_info *data; | ||
| 864 | |||
| 865 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
| 866 | if (!data) | ||
| 867 | return -ENOMEM; | ||
| 868 | spin_lock_bh(&profile->lock); | ||
| 869 | if (profile->data) { | ||
| 870 | spin_unlock_bh(&profile->lock); | ||
| 871 | kfree(data); | ||
| 872 | return 0; | ||
| 873 | } | ||
| 874 | getnstimeofday(&data->starttod); | ||
| 875 | profile->data = data; | ||
| 876 | spin_unlock_bh(&profile->lock); | ||
| 877 | return 0; | ||
| 878 | } | ||
| 879 | |||
| 880 | void dasd_profile_off(struct dasd_profile *profile) | ||
| 881 | { | ||
| 882 | spin_lock_bh(&profile->lock); | ||
| 883 | kfree(profile->data); | ||
| 884 | profile->data = NULL; | ||
| 885 | spin_unlock_bh(&profile->lock); | ||
| 886 | } | ||
| 887 | |||
| 888 | char *dasd_get_user_string(const char __user *user_buf, size_t user_len) | ||
| 889 | { | ||
| 890 | char *buffer; | ||
| 891 | |||
| 892 | buffer = vmalloc(user_len + 1); | ||
| 893 | if (buffer == NULL) | ||
| 894 | return ERR_PTR(-ENOMEM); | ||
| 895 | if (copy_from_user(buffer, user_buf, user_len) != 0) { | ||
| 896 | vfree(buffer); | ||
| 897 | return ERR_PTR(-EFAULT); | ||
| 898 | } | ||
| 899 | /* got the string, now strip linefeed. */ | ||
| 900 | if (buffer[user_len - 1] == '\n') | ||
| 901 | buffer[user_len - 1] = 0; | ||
| 902 | else | ||
| 903 | buffer[user_len] = 0; | ||
| 904 | return buffer; | ||
| 694 | } | 905 | } |
| 906 | |||
| 907 | static ssize_t dasd_stats_write(struct file *file, | ||
| 908 | const char __user *user_buf, | ||
| 909 | size_t user_len, loff_t *pos) | ||
| 910 | { | ||
| 911 | char *buffer, *str; | ||
| 912 | int rc; | ||
| 913 | struct seq_file *m = (struct seq_file *)file->private_data; | ||
| 914 | struct dasd_profile *prof = m->private; | ||
| 915 | |||
| 916 | if (user_len > 65536) | ||
| 917 | user_len = 65536; | ||
| 918 | buffer = dasd_get_user_string(user_buf, user_len); | ||
| 919 | if (IS_ERR(buffer)) | ||
| 920 | return PTR_ERR(buffer); | ||
| 921 | |||
| 922 | str = skip_spaces(buffer); | ||
| 923 | rc = user_len; | ||
| 924 | if (strncmp(str, "reset", 5) == 0) { | ||
| 925 | dasd_profile_reset(prof); | ||
| 926 | } else if (strncmp(str, "on", 2) == 0) { | ||
| 927 | rc = dasd_profile_on(prof); | ||
| 928 | if (!rc) | ||
| 929 | rc = user_len; | ||
| 930 | } else if (strncmp(str, "off", 3) == 0) { | ||
| 931 | dasd_profile_off(prof); | ||
| 932 | } else | ||
| 933 | rc = -EINVAL; | ||
| 934 | vfree(buffer); | ||
| 935 | return rc; | ||
| 936 | } | ||
| 937 | |||
| 938 | static void dasd_stats_array(struct seq_file *m, unsigned int *array) | ||
| 939 | { | ||
| 940 | int i; | ||
| 941 | |||
| 942 | for (i = 0; i < 32; i++) | ||
| 943 | seq_printf(m, "%u ", array[i]); | ||
| 944 | seq_putc(m, '\n'); | ||
| 945 | } | ||
| 946 | |||
| 947 | static void dasd_stats_seq_print(struct seq_file *m, | ||
| 948 | struct dasd_profile_info *data) | ||
| 949 | { | ||
| 950 | seq_printf(m, "start_time %ld.%09ld\n", | ||
| 951 | data->starttod.tv_sec, data->starttod.tv_nsec); | ||
| 952 | seq_printf(m, "total_requests %u\n", data->dasd_io_reqs); | ||
| 953 | seq_printf(m, "total_sectors %u\n", data->dasd_io_sects); | ||
| 954 | seq_printf(m, "total_pav %u\n", data->dasd_io_alias); | ||
| 955 | seq_printf(m, "total_hpf %u\n", data->dasd_io_tpm); | ||
| 956 | seq_printf(m, "histogram_sectors "); | ||
| 957 | dasd_stats_array(m, data->dasd_io_secs); | ||
| 958 | seq_printf(m, "histogram_io_times "); | ||
| 959 | dasd_stats_array(m, data->dasd_io_times); | ||
| 960 | seq_printf(m, "histogram_io_times_weighted "); | ||
| 961 | dasd_stats_array(m, data->dasd_io_timps); | ||
| 962 | seq_printf(m, "histogram_time_build_to_ssch "); | ||
| 963 | dasd_stats_array(m, data->dasd_io_time1); | ||
| 964 | seq_printf(m, "histogram_time_ssch_to_irq "); | ||
| 965 | dasd_stats_array(m, data->dasd_io_time2); | ||
| 966 | seq_printf(m, "histogram_time_ssch_to_irq_weighted "); | ||
| 967 | dasd_stats_array(m, data->dasd_io_time2ps); | ||
| 968 | seq_printf(m, "histogram_time_irq_to_end "); | ||
| 969 | dasd_stats_array(m, data->dasd_io_time3); | ||
| 970 | seq_printf(m, "histogram_ccw_queue_length "); | ||
| 971 | dasd_stats_array(m, data->dasd_io_nr_req); | ||
| 972 | seq_printf(m, "total_read_requests %u\n", data->dasd_read_reqs); | ||
| 973 | seq_printf(m, "total_read_sectors %u\n", data->dasd_read_sects); | ||
| 974 | seq_printf(m, "total_read_pav %u\n", data->dasd_read_alias); | ||
| 975 | seq_printf(m, "total_read_hpf %u\n", data->dasd_read_tpm); | ||
| 976 | seq_printf(m, "histogram_read_sectors "); | ||
| 977 | dasd_stats_array(m, data->dasd_read_secs); | ||
| 978 | seq_printf(m, "histogram_read_times "); | ||
| 979 | dasd_stats_array(m, data->dasd_read_times); | ||
| 980 | seq_printf(m, "histogram_read_time_build_to_ssch "); | ||
| 981 | dasd_stats_array(m, data->dasd_read_time1); | ||
| 982 | seq_printf(m, "histogram_read_time_ssch_to_irq "); | ||
| 983 | dasd_stats_array(m, data->dasd_read_time2); | ||
| 984 | seq_printf(m, "histogram_read_time_irq_to_end "); | ||
| 985 | dasd_stats_array(m, data->dasd_read_time3); | ||
| 986 | seq_printf(m, "histogram_read_ccw_queue_length "); | ||
| 987 | dasd_stats_array(m, data->dasd_read_nr_req); | ||
| 988 | } | ||
| 989 | |||
| 990 | static int dasd_stats_show(struct seq_file *m, void *v) | ||
| 991 | { | ||
| 992 | struct dasd_profile *profile; | ||
| 993 | struct dasd_profile_info *data; | ||
| 994 | |||
| 995 | profile = m->private; | ||
| 996 | spin_lock_bh(&profile->lock); | ||
| 997 | data = profile->data; | ||
| 998 | if (!data) { | ||
| 999 | spin_unlock_bh(&profile->lock); | ||
| 1000 | seq_printf(m, "disabled\n"); | ||
| 1001 | return 0; | ||
| 1002 | } | ||
| 1003 | dasd_stats_seq_print(m, data); | ||
| 1004 | spin_unlock_bh(&profile->lock); | ||
| 1005 | return 0; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | static int dasd_stats_open(struct inode *inode, struct file *file) | ||
| 1009 | { | ||
| 1010 | struct dasd_profile *profile = inode->i_private; | ||
| 1011 | return single_open(file, dasd_stats_show, profile); | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | static const struct file_operations dasd_stats_raw_fops = { | ||
| 1015 | .owner = THIS_MODULE, | ||
| 1016 | .open = dasd_stats_open, | ||
| 1017 | .read = seq_read, | ||
| 1018 | .llseek = seq_lseek, | ||
| 1019 | .release = single_release, | ||
| 1020 | .write = dasd_stats_write, | ||
| 1021 | }; | ||
| 1022 | |||
| 1023 | static ssize_t dasd_stats_global_write(struct file *file, | ||
| 1024 | const char __user *user_buf, | ||
| 1025 | size_t user_len, loff_t *pos) | ||
| 1026 | { | ||
| 1027 | char *buffer, *str; | ||
| 1028 | ssize_t rc; | ||
| 1029 | |||
| 1030 | if (user_len > 65536) | ||
| 1031 | user_len = 65536; | ||
| 1032 | buffer = dasd_get_user_string(user_buf, user_len); | ||
| 1033 | if (IS_ERR(buffer)) | ||
| 1034 | return PTR_ERR(buffer); | ||
| 1035 | str = skip_spaces(buffer); | ||
| 1036 | rc = user_len; | ||
| 1037 | if (strncmp(str, "reset", 5) == 0) { | ||
| 1038 | dasd_global_profile_reset(); | ||
| 1039 | } else if (strncmp(str, "on", 2) == 0) { | ||
| 1040 | dasd_global_profile_reset(); | ||
| 1041 | dasd_global_profile_level = DASD_PROFILE_GLOBAL_ONLY; | ||
| 1042 | } else if (strncmp(str, "off", 3) == 0) { | ||
| 1043 | dasd_global_profile_level = DASD_PROFILE_OFF; | ||
| 1044 | } else | ||
| 1045 | rc = -EINVAL; | ||
| 1046 | vfree(buffer); | ||
| 1047 | return rc; | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | static int dasd_stats_global_show(struct seq_file *m, void *v) | ||
| 1051 | { | ||
| 1052 | if (!dasd_global_profile_level) { | ||
| 1053 | seq_printf(m, "disabled\n"); | ||
| 1054 | return 0; | ||
| 1055 | } | ||
| 1056 | dasd_stats_seq_print(m, &dasd_global_profile_data); | ||
| 1057 | return 0; | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | static int dasd_stats_global_open(struct inode *inode, struct file *file) | ||
| 1061 | { | ||
| 1062 | return single_open(file, dasd_stats_global_show, NULL); | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | static const struct file_operations dasd_stats_global_fops = { | ||
| 1066 | .owner = THIS_MODULE, | ||
| 1067 | .open = dasd_stats_global_open, | ||
| 1068 | .read = seq_read, | ||
| 1069 | .llseek = seq_lseek, | ||
| 1070 | .release = single_release, | ||
| 1071 | .write = dasd_stats_global_write, | ||
| 1072 | }; | ||
| 1073 | |||
| 1074 | static void dasd_profile_init(struct dasd_profile *profile, | ||
| 1075 | struct dentry *base_dentry) | ||
| 1076 | { | ||
| 1077 | mode_t mode; | ||
| 1078 | struct dentry *pde; | ||
| 1079 | |||
| 1080 | if (!base_dentry) | ||
| 1081 | return; | ||
| 1082 | profile->dentry = NULL; | ||
| 1083 | profile->data = NULL; | ||
| 1084 | mode = (S_IRUSR | S_IWUSR | S_IFREG); | ||
| 1085 | pde = debugfs_create_file("statistics", mode, base_dentry, | ||
| 1086 | profile, &dasd_stats_raw_fops); | ||
| 1087 | if (pde && !IS_ERR(pde)) | ||
| 1088 | profile->dentry = pde; | ||
| 1089 | return; | ||
| 1090 | } | ||
| 1091 | |||
| 1092 | static void dasd_profile_exit(struct dasd_profile *profile) | ||
| 1093 | { | ||
| 1094 | dasd_profile_off(profile); | ||
| 1095 | if (profile->dentry) { | ||
| 1096 | debugfs_remove(profile->dentry); | ||
| 1097 | profile->dentry = NULL; | ||
| 1098 | } | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | static void dasd_statistics_removeroot(void) | ||
| 1102 | { | ||
| 1103 | dasd_global_profile_level = DASD_PROFILE_OFF; | ||
| 1104 | if (dasd_global_profile_dentry) { | ||
| 1105 | debugfs_remove(dasd_global_profile_dentry); | ||
| 1106 | dasd_global_profile_dentry = NULL; | ||
| 1107 | } | ||
| 1108 | if (dasd_debugfs_global_entry) | ||
| 1109 | debugfs_remove(dasd_debugfs_global_entry); | ||
| 1110 | if (dasd_debugfs_root_entry) | ||
| 1111 | debugfs_remove(dasd_debugfs_root_entry); | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | static void dasd_statistics_createroot(void) | ||
| 1115 | { | ||
| 1116 | mode_t mode; | ||
| 1117 | struct dentry *pde; | ||
| 1118 | |||
| 1119 | dasd_debugfs_root_entry = NULL; | ||
| 1120 | dasd_debugfs_global_entry = NULL; | ||
| 1121 | dasd_global_profile_dentry = NULL; | ||
| 1122 | pde = debugfs_create_dir("dasd", NULL); | ||
| 1123 | if (!pde || IS_ERR(pde)) | ||
| 1124 | goto error; | ||
| 1125 | dasd_debugfs_root_entry = pde; | ||
| 1126 | pde = debugfs_create_dir("global", dasd_debugfs_root_entry); | ||
| 1127 | if (!pde || IS_ERR(pde)) | ||
| 1128 | goto error; | ||
| 1129 | dasd_debugfs_global_entry = pde; | ||
| 1130 | |||
| 1131 | mode = (S_IRUSR | S_IWUSR | S_IFREG); | ||
| 1132 | pde = debugfs_create_file("statistics", mode, dasd_debugfs_global_entry, | ||
| 1133 | NULL, &dasd_stats_global_fops); | ||
| 1134 | if (!pde || IS_ERR(pde)) | ||
| 1135 | goto error; | ||
| 1136 | dasd_global_profile_dentry = pde; | ||
| 1137 | return; | ||
| 1138 | |||
| 1139 | error: | ||
| 1140 | DBF_EVENT(DBF_ERR, "%s", | ||
| 1141 | "Creation of the dasd debugfs interface failed"); | ||
| 1142 | dasd_statistics_removeroot(); | ||
| 1143 | return; | ||
| 1144 | } | ||
| 1145 | |||
| 695 | #else | 1146 | #else |
| 696 | #define dasd_profile_start(block, cqr, req) do {} while (0) | 1147 | #define dasd_profile_start(block, cqr, req) do {} while (0) |
| 697 | #define dasd_profile_end(block, cqr, req) do {} while (0) | 1148 | #define dasd_profile_end(block, cqr, req) do {} while (0) |
| 1149 | |||
| 1150 | static void dasd_statistics_createroot(void) | ||
| 1151 | { | ||
| 1152 | return; | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | static void dasd_statistics_removeroot(void) | ||
| 1156 | { | ||
| 1157 | return; | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | int dasd_stats_generic_show(struct seq_file *m, void *v) | ||
| 1161 | { | ||
| 1162 | seq_printf(m, "Statistics are not activated in this kernel\n"); | ||
| 1163 | return 0; | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | static void dasd_profile_init(struct dasd_profile *profile, | ||
| 1167 | struct dentry *base_dentry) | ||
| 1168 | { | ||
| 1169 | return; | ||
| 1170 | } | ||
| 1171 | |||
| 1172 | static void dasd_profile_exit(struct dasd_profile *profile) | ||
| 1173 | { | ||
| 1174 | return; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | int dasd_profile_on(struct dasd_profile *profile) | ||
| 1178 | { | ||
| 1179 | return 0; | ||
| 1180 | } | ||
| 1181 | |||
| 698 | #endif /* CONFIG_DASD_PROFILE */ | 1182 | #endif /* CONFIG_DASD_PROFILE */ |
| 699 | 1183 | ||
| 700 | /* | 1184 | /* |
| @@ -2441,6 +2925,7 @@ dasd_exit(void) | |||
| 2441 | debug_unregister(dasd_debug_area); | 2925 | debug_unregister(dasd_debug_area); |
| 2442 | dasd_debug_area = NULL; | 2926 | dasd_debug_area = NULL; |
| 2443 | } | 2927 | } |
| 2928 | dasd_statistics_removeroot(); | ||
| 2444 | } | 2929 | } |
| 2445 | 2930 | ||
| 2446 | /* | 2931 | /* |
| @@ -2992,6 +3477,8 @@ static int __init dasd_init(void) | |||
| 2992 | 3477 | ||
| 2993 | dasd_diag_discipline_pointer = NULL; | 3478 | dasd_diag_discipline_pointer = NULL; |
| 2994 | 3479 | ||
| 3480 | dasd_statistics_createroot(); | ||
| 3481 | |||
| 2995 | rc = dasd_devmap_init(); | 3482 | rc = dasd_devmap_init(); |
| 2996 | if (rc) | 3483 | if (rc) |
| 2997 | goto failed; | 3484 | goto failed; |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 30fb979d684..6e835c9fdfc 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
| @@ -1461,6 +1461,15 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
| 1461 | "Read device characteristic failed, rc=%d", rc); | 1461 | "Read device characteristic failed, rc=%d", rc); |
| 1462 | goto out_err3; | 1462 | goto out_err3; |
| 1463 | } | 1463 | } |
| 1464 | |||
| 1465 | if ((device->features & DASD_FEATURE_USERAW) && | ||
| 1466 | !(private->rdc_data.facilities.RT_in_LR)) { | ||
| 1467 | dev_err(&device->cdev->dev, "The storage server does not " | ||
| 1468 | "support raw-track access\n"); | ||
| 1469 | rc = -EINVAL; | ||
| 1470 | goto out_err3; | ||
| 1471 | } | ||
| 1472 | |||
| 1464 | /* find the valid cylinder size */ | 1473 | /* find the valid cylinder size */ |
| 1465 | if (private->rdc_data.no_cyl == LV_COMPAT_CYL && | 1474 | if (private->rdc_data.no_cyl == LV_COMPAT_CYL && |
| 1466 | private->rdc_data.long_no_cyl) | 1475 | private->rdc_data.long_no_cyl) |
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index 77f778b7b07..16c5208c3dc 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
| 22 | 22 | ||
| 23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 24 | #include <asm/atomic.h> | 24 | #include <linux/atomic.h> |
| 25 | #include <asm/ebcdic.h> | 25 | #include <asm/ebcdic.h> |
| 26 | 26 | ||
| 27 | #include "dasd_int.h" | 27 | #include "dasd_int.h" |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index d1e4f2c1264..1dd12bd85a6 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
| @@ -382,6 +382,41 @@ struct dasd_path { | |||
| 382 | __u8 npm; | 382 | __u8 npm; |
| 383 | }; | 383 | }; |
| 384 | 384 | ||
| 385 | struct dasd_profile_info { | ||
| 386 | /* legacy part of profile data, as in dasd_profile_info_t */ | ||
| 387 | unsigned int dasd_io_reqs; /* number of requests processed */ | ||
| 388 | unsigned int dasd_io_sects; /* number of sectors processed */ | ||
| 389 | unsigned int dasd_io_secs[32]; /* histogram of request's sizes */ | ||
| 390 | unsigned int dasd_io_times[32]; /* histogram of requests's times */ | ||
| 391 | unsigned int dasd_io_timps[32]; /* h. of requests's times per sector */ | ||
| 392 | unsigned int dasd_io_time1[32]; /* hist. of time from build to start */ | ||
| 393 | unsigned int dasd_io_time2[32]; /* hist. of time from start to irq */ | ||
| 394 | unsigned int dasd_io_time2ps[32]; /* hist. of time from start to irq */ | ||
| 395 | unsigned int dasd_io_time3[32]; /* hist. of time from irq to end */ | ||
| 396 | unsigned int dasd_io_nr_req[32]; /* hist. of # of requests in chanq */ | ||
| 397 | |||
| 398 | /* new data */ | ||
| 399 | struct timespec starttod; /* time of start or last reset */ | ||
| 400 | unsigned int dasd_io_alias; /* requests using an alias */ | ||
| 401 | unsigned int dasd_io_tpm; /* requests using transport mode */ | ||
| 402 | unsigned int dasd_read_reqs; /* total number of read requests */ | ||
| 403 | unsigned int dasd_read_sects; /* total number read sectors */ | ||
| 404 | unsigned int dasd_read_alias; /* read request using an alias */ | ||
| 405 | unsigned int dasd_read_tpm; /* read requests in transport mode */ | ||
| 406 | unsigned int dasd_read_secs[32]; /* histogram of request's sizes */ | ||
| 407 | unsigned int dasd_read_times[32]; /* histogram of requests's times */ | ||
| 408 | unsigned int dasd_read_time1[32]; /* hist. time from build to start */ | ||
| 409 | unsigned int dasd_read_time2[32]; /* hist. of time from start to irq */ | ||
| 410 | unsigned int dasd_read_time3[32]; /* hist. of time from irq to end */ | ||
| 411 | unsigned int dasd_read_nr_req[32]; /* hist. of # of requests in chanq */ | ||
| 412 | }; | ||
| 413 | |||
| 414 | struct dasd_profile { | ||
| 415 | struct dentry *dentry; | ||
| 416 | struct dasd_profile_info *data; | ||
| 417 | spinlock_t lock; | ||
| 418 | }; | ||
| 419 | |||
| 385 | struct dasd_device { | 420 | struct dasd_device { |
| 386 | /* Block device stuff. */ | 421 | /* Block device stuff. */ |
| 387 | struct dasd_block *block; | 422 | struct dasd_block *block; |
| @@ -431,6 +466,9 @@ struct dasd_device { | |||
| 431 | 466 | ||
| 432 | /* default expiration time in s */ | 467 | /* default expiration time in s */ |
| 433 | unsigned long default_expires; | 468 | unsigned long default_expires; |
| 469 | |||
| 470 | struct dentry *debugfs_dentry; | ||
| 471 | struct dasd_profile profile; | ||
| 434 | }; | 472 | }; |
| 435 | 473 | ||
| 436 | struct dasd_block { | 474 | struct dasd_block { |
| @@ -453,9 +491,8 @@ struct dasd_block { | |||
| 453 | struct tasklet_struct tasklet; | 491 | struct tasklet_struct tasklet; |
| 454 | struct timer_list timer; | 492 | struct timer_list timer; |
| 455 | 493 | ||
| 456 | #ifdef CONFIG_DASD_PROFILE | 494 | struct dentry *debugfs_dentry; |
| 457 | struct dasd_profile_info_t profile; | 495 | struct dasd_profile profile; |
| 458 | #endif | ||
| 459 | }; | 496 | }; |
| 460 | 497 | ||
| 461 | 498 | ||
| @@ -589,12 +626,13 @@ dasd_check_blocksize(int bsize) | |||
| 589 | } | 626 | } |
| 590 | 627 | ||
| 591 | /* externals in dasd.c */ | 628 | /* externals in dasd.c */ |
| 592 | #define DASD_PROFILE_ON 1 | 629 | #define DASD_PROFILE_OFF 0 |
| 593 | #define DASD_PROFILE_OFF 0 | 630 | #define DASD_PROFILE_ON 1 |
| 631 | #define DASD_PROFILE_GLOBAL_ONLY 2 | ||
| 594 | 632 | ||
| 595 | extern debug_info_t *dasd_debug_area; | 633 | extern debug_info_t *dasd_debug_area; |
| 596 | extern struct dasd_profile_info_t dasd_global_profile; | 634 | extern struct dasd_profile_info dasd_global_profile_data; |
| 597 | extern unsigned int dasd_profile_level; | 635 | extern unsigned int dasd_global_profile_level; |
| 598 | extern const struct block_device_operations dasd_device_operations; | 636 | extern const struct block_device_operations dasd_device_operations; |
| 599 | 637 | ||
| 600 | extern struct kmem_cache *dasd_page_cache; | 638 | extern struct kmem_cache *dasd_page_cache; |
| @@ -662,6 +700,11 @@ void dasd_device_remove_stop_bits(struct dasd_device *, int); | |||
| 662 | 700 | ||
| 663 | int dasd_device_is_ro(struct dasd_device *); | 701 | int dasd_device_is_ro(struct dasd_device *); |
| 664 | 702 | ||
| 703 | void dasd_profile_reset(struct dasd_profile *); | ||
| 704 | int dasd_profile_on(struct dasd_profile *); | ||
| 705 | void dasd_profile_off(struct dasd_profile *); | ||
| 706 | void dasd_global_profile_reset(void); | ||
| 707 | char *dasd_get_user_string(const char __user *, size_t); | ||
| 665 | 708 | ||
| 666 | /* externals in dasd_devmap.c */ | 709 | /* externals in dasd_devmap.c */ |
| 667 | extern int dasd_max_devindex; | 710 | extern int dasd_max_devindex; |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 72261e4c516..f1a2016829f 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
| @@ -239,7 +239,7 @@ dasd_ioctl_format(struct block_device *bdev, void __user *argp) | |||
| 239 | */ | 239 | */ |
| 240 | static int dasd_ioctl_reset_profile(struct dasd_block *block) | 240 | static int dasd_ioctl_reset_profile(struct dasd_block *block) |
| 241 | { | 241 | { |
| 242 | memset(&block->profile, 0, sizeof(struct dasd_profile_info_t)); | 242 | dasd_profile_reset(&block->profile); |
| 243 | return 0; | 243 | return 0; |
| 244 | } | 244 | } |
| 245 | 245 | ||
| @@ -248,12 +248,46 @@ static int dasd_ioctl_reset_profile(struct dasd_block *block) | |||
| 248 | */ | 248 | */ |
| 249 | static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp) | 249 | static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp) |
| 250 | { | 250 | { |
| 251 | if (dasd_profile_level == DASD_PROFILE_OFF) | 251 | struct dasd_profile_info_t *data; |
| 252 | return -EIO; | 252 | int rc = 0; |
| 253 | if (copy_to_user(argp, &block->profile, | 253 | |
| 254 | sizeof(struct dasd_profile_info_t))) | 254 | data = kmalloc(sizeof(*data), GFP_KERNEL); |
| 255 | return -EFAULT; | 255 | if (!data) |
| 256 | return 0; | 256 | return -ENOMEM; |
| 257 | |||
| 258 | spin_lock_bh(&block->profile.lock); | ||
| 259 | if (block->profile.data) { | ||
| 260 | data->dasd_io_reqs = block->profile.data->dasd_io_reqs; | ||
| 261 | data->dasd_io_sects = block->profile.data->dasd_io_sects; | ||
| 262 | memcpy(data->dasd_io_secs, block->profile.data->dasd_io_secs, | ||
| 263 | sizeof(data->dasd_io_secs)); | ||
| 264 | memcpy(data->dasd_io_times, block->profile.data->dasd_io_times, | ||
| 265 | sizeof(data->dasd_io_times)); | ||
| 266 | memcpy(data->dasd_io_timps, block->profile.data->dasd_io_timps, | ||
| 267 | sizeof(data->dasd_io_timps)); | ||
| 268 | memcpy(data->dasd_io_time1, block->profile.data->dasd_io_time1, | ||
| 269 | sizeof(data->dasd_io_time1)); | ||
| 270 | memcpy(data->dasd_io_time2, block->profile.data->dasd_io_time2, | ||
| 271 | sizeof(data->dasd_io_time2)); | ||
| 272 | memcpy(data->dasd_io_time2ps, | ||
| 273 | block->profile.data->dasd_io_time2ps, | ||
| 274 | sizeof(data->dasd_io_time2ps)); | ||
| 275 | memcpy(data->dasd_io_time3, block->profile.data->dasd_io_time3, | ||
| 276 | sizeof(data->dasd_io_time3)); | ||
| 277 | memcpy(data->dasd_io_nr_req, | ||
| 278 | block->profile.data->dasd_io_nr_req, | ||
| 279 | sizeof(data->dasd_io_nr_req)); | ||
| 280 | spin_unlock_bh(&block->profile.lock); | ||
| 281 | } else { | ||
| 282 | spin_unlock_bh(&block->profile.lock); | ||
| 283 | rc = -EIO; | ||
| 284 | goto out; | ||
| 285 | } | ||
| 286 | if (copy_to_user(argp, data, sizeof(*data))) | ||
| 287 | rc = -EFAULT; | ||
| 288 | out: | ||
| 289 | kfree(data); | ||
| 290 | return rc; | ||
| 257 | } | 291 | } |
| 258 | #else | 292 | #else |
| 259 | static int dasd_ioctl_reset_profile(struct dasd_block *block) | 293 | static int dasd_ioctl_reset_profile(struct dasd_block *block) |
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c index c4a6a31bd9c..e12989fff4f 100644 --- a/drivers/s390/block/dasd_proc.c +++ b/drivers/s390/block/dasd_proc.c | |||
| @@ -32,28 +32,6 @@ static struct proc_dir_entry *dasd_proc_root_entry = NULL; | |||
| 32 | static struct proc_dir_entry *dasd_devices_entry = NULL; | 32 | static struct proc_dir_entry *dasd_devices_entry = NULL; |
| 33 | static struct proc_dir_entry *dasd_statistics_entry = NULL; | 33 | static struct proc_dir_entry *dasd_statistics_entry = NULL; |
| 34 | 34 | ||
| 35 | #ifdef CONFIG_DASD_PROFILE | ||
| 36 | static char * | ||
| 37 | dasd_get_user_string(const char __user *user_buf, size_t user_len) | ||
| 38 | { | ||
| 39 | char *buffer; | ||
| 40 | |||
| 41 | buffer = kmalloc(user_len + 1, GFP_KERNEL); | ||
| 42 | if (buffer == NULL) | ||
| 43 | return ERR_PTR(-ENOMEM); | ||
| 44 | if (copy_from_user(buffer, user_buf, user_len) != 0) { | ||
| 45 | kfree(buffer); | ||
| 46 | return ERR_PTR(-EFAULT); | ||
| 47 | } | ||
| 48 | /* got the string, now strip linefeed. */ | ||
| 49 | if (buffer[user_len - 1] == '\n') | ||
| 50 | buffer[user_len - 1] = 0; | ||
| 51 | else | ||
| 52 | buffer[user_len] = 0; | ||
| 53 | return buffer; | ||
| 54 | } | ||
| 55 | #endif /* CONFIG_DASD_PROFILE */ | ||
| 56 | |||
| 57 | static int | 35 | static int |
| 58 | dasd_devices_show(struct seq_file *m, void *v) | 36 | dasd_devices_show(struct seq_file *m, void *v) |
| 59 | { | 37 | { |
| @@ -167,6 +145,55 @@ static const struct file_operations dasd_devices_file_ops = { | |||
| 167 | }; | 145 | }; |
| 168 | 146 | ||
| 169 | #ifdef CONFIG_DASD_PROFILE | 147 | #ifdef CONFIG_DASD_PROFILE |
| 148 | static int dasd_stats_all_block_on(void) | ||
| 149 | { | ||
| 150 | int i, rc; | ||
| 151 | struct dasd_device *device; | ||
| 152 | |||
| 153 | rc = 0; | ||
| 154 | for (i = 0; i < dasd_max_devindex; ++i) { | ||
| 155 | device = dasd_device_from_devindex(i); | ||
| 156 | if (IS_ERR(device)) | ||
| 157 | continue; | ||
| 158 | if (device->block) | ||
| 159 | rc = dasd_profile_on(&device->block->profile); | ||
| 160 | dasd_put_device(device); | ||
| 161 | if (rc) | ||
| 162 | return rc; | ||
| 163 | } | ||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | static void dasd_stats_all_block_off(void) | ||
| 168 | { | ||
| 169 | int i; | ||
| 170 | struct dasd_device *device; | ||
| 171 | |||
| 172 | for (i = 0; i < dasd_max_devindex; ++i) { | ||
| 173 | device = dasd_device_from_devindex(i); | ||
| 174 | if (IS_ERR(device)) | ||
| 175 | continue; | ||
| 176 | if (device->block) | ||
| 177 | dasd_profile_off(&device->block->profile); | ||
| 178 | dasd_put_device(device); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | static void dasd_stats_all_block_reset(void) | ||
| 183 | { | ||
| 184 | int i; | ||
| 185 | struct dasd_device *device; | ||
| 186 | |||
| 187 | for (i = 0; i < dasd_max_devindex; ++i) { | ||
| 188 | device = dasd_device_from_devindex(i); | ||
| 189 | if (IS_ERR(device)) | ||
| 190 | continue; | ||
| 191 | if (device->block) | ||
| 192 | dasd_profile_reset(&device->block->profile); | ||
| 193 | dasd_put_device(device); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 170 | static void dasd_statistics_array(struct seq_file *m, unsigned int *array, int factor) | 197 | static void dasd_statistics_array(struct seq_file *m, unsigned int *array, int factor) |
| 171 | { | 198 | { |
| 172 | int i; | 199 | int i; |
| @@ -183,18 +210,18 @@ static void dasd_statistics_array(struct seq_file *m, unsigned int *array, int f | |||
| 183 | static int dasd_stats_proc_show(struct seq_file *m, void *v) | 210 | static int dasd_stats_proc_show(struct seq_file *m, void *v) |
| 184 | { | 211 | { |
| 185 | #ifdef CONFIG_DASD_PROFILE | 212 | #ifdef CONFIG_DASD_PROFILE |
| 186 | struct dasd_profile_info_t *prof; | 213 | struct dasd_profile_info *prof; |
| 187 | int factor; | 214 | int factor; |
| 188 | 215 | ||
| 189 | /* check for active profiling */ | 216 | /* check for active profiling */ |
| 190 | if (dasd_profile_level == DASD_PROFILE_OFF) { | 217 | if (!dasd_global_profile_level) { |
| 191 | seq_printf(m, "Statistics are off - they might be " | 218 | seq_printf(m, "Statistics are off - they might be " |
| 192 | "switched on using 'echo set on > " | 219 | "switched on using 'echo set on > " |
| 193 | "/proc/dasd/statistics'\n"); | 220 | "/proc/dasd/statistics'\n"); |
| 194 | return 0; | 221 | return 0; |
| 195 | } | 222 | } |
| 223 | prof = &dasd_global_profile_data; | ||
| 196 | 224 | ||
| 197 | prof = &dasd_global_profile; | ||
| 198 | /* prevent counter 'overflow' on output */ | 225 | /* prevent counter 'overflow' on output */ |
| 199 | for (factor = 1; (prof->dasd_io_reqs / factor) > 9999999; | 226 | for (factor = 1; (prof->dasd_io_reqs / factor) > 9999999; |
| 200 | factor *= 10); | 227 | factor *= 10); |
| @@ -245,6 +272,7 @@ static ssize_t dasd_stats_proc_write(struct file *file, | |||
| 245 | { | 272 | { |
| 246 | #ifdef CONFIG_DASD_PROFILE | 273 | #ifdef CONFIG_DASD_PROFILE |
| 247 | char *buffer, *str; | 274 | char *buffer, *str; |
| 275 | int rc; | ||
| 248 | 276 | ||
| 249 | if (user_len > 65536) | 277 | if (user_len > 65536) |
| 250 | user_len = 65536; | 278 | user_len = 65536; |
| @@ -259,32 +287,40 @@ static ssize_t dasd_stats_proc_write(struct file *file, | |||
| 259 | str = skip_spaces(str + 4); | 287 | str = skip_spaces(str + 4); |
| 260 | if (strcmp(str, "on") == 0) { | 288 | if (strcmp(str, "on") == 0) { |
| 261 | /* switch on statistics profiling */ | 289 | /* switch on statistics profiling */ |
| 262 | dasd_profile_level = DASD_PROFILE_ON; | 290 | rc = dasd_stats_all_block_on(); |
| 291 | if (rc) { | ||
| 292 | dasd_stats_all_block_off(); | ||
| 293 | goto out_error; | ||
| 294 | } | ||
| 295 | dasd_global_profile_reset(); | ||
| 296 | dasd_global_profile_level = DASD_PROFILE_ON; | ||
| 263 | pr_info("The statistics feature has been switched " | 297 | pr_info("The statistics feature has been switched " |
| 264 | "on\n"); | 298 | "on\n"); |
| 265 | } else if (strcmp(str, "off") == 0) { | 299 | } else if (strcmp(str, "off") == 0) { |
| 266 | /* switch off and reset statistics profiling */ | 300 | /* switch off and reset statistics profiling */ |
| 267 | memset(&dasd_global_profile, | 301 | dasd_global_profile_level = DASD_PROFILE_OFF; |
| 268 | 0, sizeof (struct dasd_profile_info_t)); | 302 | dasd_global_profile_reset(); |
| 269 | dasd_profile_level = DASD_PROFILE_OFF; | 303 | dasd_stats_all_block_off(); |
| 270 | pr_info("The statistics feature has been switched " | 304 | pr_info("The statistics feature has been switched " |
| 271 | "off\n"); | 305 | "off\n"); |
| 272 | } else | 306 | } else |
| 273 | goto out_error; | 307 | goto out_parse_error; |
| 274 | } else if (strncmp(str, "reset", 5) == 0) { | 308 | } else if (strncmp(str, "reset", 5) == 0) { |
| 275 | /* reset the statistics */ | 309 | /* reset the statistics */ |
| 276 | memset(&dasd_global_profile, 0, | 310 | dasd_global_profile_reset(); |
| 277 | sizeof (struct dasd_profile_info_t)); | 311 | dasd_stats_all_block_reset(); |
| 278 | pr_info("The statistics have been reset\n"); | 312 | pr_info("The statistics have been reset\n"); |
| 279 | } else | 313 | } else |
| 280 | goto out_error; | 314 | goto out_parse_error; |
| 281 | kfree(buffer); | 315 | vfree(buffer); |
| 282 | return user_len; | 316 | return user_len; |
| 283 | out_error: | 317 | out_parse_error: |
| 318 | rc = -EINVAL; | ||
| 284 | pr_warning("%s is not a supported value for /proc/dasd/statistics\n", | 319 | pr_warning("%s is not a supported value for /proc/dasd/statistics\n", |
| 285 | str); | 320 | str); |
| 286 | kfree(buffer); | 321 | out_error: |
| 287 | return -EINVAL; | 322 | vfree(buffer); |
| 323 | return rc; | ||
| 288 | #else | 324 | #else |
| 289 | pr_warning("/proc/dasd/statistics: is not activated in this kernel\n"); | 325 | pr_warning("/proc/dasd/statistics: is not activated in this kernel\n"); |
| 290 | return user_len; | 326 | return user_len; |
diff --git a/drivers/s390/char/Kconfig b/drivers/s390/char/Kconfig index a4f117d9fdc..2c9a776bd63 100644 --- a/drivers/s390/char/Kconfig +++ b/drivers/s390/char/Kconfig | |||
| @@ -116,9 +116,6 @@ config S390_TAPE | |||
| 116 | called tape390 and include all selected interfaces and | 116 | called tape390 and include all selected interfaces and |
| 117 | hardware drivers. | 117 | hardware drivers. |
| 118 | 118 | ||
| 119 | comment "S/390 tape interface support" | ||
| 120 | depends on S390_TAPE | ||
| 121 | |||
| 122 | comment "S/390 tape hardware support" | 119 | comment "S/390 tape hardware support" |
| 123 | depends on S390_TAPE | 120 | depends on S390_TAPE |
| 124 | 121 | ||
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c index 7ad30e72f86..5f9f929e891 100644 --- a/drivers/s390/char/sclp_async.c +++ b/drivers/s390/char/sclp_async.c | |||
| @@ -82,12 +82,9 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write, | |||
| 82 | return -EFAULT; | 82 | return -EFAULT; |
| 83 | } else { | 83 | } else { |
| 84 | len = *count; | 84 | len = *count; |
| 85 | rc = copy_from_user(buf, buffer, sizeof(buf)); | 85 | rc = kstrtoul_from_user(buffer, len, 0, &val); |
| 86 | if (rc != 0) | 86 | if (rc) |
| 87 | return -EFAULT; | 87 | return rc; |
| 88 | buf[sizeof(buf) - 1] = '\0'; | ||
| 89 | if (strict_strtoul(buf, 0, &val) != 0) | ||
| 90 | return -EINVAL; | ||
| 91 | if (val != 0 && val != 1) | 88 | if (val != 0 && val != 1) |
| 92 | return -EINVAL; | 89 | return -EINVAL; |
| 93 | callhome_enabled = val; | 90 | callhome_enabled = val; |
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index be55fb2b1b1..837e010299a 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
| @@ -383,8 +383,10 @@ static int sclp_attach_storage(u8 id) | |||
| 383 | switch (sccb->header.response_code) { | 383 | switch (sccb->header.response_code) { |
| 384 | case 0x0020: | 384 | case 0x0020: |
| 385 | set_bit(id, sclp_storage_ids); | 385 | set_bit(id, sclp_storage_ids); |
| 386 | for (i = 0; i < sccb->assigned; i++) | 386 | for (i = 0; i < sccb->assigned; i++) { |
| 387 | sclp_unassign_storage(sccb->entries[i] >> 16); | 387 | if (sccb->entries[i]) |
| 388 | sclp_unassign_storage(sccb->entries[i] >> 16); | ||
| 389 | } | ||
| 388 | break; | 390 | break; |
| 389 | default: | 391 | default: |
| 390 | rc = -EIO; | 392 | rc = -EIO; |
diff --git a/drivers/s390/char/sclp_quiesce.c b/drivers/s390/char/sclp_quiesce.c index 05909a7df8b..a90a02c28d6 100644 --- a/drivers/s390/char/sclp_quiesce.c +++ b/drivers/s390/char/sclp_quiesce.c | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/reboot.h> | 15 | #include <linux/reboot.h> |
| 16 | #include <asm/atomic.h> | 16 | #include <linux/atomic.h> |
| 17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
| 18 | #include <asm/sigp.h> | 18 | #include <asm/sigp.h> |
| 19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index c837d7419a6..524d988d89d 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
| 23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
| 24 | #include <asm/atomic.h> | 24 | #include <linux/atomic.h> |
| 25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
| 26 | #include <asm/cpcmd.h> | 26 | #include <asm/cpcmd.h> |
| 27 | #include <asm/debug.h> | 27 | #include <asm/debug.h> |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c index 12ef9121d4f..11312f401c7 100644 --- a/drivers/s390/char/vmwatchdog.c +++ b/drivers/s390/char/vmwatchdog.c | |||
| @@ -258,13 +258,13 @@ static int vmwdt_suspend(void) | |||
| 258 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { | 258 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { |
| 259 | pr_err("The system cannot be suspended while the watchdog" | 259 | pr_err("The system cannot be suspended while the watchdog" |
| 260 | " is in use\n"); | 260 | " is in use\n"); |
| 261 | return NOTIFY_BAD; | 261 | return notifier_from_errno(-EBUSY); |
| 262 | } | 262 | } |
| 263 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { | 263 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { |
| 264 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | 264 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); |
| 265 | pr_err("The system cannot be suspended while the watchdog" | 265 | pr_err("The system cannot be suspended while the watchdog" |
| 266 | " is running\n"); | 266 | " is running\n"); |
| 267 | return NOTIFY_BAD; | 267 | return notifier_from_errno(-EBUSY); |
| 268 | } | 268 | } |
| 269 | return NOTIFY_DONE; | 269 | return NOTIFY_DONE; |
| 270 | } | 270 | } |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 5c567414c4b..cda9bd6e48e 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
| @@ -87,6 +87,12 @@ static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev) | |||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static ssize_t ccwgroup_online_store(struct device *dev, | ||
| 91 | struct device_attribute *attr, | ||
| 92 | const char *buf, size_t count); | ||
| 93 | static ssize_t ccwgroup_online_show(struct device *dev, | ||
| 94 | struct device_attribute *attr, | ||
| 95 | char *buf); | ||
| 90 | /* | 96 | /* |
| 91 | * Provide an 'ungroup' attribute so the user can remove group devices no | 97 | * Provide an 'ungroup' attribute so the user can remove group devices no |
| 92 | * longer needed or accidentially created. Saves memory :) | 98 | * longer needed or accidentially created. Saves memory :) |
| @@ -134,6 +140,20 @@ out: | |||
| 134 | } | 140 | } |
| 135 | 141 | ||
| 136 | static DEVICE_ATTR(ungroup, 0200, NULL, ccwgroup_ungroup_store); | 142 | static DEVICE_ATTR(ungroup, 0200, NULL, ccwgroup_ungroup_store); |
| 143 | static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store); | ||
| 144 | |||
| 145 | static struct attribute *ccwgroup_attrs[] = { | ||
| 146 | &dev_attr_online.attr, | ||
| 147 | &dev_attr_ungroup.attr, | ||
| 148 | NULL, | ||
| 149 | }; | ||
| 150 | static struct attribute_group ccwgroup_attr_group = { | ||
| 151 | .attrs = ccwgroup_attrs, | ||
| 152 | }; | ||
| 153 | static const struct attribute_group *ccwgroup_attr_groups[] = { | ||
| 154 | &ccwgroup_attr_group, | ||
| 155 | NULL, | ||
| 156 | }; | ||
| 137 | 157 | ||
| 138 | static void | 158 | static void |
| 139 | ccwgroup_release (struct device *dev) | 159 | ccwgroup_release (struct device *dev) |
| @@ -293,25 +313,17 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, | |||
| 293 | } | 313 | } |
| 294 | 314 | ||
| 295 | dev_set_name(&gdev->dev, "%s", dev_name(&gdev->cdev[0]->dev)); | 315 | dev_set_name(&gdev->dev, "%s", dev_name(&gdev->cdev[0]->dev)); |
| 296 | 316 | gdev->dev.groups = ccwgroup_attr_groups; | |
| 297 | rc = device_add(&gdev->dev); | 317 | rc = device_add(&gdev->dev); |
| 298 | if (rc) | 318 | if (rc) |
| 299 | goto error; | 319 | goto error; |
| 300 | get_device(&gdev->dev); | 320 | get_device(&gdev->dev); |
| 301 | rc = device_create_file(&gdev->dev, &dev_attr_ungroup); | ||
| 302 | |||
| 303 | if (rc) { | ||
| 304 | device_unregister(&gdev->dev); | ||
| 305 | goto error; | ||
| 306 | } | ||
| 307 | |||
| 308 | rc = __ccwgroup_create_symlinks(gdev); | 321 | rc = __ccwgroup_create_symlinks(gdev); |
| 309 | if (!rc) { | 322 | if (!rc) { |
| 310 | mutex_unlock(&gdev->reg_mutex); | 323 | mutex_unlock(&gdev->reg_mutex); |
| 311 | put_device(&gdev->dev); | 324 | put_device(&gdev->dev); |
| 312 | return 0; | 325 | return 0; |
| 313 | } | 326 | } |
| 314 | device_remove_file(&gdev->dev, &dev_attr_ungroup); | ||
| 315 | device_unregister(&gdev->dev); | 327 | device_unregister(&gdev->dev); |
| 316 | error: | 328 | error: |
| 317 | for (i = 0; i < num_devices; i++) | 329 | for (i = 0; i < num_devices; i++) |
| @@ -423,7 +435,7 @@ ccwgroup_online_store (struct device *dev, struct device_attribute *attr, const | |||
| 423 | int ret; | 435 | int ret; |
| 424 | 436 | ||
| 425 | if (!dev->driver) | 437 | if (!dev->driver) |
| 426 | return -ENODEV; | 438 | return -EINVAL; |
| 427 | 439 | ||
| 428 | gdev = to_ccwgroupdev(dev); | 440 | gdev = to_ccwgroupdev(dev); |
| 429 | gdrv = to_ccwgroupdrv(dev->driver); | 441 | gdrv = to_ccwgroupdrv(dev->driver); |
| @@ -456,8 +468,6 @@ ccwgroup_online_show (struct device *dev, struct device_attribute *attr, char *b | |||
| 456 | return sprintf(buf, online ? "1\n" : "0\n"); | 468 | return sprintf(buf, online ? "1\n" : "0\n"); |
| 457 | } | 469 | } |
| 458 | 470 | ||
| 459 | static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store); | ||
| 460 | |||
| 461 | static int | 471 | static int |
| 462 | ccwgroup_probe (struct device *dev) | 472 | ccwgroup_probe (struct device *dev) |
| 463 | { | 473 | { |
| @@ -469,12 +479,7 @@ ccwgroup_probe (struct device *dev) | |||
| 469 | gdev = to_ccwgroupdev(dev); | 479 | gdev = to_ccwgroupdev(dev); |
| 470 | gdrv = to_ccwgroupdrv(dev->driver); | 480 | gdrv = to_ccwgroupdrv(dev->driver); |
| 471 | 481 | ||
| 472 | if ((ret = device_create_file(dev, &dev_attr_online))) | ||
| 473 | return ret; | ||
| 474 | |||
| 475 | ret = gdrv->probe ? gdrv->probe(gdev) : -ENODEV; | 482 | ret = gdrv->probe ? gdrv->probe(gdev) : -ENODEV; |
| 476 | if (ret) | ||
| 477 | device_remove_file(dev, &dev_attr_online); | ||
| 478 | 483 | ||
| 479 | return ret; | 484 | return ret; |
| 480 | } | 485 | } |
| @@ -485,9 +490,6 @@ ccwgroup_remove (struct device *dev) | |||
| 485 | struct ccwgroup_device *gdev; | 490 | struct ccwgroup_device *gdev; |
| 486 | struct ccwgroup_driver *gdrv; | 491 | struct ccwgroup_driver *gdrv; |
| 487 | 492 | ||
| 488 | device_remove_file(dev, &dev_attr_online); | ||
| 489 | device_remove_file(dev, &dev_attr_ungroup); | ||
| 490 | |||
| 491 | if (!dev->driver) | 493 | if (!dev->driver) |
| 492 | return 0; | 494 | return 0; |
| 493 | 495 | ||
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index cbde448f994..eb3140ee821 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
| @@ -654,8 +654,8 @@ static struct io_subchannel_private console_priv; | |||
| 654 | static int console_subchannel_in_use; | 654 | static int console_subchannel_in_use; |
| 655 | 655 | ||
| 656 | /* | 656 | /* |
| 657 | * Use tpi to get a pending interrupt, call the interrupt handler and | 657 | * Use cio_tpi to get a pending interrupt and call the interrupt handler. |
| 658 | * return a pointer to the subchannel structure. | 658 | * Return non-zero if an interrupt was processed, zero otherwise. |
| 659 | */ | 659 | */ |
| 660 | static int cio_tpi(void) | 660 | static int cio_tpi(void) |
| 661 | { | 661 | { |
| @@ -667,6 +667,10 @@ static int cio_tpi(void) | |||
| 667 | tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id; | 667 | tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id; |
| 668 | if (tpi(NULL) != 1) | 668 | if (tpi(NULL) != 1) |
| 669 | return 0; | 669 | return 0; |
| 670 | if (tpi_info->adapter_IO) { | ||
| 671 | do_adapter_IO(tpi_info->isc); | ||
| 672 | return 1; | ||
| 673 | } | ||
| 670 | irb = (struct irb *)&S390_lowcore.irb; | 674 | irb = (struct irb *)&S390_lowcore.irb; |
| 671 | /* Store interrupt response block to lowcore. */ | 675 | /* Store interrupt response block to lowcore. */ |
| 672 | if (tsch(tpi_info->schid, irb) != 0) | 676 | if (tsch(tpi_info->schid, irb) != 0) |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index c47b25fd3f4..92d7324acb1 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
| @@ -814,8 +814,8 @@ static int css_power_event(struct notifier_block *this, unsigned long event, | |||
| 814 | mutex_unlock(&css->mutex); | 814 | mutex_unlock(&css->mutex); |
| 815 | continue; | 815 | continue; |
| 816 | } | 816 | } |
| 817 | if (__chsc_do_secm(css, 0)) | 817 | ret = __chsc_do_secm(css, 0); |
| 818 | ret = NOTIFY_BAD; | 818 | ret = notifier_from_errno(ret); |
| 819 | mutex_unlock(&css->mutex); | 819 | mutex_unlock(&css->mutex); |
| 820 | } | 820 | } |
| 821 | break; | 821 | break; |
| @@ -831,8 +831,8 @@ static int css_power_event(struct notifier_block *this, unsigned long event, | |||
| 831 | mutex_unlock(&css->mutex); | 831 | mutex_unlock(&css->mutex); |
| 832 | continue; | 832 | continue; |
| 833 | } | 833 | } |
| 834 | if (__chsc_do_secm(css, 1)) | 834 | ret = __chsc_do_secm(css, 1); |
| 835 | ret = NOTIFY_BAD; | 835 | ret = notifier_from_errno(ret); |
| 836 | mutex_unlock(&css->mutex); | 836 | mutex_unlock(&css->mutex); |
| 837 | } | 837 | } |
| 838 | /* search for subchannels, which appeared during hibernation */ | 838 | /* search for subchannels, which appeared during hibernation */ |
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h index 7e297c7bb5f..0b7245c72d5 100644 --- a/drivers/s390/cio/device.h +++ b/drivers/s390/cio/device.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define S390_DEVICE_H | 2 | #define S390_DEVICE_H |
| 3 | 3 | ||
| 4 | #include <asm/ccwdev.h> | 4 | #include <asm/ccwdev.h> |
| 5 | #include <asm/atomic.h> | 5 | #include <linux/atomic.h> |
| 6 | #include <linux/wait.h> | 6 | #include <linux/wait.h> |
| 7 | #include <linux/notifier.h> | 7 | #include <linux/notifier.h> |
| 8 | #include "io_sch.h" | 8 | #include "io_sch.h" |
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index 7bc643f3f5a..e5c966462c5 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include "chsc.h" | 14 | #include "chsc.h" |
| 15 | 15 | ||
| 16 | #define QDIO_BUSY_BIT_PATIENCE (100 << 12) /* 100 microseconds */ | 16 | #define QDIO_BUSY_BIT_PATIENCE (100 << 12) /* 100 microseconds */ |
| 17 | #define QDIO_BUSY_BIT_RETRY_DELAY 10 /* 10 milliseconds */ | ||
| 18 | #define QDIO_BUSY_BIT_RETRIES 1000 /* = 10s retry time */ | ||
| 17 | #define QDIO_INPUT_THRESHOLD (500 << 12) /* 500 microseconds */ | 19 | #define QDIO_INPUT_THRESHOLD (500 << 12) /* 500 microseconds */ |
| 18 | 20 | ||
| 19 | /* | 21 | /* |
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index f8b03a636e4..0e615cb912d 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
| @@ -188,19 +188,13 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf, | |||
| 188 | struct qdio_irq *irq_ptr = seq->private; | 188 | struct qdio_irq *irq_ptr = seq->private; |
| 189 | struct qdio_q *q; | 189 | struct qdio_q *q; |
| 190 | unsigned long val; | 190 | unsigned long val; |
| 191 | char buf[8]; | ||
| 192 | int ret, i; | 191 | int ret, i; |
| 193 | 192 | ||
| 194 | if (!irq_ptr) | 193 | if (!irq_ptr) |
| 195 | return 0; | 194 | return 0; |
| 196 | if (count >= sizeof(buf)) | 195 | |
| 197 | return -EINVAL; | 196 | ret = kstrtoul_from_user(ubuf, count, 10, &val); |
| 198 | if (copy_from_user(&buf, ubuf, count)) | 197 | if (ret) |
| 199 | return -EFAULT; | ||
| 200 | buf[count] = 0; | ||
| 201 | |||
| 202 | ret = strict_strtoul(buf, 10, &val); | ||
| 203 | if (ret < 0) | ||
| 204 | return ret; | 198 | return ret; |
| 205 | 199 | ||
| 206 | switch (val) { | 200 | switch (val) { |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 570d4da1069..288c9140290 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/gfp.h> | 16 | #include <linux/gfp.h> |
| 17 | #include <linux/kernel_stat.h> | 17 | #include <linux/kernel_stat.h> |
| 18 | #include <asm/atomic.h> | 18 | #include <linux/atomic.h> |
| 19 | #include <asm/debug.h> | 19 | #include <asm/debug.h> |
| 20 | #include <asm/qdio.h> | 20 | #include <asm/qdio.h> |
| 21 | 21 | ||
| @@ -313,7 +313,7 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) | |||
| 313 | unsigned long schid = *((u32 *) &q->irq_ptr->schid); | 313 | unsigned long schid = *((u32 *) &q->irq_ptr->schid); |
| 314 | unsigned int fc = QDIO_SIGA_WRITE; | 314 | unsigned int fc = QDIO_SIGA_WRITE; |
| 315 | u64 start_time = 0; | 315 | u64 start_time = 0; |
| 316 | int cc; | 316 | int retries = 0, cc; |
| 317 | 317 | ||
| 318 | if (is_qebsm(q)) { | 318 | if (is_qebsm(q)) { |
| 319 | schid = q->irq_ptr->sch_token; | 319 | schid = q->irq_ptr->sch_token; |
| @@ -325,6 +325,7 @@ again: | |||
| 325 | /* hipersocket busy condition */ | 325 | /* hipersocket busy condition */ |
| 326 | if (unlikely(*busy_bit)) { | 326 | if (unlikely(*busy_bit)) { |
| 327 | WARN_ON(queue_type(q) != QDIO_IQDIO_QFMT || cc != 2); | 327 | WARN_ON(queue_type(q) != QDIO_IQDIO_QFMT || cc != 2); |
| 328 | retries++; | ||
| 328 | 329 | ||
| 329 | if (!start_time) { | 330 | if (!start_time) { |
| 330 | start_time = get_clock(); | 331 | start_time = get_clock(); |
| @@ -333,6 +334,11 @@ again: | |||
| 333 | if ((get_clock() - start_time) < QDIO_BUSY_BIT_PATIENCE) | 334 | if ((get_clock() - start_time) < QDIO_BUSY_BIT_PATIENCE) |
| 334 | goto again; | 335 | goto again; |
| 335 | } | 336 | } |
| 337 | if (retries) { | ||
| 338 | DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, | ||
| 339 | "%4x cc2 BB1:%1d", SCH_NO(q), q->nr); | ||
| 340 | DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "count:%u", retries); | ||
| 341 | } | ||
| 336 | return cc; | 342 | return cc; |
| 337 | } | 343 | } |
| 338 | 344 | ||
| @@ -728,13 +734,14 @@ static inline int qdio_outbound_q_moved(struct qdio_q *q) | |||
| 728 | 734 | ||
| 729 | static int qdio_kick_outbound_q(struct qdio_q *q) | 735 | static int qdio_kick_outbound_q(struct qdio_q *q) |
| 730 | { | 736 | { |
| 737 | int retries = 0, cc; | ||
| 731 | unsigned int busy_bit; | 738 | unsigned int busy_bit; |
| 732 | int cc; | ||
| 733 | 739 | ||
| 734 | if (!need_siga_out(q)) | 740 | if (!need_siga_out(q)) |
| 735 | return 0; | 741 | return 0; |
| 736 | 742 | ||
| 737 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr); | 743 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr); |
| 744 | retry: | ||
| 738 | qperf_inc(q, siga_write); | 745 | qperf_inc(q, siga_write); |
| 739 | 746 | ||
| 740 | cc = qdio_siga_output(q, &busy_bit); | 747 | cc = qdio_siga_output(q, &busy_bit); |
| @@ -743,7 +750,11 @@ static int qdio_kick_outbound_q(struct qdio_q *q) | |||
| 743 | break; | 750 | break; |
| 744 | case 2: | 751 | case 2: |
| 745 | if (busy_bit) { | 752 | if (busy_bit) { |
| 746 | DBF_ERROR("%4x cc2 REP:%1d", SCH_NO(q), q->nr); | 753 | while (++retries < QDIO_BUSY_BIT_RETRIES) { |
| 754 | mdelay(QDIO_BUSY_BIT_RETRY_DELAY); | ||
| 755 | goto retry; | ||
| 756 | } | ||
| 757 | DBF_ERROR("%4x cc2 BBC:%1d", SCH_NO(q), q->nr); | ||
| 747 | cc |= QDIO_ERROR_SIGA_BUSY; | 758 | cc |= QDIO_ERROR_SIGA_BUSY; |
| 748 | } else | 759 | } else |
| 749 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w cc2:%1d", q->nr); | 760 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w cc2:%1d", q->nr); |
| @@ -753,6 +764,10 @@ static int qdio_kick_outbound_q(struct qdio_q *q) | |||
| 753 | DBF_ERROR("%4x SIGA-W:%1d", SCH_NO(q), cc); | 764 | DBF_ERROR("%4x SIGA-W:%1d", SCH_NO(q), cc); |
| 754 | break; | 765 | break; |
| 755 | } | 766 | } |
| 767 | if (retries) { | ||
| 768 | DBF_ERROR("%4x cc2 BB2:%1d", SCH_NO(q), q->nr); | ||
| 769 | DBF_ERROR("count:%u", retries); | ||
| 770 | } | ||
| 756 | return cc; | 771 | return cc; |
| 757 | } | 772 | } |
| 758 | 773 | ||
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index 5c4e741d822..2a1d4dfaf85 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
| 10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
| 11 | #include <linux/kernel_stat.h> | 11 | #include <linux/kernel_stat.h> |
| 12 | #include <asm/atomic.h> | 12 | #include <linux/atomic.h> |
| 13 | #include <asm/debug.h> | 13 | #include <asm/debug.h> |
| 14 | #include <asm/qdio.h> | 14 | #include <asm/qdio.h> |
| 15 | #include <asm/airq.h> | 15 | #include <asm/airq.h> |
| @@ -95,9 +95,11 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) | |||
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | static inline u32 shared_ind_set(void) | 98 | static inline u32 clear_shared_ind(void) |
| 99 | { | 99 | { |
| 100 | return q_indicators[TIQDIO_SHARED_IND].ind; | 100 | if (!atomic_read(&q_indicators[TIQDIO_SHARED_IND].count)) |
| 101 | return 0; | ||
| 102 | return xchg(&q_indicators[TIQDIO_SHARED_IND].ind, 0); | ||
| 101 | } | 103 | } |
| 102 | 104 | ||
| 103 | /** | 105 | /** |
| @@ -107,7 +109,7 @@ static inline u32 shared_ind_set(void) | |||
| 107 | */ | 109 | */ |
| 108 | static void tiqdio_thinint_handler(void *alsi, void *data) | 110 | static void tiqdio_thinint_handler(void *alsi, void *data) |
| 109 | { | 111 | { |
| 110 | u32 si_used = shared_ind_set(); | 112 | u32 si_used = clear_shared_ind(); |
| 111 | struct qdio_q *q; | 113 | struct qdio_q *q; |
| 112 | 114 | ||
| 113 | last_ai_time = S390_lowcore.int_clock; | 115 | last_ai_time = S390_lowcore.int_clock; |
| @@ -150,13 +152,6 @@ static void tiqdio_thinint_handler(void *alsi, void *data) | |||
| 150 | qperf_inc(q, adapter_int); | 152 | qperf_inc(q, adapter_int); |
| 151 | } | 153 | } |
| 152 | rcu_read_unlock(); | 154 | rcu_read_unlock(); |
| 153 | |||
| 154 | /* | ||
| 155 | * If the shared indicator was used clear it now after all queues | ||
| 156 | * were processed. | ||
| 157 | */ | ||
| 158 | if (si_used && shared_ind_set()) | ||
| 159 | xchg(&q_indicators[TIQDIO_SHARED_IND].ind, 0); | ||
| 160 | } | 155 | } |
| 161 | 156 | ||
| 162 | static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset) | 157 | static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset) |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 16e4a25596e..b77ae519d79 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | 6 | * Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 7 | * Ralph Wuerthner <rwuerthn@de.ibm.com> | 7 | * Ralph Wuerthner <rwuerthn@de.ibm.com> |
| 8 | * Felix Beck <felix.beck@de.ibm.com> | 8 | * Felix Beck <felix.beck@de.ibm.com> |
| 9 | * Holger Dengler <hd@linux.vnet.ibm.com> | ||
| 9 | * | 10 | * |
| 10 | * Adjunct processor bus. | 11 | * Adjunct processor bus. |
| 11 | * | 12 | * |
| @@ -40,7 +41,7 @@ | |||
| 40 | #include <linux/mutex.h> | 41 | #include <linux/mutex.h> |
| 41 | #include <asm/reset.h> | 42 | #include <asm/reset.h> |
| 42 | #include <asm/airq.h> | 43 | #include <asm/airq.h> |
| 43 | #include <asm/atomic.h> | 44 | #include <linux/atomic.h> |
| 44 | #include <asm/system.h> | 45 | #include <asm/system.h> |
| 45 | #include <asm/isc.h> | 46 | #include <asm/isc.h> |
| 46 | #include <linux/hrtimer.h> | 47 | #include <linux/hrtimer.h> |
| @@ -222,47 +223,52 @@ ap_queue_interruption_control(ap_qid_t qid, void *ind) | |||
| 222 | } | 223 | } |
| 223 | #endif | 224 | #endif |
| 224 | 225 | ||
| 225 | static inline struct ap_queue_status __ap_4096_commands_available(ap_qid_t qid, | 226 | #ifdef CONFIG_64BIT |
| 226 | int *support) | 227 | static inline struct ap_queue_status |
| 228 | __ap_query_functions(ap_qid_t qid, unsigned int *functions) | ||
| 227 | { | 229 | { |
| 228 | register unsigned long reg0 asm ("0") = 0UL | qid | (1UL << 23); | 230 | register unsigned long reg0 asm ("0") = 0UL | qid | (1UL << 23); |
| 229 | register struct ap_queue_status reg1 asm ("1"); | 231 | register struct ap_queue_status reg1 asm ("1") = AP_QUEUE_STATUS_INVALID; |
| 230 | register unsigned long reg2 asm ("2") = 0UL; | 232 | register unsigned long reg2 asm ("2"); |
| 231 | 233 | ||
| 232 | asm volatile( | 234 | asm volatile( |
| 233 | ".long 0xb2af0000\n" | 235 | ".long 0xb2af0000\n" |
| 234 | "0: la %1,0\n" | 236 | "0:\n" |
| 235 | "1:\n" | 237 | EX_TABLE(0b, 0b) |
| 236 | EX_TABLE(0b, 1b) | 238 | : "+d" (reg0), "+d" (reg1), "=d" (reg2) |
| 237 | : "+d" (reg0), "=d" (reg1), "=d" (reg2) | ||
| 238 | : | 239 | : |
| 239 | : "cc"); | 240 | : "cc"); |
| 240 | 241 | ||
| 241 | if (reg2 & 0x6000000000000000ULL) | 242 | *functions = (unsigned int)(reg2 >> 32); |
| 242 | *support = 1; | ||
| 243 | else | ||
| 244 | *support = 0; | ||
| 245 | |||
| 246 | return reg1; | 243 | return reg1; |
| 247 | } | 244 | } |
| 245 | #endif | ||
| 248 | 246 | ||
| 249 | /** | 247 | /** |
| 250 | * ap_4096_commands_availablen(): Check for availability of 4096 bit RSA | 248 | * ap_query_functions(): Query supported functions. |
| 251 | * support. | ||
| 252 | * @qid: The AP queue number | 249 | * @qid: The AP queue number |
| 250 | * @functions: Pointer to functions field. | ||
| 253 | * | 251 | * |
| 254 | * Returns 1 if 4096 bit RSA keys are support fo the AP, returns 0 if not. | 252 | * Returns |
| 253 | * 0 on success. | ||
| 254 | * -ENODEV if queue not valid. | ||
| 255 | * -EBUSY if device busy. | ||
| 256 | * -EINVAL if query function is not supported | ||
| 255 | */ | 257 | */ |
| 256 | int ap_4096_commands_available(ap_qid_t qid) | 258 | static int ap_query_functions(ap_qid_t qid, unsigned int *functions) |
| 257 | { | 259 | { |
| 260 | #ifdef CONFIG_64BIT | ||
| 258 | struct ap_queue_status status; | 261 | struct ap_queue_status status; |
| 259 | int i, support = 0; | 262 | int i; |
| 260 | status = __ap_4096_commands_available(qid, &support); | 263 | status = __ap_query_functions(qid, functions); |
| 261 | 264 | ||
| 262 | for (i = 0; i < AP_MAX_RESET; i++) { | 265 | for (i = 0; i < AP_MAX_RESET; i++) { |
| 266 | if (ap_queue_status_invalid_test(&status)) | ||
| 267 | return -ENODEV; | ||
| 268 | |||
| 263 | switch (status.response_code) { | 269 | switch (status.response_code) { |
| 264 | case AP_RESPONSE_NORMAL: | 270 | case AP_RESPONSE_NORMAL: |
| 265 | return support; | 271 | return 0; |
| 266 | case AP_RESPONSE_RESET_IN_PROGRESS: | 272 | case AP_RESPONSE_RESET_IN_PROGRESS: |
| 267 | case AP_RESPONSE_BUSY: | 273 | case AP_RESPONSE_BUSY: |
| 268 | break; | 274 | break; |
| @@ -270,7 +276,7 @@ int ap_4096_commands_available(ap_qid_t qid) | |||
| 270 | case AP_RESPONSE_DECONFIGURED: | 276 | case AP_RESPONSE_DECONFIGURED: |
| 271 | case AP_RESPONSE_CHECKSTOPPED: | 277 | case AP_RESPONSE_CHECKSTOPPED: |
| 272 | case AP_RESPONSE_INVALID_ADDRESS: | 278 | case AP_RESPONSE_INVALID_ADDRESS: |
| 273 | return 0; | 279 | return -ENODEV; |
| 274 | case AP_RESPONSE_OTHERWISE_CHANGED: | 280 | case AP_RESPONSE_OTHERWISE_CHANGED: |
| 275 | break; | 281 | break; |
| 276 | default: | 282 | default: |
| @@ -278,10 +284,31 @@ int ap_4096_commands_available(ap_qid_t qid) | |||
| 278 | } | 284 | } |
| 279 | if (i < AP_MAX_RESET - 1) { | 285 | if (i < AP_MAX_RESET - 1) { |
| 280 | udelay(5); | 286 | udelay(5); |
| 281 | status = __ap_4096_commands_available(qid, &support); | 287 | status = __ap_query_functions(qid, functions); |
| 282 | } | 288 | } |
| 283 | } | 289 | } |
| 284 | return support; | 290 | return -EBUSY; |
| 291 | #else | ||
| 292 | return -EINVAL; | ||
| 293 | #endif | ||
| 294 | } | ||
| 295 | |||
| 296 | /** | ||
| 297 | * ap_4096_commands_availablen(): Check for availability of 4096 bit RSA | ||
| 298 | * support. | ||
| 299 | * @qid: The AP queue number | ||
| 300 | * | ||
| 301 | * Returns 1 if 4096 bit RSA keys are support fo the AP, returns 0 if not. | ||
| 302 | */ | ||
| 303 | int ap_4096_commands_available(ap_qid_t qid) | ||
| 304 | { | ||
| 305 | unsigned int functions; | ||
| 306 | |||
| 307 | if (ap_query_functions(qid, &functions)) | ||
| 308 | return 0; | ||
| 309 | |||
| 310 | return test_ap_facility(functions, 1) && | ||
| 311 | test_ap_facility(functions, 2); | ||
| 285 | } | 312 | } |
| 286 | EXPORT_SYMBOL(ap_4096_commands_available); | 313 | EXPORT_SYMBOL(ap_4096_commands_available); |
| 287 | 314 | ||
| @@ -1135,6 +1162,7 @@ static void ap_scan_bus(struct work_struct *unused) | |||
| 1135 | struct device *dev; | 1162 | struct device *dev; |
| 1136 | ap_qid_t qid; | 1163 | ap_qid_t qid; |
| 1137 | int queue_depth, device_type; | 1164 | int queue_depth, device_type; |
| 1165 | unsigned int device_functions; | ||
| 1138 | int rc, i; | 1166 | int rc, i; |
| 1139 | 1167 | ||
| 1140 | if (ap_select_domain() != 0) | 1168 | if (ap_select_domain() != 0) |
| @@ -1183,14 +1211,30 @@ static void ap_scan_bus(struct work_struct *unused) | |||
| 1183 | INIT_LIST_HEAD(&ap_dev->list); | 1211 | INIT_LIST_HEAD(&ap_dev->list); |
| 1184 | setup_timer(&ap_dev->timeout, ap_request_timeout, | 1212 | setup_timer(&ap_dev->timeout, ap_request_timeout, |
| 1185 | (unsigned long) ap_dev); | 1213 | (unsigned long) ap_dev); |
| 1186 | if (device_type == 0) { | 1214 | switch (device_type) { |
| 1215 | case 0: | ||
| 1187 | if (ap_probe_device_type(ap_dev)) { | 1216 | if (ap_probe_device_type(ap_dev)) { |
| 1188 | kfree(ap_dev); | 1217 | kfree(ap_dev); |
| 1189 | continue; | 1218 | continue; |
| 1190 | } | 1219 | } |
| 1191 | } | 1220 | break; |
| 1192 | else | 1221 | case 10: |
| 1222 | if (ap_query_functions(qid, &device_functions)) { | ||
| 1223 | kfree(ap_dev); | ||
| 1224 | continue; | ||
| 1225 | } | ||
| 1226 | if (test_ap_facility(device_functions, 3)) | ||
| 1227 | ap_dev->device_type = AP_DEVICE_TYPE_CEX3C; | ||
| 1228 | else if (test_ap_facility(device_functions, 4)) | ||
| 1229 | ap_dev->device_type = AP_DEVICE_TYPE_CEX3A; | ||
| 1230 | else { | ||
| 1231 | kfree(ap_dev); | ||
| 1232 | continue; | ||
| 1233 | } | ||
| 1234 | break; | ||
| 1235 | default: | ||
| 1193 | ap_dev->device_type = device_type; | 1236 | ap_dev->device_type = device_type; |
| 1237 | } | ||
| 1194 | 1238 | ||
| 1195 | ap_dev->device.bus = &ap_bus_type; | 1239 | ap_dev->device.bus = &ap_bus_type; |
| 1196 | ap_dev->device.parent = ap_root_device; | 1240 | ap_dev->device.parent = ap_root_device; |
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h index 08b9738285b..d960a6309ee 100644 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | 6 | * Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 7 | * Ralph Wuerthner <rwuerthn@de.ibm.com> | 7 | * Ralph Wuerthner <rwuerthn@de.ibm.com> |
| 8 | * Felix Beck <felix.beck@de.ibm.com> | 8 | * Felix Beck <felix.beck@de.ibm.com> |
| 9 | * Holger Dengler <hd@linux.vnet.ibm.com> | ||
| 9 | * | 10 | * |
| 10 | * Adjunct processor bus header file. | 11 | * Adjunct processor bus header file. |
| 11 | * | 12 | * |
| @@ -72,7 +73,26 @@ struct ap_queue_status { | |||
| 72 | unsigned int int_enabled : 1; | 73 | unsigned int int_enabled : 1; |
| 73 | unsigned int response_code : 8; | 74 | unsigned int response_code : 8; |
| 74 | unsigned int pad2 : 16; | 75 | unsigned int pad2 : 16; |
| 75 | }; | 76 | } __packed; |
| 77 | |||
| 78 | #define AP_QUEUE_STATUS_INVALID \ | ||
| 79 | { 1, 1, 1, 0xF, 1, 0xFF, 0xFFFF } | ||
| 80 | |||
| 81 | static inline | ||
| 82 | int ap_queue_status_invalid_test(struct ap_queue_status *status) | ||
| 83 | { | ||
| 84 | struct ap_queue_status invalid = AP_QUEUE_STATUS_INVALID; | ||
| 85 | return !(memcmp(status, &invalid, sizeof(struct ap_queue_status))); | ||
| 86 | } | ||
| 87 | |||
| 88 | #define MAX_AP_FACILITY 31 | ||
| 89 | |||
| 90 | static inline int test_ap_facility(unsigned int function, unsigned int nr) | ||
| 91 | { | ||
| 92 | if (nr > MAX_AP_FACILITY) | ||
| 93 | return 0; | ||
| 94 | return function & (unsigned int)(0x80000000 >> nr); | ||
| 95 | } | ||
| 76 | 96 | ||
| 77 | #define AP_RESPONSE_NORMAL 0x00 | 97 | #define AP_RESPONSE_NORMAL 0x00 |
| 78 | #define AP_RESPONSE_Q_NOT_AVAIL 0x01 | 98 | #define AP_RESPONSE_Q_NOT_AVAIL 0x01 |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 8e65447f76b..88ad33ed5d3 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
| 37 | #include <linux/compat.h> | 37 | #include <linux/compat.h> |
| 38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
| 39 | #include <asm/atomic.h> | 39 | #include <linux/atomic.h> |
| 40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
| 41 | #include <linux/hw_random.h> | 41 | #include <linux/hw_random.h> |
| 42 | 42 | ||
diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c index 2176d00b395..da171b5f399 100644 --- a/drivers/s390/crypto/zcrypt_cex2a.c +++ b/drivers/s390/crypto/zcrypt_cex2a.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
| 32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
| 33 | #include <asm/atomic.h> | 33 | #include <linux/atomic.h> |
| 34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| 35 | 35 | ||
| 36 | #include "ap_bus.h" | 36 | #include "ap_bus.h" |
diff --git a/drivers/s390/crypto/zcrypt_mono.c b/drivers/s390/crypto/zcrypt_mono.c index 44253fdd413..eb313c3fb2d 100644 --- a/drivers/s390/crypto/zcrypt_mono.c +++ b/drivers/s390/crypto/zcrypt_mono.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
| 33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
| 34 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
| 35 | #include <asm/atomic.h> | 35 | #include <linux/atomic.h> |
| 36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
| 37 | 37 | ||
| 38 | #include "ap_bus.h" | 38 | #include "ap_bus.h" |
diff --git a/drivers/s390/crypto/zcrypt_pcica.c b/drivers/s390/crypto/zcrypt_pcica.c index 1afb69c75fe..d84816f144d 100644 --- a/drivers/s390/crypto/zcrypt_pcica.c +++ b/drivers/s390/crypto/zcrypt_pcica.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
| 32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
| 33 | #include <asm/atomic.h> | 33 | #include <linux/atomic.h> |
| 34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| 35 | 35 | ||
| 36 | #include "ap_bus.h" | 36 | #include "ap_bus.h" |
diff --git a/drivers/s390/crypto/zcrypt_pcicc.c b/drivers/s390/crypto/zcrypt_pcicc.c index aa4c050a569..bdbdbe19299 100644 --- a/drivers/s390/crypto/zcrypt_pcicc.c +++ b/drivers/s390/crypto/zcrypt_pcicc.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
| 31 | #include <linux/gfp.h> | 31 | #include <linux/gfp.h> |
| 32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
| 33 | #include <asm/atomic.h> | 33 | #include <linux/atomic.h> |
| 34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| 35 | 35 | ||
| 36 | #include "ap_bus.h" | 36 | #include "ap_bus.h" |
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c index 4f85eb725f4..dd4737808e0 100644 --- a/drivers/s390/crypto/zcrypt_pcixcc.c +++ b/drivers/s390/crypto/zcrypt_pcixcc.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
| 32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
| 33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
| 34 | #include <asm/atomic.h> | 34 | #include <linux/atomic.h> |
| 35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
| 36 | 36 | ||
| 37 | #include "ap_bus.h" | 37 | #include "ap_bus.h" |
diff --git a/drivers/s390/net/ctcm_mpc.h b/drivers/s390/net/ctcm_mpc.h index 5336120cddf..1fa07b0c11c 100644 --- a/drivers/s390/net/ctcm_mpc.h +++ b/drivers/s390/net/ctcm_mpc.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #ifndef _CTC_MPC_H_ | 12 | #ifndef _CTC_MPC_H_ |
| 13 | #define _CTC_MPC_H_ | 13 | #define _CTC_MPC_H_ |
| 14 | 14 | ||
| 15 | #include <linux/interrupt.h> | ||
| 15 | #include <linux/skbuff.h> | 16 | #include <linux/skbuff.h> |
| 16 | #include "fsm.h" | 17 | #include "fsm.h" |
| 17 | 18 | ||
diff --git a/drivers/s390/net/fsm.h b/drivers/s390/net/fsm.h index 1e8b235d95b..a4510cf5903 100644 --- a/drivers/s390/net/fsm.h +++ b/drivers/s390/net/fsm.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
| 10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
| 11 | #include <asm/atomic.h> | 11 | #include <linux/atomic.h> |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * Define this to get debugging messages. | 14 | * Define this to get debugging messages. |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index d3cee33e554..26a4110eeb2 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
| @@ -720,7 +720,7 @@ struct qeth_card { | |||
| 720 | wait_queue_head_t wait_q; | 720 | wait_queue_head_t wait_q; |
| 721 | spinlock_t vlanlock; | 721 | spinlock_t vlanlock; |
| 722 | spinlock_t mclock; | 722 | spinlock_t mclock; |
| 723 | struct vlan_group *vlangrp; | 723 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
| 724 | struct list_head vid_list; | 724 | struct list_head vid_list; |
| 725 | struct list_head mc_list; | 725 | struct list_head mc_list; |
| 726 | struct work_struct kernel_thread_starter; | 726 | struct work_struct kernel_thread_starter; |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index dd08f7b42fb..4550573c25e 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
| @@ -1097,7 +1097,6 @@ static int qeth_setup_card(struct qeth_card *card) | |||
| 1097 | card->dev = NULL; | 1097 | card->dev = NULL; |
| 1098 | spin_lock_init(&card->vlanlock); | 1098 | spin_lock_init(&card->vlanlock); |
| 1099 | spin_lock_init(&card->mclock); | 1099 | spin_lock_init(&card->mclock); |
| 1100 | card->vlangrp = NULL; | ||
| 1101 | spin_lock_init(&card->lock); | 1100 | spin_lock_init(&card->lock); |
| 1102 | spin_lock_init(&card->ip_lock); | 1101 | spin_lock_init(&card->ip_lock); |
| 1103 | spin_lock_init(&card->thread_mask_lock); | 1102 | spin_lock_init(&card->thread_mask_lock); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index fd69da3fa6b..c74e8670fab 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
| 16 | #include <linux/bitops.h> | ||
| 16 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
| 18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| @@ -23,6 +24,7 @@ | |||
| 23 | #include <linux/inetdevice.h> | 24 | #include <linux/inetdevice.h> |
| 24 | #include <linux/igmp.h> | 25 | #include <linux/igmp.h> |
| 25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/if_vlan.h> | ||
| 26 | 28 | ||
| 27 | #include <net/ip.h> | 29 | #include <net/ip.h> |
| 28 | #include <net/arp.h> | 30 | #include <net/arp.h> |
| @@ -1696,16 +1698,18 @@ static void qeth_l3_add_mc(struct qeth_card *card, struct in_device *in4_dev) | |||
| 1696 | static void qeth_l3_add_vlan_mc(struct qeth_card *card) | 1698 | static void qeth_l3_add_vlan_mc(struct qeth_card *card) |
| 1697 | { | 1699 | { |
| 1698 | struct in_device *in_dev; | 1700 | struct in_device *in_dev; |
| 1699 | struct vlan_group *vg; | 1701 | u16 vid; |
| 1700 | int i; | ||
| 1701 | 1702 | ||
| 1702 | QETH_CARD_TEXT(card, 4, "addmcvl"); | 1703 | QETH_CARD_TEXT(card, 4, "addmcvl"); |
| 1703 | if (!qeth_is_supported(card, IPA_FULL_VLAN) || (card->vlangrp == NULL)) | 1704 | if (!qeth_is_supported(card, IPA_FULL_VLAN)) |
| 1704 | return; | 1705 | return; |
| 1705 | 1706 | ||
| 1706 | vg = card->vlangrp; | 1707 | for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { |
| 1707 | for (i = 0; i < VLAN_N_VID; i++) { | 1708 | struct net_device *netdev; |
| 1708 | struct net_device *netdev = vlan_group_get_device(vg, i); | 1709 | |
| 1710 | rcu_read_lock(); | ||
| 1711 | netdev = __vlan_find_dev_deep(card->dev, vid); | ||
| 1712 | rcu_read_unlock(); | ||
| 1709 | if (netdev == NULL || | 1713 | if (netdev == NULL || |
| 1710 | !(netdev->flags & IFF_UP)) | 1714 | !(netdev->flags & IFF_UP)) |
| 1711 | continue; | 1715 | continue; |
| @@ -1759,16 +1763,16 @@ static void qeth_l3_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev) | |||
| 1759 | static void qeth_l3_add_vlan_mc6(struct qeth_card *card) | 1763 | static void qeth_l3_add_vlan_mc6(struct qeth_card *card) |
| 1760 | { | 1764 | { |
| 1761 | struct inet6_dev *in_dev; | 1765 | struct inet6_dev *in_dev; |
| 1762 | struct vlan_group *vg; | 1766 | u16 vid; |
| 1763 | int i; | ||
| 1764 | 1767 | ||
| 1765 | QETH_CARD_TEXT(card, 4, "admc6vl"); | 1768 | QETH_CARD_TEXT(card, 4, "admc6vl"); |
| 1766 | if (!qeth_is_supported(card, IPA_FULL_VLAN) || (card->vlangrp == NULL)) | 1769 | if (!qeth_is_supported(card, IPA_FULL_VLAN)) |
| 1767 | return; | 1770 | return; |
| 1768 | 1771 | ||
| 1769 | vg = card->vlangrp; | 1772 | for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { |
| 1770 | for (i = 0; i < VLAN_N_VID; i++) { | 1773 | struct net_device *netdev; |
| 1771 | struct net_device *netdev = vlan_group_get_device(vg, i); | 1774 | |
| 1775 | netdev = __vlan_find_dev_deep(card->dev, vid); | ||
| 1772 | if (netdev == NULL || | 1776 | if (netdev == NULL || |
| 1773 | !(netdev->flags & IFF_UP)) | 1777 | !(netdev->flags & IFF_UP)) |
| 1774 | continue; | 1778 | continue; |
| @@ -1806,10 +1810,12 @@ static void qeth_l3_free_vlan_addresses4(struct qeth_card *card, | |||
| 1806 | struct in_device *in_dev; | 1810 | struct in_device *in_dev; |
| 1807 | struct in_ifaddr *ifa; | 1811 | struct in_ifaddr *ifa; |
| 1808 | struct qeth_ipaddr *addr; | 1812 | struct qeth_ipaddr *addr; |
| 1813 | struct net_device *netdev; | ||
| 1809 | 1814 | ||
| 1810 | QETH_CARD_TEXT(card, 4, "frvaddr4"); | 1815 | QETH_CARD_TEXT(card, 4, "frvaddr4"); |
| 1811 | 1816 | ||
| 1812 | in_dev = in_dev_get(vlan_group_get_device(card->vlangrp, vid)); | 1817 | netdev = __vlan_find_dev_deep(card->dev, vid); |
| 1818 | in_dev = in_dev_get(netdev); | ||
| 1813 | if (!in_dev) | 1819 | if (!in_dev) |
| 1814 | return; | 1820 | return; |
| 1815 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { | 1821 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { |
| @@ -1832,10 +1838,12 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card, | |||
| 1832 | struct inet6_dev *in6_dev; | 1838 | struct inet6_dev *in6_dev; |
| 1833 | struct inet6_ifaddr *ifa; | 1839 | struct inet6_ifaddr *ifa; |
| 1834 | struct qeth_ipaddr *addr; | 1840 | struct qeth_ipaddr *addr; |
| 1841 | struct net_device *netdev; | ||
| 1835 | 1842 | ||
| 1836 | QETH_CARD_TEXT(card, 4, "frvaddr6"); | 1843 | QETH_CARD_TEXT(card, 4, "frvaddr6"); |
| 1837 | 1844 | ||
| 1838 | in6_dev = in6_dev_get(vlan_group_get_device(card->vlangrp, vid)); | 1845 | netdev = __vlan_find_dev_deep(card->dev, vid); |
| 1846 | in6_dev = in6_dev_get(netdev); | ||
| 1839 | if (!in6_dev) | 1847 | if (!in6_dev) |
| 1840 | return; | 1848 | return; |
| 1841 | list_for_each_entry(ifa, &in6_dev->addr_list, if_list) { | 1849 | list_for_each_entry(ifa, &in6_dev->addr_list, if_list) { |
| @@ -1856,26 +1864,15 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card, | |||
| 1856 | static void qeth_l3_free_vlan_addresses(struct qeth_card *card, | 1864 | static void qeth_l3_free_vlan_addresses(struct qeth_card *card, |
| 1857 | unsigned short vid) | 1865 | unsigned short vid) |
| 1858 | { | 1866 | { |
| 1859 | if (!card->vlangrp) | ||
| 1860 | return; | ||
| 1861 | qeth_l3_free_vlan_addresses4(card, vid); | 1867 | qeth_l3_free_vlan_addresses4(card, vid); |
| 1862 | qeth_l3_free_vlan_addresses6(card, vid); | 1868 | qeth_l3_free_vlan_addresses6(card, vid); |
| 1863 | } | 1869 | } |
| 1864 | 1870 | ||
| 1865 | static void qeth_l3_vlan_rx_register(struct net_device *dev, | 1871 | static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) |
| 1866 | struct vlan_group *grp) | ||
| 1867 | { | 1872 | { |
| 1868 | struct qeth_card *card = dev->ml_priv; | 1873 | struct qeth_card *card = dev->ml_priv; |
| 1869 | unsigned long flags; | ||
| 1870 | 1874 | ||
| 1871 | QETH_CARD_TEXT(card, 4, "vlanreg"); | 1875 | set_bit(vid, card->active_vlans); |
| 1872 | spin_lock_irqsave(&card->vlanlock, flags); | ||
| 1873 | card->vlangrp = grp; | ||
| 1874 | spin_unlock_irqrestore(&card->vlanlock, flags); | ||
| 1875 | } | ||
| 1876 | |||
| 1877 | static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | ||
| 1878 | { | ||
| 1879 | return; | 1876 | return; |
| 1880 | } | 1877 | } |
| 1881 | 1878 | ||
| @@ -1892,7 +1889,7 @@ static void qeth_l3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
| 1892 | spin_lock_irqsave(&card->vlanlock, flags); | 1889 | spin_lock_irqsave(&card->vlanlock, flags); |
| 1893 | /* unregister IP addresses of vlan device */ | 1890 | /* unregister IP addresses of vlan device */ |
| 1894 | qeth_l3_free_vlan_addresses(card, vid); | 1891 | qeth_l3_free_vlan_addresses(card, vid); |
| 1895 | vlan_group_set_device(card->vlangrp, vid, NULL); | 1892 | clear_bit(vid, card->active_vlans); |
| 1896 | spin_unlock_irqrestore(&card->vlanlock, flags); | 1893 | spin_unlock_irqrestore(&card->vlanlock, flags); |
| 1897 | qeth_l3_set_multicast_list(card->dev); | 1894 | qeth_l3_set_multicast_list(card->dev); |
| 1898 | } | 1895 | } |
| @@ -2014,10 +2011,8 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, | |||
| 2014 | &vlan_tag); | 2011 | &vlan_tag); |
| 2015 | len = skb->len; | 2012 | len = skb->len; |
| 2016 | if (is_vlan && !card->options.sniffer) | 2013 | if (is_vlan && !card->options.sniffer) |
| 2017 | vlan_gro_receive(&card->napi, card->vlangrp, | 2014 | __vlan_hwaccel_put_tag(skb, vlan_tag); |
| 2018 | vlan_tag, skb); | 2015 | napi_gro_receive(&card->napi, skb); |
| 2019 | else | ||
| 2020 | napi_gro_receive(&card->napi, skb); | ||
| 2021 | break; | 2016 | break; |
| 2022 | case QETH_HEADER_TYPE_LAYER2: /* for HiperSockets sniffer */ | 2017 | case QETH_HEADER_TYPE_LAYER2: /* for HiperSockets sniffer */ |
| 2023 | skb->pkt_type = PACKET_HOST; | 2018 | skb->pkt_type = PACKET_HOST; |
| @@ -2118,15 +2113,15 @@ static int qeth_l3_verify_vlan_dev(struct net_device *dev, | |||
| 2118 | struct qeth_card *card) | 2113 | struct qeth_card *card) |
| 2119 | { | 2114 | { |
| 2120 | int rc = 0; | 2115 | int rc = 0; |
| 2121 | struct vlan_group *vg; | 2116 | u16 vid; |
| 2122 | int i; | ||
| 2123 | 2117 | ||
| 2124 | vg = card->vlangrp; | 2118 | for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { |
| 2125 | if (!vg) | 2119 | struct net_device *netdev; |
| 2126 | return rc; | ||
| 2127 | 2120 | ||
| 2128 | for (i = 0; i < VLAN_N_VID; i++) { | 2121 | rcu_read_lock(); |
| 2129 | if (vlan_group_get_device(vg, i) == dev) { | 2122 | netdev = __vlan_find_dev_deep(dev, vid); |
| 2123 | rcu_read_unlock(); | ||
| 2124 | if (netdev == dev) { | ||
| 2130 | rc = QETH_VLAN_CARD; | 2125 | rc = QETH_VLAN_CARD; |
| 2131 | break; | 2126 | break; |
| 2132 | } | 2127 | } |
| @@ -2742,9 +2737,16 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 2742 | int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | 2737 | int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) |
| 2743 | { | 2738 | { |
| 2744 | int cast_type = RTN_UNSPEC; | 2739 | int cast_type = RTN_UNSPEC; |
| 2740 | struct neighbour *n = NULL; | ||
| 2741 | struct dst_entry *dst; | ||
| 2745 | 2742 | ||
| 2746 | if (skb_dst(skb) && skb_dst(skb)->neighbour) { | 2743 | rcu_read_lock(); |
| 2747 | cast_type = skb_dst(skb)->neighbour->type; | 2744 | dst = skb_dst(skb); |
| 2745 | if (dst) | ||
| 2746 | n = dst_get_neighbour(dst); | ||
| 2747 | if (n) { | ||
| 2748 | cast_type = n->type; | ||
| 2749 | rcu_read_unlock(); | ||
| 2748 | if ((cast_type == RTN_BROADCAST) || | 2750 | if ((cast_type == RTN_BROADCAST) || |
| 2749 | (cast_type == RTN_MULTICAST) || | 2751 | (cast_type == RTN_MULTICAST) || |
| 2750 | (cast_type == RTN_ANYCAST)) | 2752 | (cast_type == RTN_ANYCAST)) |
| @@ -2752,6 +2754,8 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
| 2752 | else | 2754 | else |
| 2753 | return RTN_UNSPEC; | 2755 | return RTN_UNSPEC; |
| 2754 | } | 2756 | } |
| 2757 | rcu_read_unlock(); | ||
| 2758 | |||
| 2755 | /* try something else */ | 2759 | /* try something else */ |
| 2756 | if (skb->protocol == ETH_P_IPV6) | 2760 | if (skb->protocol == ETH_P_IPV6) |
| 2757 | return (skb_network_header(skb)[24] == 0xff) ? | 2761 | return (skb_network_header(skb)[24] == 0xff) ? |
| @@ -2787,6 +2791,9 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
| 2787 | static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | 2791 | static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, |
| 2788 | struct sk_buff *skb, int ipv, int cast_type) | 2792 | struct sk_buff *skb, int ipv, int cast_type) |
| 2789 | { | 2793 | { |
| 2794 | struct neighbour *n = NULL; | ||
| 2795 | struct dst_entry *dst; | ||
| 2796 | |||
| 2790 | memset(hdr, 0, sizeof(struct qeth_hdr)); | 2797 | memset(hdr, 0, sizeof(struct qeth_hdr)); |
| 2791 | hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; | 2798 | hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; |
| 2792 | hdr->hdr.l3.ext_flags = 0; | 2799 | hdr->hdr.l3.ext_flags = 0; |
| @@ -2795,7 +2802,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
| 2795 | * before we're going to overwrite this location with next hop ip. | 2802 | * before we're going to overwrite this location with next hop ip. |
| 2796 | * v6 uses passthrough, v4 sets the tag in the QDIO header. | 2803 | * v6 uses passthrough, v4 sets the tag in the QDIO header. |
| 2797 | */ | 2804 | */ |
| 2798 | if (card->vlangrp && vlan_tx_tag_present(skb)) { | 2805 | if (vlan_tx_tag_present(skb)) { |
| 2799 | if ((ipv == 4) || (card->info.type == QETH_CARD_TYPE_IQD)) | 2806 | if ((ipv == 4) || (card->info.type == QETH_CARD_TYPE_IQD)) |
| 2800 | hdr->hdr.l3.ext_flags = QETH_HDR_EXT_VLAN_FRAME; | 2807 | hdr->hdr.l3.ext_flags = QETH_HDR_EXT_VLAN_FRAME; |
| 2801 | else | 2808 | else |
| @@ -2804,13 +2811,18 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
| 2804 | } | 2811 | } |
| 2805 | 2812 | ||
| 2806 | hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr); | 2813 | hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr); |
| 2814 | |||
| 2815 | rcu_read_lock(); | ||
| 2816 | dst = skb_dst(skb); | ||
| 2817 | if (dst) | ||
| 2818 | n = dst_get_neighbour(dst); | ||
| 2807 | if (ipv == 4) { | 2819 | if (ipv == 4) { |
| 2808 | /* IPv4 */ | 2820 | /* IPv4 */ |
| 2809 | hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type); | 2821 | hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type); |
| 2810 | memset(hdr->hdr.l3.dest_addr, 0, 12); | 2822 | memset(hdr->hdr.l3.dest_addr, 0, 12); |
| 2811 | if ((skb_dst(skb)) && (skb_dst(skb)->neighbour)) { | 2823 | if (n) { |
| 2812 | *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = | 2824 | *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = |
| 2813 | *((u32 *) skb_dst(skb)->neighbour->primary_key); | 2825 | *((u32 *) n->primary_key); |
| 2814 | } else { | 2826 | } else { |
| 2815 | /* fill in destination address used in ip header */ | 2827 | /* fill in destination address used in ip header */ |
| 2816 | *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = | 2828 | *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = |
| @@ -2821,9 +2833,9 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
| 2821 | hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type); | 2833 | hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type); |
| 2822 | if (card->info.type == QETH_CARD_TYPE_IQD) | 2834 | if (card->info.type == QETH_CARD_TYPE_IQD) |
| 2823 | hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU; | 2835 | hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU; |
| 2824 | if ((skb_dst(skb)) && (skb_dst(skb)->neighbour)) { | 2836 | if (n) { |
| 2825 | memcpy(hdr->hdr.l3.dest_addr, | 2837 | memcpy(hdr->hdr.l3.dest_addr, |
| 2826 | skb_dst(skb)->neighbour->primary_key, 16); | 2838 | n->primary_key, 16); |
| 2827 | } else { | 2839 | } else { |
| 2828 | /* fill in destination address used in ip header */ | 2840 | /* fill in destination address used in ip header */ |
| 2829 | memcpy(hdr->hdr.l3.dest_addr, | 2841 | memcpy(hdr->hdr.l3.dest_addr, |
| @@ -2847,6 +2859,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
| 2847 | QETH_CAST_UNICAST | QETH_HDR_PASSTHRU; | 2859 | QETH_CAST_UNICAST | QETH_HDR_PASSTHRU; |
| 2848 | } | 2860 | } |
| 2849 | } | 2861 | } |
| 2862 | rcu_read_unlock(); | ||
| 2850 | } | 2863 | } |
| 2851 | 2864 | ||
| 2852 | static inline void qeth_l3_hdr_csum(struct qeth_card *card, | 2865 | static inline void qeth_l3_hdr_csum(struct qeth_card *card, |
| @@ -2977,8 +2990,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 2977 | skb_pull(new_skb, ETH_HLEN); | 2990 | skb_pull(new_skb, ETH_HLEN); |
| 2978 | } | 2991 | } |
| 2979 | 2992 | ||
| 2980 | if (ipv != 4 && card->vlangrp && | 2993 | if (ipv != 4 && vlan_tx_tag_present(new_skb)) { |
| 2981 | vlan_tx_tag_present(new_skb)) { | ||
| 2982 | skb_push(new_skb, VLAN_HLEN); | 2994 | skb_push(new_skb, VLAN_HLEN); |
| 2983 | skb_copy_to_linear_data(new_skb, new_skb->data + 4, 4); | 2995 | skb_copy_to_linear_data(new_skb, new_skb->data + 4, 4); |
| 2984 | skb_copy_to_linear_data_offset(new_skb, 4, | 2996 | skb_copy_to_linear_data_offset(new_skb, 4, |
| @@ -3222,14 +3234,13 @@ static const struct net_device_ops qeth_l3_netdev_ops = { | |||
| 3222 | .ndo_start_xmit = qeth_l3_hard_start_xmit, | 3234 | .ndo_start_xmit = qeth_l3_hard_start_xmit, |
| 3223 | .ndo_validate_addr = eth_validate_addr, | 3235 | .ndo_validate_addr = eth_validate_addr, |
| 3224 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, | 3236 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, |
| 3225 | .ndo_do_ioctl = qeth_l3_do_ioctl, | 3237 | .ndo_do_ioctl = qeth_l3_do_ioctl, |
| 3226 | .ndo_change_mtu = qeth_change_mtu, | 3238 | .ndo_change_mtu = qeth_change_mtu, |
| 3227 | .ndo_fix_features = qeth_l3_fix_features, | 3239 | .ndo_fix_features = qeth_l3_fix_features, |
| 3228 | .ndo_set_features = qeth_l3_set_features, | 3240 | .ndo_set_features = qeth_l3_set_features, |
| 3229 | .ndo_vlan_rx_register = qeth_l3_vlan_rx_register, | ||
| 3230 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, | 3241 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, |
| 3231 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, | 3242 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, |
| 3232 | .ndo_tx_timeout = qeth_tx_timeout, | 3243 | .ndo_tx_timeout = qeth_tx_timeout, |
| 3233 | }; | 3244 | }; |
| 3234 | 3245 | ||
| 3235 | static const struct net_device_ops qeth_l3_osa_netdev_ops = { | 3246 | static const struct net_device_ops qeth_l3_osa_netdev_ops = { |
| @@ -3239,14 +3250,13 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = { | |||
| 3239 | .ndo_start_xmit = qeth_l3_hard_start_xmit, | 3250 | .ndo_start_xmit = qeth_l3_hard_start_xmit, |
| 3240 | .ndo_validate_addr = eth_validate_addr, | 3251 | .ndo_validate_addr = eth_validate_addr, |
| 3241 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, | 3252 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, |
| 3242 | .ndo_do_ioctl = qeth_l3_do_ioctl, | 3253 | .ndo_do_ioctl = qeth_l3_do_ioctl, |
| 3243 | .ndo_change_mtu = qeth_change_mtu, | 3254 | .ndo_change_mtu = qeth_change_mtu, |
| 3244 | .ndo_fix_features = qeth_l3_fix_features, | 3255 | .ndo_fix_features = qeth_l3_fix_features, |
| 3245 | .ndo_set_features = qeth_l3_set_features, | 3256 | .ndo_set_features = qeth_l3_set_features, |
| 3246 | .ndo_vlan_rx_register = qeth_l3_vlan_rx_register, | ||
| 3247 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, | 3257 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, |
| 3248 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, | 3258 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, |
| 3249 | .ndo_tx_timeout = qeth_tx_timeout, | 3259 | .ndo_tx_timeout = qeth_tx_timeout, |
| 3250 | .ndo_neigh_setup = qeth_l3_neigh_setup, | 3260 | .ndo_neigh_setup = qeth_l3_neigh_setup, |
| 3251 | }; | 3261 | }; |
| 3252 | 3262 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 2a4991d6d4d..169ba7b7504 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
| 14 | #include <scsi/fc/fc_fcp.h> | 14 | #include <scsi/fc/fc_fcp.h> |
| 15 | #include <scsi/scsi_eh.h> | 15 | #include <scsi/scsi_eh.h> |
| 16 | #include <asm/atomic.h> | 16 | #include <linux/atomic.h> |
| 17 | #include "zfcp_ext.h" | 17 | #include "zfcp_ext.h" |
| 18 | #include "zfcp_dbf.h" | 18 | #include "zfcp_dbf.h" |
| 19 | #include "zfcp_fc.h" | 19 | #include "zfcp_fc.h" |
| @@ -57,6 +57,10 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev) | |||
| 57 | { | 57 | { |
| 58 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | 58 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); |
| 59 | 59 | ||
| 60 | /* if previous slave_alloc returned early, there is nothing to do */ | ||
| 61 | if (!zfcp_sdev->port) | ||
| 62 | return; | ||
| 63 | |||
| 60 | zfcp_erp_lun_shutdown_wait(sdev, "scssd_1"); | 64 | zfcp_erp_lun_shutdown_wait(sdev, "scssd_1"); |
| 61 | put_device(&zfcp_sdev->port->dev); | 65 | put_device(&zfcp_sdev->port->dev); |
| 62 | } | 66 | } |
