Jason Lowe-Power has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12278

Change subject: cpu-kvm, arch-x86: Fix KVM on Intel platforms
......................................................................

cpu-kvm, arch-x86: Fix KVM on Intel platforms

This is the minimal set of changes from the patch that's been floating
around for a few years originally by Mike Upton.

See http://reviews.gem5.org/r/2613/ and
https://gem5-review.googlesource.com/c/public/gem5/+/7361

The change to the tssDesc is the minimal change to get KVM working on
Intel platforms. However, the other changes seem prudent to add.

Tested on both Intel (i7-7700) and AMD (EPYC 7451) platforms.

Change-Id: I000c7ba102ba161c2bb5e224bf826216cf0ff87a
Signed-off-by: Jason Lowe-Power <[email protected]>
---
M src/arch/x86/system.cc
1 file changed, 13 insertions(+), 0 deletions(-)



diff --git a/src/arch/x86/system.cc b/src/arch/x86/system.cc
index 0f85fdb..2cd9330 100644
--- a/src/arch/x86/system.cc
+++ b/src/arch/x86/system.cc
@@ -179,6 +179,12 @@

     // 32 bit data segment
     SegDescriptor dsDesc = initDesc;
+    dsDesc.type.e = 0;
+    dsDesc.type.w = 1;
+    dsDesc.d = 1;
+    dsDesc.baseHigh = 0;
+    dsDesc.baseLow = 0;
+
     uint64_t dsDescVal = dsDesc;
     physProxy.writeBlob(GDTBase + numGDTEntries * 8,
                         (uint8_t *)(&dsDescVal), 8);
@@ -195,10 +201,17 @@
     tc->setMiscReg(MISCREG_SS, (MiscReg)ds);

     tc->setMiscReg(MISCREG_TSL, 0);
+    SegAttr ldtAttr = 0;
+    ldtAttr.unusable = 1;
+    tc->setMiscReg(MISCREG_TSL_ATTR, ldtAttr);
     tc->setMiscReg(MISCREG_TSG_BASE, GDTBase);
     tc->setMiscReg(MISCREG_TSG_LIMIT, 8 * numGDTEntries - 1);

     SegDescriptor tssDesc = initDesc;
+    tssDesc.type = 0xB;
+    tssDesc.d = 1;
+    tssDesc.s = 0;
+
     uint64_t tssDescVal = tssDesc;
     physProxy.writeBlob(GDTBase + numGDTEntries * 8,
                         (uint8_t *)(&tssDescVal), 8);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12278
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I000c7ba102ba161c2bb5e224bf826216cf0ff87a
Gerrit-Change-Number: 12278
Gerrit-PatchSet: 1
Gerrit-Owner: Jason Lowe-Power <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to