From patchwork Wed Nov 13 14:26:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13873844 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B96292038B3; Wed, 13 Nov 2024 14:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731507999; cv=none; b=oQjvdmy0F44AhsjN3Oq5xjUgdmxrNaQ7TJztntSt9mUkHHDpSZ328ACHFi/3leBxu2JIjUaj5lpa2eE3nxxFXRRkjlCtfIDl2ehM7Mx5M7SzEqW+7rGMG3GHZ5N/vmfjdH1URFiM4uZZLwBBKmukhCNeFz2057rK0n3/MeReJzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731507999; c=relaxed/simple; bh=ykozEZT9S6rCqtY4BFNlhiPo2SLAkwdyL9yKIvPlm0Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VoePgvozQ61DXyEqHgyM8R9wfrkP/fCghS/mI0PfyKhDZ/LB6w8AAslhRr+akMEdoJkchZQr/46NR1hF3mwLd1i8I8NAmqDJHr3KhfkfSKOav1WzXRA7TxTSa8C0wJgzTLeKNBbZHlmJgITJ3QT+rsz4ejIJSgjAenbnfQsPtrg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LAho7g8S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LAho7g8S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D77ABC4CEDC; Wed, 13 Nov 2024 14:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731507999; bh=ykozEZT9S6rCqtY4BFNlhiPo2SLAkwdyL9yKIvPlm0Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LAho7g8Sx8pHXhA/A3+lvNmYwqWF+/vwwUcpNhr3BWcFrfmNTwXtjzxd6yOX4o7Y4 tlsFNFiKqjYsnb/6akmCJklODLLX1AqfWoXw9txNJxXqYmc43UPiq3SNf0AQTm7NYx Mhp2CCSTlXRmixLyVraAtqo+2DvTGJ5MMrdXQhKgWWtcUPVx98jfMWeu+CXkhGV0vI OY49Zwyp0wqAkzwSWmIFbG5k8QlVtFpp6c6FoecbOVWcKjbHW4JMi1rFtwLu3fPpbG hP3SLoDnOCW5sIHtv4D3MpKltXNgTOND7b+nRzY8D4RSI2qhCKYpMXqYmKIpiq2jbX ZgyB9+whkOReg== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:18 +0100 Subject: [PATCH v4 04/10] virtio: hookup irq_get_affinity callback Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-4-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner X-Mailer: b4 0.14.2 struct bus_type has a new callback for retrieving the IRQ affinity for a device. Hook this callback up for virtio based devices. Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner Reviewed-by: Ming Lei --- drivers/virtio/virtio.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index b9095751e43bb7db5fc991b0cc0979d2e86f7b9b..4ca6ec84cb092eac7ddf4b86b4eacac099b480cf 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_vec) +{ + struct virtio_device *dev = dev_to_virtio(_d); + + if (!dev->config->get_vq_affinity) + return NULL; + + return dev->config->get_vq_affinity(dev, irq_vec); +} + 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)