[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 27/72] pseries: Correctly create ibm, segment-page-siz
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 27/72] pseries: Correctly create ibm, segment-page-sizes property |
Date: |
Sun, 24 Jun 2012 01:06:51 +0200 |
From: Benjamin Herrenschmidt <address@hidden>
The core tcg/kvm code for ppc64 now has at least the outline
capability to support pagesizes beyond the standard 4k and 16MB. The
CPUState is initialized with information advertising the available
pagesizes and their correct encodings, and under the right KVM setup
this will be populated with page sizes beyond the standard.
Obviously guests can't use the extra page sizes unless they know
they're present. For the pseries machine, at least, there is a
defined method for conveying exactly this information, the
"ibm-segment-page-sizes" property in the guest device tree.
This patch generates this property using the supported page size
information that's already in the CPUState.
Signed-off-by: Nishanth Aravamudan <address@hidden>
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Benjamin Herrenschmidt <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/spapr.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/hw/spapr.c b/hw/spapr.c
index d0bddbc..1b01d64 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -146,6 +146,40 @@ static int spapr_set_associativity(void *fdt,
sPAPREnvironment *spapr)
return ret;
}
+
+static size_t create_page_sizes_prop(CPUPPCState *env, uint32_t *prop,
+ size_t maxsize)
+{
+ size_t maxcells = maxsize / sizeof(uint32_t);
+ int i, j, count;
+ uint32_t *p = prop;
+
+ for (i = 0; i < PPC_PAGE_SIZES_MAX_SZ; i++) {
+ struct ppc_one_seg_page_size *sps = &env->sps.sps[i];
+
+ if (!sps->page_shift) {
+ break;
+ }
+ for (count = 0; count < PPC_PAGE_SIZES_MAX_SZ; count++) {
+ if (sps->enc[count].page_shift == 0) {
+ break;
+ }
+ }
+ if ((p - prop) >= (maxcells - 3 - count * 2)) {
+ break;
+ }
+ *(p++) = cpu_to_be32(sps->page_shift);
+ *(p++) = cpu_to_be32(sps->slb_enc);
+ *(p++) = cpu_to_be32(count);
+ for (j = 0; j < count; j++) {
+ *(p++) = cpu_to_be32(sps->enc[j].page_shift);
+ *(p++) = cpu_to_be32(sps->enc[j].pte_enc);
+ }
+ }
+
+ return (p - prop) * sizeof(uint32_t);
+}
+
static void *spapr_create_fdt_skel(const char *cpu_model,
target_phys_addr_t rma_size,
target_phys_addr_t initrd_base,
@@ -298,6 +332,8 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
0xffffffff, 0xffffffff};
uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TIMEBASE_FREQ;
uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000;
+ uint32_t page_sizes_prop[64];
+ size_t page_sizes_prop_size;
if ((index % smt) != 0) {
continue;
@@ -362,6 +398,13 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
_FDT((fdt_property_cell(fdt, "ibm,dfp", 1)));
}
+ page_sizes_prop_size = create_page_sizes_prop(env, page_sizes_prop,
+ sizeof(page_sizes_prop));
+ if (page_sizes_prop_size) {
+ _FDT((fdt_property(fdt, "ibm,segment-page-sizes",
+ page_sizes_prop, page_sizes_prop_size)));
+ }
+
_FDT((fdt_end_node(fdt)));
}
--
1.6.0.2
- [Qemu-ppc] [PATCH 24/72] Avoid segfault in cpu_dump_state, (continued)
- [Qemu-ppc] [PATCH 24/72] Avoid segfault in cpu_dump_state, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 28/72] spapr_vscsi: Error handling fixes, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 20/72] ppc: Move load and store helpers, switch to AREG0 free mode, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 31/72] dt: allow add_subnode to create root subnodes, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 34/72] dt: temporarily disable subtree creation failure check, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 37/72] dt: add helper for phandle allocation, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 38/72] dt: add helper for 64bit cell adds, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 41/72] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 26/72] ppc64: Rudimentary Support for extra page sizes on server CPUs, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 40/72] PPC: e500: dt: create memory node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 27/72] pseries: Correctly create ibm, segment-page-sizes property,
Alexander Graf <=
- [Qemu-ppc] [PATCH 06/72] ppc: Split FPU and SPE ops, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 49/72] PPC: e500: dt: create pci node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 56/72] PPC: e500: Use new MPIC dt format, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 57/72] PPC: e500: Use new SOC dt format, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 55/72] Revert "dt: temporarily disable subtree creation failure check", Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 54/72] PPC: e500: enable manual loading of dtb blob, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 43/72] PPC: e500: dt: create / node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 01/72] ppc: Fix coding style in op_helper.c, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 08/72] ppc: Split integer and vector ops, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 59/72] PPC: e500: Extend address/size of / to 64bit, Alexander Graf, 2012/06/23