Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp783167pxu; Wed, 6 Jan 2021 04:26:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwj2aS2ijsemDo6Muk31+DsImiP6a7i8pR5zNCGWu5/zcltZk0ovcPufB0CP9jcy/sXucWv X-Received: by 2002:a17:906:c1d9:: with SMTP id bw25mr2623161ejb.452.1609935992530; Wed, 06 Jan 2021 04:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609935992; cv=none; d=google.com; s=arc-20160816; b=RnK9wN+12KWG+XCi9b2/QW2zx9cUqMdbGZ7+ObzRGXxun6r5/pHyNdWDmVxXPeJmRi pq+qJo3/S0d2WLKHp+2Owju5/A9iEycohKQBD0YzMgYmYPNC+ClGxma9issTOprs/BQD qs+qCVzbWBxbGszQ3jsWZCG96KcPDWORYRgknVDPz7Soqe6xTxFAj4Z2xSglop+vlvzP RqxCZ1UOt9QJN66dJQvk2Ez49cJwwM6+h7guDmHiYpLo2wNfv5EAvQinwLgficVli9jt KbDYAct2lB+sh7OeuN+RAXL0Cx0UJIgmWpwu9P0ff3XGCJM/nexrETdJMto9lsyev4fV zWjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=gFG6Xd7fjkJb7FFuGgL2prWRE0IhLPnp3R++jHA/HGU=; b=S+VN960m2xcLpxjkOskah78BuMl89BamG/2OXWkj0/VhlhyilmHpf3UQjfkX2EViKC cYM/k9IjXUDBWm4xvjoPGfCbMHq92hL9SOCCFIU8WrFuFcwkkhym+Ph/gmHiyZlpQk+w JU/Jln1a9e1hCXE36Gg7+MitJI7CZ/UVPSOwgl2BOuwYuypEP3l108iQNLCLqrL2gh2O 3ZYjFLE87HP3XL0Vzd0ZDSraQvGi2i4jIKjZJkH4HZP65iHAfcEr4UuT+wfp2Wtpr9Uv 7kG3LCXdFAoxOiC9rOHZCIdXA5lmlFnenO8skjEeqqZc6R3ydXZrnmdO5zyaofdnBCS3 Qw8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si839427edw.381.2021.01.06.04.26.07; Wed, 06 Jan 2021 04:26:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726076AbhAFMYq (ORCPT + 99 others); Wed, 6 Jan 2021 07:24:46 -0500 Received: from foss.arm.com ([217.140.110.172]:40274 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbhAFMYq (ORCPT ); Wed, 6 Jan 2021 07:24:46 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 08ED3D6E; Wed, 6 Jan 2021 04:24:01 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.36.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D4A593F70D; Wed, 6 Jan 2021 04:23:59 -0800 (PST) Date: Wed, 6 Jan 2021 12:23:56 +0000 From: Mark Rutland To: tingwei@codeaurora.org Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: Set DBGCLAIM when self-host debug is enabled Message-ID: <20210106122356.GC26994@C02TD0UTHF1T.local> References: <512a30e6cc6877687c10c0f9ccc3c4c5@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <512a30e6cc6877687c10c0f9ccc3c4c5@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 06, 2021 at 06:29:53PM +0800, tingwei@codeaurora.org wrote: > Hi Will and Mark, Hi Tingwei, > In recent implementation of save/restore ARM debug registers in > EL2/EL3, we found it's necessary to know whether self-host debug is > enabled so EL2/EL3 can avoid saving/restoring debug registers but no > one is using debug. In what situation are you considering? I assume you mean idle sequences using CPU_SUSPEND? Generally our expectation for CPU_SUSPEND is: * Where StateType==0, the debug state is preserved with all other PE state. * Where StateType==1 and the PE returns "warm" without having entered a powerdown state, the debug state is preserved along with all other PE state. * Where StateType==1, and the PE returns "cold" after having entered a powerdown state (i.e. we return via the entry point address), the debug state is not preserved. ... and I'm missing where you could avoid saving the state. What situation(s) did you have in mind? > In ARM PSCI, it has one option to set DBGCLAIM[1] to 1 to indicate > that debug is in use by a self-host debugger. Do you think it's > resonable to add this to Kernel? > > For example, can we set DBGCLAIM[1] to 1 in enable_debug_monitors() > and clear it in disable_debug_monitors(). I was under the impression that this was solely for the benefit of an external debugger, and should have no functional impact on the PSCI implementation from the kernel's PoV, so as above I think we need a better description of the case you're trying to address. Thanks, Mark.