* [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
@ 2013-09-06 20:47 Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Laurent Vivier @ 2013-09-06 20:47 UTC (permalink / raw)
To: Riku Voipio; +Cc: qemu-devel, Laurent Vivier
This series of patch allows to set the default CPU used by linux-user qemu.
When qemu is used in a container as a binfmt interpreter we can't use the
environment variable QEMU_CPU to set the CPU id.
The two last patches allows to display the default CPU id when "-cpu ?" is
used. Only two archs are updated as examples : arm and m68k.
Laurent Vivier (4):
linux-user: define default cpu model in configure instead of
linux-user/main.c
linux-user: specify the cpu model during configure
linux-user,m68k: display default cpu
linux-user,arm: display default cpu
configure | 23 +++++++++++++++++++++++
linux-user/main.c | 36 +-----------------------------------
target-arm/helper.c | 5 +++++
target-m68k/helper.c | 5 +++++
4 files changed, 34 insertions(+), 35 deletions(-)
--
1.8.1.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c
2013-09-06 20:47 [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Laurent Vivier
@ 2013-09-06 20:47 ` Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 2/4] linux-user: specify the cpu model during configure Laurent Vivier
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2013-09-06 20:47 UTC (permalink / raw)
To: Riku Voipio; +Cc: qemu-devel, Laurent Vivier
From: Laurent Vivier <Laurent@Vivier.EU>
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
configure | 14 ++++++++++++++
linux-user/main.c | 36 +-----------------------------------
2 files changed, 15 insertions(+), 35 deletions(-)
diff --git a/configure b/configure
index e989609..ef84abe 100755
--- a/configure
+++ b/configure
@@ -4214,6 +4214,7 @@ target_dir="$target"
config_target_mak=$target_dir/config-target.mak
target_name=`echo $target | cut -d '-' -f 1`
target_bigendian="no"
+target_default_cpu="any"
case "$target_name" in
armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
@@ -4261,9 +4262,11 @@ TARGET_ABI_DIR=""
case "$target_name" in
i386)
+ target_default_cpu="qemu32"
;;
x86_64)
TARGET_BASE_ARCH=i386
+ target_default_cpu="qemu64"
;;
alpha)
;;
@@ -4287,17 +4290,20 @@ case "$target_name" in
mips|mipsel)
TARGET_ARCH=mips
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
+ target_default_cpu="24Kf"
;;
mipsn32|mipsn32el)
TARGET_ARCH=mips64
TARGET_BASE_ARCH=mips
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
echo "TARGET_ABI32=y" >> $config_target_mak
+ target_default_cpu="20Kc"
;;
mips64|mips64el)
TARGET_ARCH=mips64
TARGET_BASE_ARCH=mips
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
+ target_default_cpu="20Kc"
;;
moxie)
;;
@@ -4307,16 +4313,19 @@ case "$target_name" in
;;
ppc)
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+ target_default_cpu="750"
;;
ppcemb)
TARGET_BASE_ARCH=ppc
TARGET_ABI_DIR=ppc
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+ target_default_cpu="750"
;;
ppc64)
TARGET_BASE_ARCH=ppc
TARGET_ABI_DIR=ppc
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+ target_default_cpu="970fx"
;;
ppc64abi32)
TARGET_ARCH=ppc64
@@ -4324,21 +4333,25 @@ case "$target_name" in
TARGET_ABI_DIR=ppc
echo "TARGET_ABI32=y" >> $config_target_mak
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+ target_default_cpu="750"
;;
sh4|sh4eb)
TARGET_ARCH=sh4
bflt="yes"
;;
sparc)
+ target_default_cpu="Fujitsu MB86904"
;;
sparc64)
TARGET_BASE_ARCH=sparc
+ target_default_cpu="TI UltraSparc II"
;;
sparc32plus)
TARGET_ARCH=sparc64
TARGET_BASE_ARCH=sparc
TARGET_ABI_DIR=sparc
echo "TARGET_ABI32=y" >> $config_target_mak
+ target_default_cpu="TI UltraSparc II"
;;
s390x)
;;
@@ -4362,6 +4375,7 @@ upper() {
echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
}
+echo "TARGET_DEFAULT_CPU=\"$target_default_cpu\"" >> $config_target_mak
target_arch_name="`upper $TARGET_ARCH`"
echo "TARGET_$target_arch_name=y" >> $config_target_mak
echo "TARGET_NAME=$target_name" >> $config_target_mak
diff --git a/linux-user/main.c b/linux-user/main.c
index 5c2f7b2..4681349 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3595,41 +3595,7 @@ int main(int argc, char **argv, char **envp)
init_paths(interp_prefix);
if (cpu_model == NULL) {
-#if defined(TARGET_I386)
-#ifdef TARGET_X86_64
- cpu_model = "qemu64";
-#else
- cpu_model = "qemu32";
-#endif
-#elif defined(TARGET_ARM)
- cpu_model = "any";
-#elif defined(TARGET_UNICORE32)
- cpu_model = "any";
-#elif defined(TARGET_M68K)
- cpu_model = "any";
-#elif defined(TARGET_SPARC)
-#ifdef TARGET_SPARC64
- cpu_model = "TI UltraSparc II";
-#else
- cpu_model = "Fujitsu MB86904";
-#endif
-#elif defined(TARGET_MIPS)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
- cpu_model = "20Kc";
-#else
- cpu_model = "24Kf";
-#endif
-#elif defined TARGET_OPENRISC
- cpu_model = "or1200";
-#elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
- cpu_model = "970fx";
-#else
- cpu_model = "750";
-#endif
-#else
- cpu_model = "any";
-#endif
+ cpu_model = TARGET_DEFAULT_CPU;
}
tcg_exec_init(0);
cpu_exec_init_all();
--
1.8.1.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 2/4] linux-user: specify the cpu model during configure
2013-09-06 20:47 [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
@ 2013-09-06 20:47 ` Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 3/4] linux-user,m68k: display default cpu Laurent Vivier
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2013-09-06 20:47 UTC (permalink / raw)
To: Riku Voipio; +Cc: qemu-devel, Laurent Vivier
From: Laurent Vivier <Laurent@Vivier.EU>
This patch allows to set the default cpu model for a given architecture,
for instance:
configure --target-list=m68k-linux-user --m68k-default-cpu=m68040
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
configure | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/configure b/configure
index ef84abe..22b27fc 100755
--- a/configure
+++ b/configure
@@ -650,6 +650,10 @@ for opt do
;;
--target-list=*) target_list="$optarg"
;;
+ --*-default-cpu=*)
+ tmp=`expr "x$opt" : 'x--\(.*\)-default-cpu=.*'`
+ eval ${tmp}_default_cpu="\"$optarg\""
+ ;;
--enable-trace-backend=*) trace_backend="$optarg"
;;
--with-trace-file=*) trace_file="$optarg"
@@ -1025,6 +1029,7 @@ echo " use %M for cpu name [$interp_prefix]"
echo " --target-list=LIST set target list (default: build everything)"
echo "Available targets: $default_target_list" | \
fold -s -w 53 | sed -e 's/^/ /'
+echo " --ARCH-default-cpu=CPU set the default cpu for a given architecture"
echo ""
echo "Advanced options (experts only):"
echo " --source-path=PATH path of source code [$source_path]"
@@ -4375,6 +4380,10 @@ upper() {
echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
}
+tmp_target_default_cpu=`eval echo \\$${target_name}_default_cpu`
+if [ "x$tmp_target_default_cpu" != "x" ] ; then
+ target_default_cpu="$tmp_target_default_cpu"
+fi
echo "TARGET_DEFAULT_CPU=\"$target_default_cpu\"" >> $config_target_mak
target_arch_name="`upper $TARGET_ARCH`"
echo "TARGET_$target_arch_name=y" >> $config_target_mak
--
1.8.1.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 3/4] linux-user,m68k: display default cpu
2013-09-06 20:47 [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 2/4] linux-user: specify the cpu model during configure Laurent Vivier
@ 2013-09-06 20:47 ` Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 4/4] linux-user,arm: " Laurent Vivier
2013-09-07 8:43 ` [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Peter Maydell
4 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2013-09-06 20:47 UTC (permalink / raw)
To: Riku Voipio; +Cc: qemu-devel, Laurent Vivier
From: Laurent Vivier <Laurent@Vivier.EU>
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
target-m68k/helper.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 00a7a08..123329a 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -52,6 +52,11 @@ static void m68k_cpu_list_entry(gpointer data, gpointer user_data)
typename = object_class_get_name(c);
name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_M68K_CPU));
+ if (strcmp(name, TARGET_DEFAULT_CPU) == 0) {
+ (*s->cpu_fprintf)(s->file, " >");
+ } else {
+ (*s->cpu_fprintf)(s->file, " ");
+ }
(*s->cpu_fprintf)(s->file, "%s\n",
name);
g_free(name);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 4/4] linux-user,arm: display default cpu
2013-09-06 20:47 [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Laurent Vivier
` (2 preceding siblings ...)
2013-09-06 20:47 ` [Qemu-devel] [PATCH 3/4] linux-user,m68k: display default cpu Laurent Vivier
@ 2013-09-06 20:47 ` Laurent Vivier
2013-09-07 8:43 ` [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Peter Maydell
4 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2013-09-06 20:47 UTC (permalink / raw)
To: Riku Voipio; +Cc: qemu-devel, Laurent Vivier
From: Laurent Vivier <Laurent@Vivier.EU>
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
target-arm/helper.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index e51ef20..26863d4 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1809,6 +1809,11 @@ static void arm_cpu_list_entry(gpointer data, gpointer user_data)
typename = object_class_get_name(oc);
name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU));
+ if (strcmp(name, TARGET_DEFAULT_CPU) == 0) {
+ (*s->cpu_fprintf)(s->file, " >");
+ } else {
+ (*s->cpu_fprintf)(s->file, " ");
+ }
(*s->cpu_fprintf)(s->file, " %s\n",
name);
g_free(name);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
2013-09-06 20:47 [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Laurent Vivier
` (3 preceding siblings ...)
2013-09-06 20:47 ` [Qemu-devel] [PATCH 4/4] linux-user,arm: " Laurent Vivier
@ 2013-09-07 8:43 ` Peter Maydell
2013-09-07 9:13 ` Laurent Vivier
4 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2013-09-07 8:43 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Riku Voipio, QEMU Developers
On 6 September 2013 21:47, Laurent Vivier <laurent@vivier.eu> wrote:
> This series of patch allows to set the default CPU used by linux-user qemu.
>
> When qemu is used in a container as a binfmt interpreter we can't use the
> environment variable QEMU_CPU to set the CPU id.
I definitely don't like this. We shouldn't be hardcoding this at
configure time. There doesn't seem to be any particular reason
why QEMU_CPU is the only option you might want to set for
your binfmt-interpreter either.
Is there a reason why using a wrapper script which sets
options to the real qemu binary won't work?
thanks
-- PMM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
2013-09-07 8:43 ` [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Peter Maydell
@ 2013-09-07 9:13 ` Laurent Vivier
2013-09-07 9:19 ` Peter Maydell
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Vivier @ 2013-09-07 9:13 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, QEMU Developers
Le 07/09/2013 10:43, Peter Maydell a écrit :
> On 6 September 2013 21:47, Laurent Vivier <laurent@vivier.eu> wrote:
>> This series of patch allows to set the default CPU used by linux-user qemu.
>>
>> When qemu is used in a container as a binfmt interpreter we can't use the
>> environment variable QEMU_CPU to set the CPU id.
> I definitely don't like this. We shouldn't be hardcoding this at
> configure time. There doesn't seem to be any particular reason
> why QEMU_CPU is the only option you might want to set for
> your binfmt-interpreter either.
In fact, I don't understand why a given CPU id has been chosen to be the
default value. I think there is a default value not because this is the
best/most used value but because we need a default. It's hardcoded at
development time. So I think this is better to be able to choose this
default value without editing any file. A configuration option is the
best solution for me. Moreover, this doesn't change the default behavior.
> Is there a reason why using a wrapper script which sets
> options to the real qemu binary won't work?
Personal reason : I don't like wrapper. Kernel must load two
executables, wrapper must analyze environment, auxv, parameters and pass
what it needs to pass.
But I don't want to push these patches at any reason : I just want to share.
Thank you for your comments.
Regards,
Laurent
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
2013-09-07 9:13 ` Laurent Vivier
@ 2013-09-07 9:19 ` Peter Maydell
2013-09-09 19:23 ` Richard Henderson
0 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2013-09-07 9:19 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Riku Voipio, QEMU Developers
On 7 September 2013 10:13, Laurent Vivier <Laurent@vivier.eu> wrote:
> Le 07/09/2013 10:43, Peter Maydell a écrit :
> In fact, I don't understand why a given CPU id has been chosen to be the
> default value. I think there is a default value not because this is the
> best/most used value but because we need a default.
The default for ARM is "any", which is specifically for linux-user
and means "enable all possible user-visible instruction set options".
That means it should be able to run any guest binary OK.
Some other target CPU types do this, but not all; I think that
ideally we should convert them to do similarly.
I agree that the cases where we've picked some specific CPU
to be the linux-user default are a bit dubious.
-- PMM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
2013-09-07 9:19 ` Peter Maydell
@ 2013-09-09 19:23 ` Richard Henderson
2013-09-10 7:13 ` Laurent Vivier
0 siblings, 1 reply; 14+ messages in thread
From: Richard Henderson @ 2013-09-09 19:23 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, Laurent Vivier, QEMU Developers
On 09/07/2013 02:19 AM, Peter Maydell wrote:
> On 7 September 2013 10:13, Laurent Vivier <Laurent@vivier.eu> wrote:
>> Le 07/09/2013 10:43, Peter Maydell a écrit :
>> In fact, I don't understand why a given CPU id has been chosen to be the
>> default value. I think there is a default value not because this is the
>> best/most used value but because we need a default.
>
> The default for ARM is "any", which is specifically for linux-user
> and means "enable all possible user-visible instruction set options".
> That means it should be able to run any guest binary OK.
> Some other target CPU types do this, but not all; I think that
> ideally we should convert them to do similarly.
For mips this is impossible. There are multiple isa extensions that are
mutually exclusive. But for everyone else that ought to work.
r~
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
2013-09-09 19:23 ` Richard Henderson
@ 2013-09-10 7:13 ` Laurent Vivier
2013-09-10 8:40 ` Peter Maydell
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Vivier @ 2013-09-10 7:13 UTC (permalink / raw)
To: Richard Henderson, Peter Maydell; +Cc: Riku Voipio, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]
> Le 9 septembre 2013 à 21:23, Richard Henderson <rth@twiddle.net> a écrit :
>
>
> On 09/07/2013 02:19 AM, Peter Maydell wrote:
> > On 7 September 2013 10:13, Laurent Vivier <Laurent@vivier.eu> wrote:
> >> Le 07/09/2013 10:43, Peter Maydell a écrit :
> >> In fact, I don't understand why a given CPU id has been chosen to be the
> >> default value. I think there is a default value not because this is the
> >> best/most used value but because we need a default.
> >
> > The default for ARM is "any", which is specifically for linux-user
> > and means "enable all possible user-visible instruction set options".
> > That means it should be able to run any guest binary OK.
> > Some other target CPU types do this, but not all; I think that
> > ideally we should convert them to do similarly.
>
> For mips this is impossible. There are multiple isa extensions that are
> mutually exclusive. But for everyone else that ought to work.
It doesn't work for m68k, too. It's why I need to define the default I want to
use...
Regards,
Laurent
[-- Attachment #2: Type: text/html, Size: 2146 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Define default CPU at configure time
2013-09-10 7:13 ` Laurent Vivier
@ 2013-09-10 8:40 ` Peter Maydell
0 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2013-09-10 8:40 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Riku Voipio, QEMU Developers, Richard Henderson
On 10 September 2013 08:13, Laurent Vivier <laurent@vivier.eu> wrote:
>> Le 9 septembre 2013 à 21:23, Richard Henderson <rth@twiddle.net> a écrit :
>> For mips this is impossible. There are multiple isa extensions that are
>> mutually exclusive. But for everyone else that ought to work.
>
> It doesn't work for m68k, too. It's why I need to define the default I want
> to use...
Where the instruction set options conflict I really
don't think we should have a default selectable at
configure time. Having different people with different
qemu-m68k or qemu-mips being able to run or not run
different programs sounds very confusing. At least if
there's a command line option or a wrapper to set
environment then it's reasonably clear that the
config is different. Also if these different
variants are properly represented by different ELF
information you can then register several different
wrappers to handle different flavours of m68k
or mips binary correctly.
-- PMM
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 0/4] linux-user: A serie of patches to set default CPU
@ 2012-01-22 12:27 Laurent Vivier
2012-01-22 12:27 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Vivier @ 2012-01-22 12:27 UTC (permalink / raw)
To: qemu-devel
This serie of patches has already been sent, more or less, several time,
last time in july 2011.
For chrooted environment, it allows to define the default cpu model as we can't use '-cpu' argument.
For instance:
./configure --target-list=m68k-linux-user,arm-linux-user \
--m68k-default-cpu=m5206 --arm-default-cpu=sa1100
./m68k-linux-user/qemu-m68k -cpu ?
>m5206
m5208
cfv4e
any
./arm-linux-user/qemu-arm -cpu ?
Available CPUs:
arm926
arm946
arm1026
arm1136
arm1136-r2
arm1176
arm11mpcore
cortex-m3
cortex-a8
cortex-a9
ti925t
pxa250
>sa1100
sa1110
pxa255
pxa260
pxa261
pxa262
pxa270
pxa270-a0
pxa270-a1
pxa270-b0
pxa270-b1
pxa270-c0
pxa270-c5
any
[PATCH 1/4] linux-user: define default cpu model in configure
[PATCH 2/4] linux-user: specify the cpu model during configure
[PATCH 3/4] linux-user,m68k: display default cpu
[PATCH 4/4] linux-user,arm: display default cpu
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c
2012-01-22 12:27 [Qemu-devel] [PATCH 0/4] linux-user: A serie of patches to set default CPU Laurent Vivier
@ 2012-01-22 12:27 ` Laurent Vivier
0 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2012-01-22 12:27 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier
From: Laurent Vivier <Laurent@Vivier.EU>
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
configure | 14 ++++++++++++++
linux-user/main.c | 34 +---------------------------------
2 files changed, 15 insertions(+), 33 deletions(-)
diff --git a/configure b/configure
index 467e87b..c251df2 100755
--- a/configure
+++ b/configure
@@ -3313,6 +3313,7 @@ target_dir="$target"
config_target_mak=$target_dir/config-target.mak
target_arch2=`echo $target | cut -d '-' -f 1`
target_bigendian="no"
+target_default_cpu="any"
case "$target_arch2" in
armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
@@ -3388,11 +3389,13 @@ TARGET_ABI_DIR=""
case "$target_arch2" in
i386)
target_phys_bits=64
+ target_default_cpu="qemu32"
;;
x86_64)
TARGET_BASE_ARCH=i386
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="qemu64"
;;
alpha)
target_phys_bits=64
@@ -3435,12 +3438,14 @@ case "$target_arch2" in
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
target_nptl="yes"
target_phys_bits=64
+ target_default_cpu="24Kf"
;;
mipsn32|mipsn32el)
TARGET_ARCH=mipsn32
TARGET_BASE_ARCH=mips
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
target_phys_bits=64
+ target_default_cpu="20Kc"
;;
mips64|mips64el)
TARGET_ARCH=mips64
@@ -3448,12 +3453,14 @@ case "$target_arch2" in
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="20Kc"
;;
ppc)
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
target_phys_bits=64
target_nptl="yes"
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
ppcemb)
TARGET_BASE_ARCH=ppc
@@ -3462,6 +3469,7 @@ case "$target_arch2" in
target_phys_bits=64
target_nptl="yes"
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
ppc64)
TARGET_BASE_ARCH=ppc
@@ -3470,6 +3478,7 @@ case "$target_arch2" in
target_phys_bits=64
target_long_alignment=8
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="970fx"
;;
ppc64abi32)
TARGET_ARCH=ppc64
@@ -3479,6 +3488,7 @@ case "$target_arch2" in
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
target_phys_bits=64
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
sh4|sh4eb)
TARGET_ARCH=sh4
@@ -3488,11 +3498,13 @@ case "$target_arch2" in
;;
sparc)
target_phys_bits=64
+ target_default_cpu="Fujitsu MB86904"
;;
sparc64)
TARGET_BASE_ARCH=sparc
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="TI UltraSparc II"
;;
sparc32plus)
TARGET_ARCH=sparc64
@@ -3500,6 +3512,7 @@ case "$target_arch2" in
TARGET_ABI_DIR=sparc
echo "TARGET_ABI32=y" >> $config_target_mak
target_phys_bits=64
+ target_default_cpu="Fujitsu MB86904"
;;
s390x)
target_nptl="yes"
@@ -3522,6 +3535,7 @@ echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
+echo "TARGET_DEFAULT_CPU=\"$target_default_cpu\"" >> $config_target_mak
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
echo "TARGET_$target_arch_name=y" >> $config_target_mak
diff --git a/linux-user/main.c b/linux-user/main.c
index 64d2208..25dc0eb 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3322,39 +3322,7 @@ int main(int argc, char **argv, char **envp)
init_paths(interp_prefix);
if (cpu_model == NULL) {
-#if defined(TARGET_I386)
-#ifdef TARGET_X86_64
- cpu_model = "qemu64";
-#else
- cpu_model = "qemu32";
-#endif
-#elif defined(TARGET_ARM)
- cpu_model = "any";
-#elif defined(TARGET_UNICORE32)
- cpu_model = "any";
-#elif defined(TARGET_M68K)
- cpu_model = "any";
-#elif defined(TARGET_SPARC)
-#ifdef TARGET_SPARC64
- cpu_model = "TI UltraSparc II";
-#else
- cpu_model = "Fujitsu MB86904";
-#endif
-#elif defined(TARGET_MIPS)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
- cpu_model = "20Kc";
-#else
- cpu_model = "24Kf";
-#endif
-#elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
- cpu_model = "970fx";
-#else
- cpu_model = "750";
-#endif
-#else
- cpu_model = "any";
-#endif
+ cpu_model = TARGET_DEFAULT_CPU;
}
tcg_exec_init(0);
cpu_exec_init_all();
--
1.7.5.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 0/4] Set of patches for chrooted environment
@ 2011-09-18 9:37 Laurent Vivier
2011-09-18 9:37 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Vivier @ 2011-09-18 9:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio
This set of patches helps to use qemu-linux-user in a chrooted environment.
It mostly allows to define the default cpu model as we can't use '-cpu' argument.
The last one defines enviromnent variables to be able to use log file and
gdb server ('-d' and '-g' arguments).
[PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c
[PATCH 2/4] linux-user: specify the cpu model during configure
[PATCH 3/4] linux-user,m68k: display default cpu
[PATCH 4/4] linux-user: define new environment variables
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c
2011-09-18 9:37 [Qemu-devel] [PATCH 0/4] Set of patches for chrooted environment Laurent Vivier
@ 2011-09-18 9:37 ` Laurent Vivier
0 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2011-09-18 9:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
From: Laurent Vivier <Laurent@Vivier.EU>
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
configure | 14 ++++++++++++++
linux-user/main.c | 34 +---------------------------------
2 files changed, 15 insertions(+), 33 deletions(-)
diff --git a/configure b/configure
index ad924c4..5e10055 100755
--- a/configure
+++ b/configure
@@ -3150,6 +3150,7 @@ target_dir="$target"
config_target_mak=$target_dir/config-target.mak
target_arch2=`echo $target | cut -d '-' -f 1`
target_bigendian="no"
+target_default_cpu="any"
case "$target_arch2" in
armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
@@ -3226,11 +3227,13 @@ TARGET_ABI_DIR=""
case "$target_arch2" in
i386)
target_phys_bits=64
+ target_default_cpu="qemu32"
;;
x86_64)
TARGET_BASE_ARCH=i386
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="qemu64"
;;
alpha)
target_phys_bits=64
@@ -3273,12 +3276,14 @@ case "$target_arch2" in
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
target_nptl="yes"
target_phys_bits=64
+ target_default_cpu="24Kf"
;;
mipsn32|mipsn32el)
TARGET_ARCH=mipsn32
TARGET_BASE_ARCH=mips
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
target_phys_bits=64
+ target_default_cpu="20Kc"
;;
mips64|mips64el)
TARGET_ARCH=mips64
@@ -3286,12 +3291,14 @@ case "$target_arch2" in
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="20Kc"
;;
ppc)
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
target_phys_bits=32
target_nptl="yes"
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
ppcemb)
TARGET_BASE_ARCH=ppc
@@ -3300,6 +3307,7 @@ case "$target_arch2" in
target_phys_bits=64
target_nptl="yes"
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
ppc64)
TARGET_BASE_ARCH=ppc
@@ -3308,6 +3316,7 @@ case "$target_arch2" in
target_phys_bits=64
target_long_alignment=8
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="970fx"
;;
ppc64abi32)
TARGET_ARCH=ppc64
@@ -3317,6 +3326,7 @@ case "$target_arch2" in
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
target_phys_bits=64
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
sh4|sh4eb)
TARGET_ARCH=sh4
@@ -3326,11 +3336,13 @@ case "$target_arch2" in
;;
sparc)
target_phys_bits=64
+ target_default_cpu="Fujitsu MB86904"
;;
sparc64)
TARGET_BASE_ARCH=sparc
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="TI UltraSparc II"
;;
sparc32plus)
TARGET_ARCH=sparc64
@@ -3338,6 +3350,7 @@ case "$target_arch2" in
TARGET_ABI_DIR=sparc
echo "TARGET_ABI32=y" >> $config_target_mak
target_phys_bits=64
+ target_default_cpu="Fujitsu MB86904"
;;
s390x)
target_nptl="yes"
@@ -3360,6 +3373,7 @@ echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
+echo "TARGET_DEFAULT_CPU=\"$target_default_cpu\"" >> $config_target_mak
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
echo "TARGET_$target_arch_name=y" >> $config_target_mak
diff --git a/linux-user/main.c b/linux-user/main.c
index 89a51d7..40d76b4 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3090,39 +3090,7 @@ int main(int argc, char **argv, char **envp)
init_paths(interp_prefix);
if (cpu_model == NULL) {
-#if defined(TARGET_I386)
-#ifdef TARGET_X86_64
- cpu_model = "qemu64";
-#else
- cpu_model = "qemu32";
-#endif
-#elif defined(TARGET_ARM)
- cpu_model = "any";
-#elif defined(TARGET_UNICORE32)
- cpu_model = "any";
-#elif defined(TARGET_M68K)
- cpu_model = "any";
-#elif defined(TARGET_SPARC)
-#ifdef TARGET_SPARC64
- cpu_model = "TI UltraSparc II";
-#else
- cpu_model = "Fujitsu MB86904";
-#endif
-#elif defined(TARGET_MIPS)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
- cpu_model = "20Kc";
-#else
- cpu_model = "24Kf";
-#endif
-#elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
- cpu_model = "970fx";
-#else
- cpu_model = "750";
-#endif
-#else
- cpu_model = "any";
-#endif
+ cpu_model = TARGET_DEFAULT_CPU;
}
tcg_exec_init(0);
cpu_exec_init_all();
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 0/4] Set of patches for chrooted environment
@ 2011-07-28 13:37 Laurent Vivier
2011-07-28 13:37 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Vivier @ 2011-07-28 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio
This set of patches helps to use qemu-linux-user in a chrooted environment.
It mostly allows to define the default cpu model as we can't use '-cpu' argument.
The last one defines enviromnent variables to be able to use log file and
gdb server ('-d' and '-g' arguments).
NOTE: I saw some comments in the mailing list about environment variables,
if patch #4 dislikes, I've also a patch providing a "qemu-wrapper" with the same behavior.
[PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c
[PATCH 2/4] linux-user: specify the cpu model during configure
[PATCH 3/4] linux-user,m68k: display default cpu
[PATCH 4/4] linux-user: define new environment variables
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c
2011-07-28 13:37 [Qemu-devel] [PATCH 0/4] Set of patches for chrooted environment Laurent Vivier
@ 2011-07-28 13:37 ` Laurent Vivier
0 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2011-07-28 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
---
configure | 15 +++++++++++++++
linux-user/main.c | 34 +---------------------------------
2 files changed, 16 insertions(+), 33 deletions(-)
diff --git a/configure b/configure
index fb8819b..c74a5f9 100755
--- a/configure
+++ b/configure
@@ -3075,6 +3075,7 @@ target_dir="$target"
config_target_mak=$target_dir/config-target.mak
target_arch2=`echo $target | cut -d '-' -f 1`
target_bigendian="no"
+target_default_cpu="any"
case "$target_arch2" in
armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
@@ -3151,11 +3152,13 @@ TARGET_ABI_DIR=""
case "$target_arch2" in
i386)
target_phys_bits=64
+ target_default_cpu="qemu32"
;;
x86_64)
TARGET_BASE_ARCH=i386
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="qemu64"
;;
alpha)
target_phys_bits=64
@@ -3173,6 +3176,7 @@ case "$target_arch2" in
cris)
target_nptl="yes"
target_phys_bits=32
+ target_default_cpu=""
;;
lm32)
target_phys_bits=32
@@ -3198,12 +3202,14 @@ case "$target_arch2" in
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
target_nptl="yes"
target_phys_bits=64
+ target_default_cpu="24Kf"
;;
mipsn32|mipsn32el)
TARGET_ARCH=mipsn32
TARGET_BASE_ARCH=mips
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
target_phys_bits=64
+ target_default_cpu="20Kc"
;;
mips64|mips64el)
TARGET_ARCH=mips64
@@ -3211,12 +3217,14 @@ case "$target_arch2" in
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="20Kc"
;;
ppc)
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
target_phys_bits=32
target_nptl="yes"
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
ppcemb)
TARGET_BASE_ARCH=ppc
@@ -3225,6 +3233,7 @@ case "$target_arch2" in
target_phys_bits=64
target_nptl="yes"
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
ppc64)
TARGET_BASE_ARCH=ppc
@@ -3233,6 +3242,7 @@ case "$target_arch2" in
target_phys_bits=64
target_long_alignment=8
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="970fx"
;;
ppc64abi32)
TARGET_ARCH=ppc64
@@ -3242,6 +3252,7 @@ case "$target_arch2" in
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
target_phys_bits=64
target_libs_softmmu="$fdt_libs"
+ target_default_cpu="750"
;;
sh4|sh4eb)
TARGET_ARCH=sh4
@@ -3251,11 +3262,13 @@ case "$target_arch2" in
;;
sparc)
target_phys_bits=64
+ target_default_cpu="Fujitsu MB86904"
;;
sparc64)
TARGET_BASE_ARCH=sparc
target_phys_bits=64
target_long_alignment=8
+ target_default_cpu="TI UltraSparc II"
;;
sparc32plus)
TARGET_ARCH=sparc64
@@ -3263,6 +3276,7 @@ case "$target_arch2" in
TARGET_ABI_DIR=sparc
echo "TARGET_ABI32=y" >> $config_target_mak
target_phys_bits=64
+ target_default_cpu="Fujitsu MB86904"
;;
s390x)
target_nptl="yes"
@@ -3281,6 +3295,7 @@ echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
+echo "TARGET_DEFAULT_CPU=\"$target_default_cpu\"" >> $config_target_mak
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
echo "TARGET_$target_arch_name=y" >> $config_target_mak
diff --git a/linux-user/main.c b/linux-user/main.c
index 2135b9c..7180cee 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3082,39 +3082,7 @@ int main(int argc, char **argv, char **envp)
init_paths(interp_prefix);
if (cpu_model == NULL) {
-#if defined(TARGET_I386)
-#ifdef TARGET_X86_64
- cpu_model = "qemu64";
-#else
- cpu_model = "qemu32";
-#endif
-#elif defined(TARGET_ARM)
- cpu_model = "any";
-#elif defined(TARGET_UNICORE32)
- cpu_model = "any";
-#elif defined(TARGET_M68K)
- cpu_model = "any";
-#elif defined(TARGET_SPARC)
-#ifdef TARGET_SPARC64
- cpu_model = "TI UltraSparc II";
-#else
- cpu_model = "Fujitsu MB86904";
-#endif
-#elif defined(TARGET_MIPS)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
- cpu_model = "20Kc";
-#else
- cpu_model = "24Kf";
-#endif
-#elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
- cpu_model = "970fx";
-#else
- cpu_model = "750";
-#endif
-#else
- cpu_model = "any";
-#endif
+ cpu_model = TARGET_DEFAULT_CPU;
}
cpu_exec_init_all(0);
/* NOTE: we need to init the CPU at this stage to get
--
1.7.4.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-09-10 8:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 20:47 [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 2/4] linux-user: specify the cpu model during configure Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 3/4] linux-user,m68k: display default cpu Laurent Vivier
2013-09-06 20:47 ` [Qemu-devel] [PATCH 4/4] linux-user,arm: " Laurent Vivier
2013-09-07 8:43 ` [Qemu-devel] [PATCH 0/4] Define default CPU at configure time Peter Maydell
2013-09-07 9:13 ` Laurent Vivier
2013-09-07 9:19 ` Peter Maydell
2013-09-09 19:23 ` Richard Henderson
2013-09-10 7:13 ` Laurent Vivier
2013-09-10 8:40 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2012-01-22 12:27 [Qemu-devel] [PATCH 0/4] linux-user: A serie of patches to set default CPU Laurent Vivier
2012-01-22 12:27 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
2011-09-18 9:37 [Qemu-devel] [PATCH 0/4] Set of patches for chrooted environment Laurent Vivier
2011-09-18 9:37 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
2011-07-28 13:37 [Qemu-devel] [PATCH 0/4] Set of patches for chrooted environment Laurent Vivier
2011-07-28 13:37 ` [Qemu-devel] [PATCH 1/4] linux-user: define default cpu model in configure instead of linux-user/main.c Laurent Vivier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).