Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp340340ioo; Thu, 26 May 2022 05:02:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8WuMmDnc05NDyfGaBEnBmPLQjWIeD93i1JCApGanWRzRSL6HgRcfG63wMjAGt992Tll/e X-Received: by 2002:a17:90b:1d92:b0:1e2:5da0:8e14 with SMTP id pf18-20020a17090b1d9200b001e25da08e14mr1389922pjb.80.1653566578360; Thu, 26 May 2022 05:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653566578; cv=none; d=google.com; s=arc-20160816; b=qYZAPH7AbvIZlpyBEsm4qOGYI/zR1YGScaXoU2CKTcHT1lkuDCd1KH+oT7QEVEj/Z+ sQl9T0xkAvWdcZTtw1KH1vHI2XTS044Jkx1J8PZ9AvFmyVN04JZib78HFAJ0HupaGely RBTgyKyCSmChUNqtdukCiqMy/PAmgcCDKNVoEi7kQbWUZAKL6dXT7QjwCwYV72j5RnYi Zro2W5yt8P8waInPWLoB1GHzp5ZjBm7zL4xzDafqvuUA50/1Eb1WVmojWQvjc47twgZg t1k9a1BUz+OyfAXGK344Cicj1WJ0ARQTI9eLWkTlebOTCbqYsBxXiL0k/MCfsBLkZTlY Th1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2Tsl43vKOyakBAOjeNueNb9Uu0rxAb3Y9S+ROwk9uac=; b=shQu5qDGms27XgkBDXRUiqJYU+xtBF3Y0w8jhqydKrb0R/a0Aft97qGzV4w5QX31kY Y6Ss8VP3J4oCQ+CwFUaryRpcG7x1Ck+RDEQ8Po1KjgJAYZVNdjXHyHLfacLIwtI9Ohr6 qo2PuazCuUdpp01crN2/xOWEOQkoz0K9kER6xSL1sWzBem6uID4AI/PB/IvCr8d+iTPM DGBfydP2YiB641Z8gBiMx668CAyaHGZRhPGyOAuxrPN2YI7XglGdanYtiqvrdbMIkOuR 4tjn85ji0yzFUHrWV44FH8LePDkjChmGa0PVKVbaLzN8Ga4+JWYX+ofPi3iCEcBFTw0n vfuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R04feccd; 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 b3-20020a056a000a8300b0050a73d826c7si1959416pfl.14.2022.05.26.05.02.43; Thu, 26 May 2022 05:02:58 -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=R04feccd; 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 S243646AbiEYCv0 (ORCPT + 99 others); Tue, 24 May 2022 22:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243678AbiEYCvV (ORCPT ); Tue, 24 May 2022 22:51:21 -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 ESMTP id E91E065DC for ; Tue, 24 May 2022 19:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653447079; 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=2Tsl43vKOyakBAOjeNueNb9Uu0rxAb3Y9S+ROwk9uac=; b=R04feccdpyTSVCnhHap2FytqJmvv1rO9Q7fWa7nf/eC0yXEMqHkLkvluaUOznO9tGRpvou NsrmIfciQ83+v+6C3je0DWB2ktkM2s/0EXGSZrgnCcCVyQ/iQByljGzRjlhdSTqUoWQe4j IMbI+kbAE1pygKGTjSsQ7tZLcJAtnO4= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-424-prF9BI8cMlSho89r0kgxxg-1; Tue, 24 May 2022 22:51:16 -0400 X-MC-Unique: prF9BI8cMlSho89r0kgxxg-1 Received: by mail-lf1-f69.google.com with SMTP id x36-20020a056512132400b0044b07b24746so10016815lfu.8 for ; Tue, 24 May 2022 19:51:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=2Tsl43vKOyakBAOjeNueNb9Uu0rxAb3Y9S+ROwk9uac=; b=V7OaNIw2LfqUbZNXJ8LLXTHrR6tdFkm6bbl4F/9x9fnM4btoPnP/ZxMug+9OeKDRDt eNiu3d/tQsOrv+xnnrNITQcp3nXGXR8V1BnIQMjfk83EVzDwjIXk0Ukvz+euj5oQQytw JoaWUoNpt9TNJeT6Y3CSD7SdTlSX+iAfmoMdneooIe4jl4pOIboRYQCWifOKNUG/rMj5 RXZVzvjUi8WVWxfyxBZWmijZsNpNxWPyzJ+Rq5ghcSgzLb0SY/RM7ovmm5YPuAomROEy 84nL0+8qMhCJ425pHH7OvU4GgG75v2PBx4so8BM5MUGVPHlHE2AzULzeiusLAdJ9Abd+ +3dw== X-Gm-Message-State: AOAM5335DP1HpIcy1/xyglGhTKocLupQZmCTfJtBUDzsVZeFSZsoXUMV C5CwMN9i9NWOV8V04Mo8fCZd9wwFggoHooy4Vq9mn05NRyJzF5PhmXzZ7v3f+ck3qcNCuUDLGOf XcaXq2j4t7eRiQsLvoKvRlQodB3sPizRXtm/jdpIe X-Received: by 2002:a05:6512:1588:b0:477:a556:4ab2 with SMTP id bp8-20020a056512158800b00477a5564ab2mr21566070lfb.376.1653447075327; Tue, 24 May 2022 19:51:15 -0700 (PDT) X-Received: by 2002:a05:6512:1588:b0:477:a556:4ab2 with SMTP id bp8-20020a056512158800b00477a5564ab2mr21566038lfb.376.1653447075136; Tue, 24 May 2022 19:51:15 -0700 (PDT) MIME-Version: 1.0 References: <20220524170610.2255608-1-eperezma@redhat.com> <20220524170610.2255608-4-eperezma@redhat.com> In-Reply-To: <20220524170610.2255608-4-eperezma@redhat.com> From: Jason Wang Date: Wed, 25 May 2022 10:51:04 +0800 Message-ID: Subject: Re: [PATCH v2 3/4] vhost-vdpa: uAPI to stop the device To: =?UTF-8?Q?Eugenio_P=C3=A9rez?= Cc: netdev , virtualization , "Michael S. Tsirkin" , kvm , linux-kernel , Parav Pandit , Zhang Min , Harpreet Singh Anand , Zhu Lingshan , tanuj.kamde@amd.com, "Dawar, Gautam" , Christophe JAILLET , Xie Yongji , Dinan Gunawardena , habetsm.xilinx@gmail.com, Eli Cohen , Pablo Cascon Katchadourian , Laurent Vivier , Dan Carpenter , Cindy Lu , Wu Zongyong , ecree.xilinx@gmail.com, "Uminski, Piotr" , Martin Porter , Stefano Garzarella , Si-Wei Liu , Longpeng , Martin Petrus Hubertus Habets Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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 On Wed, May 25, 2022 at 1:06 AM Eugenio P=C3=A9rez wr= ote: > > The ioctl adds support for stop the device from userspace. > > Signed-off-by: Eugenio P=C3=A9rez > --- > drivers/vhost/vdpa.c | 18 ++++++++++++++++++ > include/uapi/linux/vhost.h | 3 +++ > 2 files changed, 21 insertions(+) > > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > index 32713db5831d..a5d33bad92f9 100644 > --- a/drivers/vhost/vdpa.c > +++ b/drivers/vhost/vdpa.c > @@ -478,6 +478,21 @@ static long vhost_vdpa_get_vqs_count(struct vhost_vd= pa *v, u32 __user *argp) > return 0; > } > > +static long vhost_vdpa_stop(struct vhost_vdpa *v, u32 __user *argp) > +{ > + struct vdpa_device *vdpa =3D v->vdpa; > + const struct vdpa_config_ops *ops =3D vdpa->config; > + int stop; > + > + if (!ops->stop) > + return -EOPNOTSUPP; > + > + if (copy_from_user(&stop, argp, sizeof(stop))) > + return -EFAULT; > + > + return ops->stop(vdpa, stop); > +} > + > static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cm= d, > void __user *argp) > { > @@ -650,6 +665,9 @@ static long vhost_vdpa_unlocked_ioctl(struct file *fi= lep, > case VHOST_VDPA_GET_VQS_COUNT: > r =3D vhost_vdpa_get_vqs_count(v, argp); > break; > + case VHOST_STOP: > + r =3D vhost_vdpa_stop(v, argp); > + break; > default: > r =3D vhost_dev_ioctl(&v->vdev, cmd, argp); > if (r =3D=3D -ENOIOCTLCMD) > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h > index cab645d4a645..e7526968ab0c 100644 > --- a/include/uapi/linux/vhost.h > +++ b/include/uapi/linux/vhost.h > @@ -171,4 +171,7 @@ > #define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \ > struct vhost_vring_state) > > +/* Stop or resume a device so it does not process virtqueue requests any= more */ > +#define VHOST_STOP _IOW(VHOST_VIRTIO, 0x7D, int) > + Unless we know it's a vhost general uAPI, let's use VHOST_VDPA_STOP here. Thanks > #endif > -- > 2.27.0 >