[Skiboot] [PATCH V2] capi: Keep the current mmio windows in the mbt cache table.

christophe lombard clombard at linux.vnet.ibm.com
Thu Apr 5 17:13:12 AEST 2018


Le 05/04/2018 à 06:36, Vaibhav Jain a écrit :
> Hi Christophe,
> 
> Look good to me with one minor and optional suggestion.
> 
> Christophe Lombard <clombard at linux.vnet.ibm.com> writes:
> 
>> When the phb is used as a CAPI interface, the current mmio windows list
>> is cleaned before adding the capi and the prefetchable memory (M64)
>> windows, which implies that the non-prefetchable BAR is no more
>> configured.
>> This patch allows to set only the mbt bar to pass capi mmio window and
>> to keep, as defined, the other mmio values (M32 and M64).
>>
>> Signed-off-by: Christophe Lombard <clombard at linux.vnet.ibm.com>
> Reviwed-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
> 
>> +		/* search a free entry */
>> +		if ((entf == -1) &&
>> +		   ((!(p->mbt_cache[i][0] & IODA3_MBT0_ENABLE)) &&
>> +		    (!(p->mbt_cache[i][1] & IODA3_MBT1_ENABLE))))
>> +			entf = i;
> Too many parentheses :-)

The parentheses are only there to identify the type of test you want
to appear.

> 
> Since logical 'and' is associative
> Also,  s/ !(p->mbt_cache[i][0] & IODA3_MBT0_ENABLE) /
>         p->mbt_cache[i][0] ^ IODA3_MBT0_ENABLE
>

there are many ways to write code. Some seem right in your eyes but for 
others can not.

> So, the expression can be rewritten much cleanly as
> if (entf == -1 && (p->mbt_cache[i][0] ^ IODA3_MBT0_ENABLE) &&
> (p->mbt_cache[i][1] ^ IODA3_MBT1_ENABLE))
> 
> or going by precendence rules
> 
> if (entf == -1 && p->mbt_cache[i][0] ^ IODA3_MBT0_ENABLE &&
> p->mbt_cache[i][1] ^ IODA3_MBT1_ENABLE)
> 




More information about the Skiboot mailing list