# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 3bf1684f032ebf5ccabda8f0a7cc10757061b0bf
# Parent 2e219f06f9a407d13248ea7a389373a23028c426
[XEN][POWERPC] Conistence with log vs. order
We use "log" for a log2 value, "order" is the log2 of page size, so:
order = log - PAGE_SHIFT
It is confusing, but more so if we are not consistent.
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
xen/arch/powerpc/domctl.c | 6 ++---
xen/arch/powerpc/powerpc64/ppc970.c | 37 ++++++++++++++++++------------------
xen/include/asm-powerpc/processor.h | 2 -
3 files changed, 23 insertions(+), 22 deletions(-)
diff -r 2e219f06f9a4 -r 3bf1684f032e xen/arch/powerpc/domctl.c
--- a/xen/arch/powerpc/domctl.c Thu Sep 28 22:31:23 2006 -0400
+++ b/xen/arch/powerpc/domctl.c Fri Sep 29 09:53:39 2006 -0400
@@ -96,14 +96,14 @@ long arch_do_domctl(struct xen_domctl *d
case XEN_DOMCTL_real_mode_area:
{
struct domain *d;
- unsigned int log = domctl->u.real_mode_area.log;
+ unsigned int order = domctl->u.real_mode_area.log - PAGE_SHIFT;
ret = -ESRCH;
d = find_domain_by_id(domctl->domain);
if (d != NULL) {
ret = -EINVAL;
- if (cpu_rma_valid(log))
- ret = allocate_rma(d, log - PAGE_SHIFT);
+ if (cpu_rma_valid(order))
+ ret = allocate_rma(d, order);
put_domain(d);
}
}
diff -r 2e219f06f9a4 -r 3bf1684f032e xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c Thu Sep 28 22:31:23 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c Fri Sep 29 09:53:39 2006 -0400
@@ -45,42 +45,43 @@ struct cpu_caches cpu_caches = {
};
struct rma_settings {
- int order;
+ int log;
int rmlr_0;
int rmlr_1_2;
};
-static struct rma_settings rma_orders[] = {
- { .order = 26, .rmlr_0 = 0, .rmlr_1_2 = 3, }, /* 64 MB */
- { .order = 27, .rmlr_0 = 1, .rmlr_1_2 = 3, }, /* 128 MB */
- { .order = 28, .rmlr_0 = 1, .rmlr_1_2 = 0, }, /* 256 MB */
- { .order = 30, .rmlr_0 = 0, .rmlr_1_2 = 2, }, /* 1 GB */
- { .order = 34, .rmlr_0 = 0, .rmlr_1_2 = 1, }, /* 16 GB */
- { .order = 38, .rmlr_0 = 0, .rmlr_1_2 = 0, }, /* 256 GB */
+static struct rma_settings rma_logs[] = {
+ { .log = 26, .rmlr_0 = 0, .rmlr_1_2 = 3, }, /* 64 MB */
+ { .log = 27, .rmlr_0 = 1, .rmlr_1_2 = 3, }, /* 128 MB */
+ { .log = 28, .rmlr_0 = 1, .rmlr_1_2 = 0, }, /* 256 MB */
+ { .log = 30, .rmlr_0 = 0, .rmlr_1_2 = 2, }, /* 1 GB */
+ { .log = 34, .rmlr_0 = 0, .rmlr_1_2 = 1, }, /* 16 GB */
+ { .log = 38, .rmlr_0 = 0, .rmlr_1_2 = 0, }, /* 256 GB */
};
static uint log_large_page_sizes[] = {
4 + 20, /* (1 << 4) == 16M */
};
-static struct rma_settings *cpu_find_rma(unsigned int order)
+static struct rma_settings *cpu_find_rma(unsigned int log)
{
int i;
- for (i = 0; i < ARRAY_SIZE(rma_orders); i++) {
- if (rma_orders[i].order == order)
- return &rma_orders[i];
+
+ for (i = 0; i < ARRAY_SIZE(rma_logs); i++) {
+ if (rma_logs[i].log == log)
+ return &rma_logs[i];
}
return NULL;
}
unsigned int cpu_default_rma_order_pages(void)
{
- return rma_orders[0].order - PAGE_SHIFT;
-}
-
-int cpu_rma_valid(unsigned int log)
-{
- return cpu_find_rma(log) != NULL;
+ return rma_logs[0].log - PAGE_SHIFT;
+}
+
+int cpu_rma_valid(unsigned int order)
+{
+ return cpu_find_rma(order + PAGE_SHIFT) != NULL;
}
unsigned int cpu_large_page_orders(uint *sizes, uint max)
diff -r 2e219f06f9a4 -r 3bf1684f032e xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h Thu Sep 28 22:31:23 2006 -0400
+++ b/xen/include/asm-powerpc/processor.h Fri Sep 29 09:53:39 2006 -0400
@@ -120,7 +120,7 @@ extern void show_registers(struct cpu_us
extern void show_registers(struct cpu_user_regs *);
extern unsigned int cpu_extent_order(void);
extern unsigned int cpu_default_rma_order_pages(void);
-extern int cpu_rma_valid(unsigned int log);
+extern int cpu_rma_valid(unsigned int order);
extern uint cpu_large_page_orders(uint *sizes, uint max);
extern void cpu_initialize(int cpuid);
extern void cpu_init_vcpu(struct vcpu *);
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|