From ab8e4c035638685f1e579ce472dd8b4c957f8097 Mon Sep 17 00:00:00 2001 From: john cooper Date: Thu, 8 Jul 2010 04:17:13 -0300 Subject: [PATCH 1/3] Move CPU definitions to /usr/share/... BZ #610805 RH-Author: john cooper Message-id: <4C355149.2050800@redhat.com> Patchwork-id: 10557 O-Subject: [RHEL6 PATCH] Move CPU definitions to /usr/share/... BZ #610805 Bugzilla: 610805 RH-Acked-by: Markus Armbruster RH-Acked-by: Jes Sorensen RH-Acked-by: Juan Quintela Description: libvirt requested the cpu model configuration file be relocated to /usr/share to more clearly signify it was not to be modified by users. In addition the model file is now loaded even in the presence of the "-nodefconfig" command line flag. Note this is intended as an interim work-around for rhel6.0. While the new location of the config file should remain the same, the mechanism to direct qemu to it will likely differ going forward. Minor Caveat: Although the model definitions have moved from /etc/qemu/target-x86_64.conf to /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf an open of the former default config file is still attempted by qemu. In a new installation of the rpm this is a non-issue as well as when "-nodefconfig" is specified. However if the former config file exists, and is allowed to be read, and and contains model definitions conflicting with those in cpu-x86_64.conf, they will override those from the new config file. This realistically is only an issue for development testing and may be detected by "-readconfig ?" which will indicate when the old file had been found or "-cpu ?" which will display replicated model definitions. Verification: # /usr/libexec/qemu-kvm -nodefconfig -readconfig ? -cpu ? parsed config file /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf x86 Opteron_G3 x86 Opteron_G2 x86 Opteron_G1 x86 Nehalem x86 Penryn x86 Conroe x86 [n270] x86 [athlon] x86 [pentium3] x86 [pentium2] x86 [pentium] x86 [486] x86 [coreduo] x86 [qemu32] x86 [kvm64] x86 [core2duo] x86 [phenom] x86 [qemu64] Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=2581001 Signed-off-by: john cooper --- Move cpu model config to /usr/share/qemu-kvm/cpu-model. Enforce loading at startup. Add cpu model config path to specfile. Signed-off-by: Eduardo Habkost --- Makefile | 8 ++-- configure | 9 ++++ sysconfigs/target/cpu-x86_64.conf | 85 ++++++++++++++++++++++++++++++++++ sysconfigs/target/target-x86_64.conf | 85 ---------------------------------- vl.c | 7 +++ 6 files changed, 109 insertions(+), 90 deletions(-) create mode 100644 sysconfigs/target/cpu-x86_64.conf delete mode 100644 sysconfigs/target/target-x86_64.conf diff --git a/Makefile b/Makefile index c1dadd0..d147632 100644 --- a/Makefile +++ b/Makefile @@ -319,11 +319,11 @@ ifdef CONFIG_POSIX $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" endif -install-sysconfig: - $(INSTALL_DIR) "$(sysconfdir)/qemu" - $(INSTALL_DATA) sysconfigs/target/target-x86_64.conf "$(sysconfdir)/qemu" +install-cpuconfig: + $(INSTALL_DIR) "$(DESTDIR)$(cpuconfdir)" + $(INSTALL_DATA) sysconfigs/target/cpu-x86_64.conf "$(DESTDIR)$(cpuconfdir)" -install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig +install: all $(if $(BUILD_DOCS),install-doc) install-cpuconfig $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ifneq ($(TOOLS),) $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)" diff --git a/configure b/configure index 9e62b0d..be78a0c 100755 --- a/configure +++ b/configure @@ -33,6 +33,7 @@ prefix="" interp_prefix="/usr/gnemul/qemu-%M" static="no" sysconfdir="" +cpuconfdir="" sparc_cpu="" cross_prefix="" cc="gcc" @@ -480,6 +481,8 @@ for opt do ;; --sysconfdir=*) sysconfdir="$optarg" ;; + --cpuconfdir=*) cpuconfdir="$optarg" + ;; --disable-sdl) sdl="no" ;; --enable-sdl) sdl="yes" @@ -739,6 +742,7 @@ echo " --make=MAKE use specified make [$make]" echo " --install=INSTALL use specified install [$install]" echo " --static enable static build [$static]" echo " --sysconfdir=PATH install config in PATH" +echo " --cpuconfdir=PATH install cpu model config in PATH" echo " --enable-debug-tcg enable TCG debugging" echo " --disable-debug-tcg disable TCG debugging (default)" echo " --enable-debug enable common debug build options" @@ -2058,6 +2062,9 @@ else if test -z "$sysconfdir" ; then sysconfdir="${prefix}/etc" fi + if test -z "$cpuconfdir" ; then + cpuconfdir="$sysconfdir/qemu" + fi fi if test -f kvm/kernel/configure; then @@ -2159,6 +2166,7 @@ if test "$mingw32" = "yes" ; then echo "CONFIG_QEMU_CONFDIR=\"$sysconfdir\"" >> $config_host_mak else echo "CONFIG_QEMU_CONFDIR=\"${sysconfdir}/qemu\"" >> $config_host_mak + echo "CONFIG_QEMU_CPUCONFDIR=\"${cpuconfdir}\"" >> $config_host_mak fi case "$cpu" in @@ -2426,6 +2434,7 @@ echo "bindir=\${prefix}$binsuffix" >> $config_host_mak echo "mandir=\${prefix}$mansuffix" >> $config_host_mak echo "datadir=\${prefix}$datasuffix" >> $config_host_mak echo "sysconfdir=$sysconfdir" >> $config_host_mak +echo "cpuconfdir=$cpuconfdir" >> $config_host_mak echo "docdir=\${prefix}$docsuffix" >> $config_host_mak echo "MAKE=$make" >> $config_host_mak echo "INSTALL=$install" >> $config_host_mak diff --git a/sysconfigs/target/cpu-x86_64.conf b/sysconfigs/target/cpu-x86_64.conf new file mode 100644 index 0000000..ca07088 --- /dev/null +++ b/sysconfigs/target/cpu-x86_64.conf @@ -0,0 +1,85 @@ +# x86 CPU MODELS + +[cpudef] + name = "Conroe" + level = "2" + vendor = "GenuineIntel" + family = "6" + model = "2" + stepping = "3" + feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" + feature_ecx = "sse3 ssse3 x2apic" + extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" + extfeature_ecx = "lahf_lm" + xlevel = "0x8000000A" + model_id = "Intel Celeron_4x0 (Conroe/Merom Class Core 2)" + +[cpudef] + name = "Penryn" + level = "2" + vendor = "GenuineIntel" + family = "6" + model = "2" + stepping = "3" + feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" + feature_ecx = "sse3 cx16 ssse3 sse4.1 x2apic" + extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" + extfeature_ecx = "lahf_lm" + xlevel = "0x8000000A" + model_id = "Intel Core 2 Duo P9xxx (Penryn Class Core 2)" + +[cpudef] + name = "Nehalem" + level = "2" + vendor = "GenuineIntel" + family = "6" + model = "2" + stepping = "3" + feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" + feature_ecx = "sse3 cx16 ssse3 sse4.1 sse4.2 x2apic popcnt" + extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" + extfeature_ecx = "lahf_lm" + xlevel = "0x8000000A" + model_id = "Intel Core i7 9xx (Nehalem Class Core i7)" + +[cpudef] + name = "Opteron_G1" + level = "5" + vendor = "AuthenticAMD" + family = "15" + model = "6" + stepping = "1" + feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" + feature_ecx = "sse3" + extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" +# extfeature_ecx = "" + xlevel = "0x80000008" + model_id = "AMD Opteron 240 (Gen 1 Class Opteron)" + +[cpudef] + name = "Opteron_G2" + level = "5" + vendor = "AuthenticAMD" + family = "15" + model = "6" + stepping = "1" + feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" + feature_ecx = "sse3 cx16" + extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx rdtscp" + extfeature_ecx = "svm lahf_lm" + xlevel = "0x80000008" + model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)" + +[cpudef] + name = "Opteron_G3" + level = "5" + vendor = "AuthenticAMD" + family = "15" + model = "6" + stepping = "1" + feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" + feature_ecx = "sse3 cx16 monitor popcnt" + extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx rdtscp" + extfeature_ecx = "svm sse4a abm misalignsse lahf_lm" + xlevel = "0x80000008" + model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)" diff --git a/sysconfigs/target/target-x86_64.conf b/sysconfigs/target/target-x86_64.conf deleted file mode 100644 index ca07088..0000000 --- a/sysconfigs/target/target-x86_64.conf +++ /dev/null @@ -1,85 +0,0 @@ -# x86 CPU MODELS - -[cpudef] - name = "Conroe" - level = "2" - vendor = "GenuineIntel" - family = "6" - model = "2" - stepping = "3" - feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" - feature_ecx = "sse3 ssse3 x2apic" - extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Celeron_4x0 (Conroe/Merom Class Core 2)" - -[cpudef] - name = "Penryn" - level = "2" - vendor = "GenuineIntel" - family = "6" - model = "2" - stepping = "3" - feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" - feature_ecx = "sse3 cx16 ssse3 sse4.1 x2apic" - extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Core 2 Duo P9xxx (Penryn Class Core 2)" - -[cpudef] - name = "Nehalem" - level = "2" - vendor = "GenuineIntel" - family = "6" - model = "2" - stepping = "3" - feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" - feature_ecx = "sse3 cx16 ssse3 sse4.1 sse4.2 x2apic popcnt" - extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Core i7 9xx (Nehalem Class Core i7)" - -[cpudef] - name = "Opteron_G1" - level = "5" - vendor = "AuthenticAMD" - family = "15" - model = "6" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" - feature_ecx = "sse3" - extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx" -# extfeature_ecx = "" - xlevel = "0x80000008" - model_id = "AMD Opteron 240 (Gen 1 Class Opteron)" - -[cpudef] - name = "Opteron_G2" - level = "5" - vendor = "AuthenticAMD" - family = "15" - model = "6" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" - feature_ecx = "sse3 cx16" - extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx rdtscp" - extfeature_ecx = "svm lahf_lm" - xlevel = "0x80000008" - model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)" - -[cpudef] - name = "Opteron_G3" - level = "5" - vendor = "AuthenticAMD" - family = "15" - model = "6" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36" - feature_ecx = "sse3 cx16 monitor popcnt" - extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx rdtscp" - extfeature_ecx = "svm sse4a abm misalignsse lahf_lm" - xlevel = "0x80000008" - model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)" diff --git a/vl.c b/vl.c index a3b682d..eb993d6 100644 --- a/vl.c +++ b/vl.c @@ -5141,6 +5141,13 @@ int main(int argc, char **argv, char **envp) } } + /* load local cpu config, NB: may possibly be overridden by defconfigs + */ + if (qemu_read_config_file( + CONFIG_QEMU_CPUCONFDIR "/cpu-" TARGET_ARCH ".conf", + defconfig_verbose) == -EINVAL) { + exit(1); + } if (defconfig) { int ret; -- 1.7.0.3