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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull more s390 updates from Martin Schwidefsky:
"The second patch set for the 4.14 merge window:

- Convert the dasd device driver to the blk-mq interface.

- Provide three zcrypt interfaces for vfio_ap. These will be required
for KVM guest access to the crypto cards attached via the AP bus.

- A couple of memory management bug fixes."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/dasd: blk-mq conversion
s390/mm: use a single lock for the fields in mm_context_t
s390/mm: fix race on mm->context.flush_mm
s390/mm: fix local TLB flushing vs. detach of an mm address space
s390/zcrypt: externalize AP queue interrupt control
s390/zcrypt: externalize AP config info query
s390/zcrypt: externalize test AP queue
s390/mm: use VM_BUG_ON in crst_table_[upgrade|downgrade]

+416 -274
+126
arch/s390/include/asm/ap.h
··· 1 + /* 2 + * Adjunct processor (AP) interfaces 3 + * 4 + * Copyright IBM Corp. 2017 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License (version 2 only) 8 + * as published by the Free Software Foundation. 9 + * 10 + * Author(s): Tony Krowiak <akrowia@linux.vnet.ibm.com> 11 + * Martin Schwidefsky <schwidefsky@de.ibm.com> 12 + * Harald Freudenberger <freude@de.ibm.com> 13 + */ 14 + 15 + #ifndef _ASM_S390_AP_H_ 16 + #define _ASM_S390_AP_H_ 17 + 18 + /** 19 + * The ap_qid_t identifier of an ap queue. 20 + * If the AP facilities test (APFT) facility is available, 21 + * card and queue index are 8 bit values, otherwise 22 + * card index is 6 bit and queue index a 4 bit value. 23 + */ 24 + typedef unsigned int ap_qid_t; 25 + 26 + #define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255)) 27 + #define AP_QID_CARD(_qid) (((_qid) >> 8) & 63) 28 + #define AP_QID_QUEUE(_qid) ((_qid) & 255) 29 + 30 + /** 31 + * struct ap_queue_status - Holds the AP queue status. 32 + * @queue_empty: Shows if queue is empty 33 + * @replies_waiting: Waiting replies 34 + * @queue_full: Is 1 if the queue is full 35 + * @irq_enabled: Shows if interrupts are enabled for the AP 36 + * @response_code: Holds the 8 bit response code 37 + * 38 + * The ap queue status word is returned by all three AP functions 39 + * (PQAP, NQAP and DQAP). There's a set of flags in the first 40 + * byte, followed by a 1 byte response code. 41 + */ 42 + struct ap_queue_status { 43 + unsigned int queue_empty : 1; 44 + unsigned int replies_waiting : 1; 45 + unsigned int queue_full : 1; 46 + unsigned int _pad1 : 4; 47 + unsigned int irq_enabled : 1; 48 + unsigned int response_code : 8; 49 + unsigned int _pad2 : 16; 50 + }; 51 + 52 + /** 53 + * ap_test_queue(): Test adjunct processor queue. 54 + * @qid: The AP queue number 55 + * @tbit: Test facilities bit 56 + * @info: Pointer to queue descriptor 57 + * 58 + * Returns AP queue status structure. 59 + */ 60 + struct ap_queue_status ap_test_queue(ap_qid_t qid, 61 + int tbit, 62 + unsigned long *info); 63 + 64 + struct ap_config_info { 65 + unsigned int apsc : 1; /* S bit */ 66 + unsigned int apxa : 1; /* N bit */ 67 + unsigned int qact : 1; /* C bit */ 68 + unsigned int rc8a : 1; /* R bit */ 69 + unsigned char _reserved1 : 4; 70 + unsigned char _reserved2[3]; 71 + unsigned char Na; /* max # of APs - 1 */ 72 + unsigned char Nd; /* max # of Domains - 1 */ 73 + unsigned char _reserved3[10]; 74 + unsigned int apm[8]; /* AP ID mask */ 75 + unsigned int aqm[8]; /* AP queue mask */ 76 + unsigned int adm[8]; /* AP domain mask */ 77 + unsigned char _reserved4[16]; 78 + } __aligned(8); 79 + 80 + /* 81 + * ap_query_configuration(): Fetch cryptographic config info 82 + * 83 + * Returns the ap configuration info fetched via PQAP(QCI). 84 + * On success 0 is returned, on failure a negative errno 85 + * is returned, e.g. if the PQAP(QCI) instruction is not 86 + * available, the return value will be -EOPNOTSUPP. 87 + */ 88 + int ap_query_configuration(struct ap_config_info *info); 89 + 90 + /* 91 + * struct ap_qirq_ctrl - convenient struct for easy invocation 92 + * of the ap_queue_irq_ctrl() function. This struct is passed 93 + * as GR1 parameter to the PQAP(AQIC) instruction. For details 94 + * please see the AR documentation. 95 + */ 96 + struct ap_qirq_ctrl { 97 + unsigned int _res1 : 8; 98 + unsigned int zone : 8; /* zone info */ 99 + unsigned int ir : 1; /* ir flag: enable (1) or disable (0) irq */ 100 + unsigned int _res2 : 4; 101 + unsigned int gisc : 3; /* guest isc field */ 102 + unsigned int _res3 : 6; 103 + unsigned int gf : 2; /* gisa format */ 104 + unsigned int _res4 : 1; 105 + unsigned int gisa : 27; /* gisa origin */ 106 + unsigned int _res5 : 1; 107 + unsigned int isc : 3; /* irq sub class */ 108 + }; 109 + 110 + /** 111 + * ap_queue_irq_ctrl(): Control interruption on a AP queue. 112 + * @qid: The AP queue number 113 + * @qirqctrl: struct ap_qirq_ctrl, see above 114 + * @ind: The notification indicator byte 115 + * 116 + * Returns AP queue status. 117 + * 118 + * Control interruption on the given AP queue. 119 + * Just a simple wrapper function for the low level PQAP(AQIC) 120 + * instruction available for other kernel modules. 121 + */ 122 + struct ap_queue_status ap_queue_irq_ctrl(ap_qid_t qid, 123 + struct ap_qirq_ctrl qirqctrl, 124 + void *ind); 125 + 126 + #endif /* _ASM_S390_AP_H_ */
+2 -5
arch/s390/include/asm/mmu.h
··· 5 5 #include <linux/errno.h> 6 6 7 7 typedef struct { 8 + spinlock_t lock; 8 9 cpumask_t cpu_attach_mask; 9 10 atomic_t flush_count; 10 11 unsigned int flush_mm; 11 - spinlock_t pgtable_lock; 12 12 struct list_head pgtable_list; 13 - spinlock_t gmap_lock; 14 13 struct list_head gmap_list; 15 14 unsigned long gmap_asce; 16 15 unsigned long asce; ··· 26 27 } mm_context_t; 27 28 28 29 #define INIT_MM_CONTEXT(name) \ 29 - .context.pgtable_lock = \ 30 - __SPIN_LOCK_UNLOCKED(name.context.pgtable_lock), \ 30 + .context.lock = __SPIN_LOCK_UNLOCKED(name.context.lock), \ 31 31 .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \ 32 - .context.gmap_lock = __SPIN_LOCK_UNLOCKED(name.context.gmap_lock), \ 33 32 .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list), 34 33 35 34 static inline int tprot(unsigned long addr)
+4 -6
arch/s390/include/asm/mmu_context.h
··· 17 17 static inline int init_new_context(struct task_struct *tsk, 18 18 struct mm_struct *mm) 19 19 { 20 - spin_lock_init(&mm->context.pgtable_lock); 20 + spin_lock_init(&mm->context.lock); 21 21 INIT_LIST_HEAD(&mm->context.pgtable_list); 22 - spin_lock_init(&mm->context.gmap_lock); 23 22 INIT_LIST_HEAD(&mm->context.gmap_list); 24 23 cpumask_clear(&mm->context.cpu_attach_mask); 25 24 atomic_set(&mm->context.flush_count, 0); ··· 102 103 if (prev == next) 103 104 return; 104 105 cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); 105 - cpumask_set_cpu(cpu, mm_cpumask(next)); 106 106 /* Clear old ASCE by loading the kernel ASCE. */ 107 107 __ctl_load(S390_lowcore.kernel_asce, 1, 1); 108 108 __ctl_load(S390_lowcore.kernel_asce, 7, 7); ··· 119 121 preempt_disable(); 120 122 while (atomic_read(&mm->context.flush_count)) 121 123 cpu_relax(); 122 - 123 - if (mm->context.flush_mm) 124 - __tlb_flush_mm(mm); 124 + cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); 125 + __tlb_flush_mm_lazy(mm); 125 126 preempt_enable(); 126 127 } 127 128 set_fs(current->thread.mm_segment); ··· 133 136 struct mm_struct *next) 134 137 { 135 138 switch_mm(prev, next, current); 139 + cpumask_set_cpu(smp_processor_id(), mm_cpumask(next)); 136 140 set_user_asce(next); 137 141 } 138 142
+8 -22
arch/s390/include/asm/tlbflush.h
··· 48 48 * Flush TLB entries for a specific mm on all CPUs (in case gmap is used 49 49 * this implicates multiple ASCEs!). 50 50 */ 51 - static inline void __tlb_flush_full(struct mm_struct *mm) 52 - { 53 - preempt_disable(); 54 - atomic_inc(&mm->context.flush_count); 55 - if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id()))) { 56 - /* Local TLB flush */ 57 - __tlb_flush_local(); 58 - } else { 59 - /* Global TLB flush */ 60 - __tlb_flush_global(); 61 - /* Reset TLB flush mask */ 62 - cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask); 63 - } 64 - atomic_dec(&mm->context.flush_count); 65 - preempt_enable(); 66 - } 67 - 68 51 static inline void __tlb_flush_mm(struct mm_struct *mm) 69 52 { 70 53 unsigned long gmap_asce; ··· 59 76 */ 60 77 preempt_disable(); 61 78 atomic_inc(&mm->context.flush_count); 79 + /* Reset TLB flush mask */ 80 + cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask); 81 + barrier(); 62 82 gmap_asce = READ_ONCE(mm->context.gmap_asce); 63 83 if (MACHINE_HAS_IDTE && gmap_asce != -1UL) { 64 84 if (gmap_asce) 65 85 __tlb_flush_idte(gmap_asce); 66 86 __tlb_flush_idte(mm->context.asce); 67 87 } else { 68 - __tlb_flush_full(mm); 88 + /* Global TLB flush */ 89 + __tlb_flush_global(); 69 90 } 70 - /* Reset TLB flush mask */ 71 - cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask); 72 91 atomic_dec(&mm->context.flush_count); 73 92 preempt_enable(); 74 93 } ··· 84 99 } 85 100 #else 86 101 #define __tlb_flush_global() __tlb_flush_local() 87 - #define __tlb_flush_full(mm) __tlb_flush_local() 88 102 89 103 /* 90 104 * Flush TLB entries for a specific ASCE on all CPUs. ··· 101 117 102 118 static inline void __tlb_flush_mm_lazy(struct mm_struct * mm) 103 119 { 120 + spin_lock(&mm->context.lock); 104 121 if (mm->context.flush_mm) { 105 - __tlb_flush_mm(mm); 106 122 mm->context.flush_mm = 0; 123 + __tlb_flush_mm(mm); 107 124 } 125 + spin_unlock(&mm->context.lock); 108 126 } 109 127 110 128 /*
+4 -4
arch/s390/mm/gmap.c
··· 100 100 if (!gmap) 101 101 return NULL; 102 102 gmap->mm = mm; 103 - spin_lock(&mm->context.gmap_lock); 103 + spin_lock(&mm->context.lock); 104 104 list_add_rcu(&gmap->list, &mm->context.gmap_list); 105 105 if (list_is_singular(&mm->context.gmap_list)) 106 106 gmap_asce = gmap->asce; 107 107 else 108 108 gmap_asce = -1UL; 109 109 WRITE_ONCE(mm->context.gmap_asce, gmap_asce); 110 - spin_unlock(&mm->context.gmap_lock); 110 + spin_unlock(&mm->context.lock); 111 111 return gmap; 112 112 } 113 113 EXPORT_SYMBOL_GPL(gmap_create); ··· 248 248 spin_unlock(&gmap->shadow_lock); 249 249 } 250 250 /* Remove gmap from the pre-mm list */ 251 - spin_lock(&gmap->mm->context.gmap_lock); 251 + spin_lock(&gmap->mm->context.lock); 252 252 list_del_rcu(&gmap->list); 253 253 if (list_empty(&gmap->mm->context.gmap_list)) 254 254 gmap_asce = 0; ··· 258 258 else 259 259 gmap_asce = -1UL; 260 260 WRITE_ONCE(gmap->mm->context.gmap_asce, gmap_asce); 261 - spin_unlock(&gmap->mm->context.gmap_lock); 261 + spin_unlock(&gmap->mm->context.lock); 262 262 synchronize_rcu(); 263 263 /* Put reference */ 264 264 gmap_put(gmap);
+10 -10
arch/s390/mm/pgalloc.c
··· 83 83 int rc, notify; 84 84 85 85 /* upgrade should only happen from 3 to 4, 3 to 5, or 4 to 5 levels */ 86 - BUG_ON(mm->context.asce_limit < _REGION2_SIZE); 86 + VM_BUG_ON(mm->context.asce_limit < _REGION2_SIZE); 87 87 if (end >= TASK_SIZE_MAX) 88 88 return -ENOMEM; 89 89 rc = 0; ··· 124 124 pgd_t *pgd; 125 125 126 126 /* downgrade should only happen from 3 to 2 levels (compat only) */ 127 - BUG_ON(mm->context.asce_limit != _REGION2_SIZE); 127 + VM_BUG_ON(mm->context.asce_limit != _REGION2_SIZE); 128 128 129 129 if (current->active_mm == mm) { 130 130 clear_user_asce(); ··· 188 188 /* Try to get a fragment of a 4K page as a 2K page table */ 189 189 if (!mm_alloc_pgste(mm)) { 190 190 table = NULL; 191 - spin_lock_bh(&mm->context.pgtable_lock); 191 + spin_lock_bh(&mm->context.lock); 192 192 if (!list_empty(&mm->context.pgtable_list)) { 193 193 page = list_first_entry(&mm->context.pgtable_list, 194 194 struct page, lru); ··· 203 203 list_del(&page->lru); 204 204 } 205 205 } 206 - spin_unlock_bh(&mm->context.pgtable_lock); 206 + spin_unlock_bh(&mm->context.lock); 207 207 if (table) 208 208 return table; 209 209 } ··· 227 227 /* Return the first 2K fragment of the page */ 228 228 atomic_set(&page->_mapcount, 1); 229 229 clear_table(table, _PAGE_INVALID, PAGE_SIZE); 230 - spin_lock_bh(&mm->context.pgtable_lock); 230 + spin_lock_bh(&mm->context.lock); 231 231 list_add(&page->lru, &mm->context.pgtable_list); 232 - spin_unlock_bh(&mm->context.pgtable_lock); 232 + spin_unlock_bh(&mm->context.lock); 233 233 } 234 234 return table; 235 235 } ··· 243 243 if (!mm_alloc_pgste(mm)) { 244 244 /* Free 2K page table fragment of a 4K page */ 245 245 bit = (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); 246 - spin_lock_bh(&mm->context.pgtable_lock); 246 + spin_lock_bh(&mm->context.lock); 247 247 mask = atomic_xor_bits(&page->_mapcount, 1U << bit); 248 248 if (mask & 3) 249 249 list_add(&page->lru, &mm->context.pgtable_list); 250 250 else 251 251 list_del(&page->lru); 252 - spin_unlock_bh(&mm->context.pgtable_lock); 252 + spin_unlock_bh(&mm->context.lock); 253 253 if (mask != 0) 254 254 return; 255 255 } ··· 275 275 return; 276 276 } 277 277 bit = (__pa(table) & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); 278 - spin_lock_bh(&mm->context.pgtable_lock); 278 + spin_lock_bh(&mm->context.lock); 279 279 mask = atomic_xor_bits(&page->_mapcount, 0x11U << bit); 280 280 if (mask & 3) 281 281 list_add_tail(&page->lru, &mm->context.pgtable_list); 282 282 else 283 283 list_del(&page->lru); 284 - spin_unlock_bh(&mm->context.pgtable_lock); 284 + spin_unlock_bh(&mm->context.lock); 285 285 table = (unsigned long *) (__pa(table) | (1U << bit)); 286 286 tlb_remove_table(tlb, table); 287 287 }
+174 -157
drivers/s390/block/dasd.c
··· 62 62 static int dasd_alloc_queue(struct dasd_block *); 63 63 static void dasd_setup_queue(struct dasd_block *); 64 64 static void dasd_free_queue(struct dasd_block *); 65 - static void dasd_flush_request_queue(struct dasd_block *); 66 65 static int dasd_flush_block_queue(struct dasd_block *); 67 66 static void dasd_device_tasklet(struct dasd_device *); 68 67 static void dasd_block_tasklet(struct dasd_block *); ··· 157 158 /* open_count = 0 means device online but not in use */ 158 159 atomic_set(&block->open_count, -1); 159 160 160 - spin_lock_init(&block->request_queue_lock); 161 161 atomic_set(&block->tasklet_scheduled, 0); 162 162 tasklet_init(&block->tasklet, 163 163 (void (*)(unsigned long)) dasd_block_tasklet, ··· 389 391 device->state = DASD_STATE_READY; 390 392 return rc; 391 393 } 392 - dasd_flush_request_queue(block); 393 394 dasd_destroy_partitions(block); 394 395 block->blocks = 0; 395 396 block->bp_block = 0; ··· 1642 1645 1643 1646 dasd_device_remove_stop_bits(device, DASD_STOPPED_PENDING); 1644 1647 dasd_schedule_device_bh(device); 1645 - if (device->block) 1648 + if (device->block) { 1646 1649 dasd_schedule_block_bh(device->block); 1650 + blk_mq_run_hw_queues(device->block->request_queue, true); 1651 + } 1647 1652 } 1648 1653 EXPORT_SYMBOL_GPL(dasd_generic_handle_state_change); 1649 1654 ··· 2637 2638 dasd_device_remove_stop_bits(block->base, DASD_STOPPED_PENDING); 2638 2639 spin_unlock_irqrestore(get_ccwdev_lock(block->base->cdev), flags); 2639 2640 dasd_schedule_block_bh(block); 2641 + blk_mq_run_hw_queues(block->request_queue, true); 2640 2642 } 2641 2643 2642 2644 /* ··· 2677 2677 erp_fn(cqr); 2678 2678 } 2679 2679 2680 - /* 2681 - * Fetch requests from the block device queue. 2682 - */ 2683 - static void __dasd_process_request_queue(struct dasd_block *block) 2684 - { 2685 - struct request_queue *queue; 2686 - struct request *req; 2687 - struct dasd_ccw_req *cqr; 2688 - struct dasd_device *basedev; 2689 - unsigned long flags; 2690 - queue = block->request_queue; 2691 - basedev = block->base; 2692 - /* No queue ? Then there is nothing to do. */ 2693 - if (queue == NULL) 2694 - return; 2695 - 2696 - /* 2697 - * We requeue request from the block device queue to the ccw 2698 - * queue only in two states. In state DASD_STATE_READY the 2699 - * partition detection is done and we need to requeue requests 2700 - * for that. State DASD_STATE_ONLINE is normal block device 2701 - * operation. 2702 - */ 2703 - if (basedev->state < DASD_STATE_READY) { 2704 - while ((req = blk_fetch_request(block->request_queue))) 2705 - __blk_end_request_all(req, BLK_STS_IOERR); 2706 - return; 2707 - } 2708 - 2709 - /* 2710 - * if device is stopped do not fetch new requests 2711 - * except failfast is active which will let requests fail 2712 - * immediately in __dasd_block_start_head() 2713 - */ 2714 - if (basedev->stopped && !(basedev->features & DASD_FEATURE_FAILFAST)) 2715 - return; 2716 - 2717 - /* Now we try to fetch requests from the request queue */ 2718 - while ((req = blk_peek_request(queue))) { 2719 - if (basedev->features & DASD_FEATURE_READONLY && 2720 - rq_data_dir(req) == WRITE) { 2721 - DBF_DEV_EVENT(DBF_ERR, basedev, 2722 - "Rejecting write request %p", 2723 - req); 2724 - blk_start_request(req); 2725 - __blk_end_request_all(req, BLK_STS_IOERR); 2726 - continue; 2727 - } 2728 - if (test_bit(DASD_FLAG_ABORTALL, &basedev->flags) && 2729 - (basedev->features & DASD_FEATURE_FAILFAST || 2730 - blk_noretry_request(req))) { 2731 - DBF_DEV_EVENT(DBF_ERR, basedev, 2732 - "Rejecting failfast request %p", 2733 - req); 2734 - blk_start_request(req); 2735 - __blk_end_request_all(req, BLK_STS_TIMEOUT); 2736 - continue; 2737 - } 2738 - cqr = basedev->discipline->build_cp(basedev, block, req); 2739 - if (IS_ERR(cqr)) { 2740 - if (PTR_ERR(cqr) == -EBUSY) 2741 - break; /* normal end condition */ 2742 - if (PTR_ERR(cqr) == -ENOMEM) 2743 - break; /* terminate request queue loop */ 2744 - if (PTR_ERR(cqr) == -EAGAIN) { 2745 - /* 2746 - * The current request cannot be build right 2747 - * now, we have to try later. If this request 2748 - * is the head-of-queue we stop the device 2749 - * for 1/2 second. 2750 - */ 2751 - if (!list_empty(&block->ccw_queue)) 2752 - break; 2753 - spin_lock_irqsave( 2754 - get_ccwdev_lock(basedev->cdev), flags); 2755 - dasd_device_set_stop_bits(basedev, 2756 - DASD_STOPPED_PENDING); 2757 - spin_unlock_irqrestore( 2758 - get_ccwdev_lock(basedev->cdev), flags); 2759 - dasd_block_set_timer(block, HZ/2); 2760 - break; 2761 - } 2762 - DBF_DEV_EVENT(DBF_ERR, basedev, 2763 - "CCW creation failed (rc=%ld) " 2764 - "on request %p", 2765 - PTR_ERR(cqr), req); 2766 - blk_start_request(req); 2767 - __blk_end_request_all(req, BLK_STS_IOERR); 2768 - continue; 2769 - } 2770 - /* 2771 - * Note: callback is set to dasd_return_cqr_cb in 2772 - * __dasd_block_start_head to cover erp requests as well 2773 - */ 2774 - cqr->callback_data = (void *) req; 2775 - cqr->status = DASD_CQR_FILLED; 2776 - req->completion_data = cqr; 2777 - blk_start_request(req); 2778 - list_add_tail(&cqr->blocklist, &block->ccw_queue); 2779 - INIT_LIST_HEAD(&cqr->devlist); 2780 - dasd_profile_start(block, cqr, req); 2781 - } 2782 - } 2783 - 2784 2680 static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr) 2785 2681 { 2786 2682 struct request *req; 2787 - int status; 2788 2683 blk_status_t error = BLK_STS_OK; 2684 + int status; 2789 2685 2790 2686 req = (struct request *) cqr->callback_data; 2791 2687 dasd_profile_end(cqr->block, cqr, req); ··· 2705 2809 break; 2706 2810 } 2707 2811 } 2708 - __blk_end_request_all(req, error); 2812 + 2813 + /* 2814 + * We need to take care for ETIMEDOUT errors here since the 2815 + * complete callback does not get called in this case. 2816 + * Take care of all errors here and avoid additional code to 2817 + * transfer the error value to the complete callback. 2818 + */ 2819 + if (error) { 2820 + blk_mq_end_request(req, error); 2821 + blk_mq_run_hw_queues(req->q, true); 2822 + } else { 2823 + blk_mq_complete_request(req); 2824 + } 2709 2825 } 2710 2826 2711 2827 /* ··· 2846 2938 struct list_head final_queue; 2847 2939 struct list_head *l, *n; 2848 2940 struct dasd_ccw_req *cqr; 2941 + struct dasd_queue *dq; 2849 2942 2850 2943 atomic_set(&block->tasklet_scheduled, 0); 2851 2944 INIT_LIST_HEAD(&final_queue); 2852 - spin_lock(&block->queue_lock); 2945 + spin_lock_irq(&block->queue_lock); 2853 2946 /* Finish off requests on ccw queue */ 2854 2947 __dasd_process_block_ccw_queue(block, &final_queue); 2855 - spin_unlock(&block->queue_lock); 2948 + spin_unlock_irq(&block->queue_lock); 2949 + 2856 2950 /* Now call the callback function of requests with final status */ 2857 - spin_lock_irq(&block->request_queue_lock); 2858 2951 list_for_each_safe(l, n, &final_queue) { 2859 2952 cqr = list_entry(l, struct dasd_ccw_req, blocklist); 2953 + dq = cqr->dq; 2954 + spin_lock_irq(&dq->lock); 2860 2955 list_del_init(&cqr->blocklist); 2861 2956 __dasd_cleanup_cqr(cqr); 2957 + spin_unlock_irq(&dq->lock); 2862 2958 } 2863 - spin_lock(&block->queue_lock); 2864 - /* Get new request from the block device request queue */ 2865 - __dasd_process_request_queue(block); 2959 + 2960 + spin_lock_irq(&block->queue_lock); 2866 2961 /* Now check if the head of the ccw queue needs to be started. */ 2867 2962 __dasd_block_start_head(block); 2868 - spin_unlock(&block->queue_lock); 2869 - spin_unlock_irq(&block->request_queue_lock); 2963 + spin_unlock_irq(&block->queue_lock); 2964 + 2870 2965 if (waitqueue_active(&shutdown_waitq)) 2871 2966 wake_up(&shutdown_waitq); 2872 2967 dasd_put_device(block->base); ··· 2888 2977 { 2889 2978 struct dasd_block *block = cqr->block; 2890 2979 struct request *req; 2891 - unsigned long flags; 2892 2980 2893 2981 if (!block) 2894 2982 return -EINVAL; 2895 - spin_lock_irqsave(&block->request_queue_lock, flags); 2983 + spin_lock_irq(&cqr->dq->lock); 2896 2984 req = (struct request *) cqr->callback_data; 2897 - blk_requeue_request(block->request_queue, req); 2898 - spin_unlock_irqrestore(&block->request_queue_lock, flags); 2985 + blk_mq_requeue_request(req, false); 2986 + spin_unlock_irq(&cqr->dq->lock); 2899 2987 2900 2988 return 0; 2901 2989 } ··· 2909 2999 struct dasd_ccw_req *cqr, *n; 2910 3000 int rc, i; 2911 3001 struct list_head flush_queue; 3002 + unsigned long flags; 2912 3003 2913 3004 INIT_LIST_HEAD(&flush_queue); 2914 3005 spin_lock_bh(&block->queue_lock); ··· 2948 3037 goto restart_cb; 2949 3038 } 2950 3039 /* call the callback function */ 2951 - spin_lock_irq(&block->request_queue_lock); 3040 + spin_lock_irqsave(&cqr->dq->lock, flags); 2952 3041 cqr->endclk = get_tod_clock(); 2953 3042 list_del_init(&cqr->blocklist); 2954 3043 __dasd_cleanup_cqr(cqr); 2955 - spin_unlock_irq(&block->request_queue_lock); 3044 + spin_unlock_irqrestore(&cqr->dq->lock, flags); 2956 3045 } 2957 3046 return rc; 2958 3047 } ··· 2980 3069 /* 2981 3070 * Dasd request queue function. Called from ll_rw_blk.c 2982 3071 */ 2983 - static void do_dasd_request(struct request_queue *queue) 3072 + static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx, 3073 + const struct blk_mq_queue_data *qd) 2984 3074 { 2985 - struct dasd_block *block; 3075 + struct dasd_block *block = hctx->queue->queuedata; 3076 + struct dasd_queue *dq = hctx->driver_data; 3077 + struct request *req = qd->rq; 3078 + struct dasd_device *basedev; 3079 + struct dasd_ccw_req *cqr; 3080 + blk_status_t rc = BLK_STS_OK; 2986 3081 2987 - block = queue->queuedata; 3082 + basedev = block->base; 3083 + spin_lock_irq(&dq->lock); 3084 + if (basedev->state < DASD_STATE_READY) { 3085 + DBF_DEV_EVENT(DBF_ERR, basedev, 3086 + "device not ready for request %p", req); 3087 + rc = BLK_STS_IOERR; 3088 + goto out; 3089 + } 3090 + 3091 + /* 3092 + * if device is stopped do not fetch new requests 3093 + * except failfast is active which will let requests fail 3094 + * immediately in __dasd_block_start_head() 3095 + */ 3096 + if (basedev->stopped && !(basedev->features & DASD_FEATURE_FAILFAST)) { 3097 + DBF_DEV_EVENT(DBF_ERR, basedev, 3098 + "device stopped request %p", req); 3099 + rc = BLK_STS_RESOURCE; 3100 + goto out; 3101 + } 3102 + 3103 + if (basedev->features & DASD_FEATURE_READONLY && 3104 + rq_data_dir(req) == WRITE) { 3105 + DBF_DEV_EVENT(DBF_ERR, basedev, 3106 + "Rejecting write request %p", req); 3107 + rc = BLK_STS_IOERR; 3108 + goto out; 3109 + } 3110 + 3111 + if (test_bit(DASD_FLAG_ABORTALL, &basedev->flags) && 3112 + (basedev->features & DASD_FEATURE_FAILFAST || 3113 + blk_noretry_request(req))) { 3114 + DBF_DEV_EVENT(DBF_ERR, basedev, 3115 + "Rejecting failfast request %p", req); 3116 + rc = BLK_STS_IOERR; 3117 + goto out; 3118 + } 3119 + 3120 + cqr = basedev->discipline->build_cp(basedev, block, req); 3121 + if (IS_ERR(cqr)) { 3122 + if (PTR_ERR(cqr) == -EBUSY || 3123 + PTR_ERR(cqr) == -ENOMEM || 3124 + PTR_ERR(cqr) == -EAGAIN) { 3125 + rc = BLK_STS_RESOURCE; 3126 + goto out; 3127 + } 3128 + DBF_DEV_EVENT(DBF_ERR, basedev, 3129 + "CCW creation failed (rc=%ld) on request %p", 3130 + PTR_ERR(cqr), req); 3131 + rc = BLK_STS_IOERR; 3132 + goto out; 3133 + } 3134 + /* 3135 + * Note: callback is set to dasd_return_cqr_cb in 3136 + * __dasd_block_start_head to cover erp requests as well 3137 + */ 3138 + cqr->callback_data = req; 3139 + cqr->status = DASD_CQR_FILLED; 3140 + cqr->dq = dq; 3141 + req->completion_data = cqr; 3142 + blk_mq_start_request(req); 2988 3143 spin_lock(&block->queue_lock); 2989 - /* Get new request from the block device request queue */ 2990 - __dasd_process_request_queue(block); 2991 - /* Now check if the head of the ccw queue needs to be started. */ 2992 - __dasd_block_start_head(block); 3144 + list_add_tail(&cqr->blocklist, &block->ccw_queue); 3145 + INIT_LIST_HEAD(&cqr->devlist); 3146 + dasd_profile_start(block, cqr, req); 3147 + dasd_schedule_block_bh(block); 2993 3148 spin_unlock(&block->queue_lock); 3149 + 3150 + out: 3151 + spin_unlock_irq(&dq->lock); 3152 + return rc; 2994 3153 } 2995 3154 2996 3155 /* 2997 3156 * Block timeout callback, called from the block layer 2998 - * 2999 - * request_queue lock is held on entry. 3000 3157 * 3001 3158 * Return values: 3002 3159 * BLK_EH_RESET_TIMER if the request should be left running 3003 3160 * BLK_EH_NOT_HANDLED if the request is handled or terminated 3004 3161 * by the driver. 3005 3162 */ 3006 - enum blk_eh_timer_return dasd_times_out(struct request *req) 3163 + enum blk_eh_timer_return dasd_times_out(struct request *req, bool reserved) 3007 3164 { 3008 3165 struct dasd_ccw_req *cqr = req->completion_data; 3009 3166 struct dasd_block *block = req->q->queuedata; 3010 3167 struct dasd_device *device; 3168 + unsigned long flags; 3011 3169 int rc = 0; 3012 3170 3013 3171 if (!cqr) 3014 3172 return BLK_EH_NOT_HANDLED; 3015 3173 3174 + spin_lock_irqsave(&cqr->dq->lock, flags); 3016 3175 device = cqr->startdev ? cqr->startdev : block->base; 3017 - if (!device->blk_timeout) 3176 + if (!device->blk_timeout) { 3177 + spin_unlock_irqrestore(&cqr->dq->lock, flags); 3018 3178 return BLK_EH_RESET_TIMER; 3179 + } 3019 3180 DBF_DEV_EVENT(DBF_WARNING, device, 3020 3181 " dasd_times_out cqr %p status %x", 3021 3182 cqr, cqr->status); ··· 3137 3154 } 3138 3155 dasd_schedule_block_bh(block); 3139 3156 spin_unlock(&block->queue_lock); 3157 + spin_unlock_irqrestore(&cqr->dq->lock, flags); 3140 3158 3141 3159 return rc ? BLK_EH_RESET_TIMER : BLK_EH_NOT_HANDLED; 3142 3160 } 3161 + 3162 + static int dasd_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, 3163 + unsigned int idx) 3164 + { 3165 + struct dasd_queue *dq = kzalloc(sizeof(*dq), GFP_KERNEL); 3166 + 3167 + if (!dq) 3168 + return -ENOMEM; 3169 + 3170 + spin_lock_init(&dq->lock); 3171 + hctx->driver_data = dq; 3172 + 3173 + return 0; 3174 + } 3175 + 3176 + static void dasd_exit_hctx(struct blk_mq_hw_ctx *hctx, unsigned int idx) 3177 + { 3178 + kfree(hctx->driver_data); 3179 + hctx->driver_data = NULL; 3180 + } 3181 + 3182 + static void dasd_request_done(struct request *req) 3183 + { 3184 + blk_mq_end_request(req, 0); 3185 + blk_mq_run_hw_queues(req->q, true); 3186 + } 3187 + 3188 + static struct blk_mq_ops dasd_mq_ops = { 3189 + .queue_rq = do_dasd_request, 3190 + .complete = dasd_request_done, 3191 + .timeout = dasd_times_out, 3192 + .init_hctx = dasd_init_hctx, 3193 + .exit_hctx = dasd_exit_hctx, 3194 + }; 3143 3195 3144 3196 /* 3145 3197 * Allocate and initialize request queue and default I/O scheduler. 3146 3198 */ 3147 3199 static int dasd_alloc_queue(struct dasd_block *block) 3148 3200 { 3149 - block->request_queue = blk_init_queue(do_dasd_request, 3150 - &block->request_queue_lock); 3151 - if (block->request_queue == NULL) 3152 - return -ENOMEM; 3201 + int rc; 3202 + 3203 + block->tag_set.ops = &dasd_mq_ops; 3204 + block->tag_set.nr_hw_queues = DASD_NR_HW_QUEUES; 3205 + block->tag_set.queue_depth = DASD_MAX_LCU_DEV * DASD_REQ_PER_DEV; 3206 + block->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; 3207 + 3208 + rc = blk_mq_alloc_tag_set(&block->tag_set); 3209 + if (rc) 3210 + return rc; 3211 + 3212 + block->request_queue = blk_mq_init_queue(&block->tag_set); 3213 + if (IS_ERR(block->request_queue)) 3214 + return PTR_ERR(block->request_queue); 3153 3215 3154 3216 block->request_queue->queuedata = block; 3155 3217 ··· 3257 3229 { 3258 3230 if (block->request_queue) { 3259 3231 blk_cleanup_queue(block->request_queue); 3232 + blk_mq_free_tag_set(&block->tag_set); 3260 3233 block->request_queue = NULL; 3261 3234 } 3262 - } 3263 - 3264 - /* 3265 - * Flush request on the request queue. 3266 - */ 3267 - static void dasd_flush_request_queue(struct dasd_block *block) 3268 - { 3269 - struct request *req; 3270 - 3271 - if (!block->request_queue) 3272 - return; 3273 - 3274 - spin_lock_irq(&block->request_queue_lock); 3275 - while ((req = blk_fetch_request(block->request_queue))) 3276 - __blk_end_request_all(req, BLK_STS_IOERR); 3277 - spin_unlock_irq(&block->request_queue_lock); 3278 3235 } 3279 3236 3280 3237 static int dasd_open(struct block_device *bdev, fmode_t mode) ··· 3757 3744 return 1; 3758 3745 } 3759 3746 dasd_schedule_device_bh(device); 3760 - if (device->block) 3747 + if (device->block) { 3761 3748 dasd_schedule_block_bh(device->block); 3749 + blk_mq_run_hw_queues(device->block->request_queue, true); 3750 + } 3762 3751 3763 3752 if (!device->stopped) 3764 3753 wake_up(&generic_waitq); ··· 4023 4008 */ 4024 4009 device->stopped |= DASD_UNRESUMED_PM; 4025 4010 4026 - if (device->block) 4011 + if (device->block) { 4027 4012 dasd_schedule_block_bh(device->block); 4013 + blk_mq_run_hw_queues(device->block->request_queue, true); 4014 + } 4028 4015 4029 4016 clear_bit(DASD_FLAG_SUSPENDED, &device->flags); 4030 4017 dasd_put_device(device);
+1 -7
drivers/s390/block/dasd_devmap.c
··· 1326 1326 { 1327 1327 struct dasd_device *device; 1328 1328 struct request_queue *q; 1329 - unsigned long val, flags; 1329 + unsigned long val; 1330 1330 1331 1331 device = dasd_device_from_cdev(to_ccwdev(dev)); 1332 1332 if (IS_ERR(device) || !device->block) ··· 1342 1342 dasd_put_device(device); 1343 1343 return -ENODEV; 1344 1344 } 1345 - spin_lock_irqsave(&device->block->request_queue_lock, flags); 1346 - if (!val) 1347 - blk_queue_rq_timed_out(q, NULL); 1348 - else 1349 - blk_queue_rq_timed_out(q, dasd_times_out); 1350 1345 1351 1346 device->blk_timeout = val; 1352 1347 1353 1348 blk_queue_rq_timeout(q, device->blk_timeout * HZ); 1354 - spin_unlock_irqrestore(&device->block->request_queue_lock, flags); 1355 1349 1356 1350 dasd_put_device(device); 1357 1351 return count;
+18 -1
drivers/s390/block/dasd_int.h
··· 56 56 #include <asm/dasd.h> 57 57 #include <asm/idals.h> 58 58 #include <linux/bitops.h> 59 + #include <linux/blk-mq.h> 59 60 60 61 /* DASD discipline magic */ 61 62 #define DASD_ECKD_MAGIC 0xC5C3D2C4 ··· 186 185 char status; /* status of this request */ 187 186 short retries; /* A retry counter */ 188 187 unsigned long flags; /* flags of this request */ 188 + struct dasd_queue *dq; 189 189 190 190 /* ... and how */ 191 191 unsigned long starttime; /* jiffies time of request start */ ··· 249 247 #define DASD_CQR_SUPPRESS_FP 5 /* Suppress 'File Protected' error*/ 250 248 #define DASD_CQR_SUPPRESS_IL 6 /* Suppress 'Incorrect Length' error */ 251 249 #define DASD_CQR_SUPPRESS_CR 7 /* Suppress 'Command Reject' error */ 250 + 251 + /* 252 + * There is no reliable way to determine the number of available CPUs on 253 + * LPAR but there is no big performance difference between 1 and the 254 + * maximum CPU number. 255 + * 64 is a good trade off performance wise. 256 + */ 257 + #define DASD_NR_HW_QUEUES 64 258 + #define DASD_MAX_LCU_DEV 256 259 + #define DASD_REQ_PER_DEV 4 252 260 253 261 /* Signature for error recovery functions. */ 254 262 typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *); ··· 551 539 struct gendisk *gdp; 552 540 struct request_queue *request_queue; 553 541 spinlock_t request_queue_lock; 542 + struct blk_mq_tag_set tag_set; 554 543 struct block_device *bdev; 555 544 atomic_t open_count; 556 545 ··· 574 561 struct dasd_attention_data { 575 562 struct dasd_device *device; 576 563 __u8 lpum; 564 + }; 565 + 566 + struct dasd_queue { 567 + spinlock_t lock; 577 568 }; 578 569 579 570 /* reasons why device (ccw_device_start) was stopped */ ··· 748 731 struct dasd_block *dasd_alloc_block(void); 749 732 void dasd_free_block(struct dasd_block *); 750 733 751 - enum blk_eh_timer_return dasd_times_out(struct request *req); 734 + enum blk_eh_timer_return dasd_times_out(struct request *req, bool reserved); 752 735 753 736 void dasd_enable_device(struct dasd_device *); 754 737 void dasd_set_target_state(struct dasd_device *, int);
+6 -3
drivers/s390/crypto/ap_asm.h
··· 69 69 } 70 70 71 71 /** 72 - * ap_aqic(): Enable interruption for a specific AP. 72 + * ap_aqic(): Control interruption for a specific AP. 73 73 * @qid: The AP queue number 74 + * @qirqctrl: struct ap_qirq_ctrl (64 bit value) 74 75 * @ind: The notification indicator byte 75 76 * 76 77 * Returns AP queue status. 77 78 */ 78 - static inline struct ap_queue_status ap_aqic(ap_qid_t qid, void *ind) 79 + static inline struct ap_queue_status ap_aqic(ap_qid_t qid, 80 + struct ap_qirq_ctrl qirqctrl, 81 + void *ind) 79 82 { 80 83 register unsigned long reg0 asm ("0") = qid | (3UL << 24); 81 - register unsigned long reg1_in asm ("1") = (8UL << 44) | AP_ISC; 84 + register struct ap_qirq_ctrl reg1_in asm ("1") = qirqctrl; 82 85 register struct ap_queue_status reg1_out asm ("1"); 83 86 register void *reg2 asm ("2") = ind; 84 87
+38 -11
drivers/s390/crypto/ap_bus.c
··· 166 166 } 167 167 168 168 /** 169 + * ap_apft_available(): Test if AP facilities test (APFT) 170 + * facility is available. 171 + * 172 + * Returns 1 if APFT is is available. 173 + */ 174 + static int ap_apft_available(void) 175 + { 176 + return test_facility(15); 177 + } 178 + 179 + /** 169 180 * ap_test_queue(): Test adjunct processor queue. 170 181 * @qid: The AP queue number 182 + * @tbit: Test facilities bit 171 183 * @info: Pointer to queue descriptor 172 184 * 173 185 * Returns AP queue status structure. 174 186 */ 175 - static inline struct ap_queue_status 176 - ap_test_queue(ap_qid_t qid, unsigned long *info) 187 + struct ap_queue_status ap_test_queue(ap_qid_t qid, 188 + int tbit, 189 + unsigned long *info) 177 190 { 178 - if (test_facility(15)) 179 - qid |= 1UL << 23; /* set APFT T bit*/ 191 + if (tbit) 192 + qid |= 1UL << 23; /* set T bit*/ 180 193 return ap_tapq(qid, info); 181 194 } 195 + EXPORT_SYMBOL(ap_test_queue); 182 196 183 - static inline int ap_query_configuration(void) 197 + /* 198 + * ap_query_configuration(): Fetch cryptographic config info 199 + * 200 + * Returns the ap configuration info fetched via PQAP(QCI). 201 + * On success 0 is returned, on failure a negative errno 202 + * is returned, e.g. if the PQAP(QCI) instruction is not 203 + * available, the return value will be -EOPNOTSUPP. 204 + */ 205 + int ap_query_configuration(struct ap_config_info *info) 184 206 { 185 - if (!ap_configuration) 207 + if (!ap_configuration_available()) 186 208 return -EOPNOTSUPP; 187 - return ap_qci(ap_configuration); 209 + if (!info) 210 + return -EINVAL; 211 + return ap_qci(info); 188 212 } 213 + EXPORT_SYMBOL(ap_query_configuration); 189 214 190 215 /** 191 216 * ap_init_configuration(): Allocate and query configuration array. ··· 223 198 ap_configuration = kzalloc(sizeof(*ap_configuration), GFP_KERNEL); 224 199 if (!ap_configuration) 225 200 return; 226 - if (ap_query_configuration() != 0) { 201 + if (ap_query_configuration(ap_configuration) != 0) { 227 202 kfree(ap_configuration); 228 203 ap_configuration = NULL; 229 204 return; ··· 286 261 if (!ap_test_config_card_id(AP_QID_CARD(qid))) 287 262 return -ENODEV; 288 263 289 - status = ap_test_queue(qid, &info); 264 + status = ap_test_queue(qid, ap_apft_available(), &info); 290 265 switch (status.response_code) { 291 266 case AP_RESPONSE_NORMAL: 292 267 *queue_depth = (int)(info & 0xff); ··· 965 940 for (j = 0; j < AP_DEVICES; j++) { 966 941 if (!ap_test_config_card_id(j)) 967 942 continue; 968 - status = ap_test_queue(AP_MKQID(j, i), NULL); 943 + status = ap_test_queue(AP_MKQID(j, i), 944 + ap_apft_available(), 945 + NULL); 969 946 if (status.response_code != AP_RESPONSE_NORMAL) 970 947 continue; 971 948 count++; ··· 1020 993 1021 994 AP_DBF(DBF_DEBUG, "ap_scan_bus running\n"); 1022 995 1023 - ap_query_configuration(); 996 + ap_query_configuration(ap_configuration); 1024 997 if (ap_select_domain() != 0) 1025 998 goto out; 1026 999
+1 -46
drivers/s390/crypto/ap_bus.h
··· 28 28 29 29 #include <linux/device.h> 30 30 #include <linux/types.h> 31 + #include <asm/ap.h> 31 32 32 33 #define AP_DEVICES 64 /* Number of AP devices. */ 33 34 #define AP_DOMAINS 256 /* Number of AP domains. */ ··· 40 39 41 40 extern spinlock_t ap_list_lock; 42 41 extern struct list_head ap_card_list; 43 - 44 - /** 45 - * The ap_qid_t identifier of an ap queue. It contains a 46 - * 6 bit card index and a 4 bit queue index (domain). 47 - */ 48 - typedef unsigned int ap_qid_t; 49 - 50 - #define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255)) 51 - #define AP_QID_CARD(_qid) (((_qid) >> 8) & 63) 52 - #define AP_QID_QUEUE(_qid) ((_qid) & 255) 53 - 54 - /** 55 - * structy ap_queue_status - Holds the AP queue status. 56 - * @queue_empty: Shows if queue is empty 57 - * @replies_waiting: Waiting replies 58 - * @queue_full: Is 1 if the queue is full 59 - * @pad: A 4 bit pad 60 - * @int_enabled: Shows if interrupts are enabled for the AP 61 - * @response_code: Holds the 8 bit response code 62 - * @pad2: A 16 bit pad 63 - * 64 - * The ap queue status word is returned by all three AP functions 65 - * (PQAP, NQAP and DQAP). There's a set of flags in the first 66 - * byte, followed by a 1 byte response code. 67 - */ 68 - struct ap_queue_status { 69 - unsigned int queue_empty : 1; 70 - unsigned int replies_waiting : 1; 71 - unsigned int queue_full : 1; 72 - unsigned int pad1 : 4; 73 - unsigned int int_enabled : 1; 74 - unsigned int response_code : 8; 75 - unsigned int pad2 : 16; 76 - } __packed; 77 - 78 42 79 43 static inline int ap_test_bit(unsigned int *ptr, unsigned int nr) 80 44 { ··· 203 237 void (*receive)(struct ap_queue *, struct ap_message *, 204 238 struct ap_message *); 205 239 }; 206 - 207 - struct ap_config_info { 208 - unsigned int special_command:1; 209 - unsigned int ap_extended:1; 210 - unsigned char reserved1:6; 211 - unsigned char reserved2[15]; 212 - unsigned int apm[8]; /* AP ID mask */ 213 - unsigned int aqm[8]; /* AP queue mask */ 214 - unsigned int adm[8]; /* AP domain mask */ 215 - unsigned char reserved4[16]; 216 - } __packed; 217 240 218 241 /** 219 242 * ap_init_message() - Initialize ap_message.
+24 -2
drivers/s390/crypto/ap_queue.c
··· 16 16 #include "ap_asm.h" 17 17 18 18 /** 19 + * ap_queue_irq_ctrl(): Control interruption on a AP queue. 20 + * @qirqctrl: struct ap_qirq_ctrl (64 bit value) 21 + * @ind: The notification indicator byte 22 + * 23 + * Returns AP queue status. 24 + * 25 + * Control interruption on the given AP queue. 26 + * Just a simple wrapper function for the low level PQAP(AQIC) 27 + * instruction available for other kernel modules. 28 + */ 29 + struct ap_queue_status ap_queue_irq_ctrl(ap_qid_t qid, 30 + struct ap_qirq_ctrl qirqctrl, 31 + void *ind) 32 + { 33 + return ap_aqic(qid, qirqctrl, ind); 34 + } 35 + EXPORT_SYMBOL(ap_queue_irq_ctrl); 36 + 37 + /** 19 38 * ap_queue_enable_interruption(): Enable interruption on an AP queue. 20 39 * @qid: The AP queue number 21 40 * @ind: the notification indicator byte ··· 46 27 static int ap_queue_enable_interruption(struct ap_queue *aq, void *ind) 47 28 { 48 29 struct ap_queue_status status; 30 + struct ap_qirq_ctrl qirqctrl = { 0 }; 49 31 50 - status = ap_aqic(aq->qid, ind); 32 + qirqctrl.ir = 1; 33 + qirqctrl.isc = AP_ISC; 34 + status = ap_aqic(aq->qid, qirqctrl, ind); 51 35 switch (status.response_code) { 52 36 case AP_RESPONSE_NORMAL: 53 37 case AP_RESPONSE_OTHERWISE_CHANGED: ··· 384 362 /* Get the status with TAPQ */ 385 363 status = ap_tapq(aq->qid, NULL); 386 364 387 - if (status.int_enabled == 1) { 365 + if (status.irq_enabled == 1) { 388 366 /* Irqs are now enabled */ 389 367 aq->interrupt = AP_INTR_ENABLED; 390 368 aq->state = (aq->queue_count > 0) ?