From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7CFD22218E949 for ; Sun, 10 Dec 2017 05:26:01 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2017 05:30:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,388,1508828400"; d="scan'208";a="185689555" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 10 Dec 2017 05:30:36 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Dec 2017 05:30:36 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Dec 2017 05:30:36 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Sun, 10 Dec 2017 21:30:34 +0800 From: "Gao, Liming" To: Leif Lindholm CC: "ard.biesheuvel@linaro.org" , "edk2-devel@lists.01.org" , "Kinney, Michael D" Thread-Topic: [edk2] [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add support for Watchdog driver Thread-Index: AQHTbQ0vgZNINfv/j0CGQcZcSf6avaMzTR3AgABgbwCAAGRVAIADZB8w//+/2gCAAMYvQP//hXUAgAUFGuA= Date: Sun, 10 Dec 2017 13:30:33 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E18E21E@SHSMSX104.ccr.corp.intel.com> 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: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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: Sun, 10 Dec 2017 13:26:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Leif: I have no strong opinion. PI spec doesn't require WdogRegisterHandler mus= t be supported. So, this implementation doesn't break spec. For this platfo= rm, if there is no register handler or no critical register handler, this W= atchdog driver can be used.=20 Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Le= if Lindholm > Sent: Thursday, December 7, 2017 11:34 PM > To: Gao, Liming > Cc: ard.biesheuvel@linaro.org; edk2-devel@lists.01.org; Kinney, Michael D= > Subject: Re: [edk2] [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : = Add support for Watchdog driver >=20 > Liming, >=20 > https://www.mail-archive.com/edk2-devel@lists.01.org/msg32761.html > Search for WdogRegisterHandler. >=20 > This topic is entirely unrelated to any _usage_ of watchdog timer > protocol. >=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 reset, 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@l= ists.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 a= n > > > immediate hardware reset of the processor. > > > > > > Because of this, I believe EFI_WATCHDOG_TIMER_ARCH_PROTOCOL is not th= e > > > 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 ca= n > > > > >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/NX= P : 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, Lim= ing > > > > >> > > > > > > >> > > 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 i= t 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 alre= ady > > > > >> > > > +registered, > > > > >> > > > + then the new handler is registered and EFI_SUCCESS is r= eturned. > > > > >> > > > + If NotifyFunction is NULL, and a handler is already reg= istered, > > > > >> > > > + then that handler is unregistered. > > > > >> > > > + If an attempt is made to register a handler when a hand= ler is > > > > >> > > > +already registered, > > > > >> > > > + then EFI_ALREADY_STARTED is returned. > > > > >> > > > + If an attempt is made to unregister a handler when a ha= ndler is > > > > >> > > > +not registered, > > > > >> > > > + then EFI_INVALID_PARAMETER is returned. > > > > >> > > > + > > > > >> > > > + @param This The EFI_TIMER_ARCH_PROTOCOL in= stance. > > > > >> > > > + @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. NUL= L 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, a= nd 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 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel