Re: [PATCH 6/9] nvme-apple: Add initial Apple SoC NVMe driver

From: Sven Peter
Date: Sat Apr 02 2022 - 10:05:21 EST




On Sat, Apr 2, 2022, at 15:58, Janne Grunau wrote:
> On 2022-04-02 15:34:55 +0200, Sven Peter wrote:
>>
>>
>> On Tue, Mar 22, 2022, at 14:38, Arnd Bergmann wrote:
>> > On Mon, Mar 21, 2022 at 5:50 PM Sven Peter <sven@xxxxxxxxxxxxx> wrote:
>> >
>> >> +static int apple_nvme_sart_dma_setup(void *cookie, struct apple_rtkit_shmem *bfr,
>> >> + dma_addr_t iova, size_t size)
>> >> +{
>> >> + struct apple_nvme *anv = cookie;
>> >> + int ret;
>> >> +
>> >> + if (iova)
>> >> + return -EINVAL;
>> >> +
>> >> + bfr->buffer = dma_alloc_coherent(anv->dev, size, &iova, GFP_KERNEL);
>> >> + if (!bfr->buffer)
>> >> + return -ENOMEM;
>> >
>> > You pass 'iova' as an argument, but then replace it with the address
>> > returned by dma_alloc_coherent(). Can you remove the function
>> > argument?
>>
>> Yup, will remove it.
>
> You can remove it but we will have to add it back once we submit the dcp
> driver (display co-processor). dcp is initialized during boot and uses a
> single pre-allocated buffer which needs to be mapped instead of
> allocated. It seemed easier to make apple_rtkit_ops.shmem_setup()
> omnipotent than adding a different function pointer for this case.

Or we can already pass the iova DCP sent us into bfr->iova
and this function then has the task to just "do whatever is required
so that struct apple_rtkit_shmem *bfr is usable".


Sven