提交 e102d627 编写于 作者: L Lianbo Jiang 提交者: Xie XiuQi

kexec: Allocate decrypted control pages for kdump if SME is enabled

[ Upstream commit 9cf38d55 ]

When SME is enabled in the first kernel, it needs to allocate decrypted
pages for kdump because when the kdump kernel boots, these pages need to
be accessed decrypted in the initial boot stage, before SME is enabled.

 [ bp: clean up text. ]
Signed-off-by: NLianbo Jiang <lijiang@redhat.com>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Reviewed-by: NTom Lendacky <thomas.lendacky@amd.com>
Cc: kexec@lists.infradead.org
Cc: tglx@linutronix.de
Cc: mingo@redhat.com
Cc: hpa@zytor.com
Cc: akpm@linux-foundation.org
Cc: dan.j.williams@intel.com
Cc: bhelgaas@google.com
Cc: baiyaowei@cmss.chinamobile.com
Cc: tiwai@suse.de
Cc: brijesh.singh@amd.com
Cc: dyoung@redhat.com
Cc: bhe@redhat.com
Cc: jroedel@suse.de
Link: https://lkml.kernel.org/r/20180930031033.22110-3-lijiang@redhat.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 188e2efd
...@@ -529,6 +529,10 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, ...@@ -529,6 +529,10 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
} }
} }
/* Ensure that these pages are decrypted if SME is enabled. */
if (pages)
arch_kexec_post_alloc_pages(page_address(pages), 1 << order, 0);
return pages; return pages;
} }
...@@ -925,6 +929,7 @@ static int kimage_load_crash_segment(struct kimage *image, ...@@ -925,6 +929,7 @@ static int kimage_load_crash_segment(struct kimage *image,
result = -ENOMEM; result = -ENOMEM;
goto out; goto out;
} }
arch_kexec_post_alloc_pages(page_address(page), 1, 0);
ptr = kmap(page); ptr = kmap(page);
ptr += maddr & ~PAGE_MASK; ptr += maddr & ~PAGE_MASK;
mchunk = min_t(size_t, mbytes, mchunk = min_t(size_t, mbytes,
...@@ -942,6 +947,7 @@ static int kimage_load_crash_segment(struct kimage *image, ...@@ -942,6 +947,7 @@ static int kimage_load_crash_segment(struct kimage *image,
result = copy_from_user(ptr, buf, uchunk); result = copy_from_user(ptr, buf, uchunk);
kexec_flush_icache_page(page); kexec_flush_icache_page(page);
kunmap(page); kunmap(page);
arch_kexec_pre_free_pages(page_address(page), 1);
if (result) { if (result) {
result = -EFAULT; result = -EFAULT;
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册