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

s390/zcrypt: externalize AP queue interrupt control

KVM has a need to control the interrupts on real and virtualized
AP queue devices. This fix provides a new function to control
the interrupt facilities of an AP queue device.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Harald Freudenberger and committed by
Martin Schwidefsky
46fde9a9 050349b5

+65 -4
+36
arch/s390/include/asm/ap.h
··· 87 87 */ 88 88 int ap_query_configuration(struct ap_config_info *info); 89 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 + 90 126 #endif /* _ASM_S390_AP_H_ */
+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
+23 -1
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: