diff mbox series

[v3,3/8] virtio: hookup irq_get_affinity callback

Message ID 20241112-refactor-blk-affinity-helpers-v3-3-573bfca0cbd8@kernel.org (mailing list archive)
State New
Headers show
Series blk: refactor queue affinity helpers | expand

Commit Message

Daniel Wagner Nov. 12, 2024, 1:26 p.m. UTC
struct bus_type has a new callback for retrieving the IRQ affinity for a
device. Hook this callback up for virtio based devices.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
---
 drivers/virtio/virtio.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Christoph Hellwig Nov. 12, 2024, 4:55 p.m. UTC | #1
On Tue, Nov 12, 2024 at 02:26:18PM +0100, Daniel Wagner wrote:
> struct bus_type has a new callback for retrieving the IRQ affinity for a
> device. Hook this callback up for virtio based devices.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
kernel test robot Nov. 12, 2024, 10:07 p.m. UTC | #2
Hi Daniel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on c9af98a7e8af266bae73e9d662b8341da1ec5824]

url:    https://github.com/intel-lab-lkp/linux/commits/Daniel-Wagner/driver-core-bus-add-irq_get_affinity-callback-to-bus_type/20241112-213257
base:   c9af98a7e8af266bae73e9d662b8341da1ec5824
patch link:    https://lore.kernel.org/r/20241112-refactor-blk-affinity-helpers-v3-3-573bfca0cbd8%40kernel.org
patch subject: [PATCH v3 3/8] virtio: hookup irq_get_affinity callback
config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20241113/202411130521.UOBdW8Rv-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241113/202411130521.UOBdW8Rv-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411130521.UOBdW8Rv-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/virtio/virtio.c:389: warning: Function parameter or struct member 'irq_veq' not described in 'virtio_irq_get_affinity'
>> drivers/virtio/virtio.c:389: warning: Excess function parameter 'irq_vec' description in 'virtio_irq_get_affinity'


vim +389 drivers/virtio/virtio.c

   379	
   380	/**
   381	 * virtio_irq_get_affinity - get IRQ affinity mask for device
   382	 * @_d: ptr to dev structure
   383	 * @irq_vec: interrupt vector number
   384	 *
   385	 * Return the CPU affinity mask for @_d and @irq_vec.
   386	 */
   387	static const struct cpumask *virtio_irq_get_affinity(struct device *_d,
   388							     unsigned int irq_veq)
 > 389	{
   390		struct virtio_device *dev = dev_to_virtio(_d);
   391	
   392		if (!dev->config->get_vq_affinity)
   393			return NULL;
   394	
   395		return dev->config->get_vq_affinity(dev, irq_veq);
   396	}
   397
Hannes Reinecke Nov. 13, 2024, 9:47 a.m. UTC | #3
On 11/12/24 14:26, Daniel Wagner wrote:
> struct bus_type has a new callback for retrieving the IRQ affinity for a
> device. Hook this callback up for virtio based devices.
> 
> Signed-off-by: Daniel Wagner <wagi@kernel.org>
> ---
>   drivers/virtio/virtio.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index b9095751e43bb7db5fc991b0cc0979d2e86f7b9b..7774aecdfe52d4dce11eb77e43864981a2e2b2bb 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -377,6 +377,24 @@  static void virtio_dev_remove(struct device *_d)
 	of_node_put(dev->dev.of_node);
 }
 
+/**
+ * virtio_irq_get_affinity - get IRQ affinity mask for device
+ * @_d: ptr to dev structure
+ * @irq_vec: interrupt vector number
+ *
+ * Return the CPU affinity mask for @_d and @irq_vec.
+ */
+static const struct cpumask *virtio_irq_get_affinity(struct device *_d,
+						     unsigned int irq_veq)
+{
+	struct virtio_device *dev = dev_to_virtio(_d);
+
+	if (!dev->config->get_vq_affinity)
+		return NULL;
+
+	return dev->config->get_vq_affinity(dev, irq_veq);
+}
+
 static const struct bus_type virtio_bus = {
 	.name  = "virtio",
 	.match = virtio_dev_match,
@@ -384,6 +402,7 @@  static const struct bus_type virtio_bus = {
 	.uevent = virtio_uevent,
 	.probe = virtio_dev_probe,
 	.remove = virtio_dev_remove,
+	.irq_get_affinity = virtio_irq_get_affinity,
 };
 
 int __register_virtio_driver(struct virtio_driver *driver, struct module *owner)