* [PATCH 2/2] Revert "xen/pvh: Update E820 to work with PVH (v2)"
2014-06-02 17:09 [RFC PATCHv1 " David Vrabel
@ 2014-06-02 17:09 ` David Vrabel
0 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2014-06-02 17:09 UTC (permalink / raw)
To: xen-devel; +Cc: Boris Ostrovsky, David Vrabel
This reverts commit 9103bb0f8240b2a55aac3ff7ecba9c7dcf66b08b.
Now than xen_memory_setup() is not called for auto-translated guests,
we can remove this commit.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
arch/x86/xen/setup.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e7ef388..40373d7 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,7 +27,6 @@
#include <xen/interface/memory.h>
#include <xen/interface/physdev.h>
#include <xen/features.h>
-#include "mmu.h"
#include "xen-ops.h"
#include "vdso.h"
@@ -82,9 +81,6 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
memblock_reserve(start, size);
- if (xen_feature(XENFEAT_auto_translated_physmap))
- return;
-
xen_max_p2m_pfn = PFN_DOWN(start + size);
for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
unsigned long mfn = pfn_to_mfn(pfn);
@@ -107,7 +103,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
.domid = DOMID_SELF
};
unsigned long len = 0;
- int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
unsigned long pfn;
int ret;
@@ -121,7 +116,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
continue;
frame = mfn;
} else {
- if (!xlated_phys && mfn != INVALID_P2M_ENTRY)
+ if (mfn != INVALID_P2M_ENTRY)
continue;
frame = pfn;
}
@@ -159,13 +154,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
static unsigned long __init xen_release_chunk(unsigned long start,
unsigned long end)
{
- /*
- * Xen already ballooned out the E820 non RAM regions for us
- * and set them up properly in EPT.
- */
- if (xen_feature(XENFEAT_auto_translated_physmap))
- return end - start;
-
return xen_do_chunk(start, end, true);
}
@@ -234,13 +222,7 @@ static void __init xen_set_identity_and_release_chunk(
* (except for the ISA region which must be 1:1 mapped) to
* release the refcounts (in Xen) on the original frames.
*/
-
- /*
- * PVH E820 matches the hypervisor's P2M which means we need to
- * account for the proper values of *release and *identity.
- */
- for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) &&
- pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
+ for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
pte_t pte = __pte_ma(0);
if (pfn < PFN_UP(ISA_END_ADDRESS))
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCHv2 0/2] Linux PVH dom0 memory setup
@ 2014-06-05 11:51 David Vrabel
2014-06-05 11:51 ` [PATCH 1/2] x86/xen: fix memory setup for PVH dom0 David Vrabel
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: David Vrabel @ 2014-06-05 11:51 UTC (permalink / raw)
To: xen-devel; +Cc: Boris Ostrovsky, David Vrabel
This is an patch fixing up Linux's memory setup for PVH dom0 after the
recent Xen change (x86: fix setup of PVH Dom0 memory map).
Changes in v2:
- panic if no memory map
- sanitize e820
- reserve start info bits and pieces
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] x86/xen: fix memory setup for PVH dom0
2014-06-05 11:51 [PATCHv2 0/2] Linux PVH dom0 memory setup David Vrabel
@ 2014-06-05 11:51 ` David Vrabel
2014-06-05 11:51 ` [PATCH 2/2] Revert "xen/pvh: Update E820 to work with PVH (v2)" David Vrabel
2014-06-05 13:19 ` [PATCHv2 0/2] Linux PVH dom0 memory setup Roger Pau Monné
2 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2014-06-05 11:51 UTC (permalink / raw)
To: xen-devel; +Cc: Boris Ostrovsky, David Vrabel
Since af06d66ee32b (x86: fix setup of PVH Dom0 memory map) in Xen, PVH
dom0 need only use the memory memory provided by Xen which has already
setup all the correct holes.
xen_memory_setup() then ends up being trivial for a PVH guest so
introduce a new function (xen_auto_xlated_memory_setup()).
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
arch/x86/xen/enlighten.c | 5 ++++-
arch/x86/xen/setup.c | 29 +++++++++++++++++++++++++++++
arch/x86/xen/xen-ops.h | 1 +
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c34bfc4..7dffa8c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1536,7 +1536,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
if (!xen_pvh_domain())
pv_cpu_ops = xen_cpu_ops;
- x86_init.resources.memory_setup = xen_memory_setup;
+ if (xen_feature(XENFEAT_auto_translated_physmap))
+ x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
+ else
+ x86_init.resources.memory_setup = xen_memory_setup;
x86_init.oem.arch_setup = xen_arch_setup;
x86_init.oem.banner = xen_banner;
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 0982233..d54d686 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -509,6 +509,35 @@ char * __init xen_memory_setup(void)
}
/*
+ * Machine specific memory setup for auto-translated guests.
+ */
+char * __init xen_auto_xlated_memory_setup(void)
+{
+ static struct e820entry map[E820MAX] __initdata;
+
+ struct xen_memory_map memmap;
+ int i;
+ int rc;
+
+ memmap.nr_entries = E820MAX;
+ set_xen_guest_handle(memmap.buffer, map);
+
+ rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
+ if (rc < 0)
+ panic("No memory map (%d)\n", rc);
+
+ sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
+
+ for (i = 0; i < memmap.nr_entries; i++)
+ e820_add_region(map[i].addr, map[i].size, map[i].type);
+
+ memblock_reserve(__pa(xen_start_info->mfn_list),
+ xen_start_info->pt_base - xen_start_info->mfn_list);
+
+ return "Xen";
+}
+
+/*
* Set the bit indicating "nosegneg" library variants should be used.
* We only need to bother in pure 32-bit mode; compat 32-bit processes
* can have un-truncated segments, so wrapping around is allowed.
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 1cb6f4c..b371d18 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -34,6 +34,7 @@ extern unsigned long xen_max_p2m_pfn;
void xen_set_pat(u64);
char * __init xen_memory_setup(void);
+char * xen_auto_xlated_memory_setup(void);
void __init xen_arch_setup(void);
void xen_enable_sysenter(void);
void xen_enable_syscall(void);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Revert "xen/pvh: Update E820 to work with PVH (v2)"
2014-06-05 11:51 [PATCHv2 0/2] Linux PVH dom0 memory setup David Vrabel
2014-06-05 11:51 ` [PATCH 1/2] x86/xen: fix memory setup for PVH dom0 David Vrabel
@ 2014-06-05 11:51 ` David Vrabel
2014-06-05 13:19 ` [PATCHv2 0/2] Linux PVH dom0 memory setup Roger Pau Monné
2 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2014-06-05 11:51 UTC (permalink / raw)
To: xen-devel; +Cc: Boris Ostrovsky, David Vrabel
This reverts commit 9103bb0f8240b2a55aac3ff7ecba9c7dcf66b08b.
Now than xen_memory_setup() is not called for auto-translated guests,
we can remove this commit.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
arch/x86/xen/setup.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index d54d686..039b9c5 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,7 +27,6 @@
#include <xen/interface/memory.h>
#include <xen/interface/physdev.h>
#include <xen/features.h>
-#include "mmu.h"
#include "xen-ops.h"
#include "vdso.h"
@@ -82,9 +81,6 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
memblock_reserve(start, size);
- if (xen_feature(XENFEAT_auto_translated_physmap))
- return;
-
xen_max_p2m_pfn = PFN_DOWN(start + size);
for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
unsigned long mfn = pfn_to_mfn(pfn);
@@ -107,7 +103,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
.domid = DOMID_SELF
};
unsigned long len = 0;
- int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
unsigned long pfn;
int ret;
@@ -121,7 +116,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
continue;
frame = mfn;
} else {
- if (!xlated_phys && mfn != INVALID_P2M_ENTRY)
+ if (mfn != INVALID_P2M_ENTRY)
continue;
frame = pfn;
}
@@ -159,13 +154,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
static unsigned long __init xen_release_chunk(unsigned long start,
unsigned long end)
{
- /*
- * Xen already ballooned out the E820 non RAM regions for us
- * and set them up properly in EPT.
- */
- if (xen_feature(XENFEAT_auto_translated_physmap))
- return end - start;
-
return xen_do_chunk(start, end, true);
}
@@ -234,13 +222,7 @@ static void __init xen_set_identity_and_release_chunk(
* (except for the ISA region which must be 1:1 mapped) to
* release the refcounts (in Xen) on the original frames.
*/
-
- /*
- * PVH E820 matches the hypervisor's P2M which means we need to
- * account for the proper values of *release and *identity.
- */
- for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) &&
- pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
+ for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
pte_t pte = __pte_ma(0);
if (pfn < PFN_UP(ISA_END_ADDRESS))
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCHv2 0/2] Linux PVH dom0 memory setup
2014-06-05 11:51 [PATCHv2 0/2] Linux PVH dom0 memory setup David Vrabel
2014-06-05 11:51 ` [PATCH 1/2] x86/xen: fix memory setup for PVH dom0 David Vrabel
2014-06-05 11:51 ` [PATCH 2/2] Revert "xen/pvh: Update E820 to work with PVH (v2)" David Vrabel
@ 2014-06-05 13:19 ` Roger Pau Monné
2014-06-05 13:40 ` David Vrabel
2 siblings, 1 reply; 6+ messages in thread
From: Roger Pau Monné @ 2014-06-05 13:19 UTC (permalink / raw)
To: David Vrabel, xen-devel; +Cc: Boris Ostrovsky
On 05/06/14 13:51, David Vrabel wrote:
> This is an patch fixing up Linux's memory setup for PVH dom0 after the
> recent Xen change (x86: fix setup of PVH Dom0 memory map).
>
> Changes in v2:
> - panic if no memory map
> - sanitize e820
> - reserve start info bits and pieces
For both:
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Tested-by: Roger Pau Monné <roger.pau@citrix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2 0/2] Linux PVH dom0 memory setup
2014-06-05 13:19 ` [PATCHv2 0/2] Linux PVH dom0 memory setup Roger Pau Monné
@ 2014-06-05 13:40 ` David Vrabel
0 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2014-06-05 13:40 UTC (permalink / raw)
To: Roger Pau Monné, David Vrabel, xen-devel; +Cc: Boris Ostrovsky
On 05/06/14 14:19, Roger Pau Monné wrote:
> On 05/06/14 13:51, David Vrabel wrote:
>> This is an patch fixing up Linux's memory setup for PVH dom0 after the
>> recent Xen change (x86: fix setup of PVH Dom0 memory map).
>>
>> Changes in v2:
>> - panic if no memory map
>> - sanitize e820
>> - reserve start info bits and pieces
>
> For both:
>
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
> Tested-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks. Applied to stable/for-linus-3.16
David
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-05 13:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-05 11:51 [PATCHv2 0/2] Linux PVH dom0 memory setup David Vrabel
2014-06-05 11:51 ` [PATCH 1/2] x86/xen: fix memory setup for PVH dom0 David Vrabel
2014-06-05 11:51 ` [PATCH 2/2] Revert "xen/pvh: Update E820 to work with PVH (v2)" David Vrabel
2014-06-05 13:19 ` [PATCHv2 0/2] Linux PVH dom0 memory setup Roger Pau Monné
2014-06-05 13:40 ` David Vrabel
-- strict thread matches above, loose matches on Subject: below --
2014-06-02 17:09 [RFC PATCHv1 " David Vrabel
2014-06-02 17:09 ` [PATCH 2/2] Revert "xen/pvh: Update E820 to work with PVH (v2)" David Vrabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).