[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 s

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

2018-07-02 Thread Borislav Petkov
On Mon, Jul 02, 2018 at 03:26:35PM +0800, Lianbo Jiang wrote: > @@ -131,7 +132,8 @@ static void __ioremap_check_mem(resource_size_t addr, > unsigned long size, > * caller shouldn't need to know that small detail. > */ > static void __iomem *__ioremap_caller(resource_size_t phys_addr, > -

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

2018-07-02 Thread lijiang
在 2018年07月02日 18:14, Borislav Petkov 写道: > On Mon, Jul 02, 2018 at 03:26:35PM +0800, Lianbo Jiang wrote: >> @@ -131,7 +132,8 @@ static void __ioremap_check_mem(resource_size_t addr, >> unsigned long size, >> * caller shouldn't need to know that small detail. >> */ >> static void __iomem *__io

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

2018-07-03 Thread Borislav Petkov
On Tue, Jul 03, 2018 at 10:17:19AM +0800, lijiang wrote: > for example, the elfcorehdr. In fact, the elfcorehdr and notes You mean this? ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos) { - return read_from_oldmem(buf, count, ppos, 0); + return read_from_oldm

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

2018-07-03 Thread lijiang
在 2018年07月03日 10:17, lijiang 写道: > 在 2018年07月02日 18:14, Borislav Petkov 写道: >> On Mon, Jul 02, 2018 at 03:26:35PM +0800, Lianbo Jiang wrote: >>> @@ -131,7 +132,8 @@ static void __ioremap_check_mem(resource_size_t addr, >>> unsigned long size, >>> * caller shouldn't need to know that small detail

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

2018-07-03 Thread Borislav Petkov
On Tue, Jul 03, 2018 at 06:58:14PM +0800, lijiang wrote: > For kdump, the elf header finally use the crash kernel reserved memory, it is > not an old memory. Lamme repeat my suggestion: So beef up the logic in __ioremap_caller() to figure out based on the address whether to access the memory enc

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

2018-07-03 Thread lijiang
在 2018年07月03日 17:39, Borislav Petkov 写道: > On Tue, Jul 03, 2018 at 10:17:19AM +0800, lijiang wrote: >> for example, the elfcorehdr. In fact, the elfcorehdr and notes > > You mean this? > > ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos) > { > - return read_from_ol

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

2018-07-03 Thread lijiang
在 2018年07月03日 19:14, Borislav Petkov 写道: > On Tue, Jul 03, 2018 at 06:58:14PM +0800, lijiang wrote: >> For kdump, the elf header finally use the crash kernel reserved memory, it >> is not an old memory. > > Lamme repeat my suggestion: > > So beef up the logic in __ioremap_caller() to figure out

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

2018-07-08 Thread lijiang
在 2018年07月03日 19:44, lijiang 写道: > 在 2018年07月03日 19:14, Borislav Petkov 写道: >> On Tue, Jul 03, 2018 at 06:58:14PM +0800, lijiang wrote: >>> For kdump, the elf header finally use the crash kernel reserved memory, it >>> is not an old memory. >> >> Lamme repeat my suggestion: >> >> So beef up the lo

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

2018-07-09 Thread Borislav Petkov
On Mon, Jul 09, 2018 at 02:28:11PM +0800, lijiang wrote: > Last week, I had tried many ways to do this work, but it looks > like that the ways of deducing address is not suitable to another > scenarios, such as mapping some devices mmio space, which are > unencrypted, and the device mmio space is o

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

2018-07-09 Thread lijiang
在 2018年07月09日 17:29, Borislav Petkov 写道: > On Mon, Jul 09, 2018 at 02:28:11PM +0800, lijiang wrote: >> Last week, I had tried many ways to do this work, but it looks >> like that the ways of deducing address is not suitable to another >> scenarios, such as mapping some devices mmio space, which are

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

2018-07-13 Thread Borislav Petkov
On Mon, Jul 09, 2018 at 09:55:35PM +0800, lijiang wrote: > About this issue, i want to use an example to describe it. > /* drivers/iommu/amd_iommu_init.c */ > static u8 __iomem * __init iommu_map_mmio_space(u64 address, u64 end) Those addresses come from the IVHD header which is an ACPI table. So

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

2018-07-19 Thread lijiang
在 2018年07月14日 01:08, Borislav Petkov 写道: > On Mon, Jul 09, 2018 at 09:55:35PM +0800, lijiang wrote: >> About this issue, i want to use an example to describe it. >> /* drivers/iommu/amd_iommu_init.c */ >> static u8 __iomem * __init iommu_map_mmio_space(u64 address, u64 end) > > Those addresses com

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

2018-07-19 Thread Dave Young
On 07/20/18 at 01:06pm, lijiang wrote: > 在 2018年07月14日 01:08, Borislav Petkov 写道: > > On Mon, Jul 09, 2018 at 09:55:35PM +0800, lijiang wrote: > >> About this issue, i want to use an example to describe it. > >> /* drivers/iommu/amd_iommu_init.c */ > >> static u8 __iomem * __init iommu_map_mmio_spa

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

2018-07-20 Thread Borislav Petkov
On Fri, Jul 20, 2018 at 01:23:04PM +0800, Dave Young wrote: > > Here, it doesn't need to dump MMIO space of the previous kernel, when the > > kdump kernel boot, the MMIO address will be remapped in decryption manners, > > but the MMIO address don't belong to the range of the crash reserved memory,

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

2018-07-20 Thread lijiang
在 2018年07月20日 15:32, Borislav Petkov 写道: > On Fri, Jul 20, 2018 at 01:23:04PM +0800, Dave Young wrote: >>> Here, it doesn't need to dump MMIO space of the previous kernel, when the >>> kdump kernel boot, the MMIO address will be remapped in decryption manners, >>> but the MMIO address don't belong

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

2018-07-20 Thread Boris Petkov
On July 20, 2018 12:55:04 PM GMT+03:00, lijiang wrote:> >Thanks for your advice, I will rewrite the log and send them again. Do not send them again - explain the problem properly first! -- Sent from a small device: formatting sux and brevity is inevitable. _

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

2018-08-15 Thread lijiang
在 2018年07月20日 18:08, Boris Petkov 写道: > On July 20, 2018 12:55:04 PM GMT+03:00, lijiang wrote:> >> Thanks for your advice, I will rewrite the log and send them again. > > Do not send them again - explain the problem properly first! > I have compared two solutions to handle the encrypted memory,

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

2018-08-23 Thread Borislav Petkov
On Thu, Aug 16, 2018 at 01:35:28PM +0800, lijiang wrote: > I personally prefer solution A, which is presented in posted patches. > What do you think, Boris? And other reviewers? Ok, thanks for taking the time and effort in explaning this in detail. Solution B really turns out to be too complex af