[PATCH v3 0/2] iommu: fix the failure of deferred attach for iommu attach device

2021-01-26 Thread Lianbo Jiang
d change its name to iommu_deferred_attach() [3] remove the "extern" from the definition of iommu_deferred_attach() in include/linux/iommu.h Lianbo Jiang (2): dma-iommu: use static-key to minimize the impact in the fast-path iommu: use the __iommu_attach_device() directly for defer

[PATCH v3 1/2] dma-iommu: use static-key to minimize the impact in the fast-path

2021-01-26 Thread Lianbo Jiang
Let's move out the is_kdump_kernel() check from iommu_dma_deferred_attach() to iommu_dma_init(), and use the static-key in the fast-path to minimize the impact in the normal case. Signed-off-by: Lianbo Jiang Co-developed-by: Robin Murphy Signed-off-by: Robin Murphy --- drivers/iomm

[PATCH v3 2/2] iommu: use the __iommu_attach_device() directly for deferred attach

2021-01-26 Thread Lianbo Jiang
interface iommu_attach_device() is not suitable for handling this situation. Signed-off-by: Lianbo Jiang --- drivers/iommu/dma-iommu.c | 18 +++--- drivers/iommu/iommu.c | 10 ++ include/linux/iommu.h | 1 + 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dri

[PATCH] iommu: check for the deferred attach when attaching a device

2020-12-25 Thread Lianbo Jiang
s the bnxt_en driver. That can be reproduced easily in kdump kernel when SME is active. Add a check for the deferred attach in the iommu_attach_device() and allow to attach the deferred device regardless of how many devices are in a group. Signed-off-by: Lianbo Jiang --- drivers/iommu/iommu.

[PATCH 0/2 v2] iommu: fix the failure of deferred attach for iommu attach device

2021-01-19 Thread Lianbo Jiang
static-key to minimize the impact in the fast-path Lianbo Jiang (2): dma-iommu: use static-key to minimize the impact in the fast-path iommu: use the __iommu_attach_device() directly for deferred attach drivers/iommu/dma-iommu.c | 29 +++-- drivers/iommu/iommu.c

[PATCH 1/2 v2] dma-iommu: use static-key to minimize the impact in the fast-path

2021-01-19 Thread Lianbo Jiang
Let's move out the is_kdump_kernel() check from iommu_dma_deferred_attach() to iommu_dma_init(), and use the static-key in the fast-path to minimize the impact in the normal case. Signed-off-by: Lianbo Jiang Co-developed-by: Robin Murphy Signed-off-by: Robin Murphy --- drivers/iomm

[PATCH 2/2 v2] iommu: use the __iommu_attach_device() directly for deferred attach

2021-01-19 Thread Lianbo Jiang
interface iommu_attach_device() is not suitable for handling this situation. Signed-off-by: Lianbo Jiang --- drivers/iommu/dma-iommu.c | 18 +++--- drivers/iommu/iommu.c | 12 include/linux/iommu.h | 2 ++ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git

[PATCH 1/4 V3] Add a function(ioremap_encrypted) for kdump when AMD sme enabled

2018-06-16 Thread Lianbo Jiang
It is convenient to remap the old memory encrypted to the second kernel by calling ioremap_encrypted(). Signed-off-by: Lianbo Jiang --- Some changes: 1. remove the sme_active() check in __ioremap_caller(). 2. put some logic into the early_memremap_pgprot_adjust() for early memremap. arch/x86

[PATCH 0/4 V3] Support kdump for AMD secure memory encryption(SME)

2018-06-16 Thread Lianbo Jiang
tools: makedumpfile[v1.6.3]: https://github.com/LianboJ/makedumpfile commit e1de103eca8f (A draft for kdump vmcore about AMD SME) Author: Lianbo Jiang Date: Mon May 14 17:02:40 2018 +0800 Note: This patch can only dump vmcore in the case of SME enabled. crash-7.2.1: https://github.com/crash

[PATCH 2/4 V3] Allocate pages for kdump without encryption when SME is enabled

2018-06-16 Thread Lianbo Jiang
When SME is enabled in the first kernel, we will allocate pages for kdump without encryption in order to be able to boot the second kernel in the same manner as kexec, which helps to keep the same code style. Signed-off-by: Lianbo Jiang --- kernel/kexec_core.c | 12 1 file changed

[PATCH 3/4 V3] Remap the device table of IOMMU in encrypted manner for kdump

2018-06-16 Thread Lianbo Jiang
In kdump mode, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in the first kernel. So we must remap it in encrypted manner in order to be automatically decrypted when we read. Signed-off-by: Lianbo Jiang --- Some changes: 1. add some

[PATCH 4/4 V3] Help to dump the old memory encrypted into vmcore file

2018-06-16 Thread Lianbo Jiang
In kdump mode, we need to dump the old memory into vmcore file, if SME is enabled in the first kernel, we must remap the old memory in encrypted manner, which will be automatically decrypted when we read from DRAM. It helps to parse the vmcore for some tools. Signed-off-by: Lianbo Jiang --- Some

[PATCH 0/5 V4] Support kdump for AMD secure memory encryption(SME)

2018-06-28 Thread Lianbo Jiang
ub.com/LianboJ/makedumpfile commit e1de103eca8f (A draft for kdump vmcore about AMD SME) Author: Lianbo Jiang Date: Mon May 14 17:02:40 2018 +0800 Note: This patch can only dump vmcore in the case of SME enabled. crash-7.2.1: https://github.com/crash-utility/crash.git commit 1e1bd9c4c1be (Fix f

[PATCH 1/5 V4] Add a function(ioremap_encrypted) for kdump when AMD sme enabled

2018-06-28 Thread Lianbo Jiang
It is convenient to remap the old memory encrypted to the second kernel by calling ioremap_encrypted(). Signed-off-by: Lianbo Jiang --- Some changes: 1. remove the sme_active() check in __ioremap_caller(). 2. revert some logic in the early_memremap_pgprot_adjust() for early memremap and make it

[PATCH 2/5 V4] Allocate pages for kdump without encryption when SME is enabled

2018-06-28 Thread Lianbo Jiang
When SME is enabled in the first kernel, we will allocate pages for kdump without encryption in order to be able to boot the second kernel in the same manner as kexec, which helps to keep the same code style. Signed-off-by: Lianbo Jiang --- Some changes: 1. remove some redundant codes for crash

[PATCH 3/5 V4] Remap the device table of IOMMU in encrypted manner for kdump

2018-06-28 Thread Lianbo Jiang
In kdump mode, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in the first kernel. So we must remap it in encrypted manner in order to be automatically decrypted when we read. Signed-off-by: Lianbo Jiang --- Some changes: 1. add some

[PATCH 4/5 V4] Adjust some permanent mappings in unencrypted ways for kdump when SME is enabled.

2018-06-28 Thread Lianbo Jiang
early_memremap_pgprot_adjust(), which will have an opportunity to adjust it. Signed-off-by: Lianbo Jiang --- arch/x86/mm/ioremap.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index e01e6c6..3c1c8c4 100644 --- a/arch/x86/mm

[PATCH 5/5 V4] Help to dump the old memory encrypted into vmcore file

2018-06-28 Thread Lianbo Jiang
In kdump mode, we need to dump the old memory into vmcore file, if SME is enabled in the first kernel, we must remap the old memory in encrypted manner, which will be automatically decrypted when we read from DRAM. It helps to parse the vmcore for some tools. Signed-off-by: Lianbo Jiang --- Some

[PATCH 0/5 V5] Support kdump for AMD secure memory encryption(SME)

2018-07-02 Thread Lianbo Jiang
github.com/LianboJ/makedumpfile commit e1de103eca8f (A draft for kdump vmcore about AMD SME) Author: Lianbo Jiang Date: Mon May 14 17:02:40 2018 +0800 Note: This patch can only dump vmcore in the case of SME enabled. crash-7.2.1: https://github.com/crash-utility/crash.git commit 1e1bd9c4c1be (Fix f

[PATCH 1/5 V5] Add a function(ioremap_encrypted) for kdump when AMD sme enabled

2018-07-02 Thread Lianbo Jiang
It is convenient to remap the old memory encrypted to the second kernel by calling ioremap_encrypted(). Signed-off-by: Lianbo Jiang --- Some changes: 1. remove the sme_active() check in __ioremap_caller(). 2. revert some logic in the early_memremap_pgprot_adjust() for early memremap and make it

[PATCH 2/5 V5] Allocate pages for kdump without encryption when SME is enabled

2018-07-02 Thread Lianbo Jiang
When SME is enabled in the first kernel, we will allocate pages for kdump without encryption in order to be able to boot the second kernel in the same manner as kexec, which helps to keep the same code style. Signed-off-by: Lianbo Jiang --- Some changes: 1. remove some redundant codes for crash

[PATCH 3/5 V5] Remap the device table of IOMMU in encrypted manner for kdump

2018-07-02 Thread Lianbo Jiang
In kdump mode, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in the first kernel. So we must remap it in encrypted manner in order to be automatically decrypted when we read. Signed-off-by: Lianbo Jiang --- Some changes: 1. add some

[PATCH 4/5 V5] Adjust some permanent mappings in unencrypted ways for kdump when SME is enabled.

2018-07-02 Thread Lianbo Jiang
early_memremap_pgprot_adjust(), which will have an opportunity to adjust it. Signed-off-by: Lianbo Jiang --- arch/x86/mm/ioremap.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index e01e6c6..3c1c8c4 100644 --- a/arch/x86/mm

[PATCH 5/5 V5] Help to dump the old memory encrypted into vmcore file

2018-07-02 Thread Lianbo Jiang
In kdump mode, we need to dump the old memory into vmcore file, if SME is enabled in the first kernel, we must remap the old memory in encrypted manner, which will be automatically decrypted when we read from DRAM. It helps to parse the vmcore for some tools. Signed-off-by: Lianbo Jiang --- Some

[PATCH 0/5 V6] Support kdump for AMD secure memory encryption(SME)

2018-08-31 Thread Lianbo Jiang
369.576988] R10: 0008 R11: 0246 R12: 00000000 [ 369.584177] R13: 55602a075260 R14: 0002 R15: Lianbo Jiang (5): x86/ioremap: add a function ioremap_encrypted() to remap kdump old memroy x86/ioremap: strengthen the logic in early_memr

[PATCH 4/5 V6] iommu/amd_iommu: remap the device table of IOMMU with the memory encryption mask for kdump

2018-08-31 Thread Lianbo Jiang
In kdump kernel, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in the first kernel. So we have to remap the old device table with the memory encryption mask. Signed-off-by: Lianbo Jiang --- drivers/iommu/amd_iommu_init.c | 14

[PATCH 1/5 V6] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memroy

2018-08-31 Thread Lianbo Jiang
When SME is enabled on AMD machine, the memory is encrypted in the first kernel. In this case, SME also needs to be enabled in kdump kernel, and we have to remap the old memory with the memory encryption mask. Signed-off-by: Lianbo Jiang --- arch/x86/include/asm/io.h | 3 +++ arch/x86/mm

[PATCH 2/5 V6] x86/ioremap: strengthen the logic in early_memremap_pgprot_adjust() to adjust encryption mask

2018-08-31 Thread Lianbo Jiang
For kdump kernel, when SME is enabled, the acpi table and dmi table will need to be remapped without the memory encryption mask. So we have to strengthen the logic in early_memremap_pgprot_adjust(), which makes us have an opportunity to adjust the memory encryption mask. Signed-off-by: Lianbo

[PATCH 3/5 V6] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-08-31 Thread Lianbo Jiang
When SME is enabled in the first kernel, we will allocate unencrypted pages for kdump in order to be able to boot the kdump kernel like kexec. Signed-off-by: Lianbo Jiang --- kernel/kexec_core.c | 12 1 file changed, 12 insertions(+) diff --git a/kernel/kexec_core.c b/kernel

[PATCH 5/5 V6] kdump/vmcore: support encrypted old memory with SME enabled

2018-08-31 Thread Lianbo Jiang
der how to pass the SME flag from the first kernel to the kdump kernel, it is really too expensive to do this. This patches are only for SME kdump, the patches don't support SEV kdump. Signed-off-by: Lianbo Jiang --- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/crash

[PATCH 1/4 v7] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memory

2018-09-07 Thread Lianbo Jiang
When SME is enabled on AMD machine, the memory is encrypted in the first kernel. In this case, SME also needs to be enabled in kdump kernel, and we have to remap the old memory with the memory encryption mask. Signed-off-by: Lianbo Jiang --- arch/x86/include/asm/io.h | 3 +++ arch/x86/mm

[PATCH 2/4 v7] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-09-07 Thread Lianbo Jiang
When SME is enabled in the first kernel, we will allocate unencrypted pages for kdump in order to be able to boot the kdump kernel like kexec. Signed-off-by: Lianbo Jiang --- kernel/kexec_core.c | 12 1 file changed, 12 insertions(+) diff --git a/kernel/kexec_core.c b/kernel

[PATCH 0/4 v7] Support kdump for AMD secure memory encryption(SME)

2018-09-07 Thread Lianbo Jiang
onsole in extract_kernel input_data: 0x00087e91c3b4 input_len: 0x0067fcbd output: 0x00087d40 output_len: 0x01b6fa90 kernel_total_size: 0x01a9d000 trampoline_32bit: 0x00099000 Decompressing Linux... Parsing ELF...[---Here the system will hang] L

[PATCH 4/4 v7] kdump/vmcore: support encrypted old memory with SME enabled

2018-09-07 Thread Lianbo Jiang
der how to pass the SME flag from the first kernel to the kdump kernel, it is really too expensive to do this. This patches are only for SME kdump, the patches don't support SEV kdump. Signed-off-by: Lianbo Jiang --- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/crash

[PATCH 3/4 v7] amd_iommu: remap the device table of IOMMU with the memory encryption mask for kdump

2018-09-07 Thread Lianbo Jiang
In kdump kernel, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in the first kernel. So we have to remap the old device table with the memory encryption mask. Signed-off-by: Lianbo Jiang --- drivers/iommu/amd_iommu_init.c | 14