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

Re: [Minios-devel] [UNIKRAFT PATCH 3/6] plat/common: Provide rdmsr amd rdmsrl for x86


  • To: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
  • From: gaulthier.gain@xxxxxxxxx
  • Date: Thu, 12 Dec 2019 14:37:35 +0100 (CET)
  • Cc: Felipe Huici <felipe.huici@xxxxxxxxx>, minios-devel@xxxxxxxxxxxxx
  • Delivery-date: Thu, 12 Dec 2019 13:37:41 +0000
  • Dkim-filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 4AB0E2012174
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: ATCMccTdBLW6ecpbQtwQHTzVtLXZfg==
  • Thread-topic: plat/common: Provide rdmsr amd rdmsrl for x86

Reviewed-by: Gaulthier Gain <gaulthier.gain@xxxxxxxxx>

----- Mail original -----
De: "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx>
À: minios-devel@xxxxxxxxxxxxx
Cc: "Gaulthier Gain" <gaulthier.gain@xxxxxxxxx>, "Felipe Huici" 
<felipe.huici@xxxxxxxxx>, "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx>
Envoyé: Jeudi 5 Décembre 2019 15:02:19
Objet: [UNIKRAFT PATCH 3/6] plat/common: Provide rdmsr amd rdmsrl for x86

The model-specific registers (MSR) are used for querying and
programming some CPU features on x86. `rdmsr` and `rdmsrl` are macros
for reading the register values.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 plat/common/include/x86/cpu.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h
index 3bec2b58..120eb86d 100644
--- a/plat/common/include/x86/cpu.h
+++ b/plat/common/include/x86/cpu.h
@@ -175,6 +175,20 @@ static inline void invlpg(unsigned long va)
 }
 
 
+static inline void rdmsr(unsigned int msr, __u32 *lo, __u32 *hi)
+{
+       asm volatile("rdmsr" : "=a"(*lo), "=d"(*hi)
+                            : "c"(msr));
+}
+
+static inline __u64 rdmsrl(unsigned int msr)
+{
+       __u32 lo, hi;
+
+       rdmsr(msr, &lo, &hi);
+       return ((__u64) lo | (__u64) hi << 32);
+}
+
 static inline void wrmsr(unsigned int msr, __u32 lo, __u32 hi)
 {
        asm volatile("wrmsr"
-- 
2.20.1

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.