All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Paulo Alcantara <pcacjr@gmail.com>, qemu-devel@nongnu.org
Cc: seabios@seabios.org, Paulo Alcantara <pcacjr@zytor.com>,
	kraxel@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v8 3/3] ich9: implement strap SPKR pin logic
Date: Wed, 1 Jul 2015 15:18:41 +0200	[thread overview]
Message-ID: <5593E8B1.6000300@redhat.com> (raw)
In-Reply-To: <1435514338-20227-3-git-send-email-pcacjr@zytor.com>



On 28/06/2015 19:58, Paulo Alcantara wrote:
> If the signal is sampled high, this indicates that the system is
> strapped to the "No Reboot" mode (ICH9 will disable the TCO Timer system
> reboot feature). The status of this strap is readable via the NO_REBOOT
> bit (CC: offset 0x3410:bit 5).
> 
> The NO_REBOOT bit is set when SPKR pin on ICH9 is sampled high. This bit
> may be set or cleared by software if the strap is sampled low but may
> not override the strap when it indicates "No Reboot".
> 
> This patch implements the logic where hardware has ability to set SPKR
> pin through a property named "noreboot" and it's sampled high by
> default.

I know Michael suggested this, but I think default high is a worse
default.  It does not allow recovering from a hard lockup where you
cannot process an NMI, unlike all other watchdogs implemented by QEMU.
In fact, the Linux driver fails to start if the strap is high.

My theory is that hardware manufacturers should only set the strap high
if they want the firmware to have total control of the watchdog via SMIs
(TCO_EN).

If it is just a matter of being late in 2.4, just delay everything to
2.5.  It doesn't require any more work from Paulo, as you can just flip
the default yourself without adding a new machine type (in fact I'm
still not sure why machine types for Q35 are versioned, since migration
is not supported...).

Paolo

> Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
> ---
> v7 -> v8:
>   * change property name to "noreboot"
>   * default "noreboot" property to high
>   * define property in dc->props
>   * update tco tests to support and exercise "noreboot" property
> ---
>  hw/acpi/tco.c          |  2 +-
>  hw/isa/lpc_ich9.c      |  6 ++++++
>  include/hw/i386/ich9.h |  5 +++++
>  tests/tco-test.c       | 18 ++++++++++++++++--
>  4 files changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/acpi/tco.c b/hw/acpi/tco.c
> index 1794a54..7a026c2 100644
> --- a/hw/acpi/tco.c
> +++ b/hw/acpi/tco.c
> @@ -64,7 +64,7 @@ static void tco_timer_expired(void *opaque)
>          tr->tco.sts2 |= TCO_BOOT_STS;
>          tr->timeouts_no = 0;
>  
> -        if (!(gcs & ICH9_CC_GCS_NO_REBOOT)) {
> +        if (!lpc->pin_strap.spkr_hi && !(gcs & ICH9_CC_GCS_NO_REBOOT)) {
>              watchdog_perform_action();
>              tco_timer_stop(tr);
>              return;
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index b547002..3b460d4 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -688,6 +688,11 @@ static const VMStateDescription vmstate_ich9_lpc = {
>      }
>  };
>  
> +static Property ich9_lpc_properties[] = {
> +    DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, true),
> +    DEFINE_PROP_END_OF_LIST(),
> +};
> +
>  static void ich9_lpc_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -699,6 +704,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
>      dc->reset = ich9_lpc_reset;
>      k->init = ich9_lpc_init;
>      dc->vmsd = &vmstate_ich9_lpc;
> +    dc->props = ich9_lpc_properties;
>      k->config_write = ich9_lpc_config_write;
>      dc->desc = "ICH9 LPC bridge";
>      k->vendor_id = PCI_VENDOR_ID_INTEL;
> diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
> index f5681a3..63c5cd8 100644
> --- a/include/hw/i386/ich9.h
> +++ b/include/hw/i386/ich9.h
> @@ -46,6 +46,11 @@ typedef struct ICH9LPCState {
>      ICH9LPCPMRegs pm;
>      uint32_t sci_level; /* track sci level */
>  
> +    /* 2.24 Pin Straps */
> +    struct {
> +        bool spkr_hi;
> +    } pin_strap;
> +
>      /* 10.1 Chipset Configuration registers(Memory Space)
>       which is pointed by RCBA */
>      uint8_t chip_config[ICH9_CC_SIZE];
> diff --git a/tests/tco-test.c b/tests/tco-test.c
> index 1a2fe3d..6a48188 100644
> --- a/tests/tco-test.c
> +++ b/tests/tco-test.c
> @@ -42,6 +42,7 @@ enum {
>  
>  typedef struct {
>      const char *args;
> +    bool noreboot;
>      QPCIDevice *dev;
>      void *lpc_base;
>      void *tco_io_base;
> @@ -53,7 +54,9 @@ static void test_init(TestData *d)
>      QTestState *qs;
>      char *s;
>  
> -    s = g_strdup_printf("-machine q35 %s", !d->args ? "" : d->args);
> +    s = g_strdup_printf("-machine q35 %s %s",
> +                        d->noreboot ? "" : "-global ICH9-LPC.noreboot=false",
> +                        !d->args ? "" : d->args);
>      qs = qtest_start(s);
>      qtest_irq_intercept_in(qs, "ioapic");
>      g_free(s);
> @@ -135,6 +138,7 @@ static void test_tco_defaults(void)
>      TestData d;
>  
>      d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>      g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_base + TCO_RLD), ==,
>                      TCO_RLD_DEFAULT);
> @@ -167,6 +171,7 @@ static void test_tco_timeout(void)
>      int ret;
>  
>      d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>  
>      stop_tco(&d);
> @@ -210,6 +215,7 @@ static void test_tco_max_timeout(void)
>      int ret;
>  
>      d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>  
>      stop_tco(&d);
> @@ -253,6 +259,7 @@ static void test_tco_second_timeout_pause(void)
>      QDict *ad;
>  
>      td.args = "-watchdog-action pause";
> +    td.noreboot = false;
>      test_init(&td);
>  
>      stop_tco(&td);
> @@ -277,6 +284,7 @@ static void test_tco_second_timeout_reset(void)
>      QDict *ad;
>  
>      td.args = "-watchdog-action reset";
> +    td.noreboot = false;
>      test_init(&td);
>  
>      stop_tco(&td);
> @@ -301,6 +309,7 @@ static void test_tco_second_timeout_shutdown(void)
>      QDict *ad;
>  
>      td.args = "-watchdog-action shutdown";
> +    td.noreboot = false;
>      test_init(&td);
>  
>      stop_tco(&td);
> @@ -325,6 +334,7 @@ static void test_tco_second_timeout_none(void)
>      QDict *ad;
>  
>      td.args = "-watchdog-action none";
> +    td.noreboot = false;
>      test_init(&td);
>  
>      stop_tco(&td);
> @@ -349,6 +359,7 @@ static void test_tco_ticks_counter(void)
>      uint16_t rld;
>  
>      d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>  
>      stop_tco(&d);
> @@ -375,6 +386,7 @@ static void test_tco1_control_bits(void)
>      uint16_t val;
>  
>      d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>  
>      val = TCO_LOCK;
> @@ -394,6 +406,7 @@ static void test_tco1_status_bits(void)
>      int ret;
>  
>      d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>  
>      stop_tco(&d);
> @@ -421,7 +434,8 @@ static void test_tco2_status_bits(void)
>      uint16_t val;
>      int ret;
>  
> -    d.args = "-watchdog-action none";
> +    d.args = NULL;
> +    d.noreboot = true;
>      test_init(&d);
>  
>      stop_tco(&d);
> 

  reply	other threads:[~2015-07-01 13:18 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27  0:29 [Qemu-devel] [PATCH 1/3] ich9: add TCO interface emulation Paulo Alcantara
2015-05-27  0:29 ` [Qemu-devel] [PATCH 2/3] target-i386: reserve RCRB mmio space in ACPI DSDT table Paulo Alcantara
2015-05-27 12:03   ` Paolo Bonzini
2015-05-27 17:51     ` Paulo Alcantara
2015-05-28  7:13   ` [Qemu-devel] [SeaBIOS] " Gerd Hoffmann
2015-05-30 10:57     ` Paulo Alcantara
2015-06-01  7:16       ` Gerd Hoffmann
2015-06-01 11:59         ` Paulo Alcantara
2015-05-27  0:29 ` [Qemu-devel] [PATCH 3/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-05-27 11:58 ` [Qemu-devel] [PATCH 1/3] ich9: add TCO interface emulation Paolo Bonzini
2015-05-27 18:23   ` Paulo Alcantara
2015-05-30 22:04 ` [Qemu-devel] [PATCH v2 " Paulo Alcantara
2015-05-30 22:04   ` [Qemu-devel] [PATCH v2 2/3] target-i386: reserve RCRB mmio space in ACPI DSDT table Paulo Alcantara
2015-05-30 22:04   ` [Qemu-devel] [PATCH v2 3/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-01  9:07     ` Paolo Bonzini
2015-06-01  9:05   ` [Qemu-devel] [PATCH v2 1/3] ich9: add TCO interface emulation Paolo Bonzini
2015-06-01 13:38     ` Paulo Alcantara
2015-06-01 21:37       ` Paulo Alcantara
2015-06-01 23:48   ` [Qemu-devel] [PATCH v3 " Paulo Alcantara
2015-06-01 23:48     ` [Qemu-devel] [PATCH v3 2/3] target-i386: reserve RCRB mmio space in ACPI DSDT table Paulo Alcantara
2015-06-17 13:33       ` Michael S. Tsirkin
2015-06-18  2:14         ` Paulo Alcantara
2015-06-01 23:48     ` [Qemu-devel] [PATCH v3 3/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-17 13:37       ` Michael S. Tsirkin
2015-06-18  2:23         ` Paulo Alcantara
2015-06-10 13:17     ` [Qemu-devel] [PATCH v3 1/3] ich9: add TCO interface emulation Paulo Alcantara
2015-06-17 13:27     ` Michael S. Tsirkin
2015-06-18  2:10       ` Paulo Alcantara
2015-06-22  0:37 ` [Qemu-devel] [PATCH v4 " Paulo Alcantara
2015-06-22  0:37   ` [Qemu-devel] [PATCH v4 2/3] target-i386: reserve RCRB mmio space in ACPI DSDT table Paulo Alcantara
2015-06-22  8:40     ` Michael S. Tsirkin
2015-06-22 12:53       ` Paulo Alcantara
2015-06-23 10:38     ` [Qemu-devel] [SeaBIOS] " Igor Mammedov
2015-06-23 10:58       ` Michael S. Tsirkin
2015-06-23 12:29         ` Igor Mammedov
2015-06-23 12:37           ` Michael S. Tsirkin
2015-06-23 11:15       ` Paolo Bonzini
2015-06-23 11:18       ` Paolo Bonzini
2015-06-23 12:22       ` Michael S. Tsirkin
2015-06-22  0:37   ` [Qemu-devel] [PATCH v4 3/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-22  8:39   ` [Qemu-devel] [PATCH v4 1/3] ich9: add TCO interface emulation Michael S. Tsirkin
2015-06-22 12:30     ` Paulo Alcantara
2015-06-22 12:32       ` Paolo Bonzini
2015-06-22 12:47         ` Michael S. Tsirkin
2015-06-22 13:04           ` Paolo Bonzini
2015-06-22 13:07             ` Michael S. Tsirkin
2015-06-22 13:19               ` Paulo Alcantara
2015-06-22 13:10           ` Markus Armbruster
2015-06-22  8:43   ` Michael S. Tsirkin
2015-06-22  9:45     ` Paolo Bonzini
2015-06-22 12:11       ` Michael S. Tsirkin
2015-06-22 12:36         ` Paulo Alcantara
2015-06-22 12:44           ` Michael S. Tsirkin
2015-06-22 12:59             ` Paolo Bonzini
2015-06-22 18:29   ` Paulo Alcantara
2015-06-22 23:10 ` [Qemu-devel] [PATCH v5 " Paulo Alcantara
2015-06-22 23:10   ` [Qemu-devel] [PATCH v5 2/3] target-i386: reserve RCRB mmio space in ACPI DSDT table Paulo Alcantara
2015-06-23 14:29     ` [Qemu-devel] [SeaBIOS] " Igor Mammedov
2015-06-23 15:33       ` Michael S. Tsirkin
2015-06-23 14:39     ` Igor Mammedov
2015-06-23 15:06       ` Michael S. Tsirkin
2015-06-23 15:12         ` Igor Mammedov
2015-06-23 15:29           ` Michael S. Tsirkin
2015-06-24 15:11     ` [Qemu-devel] " Michael S. Tsirkin
2015-06-24 16:00       ` Paulo Alcantara
2015-06-24 16:04         ` Michael S. Tsirkin
2015-06-22 23:10   ` [Qemu-devel] [PATCH v5 3/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-23  6:39   ` [Qemu-devel] [PATCH v5 1/3] ich9: add TCO interface emulation Michael S. Tsirkin
2015-06-24 18:03 ` [Qemu-devel] [PATCH v6 1/2] " Paulo Alcantara
2015-06-24 18:03   ` [Qemu-devel] [PATCH v6 2/2] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-27 17:56 ` [Qemu-devel] [PATCH v7 1/3] ich9: add TCO interface emulation Paulo Alcantara
2015-06-27 17:56   ` [Qemu-devel] [PATCH v7 2/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-27 17:56   ` [Qemu-devel] [PATCH v7 3/3] ich9: implement strap SPKR pin logic Paulo Alcantara
2015-06-28  8:37     ` Michael S. Tsirkin
2015-06-28 16:21       ` Paulo Alcantara
2015-06-28 17:58 ` [Qemu-devel] [PATCH v8 1/3] ich9: add TCO interface emulation Paulo Alcantara
2015-06-28 17:58   ` [Qemu-devel] [PATCH v8 2/3] tests: add testcase for TCO watchdog emulation Paulo Alcantara
2015-06-28 17:58   ` [Qemu-devel] [PATCH v8 3/3] ich9: implement strap SPKR pin logic Paulo Alcantara
2015-07-01 13:18     ` Paolo Bonzini [this message]
2015-07-01 13:31       ` Michael S. Tsirkin
2015-07-01 13:34         ` Paolo Bonzini
2015-07-02  1:30         ` Paulo Alcantara
2015-07-02  6:55           ` Paolo Bonzini

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=5593E8B1.6000300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pcacjr@gmail.com \
    --cc=pcacjr@zytor.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.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 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.