From nobody Mon Sep 16 19:20:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679065007; cv=none; d=zohomail.com; s=zohoarc; b=eFE4os7l64Hy8LLlY1eMSdVp3QPpOgPxtMUeYNdjLSRnrGaaRympH9K8sD3DcpnuYb88nH+7J4d9Mr6vYxa69wcHO8sKs2piA845bawoYsVpBokBwWlh6xXjLRdGd3eeEncN4LW65/gt8iHrDHRLJm7KyL5RutuBSbY/jCWpVoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679065007; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LpmyuWBcYlh2Hd+XeU5GfmO3PD9opnGLJrAwHvLGNp0=; b=eFoZIEemqDU1oycPDvRLyVJrtEoC9IgtDT8WkcZpLgERSZsUSeyIg36/hxcdErrMcBpwT+hIXcX9HxUQaEUUHhhl6seYLzjSqRJiPHeXuKmAp/9ntogTDPSBucHUQZwftXgCe58wS1ewtDCACcGXDIX+qwNf04i2ZPieb+AuRSc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679065007372872.5648709793325; Fri, 17 Mar 2023 07:56:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdBVA-0000SF-Fg; Fri, 17 Mar 2023 10:56:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdBV7-0000R3-H2 for qemu-devel@nongnu.org; Fri, 17 Mar 2023 10:56:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdBV1-0007Kj-Rw for qemu-devel@nongnu.org; Fri, 17 Mar 2023 10:56:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-h_taBTzoM36OJNqe6LfmUQ-1; Fri, 17 Mar 2023 10:55:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38D9718E530C; Fri, 17 Mar 2023 14:55:55 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CA2643FBE; Fri, 17 Mar 2023 14:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679064959; 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=LpmyuWBcYlh2Hd+XeU5GfmO3PD9opnGLJrAwHvLGNp0=; b=ehA2nuqlLu5Sst2vYpcPZVKsBhiLFhBOr6HXteaGgb3dHPPSNWzfhS5bJytUSwk6+0MR4t VzWnhFZ1vNNstA4eUlzfu91DXYw/qsE+HKtZDa6ue0xGUji7X21TxA5/XSzRIrw5qJJfi/ qd0ygFM/Pbd2dYTO53CwiXqTFxpLOXQ= X-MC-Unique: h_taBTzoM36OJNqe6LfmUQ-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: alvaro.karsz@solid-run.com, Laurent Vivier , Gautam Dawar , Jason Wang , Harpreet Singh Anand , Zhu Lingshan , "Gonglei (Arei)" , "Michael S. Tsirkin" , Eli Cohen , si-wei.liu@oracle.com, Stefano Garzarella , longpeng2@huawei.com, Cindy Lu , Parav Pandit , Liuxiangdong , Shannon Nelson , Lei Yang Subject: [RFC PATCH for 8.1 3/6] vdpa: add vhost_vdpa_set_dev_features_fd Date: Fri, 17 Mar 2023 15:55:39 +0100 Message-Id: <20230317145542.347368-4-eperezma@redhat.com> In-Reply-To: <20230317145542.347368-1-eperezma@redhat.com> References: <20230317145542.347368-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679065008818100001 This allows to set the features of a vhost-vdpa device from external subsystems like vhost-net. It is used in subsequent patches to negotiate features and probe for CVQ ASID isolation. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Stefano Garzarella --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 28de7da91e..a9cb6f3a32 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -55,6 +55,7 @@ typedef struct vhost_vdpa { } VhostVDPA; =20 void vhost_vdpa_reset_status_fd(int fd); +int vhost_vdpa_set_dev_features_fd(int fd, uint64_t features); int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_r= ange); =20 int vhost_vdpa_dma_map(struct vhost_vdpa *v, uint32_t asid, hwaddr iova, diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 7a2053b8d9..acd5be46a9 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -651,11 +651,22 @@ static int vhost_vdpa_set_mem_table(struct vhost_dev = *dev, return 0; } =20 +int vhost_vdpa_set_dev_features_fd(int fd, uint64_t features) +{ + int ret; + + ret =3D vhost_vdpa_call_fd(fd, VHOST_SET_FEATURES, &features); + if (ret) { + return ret; + } + + return vhost_vdpa_add_status_fd(fd, VIRTIO_CONFIG_S_FEATURES_OK); +} + static int vhost_vdpa_set_features(struct vhost_dev *dev, uint64_t features) { struct vhost_vdpa *v =3D dev->opaque; - int ret; =20 if (!vhost_vdpa_first_dev(dev)) { return 0; @@ -678,12 +689,7 @@ static int vhost_vdpa_set_features(struct vhost_dev *d= ev, } =20 trace_vhost_vdpa_set_features(dev, features); - ret =3D vhost_vdpa_call(dev, VHOST_SET_FEATURES, &features); - if (ret) { - return ret; - } - - return vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK); + return vhost_vdpa_set_dev_features_fd(vhost_vdpa_dev_fd(dev), features= ); } =20 static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) --=20 2.31.1