Re: [kvm-unit-tests PATCH 2/4] lib: s390x: sclp: Extend feature probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10.05.21 17:00, Janosch Frank wrote:
Lets grab more of the feature bits from SCLP read info so we can use
them in the cpumodel tests.

Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx>
Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
---
  lib/s390x/sclp.c | 20 ++++++++++++++++++++
  lib/s390x/sclp.h | 38 +++++++++++++++++++++++++++++++++++---
  2 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index f11c2035..f25cfdb2 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -129,6 +129,13 @@ CPUEntry *sclp_get_cpu_entries(void)
  	return (CPUEntry *)(_read_info + read_info->offset_cpu);
  }
+static bool sclp_feat_check(int byte, int mask)
+{
+	uint8_t *rib = (uint8_t *)read_info;
+
+	return !!(rib[byte] & mask);
+}

Instead of a mask, I'd just check for bit (offset) numbers within the byte.

static bool sclp_feat_check(int byte, int bit)
{
	uint8_t *rib = (uint8_t *)read_info;

	return !!(rib[byte] & (0x80 >> bit));
}

--
Thanks,

David / dhildenb




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux