public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Thomas Gleixner <tglx@linutronix•de>,
	Ingo Molnar <mingo@redhat•com>, "H. Peter Anvin" <hpa@zytor•com>,
	Peter Zijlstra <peterz@infradead•org>,
	Joerg Roedel <joro@8bytes•org>
Cc: Dave Hansen <dave.hansen@linux•intel.com>,
	Jacob Pan <jacob.jun.pan@linux•intel.com>,
	Jason Gunthorpe <jgg@nvidia•com>, Jason Gunthorpe <jgg@ziepe•ca>,
	Joerg Roedel <jroedel@suse•de>,
	"Kirill A. Shutemov" <kirill.shutemov@linux•intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>
Subject: Re: linux-next: manual merge of the tip tree with the iommu tree
Date: Mon, 3 Apr 2023 15:11:48 +1000	[thread overview]
Message-ID: <20230403151148.2991d6cd@canb.auug.org.au> (raw)
In-Reply-To: <20230403143642.2aa6fe8e@canb.auug.org.au>

[-- Attachment #1: Type: text/plain, Size: 5496 bytes --]

Hi all,

On Mon, 3 Apr 2023 14:36:42 +1000 Stephen Rothwell <sfr@canb•auug.org.au> wrote:
>
> Today's linux-next merge of the tip tree got conflicts in:
> 
>   drivers/iommu/iommu-sva.c
>   include/linux/sched/mm.h
>   include/linux/ioasid.h
> 
> between commits:
> 
>   cd3891158a77 ("iommu/sva: Move PASID helpers to sva code")
>   4e14176ab13f ("iommu/sva: Stop using ioasid_set for SVA")
>   1a14bf0fc7ed ("iommu/sva: Use GFP_KERNEL for pasid allocation")
> 
> from the iommu tree and commit:
> 
>   400b9b93441c ("iommu/sva: Replace pasid_valid() helper with mm_valid_pasid()")
> 
> from the tip tree.
> 
> I fixed it up (I used the former version of include/linux/sched/mm.h,
> removed include/linux/ioasid.h, updated drivers/iommu/iommu-sva.c
> as below and applied the following patch) 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 <sfr@canb•auug.org.au>
> Date: Mon, 3 Apr 2023 14:32:58 +1000
> Subject: [PATCH] fixup for "iommu/sva: Replace pasid_valid() helper with mm_valid_pasid()"
> 
> interacting with "iommu/sva: Replace pasid_valid() helper with
> mm_valid_pasid()" and "iommu: Remove ioasid infrastructure"
> 
> Signed-off-by: Stephen Rothwell <sfr@canb•auug.org.au>
> ---
>  include/linux/iommu.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index 54f535ff9868..0c5d4c3b59cd 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -1172,16 +1172,15 @@ static inline bool tegra_dev_iommu_get_stream_id(struct device *dev, u32 *stream
>  	return false;
>  }
>  
> -static inline bool pasid_valid(ioasid_t ioasid)
> -{
> -	return ioasid != IOMMU_PASID_INVALID;
> -}
> -
>  #ifdef CONFIG_IOMMU_SVA
>  static inline void mm_pasid_init(struct mm_struct *mm)
>  {
>  	mm->pasid = IOMMU_PASID_INVALID;
>  }
> +static inline bool mm_valid_pasid(struct mm_struct *mm)
> +{
> +	return mm->pasid != IOMMU_PASID_INVALID;
> +}
>  void mm_pasid_drop(struct mm_struct *mm);
>  struct iommu_sva *iommu_sva_bind_device(struct device *dev,
>  					struct mm_struct *mm);
> @@ -1203,6 +1202,7 @@ static inline u32 iommu_sva_get_pasid(struct iommu_sva *handle)
>  	return IOMMU_PASID_INVALID;
>  }
>  static inline void mm_pasid_init(struct mm_struct *mm) {}
> +static inline bool mm_valid_pasid(struct mm_struct *mm) { return false; }
>  static inline void mm_pasid_drop(struct mm_struct *mm) {}
>  #endif /* CONFIG_IOMMU_SVA */
>  
> -- 
> 2.39.2
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/iommu/iommu-sva.c
> index c434b95dc8eb,dd76a1a09cf7..000000000000
> --- a/drivers/iommu/iommu-sva.c
> +++ b/drivers/iommu/iommu-sva.c
> @@@ -9,14 -10,26 +10,14 @@@
>   #include "iommu-sva.h"
>   
>   static DEFINE_MUTEX(iommu_sva_lock);
>  -static DECLARE_IOASID_SET(iommu_sva_pasid);
>  +static DEFINE_IDA(iommu_global_pasid_ida);
>   
>  -/**
>  - * iommu_sva_alloc_pasid - Allocate a PASID for the mm
>  - * @mm: the mm
>  - * @min: minimum PASID value (inclusive)
>  - * @max: maximum PASID value (inclusive)
>  - *
>  - * Try to allocate a PASID for this mm, or take a reference to the existing one
>  - * provided it fits within the [@min, @max] range. On success the PASID is
>  - * available in mm->pasid and will be available for the lifetime of the mm.
>  - *
>  - * Returns 0 on success and < 0 on error.
>  - */
>  -int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max)
>  +/* Allocate a PASID for the mm within range (inclusive) */
>  +static int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max)
>   {
>   	int ret = 0;
>  -	ioasid_t pasid;
>   
> - 	if (!pasid_valid(min) || !pasid_valid(max) ||
>  -	if (min == INVALID_IOASID || max == INVALID_IOASID ||
> ++	if (min == IOMMU_PASID_INVALID || max == IOMMU_PASID_INVALID ||
>   	    min == 0 || max < min)
>   		return -EINVAL;
>   
> @@@ -205,11 -242,3 +209,11 @@@ out_put_mm
>   
>   	return status;
>   }
>  +
>  +void mm_pasid_drop(struct mm_struct *mm)
>  +{
> - 	if (likely(!pasid_valid(mm->pasid)))
> ++	if (likely(!mm_valid_pasid(mm)))
>  +		return;
>  +
>  +	ida_free(&iommu_global_pasid_ida, mm->pasid);
>  +}

It also needs this:

From: Stephen Rothwell <sfr@canb•auug.org.au>
Date: Mon, 3 Apr 2023 14:58:05 +1000
Subject: [PATCH] extra fixup for "iommu/sva: Replace pasid_valid() helper with mm_valid_pasid()"

interacting with "iommu/sva: Replace pasid_valid() helper with
mm_valid_pasid()" and "iommu: Remove ioasid infrastructure"

Signed-off-by: Stephen Rothwell <sfr@canb•auug.org.au>
---
 arch/x86/kernel/process_64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 74c7e84a94d8..3bcbc165c5bb 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -39,6 +39,7 @@
 #include <linux/io.h>
 #include <linux/ftrace.h>
 #include <linux/syscalls.h>
+#include <linux/iommu.h>
 
 #include <asm/processor.h>
 #include <asm/pkru.h>
-- 
2.39.2

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-04-03  5:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03  4:36 linux-next: manual merge of the tip tree with the iommu tree Stephen Rothwell
2023-04-03  5:11 ` Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-14  4:10 Stephen Rothwell
2022-03-07  1:50 Stephen Rothwell
2021-10-21  1:35 Stephen Rothwell
2021-10-21 15:29 ` Borislav Petkov
2021-11-02  2:57 ` Stephen Rothwell
2020-10-02  5:22 Stephen Rothwell
2020-10-13  3:38 ` Stephen Rothwell
2017-08-22  3:50 Stephen Rothwell
2017-08-22  5:57 ` Baoquan He
2017-08-22  7:49   ` Stephen Rothwell
2017-08-22  8:01     ` Baoquan He
2017-08-22  8:43       ` Stephen Rothwell
2017-08-22  8:50         ` Baoquan He
2017-08-22  8:11     ` Baoquan He
2017-08-23 14:15 ` Tom Lendacky
2017-09-04  5:45 ` Stephen Rothwell
2015-06-17  3:22 Michael Ellerman
2015-06-17  9:57 ` Joerg Roedel
2015-06-17 21:15   ` Michael Ellerman
2015-06-09  6:57 Stephen Rothwell
2015-06-09  6:57 Stephen Rothwell
     [not found] <20150605085030.17051140293@ozlabs.org>
2015-06-05  8:57 ` Joerg Roedel
2011-09-27  5:03 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230403151148.2991d6cd@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=hpa@zytor$(echo .)com \
    --cc=jacob.jun.pan@linux$(echo .)intel.com \
    --cc=jgg@nvidia$(echo .)com \
    --cc=jgg@ziepe$(echo .)ca \
    --cc=joro@8bytes$(echo .)org \
    --cc=jroedel@suse$(echo .)de \
    --cc=kirill.shutemov@linux$(echo .)intel.com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=mingo@redhat$(echo .)com \
    --cc=peterz@infradead$(echo .)org \
    --cc=tglx@linutronix$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox