Re: [PATCH 1/2] driver core: auxiliary bus: show auxiliary device IRQs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 04/05/2024 20:50, Simon Horman wrote:
External email: Use caution opening links or attachments


On Fri, May 03, 2024 at 07:31:03AM +0300, Shay Drory wrote:
PCI subfunctions (SF) are anchored on the auxiliary bus. PCI physical
and virtual functions are anchored on the PCI bus;  the irq information
of each such function is visible to users via sysfs directory "msi_irqs"
containing file for each irq entry. However, for PCI SFs such information
is unavailable. Due to this users have no visibility on IRQs used by the
SFs.
Secondly, an SF is a multi function device supporting rdma, netdevice
and more. Without irq information at the bus level, the user is unable
to view or use the affinity of the SF IRQs.

Hence to match to the equivalent PCI PFs and VFs, add "irqs" directory,
for supporting auxiliary devices, containing file for each irq entry.

Additionally, the PCI SFs sometimes share the IRQs with peer SFs. This
information is also not available to the users. To overcome this
limitation, each irq sysfs entry shows if irq is exclusive or shared.

For example:
$ ls /sys/bus/auxiliary/devices/mlx5_core.sf.1/irqs/
50  51  52  53  54  55  56  57  58
$ cat /sys/bus/auxiliary/devices/mlx5_core.sf.1/irqs/52
exclusive

Reviewed-by: Parav Pandit <parav@xxxxxxxxxx>
Signed-off-by: Shay Drory <shayd@xxxxxxxxxx>

...

diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c

...

+static int auxiliary_irq_create(int irq)
+{
+     refcount_t *ref;
+     int ret = 0;
+
+     mutex_lock(&irqs_lock);
+     ref = xa_load(&irqs, irq);
+     if (ref && refcount_inc_not_zero(ref))
+             goto out;
+
+     ref = kzalloc(sizeof(ref), GFP_KERNEL);

Hi Shay,

Should this be sizeof(*ref) ?

yes, will fix in v2


Flagged by Coccinelle.

+     if (!ref) {
+             ret = -ENOMEM;
+             goto out;
+     }
+
+     refcount_set(ref, 1);
+     ret = xa_insert(&irqs, irq, ref, GFP_KERNEL);
+     if (ret)
+             kfree(ref);
+
+out:
+     mutex_unlock(&irqs_lock);
+     return ret;
+}
+
+/**
+ * auxiliary_device_sysfs_irq_add - add a sysfs entry for the given IRQ
+ * @auxdev: auxiliary bus device to add the sysfs entry.
+ * @irq: The associated Linux interrupt number.
+ *
+ * This function should be called after auxiliary device have successfully
+ * received the irq.

It would be nice to include a Return section to this kernel doc.

Flagged by ./scripts/kernel-doc -none -Wall

will add in v2


+ */
+int auxiliary_device_sysfs_irq_add(struct auxiliary_device *auxdev, int irq)

...




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux