[Qemu-devel] [PATCH 11/11] s390x/css: update css_adapter_interrupt

Christian Borntraeger posted 11 patches 8 years, 7 months ago
[Qemu-devel] [PATCH 11/11] s390x/css: update css_adapter_interrupt
Posted by Christian Borntraeger 8 years, 7 months ago
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>

Let's use the new inject_airq callback of flic to inject adapter
interrupts. For kvm case, if the kernel flic doesn't support the new
interface, the irq routine remains unchanged. For non-kvm case,
qemu-flic handles the suppression process.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 hw/s390x/css.c          | 18 ++++++++++++++++--
 hw/s390x/s390-pci-bus.c |  2 +-
 hw/s390x/virtio-ccw.c   |  2 +-
 include/hw/s390x/css.h  |  2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 7b82176..ee4ebbf 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -547,12 +547,26 @@ out:
     return r;
 }
 
-void css_adapter_interrupt(uint8_t isc)
+void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc)
 {
+    S390FLICState *fs = s390_get_flic();
+    S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs);
     uint32_t io_int_word = (isc << 27) | IO_INT_WORD_AI;
+    IoAdapter *adapter = channel_subsys.io_adapters[type][isc];
+
+    if (!adapter) {
+        return;
+    }
 
     trace_css_adapter_interrupt(isc);
-    s390_io_interrupt(0, 0, 0, io_int_word);
+    if (fs->ais_supported) {
+        if (fsc->inject_airq(fs, type, isc, adapter->flags)) {
+            fprintf(stderr, "Failed to inject airq with AIS supported\n");
+            exit(1);
+        }
+    } else {
+        s390_io_interrupt(0, 0, 0, io_int_word);
+    }
 }
 
 static void sch_handle_clear_func(SubchDev *sch)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index b9603e7..2de4435 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -504,7 +504,7 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
                    0x80 >> ((ind_bit + vec) % 8));
     if (!set_ind_atomic(pbdev->routes.adapter.summary_addr + sum_bit / 8,
                                        0x80 >> (sum_bit % 8))) {
-        css_adapter_interrupt(pbdev->isc);
+        css_adapter_interrupt(CSS_IO_ADAPTER_PCI, pbdev->isc);
     }
 }
 
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index e18fd26..5afd9bb 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -1074,7 +1074,7 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector)
                                   0x80 >> ((ind_bit + vector) % 8));
             if (!virtio_set_ind_atomic(sch, dev->summary_indicator->addr,
                                        0x01)) {
-                css_adapter_interrupt(dev->thinint_isc);
+                css_adapter_interrupt(CSS_IO_ADAPTER_VIRTIO, dev->thinint_isc);
             }
         } else {
             indicators = address_space_ldq(&address_space_memory,
diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index 5ee6d52..dd36d39 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -155,7 +155,6 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
 void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);
 void css_generate_css_crws(uint8_t cssid);
 void css_clear_sei_pending(void);
-void css_adapter_interrupt(uint8_t isc);
 int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data);
 int do_subchannel_work_virtual(SubchDev *sub, ORB *orb);
 int do_subchannel_work_passthrough(SubchDev *sub, ORB *orb);
@@ -166,6 +165,7 @@ typedef enum {
     CSS_IO_ADAPTER_TYPE_NUMS,
 } CssIoAdapterType;
 
+void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc);
 int css_do_sic(CPUS390XState *env, uint8_t isc, uint16_t mode);
 uint32_t css_get_adapter_id(CssIoAdapterType type, uint8_t isc);
 void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maskable,
-- 
2.7.4


Re: [Qemu-devel] [PATCH 11/11] s390x/css: update css_adapter_interrupt
Posted by Thomas Huth 8 years, 7 months ago
On 12.07.2017 14:57, Christian Borntraeger wrote:
> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> 
> Let's use the new inject_airq callback of flic to inject adapter
> interrupts. For kvm case, if the kernel flic doesn't support the new
> interface, the irq routine remains unchanged. For non-kvm case,
> qemu-flic handles the suppression process.
> 
> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  hw/s390x/css.c          | 18 ++++++++++++++++--
>  hw/s390x/s390-pci-bus.c |  2 +-
>  hw/s390x/virtio-ccw.c   |  2 +-
>  include/hw/s390x/css.h  |  2 +-
>  4 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
> index 7b82176..ee4ebbf 100644
> --- a/hw/s390x/css.c
> +++ b/hw/s390x/css.c
> @@ -547,12 +547,26 @@ out:
>      return r;
>  }
>  
> -void css_adapter_interrupt(uint8_t isc)
> +void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc)
>  {
> +    S390FLICState *fs = s390_get_flic();
> +    S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs);
>      uint32_t io_int_word = (isc << 27) | IO_INT_WORD_AI;
> +    IoAdapter *adapter = channel_subsys.io_adapters[type][isc];
> +
> +    if (!adapter) {
> +        return;
> +    }
>  
>      trace_css_adapter_interrupt(isc);
> -    s390_io_interrupt(0, 0, 0, io_int_word);
> +    if (fs->ais_supported) {
> +        if (fsc->inject_airq(fs, type, isc, adapter->flags)) {
> +            fprintf(stderr, "Failed to inject airq with AIS supported\n");

Use error_report() instead?

> +            exit(1);
> +        }
> +    } else {
> +        s390_io_interrupt(0, 0, 0, io_int_word);
> +    }
>  }

 Thomas

Re: [Qemu-devel] [PATCH 11/11] s390x/css: update css_adapter_interrupt
Posted by Christian Borntraeger 8 years, 7 months ago
On 07/12/2017 04:26 PM, Thomas Huth wrote:
> On 12.07.2017 14:57, Christian Borntraeger wrote:
>> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>>
>> Let's use the new inject_airq callback of flic to inject adapter
>> interrupts. For kvm case, if the kernel flic doesn't support the new
>> interface, the irq routine remains unchanged. For non-kvm case,
>> qemu-flic handles the suppression process.
>>
>> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>> Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  hw/s390x/css.c          | 18 ++++++++++++++++--
>>  hw/s390x/s390-pci-bus.c |  2 +-
>>  hw/s390x/virtio-ccw.c   |  2 +-
>>  include/hw/s390x/css.h  |  2 +-
>>  4 files changed, 19 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
>> index 7b82176..ee4ebbf 100644
>> --- a/hw/s390x/css.c
>> +++ b/hw/s390x/css.c
>> @@ -547,12 +547,26 @@ out:
>>      return r;
>>  }
>>  
>> -void css_adapter_interrupt(uint8_t isc)
>> +void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc)
>>  {
>> +    S390FLICState *fs = s390_get_flic();
>> +    S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs);
>>      uint32_t io_int_word = (isc << 27) | IO_INT_WORD_AI;
>> +    IoAdapter *adapter = channel_subsys.io_adapters[type][isc];
>> +
>> +    if (!adapter) {
>> +        return;
>> +    }
>>  
>>      trace_css_adapter_interrupt(isc);
>> -    s390_io_interrupt(0, 0, 0, io_int_word);
>> +    if (fs->ais_supported) {
>> +        if (fsc->inject_airq(fs, type, isc, adapter->flags)) {
>> +            fprintf(stderr, "Failed to inject airq with AIS supported\n");
> 
> Use error_report() instead?

something like this on top?

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 3d28caa..997815c 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -674,7 +674,7 @@ void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc)
     trace_css_adapter_interrupt(isc);
     if (fs->ais_supported) {
         if (fsc->inject_airq(fs, type, isc, adapter->flags)) {
-            fprintf(stderr, "Failed to inject airq with AIS supported\n");
+            error_report("Failed to inject airq with AIS supported");
             exit(1);
         }
     } else {



Re: [Qemu-devel] [PATCH 11/11] s390x/css: update css_adapter_interrupt
Posted by Thomas Huth 8 years, 7 months ago
On 13.07.2017 10:08, Christian Borntraeger wrote:
> On 07/12/2017 04:26 PM, Thomas Huth wrote:
>> On 12.07.2017 14:57, Christian Borntraeger wrote:
>>> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>>>
>>> Let's use the new inject_airq callback of flic to inject adapter
>>> interrupts. For kvm case, if the kernel flic doesn't support the new
>>> interface, the irq routine remains unchanged. For non-kvm case,
>>> qemu-flic handles the suppression process.
>>>
>>> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>>> Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>> ---
>>>  hw/s390x/css.c          | 18 ++++++++++++++++--
>>>  hw/s390x/s390-pci-bus.c |  2 +-
>>>  hw/s390x/virtio-ccw.c   |  2 +-
>>>  include/hw/s390x/css.h  |  2 +-
>>>  4 files changed, 19 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
>>> index 7b82176..ee4ebbf 100644
>>> --- a/hw/s390x/css.c
>>> +++ b/hw/s390x/css.c
>>> @@ -547,12 +547,26 @@ out:
>>>      return r;
>>>  }
>>>  
>>> -void css_adapter_interrupt(uint8_t isc)
>>> +void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc)
>>>  {
>>> +    S390FLICState *fs = s390_get_flic();
>>> +    S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs);
>>>      uint32_t io_int_word = (isc << 27) | IO_INT_WORD_AI;
>>> +    IoAdapter *adapter = channel_subsys.io_adapters[type][isc];
>>> +
>>> +    if (!adapter) {
>>> +        return;
>>> +    }
>>>  
>>>      trace_css_adapter_interrupt(isc);
>>> -    s390_io_interrupt(0, 0, 0, io_int_word);
>>> +    if (fs->ais_supported) {
>>> +        if (fsc->inject_airq(fs, type, isc, adapter->flags)) {
>>> +            fprintf(stderr, "Failed to inject airq with AIS supported\n");
>>
>> Use error_report() instead?
> 
> something like this on top?
> 
> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
> index 3d28caa..997815c 100644
> --- a/hw/s390x/css.c
> +++ b/hw/s390x/css.c
> @@ -674,7 +674,7 @@ void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc)
>      trace_css_adapter_interrupt(isc);
>      if (fs->ais_supported) {
>          if (fsc->inject_airq(fs, type, isc, adapter->flags)) {
> -            fprintf(stderr, "Failed to inject airq with AIS supported\n");
> +            error_report("Failed to inject airq with AIS supported");
>              exit(1);
>          }
>      } else {

Yes, that looks fine. Alternatively, this could maybe be a g_assert()
instead? ... but then you don't get the nice error message anymore, so I
think error_report + exit is OK here.

 Thomas

Re: [Qemu-devel] [PATCH 11/11] s390x/css: update css_adapter_interrupt
Posted by Cornelia Huck 8 years, 7 months ago
On Wed, 12 Jul 2017 14:57:45 +0200
Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> 
> Let's use the new inject_airq callback of flic to inject adapter
> interrupts. For kvm case, if the kernel flic doesn't support the new
> interface, the irq routine remains unchanged. For non-kvm case,
> qemu-flic handles the suppression process.
> 
> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  hw/s390x/css.c          | 18 ++++++++++++++++--
>  hw/s390x/s390-pci-bus.c |  2 +-
>  hw/s390x/virtio-ccw.c   |  2 +-
>  include/hw/s390x/css.h  |  2 +-
>  4 files changed, 19 insertions(+), 5 deletions(-)

With the error_report change:

Reviewed-by: Cornelia Huck <cohuck@redhat.com>