From patchwork Wed Jan 10 20:40:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 187077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1045176dyi; Wed, 10 Jan 2024 12:46:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7fWz1cDFDpnrc2kzT3tJcoGApWRJrl0m6tpG3bVUWWZQWMUCXaNbXjL5n1eREG9Q8Onym X-Received: by 2002:a2e:a683:0:b0:2cd:f47:94ae with SMTP id q3-20020a2ea683000000b002cd0f4794aemr72603lje.23.1704919573338; Wed, 10 Jan 2024 12:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704919573; cv=none; d=google.com; s=arc-20160816; b=QNqx2/fa7kdJj1pnHn2gRoK6hPZEZgT8+60Efb56sJj8TnTB2VpJzp0fqaNMXJclqv e2mhyx1t5qJ3DzrJZ9+LshgnitwoxhQghOyHAw5HTS7OcvpbB7BMHLSaehtXsxFFs6kN NxNVTqskufsTmw4kLXnl0U1sT9nEY6DO1cS0OeGjKOYh6+tzyjEvjR6lJpJdF34hoC6P w2YOJgX6Kte2RuBgveltQRdctSB/U1/h3I+KxoG68J23Y5mCO3gPhf/gTTZBpb41RyWf 0xcs1oftXvbLyUsy7fDKvCjG04AreCJxfUmr8QyA6xaobawdwc/UrFwOJVTHoLy46N9v CV1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=UhQmkXl9GVu7w+z1TCplSHMQcWUnpv9XttZYc9CaLWI=; fh=NLOUc4UpZ/0A9JrieYT9bxhjFpxay5qeZXON7PgxqoM=; b=dIYweIsIWy/dVhv0Vd4aDUj0qGuqLOss5YKkmEMLZg/GR2q3yd7JvwBbbdXnxEivHC DmpByDnvNbehY2b33sjhfDZEh3Bh0kMTLselhfpf8RShhPwiWf6u1x+gFHjMuv6C1Ul9 mF2+3JH/EXh/T5U5g62s7TmBjIJt7vvsoDYEONmez07ftzC5Ldoj6WfIqVFr6VbjW52v HIxzLjE1NfOktI4Oy+Vo/j6FWMM+G8bV5WGybwymfI0o49tTH0qI+TmkyS3OLfHcvUZ5 ywiqOTF/hBHZoBnoGfH8O2nmNAZh+VMh1yNYxbOx3hMc9WV/126KmF71U7hP/1eDExbo Te+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b="Z4I/SpWy"; spf=pass (google.com: domain of linux-kernel+bounces-22767-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22767-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l13-20020a056402230d00b00554ae146096si2060572eda.279.2024.01.10.12.46.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 12:46:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22767-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b="Z4I/SpWy"; spf=pass (google.com: domain of linux-kernel+bounces-22767-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22767-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 151781F239F5 for ; Wed, 10 Jan 2024 20:46:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02D1357865; Wed, 10 Jan 2024 20:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Z4I/SpWy" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC9D8524D0 for ; Wed, 10 Jan 2024 20:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40AHu6Er013238; Wed, 10 Jan 2024 20:40:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=UhQmkXl9GVu7w+z1TCplSHMQcWUnpv9XttZYc9CaLWI=; b=Z4I/SpWyGdRErY15n9ByLfWec96Ujkt4wHnw7OGouauwqVVHz9v5a0lCcNadOlUEwkPy VmE1a7/3INCEp0XRVfi0mkK7zbU9mlnAS192WkBv/rmo3IcLK9UrXzPCCSqso0+iAHTl BN800/wBesdL58Gj4O+WnEJ9f9EDSyiVxIUd6twX1VLHmN7XZFnCKd0FDkWDUkLgzcnT gUb8Kd6ZrMsHfVAk4W6Ig7qtcejv1x5M8F3Az7TOVOXDrMe4oEHgZ0jVj60bndwqAkEu iBkrBhq31myp2UPqP5GfFQOPPDHLN5cDua9iPNWwdHvD/Qy+I5HZx/++JYrkadO6u6dr aA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vhs1x1b3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2024 20:40:28 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 40AK51Ds030094; Wed, 10 Jan 2024 20:40:27 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vfutp5xdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2024 20:40:27 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40AKeGrp005067; Wed, 10 Jan 2024 20:40:26 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3vfutp5x5e-14; Wed, 10 Jan 2024 20:40:26 +0000 From: Steve Sistare To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Jason Wang , Si-Wei Liu , Eugenio Perez Martin , Xuan Zhuo , Dragos Tatulea , Eli Cohen , Xie Yongji , Steve Sistare Subject: [RFC V1 13/13] vduse: new owner capability Date: Wed, 10 Jan 2024 12:40:15 -0800 Message-Id: <1704919215-91319-14-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1704919215-91319-1-git-send-email-steven.sistare@oracle.com> References: <1704919215-91319-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-10_10,2024-01-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401100163 X-Proofpoint-ORIG-GUID: qAWOh5yp6HJp_t3u4k72qvHhZf-98H8a X-Proofpoint-GUID: qAWOh5yp6HJp_t3u4k72qvHhZf-98H8a Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787737746518086525 X-GMAIL-MSGID: 1787737746518086525 The vduse device supports ownership transfer to a new process, so advertise VHOST_BACKEND_F_NEW_OWNER. User virtual addresses are used by the software iommu, so VHOST_IOTLB_REMAP is required after VHOST_NEW_OWNER, so advertise VHOST_BACKEND_F_IOTLB_REMAP. Signed-off-by: Steve Sistare --- drivers/vdpa/vdpa_user/vduse_dev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index 6b25457a037d..67815f6391db 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -608,6 +609,12 @@ static u32 vduse_vdpa_get_vq_align(struct vdpa_device *vdpa) return dev->vq_align; } +static u64 vduse_vdpa_get_backend_features(const struct vdpa_device *vdpa) +{ + return BIT_ULL(VHOST_BACKEND_F_IOTLB_REMAP) | + BIT_ULL(VHOST_BACKEND_F_NEW_OWNER); +} + static u64 vduse_vdpa_get_device_features(struct vdpa_device *vdpa) { struct vduse_dev *dev = vdpa_to_vduse(vdpa); @@ -801,6 +808,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = { .set_vq_state = vduse_vdpa_set_vq_state, .get_vq_state = vduse_vdpa_get_vq_state, .get_vq_align = vduse_vdpa_get_vq_align, + .get_backend_features = vduse_vdpa_get_backend_features, .get_device_features = vduse_vdpa_get_device_features, .set_driver_features = vduse_vdpa_set_driver_features, .get_driver_features = vduse_vdpa_get_driver_features,