From patchwork Tue Aug 27 08:10:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pingfan liu X-Patchwork-Id: 270057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 365952C00C4 for ; Tue, 27 Aug 2013 18:12:07 +1000 (EST) Received: from localhost ([::1]:54734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEENW-00078V-M7 for incoming@patchwork.ozlabs.org; Tue, 27 Aug 2013 04:11:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEENA-00078O-0W for qemu-devel@nongnu.org; Tue, 27 Aug 2013 04:11:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEEN2-0000rA-M3 for qemu-devel@nongnu.org; Tue, 27 Aug 2013 04:11:31 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:56528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEEN2-0000qz-F3 for qemu-devel@nongnu.org; Tue, 27 Aug 2013 04:11:24 -0400 Received: by mail-pd0-f180.google.com with SMTP id y10so4498663pdj.39 for ; Tue, 27 Aug 2013 01:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5Rsc84pFjc/6fEYHbhuCEuBeBOmsfTF/KZHHICYH09Q=; b=d1e+BNsjUkWtddV9b5U7xchekXUFmGGDGPXKmgusibHdI82yyBd2WRvMV+ZCBkM8ZY Qf7M++DPfoUr0ajb+0ZnePuAzh9v/aSB5q2e4vIN26sQgpwyJIjAAi1YN8Sg2x9xHRfA umscq7mf86xdPn12bqR/A9FWi0XuiCAwhiQKhD/c5VENNqFGrUdPCMre4y9XOUoE7qqO lw+kaqtpxyO0qL76Rl0z0OSuUSatrRWMgaJbj+96iqOJdNlMFkxRu3JZD2RjGFq0kNjj 1gGkjVvEAIwoqYGD/NA77cLV2LVFYvBL6/dWNaOHs1GjTVIYt4+tRoBS+qpAYHubB6dT TTLA== X-Received: by 10.66.118.129 with SMTP id km1mr12691339pab.127.1377591066955; Tue, 27 Aug 2013 01:11:06 -0700 (PDT) Received: from localhost ([202.108.130.138]) by mx.google.com with ESMTPSA id nv6sm23049278pbc.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 Aug 2013 01:11:05 -0700 (PDT) From: Liu Ping Fan To: qemu-devel@nongnu.org Date: Tue, 27 Aug 2013 16:10:44 +0800 Message-Id: <1377591046-1944-1-git-send-email-pingfank@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.180 Cc: Paolo Bonzini , Anthony Liguori , Jan Kiszka Subject: [Qemu-devel] [PATCH v2 1/3] hpet: inverse polarity when pin above ISA_NUM_IRQS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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). We fold the emulation of this inversion inside the hpet logic. Signed-off-by: Liu Ping Fan --- 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 648b383..1139448 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]);