From patchwork Thu Apr 4 12:23:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Garzarella X-Patchwork-Id: 1919781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UvJyu64m; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9LSs4yZ5z1yYf for ; Thu, 4 Apr 2024 23:26:21 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsM8f-0000pm-Cp; Thu, 04 Apr 2024 08:24:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsM8b-0000pB-Nc for qemu-devel@nongnu.org; Thu, 04 Apr 2024 08:24:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsM8Z-00011r-J3 for qemu-devel@nongnu.org; Thu, 04 Apr 2024 08:24:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712233450; 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=kzYc+J54vOGcpzVPbA08PRAO84CKwMnNUHeaTVFrt3k=; b=UvJyu64mjfqqnJ8CAraTqm0LC+QrsoyAA5b2cF/aU6H7XGvJRGlaEspEYk1ZauFzluBJnI 6wZN9MhwEdBGbcg4Qzd/DhemE5HL9HA4HfLj3MXl0iLj98n3ubvuK7/L6zoGMnSTi1Yhvu X5EVE4zDJP4UTxlbgP4HJxlZ9IaXEno= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-TCQ1EZpnO_indoT5oAYsJg-1; Thu, 04 Apr 2024 08:24:09 -0400 X-MC-Unique: TCQ1EZpnO_indoT5oAYsJg-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a46852c2239so60998966b.1 for ; Thu, 04 Apr 2024 05:24:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712233447; x=1712838247; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kzYc+J54vOGcpzVPbA08PRAO84CKwMnNUHeaTVFrt3k=; b=M/MxXjryxY3p5c74CpOGw4QYYQ3ZSCh/24FWp8BCUeBgnkpL7FR3Kyxc4JDYifenYv wmpcJjRAssyZXktWUe0wp9AUdQ846vYFen8p8UJErKA/ujj9Kt9p7yc6PoLG2pDjnsz+ I/CruF/84KyQCdTswjr2dwHcBONNeqyuWjc1YLl0+yCV4knq6acK7K3zoDiFJfNrgwKF ZsqbE9IKrgEo1CFYBVVFcCnLo5QGcys6cQkanf3fVsg3d0JN9LIsso2d2bA3cGCkJxcw APltttj5c/jV/vA66HZnRyf+sgg5og8tJhC6HvlbwPoFjowX+ti1cwFNaT8onzhOnnbO S+3Q== X-Gm-Message-State: AOJu0YwqoxNP74lVBT0w6a0AoKaDR+BprksD9ySYqdS0uNYGpAdXCoLj LEN++mAQtJoIyoJgK1Pu4ZeVpKRU/DTY17xPxV29NE11QqhTKQorOBj3LQGlxgmtHo8PI9BJPan O6DvUwRkoq6OP+Z967lCEjeoBzQm0gZtIyz/FxqzB8RHnpDxhVVRwZTi+m5uOmgIDvFJRXFPbGu yUP1tIPpcVlbu1XQOMSiK3XL5U6US7d+coprNB X-Received: by 2002:a17:906:94e:b0:a4e:4e8c:bedc with SMTP id j14-20020a170906094e00b00a4e4e8cbedcmr1437237ejd.53.1712233447566; Thu, 04 Apr 2024 05:24:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFA0DRjWjymIeLJkewZMdnq50nfbl8le8bp+v6WOjYoCk+nvvjtEE8qK6+sYbGLj04IY8W+AA== X-Received: by 2002:a17:906:94e:b0:a4e:4e8c:bedc with SMTP id j14-20020a170906094e00b00a4e4e8cbedcmr1437206ejd.53.1712233447297; Thu, 04 Apr 2024 05:24:07 -0700 (PDT) Received: from localhost.localdomain (host-87-12-25-33.business.telecomitalia.it. [87.12.25.33]) by smtp.gmail.com with ESMTPSA id r17-20020a170906705100b00a42f6d17123sm8943953ejj.46.2024.04.04.05.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 05:24:06 -0700 (PDT) From: Stefano Garzarella To: qemu-devel@nongnu.org Cc: Coiby Xu , "Michael S. Tsirkin" , qemu-block@nongnu.org, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , slp@redhat.com, Eduardo Habkost , Kevin Wolf , Hanna Reitz , Igor Mammedov , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth , Raphael Norwitz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Brad Smith , stefanha@redhat.com, Eric Blake , Paolo Bonzini , Laurent Vivier , David Hildenbrand , Markus Armbruster , gmaglione@redhat.com, Jason Wang , Stefano Garzarella Subject: [PATCH for-9.1 v3 06/11] vhost-user: enable frontends on any POSIX system Date: Thu, 4 Apr 2024 14:23:25 +0200 Message-ID: <20240404122330.92710-7-sgarzare@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404122330.92710-1-sgarzare@redhat.com> References: <20240404122330.92710-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-type: text/plain Received-SPF: pass client-ip=170.10.133.124; envelope-from=sgarzare@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The vhost-user protocol is not really Linux-specific so let's enable vhost-user frontends for any POSIX system. In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux specific header, let's define it for other systems as well. Signed-off-by: Stefano Garzarella --- meson.build | 1 - hw/net/vhost_net.c | 5 +++++ hw/block/Kconfig | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index c9c3217ba4..c19d51501a 100644 --- a/meson.build +++ b/meson.build @@ -151,7 +151,6 @@ have_tpm = get_option('tpm') \ # vhost have_vhost_user = get_option('vhost_user') \ - .disable_auto_if(host_os != 'linux') \ .require(host_os != 'windows', error_message: 'vhost-user is not available on Windows').allowed() have_vhost_vdpa = get_option('vhost_vdpa') \ diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index fd1a93701a..fced429813 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -34,8 +34,13 @@ #include "standard-headers/linux/virtio_ring.h" #include "hw/virtio/vhost.h" #include "hw/virtio/virtio-bus.h" +#if defined(__linux__) #include "linux-headers/linux/vhost.h" +#endif +#ifndef VHOST_FILE_UNBIND +#define VHOST_FILE_UNBIND -1 +#endif /* Features supported by host kernel. */ static const int kernel_feature_bits[] = { diff --git a/hw/block/Kconfig b/hw/block/Kconfig index 9e8f28f982..29ee09e434 100644 --- a/hw/block/Kconfig +++ b/hw/block/Kconfig @@ -40,7 +40,7 @@ config VHOST_USER_BLK bool # Only PCI devices are provided for now default y if VIRTIO_PCI - depends on VIRTIO && VHOST_USER && LINUX + depends on VIRTIO && VHOST_USER config SWIM bool