|
@@ -879,7 +879,6 @@ int m2p_add_override(unsigned long mfn, struct page *page,
|
|
|
unsigned long uninitialized_var(address);
|
|
|
unsigned level;
|
|
|
pte_t *ptep = NULL;
|
|
|
- int ret = 0;
|
|
|
|
|
|
pfn = page_to_pfn(page);
|
|
|
if (!PageHighMem(page)) {
|
|
@@ -926,8 +925,8 @@ int m2p_add_override(unsigned long mfn, struct page *page,
|
|
|
* frontend pages while they are being shared with the backend,
|
|
|
* because mfn_to_pfn (that ends up being called by GUPF) will
|
|
|
* return the backend pfn rather than the frontend pfn. */
|
|
|
- ret = __get_user(pfn, &machine_to_phys_mapping[mfn]);
|
|
|
- if (ret == 0 && get_phys_to_machine(pfn) == mfn)
|
|
|
+ pfn = mfn_to_pfn_no_overrides(mfn);
|
|
|
+ if (get_phys_to_machine(pfn) == mfn)
|
|
|
set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));
|
|
|
|
|
|
return 0;
|
|
@@ -942,7 +941,6 @@ int m2p_remove_override(struct page *page,
|
|
|
unsigned long uninitialized_var(address);
|
|
|
unsigned level;
|
|
|
pte_t *ptep = NULL;
|
|
|
- int ret = 0;
|
|
|
|
|
|
pfn = page_to_pfn(page);
|
|
|
mfn = get_phys_to_machine(pfn);
|
|
@@ -1029,8 +1027,8 @@ int m2p_remove_override(struct page *page,
|
|
|
* the original pfn causes mfn_to_pfn(mfn) to return the frontend
|
|
|
* pfn again. */
|
|
|
mfn &= ~FOREIGN_FRAME_BIT;
|
|
|
- ret = __get_user(pfn, &machine_to_phys_mapping[mfn]);
|
|
|
- if (ret == 0 && get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) &&
|
|
|
+ pfn = mfn_to_pfn_no_overrides(mfn);
|
|
|
+ if (get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) &&
|
|
|
m2p_find_override(mfn) == NULL)
|
|
|
set_phys_to_machine(pfn, mfn);
|
|
|
|