All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] Watchdog exit handling support
@ 2012-06-28  5:51 Bharat Bhushan
  2012-06-28 22:26 ` Scott Wood
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Bharat Bhushan @ 2012-06-28  5:51 UTC (permalink / raw)
  To: kvm-ppc

This patch adds the support to handle the exit caused by watchdog
(KVM_EXIT_WDT). In the handling we clear the TSR register.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
 hw/ppc_booke.c            |    5 +++++
 linux-headers/linux/kvm.h |    1 +
 target-ppc/cpu.h          |    1 +
 target-ppc/kvm.c          |   38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/hw/ppc_booke.c b/hw/ppc_booke.c
index 837a5b6..a9fba15 100644
--- a/hw/ppc_booke.c
+++ b/hw/ppc_booke.c
@@ -203,6 +203,11 @@ static void booke_wdt_cb(void *opaque)
                              booke_timer->wdt_timer);
 }
 
+void ppc_booke_wdt_clear_tsr(CPUPPCState *env, target_ulong tsr)
+{
+    env->spr[SPR_BOOKE_TSR] = tsr & ~(TSR_ENW | TSR_WIS | TSR_WRS_MASK);
+}
+
 void store_booke_tsr(CPUPPCState *env, target_ulong val)
 {
     env->spr[SPR_BOOKE_TSR] &= ~val;
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 4b9e575..c1169ff 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -163,6 +163,7 @@ struct kvm_pit_config {
 #define KVM_EXIT_OSI              18
 #define KVM_EXIT_PAPR_HCALL	  19
 #define KVM_EXIT_S390_UCONTROL	  20
+#define KVM_EXIT_WDT              21
 
 /* For KVM_EXIT_INTERNAL_ERROR */
 #define KVM_INTERNAL_ERROR_EMULATION 1
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index ca2fc21..78212b4 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1191,6 +1191,7 @@ void store_40x_dbcr0 (CPUPPCState *env, uint32_t val);
 void store_40x_sler (CPUPPCState *env, uint32_t val);
 void store_booke_tcr (CPUPPCState *env, target_ulong val);
 void store_booke_tsr (CPUPPCState *env, target_ulong val);
+void ppc_booke_wdt_clear_tsr(CPUPPCState *env, target_ulong tsr);
 void booke206_flush_tlb(CPUPPCState *env, int flags, const int check_iprot);
 target_phys_addr_t booke206_tlb_to_page_size(CPUPPCState *env, ppcmas_tlb_t *tlb);
 int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index b6ef72d..6a37e94 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -32,6 +32,7 @@
 #include "device_tree.h"
 #include "hw/sysbus.h"
 #include "hw/spapr.h"
+#include "hw/watchdog.h"
 
 #include "hw/sysbus.h"
 #include "hw/spapr.h"
@@ -743,6 +744,37 @@ static int kvmppc_handle_dcr_write(CPUPPCState *env, uint32_t dcrn, uint32_t dat
     return 0;
 }
 
+static int kvm_arch_handle_watchdog(CPUPPCState *env)
+{
+    int ret;
+    struct kvm_sregs sregs;
+
+    watchdog_perform_action();
+
+    /*
+     * Clear watchdog interrupt condition by clearing TSR.
+     * Similar logic needed to be implemented for watchdog emulation in qemu
+     */
+    if (cap_booke_sregs) {
+        ret = kvm_vcpu_ioctl(env, KVM_GET_SREGS, &sregs);
+        if (ret < 0) {
+            return ret;
+        }
+
+        /* Clear TSR.ENW, TSR.WIS and TSR.WRS */
+        ppc_booke_wdt_clear_tsr(env, sregs.u.e.tsr);
+        sregs.u.e.tsr = env->spr[SPR_BOOKE_TSR];
+
+        sregs.u.e.update_special = KVM_SREGS_E_BASE | KVM_SREGS_E_UPDATE_TSR;
+        ret = kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);
+        if (ret < 0) {
+            return ret;
+        }
+    }
+
+    return 0;
+}
+
 int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run)
 {
     int ret;
@@ -769,6 +801,12 @@ int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run)
         ret = 1;
         break;
 #endif
+#ifdef KVM_EXIT_WDT
+    case KVM_EXIT_WDT:
+        dprintf("booke watchdog action\n");
+        ret = kvm_arch_handle_watchdog(env);
+        break;
+#endif
     default:
         fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
         ret = -1;
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
@ 2012-06-28 22:26 ` Scott Wood
  2012-07-04 11:13 ` Bhushan Bharat-R65777
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2012-06-28 22:26 UTC (permalink / raw)
  To: kvm-ppc

On 06/28/2012 12:39 AM, Bharat Bhushan wrote:
> This patch adds the support to handle the exit caused by watchdog
> (KVM_EXIT_WDT). In the handling we clear the TSR register.

I'm not sure what the logical split is between this patch and 4/4...

> diff --git a/hw/ppc_booke.c b/hw/ppc_booke.c
> index 837a5b6..a9fba15 100644
> --- a/hw/ppc_booke.c
> +++ b/hw/ppc_booke.c
> @@ -203,6 +203,11 @@ static void booke_wdt_cb(void *opaque)
>                               booke_timer->wdt_timer);
>  }
>  
> +void ppc_booke_wdt_clear_tsr(CPUPPCState *env, target_ulong tsr)
> +{
> +    env->spr[SPR_BOOKE_TSR] = tsr & ~(TSR_ENW | TSR_WIS | TSR_WRS_MASK);
> +}
> +

We should probably call this function before returning to KVM, at least
after we halt for debug, possibly other times.

-Scott


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
  2012-06-28 22:26 ` Scott Wood
@ 2012-07-04 11:13 ` Bhushan Bharat-R65777
  2012-07-05 20:27 ` Scott Wood
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Bhushan Bharat-R65777 @ 2012-07-04 11:13 UTC (permalink / raw)
  To: kvm-ppc

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogRnJpZGF5LCBKdW5lIDI5LCAyMDEyIDM6NTcgQU0NCj4gVG86IEJodXNoYW4g
QmhhcmF0LVI2NTc3Nw0KPiBDYzogcWVtdS1wcGNAbm9uZ251Lm9yZzsga3ZtLXBwY0B2Z2VyLmtl
cm5lbC5vcmc7IGFncmFmQHN1c2UuZGU7IEJodXNoYW4gQmhhcmF0LQ0KPiBSNjU3NzcNCj4gU3Vi
amVjdDogUmU6IFtQQVRDSCAzLzRdIFdhdGNoZG9nIGV4aXQgaGFuZGxpbmcgc3VwcG9ydA0KPiAN
Cj4gT24gMDYvMjgvMjAxMiAxMjozOSBBTSwgQmhhcmF0IEJodXNoYW4gd3JvdGU6DQo+ID4gVGhp
cyBwYXRjaCBhZGRzIHRoZSBzdXBwb3J0IHRvIGhhbmRsZSB0aGUgZXhpdCBjYXVzZWQgYnkgd2F0
Y2hkb2cNCj4gPiAoS1ZNX0VYSVRfV0RUKS4gSW4gdGhlIGhhbmRsaW5nIHdlIGNsZWFyIHRoZSBU
U1IgcmVnaXN0ZXIuDQo+IA0KPiBJJ20gbm90IHN1cmUgd2hhdCB0aGUgbG9naWNhbCBzcGxpdCBp
cyBiZXR3ZWVuIHRoaXMgcGF0Y2ggYW5kIDQvNC4uLg0KDQpPayBJIHdpbGwgbWVyZ2UgMy80IGFu
ZCA0LzQuDQoNCj4gDQo+ID4gZGlmZiAtLWdpdCBhL2h3L3BwY19ib29rZS5jIGIvaHcvcHBjX2Jv
b2tlLmMgaW5kZXggODM3YTViNi4uYTlmYmExNQ0KPiA+IDEwMDY0NA0KPiA+IC0tLSBhL2h3L3Bw
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nested] 8+ messages in thread

* Re: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
  2012-06-28 22:26 ` Scott Wood
  2012-07-04 11:13 ` Bhushan Bharat-R65777
@ 2012-07-05 20:27 ` Scott Wood
  2012-07-06  0:43 ` Bhushan Bharat-R65777
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2012-07-05 20:27 UTC (permalink / raw)
  To: kvm-ppc

On 07/04/2012 06:13 AM, Bhushan Bharat-R65777 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Friday, June 29, 2012 3:57 AM
>> To: Bhushan Bharat-R65777
>> Cc: qemu-ppc@nongnu.org; kvm-ppc@vger.kernel.org; agraf@suse.de; Bhushan Bharat-
>> R65777
>> Subject: Re: [PATCH 3/4] Watchdog exit handling support
>>
>> On 06/28/2012 12:39 AM, Bharat Bhushan wrote:
>>> This patch adds the support to handle the exit caused by watchdog
>>> (KVM_EXIT_WDT). In the handling we clear the TSR register.
>>
>> I'm not sure what the logical split is between this patch and 4/4...
> 
> Ok I will merge 3/4 and 4/4.
> 
>>
>>> diff --git a/hw/ppc_booke.c b/hw/ppc_booke.c index 837a5b6..a9fba15
>>> 100644
>>> --- a/hw/ppc_booke.c
>>> +++ b/hw/ppc_booke.c
>>> @@ -203,6 +203,11 @@ static void booke_wdt_cb(void *opaque)
>>>                               booke_timer->wdt_timer);  }
>>>
>>> +void ppc_booke_wdt_clear_tsr(CPUPPCState *env, target_ulong tsr) {
>>> +    env->spr[SPR_BOOKE_TSR] = tsr & ~(TSR_ENW | TSR_WIS |
>>> +TSR_WRS_MASK); }
>>> +
>>
>> We should probably call this function before returning to KVM, at least after we
>> halt for debug, possibly other times.
> 
> Why clearing watchdog related bits in TSR? This will just reset the
> watchdog state machine. Do we actually want to reset the state
> machine or want watchdog interrupt to not occur when exiting to KVM
> for debug.

We want to prevent long delays in QEMU (especially for debug halt) from
causing watchdog actions (interrupt, reset, etc).  Resetting the state
machine seems like the way to do that.

> Does possibly other times mean except KVM_RUN? 

Not sure what you mean here.  Don't we always use KVM_RUN to enter the
guest?  My point was we definitely want this after we had the guest
halted, and we may want to consider doing it for some other heavyweight
exits.

-Scott


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
                   ` (2 preceding siblings ...)
  2012-07-05 20:27 ` Scott Wood
@ 2012-07-06  0:43 ` Bhushan Bharat-R65777
  2012-07-06  1:00 ` Scott Wood
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Bhushan Bharat-R65777 @ 2012-07-06  0:43 UTC (permalink / raw)
  To: kvm-ppc

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogRnJpZGF5LCBKdWx5IDA2LCAyMDEyIDE6NTcgQU0NCj4gVG86IEJodXNoYW4g
QmhhcmF0LVI2NTc3Nw0KPiBDYzogV29vZCBTY290dC1CMDc0MjE7IHFlbXUtcHBjQG5vbmdudS5v
cmc7IGt2bS1wcGNAdmdlci5rZXJuZWwub3JnOw0KPiBhZ3JhZkBzdXNlLmRlDQo+IFN1YmplY3Q6
IFJlOiBbUEFUQ0ggMy80XSBXYXRjaGRvZyBleGl0IGhhbmRsaW5nIHN1cHBvcnQNCj4gDQo+IE9u
IDA3LzA0LzIwMTIgMDY6MTMgQU0sIEJodXNoYW4gQmhhcmF0LVI2NTc3NyB3cm90ZToNCj4gPg0K
PiA+DQo+ID4+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+ID4+IEZyb206IFdvb2QgU2Nv
dHQtQjA3NDIxDQo+ID4+IFNlbnQ6IEZyaWRheSwgSnVuZSAyOSwgMjAxMiAzOjU3IEFNDQo+ID4+
I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PiBEb2VzIHBvc3NpYmx5IG90aGVyIHRpbWVzIG1lYW4gZXhjZXB0IEtWTV9S
VU4/DQo+IA0KPiBOb3Qgc3VyZSB3aGF0IHlvdSBtZWFuIGhlcmUuICBEb24ndCB3ZSBhbHdheXMg
dXNlIEtWTV9SVU4gdG8gZW50ZXIgdGhlIGd1ZXN0Pw0KPiBNeSBwb2ludCB3YXMgd2UgZGVmaW5p
dGVseSB3YW50IHRoaXMgYWZ0ZXIgd2UgaGFkIHRoZSBndWVzdCBoYWx0ZWQsIGFuZCB3ZSBtYXkN
Cj4gd2FudCB0byBjb25zaWRlciBkb2luZyBpdCBmb3Igc29tZSBvdGhlciBoZWF2eXdlaWdodCBl
eGl0cy4NCg0KWW91ciBpbml0aWFsIGNvbW1lbnQgd2FzICJXZSBzaG91bGQgcHJvYmFibHkgY2Fs
bCB0aGlzIGZ1bmN0aW9uIGJlZm9yZSByZXR1cm5pbmcgdG8gS1ZNIi4gV2hpY2ggc3VnZ2VzdCB0
aGF0IGlvY3RscyBjYWxscyBtYWRlIGJ5IFFFTVUgdG8gZW50ZXIgS1ZNLiBJIGFtIGEgYml0IGNv
bmZ1c2VkLCBub3cgeW91IHdhbnQgdG8gYXZvaWQgbG9uZyBkZWxheXMgaW4gUUVNVT8gVGhpcyBz
dWdnZXN0IHdoZW5ldmVyIHdlIGV4aXQgdG8gcWVtdSwgcmlnaHQ/DQoNClRoYW5rcw0KPUJoYXJh
dA0KPiANCj4gLVNjb3R0DQo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
                   ` (3 preceding siblings ...)
  2012-07-06  0:43 ` Bhushan Bharat-R65777
@ 2012-07-06  1:00 ` Scott Wood
  2012-07-06  1:16 ` Bhushan Bharat-R65777
  2012-07-06  1:18 ` Scott Wood
  6 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2012-07-06  1:00 UTC (permalink / raw)
  To: kvm-ppc

On 07/05/2012 07:43 PM, Bhushan Bharat-R65777 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Friday, July 06, 2012 1:57 AM
>> To: Bhushan Bharat-R65777
>> Cc: Wood Scott-B07421; qemu-ppc@nongnu.org; kvm-ppc@vger.kernel.org;
>> agraf@suse.de
>> Subject: Re: [PATCH 3/4] Watchdog exit handling support
>>
>> On 07/04/2012 06:13 AM, Bhushan Bharat-R65777 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Friday, June 29, 2012 3:57 AM
>>>> To: Bhushan Bharat-R65777
>>>> Cc: qemu-ppc@nongnu.org; kvm-ppc@vger.kernel.org; agraf@suse.de;
>>>> Bhushan Bharat-
>>>> R65777
>>>> Subject: Re: [PATCH 3/4] Watchdog exit handling support
>>>>
>>>> On 06/28/2012 12:39 AM, Bharat Bhushan wrote:
>>>>> This patch adds the support to handle the exit caused by watchdog
>>>>> (KVM_EXIT_WDT). In the handling we clear the TSR register.
>>>>
>>>> I'm not sure what the logical split is between this patch and 4/4...
>>>
>>> Ok I will merge 3/4 and 4/4.
>>>
>>>>
>>>>> diff --git a/hw/ppc_booke.c b/hw/ppc_booke.c index 837a5b6..a9fba15
>>>>> 100644
>>>>> --- a/hw/ppc_booke.c
>>>>> +++ b/hw/ppc_booke.c
>>>>> @@ -203,6 +203,11 @@ static void booke_wdt_cb(void *opaque)
>>>>>                               booke_timer->wdt_timer);  }
>>>>>
>>>>> +void ppc_booke_wdt_clear_tsr(CPUPPCState *env, target_ulong tsr) {
>>>>> +    env->spr[SPR_BOOKE_TSR] = tsr & ~(TSR_ENW | TSR_WIS |
>>>>> +TSR_WRS_MASK); }
>>>>> +
>>>>
>>>> We should probably call this function before returning to KVM, at
>>>> least after we halt for debug, possibly other times.
>>>
>>> Why clearing watchdog related bits in TSR? This will just reset the
>>> watchdog state machine. Do we actually want to reset the state machine
>>> or want watchdog interrupt to not occur when exiting to KVM for debug.
>>
>> We want to prevent long delays in QEMU (especially for debug halt) from causing
>> watchdog actions (interrupt, reset, etc).  Resetting the state machine seems
>> like the way to do that.
>>
>>> Does possibly other times mean except KVM_RUN?
>>
>> Not sure what you mean here.  Don't we always use KVM_RUN to enter the guest?
>> My point was we definitely want this after we had the guest halted, and we may
>> want to consider doing it for some other heavyweight exits.
> 
> Your initial comment was "We should probably call this function
> before returning to KVM". Which suggest that ioctls calls made by
> QEMU to enter KVM. I am a bit confused, now you want to avoid long
> delays in QEMU? This suggest whenever we exit to qemu, right?

Whenever we exit to QEMU is one possibility, though it's probably too
aggressive (if the guest gets stuck in a loop that contains a QEMU exit,
the watchdog won't catch it).  Another option is to reset the state
machine only when the guest resumes from a debug halt.

-Scott


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
                   ` (4 preceding siblings ...)
  2012-07-06  1:00 ` Scott Wood
@ 2012-07-06  1:16 ` Bhushan Bharat-R65777
  2012-07-06  1:18 ` Scott Wood
  6 siblings, 0 replies; 8+ messages in thread
From: Bhushan Bharat-R65777 @ 2012-07-06  1:16 UTC (permalink / raw)
  To: kvm-ppc

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogRnJpZGF5LCBKdWx5IDA2LCAyMDEyIDY6MzAgQU0NCj4gVG86IEJodXNoYW4g
QmhhcmF0LVI2NTc3Nw0KPiBDYzogV29vZCBTY290dC1CMDc0MjE7IHFlbXUtcHBjQG5vbmdudS5v
cmc7IGt2bS1wcGNAdmdlci5rZXJuZWwub3JnOw0KPiBhZ3JhZkBzdXNlLmRlDQo+IFN1YmplY3Q6
IFJlOiBbUEFUQ0ggMy80XSBXYXRjaGRvZyBleGl0IGhhbmRsaW5nIHN1cHBvcnQNCj4gDQo+I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2V0dGluZyB0aGUgc3RhdGUg
bWFjaGluZSBkb2VzIG5vdCBkaXNhYmxlIHdhdGNoZG9nLCBpdCB3aWxsIGp1c3QgZW5zdXJlIHRo
ZSBsb25nZXN0IHRpbWUgZm9yIGRlYnVnIGhhbHQgZXRjLiBJcyB0aGF0IG9rID8NCg0KVGhhbmtz
DQotQmhhcmF0DQoNCj4gDQo+IC1TY290dA0K


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] Watchdog exit handling support
  2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
                   ` (5 preceding siblings ...)
  2012-07-06  1:16 ` Bhushan Bharat-R65777
@ 2012-07-06  1:18 ` Scott Wood
  6 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2012-07-06  1:18 UTC (permalink / raw)
  To: kvm-ppc

On 07/05/2012 08:16 PM, Bhushan Bharat-R65777 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Friday, July 06, 2012 6:30 AM
>> To: Bhushan Bharat-R65777
>> Cc: Wood Scott-B07421; qemu-ppc@nongnu.org; kvm-ppc@vger.kernel.org;
>> agraf@suse.de
>> Subject: Re: [PATCH 3/4] Watchdog exit handling support
>>
>> On 07/05/2012 07:43 PM, Bhushan Bharat-R65777 wrote:
>>> Your initial comment was "We should probably call this function before
>>> returning to KVM". Which suggest that ioctls calls made by QEMU to
>>> enter KVM. I am a bit confused, now you want to avoid long delays in
>>> QEMU? This suggest whenever we exit to qemu, right?
>>
>> Whenever we exit to QEMU is one possibility, though it's probably too aggressive
>> (if the guest gets stuck in a loop that contains a QEMU exit, the watchdog won't
>> catch it).  Another option is to reset the state machine only when the guest
>> resumes from a debug halt.
> 
> Ok.
>
> Resetting the state machine does not disable watchdog, it will just
> ensure the longest time for debug halt etc. Is that ok ?

I'm talking about TSR, not TCR.  It's not about disabling the watchdog
or changing the period, but clearing any event that has happened when
leaving debug halt.

-Scott


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-06  1:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-28  5:51 [PATCH 3/4] Watchdog exit handling support Bharat Bhushan
2012-06-28 22:26 ` Scott Wood
2012-07-04 11:13 ` Bhushan Bharat-R65777
2012-07-05 20:27 ` Scott Wood
2012-07-06  0:43 ` Bhushan Bharat-R65777
2012-07-06  1:00 ` Scott Wood
2012-07-06  1:16 ` Bhushan Bharat-R65777
2012-07-06  1:18 ` Scott Wood

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.