|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86/pv: Clean up cr3 handling in arch_set_info_guest()
commit 243cc95d485846e35f5e2445fdaafe77c8c114d2
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Dec 21 13:44:30 2018 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 13 19:03:42 2019 +0100
x86/pv: Clean up cr3 handling in arch_set_info_guest()
All of this code lives inside CONFIG_PV which means gfn == mfn, and the
fill_ro_mpt() calls clearly show that the value is used untranslated.
Change cr3_gfn to a suitably typed cr3_mfn, and replace get_page_from_gfn()
with get_page_from_mfn().
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/domain.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 612afb683f..9a6eb89ddc 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -803,8 +803,8 @@ int arch_set_info_guest(
unsigned long flags;
bool compat;
#ifdef CONFIG_PV
- unsigned long cr3_gfn;
- struct page_info *cr3_page;
+ mfn_t cr3_mfn;
+ struct page_info *cr3_page = NULL;
int rc = 0;
#endif
@@ -1070,10 +1070,10 @@ int arch_set_info_guest(
set_bit(_VPF_in_reset, &v->pause_flags);
if ( !compat )
- cr3_gfn = xen_cr3_to_pfn(c.nat->ctrlreg[3]);
+ cr3_mfn = _mfn(xen_cr3_to_pfn(c.nat->ctrlreg[3]));
else
- cr3_gfn = compat_cr3_to_pfn(c.cmp->ctrlreg[3]);
- cr3_page = get_page_from_gfn(d, cr3_gfn, NULL, P2M_ALLOC);
+ cr3_mfn = _mfn(compat_cr3_to_pfn(c.cmp->ctrlreg[3]));
+ cr3_page = get_page_from_mfn(cr3_mfn, d);
if ( !cr3_page )
rc = -EINVAL;
@@ -1101,7 +1101,7 @@ int arch_set_info_guest(
case 0:
if ( !compat && !VM_ASSIST(d, m2p_strict) &&
!paging_mode_refcounts(d) )
- fill_ro_mpt(_mfn(cr3_gfn));
+ fill_ro_mpt(cr3_mfn);
break;
default:
if ( cr3_page == current->arch.old_guest_table )
@@ -1116,8 +1116,8 @@ int arch_set_info_guest(
v->arch.guest_table = pagetable_from_page(cr3_page);
if ( c.nat->ctrlreg[1] )
{
- cr3_gfn = xen_cr3_to_pfn(c.nat->ctrlreg[1]);
- cr3_page = get_page_from_gfn(d, cr3_gfn, NULL, P2M_ALLOC);
+ cr3_mfn = _mfn(xen_cr3_to_pfn(c.nat->ctrlreg[1]));
+ cr3_page = get_page_from_mfn(cr3_mfn, d);
if ( !cr3_page )
rc = -EINVAL;
@@ -1141,7 +1141,7 @@ int arch_set_info_guest(
break;
case 0:
if ( VM_ASSIST(d, m2p_strict) )
- zap_ro_mpt(_mfn(cr3_gfn));
+ zap_ro_mpt(cr3_mfn);
break;
}
}
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |