From patchwork Fri Mar 17 07:09:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9629967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8E81360132 for ; Fri, 17 Mar 2017 07:10:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EE5C28679 for ; Fri, 17 Mar 2017 07:10:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72CD82869B; Fri, 17 Mar 2017 07:10:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E984628679 for ; Fri, 17 Mar 2017 07:10:32 +0000 (UTC) Received: from localhost ([::1]:47457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1com1u-00075U-Vu for patchwork-qemu-devel@patchwork.kernel.org; Fri, 17 Mar 2017 03:10:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1com1i-000758-0M for qemu-devel@nongnu.org; Fri, 17 Mar 2017 03:10:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1com1e-0000ZV-NX for qemu-devel@nongnu.org; Fri, 17 Mar 2017 03:10:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33454) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1com1e-0000ZN-FH for qemu-devel@nongnu.org; Fri, 17 Mar 2017 03:10:14 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46AA5486DC for ; Fri, 17 Mar 2017 07:10:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 46AA5486DC Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 46AA5486DC Received: from nilsson.home.kraxel.org (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25AC9627DD; Fri, 17 Mar 2017 07:10:10 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 3CB0F80BD1; Fri, 17 Mar 2017 08:10:07 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Mar 2017 08:09:54 +0100 Message-Id: <1489734595-14749-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 17 Mar 2017 07:10:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] ich9: add tco reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Without that the nmi watchdog fires after reboot and the linux kernel is confused where the nmi comes from: Uhhuh. NMI received for unknown reason 20 on CPU 0. Do you have a strange power saving mode enabled? Dazed and confused, but trying to continue Signed-off-by: Gerd Hoffmann --- hw/acpi/ich9.c | 1 + hw/acpi/tco.c | 39 ++++++++++++++++++++------------------- include/hw/acpi/tco.h | 1 + 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 5c279bb..4d03182 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -250,6 +250,7 @@ static void pm_reset(void *opaque) acpi_pm1_cnt_reset(&pm->acpi_regs); acpi_pm_tmr_reset(&pm->acpi_regs); acpi_gpe_reset(&pm->acpi_regs); + acpi_pm_tco_reset(&pm->tco_regs); pm->smi_en = 0; if (!pm->smm_enabled) { diff --git a/hw/acpi/tco.c b/hw/acpi/tco.c index b4adac8..6e5fca8 100644 --- a/hw/acpi/tco.c +++ b/hw/acpi/tco.c @@ -214,27 +214,28 @@ static const MemoryRegionOps tco_io_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +void acpi_pm_tco_reset(TCOIORegs *tr) +{ + tr->tco.rld = TCO_RLD_DEFAULT; + tr->tco.din = TCO_DAT_IN_DEFAULT; + tr->tco.dout = TCO_DAT_OUT_DEFAULT; + tr->tco.sts1 = TCO1_STS_DEFAULT; + tr->tco.sts2 = TCO2_STS_DEFAULT; + tr->tco.cnt1 = TCO1_CNT_DEFAULT; + tr->tco.cnt2 = TCO2_CNT_DEFAULT; + tr->tco.msg1 = TCO_MESSAGE1_DEFAULT; + tr->tco.msg2 = TCO_MESSAGE2_DEFAULT; + tr->tco.wdcnt = TCO_WDCNT_DEFAULT; + tr->tco.tmr = TCO_TMR_DEFAULT; + tr->sw_irq_gen = SW_IRQ_GEN_DEFAULT; + tr->expire_time = -1; + tr->timeouts_no = 0; +} + void acpi_pm_tco_init(TCOIORegs *tr, MemoryRegion *parent) { - *tr = (TCOIORegs) { - .tco = { - .rld = TCO_RLD_DEFAULT, - .din = TCO_DAT_IN_DEFAULT, - .dout = TCO_DAT_OUT_DEFAULT, - .sts1 = TCO1_STS_DEFAULT, - .sts2 = TCO2_STS_DEFAULT, - .cnt1 = TCO1_CNT_DEFAULT, - .cnt2 = TCO2_CNT_DEFAULT, - .msg1 = TCO_MESSAGE1_DEFAULT, - .msg2 = TCO_MESSAGE2_DEFAULT, - .wdcnt = TCO_WDCNT_DEFAULT, - .tmr = TCO_TMR_DEFAULT, - }, - .sw_irq_gen = SW_IRQ_GEN_DEFAULT, - .tco_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tco_timer_expired, tr), - .expire_time = -1, - .timeouts_no = 0, - }; + tr->tco_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tco_timer_expired, tr); + acpi_pm_tco_reset(tr); memory_region_init_io(&tr->io, memory_region_owner(parent), &tco_io_ops, tr, "sm-tco", ICH9_PMIO_TCO_LEN); memory_region_add_subregion(parent, ICH9_PMIO_TCO_RLD, &tr->io); diff --git a/include/hw/acpi/tco.h b/include/hw/acpi/tco.h index 52ad767..7d14043 100644 --- a/include/hw/acpi/tco.h +++ b/include/hw/acpi/tco.h @@ -74,6 +74,7 @@ typedef struct TCOIORegs { } TCOIORegs; /* tco.c */ +void acpi_pm_tco_reset(TCOIORegs *tr); void acpi_pm_tco_init(TCOIORegs *tr, MemoryRegion *parent); extern const VMStateDescription vmstate_tco_io_sts;