qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@linux.vnet.ibm.com>
To: "Roedel, Joerg" <Joerg.Roedel@amd.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Alexander Graf <agraf@suse.de>, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] Re: [PATCH 1/3] Make kvm64 the default cpu model when kvm_enabled()
Date: Mon, 18 Oct 2010 09:16:07 -0500	[thread overview]
Message-ID: <4CBC56A7.7020305@linux.vnet.ibm.com> (raw)
In-Reply-To: <20101018082230.GB1890@amd.com>

On 10/18/2010 03:22 AM, Roedel, Joerg wrote:
> (Sorry for the late reply)
>
> On Thu, Oct 07, 2010 at 08:48:06AM -0400, Anthony Liguori wrote:
>    
>> On 10/07/2010 03:42 AM, Roedel, Joerg wrote:
>>      
>>> On Wed, Oct 06, 2010 at 03:24:59PM -0400, Anthony Liguori wrote:
>>>
>>>        
>>>>>> +    qemu_compat_version = machine->compat_version;
>>>>>> +
>>>>>>         if (display_type == DT_NOGRAPHIC) {
>>>>>>             if (default_parallel)
>>>>>>                 add_device_config(DEV_PARALLEL, "null");
>>>>>> -- 
>>>>>> 1.7.0.4
>>>>>>
>>>>>>
>>>>>>              
>>>>> Looks fine to me, given CPUs are not in qdev. Anthony?
>>>>>
>>>>>
>>>>>            
>>>> The idea is fine, but why not just add the default CPU to the machine
>>>> description?
>>>>
>>>>          
>>> If I remember correctly the reason was that the machine description was
>>> not accessible in the cpuid initialization path because it is a function
>>> local variable.
>>>        
>> Not tested at all but I think the attached patch addresses it in a
>> pretty nice way.
>>
>> There's a couple ways you could support your patch on top of this.  You
>> could add a kvm_cpu_model to the machine structure that gets defaulted
>> too if kvm_enabled().  You could also introduce a new KVM machine type
>> that gets defaulted to if no explicit machine is specified.
>>      
> I had something similar in mind but then I realized that we need at
> least a cpu_model and a cpu_model_kvm to distinguish between the TCG and
> the KVM case.
>    

I would think that having different default machines for KVM and TCG 
would be a better solution.

> Further the QEMUMachine data structure is used for all architectures in
> QEMU and the model-names only make sense for x86.

SPARC uses cpu_model too FWIW.  I believe Blue Swirl has even discussed 
using a feature-format similar to how x86 does it for SPARC CPUs.

Regards,

Anthony Liguori

>   So I decided for the
> comapt-version way (which doesn't mean I object against this one ;-) )
>
> 	Joerg
>
>    
>>  From d2370c88cef4b07d48ba3c4804e35ae2db8db7c0 Mon Sep 17 00:00:00 2001
>> From: Anthony Liguori<aliguori@us.ibm.com>
>> Date: Thu, 7 Oct 2010 07:43:42 -0500
>> Subject: [PATCH] machine: make default cpu model part of machine structure
>>
>> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
>>
>> diff --git a/hw/boards.h b/hw/boards.h
>> index 6f0f0d7..8c6ef27 100644
>> --- a/hw/boards.h
>> +++ b/hw/boards.h
>> @@ -16,6 +16,7 @@ typedef struct QEMUMachine {
>>       const char *name;
>>       const char *alias;
>>       const char *desc;
>> +    const char *cpu_model;
>>       QEMUMachineInitFunc *init;
>>       int use_scsi;
>>       int max_cpus;
>> diff --git a/hw/pc.c b/hw/pc.c
>> index 69b13bf..0826107 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -866,14 +866,6 @@ void pc_cpus_init(const char *cpu_model)
>>       int i;
>>
>>       /* init CPUs */
>> -    if (cpu_model == NULL) {
>> -#ifdef TARGET_X86_64
>> -        cpu_model = "qemu64";
>> -#else
>> -        cpu_model = "qemu32";
>> -#endif
>> -    }
>> -
>>       for(i = 0; i<  smp_cpus; i++) {
>>           pc_new_cpu(cpu_model);
>>       }
>> diff --git a/hw/pc_piix.c b/hw/pc_piix.c
>> index 12359a7..919b4d6 100644
>> --- a/hw/pc_piix.c
>> +++ b/hw/pc_piix.c
>> @@ -204,17 +204,22 @@ static void pc_init_isa(ram_addr_t ram_size,
>>                           const char *initrd_filename,
>>                           const char *cpu_model)
>>   {
>> -    if (cpu_model == NULL)
>> -        cpu_model = "486";
>>       pc_init1(ram_size, boot_device,
>>                kernel_filename, kernel_cmdline,
>>                initrd_filename, cpu_model, 0);
>>   }
>>
>> +#ifdef TARGET_X86_64
>> +#define DEF_CPU_MODEL "qemu64"
>> +#else
>> +#define DEF_CPU_MODEL "qemu32"
>> +#endif
>> +
>>   static QEMUMachine pc_machine = {
>>       .name = "pc-0.13",
>>       .alias = "pc",
>>       .desc = "Standard PC",
>> +    .cpu_model = DEF_CPU_MODEL,
>>       .init = pc_init_pci,
>>       .max_cpus = 255,
>>       .is_default = 1,
>> @@ -223,6 +228,7 @@ static QEMUMachine pc_machine = {
>>   static QEMUMachine pc_machine_v0_12 = {
>>       .name = "pc-0.12",
>>       .desc = "Standard PC",
>> +    .cpu_model = DEF_CPU_MODEL,
>>       .init = pc_init_pci,
>>       .max_cpus = 255,
>>       .compat_props = (GlobalProperty[]) {
>> @@ -242,6 +248,7 @@ static QEMUMachine pc_machine_v0_12 = {
>>   static QEMUMachine pc_machine_v0_11 = {
>>       .name = "pc-0.11",
>>       .desc = "Standard PC, qemu 0.11",
>> +    .cpu_model = DEF_CPU_MODEL,
>>       .init = pc_init_pci,
>>       .max_cpus = 255,
>>       .compat_props = (GlobalProperty[]) {
>> @@ -277,6 +284,7 @@ static QEMUMachine pc_machine_v0_11 = {
>>   static QEMUMachine pc_machine_v0_10 = {
>>       .name = "pc-0.10",
>>       .desc = "Standard PC, qemu 0.10",
>> +    .cpu_model = DEF_CPU_MODEL,
>>       .init = pc_init_pci,
>>       .max_cpus = 255,
>>       .compat_props = (GlobalProperty[]) {
>> @@ -324,6 +332,7 @@ static QEMUMachine pc_machine_v0_10 = {
>>   static QEMUMachine isapc_machine = {
>>       .name = "isapc",
>>       .desc = "ISA-only PC",
>> +    .cpu_model = "486",
>>       .init = pc_init_isa,
>>       .max_cpus = 1,
>>   };
>> diff --git a/vl.c b/vl.c
>> index df414ef..3a55cc8 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -2904,6 +2904,10 @@ int main(int argc, char **argv, char **envp)
>>       }
>>       qemu_add_globals();
>>
>> +    if (cpu_model == NULL) {
>> +        cpu_model = machine->cpu_model;
>> +    }
>> +
>>       machine->init(ram_size, boot_devices,
>>                     kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
>>
>> -- 
>> 1.7.0.4
>>
>>      
>
>    

  reply	other threads:[~2010-10-18 18:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-27 13:16 [Qemu-devel] [PATCH 0/3] SVM feature support for qemu v3 Joerg Roedel
2010-09-27 13:16 ` [Qemu-devel] [PATCH 1/3] Make kvm64 the default cpu model when kvm_enabled() Joerg Roedel
2010-10-06 18:53   ` [Qemu-devel] " Marcelo Tosatti
2010-10-06 19:24     ` Anthony Liguori
2010-10-07  8:42       ` Roedel, Joerg
2010-10-07 12:48         ` Anthony Liguori
2010-10-18  8:22           ` Roedel, Joerg
2010-10-18 14:16             ` Anthony Liguori [this message]
2010-10-20 15:53               ` Blue Swirl
2010-09-27 13:16 ` [Qemu-devel] [PATCH 2/3] Set cpuid definition to 0 before initializing it Joerg Roedel
2010-09-27 13:16 ` [Qemu-devel] [PATCH 3/3] Add svm cpuid features Joerg Roedel
2010-09-27 14:58   ` [Qemu-devel] " Avi Kivity
2010-09-27 15:02     ` Avi Kivity
2010-09-27 15:40       ` Roedel, Joerg
2010-09-27 16:22         ` Avi Kivity
2010-09-28  9:28           ` Roedel, Joerg
2010-09-28  9:37             ` Avi Kivity
2010-09-28 10:05               ` Roedel, Joerg
2010-09-28 10:16                 ` Avi Kivity
2010-10-06 18:57                 ` Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2010-09-14 15:52 [Qemu-devel] [PATCH 0/3] SVM feature support for qemu Joerg Roedel
2010-09-14 15:52 ` [Qemu-devel] [PATCH 1/3] Make kvm64 the default cpu model when kvm_enabled() Joerg Roedel
2010-09-14 15:58   ` [Qemu-devel] " Alexander Graf
2010-09-14 16:21     ` Roedel, Joerg
2010-09-16 14:03   ` Avi Kivity
2010-09-16 14:21     ` Roedel, Joerg
2010-09-16 14:22       ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CBC56A7.7020305@linux.vnet.ibm.com \
    --to=aliguori@linux.vnet.ibm.com \
    --cc=Joerg.Roedel@amd.com \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).