[Cbe-oss-dev] [PATCH 1/3] spufs context switch - spu mfc save

Gerhard Stenzel gerhard.stenzel at de.ibm.com
Wed Apr 23 23:00:45 EST 2008


> You must not save some of MFC_CNTL bits at this point (Step 8),
> because the SPU is still running and then they can be changed
> until the SPU is stopped at the Step 11 (save_spu_status).
>
> For example, the SPU may issue a new DMA command after the Step 8,
> then the MFC_CNTL[Q] bit can be changed after Step 8 (save_mfc_cntl).
> So MFC_CNTL[Q] bit should be saved after the SPU is stopped.
> See the explanations in:
>
>     http://ozlabs.org/pipermail/cbe-oss-dev/2007-August/003139.html

It seems that the patch from Masato Noguchi at the end of above referenced
posting did never make it upstream. Does anybody know why?

##############################################################
Um, I feel MFC_CNTL[Q] in a CSA should indicate wheter a DMA
queue was saved to a CSA or not. How about this?

Signed-off-by: Masato Noguchi <Masato.Noguchi at jp.sony.com>
---
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c
b/arch/powerpc/platforms/cell/spufs/switch.c
index 27ffdae..4eea86f 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -329,10 +329,13 @@ static inline void save_mfc_queues(struct spu_state
*csa, struct spu *spu)
             int i;

             /* Save, Step 19:
-             *     If MFC_Cntl[Se]=0 then save
+             *     Update saved copy of CSA.MFC_CNTL[Q], and
+             *     if MFC_Cntl[Q]=0 then save
              *     MFC command queues.
              */
-            if ((in_be64(&priv2->mfc_control_RW) &
MFC_CNTL_DMA_QUEUES_EMPTY) == 0) {
+            if (in_be64(&priv2->mfc_control_RW) &
MFC_CNTL_DMA_QUEUES_EMPTY) {
+                        csa->priv2.mfc_control_RW |=
MFC_CNTL_DMA_QUEUES_EMPTY;
+            } else {
                         for (i = 0; i < 8; i++) {
                                     csa->priv2.puq[i].mfc_cq_data0_RW =

in_be64(&priv2->puq[i].mfc_cq_data0_RW);
##############################################################

Best regards,

Gerhard Stenzel, Linux on Cell Development, LTC
-----------------------------------------------------------------------------------------------------------------------------------

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung: Herbert
Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart,
HRB 243294





More information about the cbe-oss-dev mailing list