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

Vaibhav Jain vaibhav at linux.vnet.ibm.com
Thu Apr 5 14:36:28 AEST 2018


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 :-)

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

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)

-- 
Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
Linux Technology Center, IBM India Pvt. Ltd.



More information about the Skiboot mailing list