diff mbox series

[v2,3/7] libpdbg/p8chip.c: Only write the SP_STOP bit once

Message ID 20190312014920.25368-4-npiggin@gmail.com
State Accepted
Headers show
Series sreset support for P8 systems | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (deb577949a3505064f471e7b7c692e37c38ec8a4)
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Nicholas Piggin March 12, 2019, 1:49 a.m. UTC
The workbook recipe is to write SP_STOP once, then poll for status.

Also add a small delay between polling to give a reasonable timeout
and avoid hitting the scom bus hard for no good reason.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 libpdbg/p8chip.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Alistair Popple March 26, 2019, 1:03 a.m. UTC | #1
The POWER8 EKB does do retries for ramming which is where this code came from, 
however retries are not done for all cases of SP_STOP in the EKB so following 
the workbook is probably best.

- Alistair

On Tuesday, 12 March 2019 11:49:16 AM AEDT Nicholas Piggin wrote:
> The workbook recipe is to write SP_STOP once, then poll for status.
> 
> Also add a small delay between polling to give a reasonable timeout
> and avoid hitting the scom bus hard for no good reason.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  libpdbg/p8chip.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
> index 61b1e25..b93e953 100644
> --- a/libpdbg/p8chip.c
> +++ b/libpdbg/p8chip.c
> @@ -286,9 +286,11 @@ static int p8_thread_stop(struct thread *thread)
>  	struct core *chip = target_to_core(
>  		pdbg_target_require_parent("core", &thread->target));
> 
> +	/* Quiese active thread */
> +	CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG,
> DIRECT_CONTROL_SP_STOP)); +
>  	do {
> -		/* Quiese active thread */
> -		CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG,
> DIRECT_CONTROL_SP_STOP)); +		usleep(1);
> 
>  		/* Wait for thread to quiese */
>  		CHECK_ERR(pib_read(&thread->target, RAS_STATUS_REG, &val));
diff mbox series

Patch

diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 61b1e25..b93e953 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -286,9 +286,11 @@  static int p8_thread_stop(struct thread *thread)
 	struct core *chip = target_to_core(
 		pdbg_target_require_parent("core", &thread->target));
 
+	/* Quiese active thread */
+	CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP));
+
 	do {
-		/* Quiese active thread */
-		CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP));
+		usleep(1);
 
 		/* Wait for thread to quiese */
 		CHECK_ERR(pib_read(&thread->target, RAS_STATUS_REG, &val));