Re: [kvm-unit-tests PATCH v1 4/4] lib: s390x: stidp wrapper and move get_machine_id

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

 



On 3/30/22 16:43, Claudio Imbrenda wrote:
Refactor get_machine_id in arch_def.h into a simple wrapper around
stidp, add back get_machine_id in hardware.h using the stidp wrapper.

Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>

Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx>

---
  lib/s390x/asm/arch_def.h | 4 +---
  lib/s390x/hardware.h     | 5 +++++
  2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 8d860ccf..bab3c374 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -219,13 +219,11 @@ static inline unsigned short stap(void)
  	return cpu_address;
  }
-static inline uint16_t get_machine_id(void)
+static inline uint64_t stidp(void)
  {
  	uint64_t cpuid;
asm volatile("stidp %0" : "=Q" (cpuid));
-	cpuid = cpuid >> 16;
-	cpuid &= 0xffff;
return cpuid;
  }
diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h
index fb6565ad..8783ae9c 100644
--- a/lib/s390x/hardware.h
+++ b/lib/s390x/hardware.h
@@ -43,6 +43,11 @@ enum s390_host {
enum s390_host detect_host(void); +static inline uint16_t get_machine_id(void)
+{
+	return stidp() >> 16;
+}
+
  static inline bool host_is_tcg(void)
  {
  	return detect_host() == HOST_IS_TCG;




[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