Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/52085 )

Change subject: arch-x86,cpu-kvm: Move the x86 KVM CPU to the arch/x86 directory.
......................................................................

arch-x86,cpu-kvm: Move the x86 KVM CPU to the arch/x86 directory.

The x86 KVM CPU had been in the cpu/kvm directory, while the arm CPU was
inconsistently in the arch/arm directory.

This change moves the x86 CPU to be in arch/x86, restoring consistency.
This location will make the KVM support more modular, by not having the
x86 CPU implementation right alongside the generic implementation.

Change-Id: Ia13151f843df8f8877bfef5ff620825877d3dffa
---
R src/arch/x86/kvm/x86_cpu.cc
R src/arch/x86/kvm/x86_cpu.hh
C src/arch/x86/kvm/SConscript
R src/arch/x86/kvm/X86KvmCPU.py
M src/cpu/kvm/SConscript
5 files changed, 45 insertions(+), 30 deletions(-)



diff --git a/src/cpu/kvm/X86KvmCPU.py b/src/arch/x86/kvm/SConscript
similarity index 65%
copy from src/cpu/kvm/X86KvmCPU.py
copy to src/arch/x86/kvm/SConscript
index 8bb48e8..4518f72 100644
--- a/src/cpu/kvm/X86KvmCPU.py
+++ b/src/arch/x86/kvm/SConscript
@@ -1,6 +1,17 @@
-# Copyright (c) 2013 Andreas Sandberg
+# -*- mode:python -*-
+
+# Copyright (c) 2012 ARM Limited
 # All rights reserved.
 #
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder.  You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
 # met: redistributions of source code must retain the above copyright
@@ -24,23 +35,10 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from m5.params import *
-from m5.SimObject import *
+Import('*')

-from m5.objects.BaseKvmCPU import BaseKvmCPU
+if not env['USE_KVM'] or env['TARGET_ISA'] != env['KVM_ISA']:
+    Return()

-class X86KvmCPU(BaseKvmCPU):
-    type = 'X86KvmCPU'
-    cxx_header = "cpu/kvm/x86_cpu.hh"
-    cxx_class = 'gem5::X86KvmCPU'
-
-    cxx_exports = [
-        PyBindMethod("dumpFpuRegs"),
-        PyBindMethod("dumpIntRegs"),
-        PyBindMethod("dumpSpecRegs"),
-        PyBindMethod("dumpXCRs"),
-        PyBindMethod("dumpXSave"),
-        PyBindMethod("dumpVCpuEvents"),
-    ]
-
- useXSave = Param.Bool(True, "Use XSave to synchronize FPU/SIMD registers")
+SimObject('X86KvmCPU.py', tags='x86 isa')
+Source('x86_cpu.cc', tags='x86 isa')
diff --git a/src/cpu/kvm/X86KvmCPU.py b/src/arch/x86/kvm/X86KvmCPU.py
similarity index 97%
rename from src/cpu/kvm/X86KvmCPU.py
rename to src/arch/x86/kvm/X86KvmCPU.py
index 8bb48e8..54cf0f2 100644
--- a/src/cpu/kvm/X86KvmCPU.py
+++ b/src/arch/x86/kvm/X86KvmCPU.py
@@ -31,7 +31,7 @@

 class X86KvmCPU(BaseKvmCPU):
     type = 'X86KvmCPU'
-    cxx_header = "cpu/kvm/x86_cpu.hh"
+    cxx_header = "arch/x86/kvm/x86_cpu.hh"
     cxx_class = 'gem5::X86KvmCPU'

     cxx_exports = [
diff --git a/src/cpu/kvm/x86_cpu.cc b/src/arch/x86/kvm/x86_cpu.cc
similarity index 98%
rename from src/cpu/kvm/x86_cpu.cc
rename to src/arch/x86/kvm/x86_cpu.cc
index 899bbce..67cecd4 100644
--- a/src/cpu/kvm/x86_cpu.cc
+++ b/src/arch/x86/kvm/x86_cpu.cc
@@ -26,7 +26,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

-#include "cpu/kvm/x86_cpu.hh"
+#include "arch/x86/kvm/x86_cpu.hh"

 #include <linux/kvm.h>

@@ -193,10 +193,12 @@
 dumpKvm(const char *reg_name, const struct kvm_segment &seg)
 {
     inform("\t%s: @0x%llx+%x [sel: 0x%x, type: 0x%x]\n"
- "\t\tpres.: %u, dpl: %u, db: %u, s: %u, l: %u, g: %u, avl: %u, unus.: %u\n",
+           "\t\tpres.: %u, dpl: %u, db: %u, s: %u, l: %u, g: %u, avl: %u, "
+           "unus.: %u\n",
            reg_name,
            seg.base, seg.limit, seg.selector, seg.type,
- seg.present, seg.dpl, seg.db, seg.s, seg.l, seg.g, seg.avl, seg.unusable);
+           seg.present, seg.dpl, seg.db, seg.s, seg.l, seg.g, seg.avl,
+           seg.unusable);
 }

 static void
@@ -547,8 +549,8 @@
     haveXCRs = kvm.capXCRs();

     if (useXSave && !haveXSave) {
- warn("KVM: XSAVE not supported by host. MXCSR synchronization might be "
-             "unreliable due to kernel bugs.\n");
+ warn("KVM: XSAVE not supported by host. MXCSR synchronization might "
+             "be unreliable due to kernel bugs.\n");
         useXSave = false;
     } else if (!useXSave) {
         warn("KVM: XSave FPU/SIMD synchronization disabled by user.\n");
@@ -1321,7 +1323,8 @@
         handleIOMiscReg32(MISCREG_PCI_CONFIG_ADDRESS);
         return 0;
     } else if ((port & ~0x3) == IO_PCI_CONF_DATA_BASE) {
- Addr pciConfigAddr(tc->readMiscRegNoEffect(MISCREG_PCI_CONFIG_ADDRESS));
+        Addr pciConfigAddr(tc->readMiscRegNoEffect(
+                    MISCREG_PCI_CONFIG_ADDRESS));
         if (pciConfigAddr & 0x80000000) {
pAddr = X86ISA::x86PciConfigAddress((pciConfigAddr & 0x7ffffffc) |
                                                 (port & 0x3));
@@ -1473,7 +1476,8 @@
 X86KvmCPU::setCPUID(const Kvm::CPUIDVector &cpuid)
 {
     std::unique_ptr<struct kvm_cpuid2> kvm_cpuid(
- newVarStruct<struct kvm_cpuid2, struct kvm_cpuid_entry2>(cpuid.size()));
+        newVarStruct<struct kvm_cpuid2, struct kvm_cpuid_entry2>(
+            cpuid.size()));

     kvm_cpuid->nent = cpuid.size();
     std::copy(cpuid.begin(), cpuid.end(), kvm_cpuid->entries);
diff --git a/src/cpu/kvm/x86_cpu.hh b/src/arch/x86/kvm/x86_cpu.hh
similarity index 100%
rename from src/cpu/kvm/x86_cpu.hh
rename to src/arch/x86/kvm/x86_cpu.hh
diff --git a/src/cpu/kvm/SConscript b/src/cpu/kvm/SConscript
index 3d1e479..1b90408 100644
--- a/src/cpu/kvm/SConscript
+++ b/src/cpu/kvm/SConscript
@@ -49,9 +49,6 @@
 Source('perfevent.cc')
 Source('timer.cc')

-SimObject('X86KvmCPU.py', tags='x86 isa')
-Source('x86_cpu.cc', tags='x86 isa')
-
 DebugFlag('Kvm', 'Basic KVM Functionality')
 DebugFlag('KvmContext', 'KVM/gem5 context synchronization')
 DebugFlag('KvmIO', 'KVM MMIO diagnostics')

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

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ia13151f843df8f8877bfef5ff620825877d3dffa
Gerrit-Change-Number: 52085
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to