From patchwork Thu Feb 13 15:49:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Lopez X-Patchwork-Id: 13973510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96221C0219D for ; Thu, 13 Feb 2025 15:50:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C3A310EB12; Thu, 13 Feb 2025 15:50:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="DgACdXV6"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 818D610EB12 for ; Thu, 13 Feb 2025 15:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739461841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6TQz/AuXSm/jcXE77n/JSiGUw0PfjU842fJdja2/VcI=; b=DgACdXV6zHZQ4V0Zvyz+DTYN2wmrAcQzd+W339B+tn8KWKcg+mV4+byOt3FYf1queOnt5Z gkMZ9KDuJcaZjde2OQtFwHSOZphxVt2+hSitSNqPiBeHw2ku1YLgttzJ5IrHblPIKskLpv Fv0kZhUJzr23SUqOQVwaiWyFszpHAtM= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-324-52usUm0fP0qRHnq_Qf1pew-1; Thu, 13 Feb 2025 10:50:33 -0500 X-MC-Unique: 52usUm0fP0qRHnq_Qf1pew-1 X-Mimecast-MFC-AGG-ID: 52usUm0fP0qRHnq_Qf1pew_1739461831 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4AD4818004A7; Thu, 13 Feb 2025 15:50:31 +0000 (UTC) Received: from [127.0.1.1] (unknown [10.44.33.58]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 93C9B1800365; Thu, 13 Feb 2025 15:50:25 +0000 (UTC) From: Sergio Lopez Date: Thu, 13 Feb 2025 16:49:16 +0100 Subject: [PATCH RFC 2/5] virtio: introduce VIRTIO_F_SHM_PAGE_SIZE MIME-Version: 1.0 Message-Id: <20250213-virtio-shm-page-size-v1-2-5ee1f9984350@redhat.com> References: <20250213-virtio-shm-page-size-v1-0-5ee1f9984350@redhat.com> In-Reply-To: <20250213-virtio-shm-page-size-v1-0-5ee1f9984350@redhat.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter , Rob Clark , Dmitry Osipenko , fnkl.kernel@gmail.com Cc: virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sergio Lopez X-Developer-Signature: v=1; a=openpgp-sha256; l=2345; i=slp@redhat.com; h=from:subject:message-id; bh=QFdyFSfT3/4SWG9ZxXlf5iQzWwyJCONhEMZSH8OxQDM=; b=owEBbQKS/ZANAwAIAfRpJ40vDAI1AcsmYgBnrhStylNLMTT77Zr70CH3mC0kJqxktuN3LCCsg tnCFcVTa3yJAjMEAAEIAB0WIQS+1fz3US2GgJFC6KL0aSeNLwwCNQUCZ64UrQAKCRD0aSeNLwwC NZqmD/9DXwIcQu7/ILLvZOWvdxn9+Ye3CGeCADk5JnxPU0Z81fskxGRGa5lTCHCY87Gl6QFEQvG UINwli3B85/HdKrWo022BePUxPTQLp5FozatRSG+T0//2+1gw0lolaTesnkIjXxfCgXGxh5s4gD gon6X0A+PtUWkum0UJokqKyxVxoIHg1SeQGpSYZwBzKNuTx8gNz4CVmaIZIx3lEFL8/UjduIzY6 aYA+EwkVMrmxdpdNPHRoWvl/qnurDh2eLUqHeHt61PzwaxUmoSZZgxhjxc9/44WZUI4PIJdQtZe xFZlFVIGMrMPlEHk98UIIdgre9Np2XB3mhuntMoP+7LEDp8EYOBxvMPxWWQkTL/M/8s0BqAjKjG ja3grjYBvXaEPT8F8MJmsRnDKCJb57A2Wi6mQE+YBQ6TKLR0lKp0GzbLm05FuQWigxRhQnDa/qA Yztgpc4cpiZRsgqBs37g/+/S4c6sv8EcKtD/M0Wy7SA0yQtKPHVJglGxTwgguF89CqM7rW3Ozg4 QslBotsRTVlGACVi9qQwHmSKL1Rb/AWw8sz9OviHsYVkGwWpR8J81ToeFq4Zvd8luCRQhlD73kW YpvG7lyZEUdPEhyAkRDZaQ4IP4BQlHcQTm4Wu7fedAfdWYWFB1tJYWPx1lonn8AbXvZxppC4Qf3 TkqlXm2Fs5sykTQ== X-Developer-Key: i=slp@redhat.com; a=openpgp; fpr=BED5FCF7512D86809142E8A2F469278D2F0C0235 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce VIRTIO_F_SHM_PAGE_SIZE, a feature bit which indicates that the transport provides the page size for SHM regions. Signed-off-by: Sergio Lopez --- drivers/virtio/virtio_pci_modern.c | 3 +++ drivers/virtio/virtio_ring.c | 2 ++ include/uapi/linux/virtio_config.h | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index 4e6c28aacd1b5dfc117337a689a25d668805e334..79616ce5057bf3b2b88cae7e8fb7729efa9dd632 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -367,6 +367,9 @@ static void vp_transport_features(struct virtio_device *vdev, u64 features) if (features & BIT_ULL(VIRTIO_F_ADMIN_VQ)) __virtio_set_bit(vdev, VIRTIO_F_ADMIN_VQ); + + if (features & BIT_ULL(VIRTIO_F_SHM_PAGE_SIZE)) + __virtio_set_bit(vdev, VIRTIO_F_SHM_PAGE_SIZE); } static int __vp_check_common_size_one_feature(struct virtio_device *vdev, u32 fbit, diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index fdd2d2b07b5a2aca864bc917306536685afb66a6..d853d5cf7e553be8bbe0ff461dc7312b258c6e58 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -2983,6 +2983,8 @@ void vring_transport_features(struct virtio_device *vdev) break; case VIRTIO_F_NOTIFICATION_DATA: break; + case VIRTIO_F_SHM_PAGE_SIZE: + break; default: /* We don't understand this bit. */ __virtio_clear_bit(vdev, i); diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h index 2445f365bce74b4e926c6929322b269252ab6830..3171e3792263c2cd472ac09da18e593ab400751d 100644 --- a/include/uapi/linux/virtio_config.h +++ b/include/uapi/linux/virtio_config.h @@ -52,7 +52,7 @@ * rest are per-device feature bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 42 +#define VIRTIO_TRANSPORT_F_END 43 #ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've @@ -120,4 +120,9 @@ */ #define VIRTIO_F_ADMIN_VQ 41 +/* + * This feature indicates that the transport provides the SHM page size. + */ +#define VIRTIO_F_SHM_PAGE_SIZE 42 + #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */