qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: stefano.stabellini@eu.citrix.com
Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 1/4] xen: introduce mc146818rtcxen
Date: Tue, 15 Nov 2011 08:54:05 -0600	[thread overview]
Message-ID: <4EC27D0D.3040204@codemonkey.ws> (raw)
In-Reply-To: <1321368671-1134-1-git-send-email-stefano.stabellini@eu.citrix.com>

On 11/15/2011 08:51 AM, stefano.stabellini@eu.citrix.com wrote:
> From: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
>
> Xen doesn't need full RTC emulation in Qemu because the RTC is already
> emulated by the hypervisor. In particular we want to avoid the timers
> initialization so that Qemu doesn't need to wake up needlessly.
>
> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>

Yuck.  There's got to be a better way to do this.

I think it would be better to name timers and then in Xen specific machine code, 
disable the RTC timers.

Regards,

Anthony Liguori

> ---
>   hw/mc146818rtc.c |   36 +++++++++++++++++++++++++++++++++++-
>   1 files changed, 35 insertions(+), 1 deletions(-)
>
> diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
> index 2aaca2f..91242d0 100644
> --- a/hw/mc146818rtc.c
> +++ b/hw/mc146818rtc.c
> @@ -28,6 +28,7 @@
>   #include "apic.h"
>   #include "isa.h"
>   #include "mc146818rtc.h"
> +#include "arch_init.h"
>
>   //#define DEBUG_CMOS
>   //#define DEBUG_COALESCED
> @@ -614,6 +615,17 @@ static const MemoryRegionOps cmos_ops = {
>       .old_portio = cmos_portio
>   };
>
> +static int rtcxen_initfn(ISADevice *dev)
> +{
> +    int base = 0x70;
> +    RTCState *s = DO_UPCAST(RTCState, dev, dev);
> +
> +    memory_region_init_io(&s->io,&cmos_ops, s, "rtc", 2);
> +    isa_register_ioport(dev,&s->io, base);
> +
> +    return 0;
> +}
> +
>   static int rtc_initfn(ISADevice *dev)
>   {
>       RTCState *s = DO_UPCAST(RTCState, dev, dev);
> @@ -655,7 +667,11 @@ ISADevice *rtc_init(int base_year, qemu_irq intercept_irq)
>       ISADevice *dev;
>       RTCState *s;
>
> -    dev = isa_create("mc146818rtc");
> +    if (xen_available()) {
> +        dev = isa_create("mc146818rtcxen");
> +    } else {
> +        dev = isa_create("mc146818rtc");
> +    }
>       s = DO_UPCAST(RTCState, dev, dev);
>       qdev_prop_set_int32(&dev->qdev, "base_year", base_year);
>       qdev_init_nofail(&dev->qdev);
> @@ -684,3 +700,21 @@ static void mc146818rtc_register(void)
>       isa_qdev_register(&mc146818rtc_info);
>   }
>   device_init(mc146818rtc_register)
> +
> +static ISADeviceInfo mc146818rtcxen_info = {
> +    .qdev.name     = "mc146818rtcxen",
> +    .qdev.size     = sizeof(RTCState),
> +    .qdev.no_user  = 1,
> +    .qdev.vmsd     =&vmstate_rtc,
> +    .init          = rtcxen_initfn,
> +    .qdev.props    = (Property[]) {
> +        DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
> +        DEFINE_PROP_END_OF_LIST(),
> +    }
> +};
> +
> +static void mc146818rtcxen_register(void)
> +{
> +    isa_qdev_register(&mc146818rtcxen_info);
> +}
> +device_init(mc146818rtcxen_register)

  reply	other threads:[~2011-11-15 14:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 14:48 [Qemu-devel] [PATCH 0/4] prevent Qemu from waking up needlessly Stefano Stabellini
2011-11-15 14:51 ` [Qemu-devel] [PATCH 1/4] xen: introduce mc146818rtcxen stefano.stabellini
2011-11-15 14:54   ` Anthony Liguori [this message]
2011-11-15 16:57     ` Stefano Stabellini
2011-11-18 11:46       ` Stefano Stabellini
2011-11-18 13:58         ` Anthony Liguori
2011-11-18 14:54         ` Anthony Liguori
2011-11-20 14:53           ` Avi Kivity
2011-11-21 20:49             ` Anthony Liguori
2011-11-21 11:05           ` Stefano Stabellini
2011-11-21 13:21           ` Paolo Bonzini
2011-11-15 14:51 ` [Qemu-devel] [PATCH 2/4] xen: do not initialize the interval timer emulator stefano.stabellini
2011-11-15 14:51 ` [Qemu-devel] [PATCH 3/4] xen: introduce an event channel for buffered io event notifications stefano.stabellini
2011-11-15 17:13   ` [Qemu-devel] [Xen-devel] " Ian Campbell
2011-11-15 17:20     ` Stefano Stabellini
2011-11-15 17:24       ` Ian Campbell
2011-11-15 14:51 ` [Qemu-devel] [PATCH 4/4] qemu_calculate_timeout: increase minimum timeout to 1h stefano.stabellini

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=4EC27D0D.3040204@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).