public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, david@redhat.com,
	borntraeger@de.ibm.com, imbrenda@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH 1/5] s390x: Add test_bit to library
Date: Thu, 19 Nov 2020 09:32:29 +0100	[thread overview]
Message-ID: <b2ca7724-3390-fedc-4c4f-367ecbdea682@linux.ibm.com> (raw)
In-Reply-To: <6d61a28d-d822-b9b5-8ec6-1ea0dca1ed70@redhat.com>

On 11/19/20 9:26 AM, Thomas Huth wrote:
> On 17/11/2020 16.42, Janosch Frank wrote:
>> Query/feature bits are commonly tested via MSB bit numbers on
>> s390. Let's add test bit functions, so we don't need to copy code to
>> test query bits.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  lib/s390x/asm/bitops.h   | 16 ++++++++++++++++
>>  lib/s390x/asm/facility.h |  3 ++-
>>  2 files changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/s390x/asm/bitops.h b/lib/s390x/asm/bitops.h
>> index e7cdda9..a272dd7 100644
>> --- a/lib/s390x/asm/bitops.h
>> +++ b/lib/s390x/asm/bitops.h
>> @@ -7,4 +7,20 @@
>>  
>>  #define BITS_PER_LONG	64
>>  
>> +static inline bool test_bit(unsigned long nr,
>> +			    const volatile unsigned long *ptr)
>> +{
>> +	const volatile unsigned char *addr;
>> +
>> +	addr = ((const volatile unsigned char *)ptr);
>> +	addr += (nr ^ (BITS_PER_LONG - 8)) >> 3;
>> +	return (*addr >> (nr & 7)) & 1;
>> +}
>> +
>> +static inline bool test_bit_inv(unsigned long nr,
>> +				const volatile unsigned long *ptr)
>> +{
>> +	return test_bit(nr ^ (BITS_PER_LONG - 1), ptr);
>> +}
> 
> I think you should mention in the patch description that these functions
> match the implementations in the kernel (and thus are good for kernel
> developers who are used to these).

There are only so many ways one can write 4 lines of code :-)

> 
> Thus I think you should also now add a license statement to this file
> ("SPDX-License-Identifier: GPL-2.0" or so).

Definitely, thanks for reminding me

> 
> With these modifications:
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 

Thanks


  reply	other threads:[~2020-11-19  8:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 15:42 [kvm-unit-tests PATCH 0/5] s390x: Add SIE library and simple test Janosch Frank
2020-11-17 15:42 ` [kvm-unit-tests PATCH 1/5] s390x: Add test_bit to library Janosch Frank
2020-11-18 17:43   ` Cornelia Huck
2020-11-19  8:26   ` Thomas Huth
2020-11-19  8:32     ` Janosch Frank [this message]
2020-11-17 15:42 ` [kvm-unit-tests PATCH 2/5] s390x: Consolidate sclp read info Janosch Frank
2020-11-18 17:46   ` Cornelia Huck
2020-11-19  8:41   ` Thomas Huth
2020-11-19  8:52     ` Janosch Frank
2020-11-17 15:42 ` [kvm-unit-tests PATCH 3/5] s390x: SCLP feature checking Janosch Frank
2020-11-18 17:50   ` Cornelia Huck
2020-11-19  8:16     ` Janosch Frank
2020-11-19  9:15   ` Thomas Huth
2020-11-19  9:21     ` Janosch Frank
2020-11-17 15:42 ` [kvm-unit-tests PATCH 4/5] s390x: sie: Add SIE to lib Janosch Frank
2020-11-17 15:42 ` [kvm-unit-tests PATCH 5/5] s390x: sie: Add first SIE test Janosch Frank

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=b2ca7724-3390-fedc-4c4f-367ecbdea682@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@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