From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Yan Subject: Re: [PATCH v5 6/9] coresight: add support for CPU debug module Date: Thu, 30 Mar 2017 09:18:39 +0800 Message-ID: <20170330011839.GA939@leoy-linaro> References: <1490466197-29163-1-git-send-email-leo.yan@linaro.org> <1490466197-29163-7-git-send-email-leo.yan@linaro.org> <31be033f-514e-e48a-3ba2-a5c5cd477548@arm.com> <20170329030735.GA23889@leoy-linaro> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-clk-owner@vger.kernel.org To: Mike Leach Cc: Suzuki K Poulose , Jonathan Corbet , Rob Herring , Mark Rutland , Wei Xu , Catalin Marinas , Will Deacon , Andy Gross , David Brown , Michael Turquette , Stephen Boyd , Mathieu Poirier , Guodong Xu , John Stultz , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, Sudeep Holla List-Id: linux-arm-msm@vger.kernel.org On Wed, Mar 29, 2017 at 04:17:19PM +0100, Mike Leach wrote: [...] > >> >+out_powered_up: > >> >+ debug_os_unlock(drvdata); > >> > >> Question: Do we need a matching debug_os_lock() once we are done ? > > > > I have checked ARM ARMv8, but there have no detailed description for > > this. I refered coresight-etmv4 code and Mike's pseudo code, ther have > > no debug_os_lock() related operations. > > > > Mike, Mathieu, could you also help confirm this? > > > > Debug OS lock / unlock allows the power management code running on the > core to lock out the external debugger while the debug registers are > saved/restored during a core power event. > > e.g. A sequence such as this might occur in a correctly programmed system.... > > debug_os_lock() > save_debug_regs() // visible from core power domain - incl breakpoints etc > save_etm_regs() > ... // other stuff prior to core power down, > > > Followed by... > > > restore_etm_regs() > restore_debug_regs() // visible from core power domain - incl breakpoints etc > debug_os_unlock() > > The value is 1 (locked) if cold resetting into AArch64 - it is > expected that some system software will set this to 0 as part of the > boot process. > The lock prevents write access to the external debug registers so we > need to clear it to set up the external debug registers we are using. This description is conflict with upper restoring flows. During restore_debug_regs(), the os lock is locked so how it can write external debug register to restore context? > This suggests that it should be restored as we found it when done. Thanks, Leo Yan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933292AbdC3BS5 (ORCPT ); Wed, 29 Mar 2017 21:18:57 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:34461 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933194AbdC3BSx (ORCPT ); Wed, 29 Mar 2017 21:18:53 -0400 Date: Thu, 30 Mar 2017 09:18:39 +0800 From: Leo Yan To: Mike Leach Cc: Suzuki K Poulose , Jonathan Corbet , Rob Herring , Mark Rutland , Wei Xu , Catalin Marinas , Will Deacon , Andy Gross , David Brown , Michael Turquette , Stephen Boyd , Mathieu Poirier , Guodong Xu , John Stultz , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, Sudeep Holla Subject: Re: [PATCH v5 6/9] coresight: add support for CPU debug module Message-ID: <20170330011839.GA939@leoy-linaro> References: <1490466197-29163-1-git-send-email-leo.yan@linaro.org> <1490466197-29163-7-git-send-email-leo.yan@linaro.org> <31be033f-514e-e48a-3ba2-a5c5cd477548@arm.com> <20170329030735.GA23889@leoy-linaro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 29, 2017 at 04:17:19PM +0100, Mike Leach wrote: [...] > >> >+out_powered_up: > >> >+ debug_os_unlock(drvdata); > >> > >> Question: Do we need a matching debug_os_lock() once we are done ? > > > > I have checked ARM ARMv8, but there have no detailed description for > > this. I refered coresight-etmv4 code and Mike's pseudo code, ther have > > no debug_os_lock() related operations. > > > > Mike, Mathieu, could you also help confirm this? > > > > Debug OS lock / unlock allows the power management code running on the > core to lock out the external debugger while the debug registers are > saved/restored during a core power event. > > e.g. A sequence such as this might occur in a correctly programmed system.... > > debug_os_lock() > save_debug_regs() // visible from core power domain - incl breakpoints etc > save_etm_regs() > ... // other stuff prior to core power down, > > > Followed by... > > > restore_etm_regs() > restore_debug_regs() // visible from core power domain - incl breakpoints etc > debug_os_unlock() > > The value is 1 (locked) if cold resetting into AArch64 - it is > expected that some system software will set this to 0 as part of the > boot process. > The lock prevents write access to the external debug registers so we > need to clear it to set up the external debug registers we are using. This description is conflict with upper restoring flows. During restore_debug_regs(), the os lock is locked so how it can write external debug register to restore context? > This suggests that it should be restored as we found it when done. Thanks, Leo Yan From mboxrd@z Thu Jan 1 00:00:00 1970 From: leo.yan@linaro.org (Leo Yan) Date: Thu, 30 Mar 2017 09:18:39 +0800 Subject: [PATCH v5 6/9] coresight: add support for CPU debug module In-Reply-To: References: <1490466197-29163-1-git-send-email-leo.yan@linaro.org> <1490466197-29163-7-git-send-email-leo.yan@linaro.org> <31be033f-514e-e48a-3ba2-a5c5cd477548@arm.com> <20170329030735.GA23889@leoy-linaro> Message-ID: <20170330011839.GA939@leoy-linaro> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Mar 29, 2017 at 04:17:19PM +0100, Mike Leach wrote: [...] > >> >+out_powered_up: > >> >+ debug_os_unlock(drvdata); > >> > >> Question: Do we need a matching debug_os_lock() once we are done ? > > > > I have checked ARM ARMv8, but there have no detailed description for > > this. I refered coresight-etmv4 code and Mike's pseudo code, ther have > > no debug_os_lock() related operations. > > > > Mike, Mathieu, could you also help confirm this? > > > > Debug OS lock / unlock allows the power management code running on the > core to lock out the external debugger while the debug registers are > saved/restored during a core power event. > > e.g. A sequence such as this might occur in a correctly programmed system.... > > debug_os_lock() > save_debug_regs() // visible from core power domain - incl breakpoints etc > save_etm_regs() > ... // other stuff prior to core power down, > > > Followed by... > > > restore_etm_regs() > restore_debug_regs() // visible from core power domain - incl breakpoints etc > debug_os_unlock() > > The value is 1 (locked) if cold resetting into AArch64 - it is > expected that some system software will set this to 0 as part of the > boot process. > The lock prevents write access to the external debug registers so we > need to clear it to set up the external debug registers we are using. This description is conflict with upper restoring flows. During restore_debug_regs(), the os lock is locked so how it can write external debug register to restore context? > This suggests that it should be restored as we found it when done. Thanks, Leo Yan