From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQ0Wk-0000mE-0x for qemu-devel@nongnu.org; Sat, 28 Sep 2013 15:50:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQ0We-0001ur-18 for qemu-devel@nongnu.org; Sat, 28 Sep 2013 15:50:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQ0Wd-0001ui-PP for qemu-devel@nongnu.org; Sat, 28 Sep 2013 15:49:59 -0400 Date: Sat, 28 Sep 2013 22:52:13 +0300 From: "Michael S. Tsirkin" Message-ID: <20130928195213.GB1051@redhat.com> References: <1378956318-23395-1-git-send-email-pingfank@linux.vnet.ibm.com> <1378956318-23395-2-git-send-email-pingfank@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1378956318-23395-2-git-send-email-pingfank@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v5 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Peter Maydell , Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= 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? > > We fold the emulation of this inversion inside the hpet logic. > > Signed-off-by: Liu Ping Fan Doesn't this affect cross-version migration? E.g. imagine that you migrate between systems with/without this fix. > --- > 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 >