From: "Michael S. Tsirkin" <mst@redhat.com>
To: liu ping fan <qemulist@gmail.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Anthony Liguori" <anthony@codemonkey.ws>,
"Jan Kiszka" <jan.kiszka@siemens.com>,
qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v5 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS
Date: Sun, 29 Sep 2013 07:20:21 +0300 [thread overview]
Message-ID: <20130929042021.GA28311@redhat.com> (raw)
In-Reply-To: <CAJnKYQkg9xmFB8YVHTQW0WRqdAmNf+ZR3EtcRT5JcuxUvyEj6w@mail.gmail.com>
On Sun, Sep 29, 2013 at 11:25:24AM +0800, liu ping fan wrote:
> On Sun, Sep 29, 2013 at 3:52 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Thu, Sep 12, 2013 at 11:25:14AM +0800, Liu Ping Fan wrote:
> >> According to hpet spec, hpet irq is high active. But according to
> >> ICH spec, there is inversion before the input of ioapic. So the OS
> >> will expect low active on this IRQ line.
> >
> >
> >>(And this is observed on
> >> bare metal).
> >
> > How does one test this on bare metal?
> >
> If changing the func hpet_timer_set_irq() in linux's hpet driver,
> from acpi_register_gsi(NULL, irq, ACPI_LEVEL_SENSITIVE,
> ACPI_ACTIVE_LOW); to ACPI_ACTIVE_HIGH, then run hpet_example.c on
> bare metal, the modified kernel will complain about spurious irq and
> disable the irq line.
ok that's useful info for the changelog.
> >>
> >> We fold the emulation of this inversion inside the hpet logic.
> >>
> >> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> >
> >
> > Doesn't this affect cross-version migration?
> > E.g. imagine that you migrate between systems
> > with/without this fix.
> >
> No. the changing only affect "route >= ISA_NUM_IRQS", For linux
> guest, it use IRQ2/8 for hpet0/hpet1 which is reserved by kernel. It
> work without this fix (I think windows is the same). But the
> hpet_example.c(in linux) can not work without this fix. So no such
> run-time instance before this bug fix.
>
> Regards,
> Pingfan
aha so the argument is it's already too broken to even mostly work,
we don't need to worry about migrating it to/from old qemu.
> >> ---
> >> hw/timer/hpet.c | 14 ++++++++++++--
> >> 1 file changed, 12 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> >> index fcd22ae..8429eb3 100644
> >> --- a/hw/timer/hpet.c
> >> +++ b/hw/timer/hpet.c
> >> @@ -198,13 +198,23 @@ static void update_irq(struct HPETTimer *timer, int set)
> >> if (!set || !timer_enabled(timer) || !hpet_enabled(timer->state)) {
> >> s->isr &= ~mask;
> >> if (!timer_fsb_route(timer)) {
> >> - qemu_irq_lower(s->irqs[route]);
> >> + /* fold the ICH PIRQ# pin's internal inversion logic into hpet */
> >> + if (route >= ISA_NUM_IRQS) {
> >> + qemu_irq_raise(s->irqs[route]);
> >> + } else {
> >> + qemu_irq_lower(s->irqs[route]);
> >> + }
> >> }
> >> } else if (timer_fsb_route(timer)) {
> >> stl_le_phys(timer->fsb >> 32, timer->fsb & 0xffffffff);
> >> } else if (timer->config & HPET_TN_TYPE_LEVEL) {
> >> s->isr |= mask;
> >> - qemu_irq_raise(s->irqs[route]);
> >> + /* fold the ICH PIRQ# pin's internal inversion logic into hpet */
> >> + if (route >= ISA_NUM_IRQS) {
> >> + qemu_irq_lower(s->irqs[route]);
> >> + } else {
> >> + qemu_irq_raise(s->irqs[route]);
> >> + }
> >> } else {
> >> s->isr &= ~mask;
> >> qemu_irq_pulse(s->irqs[route]);
> >> --
> >> 1.8.1.4
> >>
next prev parent reply other threads:[~2013-09-29 4:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 3:25 [Qemu-devel] [PATCH v5 0/5] bugs fix for hpet Liu Ping Fan
2013-09-12 3:25 ` [Qemu-devel] [PATCH v5 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS Liu Ping Fan
2013-09-28 19:52 ` Michael S. Tsirkin
2013-09-29 3:25 ` liu ping fan
2013-09-29 4:20 ` Michael S. Tsirkin [this message]
2013-09-30 8:04 ` liu ping fan
2013-09-12 3:25 ` [Qemu-devel] [PATCH v5 2/5] hpet: entitle more irq pins for hpet Liu Ping Fan
2013-09-28 19:56 ` Michael S. Tsirkin
2013-09-29 3:49 ` liu ping fan
2013-09-29 4:15 ` Michael S. Tsirkin
2013-09-30 8:02 ` liu ping fan
2013-09-30 9:06 ` Michael S. Tsirkin
2013-09-30 9:06 ` Paolo Bonzini
2013-09-30 9:30 ` Michael S. Tsirkin
2013-09-30 15:48 ` Paolo Bonzini
2013-09-30 15:58 ` Michael S. Tsirkin
2013-10-09 3:27 ` liu ping fan
2013-10-09 7:24 ` Michael S. Tsirkin
2013-10-09 7:41 ` Paolo Bonzini
2013-10-09 8:01 ` Michael S. Tsirkin
2013-10-09 8:41 ` Paolo Bonzini
2013-09-12 3:25 ` [Qemu-devel] [PATCH v5 3/5] PC: use qdev_xx to create hpet instead of sysbus_create_xx Liu Ping Fan
2013-09-12 3:25 ` [Qemu-devel] [PATCH v5 4/5] PC: differentiate hpet's interrupt capability on piix and q35 Liu Ping Fan
2013-09-12 3:25 ` [Qemu-devel] [PATCH v5 5/5] PC-1.6: add compatibility for hpet intcap on pc-q35-1.6 Liu Ping Fan
2013-09-12 6:29 ` [Qemu-devel] [PATCH v5 0/5] bugs fix for hpet Paolo Bonzini
2013-09-12 7:49 ` liu ping fan
2013-09-25 6:27 ` liu ping fan
2013-09-25 15:59 ` Paolo Bonzini
2013-09-26 15:45 ` Mike Day
2013-09-26 15:48 ` Mike Day
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=20130929042021.GA28311@redhat.com \
--to=mst@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=jan.kiszka@siemens.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
--cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.