Re: [PATCH/RFC] iommu: Move over to unsigned int domain type

2017-05-17 Thread Magnus Damm
Hi Joerg, On Wed, May 17, 2017 at 10:18 PM, Joerg Roedel wrote: > On Wed, May 17, 2017 at 07:29:12PM +0900, Magnus Damm wrote: >> From: Magnus Damm >> >> Checkpatch dislikes the type unsigned, so update the iommu >> domain type and consumers to use

Re: [PATCH v8 06/08] iommu/ipmmu-vmsa: Use fwspec iommu_priv on ARM64

2017-05-17 Thread Magnus Damm
Hi Robin, On Wed, May 17, 2017 at 11:29 PM, Robin Murphy wrote: > Hi Magnus, > > On 17/05/17 11:07, Magnus Damm wrote: >> From: Magnus Damm >> >> Convert from archdata to iommu_priv via iommu_fwspec on ARM64 but >> let 32-bit ARM keep on using

Re: [PATCH v5 18/32] x86, mpparse: Use memremap to map the mpf and mpc data

2017-05-17 Thread Tom Lendacky
On 5/16/2017 3:36 AM, Borislav Petkov wrote: On Tue, Apr 18, 2017 at 04:19:30PM -0500, Tom Lendacky wrote: The SMP MP-table is built by UEFI and placed in memory in a decrypted state. These tables are accessed using a mix of early_memremap(), early_memunmap(), phys_to_virt() and virt_to_phys().

Re: [PATCH v5 28/32] x86/mm, kexec: Allow kexec to be used with SME

2017-05-17 Thread Borislav Petkov
On Tue, Apr 18, 2017 at 04:21:21PM -0500, Tom Lendacky wrote: > Provide support so that kexec can be used to boot a kernel when SME is > enabled. > > Support is needed to allocate pages for kexec without encryption. This > is needed in order to be able to reboot in the kernel in the same manner

Re: [PATCH v6 1/3] of/pci/dma: fix DMA configuration for PCI masters

2017-05-17 Thread Arnd Bergmann
On Tue, May 16, 2017 at 7:22 AM, Oza Pawandeep wrote: > current device framework and OF framework integration assumes > dma-ranges in a way where memory-mapped devices define their > dma-ranges. (child-bus-address, parent-bus-address, length). > > of_dma_configure is

Re: [PATCH v5 17/32] x86/mm: Add support to access boot related data in the clear

2017-05-17 Thread Tom Lendacky
On 5/15/2017 1:35 PM, Borislav Petkov wrote: On Tue, Apr 18, 2017 at 04:19:21PM -0500, Tom Lendacky wrote: Boot data (such as EFI related data) is not encrypted when the system is booted because UEFI/BIOS does not run with SME active. In order to access this data properly it needs to be mapped

Re: [PATCH v6 2/3] iommu/pci: reserve IOVA for PCI masters

2017-05-17 Thread Bjorn Helgaas
On Tue, May 16, 2017 at 10:52:06AM +0530, Oza Pawandeep wrote: > this patch reserves the IOVA for PCI masters. > ARM64 based SOCs may have scattered memory banks. > such as iproc based SOC has > > <0x 0x8000 0x0 0x8000>, /* 2G @ 2G */ > <0x0008 0x8000 0x3 0x8000>, /*

Re: [PATCH v6 1/3] of/pci/dma: fix DMA configuration for PCI masters

2017-05-17 Thread Bjorn Helgaas
On Tue, May 16, 2017 at 10:52:05AM +0530, Oza Pawandeep wrote: > current device framework and OF framework integration assumes s/current/The current/ > dma-ranges in a way where memory-mapped devices define their > dma-ranges. (child-bus-address, parent-bus-address, length). > >

Re: [PATCH 1/3] iommu: of: Fix check for returning EPROBE_DEFER

2017-05-17 Thread Bjorn Helgaas
On Wed, May 17, 2017 at 05:00:07PM +0530, Sricharan R wrote: > Now with iommu probe deferral, we return -EPROBE_DEFER > for master's that are connected to an iommu which is not s/master's/masters/ s/iommu/IOMMU/ in your English text (changelogs and comments). That seems to be the convention,

Re: [PATCH RESEND] iommu/dma: Don't touch invalid iova_domain members

2017-05-17 Thread Auger Eric
Hi, On 17/05/2017 16:32, Robin Murphy wrote: > On 17/05/17 13:36, Joerg Roedel wrote: >> On Mon, May 15, 2017 at 04:01:30PM +0100, Robin Murphy wrote: >>> When __iommu_dma_map() and iommu_dma_free_iova() are called from >>> iommu_dma_get_msi_page(), various iova_*() helpers are still invoked in

Re: [PATCH RESEND] iommu/dma: Don't touch invalid iova_domain members

2017-05-17 Thread Robin Murphy
On 17/05/17 13:36, Joerg Roedel wrote: > On Mon, May 15, 2017 at 04:01:30PM +0100, Robin Murphy wrote: >> When __iommu_dma_map() and iommu_dma_free_iova() are called from >> iommu_dma_get_msi_page(), various iova_*() helpers are still invoked in >> the process, whcih is unwise since they access a

Re: [PATCH v8 06/08] iommu/ipmmu-vmsa: Use fwspec iommu_priv on ARM64

2017-05-17 Thread Robin Murphy
Hi Magnus, On 17/05/17 11:07, Magnus Damm wrote: > From: Magnus Damm > > Convert from archdata to iommu_priv via iommu_fwspec on ARM64 but > let 32-bit ARM keep on using archdata for now. > > Once the 32-bit ARM code and the IPMMU driver is able to move over > to

Re: [PATCH] iommu/iova: Sort out rbtree limit_pfn handling

2017-05-17 Thread Joerg Roedel
On Tue, May 16, 2017 at 12:26:48PM +0100, Robin Murphy wrote: > When walking the rbtree, the fact that iovad->start_pfn and limit_pfn > are both inclusive limits creates an ambiguity once limit_pfn reaches > the bottom of the address space and they overlap. Commit 5016bdb796b3 > ("iommu/iova: Fix

Re: [PATCH v8 00/08] iommu/ipmmu-vmsa: IPMMU multi-arch update V8

2017-05-17 Thread Joerg Roedel
On Wed, May 17, 2017 at 07:06:16PM +0900, Magnus Damm wrote: > iommu/ipmmu-vmsa: IPMMU multi-arch update V8 > > [PATCH v8 01/08] iommu/ipmmu-vmsa: Remove platform data handling > [PATCH v8 02/08] iommu/ipmmu-vmsa: Rework interrupt code and use bitmap for > context > [PATCH v8 03/08]

Re: [PATCH/RFC] iommu: Move over to unsigned int domain type

2017-05-17 Thread Joerg Roedel
On Wed, May 17, 2017 at 07:29:12PM +0900, Magnus Damm wrote: > From: Magnus Damm > > Checkpatch dislikes the type unsigned, so update the iommu > domain type and consumers to use unsigned int to reduce noise. And I hate stupid checkpatch warnings and refuse to fix

Re: [PATCH 2/2] iommu/vt-d: Helper function to query if a pasid has any active users

2017-05-17 Thread Joerg Roedel
On Wed, May 10, 2017 at 11:39:03AM -0700, Ashok Raj wrote: > From: CQ Tang > > A driver would need to know if there are any active references to a > a PASID before cleaning up its resources. This function helps check > if there are any active users of a PASID before it can

Re: [PATCH] iommu/mediatek: include linux/dma-mapping.h

2017-05-17 Thread Joerg Roedel
On Thu, May 11, 2017 at 01:35:51PM +0200, Arnd Bergmann wrote: > The mediatek iommu driver relied on an implicit include of dma-mapping.h, > but for some reason that is no longer there in 4.12-rc1: > > drivers/iommu/mtk_iommu_v1.c: In function 'mtk_iommu_domain_finalise': >

Re: [PATCH] iommu: intel: Flush the IOTLB to get rid of the initial kdump mappings

2017-05-17 Thread Joerg Roedel
On Fri, May 05, 2017 at 11:39:59AM -0700, KarimAllah Ahmed wrote: > Ever since commit 091d42e43d ("iommu/vt-d: Copy translation tables from > old kernel") Please put the commit-information into a Fixes: tag next time. I'll added a Fixes tag to the commit this time. > the kdump kernel copies the

Re: [PATCH RESEND] iommu/dma: Don't touch invalid iova_domain members

2017-05-17 Thread Joerg Roedel
On Mon, May 15, 2017 at 04:01:30PM +0100, Robin Murphy wrote: > When __iommu_dma_map() and iommu_dma_free_iova() are called from > iommu_dma_get_msi_page(), various iova_*() helpers are still invoked in > the process, whcih is unwise since they access a different member of the > union (the

Re: [PATCH] iommu/rockchip: Enable Rockchip IOMMU on ARM64

2017-05-17 Thread Joerg Roedel
On Wed, May 03, 2017 at 05:19:40PM +0200, Matthias Brugger wrote: > From: Simon Xue > > This patch makes it possible to compile the rockchip-iommu driver on > ARM64, so that it can be used with 64-bit SoCs equipped with this type > of IOMMU. > > Signed-off-by: Simon Xue

Re: [PATCH] ARM: dma-mapping: Don't tear third-party mappings

2017-05-17 Thread sricharan
On 2017-05-17 10:45, Sricharan R wrote: Hi Laurent/Robin, On 5/16/2017 10:14 PM, Laurent Pinchart wrote: Hi Robin, On Tuesday 16 May 2017 16:47:36 Robin Murphy wrote: On 16/05/17 16:14, Laurent Pinchart wrote: arch_setup_dma_ops() is used in device probe code paths to create an IOMMU

[PATCH 3/3] ARM: dma-mapping: Don't tear third-party mappings

2017-05-17 Thread Sricharan R
From: Laurent Pinchart arch_setup_dma_ops() is used in device probe code paths to create an IOMMU mapping and attach it to the device. The function assumes that the device is attached to a device-specific IOMMU instance (or at least a device-specific

[PATCH 2/3] iommu: of: Ignore all errors except EPROBE_DEFER

2017-05-17 Thread Sricharan R
While deferring the probe of iommu masters, xlate and add_device callback can pass back error values like -ENODEV, which means iommu cannot be connected with that master for real reasons. So rather than killing the master's probe for such errors, just ignore the errors and let the master work

[PATCH 1/3] iommu: of: Fix check for returning EPROBE_DEFER

2017-05-17 Thread Sricharan R
Now with iommu probe deferral, we return -EPROBE_DEFER for master's that are connected to an iommu which is not probed yet, but going to get probed, so that we can attach the correct dma_ops. So while trying to defer the probe of the master, check if the of_iommu node that it is connected to is

Re: [PATCH 1/2] acpica: iort: Update SMMU models for IORT rev. C

2017-05-17 Thread Robert Richter
On 12.05.17 11:41:41, Robin Murphy wrote: > IORT revision C has been published with a number of new SMMU > implementation identifiers; define them. > > CC: Rafael J. Wysocki > CC: Robert Moore > CC: Lv Zheng > Signed-off-by: Robin

[PATCH/RFC] iommu: Move over to unsigned int domain type

2017-05-17 Thread Magnus Damm
From: Magnus Damm Checkpatch dislikes the type unsigned, so update the iommu domain type and consumers to use unsigned int to reduce noise. $ ./scripts/checkpatch.pl ../linux-v4.13-pre-drivers-iommu-ipmmu-dma-ops-20170517b.patch WARNING: Prefer 'unsigned int' to

Re: [PATCH V8 07/11] iommu: of: Handle IOMMU lookup failure with deferred probing or error

2017-05-17 Thread Sricharan R
Hi Magnus, >> Magnus, do you have a suggestion? > > Thanks for your efforts guys! > > I've recently been working on up-porting the IPMMU patches and > addressing review comments. Now with my local driver stack on top of > v4.12-rc (a95cfad) I did not notice these issues initially since I >

Re: [PATCH v8 08/08] iommu/ipmmu-vmsa: Fix pgsize_bitmap semicolon typo

2017-05-17 Thread Geert Uytterhoeven
On Wed, May 17, 2017 at 12:07 PM, Magnus Damm wrote: > From: Magnus Damm > > Fix comma-instead-of-semicolon typo error present > in the latest version of the IPMMU driver. > > Signed-off-by: Magnus Damm Reviewed-by:

RE: [v6 2/3] iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum #74

2017-05-17 Thread Shameerali Kolothum Thodi
Hi Geetha, > -Original Message- > From: linux-arm-kernel [mailto:linux-arm-kernel- > boun...@lists.infradead.org] On Behalf Of Geetha sowjanya > Sent: Friday, May 12, 2017 1:41 PM > To: will.dea...@arm.com; robin.mur...@arm.com; > lorenzo.pieral...@arm.com; hanjun@linaro.org;

[PATCH v8 07/08] iommu/ipmmu-vmsa: Drop LPAE Kconfig dependency

2017-05-17 Thread Magnus Damm
From: Magnus Damm Neither the ARM page table code enabled by IOMMU_IO_PGTABLE_LPAE nor the IPMMU_VMSA driver actually depends on ARM_LPAE, so get rid of the dependency. Tested with ipmmu-vmsa on r8a7794 ALT and a kernel config using: # CONFIG_ARM_LPAE is not set

[PATCH v8 08/08] iommu/ipmmu-vmsa: Fix pgsize_bitmap semicolon typo

2017-05-17 Thread Magnus Damm
From: Magnus Damm Fix comma-instead-of-semicolon typo error present in the latest version of the IPMMU driver. Signed-off-by: Magnus Damm --- Earlier posted as: [PATCH] iommu/ipmmu-vmsa: Fix pgsize_bitmap semicolon typo

[PATCH v8 06/08] iommu/ipmmu-vmsa: Use fwspec iommu_priv on ARM64

2017-05-17 Thread Magnus Damm
From: Magnus Damm Convert from archdata to iommu_priv via iommu_fwspec on ARM64 but let 32-bit ARM keep on using archdata for now. Once the 32-bit ARM code and the IPMMU driver is able to move over to CONFIG_IOMMU_DMA=y then coverting to fwspec via ->of_xlate() will

[PATCH v8 04/08] iommu/ipmmu-vmsa: Break out domain allocation code

2017-05-17 Thread Magnus Damm
From: Magnus Damm Break out the domain allocation code into a separate function. This is preparation for future code sharing. Signed-off-by: Magnus Damm Reviewed-by: Joerg Roedel Reviewed-by: Geert Uytterhoeven

[PATCH v8 01/08] iommu/ipmmu-vmsa: Remove platform data handling

2017-05-17 Thread Magnus Damm
From: Magnus Damm The IPMMU driver is using DT these days, and platform data is no longer used by the driver. Remove unused code. Signed-off-by: Magnus Damm Reviewed-by: Laurent Pinchart Reviewed-by:

[PATCH v8 00/08] iommu/ipmmu-vmsa: IPMMU multi-arch update V8

2017-05-17 Thread Magnus Damm
iommu/ipmmu-vmsa: IPMMU multi-arch update V8 [PATCH v8 01/08] iommu/ipmmu-vmsa: Remove platform data handling [PATCH v8 02/08] iommu/ipmmu-vmsa: Rework interrupt code and use bitmap for context [PATCH v8 03/08] iommu/ipmmu-vmsa: Break out utlb parsing code [PATCH v8 04/08] iommu/ipmmu-vmsa:

[PATCH v8 02/08] iommu/ipmmu-vmsa: Rework interrupt code and use bitmap for context

2017-05-17 Thread Magnus Damm
From: Magnus Damm Introduce a bitmap for context handing and convert the interrupt routine to handle all registered contexts. At this point the number of contexts are still limited. Also remove the use of the ARM specific mapping variable from ipmmu_irq() to allow

[PATCH v8 05/08] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops

2017-05-17 Thread Magnus Damm
From: Magnus Damm Introduce an alternative set of iommu_ops suitable for 64-bit ARM as well as 32-bit ARM when CONFIG_IOMMU_DMA=y. Also adjust the Kconfig to depend on ARM or IOMMU_DMA. Initialize the device from ->xlate() when CONFIG_IOMMU_DMA=y. Signed-off-by:

[PATCH v8 03/08] iommu/ipmmu-vmsa: Break out utlb parsing code

2017-05-17 Thread Magnus Damm
From: Magnus Damm Break out the utlb parsing code and dev_data allocation into a separate function. This is preparation for future code sharing. Signed-off-by: Magnus Damm Reviewed-by: Joerg Roedel --- Changes since

Re: [PATCH V8 07/11] iommu: of: Handle IOMMU lookup failure with deferred probing or error

2017-05-17 Thread Magnus Damm
Hi Geert, everyone, On Fri, May 5, 2017 at 10:23 PM, Geert Uytterhoeven wrote: > Hi Sricharan, Robin, > > On Wed, May 3, 2017 at 12:24 PM, Sricharan R wrote: >> On 5/3/2017 3:24 PM, Robin Murphy wrote: >>> On 02/05/17 19:35, Geert Uytterhoeven

Re: [RFC v1 7/7] iommu/arm-smmu-v3: Enable ACPI based HiSilicon erratum 161010801

2017-05-17 Thread John Garry
On 16/05/2017 15:03, Shameerali Kolothum Thodi wrote: > Lorenzo made a point that it might be relatively straightforward to just > follow the IORT mapping for the SMMU through to the ITS MADT entry and > pull the ITS geometry out of that. It would certainly be nicer to have > such a helper

Re: [PATCH v5 06/32] x86/mm: Add Secure Memory Encryption (SME) support

2017-05-17 Thread Borislav Petkov
On Tue, May 16, 2017 at 02:28:42PM -0500, Tom Lendacky wrote: > It's most problematic when CONFIG_AMD_MEM_ENCRYPT is not defined since > we never include an asm/ version from the linux/ path. I could create > a mem_encrypt.h in include/asm-generic/ that contains the info that > is in the