public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>, kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, david@redhat.com, cohuck@redhat.com,
	imbrenda@linux.ibm.com, drjones@redhat.com
Subject: Re: [kvm-unit-tests PATCH 4/7] s390x: css: registering IRQ
Date: Mon, 8 Nov 2021 13:36:18 +0100	[thread overview]
Message-ID: <1abcdea2-c9d1-c4e0-6f53-c806e80403a9@linux.ibm.com> (raw)
In-Reply-To: <8aee772e-cb44-4d3d-16bd-186b90257407@redhat.com>



On 11/3/21 09:01, Thomas Huth wrote:
> On 27/08/2021 12.17, Pierre Morel wrote:
>> Registering IRQ for the CSS level.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   lib/s390x/css.h     | 21 +++++++++++++++++++++
>>   lib/s390x/css_lib.c | 27 +++++++++++++++++++++++++--
>>   2 files changed, 46 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
>> index 2005f4d7..0422f2e7 100644
>> --- a/lib/s390x/css.h
>> +++ b/lib/s390x/css.h
>> @@ -402,4 +402,25 @@ struct measurement_block_format1 {
>>       uint32_t irq_prio_delay_time;
>>   };
>> +#include <asm/arch_def.h>
>> +static inline void disable_io_irq(void)
>> +{
>> +    uint64_t mask;
>> +
>> +    mask = extract_psw_mask();
>> +    mask &= ~PSW_MASK_IO;
>> +    load_psw_mask(mask);
>> +}
>> +
>> +static inline void enable_io_irq(void)
>> +{
>> +    uint64_t mask;
>> +
>> +    mask = extract_psw_mask();
>> +    mask |= PSW_MASK_IO;
>> +    load_psw_mask(mask);
>> +}
>> +
>> +int register_css_irq_func(void (*f)(void));
>> +int unregister_css_irq_func(void (*f)(void));
>>   #endif
>> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
>> index 484f9c41..a89fc93c 100644
>> --- a/lib/s390x/css_lib.c
>> +++ b/lib/s390x/css_lib.c
>> @@ -350,8 +350,29 @@ bool css_disable_mb(int schid)
>>       return retry_count > 0;
>>   }
>> -static struct irb irb;
>> +static void (*css_irq_func)(void);
>> +
>> +int register_css_irq_func(void (*f)(void))
>> +{
>> +    if (css_irq_func)
>> +        return -1;
>> +    css_irq_func = f;
>> +    assert(register_io_int_func(css_irq_io) == 0);
> 
> It's unlikely that we ever disable assert() in the k-u-t, but anyway, 
> I'd prefer not to put function calls within assert() statements, just in 
> case. So could you please replace this with:
> 
>      rc = register_io_int_func(css_irq_io);
>      assert(rc == 0);
>  > ?

OK

> 
>> +    enable_io_isc(0x80 >> IO_SCH_ISC);
>> +    return 0;
>> +}
>> +int unregister_css_irq_func(void (*f)(void))
>> +{
>> +    if (css_irq_func != f)
>> +        return -1;
>> +    enable_io_isc(0);
>> +    unregister_io_int_func(css_irq_io);
>> +    css_irq_func = NULL;
>> +    return 0;
>> +}
>> +
>> +static struct irb irb;
>>   void css_irq_io(void)
>>   {
>>       int ret = 0;
>> @@ -386,7 +407,9 @@ void css_irq_io(void)
>>           report(0, "tsch reporting sch %08x as not operational", sid);
>>           break;
>>       case 0:
>> -        /* Stay humble on success */
>> +        /* Call upper level IRQ routine */
>> +        if (css_irq_func)
>> +            css_irq_func();
>>           break;
>>       }
>>   pop:
>>
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 

Thanks,
Pierre


-- 
Pierre Morel
IBM Lab Boeblingen

  reply	other threads:[~2021-11-08 12:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 10:17 [kvm-unit-tests PATCH 0/7] Extending VIRTIO with a data transfer test Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 1/7] arm: virtio: move VIRTIO transport initialization inside virtio-mmio Pierre Morel
2021-11-03  7:00   ` Thomas Huth
2021-11-03  7:41     ` Andrew Jones
2021-11-08 12:20       ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 2/7] s390x: css: add callback for emnumeration Pierre Morel
2021-11-03  7:29   ` Thomas Huth
2021-11-08 12:21     ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 3/7] s390x: virtio: CCW transport implementation Pierre Morel
2021-11-03  7:46   ` Andrew Jones
2021-11-08 12:35     ` Pierre Morel
2021-11-03  7:49   ` Thomas Huth
2021-11-08 12:34     ` Pierre Morel
2021-11-09  7:01       ` Thomas Huth
2021-11-09  8:51         ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 4/7] s390x: css: registering IRQ Pierre Morel
2021-11-03  8:01   ` Thomas Huth
2021-11-08 12:36     ` Pierre Morel [this message]
2021-08-27 10:17 ` [kvm-unit-tests PATCH 5/7] virtio: implement the virtio_add_inbuf routine Pierre Morel
2021-11-03  7:51   ` Andrew Jones
2021-11-08 12:36     ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 6/7] s390x: virtio tests setup Pierre Morel
2021-11-03  7:56   ` Andrew Jones
2021-11-03  8:14     ` Thomas Huth
2021-11-08 13:00       ` Pierre Morel
2021-11-09  7:10         ` Thomas Huth
2021-11-09  8:42           ` Andrew Jones
2021-11-09  9:01             ` Pierre Morel
2021-11-08 12:53     ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 7/7] s390x: virtio data transfer Pierre Morel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1abcdea2-c9d1-c4e0-6f53-c806e80403a9@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=drjones@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox