Skip to contentSkip to conversation

xen/arm: Remove processor specific bits in code

RFC Superseded Julien Grall 2 participants 16 messages Feb 11, 2014 – Feb 24, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover xen/arm: Remove processor specific bits in code

Hello,

This patch series follow a patch I have sent few months ago see:
https://patches.linaro.org/19617/.

I took a new approach and introduced specific processors callback which will be called at least during vcpu initialization. In the future, we can extend the structure to add new callbacks.

This patch series also removes xen/include/asm-arm/processor-ca{15,7}.h, both headers are not used in Xen.

Sincerely yours,

Julien Grall (5):
xen/arm32: head.S: Remove CA15 and CA7 specific includes xen/arm32: Introduce lookup_processor_type xen/arm64: Implement lookup_processor_type as a dummy function xen/arm: Remove processor specific setup in vcpu_initialise xen/arm: Remove asm-arm/processor-ca{15,7}.h headers

 xen/arch/arm/Makefile                |    1 +
 xen/arch/arm/arm32/Makefile          |    2 +-
 xen/arch/arm/arm32/head.S            |   59 +++++++++++++++++++++++++---------
 xen/arch/arm/arm32/proc-v7-c.c       |   32 ++++++++++++++++++
 xen/arch/arm/arm32/proc-v7.S         |    3 ++
 xen/arch/arm/arm64/head.S            |    7 ++++
 xen/arch/arm/domain.c                |    8 ++---
 xen/arch/arm/processor.c             |   49 ++++++++++++++++++++++++++++
 xen/arch/arm/setup.c                 |    3 ++
 xen/include/asm-arm/processor-ca15.h |   42 ------------------------
 xen/include/asm-arm/processor-ca7.h  |   20 ------------
 xen/include/asm-arm/procinfo.h       |   17 ++++++++--
 12 files changed, 156 insertions(+), 87 deletions(-)
 create mode 100644 xen/arch/arm/arm32/proc-v7-c.c
 create mode 100644 xen/arch/arm/processor.c
 delete mode 100644 xen/include/asm-arm/processor-ca15.h
 delete mode 100644 xen/include/asm-arm/processor-ca7.h
Signature · 1 line
1.7.10.4
#1 lore raw

RFC 1/5 xen/arm32: head.S: Remove CA15 and CA7 specific includes

head.S only contains generic code. It should not include headers for a specific processor.

---
 xen/arch/arm/arm32/head.S |    2 --
 1 file changed, 2 deletions(-)
xen/arch/arm/arm32/head.S +0 -2
index 1b1801b..77f5518 100644
@@ -19,8 +19,6 @@
 
 #include <asm/config.h>
 #include <asm/page.h>
-#include <asm/processor-ca15.h>
-#include <asm/processor-ca7.h>
 #include <asm/asm_defns.h>
 #include <asm/early_printk.h>
 
Signature · 1 line
1.7.10.4
#3 lore raw

RFC 2/5 xen/arm32: Introduce lookup_processor_type

In reply to Julien Grall

Looking for a specific proc_info structure is already implemented in assembly. Implement lookup_processor_type to avoid duplicate code between C and assembly.

This function searches the proc_info_list structure following the processor ID. If the search fail, it will return NULL, otherwise a pointer to this structure for the specific processor.

---
 xen/arch/arm/arm32/head.S |   57 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 43 insertions(+), 14 deletions(-)
xen/arch/arm/arm32/head.S +43 -14
index 77f5518..68fb499 100644
@@ -198,26 +198,16 @@ skip_bss:
         PRINT("- Setting up control registers -\r\n")
 
         /* Get processor specific proc info into r1 */
-        mrc   CP32(r0, MIDR)                /* r0 := our cpu id */
-        ldr   r1, = __proc_info_start
-        add   r1, r1, r10                   /* r1 := paddr of table (start) */
-        ldr   r2, = __proc_info_end
-        add   r2, r2, r10                   /* r2 := paddr of table (end) */
-1:      ldr   r3, [r1, #PROCINFO_cpu_mask]
-        and   r4, r0, r3                    /* r4 := our cpu id with mask */
-        ldr   r3, [r1, #PROCINFO_cpu_val]   /* r3 := cpu val in current proc info */
-        teq   r4, r3
-        beq   2f                            /* Match => exit, or try next proc info */
-        add   r1, r1, #PROCINFO_sizeof
-        cmp   r1, r2
-        blo   1b
+        bl    __lookup_processor_type
+        teq   r1, #0
+        bne   1f
         mov   r4, r0
         PRINT("- Missing processor info: ")
         mov   r0, r4
         bl    putn
         PRINT(" -\r\n")
         b     fail
-2:
+1:
 
         /* Jump to cpu_init */
         ldr   r1, [r1, #PROCINFO_cpu_init]  /* r1 := vaddr(init func) */
@@ -545,6 +535,45 @@ putn:   mov   pc, lr
 
 #endif /* !CONFIG_EARLY_PRINTK */
 
+/* This provides a C-API version of __lookup_processor_type */
+GLOBAL(lookup_processor_type)
+        stmfd sp!, {r4, r10, lr}
+        mov   r10, #0                   /* r10 := offset between virt&phys */
+        bl    __lookup_processor_type
+        mov r0, r1
+        ldmfd sp!, {r4, r10, pc}
+
+/* Read processor ID register (CP#15, CR0), and Look up in the linker-built
+ * supported processor list. Note that we can't use the absolute addresses for
+ * the __proc_info lists since we aren't running with the MMU on (and therefore,
+ * we are not in correct address space). We have to calculate the offset.
+ *
+ * r10: offset between virt&phys
+ *
+ * Returns:
+ * r0: CPUID
+ * r1: proc_info pointer
+ * Clobbers r2-r4
+ */
+__lookup_processor_type:
+        mrc   CP32(r0, MIDR)                /* r0 := our cpu id */
+        ldr   r1, = __proc_info_start
+        add   r1, r1, r10                   /* r1 := paddr of table (start) */
+        ldr   r2, = __proc_info_end
+        add   r2, r2, r10                   /* r2 := paddr of table (end) */
+1:      ldr   r3, [r1, #PROCINFO_cpu_mask]
+        and   r4, r0, r3                    /* r4 := our cpu id with mask */
+        ldr   r3, [r1, #PROCINFO_cpu_val]   /* r3 := cpu val in current proc info */
+        teq   r4, r3
+        beq   2f                            /* Match => exit, or try next proc info */
+        add   r1, r1, #PROCINFO_sizeof
+        cmp   r1, r2
+        blo   1b
+        /* We failed to find the proc_info, return NULL */
+        mov   r1, #0
+2:
+        mov   pc, lr
+
 /*
  * Local variables:
  * mode: ASM
Signature · 1 line
1.7.10.4
Acked-by on v1 2/5
#4 lore raw

Re: [RFC for-4.5 2/5] xen/arm32: Introduce lookup_processor_type

Quoted 9 lines · Julien Grall

Looking for a specific proc_info structure is already implemented in assembly. Implement lookup_processor_type to avoid duplicate code between C and assembly.

This function searches the proc_info_list structure following the processor ID. If the search fail, it will return NULL, otherwise a pointer to this structure for the specific processor.

Quoted 85 lines
---
 xen/arch/arm/arm32/head.S |   57 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 43 insertions(+), 14 deletions(-)
xen/arch/arm/arm32/head.S +43 -14
index 77f5518..68fb499 100644
@@ -198,26 +198,16 @@ skip_bss:
         PRINT("- Setting up control registers -\r\n")
 
         /* Get processor specific proc info into r1 */
-        mrc   CP32(r0, MIDR)                /* r0 := our cpu id */
-        ldr   r1, = __proc_info_start
-        add   r1, r1, r10                   /* r1 := paddr of table (start) */
-        ldr   r2, = __proc_info_end
-        add   r2, r2, r10                   /* r2 := paddr of table (end) */
-1:      ldr   r3, [r1, #PROCINFO_cpu_mask]
-        and   r4, r0, r3                    /* r4 := our cpu id with mask */
-        ldr   r3, [r1, #PROCINFO_cpu_val]   /* r3 := cpu val in current proc info */
-        teq   r4, r3
-        beq   2f                            /* Match => exit, or try next proc info */
-        add   r1, r1, #PROCINFO_sizeof
-        cmp   r1, r2
-        blo   1b
+        bl    __lookup_processor_type
+        teq   r1, #0
+        bne   1f
         mov   r4, r0
         PRINT("- Missing processor info: ")
         mov   r0, r4
         bl    putn
         PRINT(" -\r\n")
         b     fail
-2:
+1:
 
         /* Jump to cpu_init */
         ldr   r1, [r1, #PROCINFO_cpu_init]  /* r1 := vaddr(init func) */
@@ -545,6 +535,45 @@ putn:   mov   pc, lr
 
 #endif /* !CONFIG_EARLY_PRINTK */
 
+/* This provides a C-API version of __lookup_processor_type */
+GLOBAL(lookup_processor_type)
+        stmfd sp!, {r4, r10, lr}
+        mov   r10, #0                   /* r10 := offset between virt&phys */
+        bl    __lookup_processor_type
+        mov r0, r1
+        ldmfd sp!, {r4, r10, pc}
+
+/* Read processor ID register (CP#15, CR0), and Look up in the linker-built
+ * supported processor list. Note that we can't use the absolute addresses for
+ * the __proc_info lists since we aren't running with the MMU on (and therefore,
+ * we are not in correct address space). We have to calculate the offset.
+ *
+ * r10: offset between virt&phys
+ *
+ * Returns:
+ * r0: CPUID
+ * r1: proc_info pointer
+ * Clobbers r2-r4
+ */
+__lookup_processor_type:
+        mrc   CP32(r0, MIDR)                /* r0 := our cpu id */
+        ldr   r1, = __proc_info_start
+        add   r1, r1, r10                   /* r1 := paddr of table (start) */
+        ldr   r2, = __proc_info_end
+        add   r2, r2, r10                   /* r2 := paddr of table (end) */
+1:      ldr   r3, [r1, #PROCINFO_cpu_mask]
+        and   r4, r0, r3                    /* r4 := our cpu id with mask */
+        ldr   r3, [r1, #PROCINFO_cpu_val]   /* r3 := cpu val in current proc info */
+        teq   r4, r3
+        beq   2f                            /* Match => exit, or try next proc info */
+        add   r1, r1, #PROCINFO_sizeof
+        cmp   r1, r2
+        blo   1b
+        /* We failed to find the proc_info, return NULL */
+        mov   r1, #0
+2:
+        mov   pc, lr
+
 /*
  * Local variables:
  * mode: ASM
#5 lore raw

RFC 3/5 xen/arm64: Implement lookup_processor_type as a dummy function

In reply to Julien Grall

ARM64 implementation doesn't yet have specific code per processor. This function will be used in a later patch.

---
 xen/arch/arm/arm64/head.S |    7 +++++++
 1 file changed, 7 insertions(+)
xen/arch/arm/arm64/head.S +7 -0
index c97c194..e1d3103 100644
@@ -546,6 +546,13 @@ putn:   ret
 
 #endif /* !CONFIG_EARLY_PRINTK */
 
+/* This provides a C-API version of __lookup_processor_type
+ * TODO: For now, the implementation return NULL every time
+ */
+GLOBAL(lookup_processor_type)
+        mov  x0, #0
+        ret
+
 /*
  * Local variables:
  * mode: ASM
Signature · 1 line
1.7.10.4
Acked-by on v1 3/5
#6 lore raw

Re: [RFC for-4.5 3/5] xen/arm64: Implement lookup_processor_type as a dummy function

Quoted 4 lines · Julien Grall

ARM64 implementation doesn't yet have specific code per processor. This function will be used in a later patch.

Quoted 22 lines
---
 xen/arch/arm/arm64/head.S |    7 +++++++
 1 file changed, 7 insertions(+)
xen/arch/arm/arm64/head.S +7 -0
index c97c194..e1d3103 100644
@@ -546,6 +546,13 @@ putn:   ret
 
 #endif /* !CONFIG_EARLY_PRINTK */
 
+/* This provides a C-API version of __lookup_processor_type
+ * TODO: For now, the implementation return NULL every time
+ */
+GLOBAL(lookup_processor_type)
+        mov  x0, #0
+        ret
+
 /*
  * Local variables:
  * mode: ASM
#7 lore raw

RFC 4/5 xen/arm: Remove processor specific setup in vcpu_initialise

In reply to Julien Grall

This patch introduces the possibility to have specific processor callbacks that can be called in various place.

Currently VCPU initialization code contains processor specific setup (for Cortex A7 and Cortex A15) for the ACTRL registers. It's possible to have processor with a different layout for this register.

Move this setup in a specific callback for ARM v7 processor.

---
 xen/arch/arm/Makefile          |    1 +
 xen/arch/arm/arm32/Makefile    |    2 +-
 xen/arch/arm/arm32/proc-v7-c.c |   32 ++++++++++++++++++++++++++
 xen/arch/arm/arm32/proc-v7.S   |    3 +++
 xen/arch/arm/domain.c          |    8 ++-----
 xen/arch/arm/processor.c       |   49 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c           |    3 +++
 xen/include/asm-arm/procinfo.h |   17 ++++++++++++--
 8 files changed, 106 insertions(+), 9 deletions(-)
 create mode 100644 xen/arch/arm/arm32/proc-v7-c.c
 create mode 100644 xen/arch/arm/processor.c
xen/arch/arm/Makefile +1 -0
index d70f6d5..63e0460 100644
@@ -32,6 +32,7 @@ obj-y += vuart.o
 obj-y += hvm.o
 obj-y += device.o
 obj-y += decode.o
+obj-y += processor.o
 
 #obj-bin-y += ....o
 
xen/arch/arm/arm32/Makefile +1 -1
index 65ecff4..0e7c3b4 100644
@@ -1,7 +1,7 @@
 subdir-y += lib
 
 obj-y += entry.o
-obj-y += proc-v7.o
+obj-y += proc-v7.o proc-v7-c.o
 
 obj-y += traps.o
 obj-y += domain.o
xen/arch/arm/arm32/proc-v7-c.c new file +32 -0
new file mode 100644
index 0000000..a3b94a2
@@ -0,0 +1,32 @@
+/*
+ * xen/arch/arm/arm32/proc-v7-c.c
+ *
+ * arm v7 specific initializations (C part)
+ *
+ * Julien Grall <[email protected]>
+ * Copyright (c) 2014 Linaro Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <asm/procinfo.h>
+#include <asm/processor.h>
+
+static void armv7_vcpu_initialize(struct vcpu *v)
+{
+    if ( v->domain->max_vcpus > 1 )
+        v->arch.actlr |= ACTLR_V7_SMP;
+    else
+        v->arch.actlr &= ~ACTLR_V7_SMP;
+}
+
+const struct processor armv7_processor = {
+    .vcpu_initialize = armv7_vcpu_initialize,
+};
xen/arch/arm/arm32/proc-v7.S +3 -0
index 2c8cb9c..d7d2318 100644
@@ -33,6 +33,7 @@ __v7_ca15mp_proc_info:
         .long 0x410FC0F0             /* Cortex-A15 */
         .long 0xFF0FFFF0             /* Mask */
         .long v7_init
+        .long armv7_processor
         .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
 
         .section ".init.proc.info", #alloc, #execinstr
@@ -41,6 +42,7 @@ __v7_ca7mp_proc_info:
         .long 0x410FC070             /* Cortex-A7 */
         .long 0xFF0FFFF0             /* Mask */
         .long v7_init
+        .long armv7_processor
         .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info
 
         .section ".init.proc.info", #alloc, #execinstr
@@ -49,6 +51,7 @@ __v7_brahma15mp_proc_info:
         .long 0x420F00F2             /* Broadcom Brahma-B15 */
         .long 0xFF0FFFFF             /* Mask */
         .long v7_init
+        .long armv7_processor
         .size __v7_brahma15mp_proc_info, . - __v7_brahma15mp_proc_info
 
 /*
xen/arch/arm/domain.c +2 -6
index c279a27..df23147 100644
@@ -29,7 +29,7 @@
 #include <asm/irq.h>
 #include <asm/cpufeature.h>
 #include <asm/vfp.h>
-#include <asm/processor-ca15.h>
+#include <asm/procinfo.h>
 
 #include <asm/gic.h>
 #include <asm/platform.h>
@@ -487,11 +487,7 @@ int vcpu_initialise(struct vcpu *v)
 
     v->arch.actlr = READ_SYSREG32(ACTLR_EL1);
 
-    /* XXX: Handle other than CA15 cpus */
-    if ( v->domain->max_vcpus > 1 )
-        v->arch.actlr |= ACTLR_CA15_SMP;
-    else
-        v->arch.actlr &= ~ACTLR_CA15_SMP;
+    processor_vcpu_initialize(v);
 
     if ( (rc = vcpu_vgic_init(v)) != 0 )
         return rc;
xen/arch/arm/processor.c new file +49 -0

49 lines not on this page · raw message

xen/arch/arm/setup.c +3 -0
index 1f6d713..5529cb1 100644
@@ -42,6 +42,7 @@
 #include <asm/gic.h>
 #include <asm/cpufeature.h>
 #include <asm/platform.h>
+#include <asm/procinfo.h>
 
 struct cpuinfo_arm __read_mostly boot_cpu_data;
 
@@ -148,6 +149,8 @@ static void __init processor_id(void)
     {
         printk("32-bit Execution: Unsupported\n");
     }
+
+    processor_setup();
 }
 
 static void dt_unreserved_regions(paddr_t s, paddr_t e,
xen/include/asm-arm/procinfo.h +15 -2
index 9d3feb7..9cb7a86 100644
@@ -21,10 +21,23 @@
 #ifndef __ASM_ARM_PROCINFO_H
 #define __ASM_ARM_PROCINFO_H
 
+#include <xen/sched.h>
+
+struct processor {
+    /* Initialize specific processor register for the new VPCU*/
+    void (*vcpu_initialize)(struct vcpu *v);
+};
+
 struct proc_info_list {
-	unsigned int		cpu_val;
-	unsigned int		cpu_mask;
+    unsigned int        cpu_val;
+    unsigned int        cpu_mask;
     void                (*cpu_init)(void);
+    struct processor    *processor;
 };
 
+const __init struct proc_info_list *lookup_processor_type(void);
+
+void __init processor_setup(void);
+void processor_vcpu_initialize(struct vcpu *v);
+
 #endif
Signature · 1 line
1.7.10.4
#8 lore raw

Re: [RFC for-4.5 4/5] xen/arm: Remove processor specific setup in vcpu_initialise

xen/arch/arm/arm32/proc-v7-c.c line 4

Quoted 10 lines · Julien Grall
xen/arch/arm/arm32/proc-v7-c.c new file +4 -0
new file mode 100644
index 0000000..a3b94a2
@@ -0,0 +1,32 @@
+/*
+ * xen/arch/arm/arm32/proc-v7-c.c
+ *
+ * arm v7 specific initializations (C part)

I think strictly speaking this is actually cortex a{7,15} specific.

Calling this file "proc-v7-ca15.c" or something (core-cortex.c?) would be nicer than the ugly -c suffix...

Quoted 16 lines
xen/arch/arm/arm32/proc-v7-c.c new file +16 -0
+ *
+ * Julien Grall <[email protected]>
+ * Copyright (c) 2014 Linaro Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <asm/procinfo.h>
+#include <asm/processor.h>

xen/arch/arm/arm32/proc-v7-c.c line 30

Quoted 10 lines
xen/arch/arm/arm32/proc-v7-c.c new file +10 -0
+
+static void armv7_vcpu_initialize(struct vcpu *v)
+{
+    if ( v->domain->max_vcpus > 1 )
+        v->arch.actlr |= ACTLR_V7_SMP;
+    else
+        v->arch.actlr &= ~ACTLR_V7_SMP;
+}
+
+const struct processor armv7_processor = {

__rodata? (or whatever it is called)

Quoted 2 lines
xen/arch/arm/arm32/proc-v7-c.c new file +2 -0
+    .vcpu_initialize = armv7_vcpu_initialize,
+};
#9 lore raw

Re: [RFC for-4.5 4/5] xen/arm: Remove processor specific setup in vcpu_initialise

Hi Ian,

Quoted 15 lines · Ian Campbell

xen/arch/arm/arm32/proc-v7-c.c line 4

Quoted 10 lines · Julien Grall
xen/arch/arm/arm32/proc-v7-c.c new file +4 -0
new file mode 100644
index 0000000..a3b94a2
@@ -0,0 +1,32 @@
+/*
+ * xen/arch/arm/arm32/proc-v7-c.c
+ *
+ * arm v7 specific initializations (C part)

I think strictly speaking this is actually cortex a{7,15} specific. Calling this file "proc-v7-ca15.c" or something (core-cortex.c?) would be nicer than the ugly -c suffix...

Right, but it's possible to have some specific quirk written in C for other ARMv7 CPU.

I think we need to have a file where we can store v7 code (as proc-v7.S). Creating a file per specific processor for only one function seems odd. I'm open to any other generic name for this file.

Cheers,

Signature · 1 line
Julien Grall
#10 lore raw

Re: [RFC for-4.5 4/5] xen/arm: Remove processor specific setup in vcpu_initialise

In reply to Ian Campbell
Quoted 20 lines · Ian Campbell
Quoted 20 lines

+ *
+ * Julien Grall <[email protected]>
+ * Copyright (c) 2014 Linaro Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */

xen/arch/arm/arm32/proc-v7-c.c new file +6 -0
+#include <asm/procinfo.h>
+#include <asm/processor.h>
+
+static void armv7_vcpu_initialize(struct vcpu *v)
+{
+    if ( v->domain->max_vcpus > 1 )
Quoted 8 lines

xen/arch/arm/arm32/proc-v7-c.c line 30

Quoted 6 lines
xen/arch/arm/arm32/proc-v7-c.c new file +6 -0
+        v->arch.actlr |= ACTLR_V7_SMP;
+    else
+        v->arch.actlr &= ~ACTLR_V7_SMP;
+}
+
+const struct processor armv7_processor = {

__rodata? (or whatever it is called)

I forgot to answer to this part. The compiler will put it by default in rodata. Did you want to say __initconst? If so, we can't because I use a pointer to this structure in arch/arm/processor.c

If we want to save space, we can copy it in another variable in processor_setup.

Signature · 1 line
Julien Grall
#11 lore raw

Re: [RFC for-4.5 4/5] xen/arm: Remove processor specific setup in vcpu_initialise

Quoted 31 lines · Julien Grall
Quoted 20 lines · Ian Campbell
Quoted 20 lines

+ *
+ * Julien Grall <[email protected]>
+ * Copyright (c) 2014 Linaro Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */

xen/arch/arm/arm32/proc-v7-c.c new file +6 -0
+#include <asm/procinfo.h>
+#include <asm/processor.h>
+
+static void armv7_vcpu_initialize(struct vcpu *v)
+{
+    if ( v->domain->max_vcpus > 1 )
Quoted 8 lines

xen/arch/arm/arm32/proc-v7-c.c line 30

Quoted 6 lines
xen/arch/arm/arm32/proc-v7-c.c new file +6 -0
+        v->arch.actlr |= ACTLR_V7_SMP;
+    else
+        v->arch.actlr &= ~ACTLR_V7_SMP;
+}
+
+const struct processor armv7_processor = {

__rodata? (or whatever it is called)

Quoted 3 lines

I forgot to answer to this part. The compiler will put it by default in rodata. Did you want to say __initconst? If so, we can't because I use a pointer to this structure in arch/arm/processor.c

I meant __initconst yes. Leaving it in rodata is fine.

__init indeed doesn't make sense now you make me think of it.

Quoted 2 lines

If we want to save space, we can copy it in another variable in processor_setup.

No need IMHO (at least not yet, maybe if we end up with dozens of these...).

Thanks.

Ian.

#12 lore raw

RFC 5/5 xen/arm: Remove asm-arm/processor-ca{15, 7}.h headers

In reply to Julien Grall

Theses headers are not in the right directory and are not used anymore.

---
 xen/include/asm-arm/processor-ca15.h |   42 ----------------------------------
 xen/include/asm-arm/processor-ca7.h  |   20 ----------------
 2 files changed, 62 deletions(-)
 delete mode 100644 xen/include/asm-arm/processor-ca15.h
 delete mode 100644 xen/include/asm-arm/processor-ca7.h
xen/include/asm-arm/processor-ca15.h deleted +0 -42
deleted file mode 100644
index f65f40a..0000000
@@ -1,42 +0,0 @@
-#ifndef __ASM_ARM_PROCESSOR_CA15_H
-#define __ASM_ARM_PROCESSOR_CA15_H
-
-/* ACTLR Auxiliary Control Register, Cortex A15 */
-#define ACTLR_CA15_SNOOP_DELAYED      (1<<31)
-#define ACTLR_CA15_MAIN_CLOCK         (1<<30)
-#define ACTLR_CA15_NEON_CLOCK         (1<<29)
-#define ACTLR_CA15_NONCACHE           (1<<24)
-#define ACTLR_CA15_INORDER_REQ        (1<<23)
-#define ACTLR_CA15_INORDER_LOAD       (1<<22)
-#define ACTLR_CA15_L2_TLB_PREFETCH    (1<<21)
-#define ACTLR_CA15_L2_IPA_PA_CACHE    (1<<20)
-#define ACTLR_CA15_L2_CACHE           (1<<19)
-#define ACTLR_CA15_L2_PA_CACHE        (1<<18)
-#define ACTLR_CA15_TLB                (1<<17)
-#define ACTLR_CA15_STRONGY_ORDERED    (1<<16)
-#define ACTLR_CA15_INORDER            (1<<15)
-#define ACTLR_CA15_FORCE_LIM          (1<<14)
-#define ACTLR_CA15_CP_FLUSH           (1<<13)
-#define ACTLR_CA15_CP_PUSH            (1<<12)
-#define ACTLR_CA15_LIM                (1<<11)
-#define ACTLR_CA15_SER                (1<<10)
-#define ACTLR_CA15_OPT                (1<<9)
-#define ACTLR_CA15_WFI                (1<<8)
-#define ACTLR_CA15_WFE                (1<<7)
-#define ACTLR_CA15_SMP                (1<<6)
-#define ACTLR_CA15_PLD                (1<<5)
-#define ACTLR_CA15_IP                 (1<<4)
-#define ACTLR_CA15_MICRO_BTB          (1<<3)
-#define ACTLR_CA15_LOOP_ONE           (1<<2)
-#define ACTLR_CA15_LOOP_DISABLE       (1<<1)
-#define ACTLR_CA15_BTB                (1<<0)
-
-#endif /* __ASM_ARM_PROCESSOR_CA15_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/include/asm-arm/processor-ca7.h deleted +0 -20
deleted file mode 100644
index 5048a95..0000000
@@ -1,20 +0,0 @@
-#ifndef __ASM_ARM_PROCESSOR_CA7_H
-#define __ASM_ARM_PROCESSOR_CA7_H
-
-/* ACTLR Auxiliary Control Register, Cortex A7 */
-#define ACTLR_CA7_DDI                 (1<<28)
-#define ACTLR_CA7_DDVM                (1<<15)
-#define ACTLR_CA7_L1RADIS             (1<<12)
-#define ACTLR_CA7_L2RADIS             (1<<11)
-#define ACTLR_CA7_DODMBS              (1<<10)
-#define ACTLR_CA7_SMP                 (1<<6)
-
-#endif /* __ASM_ARM_PROCESSOR_CA7_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
Signature · 1 line
1.7.10.4
Acked-by on v1 5/5
#13 lore raw

Re: [RFC for-4.5 5/5] xen/arm: Remove asm-arm/processor-ca{15, 7}.h headers

Quoted 3 lines · Julien Grall

Theses headers are not in the right directory and are not used anymore.

Although perhaps proc-v7-c.c ought to be using some of these? e.g. ACTLR_CA15_SMP instead of ACTLR_V7_SMP, which now looks to be badly named to me...

#14 lore raw

Re: [RFC for-4.5 5/5] xen/arm: Remove asm-arm/processor-ca{15, 7}.h headers

Hi Ian,

Quoted 10 lines · Ian Campbell
Quoted 3 lines · Julien Grall

Theses headers are not in the right directory and are not used anymore.

Although perhaps proc-v7-c.c ought to be using some of these? e.g. ACTLR_CA15_SMP instead of ACTLR_V7_SMP, which now looks to be badly named to me...

The name ACTLR_CA15_SMP gives the impression that it's only for Cortex A15, rather than A7.

ACTLR_CORTEX_SMP is not better because we may have other cortex in future that do not have the SMP bit in the future.

What about hardcoding the bit, as it will be only use here?

Cheers,

Signature · 1 line
Julien Grall
#15 lore raw

Re: [RFC for-4.5 5/5] xen/arm: Remove asm-arm/processor-ca{15, 7}.h headers

Quoted 14 lines · Julien Grall

Hi Ian,

Quoted 10 lines · Ian Campbell
Quoted 3 lines · Julien Grall

Theses headers are not in the right directory and are not used anymore.

Although perhaps proc-v7-c.c ought to be using some of these? e.g. ACTLR_CA15_SMP instead of ACTLR_V7_SMP, which now looks to be badly named to me...

Quoted 7 lines

The name ACTLR_CA15_SMP gives the impression that it's only for Cortex A15, rather than A7.

ACTLR_CORTEX_SMP is not better because we may have other cortex in future that do not have the SMP bit in the future.

What about hardcoding the bit, as it will be only use here?

Along with a suitable comment I suppose that would be OK in this instance.
Ian.