[Skiboot] [PATCH 2/3] Introduce NPU2 support

Frederic Barrat fbarrat at linux.vnet.ibm.com
Sat Jan 14 00:46:52 AEDT 2017



Le 12/01/2017 à 06:11, Alistair Popple a écrit :
> +static int64_t npu2_map_pe_dma_window_real(struct phb *phb,
> +					   uint64_t pe_num,
> +					   uint16_t window_id,
> +					   uint64_t pci_start_addr,
> +					   uint64_t pci_mem_size)
> +{
> +	struct npu2 *p = phb_to_npu2(phb);
> +	uint64_t end;
> +	uint64_t tve;
> +
> +	/* Sanity check. Each PE has one corresponding TVE */
> +	if (pe_num >= NPU2_MAX_PE_NUM ||
> +	    window_id != pe_num)
> +		return OPAL_PARAMETER;
> +
> +	if (pci_mem_size) {
> +		/* Enable */
> +
> +		end = pci_start_addr + pci_mem_size;
> +
> +		/* We have to be 16M aligned */
> +		if ((pci_start_addr & 0x00ffffff) ||
> +		    (pci_mem_size & 0x00ffffff))
> +			return OPAL_PARAMETER;
> +
> +		/*
> +		 * It *looks* like this is the max we can support (we need
> +		 * to verify this. Also we are not checking for rollover,
> +		 * but then we aren't trying too hard to protect ourselves
> +		 * againt a completely broken OS.
> +		 */
> +		if (end > 0x0003ffffffffffffull)
> +			return OPAL_PARAMETER;
> +
> +		/*
> +		 * Put start address bits 49:24 into TVE[52:53]||[0:23]
> +		 * and end address bits 49:24 into TVE[54:55]||[24:47]
> +		 * and set TVE[51]
> +		 */
> +		tve  = (pci_start_addr << 16) & (0xffffffull << 48);

I think it should be:
tve  = (pci_start_addr << 16) & (0xffffffull << 40);

See http://patchwork.ozlabs.org/patch/710557/

   Fred

> +		tve |= (pci_start_addr >> 38) & (3ull << 10);
> +		tve |= (end >>  8) & (0xfffffful << 16);
> +		tve |= (end >> 40) & (3ull << 8);
> +		tve |= PPC_BIT(51);



More information about the Skiboot mailing list