From patchwork Wed Nov 16 15:05:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13045371 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6C3C433FE for ; Wed, 16 Nov 2022 15:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234414AbiKPPHr (ORCPT ); Wed, 16 Nov 2022 10:07:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233992AbiKPPHj (ORCPT ); Wed, 16 Nov 2022 10:07:39 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECAEA3FBA7 for ; Wed, 16 Nov 2022 07:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668611199; 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=KkEFc+fbOcKId5NgCA9Uao5tsVxIoOCfeJE3AaAaezk=; b=bCrsL/XFlDkcVNGFiHzO+pv51mPYiWYgUb7Svop/Z7lhu0LG/8DxMV6YlPJyw95g6tDu/x IaHFKDiaeJ25mhQRfuTWZkiCiLuhH22TdqBGr3DW686W1AGwQafyUW/Di+k1t6LR9BhvE2 udhXi0CxVOiEGT3+sVna4iQ1BBxLr7w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-MIIakxijPG-eKYNRgCI4ug-1; Wed, 16 Nov 2022 10:06:34 -0500 X-MC-Unique: MIIakxijPG-eKYNRgCI4ug-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3732185A78B; Wed, 16 Nov 2022 15:06:33 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D870140EBF3; Wed, 16 Nov 2022 15:06:30 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Cornelia Huck , Gautam Dawar , Eli Cohen , Stefano Garzarella , Harpreet Singh Anand , Paolo Bonzini , Stefan Hajnoczi , Cindy Lu , Liuxiangdong , "Gonglei (Arei)" , Jason Wang , Parav Pandit , Si-Wei Liu , Zhu Lingshan , Laurent Vivier , "Michael S. Tsirkin" , kvm@vger.kernel.org Subject: [PATCH for 8.0 v7 08/10] vdpa: Store x-svq parameter in VhostVDPAState Date: Wed, 16 Nov 2022 16:05:54 +0100 Message-Id: <20221116150556.1294049-9-eperezma@redhat.com> In-Reply-To: <20221116150556.1294049-1-eperezma@redhat.com> References: <20221116150556.1294049-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org CVQ can be shadowed two ways: - Device has x-svq=on parameter (current way) - The device can isolate CVQ in its own vq group QEMU needs to check for the second condition dynamically, because CVQ index is not known at initialization time. Since this is dynamic, the CVQ isolation could vary with different conditions, making it possible to go from "not isolated group" to "isolated". Saving the cmdline parameter in an extra field so we never disable CVQ SVQ in case the device was started with cmdline. Signed-off-by: Eugenio PĂ©rez Acked-by: Jason Wang --- net/vhost-vdpa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 89b01fcaec..5185ac7042 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -38,6 +38,8 @@ typedef struct VhostVDPAState { void *cvq_cmd_out_buffer; virtio_net_ctrl_ack *status; + /* The device always have SVQ enabled */ + bool always_svq; bool started; } VhostVDPAState; @@ -566,6 +568,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.device_fd = vdpa_device_fd; s->vhost_vdpa.index = queue_pair_index; + s->always_svq = svq; s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_tree = iova_tree; if (!is_datapath) {