From patchwork Sat Sep 23 17:05:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cindy Lu X-Patchwork-Id: 143984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp332978vqu; Sat, 23 Sep 2023 12:11:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh2GVwbfsN1r7+VVFurT2U3UxbGRC9Gyu+K5/ZTkZlaYg1ybsa21ZEzZr1s1ZiasW6yJvT X-Received: by 2002:a17:902:dac8:b0:1c5:746f:efb1 with SMTP id q8-20020a170902dac800b001c5746fefb1mr3949630plx.8.1695496281480; Sat, 23 Sep 2023 12:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695496281; cv=none; d=google.com; s=arc-20160816; b=Wk8xQBvymKu3/jxeeBBr+UvIIub6PVyBQbMqq1BqIY2015YdV14PHz3JPkP6i90nWC AuyaSczJzps/Gmck/6O6qNO+4CXzfkzACRAB/gInEK9q2ETNaZiSsRFCDu5wW4M0VRSh S8VefFVPTD3MsECpt5xYmkspRRxLCD5+hg0fvOUOPFDwlkm6o4LgAB6uotYfxc7ywv3q bC/+VIB13XPr6O5h1A1ATie+XIpJUWddXHbqwGUszI3OOYwo4WLUDIa9TFHb3vNlBL49 iPfzcBIQXuJnUg1ZHmylkfoZxif5QWE/L147qvxWiVM3wOxAvyPbMrDpRczzGMJaC1wC JWvg== 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:to:from :dkim-signature; bh=5JLc/gcAH7DqQQF3pLiWnqXoje3Kz4Ompug0RZFEuno=; fh=xiBZnYthZkU72K3VlivZH8ewgfrUkWRaBxXhAGtxMAw=; b=pK/hDsoOxWqyMMkE0NPxUZK4YI8YTu31v+/nnm1Orvo57+ghGpkLyPCwhGBQT2Q3XF Z7Wo771j3CA04Vp916eXwP8P0pwJhkkm1KSWE5gXP5709MI2WoZ8XG9siDRX0V8+2LpE 2yhxVtq8hAML1WVbMD/ZIqAmJhWuoUYD0t6dpUDFHnbPHGA2CFJeQMEBlfTO3gnTXvnV zfg9vAjCpdgwaUw1RJtkyBYPUC49i8RyYnpJ0zJI2lgTFqvFgsnsqMJdf3fF4tNXY0wS orJ5NfJUD3H/DeYqnUoY1RdTYVmXPhpeG+sjVEV3VKnpnGVBZPMrzWzodUGCa8EojR0X YYaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gqNQ7XU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d14-20020a170902cece00b001bc674914b0si7293936plg.472.2023.09.23.12.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 12:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gqNQ7XU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0CFDF801B73C; Sat, 23 Sep 2023 10:07:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232072AbjIWRHe (ORCPT + 30 others); Sat, 23 Sep 2023 13:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbjIWRH3 (ORCPT ); Sat, 23 Sep 2023 13:07:29 -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 ESMTPS id 77C3E194 for ; Sat, 23 Sep 2023 10:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695488794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5JLc/gcAH7DqQQF3pLiWnqXoje3Kz4Ompug0RZFEuno=; b=gqNQ7XU52rlFNyl3JZVL8fqeRWFGaCgSrvBn9le9iIT5mt+aAkIGIkHHys3D6BozjYfOci RZE9HXDx+HyoxUh3l6/OZRQDsuAq2gnOypZ0S1NpPsbIivBiZ2uW+ELUMx7QI33nAXPtUb EhlUq0QCCEtAp54+jFMAB7dR0xgWZv8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-r5i6n1P3PIacCZt-mrDfdQ-1; Sat, 23 Sep 2023 13:06:31 -0400 X-MC-Unique: r5i6n1P3PIacCZt-mrDfdQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EFE13C025B6; Sat, 23 Sep 2023 17:06:31 +0000 (UTC) Received: from server.redhat.com (unknown [10.72.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD11E2156701; Sat, 23 Sep 2023 17:06:27 +0000 (UTC) From: Cindy Lu To: lulu@redhat.com, jasowang@redhat.com, mst@redhat.com, yi.l.liu@intel.com, jgg@nvidia.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Subject: [RFC 6/7] vdpa_sim :Add support for iommufd Date: Sun, 24 Sep 2023 01:05:39 +0800 Message-Id: <20230923170540.1447301-7-lulu@redhat.com> In-Reply-To: <20230923170540.1447301-1-lulu@redhat.com> References: <20230923170540.1447301-1-lulu@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 23 Sep 2023 10:07:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777856708763587534 X-GMAIL-MSGID: 1777856708763587534 Add new vdpa_config_ops to support iommufd Signed-off-by: Cindy Lu --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index cb88891b44a8..55e6f45bb274 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -727,6 +727,10 @@ static const struct vdpa_config_ops vdpasim_config_ops = { .dma_map = vdpasim_dma_map, .dma_unmap = vdpasim_dma_unmap, .free = vdpasim_free, + .bind_iommufd = vdpa_iommufd_emulated_bind, + .unbind_iommufd = vdpa_iommufd_emulated_unbind, + .attach_ioas = vdpa_iommufd_emulated_attach_ioas, + .detach_ioas = vdpa_iommufd_emulated_detach_ioas, }; static const struct vdpa_config_ops vdpasim_batch_config_ops = { @@ -759,6 +763,10 @@ static const struct vdpa_config_ops vdpasim_batch_config_ops = { .set_group_asid = vdpasim_set_group_asid, .set_map = vdpasim_set_map, .free = vdpasim_free, + .bind_iommufd = vdpa_iommufd_emulated_bind, + .unbind_iommufd = vdpa_iommufd_emulated_unbind, + .attach_ioas = vdpa_iommufd_emulated_attach_ioas, + .detach_ioas = vdpa_iommufd_emulated_detach_ioas, }; MODULE_VERSION(DRV_VERSION);