Re: [RFC PATCH 00/11] Refactor MSI to support Non-PCI device

From: Yijing Wang
Date: Wed Aug 20 2014 - 03:56:46 EST


>>> We in Freescale will be using MSI for the devices behind a new-bus (which is
>> not PCI based), We have a separate bus driver for same. And this new bus driver
>> register/provide its own address/data write function which is based on that
>> specific bus protocol.
>>
>> Hi Bharat, I'm glad to know your MSI device working mode.
>> Provide the private MSI setup functions in bus-driver layer can't apply to all
>> Non-PCI MSI devices, because we can not guarantee Non-PCI MSI devices are always
>> on a bus. The existing HPET, DMAR device both have no bus bind.
>
> Yes, that's why I was not sure of bus-driver or device-driver model.
>
>> I'm working on a
>> new MSI setup framework, as you mentioned before, in device-driver model.
>>
>> I abstracted a new virtual device (called struct msi_dev), this msi_dev will
>> manage all MSI info,
>
> Will this "struct msi_dev" will be part of "struct device"?

struct msi_dev contains the struct device

piece code:

struct msi_dev {
u8 type;
u8 enabled;
u8 nvec;
u8 nvec_retry;
char *id;
void __iomem *base;
struct msix_entry *entries;
struct list_head msi_list;
struct device dev;
void *msi_data;
struct msi_driver *driver;
const struct attribute_group **irq_groups;
};


struct msi_driver {
const char *name;
char *id;
void (*msi_set_enable)(struct msi_dev *dev, int enable);
int (*msi_setup_entry)(struct msi_dev *dev, struct msi_desc *entry);
int (*msix_setup_entries)(struct msi_dev *dev, struct msi_desc *entry, int index);
u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag);
u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag);
void (*msi_read_message)(struct msi_desc *desc, struct msi_msg *msg);
void (*msi_write_message)(struct msi_desc *desc, struct msi_msg *msg);
void (*msi_set_legacy_irq)(struct msi_dev *dev, int enable);
struct device_driver driver;
};

Thanks!
Yijing.

>
>> and a new bus named msi_bus, also introduced a new driver
>> msi_driver, msi_bus is responsible for binding msi_dev and msi_driver.
>> All MSI devices will be classified into different MSI device types, like
>> MSI_TYPE_PCI, MSI_TYPE_HPET, MSI_TYPE_DMAR, etc..
>>
>> Each MSI type device should provide a private struct msi_driver. msi_driver
>> should contain the type specific MSI ops functions to help setup and enable MSI
>> device, request MSI irq.
>>
>> I almost finish the first draft, and will post out next week in plan :)
>
> Will be looking forward to next version.
>
> Thanks
> -Bharat
>
>>
>>
>> Thanks!
>> Yijing.
>>
>>>
>>> Thanks
>>> -Bharat
>>>
>>>>
>>>> My patchset is just a RFC draft, I will update it later, all we want
>>>> to do is make kernel support Non-PCI MSI devices.
>>>>
>>>> Thanks!
>>>> Yijing.
>>>>
>>>>
>>>>>
>>>>> Thanks
>>>>> Arnab
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe
>>>>> linux-kernel" in the body of a message to majordomo@xxxxxxxxxxxxxxx
>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>> Please read the FAQ at http://www.tux.org/lkml/
>>>>>
>>>>> .
>>>>>
>>>>
>>>>
>>>> --
>>>> Thanks!
>>>> Yijing
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-pci"
>>>> in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo
>>>> info at http://vger.kernel.org/majordomo-info.html
>>>
>>> .
>>>
>>
>>
>> --
>> Thanks!
>> Yijing
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body
>> of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
>> http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
> .
>


--
Thanks!
Yijing

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/