[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87wmqxg2eu.ffs@tglx>
Date: Wed, 21 Feb 2024 18:20:09 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: "Gupta, Nipun" <nipun.gupta@....com>, gregkh@...uxfoundation.org,
maz@...nel.org, jgg@...pe.ca, linux-kernel@...r.kernel.org
Cc: git@....com, harpreet.anand@....com, pieter.jansen-van-vuuren@....com,
nikhil.agarwal@....com, michal.simek@....com, abhijit.gangurde@....com,
srivatsa@...il.mit.edu
Subject: Re: [PATCH v7] cdx: add MSI support for CDX bus
On Wed, Feb 21 2024 at 18:10, Gupta, Nipun wrote:
> On 2/19/2024 8:26 PM, Thomas Gleixner wrote:
>>> +int cdx_msi_domain_alloc_irqs(struct device *dev, unsigned int irq_count)
>>> +{
>>> + int ret;
>>> +
>>> + ret = msi_setup_device_data(dev);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ret = msi_domain_alloc_irqs_range(dev, MSI_DEFAULT_DOMAIN,
>>> + 0, irq_count - 1);
>>> + if (ret)
>>> + dev_err(dev, "Failed to allocate IRQs: %d\n", ret);
>>> +
>>> + return ret;
>>> +}
>>> +EXPORT_SYMBOL_GPL(cdx_msi_domain_alloc_irqs);
>>
>> Why does this need a special allocation function instead of setting the
>> irq domain of the device and using the generic allocation function
>> directly?
>
> Do you suggest we call msi_setup_device_data() during the
> cdx_device_add() in the CDX bus where we also assign the IRQ domain to
> the device; so CDX device driver can directly call
> msi_domain_alloc_irqs_range() API to allocate the IRQs?
That sounds about right. It avoids doing it in the drivers and does not
require a special function. Maybe an inline wrapper to convert the
simple count to the range required.
>>> +
>>> +#ifdef GENERIC_MSI_DOMAIN_OPS
>>> + /* Set the device Id to be passed to the GIC-ITS */
>>> + info->scratchpad[0].ul = dev_id;
>>> +#endif
>>
>> Is this ever used on a platform which does not have
>> GENERIC_MSI_DOMAIN_OPS ?
>
> This was added to enable the COMPILE_TEST.
Ah. Ok.
Thanks,
tglx
Powered by blists - more mailing lists