From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.1.62; helo=eur01-ve1-obe.outbound.protection.outlook.com; envelope-from=udit.kumar@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0062.outbound.protection.outlook.com [104.47.1.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 58872221EA0B2 for ; Thu, 7 Dec 2017 20:37:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=R4yMFTue37km3Z0ynvl1vZgS5w5bkYNNucwRMBkFuYI=; b=bb9o3jEYOiPEJx/wBjlyAes9BNyJ0uUfCTiKzxdtGq0bwKIDfBJksgo/YazT91WH09cQydXofrARM3FTkFw4kvRraMAnO+4YS7WA9dCUu5ZpzzDqgI5Tu0wNKzIfub4Goiz2Ehavt5bonBifyy9zBbv2PUyRgBZBMlxtCq3Wa+I= Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) by DB5PR04MB1000.eurprd04.prod.outlook.com (10.161.199.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Fri, 8 Dec 2017 04:41:55 +0000 Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::51eb:bed3:cf67:f4be]) by AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::51eb:bed3:cf67:f4be%13]) with mapi id 15.20.0282.012; Fri, 8 Dec 2017 04:41:52 +0000 From: Udit Kumar To: Leif Lindholm , "Gao, Liming" CC: "Kinney, Michael D" , Meenakshi Aggarwal , "ard.biesheuvel@linaro.org" , "edk2-devel@lists.01.org" , Varun Sethi Thread-Topic: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add support for Watchdog driver Thread-Index: AQHTbQ0qQaor6kmHaUekvON9HDYV2KMzTYcAgADatJCAAG/CAIAC4ycAgABA0gCAAEBnAIAACz4AgADYdmA= Date: Fri, 8 Dec 2017 04:41:52 +0000 Message-ID: References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> <1511779917-9255-3-git-send-email-meenakshi.aggarwal@nxp.com> <20171204143537.abxvjztldex2bjde@bivouac.eciton.net> <4A89E2EF3DFEDB4C8BFDE51014F606A14E189CAA@SHSMSX104.ccr.corp.intel.com> <20171205110606.374td5x3rhdnhh5g@bivouac.eciton.net> <4A89E2EF3DFEDB4C8BFDE51014F606A14E18BC76@SHSMSX104.ccr.corp.intel.com> <20171207110338.do5i3kqrseb24edx@bivouac.eciton.net> <4A89E2EF3DFEDB4C8BFDE51014F606A14E18C0A4@SHSMSX104.ccr.corp.intel.com> <20171207153422.g4lqd6g2fo4oqcht@bivouac.eciton.net> In-Reply-To: <20171207153422.g4lqd6g2fo4oqcht@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR04MB1000; 6:YVJxqog5COISu+qOtkytYCXajvTvulmUzH/UYAg+Omv4hZtog86xdMnmoNz1QgfBRGvblST71TTi6rTKi9ADVRypiH/a10HfF+mCUsycvwQf3i5X/7k8i6OxodlG8QiA/oAqhos/np2URxDrUQLvwFL89QQDOSkzLQPWCnGONw0uyDxpjaWaW7qklV5JhzOa8yKZYbN/ev0xPgpS7vj6diS/jX85x+yb6j0CEH+08iEMIdokf6ZisnohsaGlEp2tVpD4NGzY9vUli7ZoCmwP8tyTDR4xTXut5LEixK6VVNzGgyBIdmhiXrV8ATD0/Kkk+ebx+rTrJ//T/6MgUDPeFhPDQTNoY7/4cToF5Iu0fAo=; 5:kVEyZNtiB9Jts/V07yb0RW4LWwpTuP8949rF6hF7OAQk0nkEydI19qKc2mgGggNIhB7m+oRnxMbg0ckNBhLWMJR54e+5OLIfqL8NTXTSJfhO9FXD/Zy//TfAaCt7A27y78XYJTGRA4G+C5J3rKeHwgNyC34oKMoA2XaEqomLF48=; 24:aVYx14DBWSZSWlER45f3LKGE+tGJ1eChHuQ6fmgXqRpDv0G6C5IIElTw9CtKD6cCKS6FEpLn93/PD4zTF2i9r7/NtuVJ7JF6mib38FqUSDY=; 7:6ZdViPkSTnhtXWd4L2LuWkwYcTXxqwFrQK7swvlZ0A76lYd9thNxVymTsdWsISpnD12FM1xF3q6KZMsctopbI76rnPOxLM5ESNbvfLlqrmUTBXzwPDD3JiVELs9ZVx8TeNMj9inPVgtt6djVlcw6sSzH8Wvt763ilCMehXPYxeCGzqwrpFW9G1LVHXpa5fqXGsyCX3/B7UfSCQ6ghrSfbWtQZFXup7oB+xpNwX1p2va/TAPAb3yqbSSmcfqWUeaU x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(13464003)(189003)(199004)(24454002)(86362001)(55016002)(3280700002)(7736002)(305945005)(45080400002)(8676002)(6306002)(14454004)(4326008)(53546010)(81166006)(966005)(93886005)(6436002)(7696005)(99286004)(97736004)(74316002)(9686003)(6246003)(102836003)(229853002)(2906002)(5250100002)(3846002)(2950100002)(105586002)(66066001)(2900100001)(5660300001)(53936002)(25786009)(6116002)(33656002)(81156014)(8936002)(54906003)(76176011)(106356001)(3660700001)(478600001)(316002)(110136005)(6506006)(68736007)(171213001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB1000; H:AM6PR0402MB3334.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0b47df47-a04a-487c-af65-08d53df600e2 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:DB5PR04MB1000; x-ms-traffictypediagnostic: DB5PR04MB1000: authentication-results: spf=none (sender IP is ) smtp.mailfrom=udit.kumar@nxp.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(189930954265078)(185117386973197)(162533806227266)(45079756050767)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231022)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123564025)(20161123562025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB5PR04MB1000; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB5PR04MB1000; x-forefront-prvs: 0515208626 received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b47df47-a04a-487c-af65-08d53df600e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2017 04:41:52.7648 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1000 Subject: Re: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add support for Watchdog driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2017 04:37:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > Because when the hardware watchdog times out, it triggers a hard system r= eset, > without any software interaction. Little more complexity around this piece of h/w e.g once watchdog is started it cannot be stopped.=20 Most caller seems to set timeout of 5 mins and later stopping watchdog.=20 But actually watchdog is not stopped and OS needs to be loaded within this = time or some specific application needs to ping it. Thx Udit > -----Original Message----- > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > Sent: Thursday, December 07, 2017 9:04 PM > To: Gao, Liming > Cc: Udit Kumar ; Kinney, Michael D > ; Meenakshi Aggarwal > ; ard.biesheuvel@linaro.org; edk2- > devel@lists.01.org; Varun Sethi > Subject: Re: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add sup= port > for Watchdog driver >=20 > Liming, >=20 > https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fwww. > mail-archive.com%2Fedk2- > devel%40lists.01.org%2Fmsg32761.html&data=3D02%7C01%7Cudit.kumar%40nxp > .com%7Cb5a84bfc5cdc435a605e08d53d87ff95%7C686ea1d3bc2b4c6fa92cd99c > 5c301635%7C0%7C0%7C636482576674878205&sdata=3Dw3k%2B7Aw6D78uaTty > GOh%2F8JUSiHVIdpCPkBudMth6m%2Fw%3D&reserved=3D0 > Search for WdogRegisterHandler. >=20 > This topic is entirely unrelated to any _usage_ of watchdog timer protoco= l. >=20 > The topic is only whether it is reasonable to _implement_ > EFI_WATCHDOG_TIMER_ARCH_PROTOCOL for a hardware watchdog that > *cannot* cause a callback to a handler function. > Because when the hardware watchdog times out, it triggers a hard system r= eset, > without any software interaction. >=20 > / > Leif >=20 > On Thu, Dec 07, 2017 at 02:54:08PM +0000, Gao, Liming wrote: > > Leif: > > I don't review the whole patch serial. Could you point your usage > > case on watch dog timer protocol? > > > > Thanks > > Liming > > > -----Original Message----- > > > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > > > Sent: Thursday, December 7, 2017 7:04 PM > > > To: Gao, Liming > > > Cc: Udit Kumar ; Kinney, Michael D > > > ; Meenakshi Aggarwal > > > ; ard.biesheuvel@linaro.org; > > > edk2-devel@lists.01.org; Varun Sethi > > > Subject: Re: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : > > > Add support for Watchdog driver > > > > > > Hi Liming, > > > > > > On Thu, Dec 07, 2017 at 07:11:38AM +0000, Gao, Liming wrote: > > > > Leif: > > > > I don't see the core driver uses > > > > WatchdogTimer->RegisterHandler(). When it returns unsupported, it > > > > means the additional handler can't be registered. DxeCore uses > > > > WatchdogTimer->SetTimerPeriod(). This service is implemented in > > > > your driver. > > > > > > > > Watchdog protocol is defined in PI spec. Spec describes that this > > > > protocol provides the services required to implement the Boot > > > > Service SetWatchdogTimer(). It provides a service to set the > > > > amount of time to wait before firing the watchdog timer, and it > > > > also provides a service to register a handler that is invoked whe= n > > > > the watchdog timer fires. This protocol can implement the watchdo= g > > > > timer by using the event and timer Boot Services, or it can make > > > > use of custom hardware. If no handler has been registered, or the > > > > registered handler returns, then the system will be reset by > > > > calling the Runtime Service ResetSystem(). So, this protocol is > > > > required. > > > > > > I am not disputing that the protocol is not required. I am > > > suggesting that this hardware watchdog _cannot_ be used to register a > handler. > > > > > > If this hardware watchdog does not get updated in time, that causes > > > an immediate hardware reset of the processor. > > > > > > Because of this, I believe EFI_WATCHDOG_TIMER_ARCH_PROTOCOL is not > > > the appropriate way to make use of it. > > > > > > Please let me know whether you agree. > > > > > > Regards, > > > > > > Leif > > > > > > > Thanks > > > > Liming > > > > >-----Original Message----- > > > > >From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > > > > >Sent: Tuesday, December 05, 2017 7:06 PM > > > > >To: Udit Kumar > > > > >Cc: Gao, Liming ; Kinney, Michael D > > > > >; Meenakshi Aggarwal > > > > >; ard.biesheuvel@linaro.org; edk2- > > > > >devel@lists.01.org; Varun Sethi > > > > >Subject: Re: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : > > > > >Add support for Watchdog driver > > > > > > > > > >On Tue, Dec 05, 2017 at 05:07:00AM +0000, Udit Kumar wrote: > > > > >> > I suggest return EFI_UNSUPPORTED for this case. The > > > > >> > protocol > > > > >implementation > > > > >> > could return its status besides spec defined status. > > > > >> > > > > >> Thanks to help me , how core will treat this error 1/ Wdt not > > > > >> available 2/ ignoring this error 3/ core is not registering > > > > >> handler I guess 3 is valid, > > > > > > > > > >Looking at Core/Dxe/Misc/SetWatchdogTimer.c: > > > > > // > > > > > // Attempt to set the timeout > > > > > // > > > > > Status =3D gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, > > > > > MultU64x32 (Timeout, WATCHDOG_TIMER_CALIBRATE_PER_SECOND)); > > > > > > > > > > // > > > > > // Check for errors > > > > > // > > > > > if (EFI_ERROR (Status)) { > > > > > return EFI_DEVICE_ERROR; > > > > > } > > > > > > > > > >The SetWatchdogTimer() call would always return EFI_DEVICE_ERROR. > > > > > > > > > >> On side track, looks wdt is not used by core services then do > > > > >> we really need this as part of arch protocol ? > > > > > > > > > >Yes, that was ultimately what I was implying with my question > > > > >regarding whether this protocol is relevant for a watchdog that > > > > >can only ever reset the system on timeout. > > > > > > > > > >The protocol looks to me to be designed to use a dedicated > > > > >generic timer as backing for a software watchdog. > > > > > > > > > >Liming, Mike? > > > > > > > > > >If that is the case, then I agree this driver should probably not > > > > >implement this protocol, but rather set up a timer event (or a > > > > >dedicated timer) to stroke the watchdog. > > > > > > > > > >Regards, > > > > > > > > > >Leif > > > > > > > > > >> regards > > > > >> Udit > > > > >> > > > > >> > -----Original Message----- > > > > >> > From: Gao, Liming [mailto:liming.gao@intel.com] > > > > >> > Sent: Monday, December 04, 2017 8:53 PM > > > > >> > To: Leif Lindholm ; Kinney, Michael > > > > >> > D > > > > >> > Cc: Meenakshi Aggarwal ; > > > > >> > ard.biesheuvel@linaro.org; edk2-devel@lists.01.org; Udit > > > > >> > Kumar ; Varun Sethi > > > > >> > Subject: RE: [PATCH edk2-platforms] [PATCH v3 2/9] > > > > >> > Platform/NXP : Add > > > > >support > > > > >> > for Watchdog driver > > > > >> > > > > > >> > Leif: > > > > >> > I suggest return EFI_UNSUPPORTED for this case. The > > > > >> > protocol > > > > >implementation > > > > >> > could return its status besides spec defined status. > > > > >> > > > > > >> > Thanks > > > > >> > Liming > > > > >> > > -----Original Message----- > > > > >> > > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > > > > >> > > Sent: Monday, December 4, 2017 10:36 PM > > > > >> > > To: Kinney, Michael D ; Gao, > > > > >> > > Liming > > > > >> > > Cc: Meenakshi Aggarwal ; > > > > >> > > ard.biesheuvel@linaro.org; edk2-devel@lists.01.org; > > > > >> > > udit.kumar@nxp.com; v.sethi@nxp.com > > > > >> > > Subject: Re: [PATCH edk2-platforms] [PATCH v3 2/9] > > > > >> > > Platform/NXP : Add support for Watchdog driver > > > > >> > > > > > > >> > > Mike, Liming, as MdePkg mainteiners - one question below: > > > > >> > > > > > > >> > > On Mon, Nov 27, 2017 at 04:21:50PM +0530, Meenakshi Aggarwal > wrote: > > > > >> > > > diff --git a/Platform/NXP/Drivers/WatchDog/WatchDog.c > > > > >> > > > b/Platform/NXP/Drivers/WatchDog/WatchDog.c > > > > >> > > > new file mode 100644 > > > > >> > > > index 0000000..a9c70ef > > > > >> > > > --- /dev/null > > > > >> > > > +++ b/Platform/NXP/Drivers/WatchDog/WatchDog.c > > > > >> > > > @@ -0,0 +1,421 @@ > > > > >> > > > > > > >> > > ... > > > > >> > > > > > > >> > > > +/** > > > > >> > > > + This function registers the handler NotifyFunction so > > > > >> > > > +it is called every time > > > > >> > > > + the watchdog timer expires. It also passes the amount > > > > >> > > > +of time since the last > > > > >> > > > + handler call to the NotifyFunction. > > > > >> > > > + If NotifyFunction is not NULL and a handler is not > > > > >> > > > +already registered, > > > > >> > > > + then the new handler is registered and EFI_SUCCESS is r= eturned. > > > > >> > > > + If NotifyFunction is NULL, and a handler is already > > > > >> > > > +registered, > > > > >> > > > + then that handler is unregistered. > > > > >> > > > + If an attempt is made to register a handler when a > > > > >> > > > +handler is already registered, > > > > >> > > > + then EFI_ALREADY_STARTED is returned. > > > > >> > > > + If an attempt is made to unregister a handler when a > > > > >> > > > +handler is not registered, > > > > >> > > > + then EFI_INVALID_PARAMETER is returned. > > > > >> > > > + > > > > >> > > > + @param This The EFI_TIMER_ARCH_PROTOCOL > instance. > > > > >> > > > + @param NotifyFunction The function to call when a ti= mer > interrupt > > > > >fires. > > > > >> > This > > > > >> > > > + function executes at > > > > >> > > > + TPL_HIGH_LEVEL. The DXE Core > > > > >will > > > > >> > > > + register a handler for the tim= er interrupt, so it can > know > > > > >> > > > + how much time has passed. This= information is > used to > > > > >> > > > + signal timer based events. > > > > >> > > > + NULL will unregister the > > > > >handler. > > > > >> > > > + > > > > >> > > > + @retval EFI_SUCCESS The watchdog timer handle= r was > > > > >registered. > > > > >> > > > + @retval EFI_ALREADY_STARTED NotifyFunction is not NUL= L, > and a > > > > >> > handler is already > > > > >> > > > + registered. > > > > >> > > > + @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, > > > > >> > > > + and a > > > > >handler > > > > >> > was not > > > > >> > > > + previously registered. > > > > >> > > > + > > > > >> > > > +**/ > > > > >> > > > +STATIC > > > > >> > > > +EFI_STATUS > > > > >> > > > +EFIAPI > > > > >> > > > +WdogRegisterHandler ( > > > > >> > > > + IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, > > > > >> > > > + IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction > > > > >> > > > + ) > > > > >> > > > +{ > > > > >> > > > + // ERROR: This function is not supported. > > > > >> > > > + // The hardware watchdog will reset the board > > > > >> > > > + return EFI_INVALID_PARAMETER; > > > > >> > > > > > > >> > > Michael, Liming - what's your take on this? > > > > >> > > > > > > >> > > Is EFI_WATCHDOG_TIMER_ARCH_PROTOCOL suitable for use with a > > > > >pure-hw > > > > >> > > watchdog such as this? > > > > >> > > > > > > >> > > If so, what would be a suitable return code here? > > > > >> > > EFI_INVALID_PARAMETER does not look ideal. > > > > >> > > > > > > >> > > / > > > > >> > > Leif