From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E93A1EE6430 for ; Thu, 12 Sep 2024 04:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:To:Subject:Cc:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7dx9uaSPspZKv6ywt60+hs0Ve3r9Qlbv2gculcAbj28=; b=tYHyYawrbUIznuT5ikFJe4jsRF WQZwEzW5ImFu53MYL565P0zV9TTjOizi1OYZyWFoLVLm9AZmXJh7k/Fp2r4eHrCN2uQNM8ht1DtVz 2l8CpfLyZKeO11M6fq58ji+pIOUtpzElLuqGpQZ6uPy/7Wc/WJU/lXiskF+NNM/DHCqKTZLdYecRS Q4FP8kIMRa1pRiOPTxuiy08X62xivUJt1646OaEgVbep4xtWMwumpk3FgJD41Bz1VP4DHXNklw0N/ hohlPG24gaSZV0iEM+dg9P9IMWenTNxiGHl6CZs/z9rhqFFrF3LGai8Ivuo3zHSTGyYPw0hcrL0T2 05RSuEnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sobTe-0000000BpK7-2QrS; Thu, 12 Sep 2024 04:30:42 +0000 Received: from mgamail.intel.com ([198.175.65.16]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sobSa-0000000BpBo-3B0s for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2024 04:29:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726115377; x=1757651377; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=2htbrfTbDoYOyrx6HE0Z48NeXXb8ZCZ77dDRQxdrY68=; b=MqabyR+bxKMgapNiTzJGQGSSp9xXfYhVrzjr4quIcnJzs46tBQng4hWn 3KtJzZpvEp8zcRMbHGVKRLDtmDHPRTrq5cE54cMBsKnGNutSTkwdB7rhr uTtSO9q0Bd49ei4ydgjISUKz9Jb2YZzJqnVid3mO63ypazEnXV3WbnFPr UmOs8qSpIWlJzL3lEhs73V1oTmECG0k/jOgr28Y12oWn1Sl7EK+6ZdU09 ZqTDiop/LEVv1aTx8CXxhB096moGZyAqRHPwwe/JExrH2y45qYhJwCD7C QO/nVbVNwP0DpBzDMVigYIARYcwjLS6Y+Rk0E3PNYM9wgB2DblsvI5ped A==; X-CSE-ConnectionGUID: jnl4qWRQRiW+Ivn+S6Ro/w== X-CSE-MsgGUID: uXuwkjSUTDi497e/nordcA== X-IronPort-AV: E=McAfee;i="6700,10204,11192"; a="25050151" X-IronPort-AV: E=Sophos;i="6.10,221,1719903600"; d="scan'208";a="25050151" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 21:29:35 -0700 X-CSE-ConnectionGUID: wBTofcTnRmibyrXMjsPvvA== X-CSE-MsgGUID: sgRejlZ+S2qkKv9CuIlBYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,221,1719903600"; d="scan'208";a="67202475" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by fmviesa006.fm.intel.com with ESMTP; 11 Sep 2024 21:29:29 -0700 Message-ID: Date: Thu, 12 Sep 2024 12:25:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, Jason Gunthorpe , acpica-devel@lists.linux.dev, Hanjun Guo , iommu@lists.linux.dev, Joerg Roedel , Kevin Tian , kvm@vger.kernel.org, Len Brown , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi , "Rafael J. Wysocki" , Robert Moore , Robin Murphy , Sudeep Holla , Will Deacon , Alex Williamson , Eric Auger , Jean-Philippe Brucker , Moritz Fischer , Michael Shavit , patches@lists.linux.dev, Shameerali Kolothum Thodi , Mostafa Saleh Subject: Re: [PATCH v2 0/8] Initial support for SMMUv3 nested translation To: Zhangfei Gao , Nicolin Chen References: <0-v2-621370057090+91fec-smmuv3_nesting_jgg@nvidia.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_212936_884616_0C5705CA X-CRM114-Status: GOOD ( 22.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/12/24 11:42 AM, Zhangfei Gao wrote: > On Wed, 28 Aug 2024 at 05:32, Nicolin Chen wrote: >> On Tue, Aug 27, 2024 at 12:51:30PM -0300, Jason Gunthorpe wrote: >>> This brings support for the IOMMFD ioctls: >>> >>> - IOMMU_GET_HW_INFO >>> - IOMMU_HWPT_ALLOC_NEST_PARENT >>> - IOMMU_DOMAIN_NESTED >>> - ops->enforce_cache_coherency() >>> >>> This is quite straightforward as the nested STE can just be built in the >>> special NESTED domain op and fed through the generic update machinery. >>> >>> The design allows the user provided STE fragment to control several >>> aspects of the translation, including putting the STE into a "virtual >>> bypass" or a aborting state. This duplicates functionality available by >>> other means, but it allows trivially preserving the VMID in the STE as we >>> eventually move towards the VIOMMU owning the VMID. >>> >>> Nesting support requires the system to either support S2FWB or the >>> stronger CANWBS ACPI flag. This is to ensure the VM cannot bypass the >>> cache and view incoherent data, currently VFIO lacks any cache flushing >>> that would make this safe. >>> >>> Yan has a series to add some of the needed infrastructure for VFIO cache >>> flushing here: >>> >>> https://lore.kernel.org/linux-iommu/20240507061802.20184-1-yan.y.zhao@intel.com/ >>> >>> Which may someday allow relaxing this further. >>> >>> Remove VFIO_TYPE1_NESTING_IOMMU since it was never used and superseded by >>> this. >>> >>> This is the first series in what will be several to complete nesting >>> support. At least: >>> - IOMMU_RESV_SW_MSI related fixups >>> https://lore.kernel.org/linux-iommu/cover.1722644866.git.nicolinc@nvidia.com/ >>> - VIOMMU object support to allow ATS and CD invalidations >>> https://lore.kernel.org/linux-iommu/cover.1723061377.git.nicolinc@nvidia.com/ >>> - vCMDQ hypervisor support for direct invalidation queue assignment >>> https://lore.kernel.org/linux-iommu/cover.1712978212.git.nicolinc@nvidia.com/ >>> - KVM pinned VMID using VIOMMU for vBTM >>> https://lore.kernel.org/linux-iommu/20240208151837.35068-1-shameerali.kolothum.thodi@huawei.com/ >>> - Cross instance S2 sharing >>> - Virtual Machine Structure using VIOMMU (for vMPAM?) >>> - Fault forwarding support through IOMMUFD's fault fd for vSVA >>> >>> The VIOMMU series is essential to allow the invalidations to be processed >>> for the CD as well. >>> >>> It is enough to allow qemu work to progress. >>> >>> This is on github:https://github.com/jgunthorpe/linux/commits/smmuv3_nesting >>> >>> v2: >> As mentioned above, the VIOMMU series would be required to test >> the entire nesting feature, which now has a v2 rebasing on this >> series. I tested it with a paring QEMU branch. Please refer to: >> https://lore.kernel.org/linux-iommu/cover.1724776335.git.nicolinc@nvidia.com/ >> Also, there is another new VIRQ series on top of the VIOMMU one >> and this nesting series. And I tested it too. Please refer to: >> https://lore.kernel.org/linux-iommu/cover.1724777091.git.nicolinc@nvidia.com/ >> >> With that, >> >> Tested-by: Nicolin Chen >> > Have you tested the user page fault? > > I got an issue, when a user page fault happens, > group->attach_handle = iommu_attach_handle_get(pasid) > return NULL. > > A bit confused here, only find IOMMU_NO_PASID is used when attaching > > __fault_domain_replace_dev > ret = iommu_replace_group_handle(idev->igroup->group, hwpt->domain, > &handle->handle); > curr = xa_store(&group->pasid_array, IOMMU_NO_PASID, handle, GFP_KERNEL); > > not find where the code attach user pasid with the attach_handle. Have you set iommu_ops::user_pasid_table for SMMUv3 driver? Thanks, baolu