From: Liu Ping Fan <qemulist@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v6 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS
Date: Thu, 10 Oct 2013 15:56:15 +0800 [thread overview]
Message-ID: <1381391779-27718-2-git-send-email-pingfank@linux.vnet.ibm.com> (raw)
In-Reply-To: <1381391779-27718-1-git-send-email-pingfank@linux.vnet.ibm.com>
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. (On bare metal, if OS driver
claims high active on this line, spurious irq is generated)
We fold the emulation of this inversion inside the hpet logic.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
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-10-10 7:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 7:56 [Qemu-devel] [PATCH v6 0/5] bugs fix for hpet Liu Ping Fan
2013-10-10 7:56 ` Liu Ping Fan [this message]
2013-10-10 7:56 ` [Qemu-devel] [PATCH v6 2/5] hpet: enable to entitle more irq pins " Liu Ping Fan
2013-10-10 9:11 ` Paolo Bonzini
2013-10-11 2:59 ` liu ping fan
2013-10-10 9:16 ` Michael S. Tsirkin
2013-10-10 9:33 ` Paolo Bonzini
2013-10-10 9:41 ` Michael S. Tsirkin
2013-10-10 9:46 ` Paolo Bonzini
2013-10-10 11:41 ` Michael S. Tsirkin
2013-10-11 2:59 ` liu ping fan
2013-10-11 8:38 ` Paolo Bonzini
2013-10-11 9:18 ` liu ping fan
2013-10-11 11:28 ` Paolo Bonzini
2013-10-14 14:17 ` Michael S. Tsirkin
2013-10-14 14:18 ` Michael S. Tsirkin
2013-10-15 5:24 ` liu ping fan
2013-10-10 7:56 ` [Qemu-devel] [PATCH v6 3/5] PC: use qdev_xx to create hpet instead of sysbus_create_xx Liu Ping Fan
2013-10-10 9:10 ` Paolo Bonzini
2013-10-10 9:24 ` Michael S. Tsirkin
2013-10-10 7:56 ` [Qemu-devel] [PATCH v6 4/5] PC: add hpet compat to trace compatability version Liu Ping Fan
2013-10-10 9:09 ` Paolo Bonzini
2013-10-10 7:56 ` [Qemu-devel] [PATCH v6 5/5] PC: differentiate hpet's interrupt capability on piix and q35 Liu Ping Fan
2013-10-10 9:23 ` Michael S. Tsirkin
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=1381391779-27718-2-git-send-email-pingfank@linux.vnet.ibm.com \
--to=qemulist@gmail.com \
--cc=anthony@codemonkey.ws \
--cc=mst@redhat.com \
--cc=pbonzini@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).