diff mbox series

[v4,15/19] libpdbg: Remove special case thread procedures using sbefifo

Message ID 20200421041655.82856-16-amitay@ozlabs.org
State Superseded
Headers show
Series Add sbefifo backend | expand

Checks

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

Commit Message

Amitay Isaacs April 21, 2020, 4:16 a.m. UTC
Always check if the all thread procedures are provided by pib.  If not,
use individual thread operations.

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/chip.c | 60 +++++++++++++++++---------------------------------
 1 file changed, 20 insertions(+), 40 deletions(-)

Comments

Alistair Popple April 30, 2020, 1:29 a.m. UTC | #1
Reviewed-by: Alistair Popple <alistair@popple.id.au>

On Tuesday, 21 April 2020 2:16:51 PM AEST Amitay Isaacs wrote:
> Always check if the all thread procedures are provided by pib.  If not,
> use individual thread operations.
> 
> Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
> ---
>  libpdbg/chip.c | 60 +++++++++++++++++---------------------------------
>  1 file changed, 20 insertions(+), 40 deletions(-)
> 
> diff --git a/libpdbg/chip.c b/libpdbg/chip.c
> index 848a831..86e91bd 100644
> --- a/libpdbg/chip.c
> +++ b/libpdbg/chip.c
> @@ -156,21 +156,16 @@ int thread_sreset(struct pdbg_target *thread_target)
> 
>  int thread_step_all(void)
>  {
> -	struct pdbg_target *pib, *thread;
> +	struct pdbg_target *target, *thread;
>  	int rc = 0, count = 0;
> 
> -	pdbg_for_each_class_target("pib", pib) {
> -		struct chipop *chipop;
> +	pdbg_for_each_class_target("pib", target) {
> +		struct pib *pib = target_to_pib(target);
> 
> -		chipop = pib_to_chipop(pib);
> -		if (!chipop)
> +		if (!pib->thread_step_all)
>  			break;
> 
> -		/*
> -		 * core_id = 0xff (all SMT4 cores)
> -		 * thread_id = 0xf (all 4 threads in the SMT4 core)
> -		 */
> -		rc |= chipop->thread_step(chipop, 0xff, 0xf);
> +		rc |= pib->thread_step_all(pib, 1);
>  		count++;
>  	}
> 
> @@ -189,21 +184,16 @@ int thread_step_all(void)
> 
>  int thread_start_all(void)
>  {
> -	struct pdbg_target *pib, *thread;
> +	struct pdbg_target *target, *thread;
>  	int rc = 0, count = 0;
> 
> -	pdbg_for_each_class_target("pib", pib) {
> -		struct chipop *chipop;
> +	pdbg_for_each_class_target("pib", target) {
> +		struct pib *pib = target_to_pib(target);
> 
> -		chipop = pib_to_chipop(pib);
> -		if (!chipop)
> +		if (!pib->thread_start_all)
>  			break;
> 
> -		/*
> -		 * core_id = 0xff (all SMT4 cores)
> -		 * thread_id = 0xf (all 4 threads in the SMT4 core)
> -		 */
> -		rc |= chipop->thread_start(chipop, 0xff, 0xf);
> +		rc |= pib->thread_start_all(pib);
>  		count++;
>  	}
> 
> @@ -222,21 +212,16 @@ int thread_start_all(void)
> 
>  int thread_stop_all(void)
>  {
> -	struct pdbg_target *pib, *thread;
> +	struct pdbg_target *target, *thread;
>  	int rc = 0, count = 0;
> 
> -	pdbg_for_each_class_target("pib", pib) {
> -		struct chipop *chipop;
> +	pdbg_for_each_class_target("pib", target) {
> +		struct pib *pib = target_to_pib(target);
> 
> -		chipop = pib_to_chipop(pib);
> -		if (!chipop)
> +		if (!pib->thread_stop_all)
>  			break;
> 
> -		/*
> -		 * core_id = 0xff (all SMT4 cores)
> -		 * thread_id = 0xf (all 4 threads in the SMT4 core)
> -		 */
> -		rc |= chipop->thread_stop(chipop, 0xff, 0xf);
> +		rc |= pib->thread_stop_all(pib);
>  		count++;
>  	}
> 
> @@ -255,21 +240,16 @@ int thread_stop_all(void)
> 
>  int thread_sreset_all(void)
>  {
> -	struct pdbg_target *pib, *thread;
> +	struct pdbg_target *target, *thread;
>  	int rc = 0, count = 0;
> 
> -	pdbg_for_each_class_target("pib", pib) {
> -		struct chipop *chipop;
> +	pdbg_for_each_class_target("pib", target) {
> +		struct pib *pib = target_to_pib(target);
> 
> -		chipop = pib_to_chipop(pib);
> -		if (!chipop)
> +		if (!pib->thread_sreset_all)
>  			break;
> 
> -		/*
> -		 * core_id = 0xff (all SMT4 cores)
> -		 * thread_id = 0xf (all 4 threads in the SMT4 core)
> -		 */
> -		rc |= chipop->thread_sreset(chipop, 0xff, 0xf);
> +		rc |= pib->thread_sreset_all(pib);
>  		count++;
>  	}
diff mbox series

Patch

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 848a831..86e91bd 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -156,21 +156,16 @@  int thread_sreset(struct pdbg_target *thread_target)
 
 int thread_step_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_step_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_step(chipop, 0xff, 0xf);
+		rc |= pib->thread_step_all(pib, 1);
 		count++;
 	}
 
@@ -189,21 +184,16 @@  int thread_step_all(void)
 
 int thread_start_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_start_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_start(chipop, 0xff, 0xf);
+		rc |= pib->thread_start_all(pib);
 		count++;
 	}
 
@@ -222,21 +212,16 @@  int thread_start_all(void)
 
 int thread_stop_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_stop_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_stop(chipop, 0xff, 0xf);
+		rc |= pib->thread_stop_all(pib);
 		count++;
 	}
 
@@ -255,21 +240,16 @@  int thread_stop_all(void)
 
 int thread_sreset_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_sreset_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_sreset(chipop, 0xff, 0xf);
+		rc |= pib->thread_sreset_all(pib);
 		count++;
 	}