qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "aliguori@us.ibm.com" <aliguori@us.ibm.com>,
	"ehabkost@redhat.com" <ehabkost@redhat.com>,
	"sw@weilnetz.de" <sw@weilnetz.de>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"blauwirbel@gmail.com" <blauwirbel@gmail.com>,
	"avi@redhat.com" <avi@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"afaerber@suse.de" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH qom-next 3/5] pc: move apic_mapped initialization into common apic init code
Date: Tue, 22 May 2012 14:42:31 +0200	[thread overview]
Message-ID: <4FBB89B7.50704@redhat.com> (raw)
In-Reply-To: <4FBB6EFA.5080001@siemens.com>

On 05/22/2012 12:48 PM, Jan Kiszka wrote:
> On 2012-05-22 07:35, Igor Mammedov wrote:
>> Move from apic_init in pc.c  the code that belongs to apic_init_common
>> and create/init apic in pc_new_cpu instead of separate func.
>>
>> Signed-off-by: Igor Mammedov<imammedo@redhat.com>
>> ---
>>   hw/apic_common.c |   16 ++++++++++++++++
>>   hw/msi.h         |    2 ++
>>   hw/pc.c          |   47 ++++++++---------------------------------------
>>   3 files changed, 26 insertions(+), 39 deletions(-)
>>
>> diff --git a/hw/apic_common.c b/hw/apic_common.c
>> index 23d51e8..703931b 100644
>> --- a/hw/apic_common.c
>> +++ b/hw/apic_common.c
>> @@ -21,6 +21,7 @@
>>   #include "apic_internal.h"
>>   #include "trace.h"
>>   #include "kvm.h"
>> +#include "msi.h"
>>
>>   static int apic_irq_delivered;
>>   bool apic_report_tpr_access;
>> @@ -284,6 +285,7 @@ static int apic_init_common(SysBusDevice *dev)
>>       APICCommonClass *info;
>>       static DeviceState *vapic;
>>       static int apic_no;
>> +    static int apic_mapped;
>>
>>       if (apic_no>= MAX_APICS) {
>>           return -1;
>> @@ -295,6 +297,20 @@ static int apic_init_common(SysBusDevice *dev)
>>
>>       sysbus_init_mmio(dev,&s->io_memory);
>>
>> +    /* XXX: mapping more APICs at the same memory location */
>> +    if (apic_mapped == 0) {
>> +        /* NOTE: the APIC is directly connected to the CPU - it is not
>> +           on the global memory bus. */
>> +        /* XXX: what if the base changes? */
>> +        sysbus_mmio_map(sysbus_from_qdev(&s->busdev.qdev), 0, MSI_ADDR_BASE);
>> +        apic_mapped = 1;
>> +    }
>> +
>> +    /* KVM does not support MSI yet. */
>> +    if (!kvm_irqchip_in_kernel()) {
>> +        msi_supported = true;
>> +    }
>> +
>>       if (!vapic&&  s->vapic_control&  VAPIC_ENABLE_MASK) {
>>           vapic = sysbus_create_simple("kvmvapic", -1, NULL);
>>       }
>> diff --git a/hw/msi.h b/hw/msi.h
>> index 3040bb0..abd52b6 100644
>> --- a/hw/msi.h
>> +++ b/hw/msi.h
>> @@ -40,4 +40,6 @@ static inline bool msi_present(const PCIDevice *dev)
>>       return dev->cap_present&  QEMU_PCI_CAP_MSI;
>>   }
>>
>> +#define MSI_ADDR_BASE 0xfee00000
>> +
>>   #endif /* QEMU_MSI_H */
>> diff --git a/hw/pc.c b/hw/pc.c
>> index 00d738d..0eb0b73 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -879,44 +879,6 @@ DeviceState *cpu_get_current_apic(void)
>>       }
>>   }
>>
>> -static DeviceState *apic_init(void *env, uint8_t apic_id)
>> -{
>> -    DeviceState *dev;
>> -    static int apic_mapped;
>> -
>> -    if (kvm_irqchip_in_kernel()) {
>> -        dev = qdev_create(NULL, "kvm-apic");
>> -    } else if (xen_enabled()) {
>> -        dev = qdev_create(NULL, "xen-apic");
>> -    } else {
>> -        dev = qdev_create(NULL, "apic");
>> -    }
>> -
>> -    qdev_prop_set_uint8(dev, "id", apic_id);
>> -    qdev_prop_set_ptr(dev, "cpu_env", env);
>> -    qdev_init_nofail(dev);
>> -
>> -    /* XXX: mapping more APICs at the same memory location */
>> -    if (apic_mapped == 0) {
>> -        /* NOTE: the APIC is directly connected to the CPU - it is not
>> -           on the global memory bus. */
>> -        /* XXX: what if the base changes? */
>> -        sysbus_mmio_map(sysbus_from_qdev(dev), 0, MSI_ADDR_BASE);
>
> While at it, you should drop MSI_ADDR_BASE definition from pc.c.

Consider it done.

>
>> -        apic_mapped = 1;
>> -    }
>> -
>> -    /* KVM does not support MSI yet. */
>> -    if (!kvm_irqchip_in_kernel()) {
>> -        msi_supported = true;
>> -    }
>> -
>> -    if (xen_msi_support()) {
>> -        msi_supported = true;
>> -    }
>> -
>> -    return dev;
>> -}
>> -
>
> You are loosing some xen bits here. But this will collide with latest
> kvm pull request
> (http://thread.gmane.org/gmane.comp.emulators.kvm.devel/91171) anyway.
> You may want to base on uq/master.
>

This patchset is based on Andreas' qom-next tree. Probably I should wait
till above mentioned kvm pull is pulled in and it aprears in qom-next.

...

-- 
-----
Thanks,
   Igor

  reply	other threads:[~2012-05-22 12:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 10:35 [Qemu-devel] [PATCH qom-next 0/5] target-i386: re-factor CPU creation/initialization to QOM Igor Mammedov
2012-05-22 10:35 ` [Qemu-devel] [PATCH qom-next 1/5] target-i386: move cpu halted decision into x86_cpu_reset Igor Mammedov
2012-05-22 10:59   ` Peter Maydell
2012-05-22 12:34     ` Igor Mammedov
2012-05-22 10:35 ` [Qemu-devel] [PATCH qom-next 2/5] target-i386: add cpu-model property to x86_cpu Igor Mammedov
2012-05-22 10:35 ` [Qemu-devel] [PATCH qom-next 3/5] pc: move apic_mapped initialization into common apic init code Igor Mammedov
2012-05-22 10:48   ` Jan Kiszka
2012-05-22 12:42     ` Igor Mammedov [this message]
2012-05-22 14:24       ` Andreas Färber
2012-05-22 14:35         ` Jan Kiszka
2012-05-22 15:47         ` Paolo Bonzini
2012-05-23  9:17         ` Igor Mammedov
2012-05-22 10:51   ` Jan Kiszka
2012-05-22 10:35 ` [Qemu-devel] [PATCH qom-next 4/5] target-i386: make initialize CPU in QOM way Igor Mammedov
2012-05-22 10:56   ` Jan Kiszka
2012-05-22 12:47     ` Igor Mammedov
2012-05-22 10:35 ` [Qemu-devel] [PATCH qom-next 5/5] target-i386: move reset callback to cpu.c Igor Mammedov

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=4FBB89B7.50704@redhat.com \
    --to=imammedo@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).