[Skiboot] [PATCH v4] hw/npu2-opencapi: Add initial support for allocating OpenCAPI LPC memory

Andrew Donnellan ajd at linux.ibm.com
Tue May 14 11:07:09 AEST 2019



On 14/5/19 1:19 am, Frederic Barrat wrote:
> 
> Arg! One silly mistake below...
> 

arghhhhh, thanks. Respinning

> 
> 
>> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
>> index 9df51b22eda5..d78b161eac27 100644
>> --- a/hw/npu2-opencapi.c
>> +++ b/hw/npu2-opencapi.c
> 
> ...
> 
>> +static int64_t alloc_mem_bar(struct npu2_dev *dev, uint64_t size, 
>> uint64_t *bar)
>> +{
>> +    uint64_t phys_map_base, phys_map_size;
>> +    int rc = OPAL_SUCCESS;
>> +
>> +    lock(&dev->npu->lock);
>> +
>> +    /*
>> +     * Right now, we support 1 allocation per chip, of up to 4TB.
>> +     *
>> +     * In future, we will use chip address extension to support
>> +     * >4TB ranges, and we will implement a more sophisticated
>> +     * allocator to allow an allocation for every link on a chip.
>> +     */
>> +
>> +    if (dev->npu->lpc_mem_allocated) {
>> +        rc = OPAL_RESOURCE;
>> +        goto out;
>> +    }
>> +
>> +    phys_map_get(dev->npu->chip_id, OCAPI_MEM, 0, &phys_map_base, 
>> &phys_map_size);
>> +
>> +    if (size > phys_map_size) {
>> +        /**
>> +         * @fwts-label OCAPIInvalidLPCMemoryBARSize
>> +         * @fwts-advice The operating system requested an unsupported
>> +         * amount of OpenCAPI LPC memory. This is possibly a kernel
>> +         * bug, or you may need to upgrade your firmware.
>> +         */
>> +        OCAPIERR(dev, "Invalid LPC memory BAR allocation size 
>> requested: 0x%llx bytes (limit 0x%llx)\n",
>> +             size, phys_map_size);
> 
>          rc = OPAL_PARAMETER
> 
>> +        goto out;
>> +    }
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd at linux.ibm.com             IBM Australia Limited



More information about the Skiboot mailing list