cdx: add MSI support for CDX bus
Add CDX-MSI domain per CDX controller with gic-its domain as a parent, to support MSI for CDX devices. CDX devices allocate MSIs from the CDX domain. Also, introduce APIs to alloc and free IRQs for CDX domain. In CDX subsystem firmware is a controller for all devices and their configuration. CDX bus controller sends all the write_msi_msg commands to firmware running on RPU and the firmware interfaces with actual devices to pass this information to devices Since, CDX controller is the only way to communicate with the Firmware for MSI write info, CDX domain per controller required in contrast to having a CDX domain per device. Co-developed-by: Nikhil Agarwal <nikhil.agarwal@amd.com> Signed-off-by: Nikhil Agarwal <nikhil.agarwal@amd.com> Co-developed-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Signed-off-by: Nipun Gupta <nipun.gupta@amd.com> Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Nikhil Agarwal <nikhil.agarwal@amd.com> Link: https://lore.kernel.org/r/20240226082816.100872-1-nipun.gupta@amd.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e3a59056a6
commit
0e439ba38e
@ -56,6 +56,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/irqdomain.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
@ -302,8 +303,19 @@ static int cdx_probe(struct device *dev)
|
||||
{
|
||||
struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
|
||||
struct cdx_device *cdx_dev = to_cdx_device(dev);
|
||||
struct cdx_controller *cdx = cdx_dev->cdx;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Setup MSI device data so that generic MSI alloc/free can
|
||||
* be used by the device driver.
|
||||
*/
|
||||
if (cdx->msi_domain) {
|
||||
error = msi_setup_device_data(&cdx_dev->dev);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
error = cdx_drv->probe(cdx_dev);
|
||||
if (error) {
|
||||
dev_err_probe(dev, error, "%s failed\n", __func__);
|
||||
@ -787,6 +799,7 @@ int cdx_device_add(struct cdx_dev_params *dev_params)
|
||||
|
||||
/* Populate CDX dev params */
|
||||
cdx_dev->req_id = dev_params->req_id;
|
||||
cdx_dev->msi_dev_id = dev_params->msi_dev_id;
|
||||
cdx_dev->vendor = dev_params->vendor;
|
||||
cdx_dev->device = dev_params->device;
|
||||
cdx_dev->subsystem_vendor = dev_params->subsys_vendor;
|
||||
@ -804,12 +817,19 @@ int cdx_device_add(struct cdx_dev_params *dev_params)
|
||||
cdx_dev->dev.bus = &cdx_bus_type;
|
||||
cdx_dev->dev.dma_mask = &cdx_dev->dma_mask;
|
||||
cdx_dev->dev.release = cdx_device_release;
|
||||
cdx_dev->msi_write_pending = false;
|
||||
mutex_init(&cdx_dev->irqchip_lock);
|
||||
|
||||
/* Set Name */
|
||||
dev_set_name(&cdx_dev->dev, "cdx-%02x:%02x",
|
||||
((cdx->id << CDX_CONTROLLER_ID_SHIFT) | (cdx_dev->bus_num & CDX_BUS_NUM_MASK)),
|
||||
cdx_dev->dev_num);
|
||||
|
||||
if (cdx->msi_domain) {
|
||||
cdx_dev->num_msi = dev_params->num_msi;
|
||||
dev_set_msi_domain(&cdx_dev->dev, cdx->msi_domain);
|
||||
}
|
||||
|
||||
ret = device_add(&cdx_dev->dev);
|
||||
if (ret) {
|
||||
dev_err(&cdx_dev->dev,
|
||||
|
Reference in New Issue
Block a user