Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp8634325ioo; Sat, 4 Jun 2022 13:57:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXETfjLsex2hKOt9Vl2CG4VAo+ZSjWYPOCGtrmAvaXvg7mjhtsDQObxVkHyE/orsF0VZrZ X-Received: by 2002:a17:90a:5301:b0:1e8:41d8:d0f5 with SMTP id x1-20020a17090a530100b001e841d8d0f5mr8043535pjh.175.1654376263857; Sat, 04 Jun 2022 13:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654376263; cv=none; d=google.com; s=arc-20160816; b=iu4qOIjVGiuAsZBbBS9j1ARl5JK8fW5CkhjcCjLqH1f8+epJyKygTo7aXRraSH3kzf Fe3cC1u62bKEPwFeES/j3sAcQB3oz/cLv3Dsn2NOUDL4OPlwlZz9SNLTXJRavYcEOCAn yyHrZUvrMJ0al1rmsorawIqXOhygCCOZlfMf5+BCP0CtjjeCDQ3gnT4JG9TWjiEBSJTX fNOhi5IXXeVqfYIrD38VazYHmm9T/pgrOqToktrizp0xIXzhSDTzTzl4Rltz5Sy7C1C3 vd2WOyjYWBcOLYdBptO9GaCO+LbGZRnLBzbicaOrJOA3SsMBn66szAThCNiV2XB02+nS q4pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=idp6ThZhNo+GCJ/QXSxEg9bFnM2OmX/SaaK0aBYeq44=; b=Qo/DKjObsiuXWaEYTM8sSkdBk4vDful8TGZstfbxxzupNLXWM/pzOVkAU7PRGwMw4u 6JmB+xIboHF0sDDyOnmp3oImgHdoGEmlVjj8UMnknSPcMJJCCRGWBpk1YB8ve/v7MbeG Fax0COASiqexx/8TJvP6PTjWDwRuzMK7ImT+DRZNUbodCdFQl6RhNesi67hOhhsvR5XL i/Vp+SRCtAsNGRjof+Jy6n+75jkzGmF59x+rvmJUpHeLmrw4sBpRiWXhlczyXLc90Ib7 DrvsguRIpKdTZUSf2Y7aqEZ6rGjjiexlMs8z9Ex825C4v8eyrWMnS5xC/S/oOFweAGLh 9N3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EKGhVfgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020a170902da8b00b0015cbb6e943fsi18441835plx.299.2022.06.04.13.57.04; Sat, 04 Jun 2022 13:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EKGhVfgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243381AbiFCKKH (ORCPT + 99 others); Fri, 3 Jun 2022 06:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243396AbiFCKKA (ORCPT ); Fri, 3 Jun 2022 06:10:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B97053B02F for ; Fri, 3 Jun 2022 03:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654250998; 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; bh=idp6ThZhNo+GCJ/QXSxEg9bFnM2OmX/SaaK0aBYeq44=; b=EKGhVfgk7jPD4HzoXeSgyrQefuoDW1k+rBHUJd1PRZKdjcgHssKSXq9oMiGqwBgQg/Q0br +zAtrz0YI7tQEdWcqzddJWjunEyqrncjygCMrcz9qME/wyx94TK6hAdmKAjgxQnCG4kioQ bEqRl+a4w5kkDW9YZ+e2Hh8pONCYAZQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-133-Knw5QX-HNVSZcpQAsToNAQ-1; Fri, 03 Jun 2022 06:09:54 -0400 X-MC-Unique: Knw5QX-HNVSZcpQAsToNAQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 494951C06EE5; Fri, 3 Jun 2022 10:09:53 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.40.192.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1964E492C3B; Fri, 3 Jun 2022 10:09:46 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: kvm@vger.kernel.org, Jason Wang , "Michael S. Tsirkin" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: Christophe JAILLET , Longpeng , Stefano Garzarella , dinang@xilinx.com, Piotr.Uminski@intel.com, martinpo@xilinx.com, tanuj.kamde@amd.com, Parav Pandit , Zhang Min , habetsm.xilinx@gmail.com, Zhu Lingshan , lulu@redhat.com, hanand@xilinx.com, martinh@xilinx.com, Si-Wei Liu , gautam.dawar@amd.com, Xie Yongji , ecree.xilinx@gmail.com, pabloc@xilinx.com, lvivier@redhat.com, Eli Cohen , Wu Zongyong , Dan Carpenter Subject: [PATCH v5 0/4] Implement vdpasim suspend operation Date: Fri, 3 Jun 2022 12:09:40 +0200 Message-Id: <20220603100944.871727-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement suspend operation for vdpa_sim devices, so vhost-vdpa will offer= =0D that backend feature and userspace can effectively suspend the device.=0D =0D This is a must before getting virtqueue indexes (base) for live migration,= =0D since the device could modify them after userland gets them. There are=0D individual ways to perform that action for some devices=0D (VHOST_NET_SET_BACKEND, VHOST_VSOCK_SET_RUNNING, ...) but there was no=0D way to perform it for any vhost device (and, in particular, vhost-vdpa).=0D =0D After a successful return of ioctl with suspend =3D 1, the device must not= =0D process more virtqueue descriptors, and it must not send any config=0D interrupt. The device can answer to read or writes of config fields as=0D if it were not suspended. In particular, writing to "queue_enable" with=0D a value of 1 will not make the device start processing buffers of the=0D virtqueue until the device is resumed (suspend =3D 0).=0D =0D After a successful return of ioctl with suspend =3D 0, the device will=0D start processing data of the virtqueues if other expected conditions are=0D met (queue is enabled, DRIVER_OK has already been set to status, etc.)=0D If not, the device should be in the same state as if no call to suspend=0D callback with suspend =3D 1 has been performed.=0D =0D In the future, we will provide features similar to=0D VHOST_USER_GET_INFLIGHT_FD so the device can save pending operations.=0D =0D Comments are welcome.=0D =0D v6:=0D * s/stop/suspend/ to differentiate more from reset.=0D * Clarify scope of the suspend operation.=0D =0D v5:=0D * s/not stop/resume/ in doc.=0D =0D v4:=0D * Replace VHOST_STOP to VHOST_VDPA_STOP in vhost ioctl switch case too.=0D =0D v3:=0D * s/VHOST_STOP/VHOST_VDPA_STOP/=0D * Add documentation and requirements of the ioctl above its definition.=0D =0D v2:=0D * Replace raw _F_STOP with BIT_ULL(_F_STOP).=0D * Fix obtaining of stop ioctl arg (it was not obtained but written).=0D * Add stop to vdpa_sim_blk.=0D =0D Eugenio P=C3=A9rez (4):=0D vdpa: Add suspend operation=0D vhost-vdpa: introduce SUSPEND backend feature bit=0D vhost-vdpa: uAPI to suspend the device=0D vdpa_sim: Implement suspend vdpa op=0D =0D drivers/vdpa/vdpa_sim/vdpa_sim.c | 21 +++++++++++++=0D drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 +=0D drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 3 ++=0D drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 3 ++=0D drivers/vhost/vdpa.c | 47 +++++++++++++++++++++++++++-=0D include/linux/vdpa.h | 5 +++=0D include/uapi/linux/vhost.h | 14 +++++++++=0D include/uapi/linux/vhost_types.h | 2 ++=0D 8 files changed, 95 insertions(+), 1 deletion(-)=0D =0D --=0D 2.31.1=0D =0D