Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp636153rdf; Fri, 3 Nov 2023 10:18:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtQvfzRRrW2p3jX7FbLniBlehBB9Ex9uS2cJKP5SVKcNKwa+jA2bnmCSidht2c/iPYIKyY X-Received: by 2002:a05:6359:2c44:b0:168:e9e5:b407 with SMTP id qv4-20020a0563592c4400b00168e9e5b407mr19186866rwb.10.1699031901672; Fri, 03 Nov 2023 10:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699031901; cv=none; d=google.com; s=arc-20160816; b=rgtM6g5QilbzB3g/6izVRGSCaIUbD23cs83q2c/JRGFtZE4du+J8dbRbKStTdWFLO5 ZxAV1KcBzMBDicmtOcqfHKex53K7HMF2zZ6KyBc4m0+4NcZf/HDaWO8jovDbq3cRIcFM d/YiaMaHuCDzsJ7o/lzjUz78lW3YClMXQVQeTBwNNLBg9I+2kOETrXw3U06WFpYlN51H jUFV3zZaOO70Nt1H1bGQkzbqIIOdq4LLsdI3Rpz1Xv+p2LiyTWlJz/lPYzdmMZZFnjub ObY0K2TFxGPU7PLuoAlx1rblVOdRQB+/7P9aZvkB+SSGvna2Sx5wea8WU5IcvPFfi0eM 8Lng== 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 :message-id:date:subject:to:from:dkim-signature; bh=vRd7f5G8x90QkHchEr3Lu9idWoM8f/Qc/4n6P4JgvYc=; fh=xiBZnYthZkU72K3VlivZH8ewgfrUkWRaBxXhAGtxMAw=; b=zkrzGj5et7ZYuTC4XNONFAThgtj4LUhYuvD+AM8sqkRPztsxFLckabRXas1qmX15eq gofZr2eEkNy6kWAiT+J4zrGCNxnJSgJpJMlS2xMpABTbbxeAuC82dl8zoRJmEDw78Vbb GDuraQJ7VAAksnw8vUnpAvnWGYa95QMhvlDcBgcGs5uTyjJyIuiOML15CbK3p986tNad V7unjgB+kiJjcxZI0silm+Wikm7pHEAtyZpWSGyCwPPLi7qaH2AHZoC7US6psl2OhGH4 guY4pazMn9SThj3gB7W8ewZJAGjU3BN2V6UmKDZ8NUxSlPGXADaiijK9XH1GKPzaBIQ2 KM2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PgStz4e3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bw42-20020a056a0204aa00b005b92f57afe7si1977724pgb.641.2023.11.03.10.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 10:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PgStz4e3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 527B1823524A; Fri, 3 Nov 2023 10:18:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234408AbjKCRRp (ORCPT + 99 others); Fri, 3 Nov 2023 13:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234393AbjKCRRo (ORCPT ); Fri, 3 Nov 2023 13:17:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF4BD44 for ; Fri, 3 Nov 2023 10:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699031813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vRd7f5G8x90QkHchEr3Lu9idWoM8f/Qc/4n6P4JgvYc=; b=PgStz4e3nzBQ84CFyCeZfcpqsBsMB8phpd92nw6Sm2pR0dzoRTsoK5f7/tIA5y8j4fsfue cXbr1wAqDp+efWaMC5O9blJ0qV4RLQX91Io9r2f2nRKIfJop4a9H1o1uQjGoiFPMOyBUy/ jouEAGad2Yt0mvkebne5LoxZXt1Uhnk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-Ae_BpGh3OHuKUFySfTAznw-1; Fri, 03 Nov 2023 13:16:49 -0400 X-MC-Unique: Ae_BpGh3OHuKUFySfTAznw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5CD90848A77; Fri, 3 Nov 2023 17:16:48 +0000 (UTC) Received: from server.redhat.com (unknown [10.72.112.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CAA440C6EBC; Fri, 3 Nov 2023 17:16:44 +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 v1 0/8] vhost-vdpa: add support for iommufd Date: Sat, 4 Nov 2023 01:16:33 +0800 Message-Id: <20231103171641.1703146-1-lulu@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 03 Nov 2023 10:18:11 -0700 (PDT) Hi All This code provides the iommufd support for vdpa device This code fixes the bugs from the last version and also add the asid support. rebase on kernel v6,6-rc3 Test passed in the physical device (vp_vdpa), but there are still some problems in the emulated device (vdpa_sim_net), I will continue working on it The kernel code is https://gitlab.com/lulu6/vhost/-/tree/iommufdRFC_v1 Signed-off-by: Cindy Lu Cindy Lu (8): vhost/iommufd: Add the functions support iommufd Kconfig: Add the new file vhost/iommufd vhost: Add 3 new uapi to support iommufd vdpa: Add new vdpa_config_ops to support iommufd vdpa_sim :Add support for iommufd vdpa: change the map/unmap process to support iommufd vp_vdpa::Add support for iommufd iommu: expose the function iommu_device_use_default_domain drivers/iommu/iommu.c | 2 + drivers/vdpa/vdpa_sim/vdpa_sim.c | 8 ++ drivers/vdpa/virtio_pci/vp_vdpa.c | 4 + drivers/vhost/Kconfig | 1 + drivers/vhost/Makefile | 1 + drivers/vhost/iommufd.c | 178 +++++++++++++++++++++++++ drivers/vhost/vdpa.c | 210 +++++++++++++++++++++++++++++- drivers/vhost/vhost.h | 21 +++ include/linux/vdpa.h | 38 +++++- include/uapi/linux/vhost.h | 66 ++++++++++ 10 files changed, 525 insertions(+), 4 deletions(-) create mode 100644 drivers/vhost/iommufd.c -- 2.34.3