Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp11054pxk; Wed, 23 Sep 2020 20:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSnJ3ZDXkHStRH/RN4CyK3dFTij6KxRwYGP4cHzbNlXSwMTTjdoGJkzIhqF7vOmjJbH7No X-Received: by 2002:a17:906:f8d2:: with SMTP id lh18mr2707104ejb.44.1600918106152; Wed, 23 Sep 2020 20:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600918106; cv=none; d=google.com; s=arc-20160816; b=nagDZF9rK1aehIswt7ZsMtxgDANJ89v1hC63i9lRT+fvbCmUJb6V1+RPzBlU4zxLM5 2sWRgjvbq3/gb+UgGK7aET/Rjvxdzb3+a1LnfxyXbDWy+/a9MSc8sJNr8OEzEFkGUIf/ DdyvU7jFfU7GhTMtOKjF6EiDSafuw9dfqkhww+24MeopVApbTh3GgJdXpLTwgjCUIoZj gMgN3EqnrgmEhcl1V6Bsdwp9rorgTsTRZnmE24+jq5jM4YZgG0j3KADYnnWGAAK+aVcB DUgIK4A+DMgJ+4a0CE3z3gb4JSquEMIcADoEBwkD/Yx16P4cWKfI2IJm+bUBtGe4GPPY FySQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AfueecD2nn0g5NX57haltefO9h8rHly/lmEeHDzFMsw=; b=qPx32AR1x47qQuD7sdsditsxzmqMCNC/hNgivMalh60JYme648o1HZp9BRN7t9jUpn wHmR9xLQKlrCUQtsj4IJGvaf/9mwles8iaZWAE9QrQTMUFoMfRaktMAL7XPSO/YclwEc lqTQ/jnTB0PcLn8t1owXdUBPSb/Stqb8WX8M1Ohk/7n9OdxqCZIjk0+hMgxXWjHlRfp1 ifcX5gQoMcde0VTAS2DiDNlLs6uZDCwLfXKsOVxUmdBsoEsHeh1gEYu2OVIeSipUTHBi hNJSWxuSghxs0R9bhckYG1jH0RN/P0LyJbOIHBbOKJK59FdhLl3ekoEh5MgSgSKeixm0 3gkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dY+ZCkYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si1259843edn.260.2020.09.23.20.28.03; Wed, 23 Sep 2020 20:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dY+ZCkYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726706AbgIXDYz (ORCPT + 99 others); Wed, 23 Sep 2020 23:24:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50240 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727042AbgIXDYw (ORCPT ); Wed, 23 Sep 2020 23:24:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600917891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AfueecD2nn0g5NX57haltefO9h8rHly/lmEeHDzFMsw=; b=dY+ZCkYiepSTJxvesj9t5EzbdlmgRBal4Ig3yxiX2k1ZYHNcdj4ksZ4CWGiyEHIKov5me2 l6t/8Mh6Jyb8w8sYuleOcy1nLZxiu7u2t8VjaiMUTvic6kGFqGinYWY7YVgLctz4qvYSbD MZD+poUAC9kfoUj1cfqh3pBpyq+8+3A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-186-wvmr4WtwMBW74W3C2qdSmg-1; Wed, 23 Sep 2020 23:24:47 -0400 X-MC-Unique: wvmr4WtwMBW74W3C2qdSmg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C719106B3A1; Thu, 24 Sep 2020 03:24:46 +0000 (UTC) Received: from jason-ThinkPad-X1-Carbon-6th.redhat.com (ovpn-13-193.pek2.redhat.com [10.72.13.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8578055777; Thu, 24 Sep 2020 03:24:34 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com Cc: lulu@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, rob.miller@broadcom.com, lingshan.zhu@intel.com, eperezma@redhat.com, hanand@xilinx.com, mhabets@solarflare.com, eli@mellanox.com, amorenoz@redhat.com, maxime.coquelin@redhat.com, stefanha@redhat.com, sgarzare@redhat.com Subject: [RFC PATCH 16/24] vhost-vdpa: uAPI to get virtqueue group id Date: Thu, 24 Sep 2020 11:21:17 +0800 Message-Id: <20200924032125.18619-17-jasowang@redhat.com> In-Reply-To: <20200924032125.18619-1-jasowang@redhat.com> References: <20200924032125.18619-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Follows the support for virtqueue group in vDPA. This patches introduces uAPI to get the virtqueue group ID for a specific virtqueue in vhost-vdpa. Signed-off-by: Jason Wang --- drivers/vhost/vdpa.c | 8 ++++++++ include/uapi/linux/vhost.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 4d97a59824a1..a234d3783e16 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -433,6 +433,14 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, return -EFAULT; ops->set_vq_ready(vdpa, idx, s.num); return 0; + case VHOST_VDPA_GET_VRING_GROUP: + s.index = idx; + s.num = ops->get_vq_group(vdpa, idx); + if (s.num >= vdpa->ngroups) + return -EIO; + else if (copy_to_user(argp, &s, sizeof s)) + return -EFAULT; + return 0; case VHOST_GET_VRING_BASE: r = ops->get_vq_state(v->vdpa, idx, &vq_state); if (r) diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index 99bdf50efc50..d1c4b5561fee 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h @@ -147,4 +147,8 @@ /* Get the number of address spaces. */ #define VHOST_VDPA_GET_AS_NUM _IOR(VHOST_VIRTIO, 0x79, unsigned int) + +/* Get the group for a virtqueue: read index, write group in num */ +#define VHOST_VDPA_GET_VRING_GROUP _IOWR(VHOST_VIRTIO, 0x79, \ + struct vhost_vring_state) #endif -- 2.20.1