From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 8738E279907 for ; Thu, 16 Jul 2026 11:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784201764; cv=none; b=OfYAnS/1EeFgKx1TGhMmYxc52f6jg9wRQ5dNRYIY6Z/4X7PgLAnrrI9irEMLGygUKWSbG6TKNX8rkxafWN9WKwYWiyqoBUGuCxnpu67xpc4GH4MUSgA24MEdFN0Hfk8BVLjBfpRK4xoqlWBVp/40yzNguslXWwmVDwuRFFwQW7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784201764; c=relaxed/simple; bh=DwCHfm+r0WPDd9SBxjzkRdMHLWcHqtocj4hKAZ7zvHc=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=UWD1FiIgK7JheiYPINQZ4wAGefWQM/yxizSnFo2UC+NI7DaIwG+GF3/Skx6iIoKi4cKj5NGbUuKZif9Q8HjHBCDeiE2WACTYa4x7z/S5XG72Nzu03YljOF68UAQ6EY7ek4C5m+CU/MUh0KdMFtZcMXfpZYaLvRiDsTT3MsG0S3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HYbfHLPi; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HYbfHLPi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B17681F000E9; Thu, 16 Jul 2026 11:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784201763; bh=nZI39JQGf9PszJKOvHXXyclH3x5xeAWku+d+KbsoQpc=; h=Subject:To:Cc:From:Date; b=HYbfHLPicyW3xBr1XNeWL5AxA4Te5ktyJrnPdez5JPekRhzga6mZ5OC02m1ounMmX Wv2HOGxQ3XPvNdv0j5MeuORn/8ZBlVX7aat/4e2XzUDInDuoWDOv5zL9wy2iLv6ubL 0n2zDfH20dQt6M75YLenns366JyoKBGNjADw6yJU= Subject: FAILED: patch "[PATCH] iommu/amd: Don't split flush for amd_iommu_domain_flush_all()" failed to apply to 5.15-stable tree To: wnliu@google.com,jgg@nvidia.com,joerg.roedel@amd.com,josef@toxicpanda.com,skhawaja@google.com,suravee.suthikulpanit@amd.com,vasant.hegde@amd.com,wei.w.wang@hotmail.com Cc: From: Date: Thu, 16 Jul 2026 13:35:48 +0200 Message-ID: <2026071648-ogle-phonics-2909@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 69fe699afe1afcb730164b86c228483c2da05f94 # git commit -s git send-email --to '' --in-reply-to '2026071648-ogle-phonics-2909@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 69fe699afe1afcb730164b86c228483c2da05f94 Mon Sep 17 00:00:00 2001 From: Weinan Liu Date: Thu, 28 May 2026 22:31:47 +0000 Subject: [PATCH] iommu/amd: Don't split flush for amd_iommu_domain_flush_all() We have observed multiple full invalidations occurring during device detach when we are done using the vfio-device. blocked_domain_attach_device() -> detach_device() -> amd_iommu_domain_flush_all() -> amd_iommu_domain_flush_pages(..., CMD_INV_IOMMU_ALL_PAGES_ADDRESS) while (size != 0) { -> __domain_flush_pages( flush_size /* power of 2 flush_size */) -> domain_flush_pages_v1() -> build_inv_iommu_pages() -> build_inv_address() } build_inv_address() will trigger a full invalidation if the chunk size > (1 << 51). Consequently, the guest will issue multiple full invalidations for a single call to amd_iommu_domain_flush_all() Without this patch, we will see 10 time instead of 1 time full invalidations for every amd_iommu_domain_flush_all(). Cc: stable@vger.kernel.org Fixes: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a VM") Suggested-by: Josef Bacik Suggested-by: Jason Gunthorpe Signed-off-by: Weinan Liu Reviewed-by: Wei Wang Reviewed-by: Jason Gunthorpe Reviewed-by: Samiullah Khawaja Reviewed-by: Suravee Suthikulpanit Reviewed-by: Vasant Hegde Signed-off-by: Joerg Roedel diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index f1333071da10..0c042668b32d 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1770,7 +1770,8 @@ void amd_iommu_domain_flush_pages(struct protection_domain *domain, { lockdep_assert_held(&domain->lock); - if (likely(!amd_iommu_np_cache)) { + if (likely(!amd_iommu_np_cache) || + size >= (1ULL<<52)) { __domain_flush_pages(domain, address, size); /* Wait until IOMMU TLB and all device IOTLB flushes are complete */