From patchwork Mon Nov 14 04:10:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 19540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1958651wru; Sun, 13 Nov 2022 20:32:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf7gUgGxDCo156JJZ57hSOUpKm+YWUlYoRE0O45eTVCQRwhSfMjKUl9FTls7FLWahRnCdsG5 X-Received: by 2002:a05:6402:3cd:b0:458:e9c0:3e6f with SMTP id t13-20020a05640203cd00b00458e9c03e6fmr10068871edw.61.1668400366237; Sun, 13 Nov 2022 20:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668400366; cv=none; d=google.com; s=arc-20160816; b=mzoXf9Gm063XqqhcLcabQ9ife/i61mqxv3fytrQh0z8IopAuHaAwK2P6MEu//Z2YeY l2osj8+NW89CmBkXATunblKGyFUcQl8txb/IvQhAnrzrPLcw+b6EC9ibpyTvFW9aK5DL H03PA4E+NfT4PIyhUKuPydCc1Urvo0RwsyseZzXZ4X4SYOTjG10lq8KdJ4rZ/WTXWCL7 AWVAoDeNvObpBKR3aXnKc1c1p29K4Bj0uS/ouhMQiqCkuc84j4vFy9mD6qdZaFtyDHcX D5TVl8wAAJfzBfyXvft0XBOi5WG+VASC/oM5S1V+d4g/4+A23qlcVuHGI8h+pt+TlC5Z pbsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=ELRgeMtGATfLN7epm2jF0HOOeRGn2e6ViLNPW7m4kxM=; b=HiEe8NP2XmeHFOLQIS5cCmr7UClAQwdqqlT1UlD4dM2/KNu8ZKCbbEsg/8NsBtBwcT MPSnHK4bC2u9fqHqGGCQqcueDMp7xdhUpeOXXQabbreI4Nf+G1YZpcWOFziktx4txQj2 suPWjSibKdvipIm7lbKvdZ0zmB+aliLvjB5+l1naWa4Pltw54l9pCcNWFJK0a/ldSuPv 9MPUx2RaH+HDPYjBMKAvd4SkS4x7jBIwAoejlSTtdZCf/hMdMrGVd6idDZHcne24D5xv a6+H19YQLFwaXNxuSyDYOypl7swubfN3oWxoYv+gfL0KaFqNBQ66tAN9TEkWotcKZEvC ioBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b="aCKo5RR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a170906c09000b007ae0ea72153si6332062ejz.696.2022.11.13.20.32.22; Sun, 13 Nov 2022 20:32:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b="aCKo5RR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235804AbiKNELN (ORCPT + 99 others); Sun, 13 Nov 2022 23:11:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235415AbiKNELK (ORCPT ); Sun, 13 Nov 2022 23:11:10 -0500 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A92DFC1; Sun, 13 Nov 2022 20:11:03 -0800 (PST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4N9bTJ1mfbz4xYV; Mon, 14 Nov 2022 15:11:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canb.auug.org.au; s=201702; t=1668399062; bh=ELRgeMtGATfLN7epm2jF0HOOeRGn2e6ViLNPW7m4kxM=; h=Date:From:To:Cc:Subject:From; b=aCKo5RR/HrWvWgOaaE4L9S70+JAHH6mQ5cIB/hbo9Q0cA+WJm/HSfc8gpnoIQ5iA+ asruQgF/wpG8t7xhuVVPdTUaTn6tyX1N/xArRXCg7SF1e+AHcXy5B2TqgmDPRBf7wL 0zmmYenVJ2WRiptrjO7dZ9yXvbZfyPPW0pLZWJExzOc/BglhZil9oUjwX9UH5EbXdG Py9ILcAaGJASESeGVkP7MV0s/xFvIC/10e1PdQ4QtepWKAX1sw84yTy+xLPMqHlcEv CBocBjec3qa9nWNaCRYBhRn4Xkic0IA8fcyS0KjGTniZ5fT7PX9DwbqNp0OUr2yB4d 5jG3GbljTwK8w== Date: Mon, 14 Nov 2022 15:10:54 +1100 From: Stephen Rothwell To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Joerg Roedel Cc: Dave Hansen , Joerg Roedel , "Kirill A. Shutemov" , Linux Kernel Mailing List , Linux Next Mailing List , Lu Baolu Subject: linux-next: manual merge of the tip tree with the iommu tree Message-ID: <20221114151054.18a48fd9@canb.auug.org.au> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749444582482857094?= X-GMAIL-MSGID: =?utf-8?q?1749444582482857094?= Hi all, Today's linux-next merge of the tip tree got a conflict in: drivers/iommu/iommu-sva-lib.c between commit: 757636ed2607 ("iommu: Rename iommu-sva-lib.{c,h}") from the iommu tree and commits: e79114b17b81 ("iommu/sva: Replace pasid_valid() helper with mm_valid_pasid()") 53e220bbaa51 ("x86/mm/iommu/sva: Make LAM and SVA mutually exclusive") from the tip tree. The file was renamed in the former, so I deleted it and applied the following merge resolution patch. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. From: Stephen Rothwell Date: Mon, 14 Nov 2022 12:36:45 +1100 Subject: [PATCH] fix up for "iommu: Rename iommu-sva-lib.{c,h}" Signed-off-by: Stephen Rothwell --- drivers/iommu/iommu-sva.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index 24bf9b2b58aa..af05dd9f2a6f 100644 --- a/drivers/iommu/iommu-sva.c +++ b/drivers/iommu/iommu-sva.c @@ -2,6 +2,8 @@ /* * Helpers for IOMMU drivers implementing SVA */ +#include +#include #include #include #include @@ -32,21 +34,31 @@ int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max) min == 0 || max < min) return -EINVAL; + /* Serialize against address tagging enabling */ + if (mmap_write_lock_killable(mm)) + return -EINTR; + + if (!arch_pgtable_dma_compat(mm)) { + mmap_write_unlock(mm); + return -EBUSY; + } + mutex_lock(&iommu_sva_lock); /* Is a PASID already associated with this mm? */ - if (pasid_valid(mm->pasid)) { + if (mm_valid_pasid(mm)) { if (mm->pasid < min || mm->pasid >= max) ret = -EOVERFLOW; goto out; } pasid = ioasid_alloc(&iommu_sva_pasid, min, max, mm); - if (!pasid_valid(pasid)) + if (pasid == INVALID_IOASID) ret = -ENOMEM; else mm_pasid_set(mm, pasid); out: mutex_unlock(&iommu_sva_lock); + mmap_write_unlock(mm); return ret; } EXPORT_SYMBOL_GPL(iommu_sva_alloc_pasid);