From patchwork Wed Jun 12 13:01:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefano Garzarella X-Patchwork-Id: 1946895 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=IMHSQGsR; 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 4VzmBb4xKxz20Wd for ; Wed, 12 Jun 2024 23:11:03 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHNdP-0006lb-Gb; Wed, 12 Jun 2024 09:03:27 -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 1sHNdN-0006kT-UP for qemu-devel@nongnu.org; Wed, 12 Jun 2024 09:03:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHNdM-0008ER-BU for qemu-devel@nongnu.org; Wed, 12 Jun 2024 09:03:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718197403; 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=W9nNY1euX5/uZx9rZmDV5gA5I22VILqEg+kz3/RnvbQ=; b=IMHSQGsRYQUMPysNYgjB3BYAjNf/p+jCQr89GV/1ZjEjhVFz+JvdkZCjCEzoqDJOno1vNB ADM6EtpOf7cNk8Cb6A8C+yJmd8nI/+ZC9h31GFT2cnd5HL5IS7pkhUM3dI4PlhZE45YcsX HzJKzOi4SRiY30n10bHf3YZpP/cHBa4= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-0H2dSwAcMIaUN0o7OE7q_A-1; Wed, 12 Jun 2024 09:03:21 -0400 X-MC-Unique: 0H2dSwAcMIaUN0o7OE7q_A-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-795d19c522eso326860185a.1 for ; Wed, 12 Jun 2024 06:03:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718197401; x=1718802201; 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=W9nNY1euX5/uZx9rZmDV5gA5I22VILqEg+kz3/RnvbQ=; b=I42ryJ00RaHdnG0wtNJ84mcgGMqkkJLtKeVLuFZLoMztVVJ13wkj2n2//IQIlxqc2N nFSrbnn31C2q4E6LRKRG7bdJ7b5cDgEDgP0K/QuA61vUrLo38BubefT4w7iSmdsw1cey +3ASTApgIHhRXGHo1CKnHRO2HhHoPAU4Ro7liXwNe4xQeF4mgSkKW4OutWwrS205vUWj aYyCJFolo3XQGVfled5BZBZ2fNNDROSYo3Yc1dgwJEDU7f7nZr3x3N//kzeJL9Vx2MFC QlSY9tbWHV8S1rvVmkqfU2GbaD+bdK6uOxkBHW6QsB32tjUWKn1wOBVPj1Uk9oz9KNTs FYLQ== X-Forwarded-Encrypted: i=1; AJvYcCVS0evorTOs5Y53xiDQ3PQewMxxdgRDPw48sViNdPOxaAkv2z+tMWufHZoRB1bdkQOlDDrwGcRshKC3sQoGtli7VDXvu3o= X-Gm-Message-State: AOJu0YyAmWR85ek4gI6ku5UzwKPC57OavG1fsUXfbJFNJnegPCyWQYKv N91QsndexxKOAHeS8T1nREBiha+R8glnsa3b95MLlRXkhPrimvJNThtv/9jbFBs85VEenWFflGm C+EpFloJ0JmizTSnUBYEnY0jNdVTDGrcjdBIedR3JfFMGdYnMRZlM X-Received: by 2002:a05:620a:3193:b0:795:5de4:662e with SMTP id af79cd13be357-797f5f00567mr225193485a.12.1718197400668; Wed, 12 Jun 2024 06:03:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFam35WX5YR7D+kjZ2CAmAzS8qpFT9IWRPbjmsn4XijrL6t7TgyWQU97gaGUhGnxegZzaDHPw== X-Received: by 2002:a05:620a:3193:b0:795:5de4:662e with SMTP id af79cd13be357-797f5f00567mr225188285a.12.1718197400184; Wed, 12 Jun 2024 06:03:20 -0700 (PDT) Received: from step1.redhat.com ([193.207.132.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-797e8f4906bsm122609285a.80.2024.06.12.06.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 06:03:16 -0700 (PDT) From: Stefano Garzarella To: mst@redhat.com, qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Brad Smith , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Laurent Vivier , gmaglione@redhat.com, stefanha@redhat.com, Coiby Xu , Gerd Hoffmann , slp@redhat.com, Igor Mammedov , Raphael Norwitz , Thomas Huth , Eduardo Habkost , David Hildenbrand , Kevin Wolf , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jason Wang , Markus Armbruster , Eric Blake , Stefano Garzarella Subject: [PATCH RESEND v7 07/12] vhost-user: enable frontends on any POSIX system Date: Wed, 12 Jun 2024 15:01:35 +0200 Message-ID: <20240612130140.63004-8-sgarzare@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240612130140.63004-1-sgarzare@redhat.com> References: <20240612130140.63004-1-sgarzare@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=sgarzare@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.143, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand 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 ec59effca2..239044070f 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