]> www.infradead.org Git - users/willy/xarray.git/commitdiff
s390/qdio: clarify handler logic for qdio_handle_activate_check()
authorJulian Wiedmann <jwi@linux.ibm.com>
Mon, 15 Nov 2021 07:28:08 +0000 (08:28 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 6 Dec 2021 13:42:25 +0000 (14:42 +0100)
qdio_handle_activate_check() tries to re-use one of the queue-specific
handlers to report that the ACTIVATE ccw has been terminated. But the
logic to select that handler is overly complex - in practice both
qdio drivers have at least one Input Queue, so we never take the other
paths.

Make things more obvious by removing this unused code, and clearly
spelling out that we re-use the Input Handler for generic error
reporting. This also paves the way for a world without queue-specific
error handlers.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/qdio.h
drivers/s390/cio/qdio.h
drivers/s390/cio/qdio_main.c
drivers/s390/cio/qdio_setup.c

index c5a5b454f8dcb92ef7d2aa2fd0d581ff3b82e58f..97356ec27d37754d14441b50adc82c11bb8e82a8 100644 (file)
@@ -312,7 +312,7 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
  * @qib_rflags: rflags to set
  * @no_input_qs: number of input queues
  * @no_output_qs: number of output queues
- * @input_handler: handler to be called for input queues
+ * @input_handler: handler to be called for input queues, and device-wide errors
  * @output_handler: handler to be called for output queues
  * @irq_poll: Data IRQ polling handler
  * @scan_threshold: # of in-use buffers that triggers scan on output queue
index 152c032e74d4fc5b9267187f03d7edb3a54fd49d..5ea6249d81803ad2358592f2e4c40cb167692828 100644 (file)
@@ -240,6 +240,7 @@ struct qdio_irq {
 
        struct qdio_ssqd_desc ssqd_desc;
        void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *);
+       qdio_handler_t (*error_handler);
 
        int perf_stat_enabled;
 
index 3e586e460f919b8416c44429a8779a47308a55b7..35a32240b4ce8c508423741c8afa3d09458502f8 100644 (file)
@@ -654,24 +654,18 @@ static void qdio_handle_activate_check(struct qdio_irq *irq_ptr,
                                       unsigned long intparm, int cstat,
                                       int dstat)
 {
-       struct qdio_q *q;
+       unsigned int first_to_check = 0;
 
        DBF_ERROR("%4x ACT CHECK", irq_ptr->schid.sch_no);
        DBF_ERROR("intp :%lx", intparm);
        DBF_ERROR("ds: %2x cs:%2x", dstat, cstat);
 
-       if (irq_ptr->nr_input_qs) {
-               q = irq_ptr->input_qs[0];
-       } else if (irq_ptr->nr_output_qs) {
-               q = irq_ptr->output_qs[0];
-       } else {
-               dump_stack();
-               goto no_handler;
-       }
+       /* zfcp wants this: */
+       if (irq_ptr->nr_input_qs)
+               first_to_check = irq_ptr->input_qs[0]->first_to_check;
 
-       q->handler(irq_ptr->cdev, QDIO_ERROR_ACTIVATE, 0, q->first_to_check,
-                  0, irq_ptr->int_parm);
-no_handler:
+       irq_ptr->error_handler(irq_ptr->cdev, QDIO_ERROR_ACTIVATE, 0,
+                              first_to_check, 0, irq_ptr->int_parm);
        qdio_set_state(irq_ptr, QDIO_IRQ_STATE_STOPPED);
        /*
         * In case of z/VM LGR (Live Guest Migration) QDIO recovery will happen.
@@ -996,8 +990,11 @@ int qdio_establish(struct ccw_device *cdev,
            init_data->no_output_qs > irq_ptr->max_output_qs)
                return -EINVAL;
 
-       if ((init_data->no_input_qs && !init_data->input_handler) ||
-           (init_data->no_output_qs && !init_data->output_handler))
+       /* Needed as error_handler: */
+       if (!init_data->input_handler)
+               return -EINVAL;
+
+       if (init_data->no_output_qs && !init_data->output_handler)
                return -EINVAL;
 
        if (!init_data->input_sbal_addr_array ||
index fd663922d7d59d5be315cdf831ac847fd36501e4..714878e2acc4d907f94a7f4c1f2384e1a131413e 100644 (file)
@@ -362,6 +362,7 @@ void qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data)
        irq_ptr->debugfs_dev = NULL;
        irq_ptr->sch_token = irq_ptr->perf_stat_enabled = 0;
        irq_ptr->state = QDIO_IRQ_STATE_INACTIVE;
+       irq_ptr->error_handler = init_data->input_handler;
 
        irq_ptr->int_parm = init_data->int_parm;
        irq_ptr->nr_input_qs = init_data->no_input_qs;