Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp876476rwi; Wed, 19 Oct 2022 04:12:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KLNHIjPjFsGXXjBTsqeD4/5gAKfKOVHBTada7KbUamE3G26jALi3c8r6DsQ/3ywB088VC X-Received: by 2002:a05:6a00:843:b0:563:fd4:d73 with SMTP id q3-20020a056a00084300b005630fd40d73mr8061382pfk.47.1666177927529; Wed, 19 Oct 2022 04:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177927; cv=none; d=google.com; s=arc-20160816; b=O9bnruCw4n4UHdLl21q5RKUhj/C6ofgfhUVDvPn+Yu5p/uDdNUdZVIhhKTjC1wpcmD E9RNB9DpS5zsCE9wS98eNBQ9/UIvGYlCir7dlwY8e48bUup3IUuC93k3ErUagtNza2xb G6usr9bUGQ2rz5wHildUyx0jZiq0yyRppxsTXENXnUHlewcgaU7xlMBIqyjICbJZfUFv hCOaCh6iqB27dZyYzy0MQGsVq3REmjmVHx+jxdq1r3u6C3i8xv6gBKn4AnpXV/wqlaOZ 13tLFIVjB1p67QMcFdHsJssBKauNMtYHatlyn6lmN1Rp+xoUxYV/vp6sixg/ZQa5VmfH +JzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=B+TyF7PNH8EB0gGdWhZWNT7enwe2PDt7WQr2gXMuwD0=; b=ZMtWo9IIjZAEtObKcSPtP77CJ+1EDmCv2igwPLIfTBQOQIJX3d6ZJtkyaGW3LRm9u/ QWWVpVhanIoHbpchq3t8wWV2jGGb8nq25D+totrzFM57kj0ip0oT10cYpUS8aXDJvYzu CML+a1gBLbVGKh0flfnrdilvXKQCyOptp6aGVxv8WDVjwpRWYjetKQk2LFIrwNdhxqjE Jj0+mTXtcdN0iaTk4hCqajt6Rqt47vGV0hhvJDTrQwEU5XBtD7UUTiBkNXq72eEupTXR 2GJBWG7nKEc9Y82n3zK1+Cl6wYJ7ycJyB6/tFm/9bw0c+Jhcm1rntofelP4bUNDWiYcf pUHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HKnwd2ph; 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 q18-20020a631f52000000b0043447486c84si17789343pgm.875.2022.10.19.04.11.44; Wed, 19 Oct 2022 04:12:07 -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=HKnwd2ph; 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 S234415AbiJSKAJ (ORCPT + 99 others); Wed, 19 Oct 2022 06:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234677AbiJSJ7X (ORCPT ); Wed, 19 Oct 2022 05:59:23 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D0B811A96E for ; Wed, 19 Oct 2022 02:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666172106; 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: in-reply-to:in-reply-to:references:references; bh=B+TyF7PNH8EB0gGdWhZWNT7enwe2PDt7WQr2gXMuwD0=; b=HKnwd2ph/8LfRn+HWhbiPil2tVt0om+Kdwt/jLk4xc2XYY4eTQ3qav9ARiB9el0zyNs/L/ pRRJXaUzLWLRh1TOPn60bAZ9DJSu6xRShh09ZjT65nDgoKc2b9R0Tw+tpzrjeyIqYiZEZ5 hJt2repC0VjISVLKgDjH9RiNd59vCJo= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-27-V_PiXrY6PUa8tu8nuLP9ew-1; Wed, 19 Oct 2022 05:31:52 -0400 X-MC-Unique: V_PiXrY6PUa8tu8nuLP9ew-1 Received: by mail-pl1-f198.google.com with SMTP id b14-20020a170902d50e00b001854f631c4eso6127057plg.8 for ; Wed, 19 Oct 2022 02:31:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B+TyF7PNH8EB0gGdWhZWNT7enwe2PDt7WQr2gXMuwD0=; b=M8qAjigAB26LP19QNukjCdpQ2xjWzzUny8KR9/QhljMNNMosMuOfyYc8NVKC9hXTOw HxbfDRna8JOAH8CKbCx0uTJpZlWn6jX3WNmQAl9Mdva/uj6vSS6AA3/M8pf6zHrEBT5q 4k9LV/xs4XCRBS1Q4nJMbrfDy7eNI0e4rCo6p/4qzKdQ9Xo57t9lPErq9zPGz1c+43N7 n73yw7vGuR7P4kINo76fmLs9Do4HeEpSXjLDT4wpZZusv1lpXnRqOOgJZ9cIzZlqObQw IoNZKmRQ8Nfza7z3uplmdzmnt4+/U4y3yDVnQT4MEf36uHw3hEh9qiKMzEHKBmENTtlv TO9w== X-Gm-Message-State: ACrzQf3bxs+CHF/sXxxR2TnLvmA/3/R+nBKKKgo4bPa1fIOvQb2y4lPG o5E+9VME8as1IZXYtZLT0XeoG+iOAxQAwyht6pSdZfR+iyOnE7TE0PReBGnNtan9gRQHYBDhyF3 SsXqwFc2sJZtDaLiIqzVLJGQhz7cBw6jAlVGnjS9Z X-Received: by 2002:a17:903:2585:b0:185:483e:e4ce with SMTP id jb5-20020a170903258500b00185483ee4cemr7360967plb.17.1666171911537; Wed, 19 Oct 2022 02:31:51 -0700 (PDT) X-Received: by 2002:a17:903:2585:b0:185:483e:e4ce with SMTP id jb5-20020a170903258500b00185483ee4cemr7360946plb.17.1666171911232; Wed, 19 Oct 2022 02:31:51 -0700 (PDT) MIME-Version: 1.0 References: <56c045ac70e44e7d80f3f9e901deae3d7485b2a1.1666082013.git.sebastien.boeuf@intel.com> In-Reply-To: <56c045ac70e44e7d80f3f9e901deae3d7485b2a1.1666082013.git.sebastien.boeuf@intel.com> From: Eugenio Perez Martin Date: Wed, 19 Oct 2022 11:31:14 +0200 Message-ID: Subject: Re: [PATCH v4 4/4] vdpa_sim: Implement resume vdpa op To: sebastien.boeuf@intel.com Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, mst@redhat.com, jasowang@redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LOTS_OF_MONEY, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Tue, Oct 18, 2022 at 10:38 AM wrote: > > From: Sebastien Boeuf > > Implement resume operation for vdpa_sim devices, so vhost-vdpa will > offer that backend feature and userspace can effectively resume the > device. > > Signed-off-by: Sebastien Boeuf > --- > drivers/vdpa/vdpa_sim/vdpa_sim.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c > index b071f0d842fb..05e3802fb746 100644 > --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > @@ -527,6 +527,18 @@ static int vdpasim_suspend(struct vdpa_device *vdpa) > return 0; > } > > +static int vdpasim_resume(struct vdpa_device *vdpa) > +{ > + struct vdpasim *vdpasim = vdpa_to_sim(vdpa); > + int i; > + > + spin_lock(&vdpasim->lock); > + vdpasim->running = true; > + spin_unlock(&vdpasim->lock); > + > + return 0; > +} > + To never kick at resuming is not the right thing to do :). Maybe to store in the vdpasim_virtqueue if it was kicked during the suspend window? Thanks! > static size_t vdpasim_get_config_size(struct vdpa_device *vdpa) > { > struct vdpasim *vdpasim = vdpa_to_sim(vdpa); > @@ -717,6 +729,7 @@ static const struct vdpa_config_ops vdpasim_config_ops = { > .set_status = vdpasim_set_status, > .reset = vdpasim_reset, > .suspend = vdpasim_suspend, > + .resume = vdpasim_resume, > .get_config_size = vdpasim_get_config_size, > .get_config = vdpasim_get_config, > .set_config = vdpasim_set_config, > @@ -750,6 +763,7 @@ static const struct vdpa_config_ops vdpasim_batch_config_ops = { > .set_status = vdpasim_set_status, > .reset = vdpasim_reset, > .suspend = vdpasim_suspend, > + .resume = vdpasim_resume, > .get_config_size = vdpasim_get_config_size, > .get_config = vdpasim_get_config, > .set_config = vdpasim_set_config, > -- > 2.34.1 > > --------------------------------------------------------------------- > Intel Corporation SAS (French simplified joint stock company) > Registered headquarters: "Les Montalets"- 2, rue de Paris, > 92196 Meudon Cedex, France > Registration Number: 302 456 199 R.C.S. NANTERRE > Capital: 5 208 026.16 Euros > > This e-mail and any attachments may contain confidential material for > the sole use of the intended recipient(s). Any review or distribution > by others is strictly prohibited. If you are not the intended > recipient, please contact the sender and delete all copies. >