From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59136 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbgKSJQC (ORCPT ); Thu, 19 Nov 2020 04:16:02 -0500 Subject: Re: [kvm-unit-tests PATCH 3/5] s390x: SCLP feature checking References: <20201117154215.45855-1-frankja@linux.ibm.com> <20201117154215.45855-4-frankja@linux.ibm.com> From: Thomas Huth Message-ID: Date: Thu, 19 Nov 2020 10:15:52 +0100 MIME-Version: 1.0 In-Reply-To: <20201117154215.45855-4-frankja@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-ID: To: Janosch Frank , kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, borntraeger@de.ibm.com, imbrenda@linux.ibm.com On 17/11/2020 16.42, Janosch Frank wrote: > Availability of SIE is announced via a feature bit in a SCLP info CPU > entry. Let's add a framework that allows us to easily check for such > facilities. > > Signed-off-by: Janosch Frank > --- > lib/s390x/io.c | 1 + > lib/s390x/sclp.c | 19 +++++++++++++++++++ > lib/s390x/sclp.h | 15 +++++++++++++++ > 3 files changed, 35 insertions(+) [...] > diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h > index 6620531..bcc9f4b 100644 > --- a/lib/s390x/sclp.h > +++ b/lib/s390x/sclp.h > @@ -101,6 +101,20 @@ typedef struct CPUEntry { > uint8_t reserved1; > } __attribute__((packed)) CPUEntry; > > +extern struct sclp_facilities sclp_facilities; > + > +struct sclp_facilities { > + u64 has_sief2 : 1; > +}; > + > +/* > + * test_bit() uses unsigned long ptrs so we give it the ptr to the > + * address member and offset bits by 1> + */ > +enum sclp_cpu_feature_bit { > + SCLP_CPU_FEATURE_SIEF2_BIT = 16 + 4, > +}; That's kind of ugly ... why don't you simply replace the CPUEntry.features[] array with a bitfield, similar to what the kernel does with "struct sclp_core_entry" ? Thomas