On 11/19/20 10:15 AM, Thomas Huth wrote: > 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 <frankja@xxxxxxxxxxxxx> >> --- >> 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" ? That's an excellent idea, will do! > > Thomas > >