Re: linux-next: manual merge of the tip tree with the iommu tree

2020-10-12 Thread Stephen Rothwell
Hi all,

On Fri, 2 Oct 2020 15:22:24 +1000 Stephen Rothwell  
wrote:
>
> Today's linux-next merge of the tip tree got a conflict in:
> 
>   include/linux/iommu.h
> 
> between commits:
> 
>   23cc3493b5e1 ("iommu/uapi: Rename uapi functions")
>   d90573812eea ("iommu/uapi: Handle data and argsz filled by users")
> 
> from the iommu tree and commit:
> 
>   c7b6bac9c72c ("drm, iommu: Change type of pasid to u32")
> 
> from the tip tree.
> 
> I fixed it up (I used the former version) 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.

This is now a conflict between the iommu tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell


pgpvEOlkbU0RA.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the tip tree with the iommu tree

2020-10-01 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  include/linux/iommu.h

between commits:

  23cc3493b5e1 ("iommu/uapi: Rename uapi functions")
  d90573812eea ("iommu/uapi: Handle data and argsz filled by users")

from the iommu tree and commit:

  c7b6bac9c72c ("drm, iommu: Change type of pasid to u32")

from the tip tree.

I fixed it up (I used the former version) 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.

-- 
Cheers,
Stephen Rothwell


pgptWE2NOZQWA.pgp
Description: OpenPGP digital signature


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-09-03 Thread Stephen Rothwell
Hi all,

On Tue, 22 Aug 2017 13:50:57 +1000 Stephen Rothwell  
wrote:
>
> Hi all,
> 
> Today's linux-next merge of the tip tree got conflicts in:
> 
>   drivers/iommu/amd_iommu.c
>   drivers/iommu/amd_iommu_init.c
>   drivers/iommu/amd_iommu_proto.h
>   drivers/iommu/amd_iommu_types.h
> 
> between commits:
> 
>   4c232a708be1 ("iommu/amd: Detect pre enabled translation")
>   9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"")
>   07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
>   daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
> 
> from the iommu tree and commit:
> 
>   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> encryption")
> 
> from the tip tree.
> 
> 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/iommu/amd_iommu.c
> index 31bce367866c,4ad7e5e31943..
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@@ -1476,10 -1538,10 +1478,10 @@@ static int iommu_map_page(struct protec
>   return -EBUSY;
>   
>   if (count > 1) {
> - __pte = PAGE_SIZE_PTE(phys_addr, page_size);
> + __pte = PAGE_SIZE_PTE(__sme_set(phys_addr), page_size);
>  -__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC;
>  +__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   } else
> - __pte = phys_addr | IOMMU_PTE_PR | IOMMU_PTE_FC;
>  -__pte = __sme_set(phys_addr) | IOMMU_PTE_P | IOMMU_PTE_FC;
> ++__pte = __sme_set(phys_addr) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   
>   if (prot & IOMMU_PROT_IR)
>   __pte |= IOMMU_PTE_IR;
> diff --cc drivers/iommu/amd_iommu_init.c
> index ff8887ac,2292a6cece76..
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@@ -29,6 -29,8 +29,7 @@@
>   #include 
>   #include 
>   #include 
>  -#include 
> + #include 
>   #include 
>   #include 
>   #include 
> diff --cc drivers/iommu/amd_iommu_proto.h
> index 90e62e9b01c5,3f12fb2338ea..
> --- a/drivers/iommu/amd_iommu_proto.h
> +++ b/drivers/iommu/amd_iommu_proto.h
> @@@ -87,6 -87,14 +87,16 @@@ static inline bool iommu_feature(struc
>   return !!(iommu->features & f);
>   }
>   
> + static inline u64 iommu_virt_to_phys(void *vaddr)
> + {
> + return (u64)__sme_set(virt_to_phys(vaddr));
> + }
> + 
> + static inline void *iommu_phys_to_virt(unsigned long paddr)
> + {
> + return phys_to_virt(__sme_clr(paddr));
> + }
> + 
>  +extern bool translation_pre_enabled(struct amd_iommu *iommu);
>  +extern struct iommu_dev_data *get_dev_data(struct device *dev);
>   #endif /* _ASM_X86_AMD_IOMMU_PROTO_H  */
> diff --cc drivers/iommu/amd_iommu_types.h
> index 5f775fef341c,8591f43c467c..
> --- a/drivers/iommu/amd_iommu_types.h
> +++ b/drivers/iommu/amd_iommu_types.h
> @@@ -361,8 -343,8 +361,8 @@@
>   #define GCR3_VALID  0x01ULL
>   
>   #define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
>  -#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
>  +#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
> - #define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
> + #define IOMMU_PTE_PAGE(pte) (iommu_phys_to_virt((pte) & IOMMU_PAGE_MASK))
>   #define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
>   
>   #define IOMMU_PROT_MASK 0x03

Just a reminder that these conflicts still exist.

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-09-03 Thread Stephen Rothwell
Hi all,

On Tue, 22 Aug 2017 13:50:57 +1000 Stephen Rothwell  
wrote:
>
> Hi all,
> 
> Today's linux-next merge of the tip tree got conflicts in:
> 
>   drivers/iommu/amd_iommu.c
>   drivers/iommu/amd_iommu_init.c
>   drivers/iommu/amd_iommu_proto.h
>   drivers/iommu/amd_iommu_types.h
> 
> between commits:
> 
>   4c232a708be1 ("iommu/amd: Detect pre enabled translation")
>   9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"")
>   07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
>   daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
> 
> from the iommu tree and commit:
> 
>   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> encryption")
> 
> from the tip tree.
> 
> 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/iommu/amd_iommu.c
> index 31bce367866c,4ad7e5e31943..
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@@ -1476,10 -1538,10 +1478,10 @@@ static int iommu_map_page(struct protec
>   return -EBUSY;
>   
>   if (count > 1) {
> - __pte = PAGE_SIZE_PTE(phys_addr, page_size);
> + __pte = PAGE_SIZE_PTE(__sme_set(phys_addr), page_size);
>  -__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC;
>  +__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   } else
> - __pte = phys_addr | IOMMU_PTE_PR | IOMMU_PTE_FC;
>  -__pte = __sme_set(phys_addr) | IOMMU_PTE_P | IOMMU_PTE_FC;
> ++__pte = __sme_set(phys_addr) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   
>   if (prot & IOMMU_PROT_IR)
>   __pte |= IOMMU_PTE_IR;
> diff --cc drivers/iommu/amd_iommu_init.c
> index ff8887ac,2292a6cece76..
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@@ -29,6 -29,8 +29,7 @@@
>   #include 
>   #include 
>   #include 
>  -#include 
> + #include 
>   #include 
>   #include 
>   #include 
> diff --cc drivers/iommu/amd_iommu_proto.h
> index 90e62e9b01c5,3f12fb2338ea..
> --- a/drivers/iommu/amd_iommu_proto.h
> +++ b/drivers/iommu/amd_iommu_proto.h
> @@@ -87,6 -87,14 +87,16 @@@ static inline bool iommu_feature(struc
>   return !!(iommu->features & f);
>   }
>   
> + static inline u64 iommu_virt_to_phys(void *vaddr)
> + {
> + return (u64)__sme_set(virt_to_phys(vaddr));
> + }
> + 
> + static inline void *iommu_phys_to_virt(unsigned long paddr)
> + {
> + return phys_to_virt(__sme_clr(paddr));
> + }
> + 
>  +extern bool translation_pre_enabled(struct amd_iommu *iommu);
>  +extern struct iommu_dev_data *get_dev_data(struct device *dev);
>   #endif /* _ASM_X86_AMD_IOMMU_PROTO_H  */
> diff --cc drivers/iommu/amd_iommu_types.h
> index 5f775fef341c,8591f43c467c..
> --- a/drivers/iommu/amd_iommu_types.h
> +++ b/drivers/iommu/amd_iommu_types.h
> @@@ -361,8 -343,8 +361,8 @@@
>   #define GCR3_VALID  0x01ULL
>   
>   #define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
>  -#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
>  +#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
> - #define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
> + #define IOMMU_PTE_PAGE(pte) (iommu_phys_to_virt((pte) & IOMMU_PAGE_MASK))
>   #define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
>   
>   #define IOMMU_PROT_MASK 0x03

Just a reminder that these conflicts still exist.

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-23 Thread Tom Lendacky
On 8/21/2017 10:50 PM, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got conflicts in:
> 
>drivers/iommu/amd_iommu.c
>drivers/iommu/amd_iommu_init.c
>drivers/iommu/amd_iommu_proto.h
>drivers/iommu/amd_iommu_types.h
> 
> between commits:
> 
>4c232a708be1 ("iommu/amd: Detect pre enabled translation")
>9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump 
> kernel"")
>07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
>daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
> 
> from the iommu tree and commit:
> 
>2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> encryption")
> 
> from the tip tree.
> 
> 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.
> 

Sorry, I was out of the office the past few days.  I checked the
linux-next tree and everything looks good in relation to commit

  2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory encryption")

Thanks,
Tom


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-23 Thread Tom Lendacky
On 8/21/2017 10:50 PM, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got conflicts in:
> 
>drivers/iommu/amd_iommu.c
>drivers/iommu/amd_iommu_init.c
>drivers/iommu/amd_iommu_proto.h
>drivers/iommu/amd_iommu_types.h
> 
> between commits:
> 
>4c232a708be1 ("iommu/amd: Detect pre enabled translation")
>9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump 
> kernel"")
>07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
>daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
> 
> from the iommu tree and commit:
> 
>2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> encryption")
> 
> from the tip tree.
> 
> 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.
> 

Sorry, I was out of the office the past few days.  I checked the
linux-next tree and everything looks good in relation to commit

  2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory encryption")

Thanks,
Tom


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Baoquan He
On 08/22/17 at 06:43pm, Stephen Rothwell wrote:
> Hi Baoquan,
> 
> On Tue, 22 Aug 2017 16:01:28 +0800 Baoquan He  wrote:
> >
> > On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> > > Hi Baoquan,
> > > 
> > > On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:  
> > > >
> > > > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:  
> > > > > from the iommu tree and commit:
> > > > > 
> > > > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > > > encryption")
> > > > 
> > > > Could you tell where the above commit is put? I can have a look.
> > > >   
> > > > > from the tip tree.  
> > > ^
> > > 
> > > The tip tree is
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > >   branch auto-latest  
> > 
> > Thanks, Stephen!
> > 
> > I didn't see the commit 2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to
> > work with memory encryption") in tip/auto-latest branch.
> 
> Its in the copy I fetched this morning (and it has not changed).  the
> auto-latest branch in my tree has commit SHA 87507809e0d7

Later I found it in tip/x86/mm with the git command:
git describe --all --contains [commit-id]



Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Baoquan He
On 08/22/17 at 06:43pm, Stephen Rothwell wrote:
> Hi Baoquan,
> 
> On Tue, 22 Aug 2017 16:01:28 +0800 Baoquan He  wrote:
> >
> > On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> > > Hi Baoquan,
> > > 
> > > On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:  
> > > >
> > > > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:  
> > > > > from the iommu tree and commit:
> > > > > 
> > > > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > > > encryption")
> > > > 
> > > > Could you tell where the above commit is put? I can have a look.
> > > >   
> > > > > from the tip tree.  
> > > ^
> > > 
> > > The tip tree is
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > >   branch auto-latest  
> > 
> > Thanks, Stephen!
> > 
> > I didn't see the commit 2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to
> > work with memory encryption") in tip/auto-latest branch.
> 
> Its in the copy I fetched this morning (and it has not changed).  the
> auto-latest branch in my tree has commit SHA 87507809e0d7

Later I found it in tip/x86/mm with the git command:
git describe --all --contains [commit-id]



Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Stephen Rothwell
Hi Baoquan,

On Tue, 22 Aug 2017 16:01:28 +0800 Baoquan He  wrote:
>
> On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> > Hi Baoquan,
> > 
> > On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:  
> > >
> > > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:  
> > > > from the iommu tree and commit:
> > > > 
> > > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > > encryption")
> > > 
> > > Could you tell where the above commit is put? I can have a look.
> > >   
> > > > from the tip tree.  
> > ^
> > 
> > The tip tree is
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > branch auto-latest  
> 
> Thanks, Stephen!
> 
> I didn't see the commit 2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to
> work with memory encryption") in tip/auto-latest branch.

Its in the copy I fetched this morning (and it has not changed).  the
auto-latest branch in my tree has commit SHA 87507809e0d7

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Stephen Rothwell
Hi Baoquan,

On Tue, 22 Aug 2017 16:01:28 +0800 Baoquan He  wrote:
>
> On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> > Hi Baoquan,
> > 
> > On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:  
> > >
> > > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:  
> > > > from the iommu tree and commit:
> > > > 
> > > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > > encryption")
> > > 
> > > Could you tell where the above commit is put? I can have a look.
> > >   
> > > > from the tip tree.  
> > ^
> > 
> > The tip tree is
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > branch auto-latest  
> 
> Thanks, Stephen!
> 
> I didn't see the commit 2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to
> work with memory encryption") in tip/auto-latest branch.

Its in the copy I fetched this morning (and it has not changed).  the
auto-latest branch in my tree has commit SHA 87507809e0d7

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Baoquan He
Hi Stephen,

On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> Hi Baoquan,
> 
> On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:
> >
> > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> > > from the iommu tree and commit:
> > > 
> > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > encryption")  
> > 
> > Could you tell where the above commit is put? I can have a look.
> > 
> > > from the tip tree.
> ^
> 
> The tip tree is
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>   branch auto-latest

Thanks a lot!

I have commit 2543a786aa25, not sure which branch it's put in. I tried
to apply it to the current tip/auto-latest, and saw the conflicts. I
think your change is correct. Maybe Joerg can also help have a look.

Thanks
Baoquan


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Baoquan He
Hi Stephen,

On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> Hi Baoquan,
> 
> On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:
> >
> > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> > > from the iommu tree and commit:
> > > 
> > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > encryption")  
> > 
> > Could you tell where the above commit is put? I can have a look.
> > 
> > > from the tip tree.
> ^
> 
> The tip tree is
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>   branch auto-latest

Thanks a lot!

I have commit 2543a786aa25, not sure which branch it's put in. I tried
to apply it to the current tip/auto-latest, and saw the conflicts. I
think your change is correct. Maybe Joerg can also help have a look.

Thanks
Baoquan


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Baoquan He
On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> Hi Baoquan,
> 
> On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:
> >
> > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> > > from the iommu tree and commit:
> > > 
> > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > encryption")  
> > 
> > Could you tell where the above commit is put? I can have a look.
> > 
> > > from the tip tree.
> ^
> 
> The tip tree is
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>   branch auto-latest

Thanks, Stephen!

I didn't see the commit 2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to
work with memory encryption") in tip/auto-latest branch.



Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Baoquan He
On 08/22/17 at 05:49pm, Stephen Rothwell wrote:
> Hi Baoquan,
> 
> On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:
> >
> > On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> > > from the iommu tree and commit:
> > > 
> > >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > > encryption")  
> > 
> > Could you tell where the above commit is put? I can have a look.
> > 
> > > from the tip tree.
> ^
> 
> The tip tree is
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>   branch auto-latest

Thanks, Stephen!

I didn't see the commit 2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to
work with memory encryption") in tip/auto-latest branch.



Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Stephen Rothwell
Hi Baoquan,

On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:
>
> On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> > from the iommu tree and commit:
> > 
> >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > encryption")  
> 
> Could you tell where the above commit is put? I can have a look.
> 
> > from the tip tree.
^

The tip tree is

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
branch auto-latest

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-22 Thread Stephen Rothwell
Hi Baoquan,

On Tue, 22 Aug 2017 13:57:58 +0800 Baoquan He  wrote:
>
> On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> > from the iommu tree and commit:
> > 
> >   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> > encryption")  
> 
> Could you tell where the above commit is put? I can have a look.
> 
> > from the tip tree.
^

The tip tree is

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
branch auto-latest

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-21 Thread Baoquan He
Hi Stephen,

On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got conflicts in:
> 
>   drivers/iommu/amd_iommu.c
>   drivers/iommu/amd_iommu_init.c
>   drivers/iommu/amd_iommu_proto.h
>   drivers/iommu/amd_iommu_types.h
> 
> between commits:
> 
>   4c232a708be1 ("iommu/amd: Detect pre enabled translation")
>   9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"")
>   07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
>   daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
> 
> from the iommu tree and commit:
> 
>   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> encryption")

Could you tell where the above commit is put? I can have a look.

Thanks
Baoquan

> 
> from the tip tree.
> 
> 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/iommu/amd_iommu.c
> index 31bce367866c,4ad7e5e31943..
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@@ -1476,10 -1538,10 +1478,10 @@@ static int iommu_map_page(struct protec
>   return -EBUSY;
>   
>   if (count > 1) {
> - __pte = PAGE_SIZE_PTE(phys_addr, page_size);
> + __pte = PAGE_SIZE_PTE(__sme_set(phys_addr), page_size);
>  -__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC;
>  +__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   } else
> - __pte = phys_addr | IOMMU_PTE_PR | IOMMU_PTE_FC;
>  -__pte = __sme_set(phys_addr) | IOMMU_PTE_P | IOMMU_PTE_FC;
> ++__pte = __sme_set(phys_addr) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   
>   if (prot & IOMMU_PROT_IR)
>   __pte |= IOMMU_PTE_IR;
> diff --cc drivers/iommu/amd_iommu_init.c
> index ff8887ac,2292a6cece76..
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@@ -29,6 -29,8 +29,7 @@@
>   #include 
>   #include 
>   #include 
>  -#include 
> + #include 
>   #include 
>   #include 
>   #include 
> diff --cc drivers/iommu/amd_iommu_proto.h
> index 90e62e9b01c5,3f12fb2338ea..
> --- a/drivers/iommu/amd_iommu_proto.h
> +++ b/drivers/iommu/amd_iommu_proto.h
> @@@ -87,6 -87,14 +87,16 @@@ static inline bool iommu_feature(struc
>   return !!(iommu->features & f);
>   }
>   
> + static inline u64 iommu_virt_to_phys(void *vaddr)
> + {
> + return (u64)__sme_set(virt_to_phys(vaddr));
> + }
> + 
> + static inline void *iommu_phys_to_virt(unsigned long paddr)
> + {
> + return phys_to_virt(__sme_clr(paddr));
> + }
> + 
>  +extern bool translation_pre_enabled(struct amd_iommu *iommu);
>  +extern struct iommu_dev_data *get_dev_data(struct device *dev);
>   #endif /* _ASM_X86_AMD_IOMMU_PROTO_H  */
> diff --cc drivers/iommu/amd_iommu_types.h
> index 5f775fef341c,8591f43c467c..
> --- a/drivers/iommu/amd_iommu_types.h
> +++ b/drivers/iommu/amd_iommu_types.h
> @@@ -361,8 -343,8 +361,8 @@@
>   #define GCR3_VALID  0x01ULL
>   
>   #define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
>  -#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
>  +#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
> - #define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
> + #define IOMMU_PTE_PAGE(pte) (iommu_phys_to_virt((pte) & IOMMU_PAGE_MASK))
>   #define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
>   
>   #define IOMMU_PROT_MASK 0x03


Re: linux-next: manual merge of the tip tree with the iommu tree

2017-08-21 Thread Baoquan He
Hi Stephen,

On 08/22/17 at 01:50pm, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got conflicts in:
> 
>   drivers/iommu/amd_iommu.c
>   drivers/iommu/amd_iommu_init.c
>   drivers/iommu/amd_iommu_proto.h
>   drivers/iommu/amd_iommu_types.h
> 
> between commits:
> 
>   4c232a708be1 ("iommu/amd: Detect pre enabled translation")
>   9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"")
>   07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
>   daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
> 
> from the iommu tree and commit:
> 
>   2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory 
> encryption")

Could you tell where the above commit is put? I can have a look.

Thanks
Baoquan

> 
> from the tip tree.
> 
> 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/iommu/amd_iommu.c
> index 31bce367866c,4ad7e5e31943..
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@@ -1476,10 -1538,10 +1478,10 @@@ static int iommu_map_page(struct protec
>   return -EBUSY;
>   
>   if (count > 1) {
> - __pte = PAGE_SIZE_PTE(phys_addr, page_size);
> + __pte = PAGE_SIZE_PTE(__sme_set(phys_addr), page_size);
>  -__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC;
>  +__pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   } else
> - __pte = phys_addr | IOMMU_PTE_PR | IOMMU_PTE_FC;
>  -__pte = __sme_set(phys_addr) | IOMMU_PTE_P | IOMMU_PTE_FC;
> ++__pte = __sme_set(phys_addr) | IOMMU_PTE_PR | IOMMU_PTE_FC;
>   
>   if (prot & IOMMU_PROT_IR)
>   __pte |= IOMMU_PTE_IR;
> diff --cc drivers/iommu/amd_iommu_init.c
> index ff8887ac,2292a6cece76..
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@@ -29,6 -29,8 +29,7 @@@
>   #include 
>   #include 
>   #include 
>  -#include 
> + #include 
>   #include 
>   #include 
>   #include 
> diff --cc drivers/iommu/amd_iommu_proto.h
> index 90e62e9b01c5,3f12fb2338ea..
> --- a/drivers/iommu/amd_iommu_proto.h
> +++ b/drivers/iommu/amd_iommu_proto.h
> @@@ -87,6 -87,14 +87,16 @@@ static inline bool iommu_feature(struc
>   return !!(iommu->features & f);
>   }
>   
> + static inline u64 iommu_virt_to_phys(void *vaddr)
> + {
> + return (u64)__sme_set(virt_to_phys(vaddr));
> + }
> + 
> + static inline void *iommu_phys_to_virt(unsigned long paddr)
> + {
> + return phys_to_virt(__sme_clr(paddr));
> + }
> + 
>  +extern bool translation_pre_enabled(struct amd_iommu *iommu);
>  +extern struct iommu_dev_data *get_dev_data(struct device *dev);
>   #endif /* _ASM_X86_AMD_IOMMU_PROTO_H  */
> diff --cc drivers/iommu/amd_iommu_types.h
> index 5f775fef341c,8591f43c467c..
> --- a/drivers/iommu/amd_iommu_types.h
> +++ b/drivers/iommu/amd_iommu_types.h
> @@@ -361,8 -343,8 +361,8 @@@
>   #define GCR3_VALID  0x01ULL
>   
>   #define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
>  -#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
>  +#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
> - #define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
> + #define IOMMU_PTE_PAGE(pte) (iommu_phys_to_virt((pte) & IOMMU_PAGE_MASK))
>   #define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
>   
>   #define IOMMU_PROT_MASK 0x03


linux-next: manual merge of the tip tree with the iommu tree

2017-08-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got conflicts in:

  drivers/iommu/amd_iommu.c
  drivers/iommu/amd_iommu_init.c
  drivers/iommu/amd_iommu_proto.h
  drivers/iommu/amd_iommu_types.h

between commits:

  4c232a708be1 ("iommu/amd: Detect pre enabled translation")
  9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"")
  07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
  daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")

from the iommu tree and commit:

  2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory encryption")

from the tip tree.

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.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/iommu/amd_iommu.c
index 31bce367866c,4ad7e5e31943..
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@@ -1476,10 -1538,10 +1478,10 @@@ static int iommu_map_page(struct protec
return -EBUSY;
  
if (count > 1) {
-   __pte = PAGE_SIZE_PTE(phys_addr, page_size);
+   __pte = PAGE_SIZE_PTE(__sme_set(phys_addr), page_size);
 -  __pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC;
 +  __pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_PR | IOMMU_PTE_FC;
} else
-   __pte = phys_addr | IOMMU_PTE_PR | IOMMU_PTE_FC;
 -  __pte = __sme_set(phys_addr) | IOMMU_PTE_P | IOMMU_PTE_FC;
++  __pte = __sme_set(phys_addr) | IOMMU_PTE_PR | IOMMU_PTE_FC;
  
if (prot & IOMMU_PROT_IR)
__pte |= IOMMU_PTE_IR;
diff --cc drivers/iommu/amd_iommu_init.c
index ff8887ac,2292a6cece76..
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@@ -29,6 -29,8 +29,7 @@@
  #include 
  #include 
  #include 
 -#include 
+ #include 
  #include 
  #include 
  #include 
diff --cc drivers/iommu/amd_iommu_proto.h
index 90e62e9b01c5,3f12fb2338ea..
--- a/drivers/iommu/amd_iommu_proto.h
+++ b/drivers/iommu/amd_iommu_proto.h
@@@ -87,6 -87,14 +87,16 @@@ static inline bool iommu_feature(struc
return !!(iommu->features & f);
  }
  
+ static inline u64 iommu_virt_to_phys(void *vaddr)
+ {
+   return (u64)__sme_set(virt_to_phys(vaddr));
+ }
+ 
+ static inline void *iommu_phys_to_virt(unsigned long paddr)
+ {
+   return phys_to_virt(__sme_clr(paddr));
+ }
+ 
 +extern bool translation_pre_enabled(struct amd_iommu *iommu);
 +extern struct iommu_dev_data *get_dev_data(struct device *dev);
  #endif /* _ASM_X86_AMD_IOMMU_PROTO_H  */
diff --cc drivers/iommu/amd_iommu_types.h
index 5f775fef341c,8591f43c467c..
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@@ -361,8 -343,8 +361,8 @@@
  #define GCR3_VALID0x01ULL
  
  #define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
 -#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
 +#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
- #define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
+ #define IOMMU_PTE_PAGE(pte) (iommu_phys_to_virt((pte) & IOMMU_PAGE_MASK))
  #define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
  
  #define IOMMU_PROT_MASK 0x03


linux-next: manual merge of the tip tree with the iommu tree

2017-08-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got conflicts in:

  drivers/iommu/amd_iommu.c
  drivers/iommu/amd_iommu_init.c
  drivers/iommu/amd_iommu_proto.h
  drivers/iommu/amd_iommu_types.h

between commits:

  4c232a708be1 ("iommu/amd: Detect pre enabled translation")
  9494ea90a56d ("Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"")
  07a80a6b5920 ("iommu/amd: Define bit fields for DTE particularly")
  daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")

from the iommu tree and commit:

  2543a786aa25 ("iommu/amd: Allow the AMD IOMMU to work with memory encryption")

from the tip tree.

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.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/iommu/amd_iommu.c
index 31bce367866c,4ad7e5e31943..
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@@ -1476,10 -1538,10 +1478,10 @@@ static int iommu_map_page(struct protec
return -EBUSY;
  
if (count > 1) {
-   __pte = PAGE_SIZE_PTE(phys_addr, page_size);
+   __pte = PAGE_SIZE_PTE(__sme_set(phys_addr), page_size);
 -  __pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC;
 +  __pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_PR | IOMMU_PTE_FC;
} else
-   __pte = phys_addr | IOMMU_PTE_PR | IOMMU_PTE_FC;
 -  __pte = __sme_set(phys_addr) | IOMMU_PTE_P | IOMMU_PTE_FC;
++  __pte = __sme_set(phys_addr) | IOMMU_PTE_PR | IOMMU_PTE_FC;
  
if (prot & IOMMU_PROT_IR)
__pte |= IOMMU_PTE_IR;
diff --cc drivers/iommu/amd_iommu_init.c
index ff8887ac,2292a6cece76..
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@@ -29,6 -29,8 +29,7 @@@
  #include 
  #include 
  #include 
 -#include 
+ #include 
  #include 
  #include 
  #include 
diff --cc drivers/iommu/amd_iommu_proto.h
index 90e62e9b01c5,3f12fb2338ea..
--- a/drivers/iommu/amd_iommu_proto.h
+++ b/drivers/iommu/amd_iommu_proto.h
@@@ -87,6 -87,14 +87,16 @@@ static inline bool iommu_feature(struc
return !!(iommu->features & f);
  }
  
+ static inline u64 iommu_virt_to_phys(void *vaddr)
+ {
+   return (u64)__sme_set(virt_to_phys(vaddr));
+ }
+ 
+ static inline void *iommu_phys_to_virt(unsigned long paddr)
+ {
+   return phys_to_virt(__sme_clr(paddr));
+ }
+ 
 +extern bool translation_pre_enabled(struct amd_iommu *iommu);
 +extern struct iommu_dev_data *get_dev_data(struct device *dev);
  #endif /* _ASM_X86_AMD_IOMMU_PROTO_H  */
diff --cc drivers/iommu/amd_iommu_types.h
index 5f775fef341c,8591f43c467c..
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@@ -361,8 -343,8 +361,8 @@@
  #define GCR3_VALID0x01ULL
  
  #define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
 -#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
 +#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_PR)
- #define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
+ #define IOMMU_PTE_PAGE(pte) (iommu_phys_to_virt((pte) & IOMMU_PAGE_MASK))
  #define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
  
  #define IOMMU_PROT_MASK 0x03


linux-next: manual merge of the tip tree with the iommu tree

2015-06-09 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in
drivers/iommu/dmar.c between commit bc2272dcecae ("iommu/vt-d: Clean up
log messages in intel-iommu.c") from the  tree and commit 34742db8eaf9
("iommu/vt-d: Refine the interfaces to create IRQ for DMAR unit") from
the tip tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/iommu/dmar.c
index a2f50c5f4a2f,536f2d8ea41a..
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@@ -1642,26 -1642,17 +1642,17 @@@ int dmar_set_interrupt(struct intel_iom
if (iommu->irq)
return 0;
  
-   irq = dmar_alloc_hwirq();
-   if (irq <= 0) {
+   irq = dmar_alloc_hwirq(iommu->seq_id, iommu->node, iommu);
+   if (irq > 0) {
+   iommu->irq = irq;
+   } else {
 -  pr_err("IOMMU: no free vectors\n");
 +  pr_err("No free irq vectors\n");
return -EINVAL;
}
  
-   irq_set_handler_data(irq, iommu);
-   iommu->irq = irq;
- 
-   ret = arch_setup_dmar_msi(irq);
-   if (ret) {
-   irq_set_handler_data(irq, NULL);
-   iommu->irq = 0;
-   dmar_free_hwirq(irq);
-   return ret;
-   }
- 
ret = request_irq(irq, dmar_fault, IRQF_NO_THREAD, iommu->name, iommu);
if (ret)
 -  pr_err("IOMMU: can't request irq\n");
 +  pr_err("Can't request irq\n");
return ret;
  }
  


pgp6Z2rD5xqFk.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the tip tree with the iommu tree

2015-06-09 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in
drivers/iommu/intel_irq_remapping.c between commits 82a09c904f6a
("iommu/vt-d: Load old data structures only in kdump kernel") and
b1e27c302979 ("iommu/vt-d: Move EIM detection to
intel_prepare_irq_remapping") from the iommu tree and commits
b106ee63abcc ("irq_remapping/vt-d: Enhance Intel IR driver to support
hierarchical irqdomains") and 84bea5cc7709 ("x86/irq: Remove
x86_io_apic_ops.print_entries and related interfaces") from the tip
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/iommu/intel_irq_remapping.c
index b49aa8cf9d13,8fad71cc27e7..
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@@ -11,7 -8,7 +11,8 @@@
  #include 
  #include 
  #include 
 +#include 
+ #include 
  #include 
  #include 
  #include 
@@@ -118,9 -98,8 +105,8 @@@ static int alloc_irte(struct intel_iomm
index = bitmap_find_free_region(table->bitmap,
INTR_REMAP_TABLE_ENTRIES, mask);
if (index < 0) {
 -  pr_warn("IR%d: can't allocate an IRTE\n", iommu->seq_id);
 +  pr_warn("Can't allocate an IRTE for IR[%d]\n", iommu->seq_id);
} else {
-   cfg->remapped = 1;
irq_iommu->iommu = iommu;
irq_iommu->irte_index =  index;
irq_iommu->sub_handle = 0;
@@@ -502,10 -413,9 +427,9 @@@ static int intel_setup_irq_remapping(st
  
pages = alloc_pages_node(iommu->node, GFP_KERNEL | __GFP_ZERO,
 INTR_REMAP_PAGE_ORDER);
- 
if (!pages) {
 -  pr_err("IR%d: failed to allocate pages of order %d\n",
 - iommu->seq_id, INTR_REMAP_PAGE_ORDER);
 +  pr_err("Failed to allocate pages of order %d for IR[%d]\n",
 + INTR_REMAP_PAGE_ORDER, iommu->seq_id);
goto out_free_table;
}
  
@@@ -519,41 -439,10 +453,43 @@@
ir_table->base = page_address(pages);
ir_table->bitmap = bitmap;
iommu->ir_table = ir_table;
 +
 +  if (!iommu->qi) {
 +  /*
 +   * Clear previous faults.
 +   */
 +  dmar_fault(-1, iommu);
 +  dmar_disable_qi(iommu);
 +  if (dmar_enable_qi(iommu)) {
 +  pr_err("Failed to enable queued invalidation\n");
 +  goto out_free_pages;
 +  }
 +  }
 +
 +  iommu_check_pre_ir_status(iommu);
 +
 +  if (!is_kdump_kernel() && iommu->pre_enabled_ir) {
 +  iommu_disable_irq_remapping(iommu);
 +  iommu->pre_enabled_ir = 0;
 +  pr_warn("IRQ remapping was enabled on %s but we are not in 
kdump mode\n",
 +  iommu->name);
 +  }
 +
 +  if (iommu->pre_enabled_ir) {
 +  if (iommu_load_old_irte(iommu))
 +  pr_err("Failed to copy IR table for %s from previous 
kernel\n",
 + iommu->name);
 +  else
 +  pr_info("Copied IR table for %s from previous kernel\n",
 +  iommu->name);
 +  }
 +
 +  iommu_set_irq_remapping(iommu, eim_mode);
 +
return 0;
  
+ out_free_bitmap:
+   kfree(bitmap);
  out_free_pages:
__free_pages(pages, INTR_REMAP_PAGE_ORDER);
  out_free_table:
@@@ -709,16 -646,9 +653,9 @@@ static int __init intel_enable_irq_rema
  
irq_remapping_enabled = 1;
  
-   /*
-* VT-d has a different layout for IO-APIC entries when
-* interrupt remapping is enabled. So it needs a special routine
-* to print IO-APIC entries for debugging purposes too.
-*/
-   x86_io_apic_ops.print_entries = intel_ir_io_apic_print_entries;
- 
-   pr_info("Enabled IRQ remapping in %s mode\n", eim_mode ? "x2apic" : 
"xapic");
+   pr_info("Enabled IRQ remapping in %s mode\n", eim ? "x2apic" : "xapic");
  
 -  return eim ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
 +  return eim_mode ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
  
  error:
intel_cleanup_irq_remapping();


pgpYwTAeLE43j.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the tip tree with the iommu tree

2015-06-09 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in
drivers/iommu/intel_irq_remapping.c between commits 82a09c904f6a
(iommu/vt-d: Load old data structures only in kdump kernel) and
b1e27c302979 (iommu/vt-d: Move EIM detection to
intel_prepare_irq_remapping) from the iommu tree and commits
b106ee63abcc (irq_remapping/vt-d: Enhance Intel IR driver to support
hierarchical irqdomains) and 84bea5cc7709 (x86/irq: Remove
x86_io_apic_ops.print_entries and related interfaces) from the tip
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/iommu/intel_irq_remapping.c
index b49aa8cf9d13,8fad71cc27e7..
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@@ -11,7 -8,7 +11,8 @@@
  #include linux/irq.h
  #include linux/intel-iommu.h
  #include linux/acpi.h
 +#include linux/crash_dump.h
+ #include linux/irqdomain.h
  #include asm/io_apic.h
  #include asm/smp.h
  #include asm/cpu.h
@@@ -118,9 -98,8 +105,8 @@@ static int alloc_irte(struct intel_iomm
index = bitmap_find_free_region(table-bitmap,
INTR_REMAP_TABLE_ENTRIES, mask);
if (index  0) {
 -  pr_warn(IR%d: can't allocate an IRTE\n, iommu-seq_id);
 +  pr_warn(Can't allocate an IRTE for IR[%d]\n, iommu-seq_id);
} else {
-   cfg-remapped = 1;
irq_iommu-iommu = iommu;
irq_iommu-irte_index =  index;
irq_iommu-sub_handle = 0;
@@@ -502,10 -413,9 +427,9 @@@ static int intel_setup_irq_remapping(st
  
pages = alloc_pages_node(iommu-node, GFP_KERNEL | __GFP_ZERO,
 INTR_REMAP_PAGE_ORDER);
- 
if (!pages) {
 -  pr_err(IR%d: failed to allocate pages of order %d\n,
 - iommu-seq_id, INTR_REMAP_PAGE_ORDER);
 +  pr_err(Failed to allocate pages of order %d for IR[%d]\n,
 + INTR_REMAP_PAGE_ORDER, iommu-seq_id);
goto out_free_table;
}
  
@@@ -519,41 -439,10 +453,43 @@@
ir_table-base = page_address(pages);
ir_table-bitmap = bitmap;
iommu-ir_table = ir_table;
 +
 +  if (!iommu-qi) {
 +  /*
 +   * Clear previous faults.
 +   */
 +  dmar_fault(-1, iommu);
 +  dmar_disable_qi(iommu);
 +  if (dmar_enable_qi(iommu)) {
 +  pr_err(Failed to enable queued invalidation\n);
 +  goto out_free_pages;
 +  }
 +  }
 +
 +  iommu_check_pre_ir_status(iommu);
 +
 +  if (!is_kdump_kernel()  iommu-pre_enabled_ir) {
 +  iommu_disable_irq_remapping(iommu);
 +  iommu-pre_enabled_ir = 0;
 +  pr_warn(IRQ remapping was enabled on %s but we are not in 
kdump mode\n,
 +  iommu-name);
 +  }
 +
 +  if (iommu-pre_enabled_ir) {
 +  if (iommu_load_old_irte(iommu))
 +  pr_err(Failed to copy IR table for %s from previous 
kernel\n,
 + iommu-name);
 +  else
 +  pr_info(Copied IR table for %s from previous kernel\n,
 +  iommu-name);
 +  }
 +
 +  iommu_set_irq_remapping(iommu, eim_mode);
 +
return 0;
  
+ out_free_bitmap:
+   kfree(bitmap);
  out_free_pages:
__free_pages(pages, INTR_REMAP_PAGE_ORDER);
  out_free_table:
@@@ -709,16 -646,9 +653,9 @@@ static int __init intel_enable_irq_rema
  
irq_remapping_enabled = 1;
  
-   /*
-* VT-d has a different layout for IO-APIC entries when
-* interrupt remapping is enabled. So it needs a special routine
-* to print IO-APIC entries for debugging purposes too.
-*/
-   x86_io_apic_ops.print_entries = intel_ir_io_apic_print_entries;
- 
-   pr_info(Enabled IRQ remapping in %s mode\n, eim_mode ? x2apic : 
xapic);
+   pr_info(Enabled IRQ remapping in %s mode\n, eim ? x2apic : xapic);
  
 -  return eim ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
 +  return eim_mode ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
  
  error:
intel_cleanup_irq_remapping();


pgpYwTAeLE43j.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the tip tree with the iommu tree

2015-06-09 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in
drivers/iommu/dmar.c between commit bc2272dcecae (iommu/vt-d: Clean up
log messages in intel-iommu.c) from the  tree and commit 34742db8eaf9
(iommu/vt-d: Refine the interfaces to create IRQ for DMAR unit) from
the tip tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/iommu/dmar.c
index a2f50c5f4a2f,536f2d8ea41a..
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@@ -1642,26 -1642,17 +1642,17 @@@ int dmar_set_interrupt(struct intel_iom
if (iommu-irq)
return 0;
  
-   irq = dmar_alloc_hwirq();
-   if (irq = 0) {
+   irq = dmar_alloc_hwirq(iommu-seq_id, iommu-node, iommu);
+   if (irq  0) {
+   iommu-irq = irq;
+   } else {
 -  pr_err(IOMMU: no free vectors\n);
 +  pr_err(No free irq vectors\n);
return -EINVAL;
}
  
-   irq_set_handler_data(irq, iommu);
-   iommu-irq = irq;
- 
-   ret = arch_setup_dmar_msi(irq);
-   if (ret) {
-   irq_set_handler_data(irq, NULL);
-   iommu-irq = 0;
-   dmar_free_hwirq(irq);
-   return ret;
-   }
- 
ret = request_irq(irq, dmar_fault, IRQF_NO_THREAD, iommu-name, iommu);
if (ret)
 -  pr_err(IOMMU: can't request irq\n);
 +  pr_err(Can't request irq\n);
return ret;
  }
  


pgp6Z2rD5xqFk.pgp
Description: OpenPGP digital signature


Re: linux-next: manual merge of the tip tree with the iommu tree

2015-06-05 Thread Joerg Roedel
Hi Michael,

On Fri, Jun 05, 2015 at 06:50:30PM +1000, Michael Ellerman wrote:
> diff --cc include/linux/intel-iommu.h
> index a81ceeeaa3d1,0af9b03e2b1c..
> --- a/include/linux/intel-iommu.h
> +++ b/include/linux/intel-iommu.h
> @@@ -355,9 -349,8 +357,11 @@@ struct intel_iommu 
>   
>   #ifdef CONFIG_IRQ_REMAP
>   struct ir_table *ir_table;  /* Interrupt remapping info */
> + struct irq_domain *ir_domain;
> + struct irq_domain *ir_msi_domain;
>  +
>  +/* whether interrupt remapping is enabled prior to OS*/
>  +u8  pre_enabled_ir;
>   #endif
>   struct device   *iommu_dev; /* IOMMU-sysfs device */
>   int node;

This solution looks correct, thanks for fixing.


Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the tip tree with the iommu tree

2015-06-05 Thread Joerg Roedel
Hi Michael,

On Fri, Jun 05, 2015 at 06:50:30PM +1000, Michael Ellerman wrote:
 diff --cc include/linux/intel-iommu.h
 index a81ceeeaa3d1,0af9b03e2b1c..
 --- a/include/linux/intel-iommu.h
 +++ b/include/linux/intel-iommu.h
 @@@ -355,9 -349,8 +357,11 @@@ struct intel_iommu 
   
   #ifdef CONFIG_IRQ_REMAP
   struct ir_table *ir_table;  /* Interrupt remapping info */
 + struct irq_domain *ir_domain;
 + struct irq_domain *ir_msi_domain;
  +
  +/* whether interrupt remapping is enabled prior to OS*/
  +u8  pre_enabled_ir;
   #endif
   struct device   *iommu_dev; /* IOMMU-sysfs device */
   int node;

This solution looks correct, thanks for fixing.


Joerg

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/