public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Gupta, Nipun" <nipun.gupta@amd.com>,
	gregkh@linuxfoundation.org, maz@kernel.org, jgg@ziepe.ca,
	linux-kernel@vger.kernel.org
Cc: git@amd.com, harpreet.anand@amd.com,
	pieter.jansen-van-vuuren@amd.com, nikhil.agarwal@amd.com,
	michal.simek@amd.com, abhijit.gangurde@amd.com,
	srivatsa@csail.mit.edu
Subject: Re: [PATCH v7] cdx: add MSI support for CDX bus
Date: Wed, 21 Feb 2024 18:20:09 +0100	[thread overview]
Message-ID: <87wmqxg2eu.ffs@tglx> (raw)
In-Reply-To: <929bf3bd-fb5a-4d1d-aa46-a5ce43ce574b@amd.com>

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

      reply	other threads:[~2024-02-21 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 11:38 [PATCH v7] cdx: add MSI support for CDX bus Nipun Gupta
2024-02-19 14:56 ` Thomas Gleixner
2024-02-21 12:40   ` Gupta, Nipun
2024-02-21 17:20     ` Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmqxg2eu.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=abhijit.gangurde@amd.com \
    --cc=git@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=harpreet.anand@amd.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=pieter.jansen-van-vuuren@amd.com \
    --cc=srivatsa@csail.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox