[SRU][jammy/linux-aws][kinetic/linux-aws][PATCH 04/20] UBUNTU: SAUCE: x86/xen: Introduce new function to map HYPERVISOR_shared_info on Resume
Gerald Yang
gerald.yang at canonical.com
Wed Aug 17 08:51:31 UTC 2022
From: Anchal Agarwal <anchalag at amazon.com>
BugLink: https://bugs.launchpad.net/bugs/1968062
Introduce a small function which re-uses shared page's PA allocated
during guest initialization time in reserve_shared_info() and not
allocate new page during resume flow.
It also does the mapping of shared_info_page by calling
xen_hvm_init_shared_info() to use the function.
Backport Notes:
We don't need this commit 8d5ce0dad4ab2a4c8c8a3c36f6fb8c46b695b053 ("x86/xen:
decouple shared_info mapping from xen_hvm_init_shared_info()") here since
xen_hvm_init_shared_info changed in 4.14 kernel just to do the mapping and
allocation of shared page is done in a separate function.
We don't need to decouple this kernel API anymore
Signed-off-by: Anchal Agarwal <anchalag at amazon.com>
Reviewed-by: Sebastian Biemueller <sbiemue at amazon.com>
Reviewed-by: Munehisa Kamata <kamatam at amazon.com>
Reviewed-by: Eduardo Valentin <eduval at amazon.com>
CR: https://cr.amazon.com/r/8273203/
(cherry picked from commit 9970545c4f2f4f3d8ab77730bf67ed3accf1eab8 amazon-5.15.y/mainline)
Signed-off-by: Gerald Yang <gerald.yang at canonical.com>
Signed-off-by: Matthew Ruffell <matthew.ruffell at canonical.com>
---
arch/x86/xen/enlighten_hvm.c | 7 +++++++
arch/x86/xen/xen-ops.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index e68ea5f4ad1c..660114498316 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -29,6 +29,13 @@
static unsigned long shared_info_pfn;
+void xen_hvm_map_shared_info(void)
+{
+ xen_hvm_init_shared_info();
+ if(shared_info_pfn)
+ HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn));
+}
+
void xen_hvm_init_shared_info(void)
{
struct xen_add_to_physmap xatp;
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 16aed4b12129..5582845c5ab1 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -56,6 +56,8 @@ void xen_enable_sysenter(void);
void xen_enable_syscall(void);
void xen_vcpu_restore(void);
+void xen_callback_vector(void);
+void xen_hvm_map_shared_info(void);
void xen_hvm_init_shared_info(void);
void xen_unplug_emulated_devices(void);
--
2.34.1
More information about the kernel-team
mailing list