[Cbe-oss-dev] [PATCH]libspe2: add handling of zero tagmask for proxy dma

Kazunori Asayama asayama at sm.sony.co.jp
Thu Jul 26 01:56:31 EST 2007


D. Herrendoerfer wrote:
> This patch adds handling of a zero tagmask parameter when SPE_MAP_PS
> is set.
> 
> This is the fixed issue mentioned in Gerhard Stenzel's post:
>> The two side effects are, if a context is created with SPE_MAP_PS:
>>
>> 1) A mask value of 0 will not be interpreted as "all outsanding tags"
> 
> Ok to apply ?

The tagmask should be handled per SPE context,
so the active_tagmask should be a member of spe_context_base_priv
rather than a global variable.


> 
> Signed-off by: D. Herrendoerfer <d.herrendoerfer at herrendoerfer.name>
> 
> Index: libspe2/spebase/dma.c
> ===================================================================
> --- libspe2/spebase/dma.c	(revision 82)
> +++ libspe2/spebase/dma.c	(working copy)
> @@ -32,6 +32,8 @@
>  static int spe_read_tag_status_block(spe_context_ptr_t spectx, unsigned
> int mask, unsigned int *tag_status);
>  static int spe_read_tag_status_noblock(spe_context_ptr_t spectx,
> unsigned int mask, unsigned int *tag_status);
>  
> +static int active_tagmask = 0;
> +
>  static int issue_mfc_command(spe_context_ptr_t spectx, unsigned lsa,
> void *ea,
>  			     unsigned size, unsigned tag, unsigned tid, unsigned rid,
>  			     enum mfc_cmd cmd)
> @@ -53,6 +55,8 @@ static int issue_mfc_command(spe_context
>  		unsigned int eal = (uintptr_t) ea & 0xFFFFFFFF;
>  		unsigned int eah = (unsigned long long)(uintptr_t) ea >> 32;
>  		_base_spe_context_lock(spectx, FD_MFC);
> +		active_tagmask |= 1 << tag;
> +		DEBUG_PRINTF("set active tagmask = 0x%04x, tag=%i
> \n",active_tagmask,tag);
>  		while ((cmd_area->MFC_QStatus & 0x0000FFFF) == 0) ;
>  		do {
>  			cmd_area->MFC_LSA         = lsa;
> @@ -231,12 +235,13 @@ static int spe_read_tag_status_block(spe
>  	if (spectx->base_private->flags & SPE_MAP_PS) {
>  		volatile struct spe_mfc_command_area *cmd_area =
>  			spectx->base_private->mfc_mmap_base;
> -
>  		_base_spe_context_lock(spectx, FD_MFC);
>  		cmd_area->Prxy_QueryMask = mask;
>  		__asm__ ("eieio");
>  		do {
>  			*tag_status = cmd_area->Prxy_TagStatus;
> +			active_tagmask ^= *tag_status;
> +			DEBUG_PRINTF("unset active tagmask = 0x%04x, tag_status = 0x%04x
> \n",active_tagmask,*tag_status);
>  		} while (*tag_status ^ mask);
>  		_base_spe_context_unlock(spectx, FD_MFC);
>  		return 0;
> @@ -266,6 +271,8 @@ static int spe_read_tag_status_noblock(s
>  		cmd_area->Prxy_QueryMask = mask;
>  		__asm__ ("eieio");
>  		*tag_status =  cmd_area->Prxy_TagStatus;
> +		active_tagmask ^= *tag_status;
> +		DEBUG_PRINTF("unset active tagmask = 0x%04x, tag_status = 0x%04x
> \n",active_tagmask,*tag_status);
>  		_base_spe_context_unlock(spectx, FD_MFC);
>  		return 0;
>  	} else {
> @@ -302,6 +309,9 @@ int _base_spe_mfcio_tag_status_read(spe_
>  	if ( mask != 0 ) {
>  		if (!(spectx->base_private->flags & SPE_MAP_PS)) 
>  			mask = 0;
> +	} else {
> +		if ((spectx->base_private->flags & SPE_MAP_PS))
> +			mask = active_tagmask;
>  	}
>  
>  	if (!tag_status) {
> 
> ===================================================================
> 
> Best regards, 
> 
> D. Herrendoerfer



More information about the cbe-oss-dev mailing list