Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp11294pxk; Wed, 23 Sep 2020 20:29:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+4q+89FHrQPWw+0oyneWWbzHeEtu2K03PDetXcJenT9tvV7H7bKMevfcfoZJxjM1kuQ+i X-Received: by 2002:a05:6402:17ec:: with SMTP id t12mr2410292edy.328.1600918150880; Wed, 23 Sep 2020 20:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600918150; cv=none; d=google.com; s=arc-20160816; b=b6P4aOT9swBp6/TI1Qvgpqf2Gj6/SfniR0RXQA3aGcmb2Roo0oa3ot8TEONz6AFQBI 3ugAvZFZc47U9/cBnOUfSAgcCejQyNzRQ1MRB35LNepY9kVcAougWBKgY1rsiwvp4gn0 Wy8Wzwid2OebZ76hCXIv/EIxY0ajOjBcTQ7eZnVhdH4j8VDyWdFQVQ2llV6Yj1LeNYVG WoZCmHQK1CYz1AbKFbjZz5hqm3OP0KRhs+z93icu7P8F1OLG2R02FWKE6OGDJuzM5ddX sqSRcpZQ3FnK9mC2V1HIplRWO485PHB9/y8GgJcKN7wyqbtj6cq1+GwlenS95q0uivu7 q7kA== 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=0f6y23j1rs6f2A5XlpC2214Hgw54YVYejH44+4fkrGA=; b=DY8RMvjGqKZB3Nzv9ODonk5BVxoXHrO4S1bVPg6aFBed8BRe7ywqMNh6EC4yho7Scf /e9eihU7dtrX6z4ydQ4k93EllzeyEExftyFj2ybSuMdTfL5o1OOGBgy2tEMy7AugS07K j3qz4sRZSfPjAKOy3mcCUyxz6+tWpqiSGFZVY7bxebwdx5I6L10TZl+EUdG0cCfoFRoG ITm/VO3OjFuVxpIy0+I4x+qIiO3164eULoZqy7gDxXvpQbfxzk3dF+cVuu2W213q601x omRt6IMMsbR+dL/LtsXWDZkCmyqHImDVlRUAwE07sgadgzdLqdkt7tITKX22RBaCnQqw 6Plw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YnBJLEdh; 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 p7si1354601edq.28.2020.09.23.20.28.47; Wed, 23 Sep 2020 20:29:10 -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=YnBJLEdh; 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 S1726828AbgIXDZB (ORCPT + 99 others); Wed, 23 Sep 2020 23:25:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36990 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726854AbgIXDZB (ORCPT ); Wed, 23 Sep 2020 23:25:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600917899; 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=0f6y23j1rs6f2A5XlpC2214Hgw54YVYejH44+4fkrGA=; b=YnBJLEdhr7EEL5FaXKwPJZOAzHsWyt+1US1MKj50n2an0mf7PIOKzrBLUjNbcp3P8dN4dK k6bcik27ypAceqfcjg/LYtcaUa6MAKNiP+Gcn4RfN7Bl+i1SDsOYAkqppn6ABYb9JghPuC 1+uiEAuMg3zWVF3iqzTHe1taZy7TCgw= 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-190-9aoU-TjvMwKAW-cu8oHKZw-1; Wed, 23 Sep 2020 23:24:58 -0400 X-MC-Unique: 9aoU-TjvMwKAW-cu8oHKZw-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 A119A1891E94; Thu, 24 Sep 2020 03:24:55 +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 CC7273782; Thu, 24 Sep 2020 03:24:46 +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 17/24] vhost-vdpa: introduce uAPI to set group ASID Date: Thu, 24 Sep 2020 11:21:18 +0800 Message-Id: <20200924032125.18619-18-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 vDPA support for associating ASID to a specific virtqueue group. This patch adds a uAPI to support setting them from userspace. 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 a234d3783e16..978cf97dc03a 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -441,6 +441,14 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, else if (copy_to_user(argp, &s, sizeof s)) return -EFAULT; return 0; + case VHOST_VDPA_SET_GROUP_ASID: + if (copy_from_user(&s, argp, sizeof(s))) + return -EFAULT; + if (s.num >= vdpa->ngroups) + return -EINVAL; + if (!ops->set_group_asid) + return -ENOTSUPP; + return ops->set_group_asid(vdpa, idx, s.num); 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 d1c4b5561fee..f3de9e45c518 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h @@ -151,4 +151,8 @@ /* 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) +/* Set the ASID for a virtqueue group. */ +#define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7A, \ + struct vhost_vring_state) + #endif -- 2.20.1