Skip to contentSkip to conversation

xen/arm: Clean-up traps.c

PATCH In review Julien Grall 5 participants 23 messages Aug 11, 2017 – Aug 21, 2017

lore
Share & tools
lore
#0 lore raw

cover xen/arm: Clean-up traps.c

Hi all,

xen/arch/arm/traps.c is beginning to get very big. This series is moving out the co-processor and sysreg emulate in separate files. This will avoid to grow traps.c when adding more registers emulations (coming soon).

A branch with this series has been pushed:

https://xenbits.xen.org/git-http/people/julieng/xen-unstable.git
branch cleanup-traps-v1

Cheers,

Cc Andrew Cooper <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Wei Liu <[email protected]>

Julien Grall (11):
xen/grant_table: Include mm.h in xen/grant_table.h xen/arm: domain: Re-order the includes alphabetically xen/arm: traps: Re-order the includes alphabetically xen/arm: vgic-v3: Re-order the includes alphabetically xen/arm: vtimer: Re-order the includes alphabetically xen/arm: Move arch/arm/vtimer.h to include/asm-arm/vtimer.h xen/arm: traps: Export a bunch of helpers to handle emulation xen/arm: Move sysreg emulation outside of traps.c xen/arm: Move co-processor emulation outside of traps.c xen/arm: Move sysregs.h in arm64 sub-directory xen/arm: Limit the scope of cpregs.h

 xen/arch/arm/Makefile                      |   1 +
 xen/arch/arm/arm64/Makefile                |   1 +
 xen/arch/arm/arm64/vsysreg.c               | 229 ++++++++++
 xen/arch/arm/domain.c                      |  24 +-
 xen/arch/arm/smp.c                         |   1 -
 xen/arch/arm/traps.c                       | 704 ++---------------------------
 xen/arch/arm/vcpreg.c                      | 452 ++++++++++++++++++
 xen/arch/arm/vgic-v3.c                     |   8 +-
 xen/arch/arm/vtimer.c                      |   9 +-
 xen/include/asm-arm/arm32/processor.h      |   2 +
 xen/include/asm-arm/arm32/traps.h          |  13 +
 xen/include/asm-arm/arm64/processor.h      |   2 +
 xen/include/asm-arm/{ => arm64}/sysregs.h  |  10 +-
 xen/include/asm-arm/arm64/traps.h          |  18 +
 xen/include/asm-arm/percpu.h               |   1 -
 xen/include/asm-arm/processor.h            |   2 -
 xen/include/asm-arm/traps.h                |  43 ++
 xen/{arch/arm => include/asm-arm}/vtimer.h |   0
 xen/include/xen/grant_table.h              |   1 +
 19 files changed, 831 insertions(+), 690 deletions(-)
 create mode 100644 xen/arch/arm/arm64/vsysreg.c
 create mode 100644 xen/arch/arm/vcpreg.c
 create mode 100644 xen/include/asm-arm/arm32/traps.h
 rename xen/include/asm-arm/{ => arm64}/sysregs.h (98%)
 create mode 100644 xen/include/asm-arm/arm64/traps.h
 create mode 100644 xen/include/asm-arm/traps.h
 rename xen/{arch/arm => include/asm-arm}/vtimer.h (100%)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 1/11 xen/grant_table: Include mm.h in xen/grant_table.h

While re-ordering the include alphabetically in arch/arm/domain.c, I got a complitation error because grant_table.h is using gfn_t before been defined:

In file included from domain.c:14:0:
xen/xen/include/xen/grant_table.h:153:29: error: unknown type name ‘gfn_t’

                             gfn_t *gfn, uint16_t *status);
                             ^

Fix it by including xen/mm.h in it.

---

Cc Andrew Cooper <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Wei Liu <[email protected]>
---
 xen/include/xen/grant_table.h | 1 +
 1 file changed, 1 insertion(+)
xen/include/xen/grant_table.h +1 -0
index 4e7789968c..7913facf9f 100644
@@ -23,6 +23,7 @@
 #ifndef __XEN_GRANT_TABLE_H__
 #define __XEN_GRANT_TABLE_H__
 
+#include <xen/mm.h>
 #include <xen/rwlock.h>
 #include <public/grant_table.h>
 #include <asm/page.h>
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/11
#2 lore raw

Re: [PATCH 01/11] xen/grant_table: Include mm.h in xen/grant_table.h

Quoted 5 lines
Quoted 1 line
Quoted 1 line

Julien Grall <[email protected]> 08/11/17 8:03 PM >>>

While re-ordering the include alphabetically in arch/arm/domain.c, I got a complitation error because grant_table.h is using gfn_t before been defined:

Quoted 8 lines

In file included from domain.c:14:0:
xen/xen/include/xen/grant_table.h:153:29: error: unknown type name ‘gfn_t’ gfn_t *gfn, uint16_t *status);
^

Fix it by including xen/mm.h in it.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/11
#3 lore raw

Re: [PATCH 01/11] xen/grant_table: Include mm.h in xen/grant_table.h

In reply to Julien Grall
Quoted 4 lines · Julien Grall

While re-ordering the include alphabetically in arch/arm/domain.c, I got a complitation error because grant_table.h is using gfn_t before been defined:

Quoted 8 lines

In file included from domain.c:14:0:
xen/xen/include/xen/grant_table.h:153:29: error: unknown type name ‘gfn_t’

                             gfn_t *gfn, uint16_t *status);
                             ^

Fix it by including xen/mm.h in it.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

PATCH 2/11 xen/arm: domain: Re-order the includes alphabetically

In reply to Julien Grall
---
 xen/arch/arm/domain.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
xen/arch/arm/domain.c +11 -11
index 2dc8b0ab5a..1d835d321d 100644
@@ -9,6 +9,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#include <xen/bitops.h>
+#include <xen/errno.h>
+#include <xen/grant_table.h>
 #include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/lib.h>
@@ -16,24 +19,21 @@
 #include <xen/sched.h>
 #include <xen/softirq.h>
 #include <xen/wait.h>
-#include <xen/errno.h>
-#include <xen/bitops.h>
-#include <xen/grant_table.h>
 
+#include <asm/alternative.h>
+#include <asm/cpufeature.h>
 #include <asm/current.h>
 #include <asm/event.h>
+#include <asm/gic.h>
 #include <asm/guest_access.h>
-#include <asm/regs.h>
-#include <asm/p2m.h>
 #include <asm/irq.h>
-#include <asm/cpufeature.h>
-#include <asm/vfp.h>
+#include <asm/p2m.h>
+#include <asm/platform.h>
 #include <asm/procinfo.h>
-#include <asm/alternative.h>
-
-#include <asm/gic.h>
+#include <asm/regs.h>
+#include <asm/vfp.h>
 #include <asm/vgic.h>
-#include <asm/platform.h>
+
 #include "vtimer.h"
 #include "vuart.h"
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 2/11
#5 lore raw

Re: [PATCH 02/11] xen/arm: domain: Re-order the includes alphabetically

Quoted 1 line · Julien Grall

and applied

Quoted 54 lines
---
 xen/arch/arm/domain.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
xen/arch/arm/domain.c +11 -11
index 2dc8b0ab5a..1d835d321d 100644
@@ -9,6 +9,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#include <xen/bitops.h>
+#include <xen/errno.h>
+#include <xen/grant_table.h>
 #include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/lib.h>
@@ -16,24 +19,21 @@
 #include <xen/sched.h>
 #include <xen/softirq.h>
 #include <xen/wait.h>
-#include <xen/errno.h>
-#include <xen/bitops.h>
-#include <xen/grant_table.h>
 
+#include <asm/alternative.h>
+#include <asm/cpufeature.h>
 #include <asm/current.h>
 #include <asm/event.h>
+#include <asm/gic.h>
 #include <asm/guest_access.h>
-#include <asm/regs.h>
-#include <asm/p2m.h>
 #include <asm/irq.h>
-#include <asm/cpufeature.h>
-#include <asm/vfp.h>
+#include <asm/p2m.h>
+#include <asm/platform.h>
 #include <asm/procinfo.h>
-#include <asm/alternative.h>
-
-#include <asm/gic.h>
+#include <asm/regs.h>
+#include <asm/vfp.h>
 #include <asm/vgic.h>
-#include <asm/platform.h>
+
 #include "vtimer.h"
 #include "vuart.h"
 
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

PATCH 3/11 xen/arm: traps: Re-order the includes alphabetically

In reply to Julien Grall
---
 xen/arch/arm/traps.c | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)
xen/arch/arm/traps.c +22 -20
index c07999b518..ca9bef712c 100644
@@ -16,41 +16,43 @@
  * GNU General Public License for more details.
  */
 
-#include <xen/init.h>
-#include <xen/string.h>
-#include <xen/version.h>
-#include <xen/smp.h>
-#include <xen/symbols.h>
+#include <xen/domain_page.h>
+#include <xen/errno.h>
+#include <xen/hypercall.h>
 #include <xen/irq.h>
+#include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/lib.h>
 #include <xen/livepatch.h>
+#include <xen/mem_access.h>
 #include <xen/mm.h>
-#include <xen/errno.h>
-#include <xen/hypercall.h>
-#include <xen/softirq.h>
-#include <xen/domain_page.h>
 #include <xen/perfc.h>
+#include <xen/smp.h>
+#include <xen/softirq.h>
+#include <xen/string.h>
+#include <xen/symbols.h>
+#include <xen/version.h>
 #include <xen/virtual_region.h>
-#include <xen/mem_access.h>
-#include <xen/iocap.h>
+
 #include <public/sched.h>
 #include <public/xen.h>
-#include <asm/debugger.h>
-#include <asm/event.h>
-#include <asm/regs.h>
+
+#include <asm/acpi.h>
 #include <asm/cpregs.h>
-#include <asm/psci.h>
-#include <asm/mmio.h>
+#include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
+#include <asm/debugger.h>
+#include <asm/event.h>
 #include <asm/flushtlb.h>
+#include <asm/gic.h>
+#include <asm/psci.h>
 #include <asm/monitor.h>
+#include <asm/mmio.h>
+#include <asm/regs.h>
+#include <asm/vgic.h>
 
 #include "decode.h"
 #include "vtimer.h"
-#include <asm/gic.h>
-#include <asm/vgic.h>
-#include <asm/cpuerrata.h>
-#include <asm/acpi.h>
 
 /* The base of the stack must always be double-word aligned, which means
  * that both the kernel half of struct cpu_user_regs (which is pushed in
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 3/11
#7 lore raw

Re: [PATCH 03/11] xen/arm: traps: Re-order the includes alphabetically

Hi Julien,

Quoted 14 lines · Julien Grall
---
 xen/arch/arm/traps.c | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)
xen/arch/arm/traps.c +0 -1
index c07999b518..ca9bef712c 100644
@@ -16,41 +16,43 @@
  * GNU General Public License for more details.
  */
 
-#include <xen/init.h>

xen/arch/arm/traps.c line 24

Quoted 10 lines
xen/arch/arm/traps.c +5 -4
-#include <xen/string.h>
-#include <xen/version.h>
-#include <xen/smp.h>
-#include <xen/symbols.h>
+#include <xen/domain_page.h>
+#include <xen/errno.h>
+#include <xen/hypercall.h>
 #include <xen/irq.h>
+#include <xen/init.h>
+#include <xen/iocap.h>

The above two files should be before xen/irq.h.

Quoted 27 lines
xen/arch/arm/traps.c +9 -10
 #include <xen/lib.h>
 #include <xen/livepatch.h>
+#include <xen/mem_access.h>
 #include <xen/mm.h>
-#include <xen/errno.h>
-#include <xen/hypercall.h>
-#include <xen/softirq.h>
-#include <xen/domain_page.h>
 #include <xen/perfc.h>
+#include <xen/smp.h>
+#include <xen/softirq.h>
+#include <xen/string.h>
+#include <xen/symbols.h>
+#include <xen/version.h>
 #include <xen/virtual_region.h>
-#include <xen/mem_access.h>
-#include <xen/iocap.h>
+
 #include <public/sched.h>
 #include <public/xen.h>
-#include <asm/debugger.h>
-#include <asm/event.h>
-#include <asm/regs.h>
+
+#include <asm/acpi.h>
 #include <asm/cpregs.h>
-#include <asm/psci.h>

xen/arch/arm/traps.c line 50

Quoted 10 lines
xen/arch/arm/traps.c +6 -1
-#include <asm/mmio.h>
+#include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
+#include <asm/debugger.h>
+#include <asm/event.h>
 #include <asm/flushtlb.h>
+#include <asm/gic.h>
+#include <asm/psci.h>
 #include <asm/monitor.h>
+#include <asm/mmio.h>

The above two files should be before asm/psci.h with asm/mmio.h included first.

Quoted 13 lines
xen/arch/arm/traps.c +2 -5
+#include <asm/regs.h>
+#include <asm/vgic.h>
 
 #include "decode.h"
 #include "vtimer.h"
-#include <asm/gic.h>
-#include <asm/vgic.h>
-#include <asm/cpuerrata.h>
-#include <asm/acpi.h>
 
 /* The base of the stack must always be double-word aligned, which means
  * that both the kernel half of struct cpu_user_regs (which is pushed in
--
Quoted 2 lines

2.11.0

With these two changes.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Re: [PATCH 03/11] xen/arm: traps: Re-order the includes alphabetically

Hi Bhupinder,

Quoted 16 lines · Bhupinder Thakur

Hi Julien,

Quoted 13 lines · Julien Grall
---
 xen/arch/arm/traps.c | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)
xen/arch/arm/traps.c +0 -0
index c07999b518..ca9bef712c 100644
@@ -16,41 +16,43 @@
  * GNU General Public License for more details.
  */
 
Quoted 12 lines

xen/arch/arm/traps.c line 24

Quoted 11 lines
xen/arch/arm/traps.c +5 -5
-#include <xen/init.h>
-#include <xen/string.h>
-#include <xen/version.h>
-#include <xen/smp.h>
-#include <xen/symbols.h>
+#include <xen/domain_page.h>
+#include <xen/errno.h>
+#include <xen/hypercall.h>
 #include <xen/irq.h>
+#include <xen/init.h>
+#include <xen/iocap.h>

The above two files should be before xen/irq.h.

Got my alphabet wrong :/. Thank you for spotting it! I will fix it in the next version.

Quoted 31 lines
Quoted 31 lines
xen/arch/arm/traps.c +10 -11
 #include <xen/lib.h>
 #include <xen/livepatch.h>
+#include <xen/mem_access.h>
 #include <xen/mm.h>
-#include <xen/errno.h>
-#include <xen/hypercall.h>
-#include <xen/softirq.h>
-#include <xen/domain_page.h>
 #include <xen/perfc.h>
+#include <xen/smp.h>
+#include <xen/softirq.h>
+#include <xen/string.h>
+#include <xen/symbols.h>
+#include <xen/version.h>
 #include <xen/virtual_region.h>
-#include <xen/mem_access.h>
-#include <xen/iocap.h>
+
 #include <public/sched.h>
 #include <public/xen.h>
-#include <asm/debugger.h>
-#include <asm/event.h>
-#include <asm/regs.h>
+
+#include <asm/acpi.h>
 #include <asm/cpregs.h>
-#include <asm/psci.h>
-#include <asm/mmio.h>
+#include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
Quoted 8 lines

xen/arch/arm/traps.c line 50

Quoted 7 lines
xen/arch/arm/traps.c +5 -0
+#include <asm/debugger.h>
+#include <asm/event.h>
 #include <asm/flushtlb.h>
+#include <asm/gic.h>
+#include <asm/psci.h>
 #include <asm/monitor.h>
+#include <asm/mmio.h>

The above two files should be before asm/psci.h with asm/mmio.h included first.

Same here :/

Quoted 19 lines
Quoted 14 lines
xen/arch/arm/traps.c +2 -5
+#include <asm/regs.h>
+#include <asm/vgic.h>
 
 #include "decode.h"
 #include "vtimer.h"
-#include <asm/gic.h>
-#include <asm/vgic.h>
-#include <asm/cpuerrata.h>
-#include <asm/acpi.h>
 
 /* The base of the stack must always be double-word aligned, which means
  * that both the kernel half of struct cpu_user_regs (which is pushed in
--
Quoted 2 lines

2.11.0

With these two changes.

Quoted 1 line

Thank you for the review.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#9 lore raw

PATCH 4/11 xen/arm: vgic-v3: Re-order the includes alphabetically

In reply to Julien Grall
---
 xen/arch/arm/vgic-v3.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
xen/arch/arm/vgic-v3.c +4 -3
index 48c7682671..cbeac28b28 100644
@@ -19,16 +19,17 @@
  */
 
 #include <xen/bitops.h>
-#include <xen/lib.h>
 #include <xen/init.h>
-#include <xen/softirq.h>
 #include <xen/irq.h>
+#include <xen/lib.h>
 #include <xen/sched.h>
+#include <xen/softirq.h>
 #include <xen/sizes.h>
+
 #include <asm/current.h>
-#include <asm/mmio.h>
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
+#include <asm/mmio.h>
 #include <asm/vgic.h>
 #include <asm/vgic-emul.h>
 #include <asm/vreg.h>
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 4/11
#10 lore raw

Re: [PATCH 04/11] xen/arm: vgic-v3: Re-order the includes alphabetically

Quoted 1 line · Julien Grall

and applied

Quoted 32 lines
---
 xen/arch/arm/vgic-v3.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
xen/arch/arm/vgic-v3.c +4 -3
index 48c7682671..cbeac28b28 100644
@@ -19,16 +19,17 @@
  */
 
 #include <xen/bitops.h>
-#include <xen/lib.h>
 #include <xen/init.h>
-#include <xen/softirq.h>
 #include <xen/irq.h>
+#include <xen/lib.h>
 #include <xen/sched.h>
+#include <xen/softirq.h>
 #include <xen/sizes.h>
+
 #include <asm/current.h>
-#include <asm/mmio.h>
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
+#include <asm/mmio.h>
 #include <asm/vgic.h>
 #include <asm/vgic-emul.h>
 #include <asm/vreg.h>
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

PATCH 5/11 xen/arm: vtimer: Re-order the includes alphabetically

In reply to Julien Grall
---
 xen/arch/arm/vtimer.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
xen/arch/arm/vtimer.c +5 -4
index 32ac1279ae..9c7e8f441c 100644
@@ -18,16 +18,17 @@
  */
 
 #include <xen/lib.h>
-#include <xen/timer.h>
-#include <xen/sched.h>
 #include <xen/perfc.h>
+#include <xen/sched.h>
+#include <xen/timer.h>
+
 #include <asm/div64.h>
+#include <asm/gic.h>
 #include <asm/irq.h>
+#include <asm/regs.h>
 #include <asm/time.h>
-#include <asm/gic.h>
 #include <asm/vgic.h>
 #include <asm/vreg.h>
-#include <asm/regs.h>
 
 /*
  * Check if regs is allowed access, user_gate is tail end of a
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 5/11
#12 lore raw

Re: [PATCH 05/11] xen/arm: vtimer: Re-order the includes alphabetically

Quoted 1 line · Julien Grall

and applied

Quoted 33 lines
---
 xen/arch/arm/vtimer.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
xen/arch/arm/vtimer.c +5 -4
index 32ac1279ae..9c7e8f441c 100644
@@ -18,16 +18,17 @@
  */
 
 #include <xen/lib.h>
-#include <xen/timer.h>
-#include <xen/sched.h>
 #include <xen/perfc.h>
+#include <xen/sched.h>
+#include <xen/timer.h>
+
 #include <asm/div64.h>
+#include <asm/gic.h>
 #include <asm/irq.h>
+#include <asm/regs.h>
 #include <asm/time.h>
-#include <asm/gic.h>
 #include <asm/vgic.h>
 #include <asm/vreg.h>
-#include <asm/regs.h>
 
 /*
  * Check if regs is allowed access, user_gate is tail end of a
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw

PATCH 6/11 xen/arm: Move arch/arm/vtimer.h to include/asm-arm/vtimer.h

In reply to Julien Grall

It will be necessary to include vtimer.h from subdirectory making the inclusion a bit awkward.

---
 xen/arch/arm/domain.c                      | 2 +-
 xen/arch/arm/traps.c                       | 2 +-
 xen/{arch/arm => include/asm-arm}/vtimer.h | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename xen/{arch/arm => include/asm-arm}/vtimer.h (100%)
xen/arch/arm/domain.c +1 -1
index 1d835d321d..355021e452 100644
@@ -33,8 +33,8 @@
 #include <asm/regs.h>
 #include <asm/vfp.h>
 #include <asm/vgic.h>
+#include <asm/vtimer.h>
 
-#include "vtimer.h"
 #include "vuart.h"
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
xen/arch/arm/traps.c +1 -1
index ca9bef712c..d79e9605b5 100644
@@ -50,9 +50,9 @@
 #include <asm/mmio.h>
 #include <asm/regs.h>
 #include <asm/vgic.h>
+#include <asm/vtimer.h>
 
 #include "decode.h"
-#include "vtimer.h"
 
 /* The base of the stack must always be double-word aligned, which means
  * that both the kernel half of struct cpu_user_regs (which is pushed in
xen/include/asm-arm/vtimer.h renamed from xen/arch/arm/vtimer.h +0 -0
similarity index 100%
rename from xen/arch/arm/vtimer.h
rename to xen/include/asm-arm/vtimer.h
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#14 lore raw

PATCH 7/11 xen/arm: traps: Export a bunch of helpers to handle emulation

In reply to Julien Grall

A follow-up patch will move some parts of traps.c in separate files. The will require to use helpers that are currently statically defined. Export the following helpers:
- inject_undef64_exception
- inject_undef_exception
- check_conditional_instr
- advance_pc
- handle_raz_wi
- handle_wo_wi
- handle_ro_raz

Note that asm-arm/arm32/traps.h is empty but it is to keep parity with the arm64 counterpart.

---

---
 xen/arch/arm/traps.c              | 43 +++++++++++++++++++--------------------
 xen/include/asm-arm/arm32/traps.h | 13 ++++++++++++
 xen/include/asm-arm/arm64/traps.h | 15 ++++++++++++++
 xen/include/asm-arm/traps.h       | 35 +++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 22 deletions(-)
 create mode 100644 xen/include/asm-arm/arm32/traps.h
 create mode 100644 xen/include/asm-arm/arm64/traps.h
 create mode 100644 xen/include/asm-arm/traps.h
xen/arch/arm/traps.c +21 -22
index d79e9605b5..ab56958717 100644
@@ -49,6 +49,7 @@
 #include <asm/monitor.h>
 #include <asm/mmio.h>
 #include <asm/regs.h>
+#include <asm/traps.h>
 #include <asm/vgic.h>
 #include <asm/vtimer.h>
 
@@ -545,7 +546,7 @@ static vaddr_t exception_handler64(struct cpu_user_regs *regs, vaddr_t offset)
 }
 
 /* Inject an undefined exception into a 64 bit guest */
-static void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
 {
     vaddr_t handler;
     const union hsr esr = {
@@ -618,8 +619,7 @@ static void inject_iabt64_exception(struct cpu_user_regs *regs,
 
 #endif
 
-static void inject_undef_exception(struct cpu_user_regs *regs,
-                                   const union hsr hsr)
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr)
 {
         if ( is_32bit_domain(current->domain) )
             inject_undef32_exception(regs);
@@ -1712,8 +1712,7 @@ static const unsigned short cc_map[16] = {
         0                       /* NV                     */
 };
 
-static int check_conditional_instr(struct cpu_user_regs *regs,
-                                   const union hsr hsr)
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr)
 {
     unsigned long cpsr, cpsr_cond;
     int cond;
@@ -1758,7 +1757,7 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
     return 1;
 }
 
-static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
 {
     unsigned long itbits, cond, cpsr = regs->cpsr;
 
@@ -1799,11 +1798,11 @@ static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
 }
 
 /* Read as zero and write ignore */
-static void handle_raz_wi(struct cpu_user_regs *regs,
-                          int regidx,
-                          bool read,
-                          const union hsr hsr,
-                          int min_el)
+void handle_raz_wi(struct cpu_user_regs *regs,
+                   int regidx,
+                   bool read,
+                   const union hsr hsr,
+                   int min_el)
 {
     ASSERT((min_el == 0) || (min_el == 1));
 
@@ -1817,12 +1816,12 @@ static void handle_raz_wi(struct cpu_user_regs *regs,
     advance_pc(regs, hsr);
 }
 
-/* Write only as write ignore */
-static void handle_wo_wi(struct cpu_user_regs *regs,
-                         int regidx,
-                         bool read,
-                         const union hsr hsr,
-                         int min_el)
+/* write only as write ignore */
+void handle_wo_wi(struct cpu_user_regs *regs,
+                  int regidx,
+                  bool read,
+                  const union hsr hsr,
+                  int min_el)
 {
     ASSERT((min_el == 0) || (min_el == 1));
 
@@ -1837,11 +1836,11 @@ static void handle_wo_wi(struct cpu_user_regs *regs,
 }
 
 /* Read only as read as zero */
-static void handle_ro_raz(struct cpu_user_regs *regs,
-                          int regidx,
-                          bool read,
-                          const union hsr hsr,
-                          int min_el)
+void handle_ro_raz(struct cpu_user_regs *regs,
+                   int regidx,
+                   bool read,
+                   const union hsr hsr,
+                   int min_el)
 {
     ASSERT((min_el == 0) || (min_el == 1));
 
xen/include/asm-arm/arm32/traps.h new file +13 -0
new file mode 100644
index 0000000000..e3c4a8b473
@@ -0,0 +1,13 @@
+#ifndef __ASM_ARM32_TRAPS__
+#define __ASM_ARM32_TRAPS__
+
+#endif /* __ASM_ARM32_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-arm/arm64/traps.h new file +15 -0
new file mode 100644
index 0000000000..5cb45df6bd
@@ -0,0 +1,15 @@
+#ifndef __ASM_ARM32_TRAPS__
+#define __ASM_ARM32_TRAPS__
+
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
+
+#endif /* __ASM_ARM32_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-arm/traps.h new file +35 -0
new file mode 100644
index 0000000000..4e227c4dd2
@@ -0,0 +1,35 @@
+#ifndef __ASM_ARM_TRAPS__
+#define __ASM_ARM_TRAPS__
+
+#include <asm/processor.h>
+
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/traps.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/traps.h>
+#endif
+
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr);
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
+
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr);
+
+void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
+                   const union hsr hsr, int min_el);
+
+void handle_wo_wi(struct cpu_user_regs *regs, int regidx, bool read,
+                  const union hsr hsr, int min_el);
+
+void handle_ro_raz(struct cpu_user_regs *regs, int regidx, bool read,
+                   const union hsr hsr, int min_el);
+
+#endif /* __ASM_ARM_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#15 lore raw

Re: [PATCH 07/11] xen/arm: traps: Export a bunch of helpers to handle emulation

Hi Julien,

Quoted 157 lines · Julien Grall

A follow-up patch will move some parts of traps.c in separate files. The will require to use helpers that are currently statically defined. Export the following helpers:
- inject_undef64_exception
- inject_undef_exception
- check_conditional_instr
- advance_pc
- handle_raz_wi
- handle_wo_wi
- handle_ro_raz

Note that asm-arm/arm32/traps.h is empty but it is to keep parity with the arm64 counterpart.

---

---
 xen/arch/arm/traps.c              | 43 +++++++++++++++++++--------------------
 xen/include/asm-arm/arm32/traps.h | 13 ++++++++++++
 xen/include/asm-arm/arm64/traps.h | 15 ++++++++++++++
 xen/include/asm-arm/traps.h       | 35 +++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 22 deletions(-)
 create mode 100644 xen/include/asm-arm/arm32/traps.h
 create mode 100644 xen/include/asm-arm/arm64/traps.h
 create mode 100644 xen/include/asm-arm/traps.h
xen/arch/arm/traps.c +21 -22
index d79e9605b5..ab56958717 100644
@@ -49,6 +49,7 @@
 #include <asm/monitor.h>
 #include <asm/mmio.h>
 #include <asm/regs.h>
+#include <asm/traps.h>
 #include <asm/vgic.h>
 #include <asm/vtimer.h>
 
@@ -545,7 +546,7 @@ static vaddr_t exception_handler64(struct cpu_user_regs *regs, vaddr_t offset)
 }
 
 /* Inject an undefined exception into a 64 bit guest */
-static void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
 {
     vaddr_t handler;
     const union hsr esr = {
@@ -618,8 +619,7 @@ static void inject_iabt64_exception(struct cpu_user_regs *regs,
 
 #endif
 
-static void inject_undef_exception(struct cpu_user_regs *regs,
-                                   const union hsr hsr)
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr)
 {
         if ( is_32bit_domain(current->domain) )
             inject_undef32_exception(regs);
@@ -1712,8 +1712,7 @@ static const unsigned short cc_map[16] = {
         0                       /* NV                     */
 };
 
-static int check_conditional_instr(struct cpu_user_regs *regs,
-                                   const union hsr hsr)
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr)
 {
     unsigned long cpsr, cpsr_cond;
     int cond;
@@ -1758,7 +1757,7 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
     return 1;
 }
 
-static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
 {
     unsigned long itbits, cond, cpsr = regs->cpsr;
 
@@ -1799,11 +1798,11 @@ static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
 }
 
 /* Read as zero and write ignore */
-static void handle_raz_wi(struct cpu_user_regs *regs,
-                          int regidx,
-                          bool read,
-                          const union hsr hsr,
-                          int min_el)
+void handle_raz_wi(struct cpu_user_regs *regs,
+                   int regidx,
+                   bool read,
+                   const union hsr hsr,
+                   int min_el)
 {
     ASSERT((min_el == 0) || (min_el == 1));
 
@@ -1817,12 +1816,12 @@ static void handle_raz_wi(struct cpu_user_regs *regs,
     advance_pc(regs, hsr);
 }
 
-/* Write only as write ignore */
-static void handle_wo_wi(struct cpu_user_regs *regs,
-                         int regidx,
-                         bool read,
-                         const union hsr hsr,
-                         int min_el)
+/* write only as write ignore */
+void handle_wo_wi(struct cpu_user_regs *regs,
+                  int regidx,
+                  bool read,
+                  const union hsr hsr,
+                  int min_el)
 {
     ASSERT((min_el == 0) || (min_el == 1));
 
@@ -1837,11 +1836,11 @@ static void handle_wo_wi(struct cpu_user_regs *regs,
 }
 
 /* Read only as read as zero */
-static void handle_ro_raz(struct cpu_user_regs *regs,
-                          int regidx,
-                          bool read,
-                          const union hsr hsr,
-                          int min_el)
+void handle_ro_raz(struct cpu_user_regs *regs,
+                   int regidx,
+                   bool read,
+                   const union hsr hsr,
+                   int min_el)
 {
     ASSERT((min_el == 0) || (min_el == 1));
 
xen/include/asm-arm/arm32/traps.h new file +13 -0
new file mode 100644
index 0000000000..e3c4a8b473
@@ -0,0 +1,13 @@
+#ifndef __ASM_ARM32_TRAPS__
+#define __ASM_ARM32_TRAPS__
+
+#endif /* __ASM_ARM32_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-arm/arm64/traps.h new file +0 -0
new file mode 100644
index 0000000000..5cb45df6bd

xen/include/asm-arm/arm64/traps.h line 2

Quoted 2 lines
xen/include/asm-arm/arm64/traps.h new file +2 -0
@@ -0,0 +1,15 @@
+#ifndef __ASM_ARM32_TRAPS__
+#define __ASM_ARM32_TRAPS__

I think it should be __ASM_ARM64_TRAPS__ here.

Quoted 21 lines
xen/include/asm-arm/arm64/traps.h new file +13 -0
+
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
+
+#endif /* __ASM_ARM32_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-arm/traps.h new file +2 -0
new file mode 100644
index 0000000000..4e227c4dd2
@@ -0,0 +1,35 @@
+#ifndef __ASM_ARM_TRAPS__
+#define __ASM_ARM_TRAPS__

xen/include/asm-arm/traps.h line 12

Quoted 10 lines
xen/include/asm-arm/traps.h new file +10 -0
+
+#include <asm/processor.h>
+
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/traps.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/traps.h>
+#endif
+
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr);

a newline can be added here.

Quoted 24 lines
xen/include/asm-arm/traps.h new file +23 -1
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
+
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr);
+
+void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
+                   const union hsr hsr, int min_el);
+
+void handle_wo_wi(struct cpu_user_regs *regs, int regidx, bool read,
+                  const union hsr hsr, int min_el);
+
+void handle_ro_raz(struct cpu_user_regs *regs, int regidx, bool read,
+                   const union hsr hsr, int min_el);
+
+#endif /* __ASM_ARM_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
--
Quoted 2 lines

2.11.0

Regards,
Bhupinder

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw

Re: [PATCH 07/11] xen/arm: traps: Export a bunch of helpers to handle emulation

Quoted 1 line · Bhupinder Thakur

Hi Julien,

Hi Bhupinder,

Quoted 11 lines · Julien Grall

xen/include/asm-arm/arm64/traps.h line 2

Quoted 8 lines
xen/include/asm-arm/arm64/traps.h new file +2 -0
new file mode 100644
index 0000000000..5cb45df6bd
@@ -0,0 +1,15 @@
+#ifndef __ASM_ARM32_TRAPS__
+#define __ASM_ARM32_TRAPS__

I think it should be __ASM_ARM64_TRAPS__ here.

Hmmm yes and ...

Quoted 5 lines

xen/include/asm-arm/arm64/traps.h line 6

Quoted 5 lines
xen/include/asm-arm/arm64/traps.h new file +4 -0
+
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
+
+#endif /* __ASM_ARM32_TRAPS__ */

here too. I will fix it in the next version.

Quoted 20 lines
Quoted 20 lines
xen/include/asm-arm/arm64/traps.h new file +9 -0
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-arm/traps.h new file +5 -0
new file mode 100644
index 0000000000..4e227c4dd2
@@ -0,0 +1,35 @@
+#ifndef __ASM_ARM_TRAPS__
+#define __ASM_ARM_TRAPS__
+
+#include <asm/processor.h>
+
Quoted 8 lines

xen/include/asm-arm/traps.h line 12

Quoted 7 lines
xen/include/asm-arm/traps.h new file +7 -0
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/traps.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/traps.h>
+#endif
+
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr);

a newline can be added here.

I will do that.

Quoted 19 lines
Quoted 19 lines
xen/include/asm-arm/traps.h new file +18 -0
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
+
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr);
+
+void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
+                   const union hsr hsr, int min_el);
+
+void handle_wo_wi(struct cpu_user_regs *regs, int regidx, bool read,
+                  const union hsr hsr, int min_el);
+
+void handle_ro_raz(struct cpu_user_regs *regs, int regidx, bool read,
+                   const union hsr hsr, int min_el);
+
+#endif /* __ASM_ARM_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
Quoted 8 lines
Quoted 8 lines
xen/include/asm-arm/traps.h new file +5 -1
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
--

2.11.0

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#17 lore raw

PATCH 8/11 xen/arm: Move sysreg emulation outside of traps.c

In reply to Julien Grall

The sysreg emulation is 64-bit specific and surrounded by #ifdef. Move them in a separate file arm/arm64/vsysreg.c to shrink down a bit traps.c

No functional change.

---
 xen/arch/arm/arm64/Makefile       |   1 +
 xen/arch/arm/arm64/vsysreg.c      | 229 ++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/traps.c              | 198 --------------------------------
 xen/include/asm-arm/arm64/traps.h |   3 +
 4 files changed, 233 insertions(+), 198 deletions(-)
 create mode 100644 xen/arch/arm/arm64/vsysreg.c
xen/arch/arm/arm64/Makefile +1 -0
index 149b6b3901..718fe44455 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
+obj-y += vsysreg.o
xen/arch/arm/arm64/vsysreg.c new file +229 -0

229 lines not on this page · raw message

xen/arch/arm/traps.c +0 -198

204 lines not on this page · raw message

xen/include/asm-arm/arm64/traps.h +3 -0
index 5cb45df6bd..27145d2589 100644
@@ -3,6 +3,9 @@
 
 void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
 
+void do_sysreg(struct cpu_user_regs *regs,
+               const union hsr hsr);
+
 #endif /* __ASM_ARM32_TRAPS__ */
 /*
  * Local variables:
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#18 lore raw

PATCH 9/11 xen/arm: Move co-processor emulation outside of traps.c

In reply to Julien Grall

The co-processor emulation is quite big and pretty much standalone. Move it in a separate file to shrink down the size of traps.c.

At the same time remove unused cpregs.h.

No functional change.

---
 xen/arch/arm/Makefile       |   1 +
 xen/arch/arm/traps.c        | 421 -----------------------------------------
 xen/arch/arm/vcpreg.c       | 451 ++++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/traps.h |   8 +
 4 files changed, 460 insertions(+), 421 deletions(-)
 create mode 100644 xen/arch/arm/vcpreg.c
xen/arch/arm/Makefile +1 -0
index 49e1fb2f84..de00c5e339 100644
@@ -44,6 +44,7 @@ obj-y += smpboot.o
 obj-y += sysctl.o
 obj-y += time.o
 obj-y += traps.o
+obj-y += vcpreg.o
 obj-y += vgic.o
 obj-y += vgic-v2.o
 obj-$(CONFIG_HAS_GICV3) += vgic-v3.o
xen/arch/arm/traps.c +0 -421

433 lines not on this page · raw message

xen/arch/arm/vcpreg.c new file +451 -0

451 lines not on this page · raw message

xen/include/asm-arm/traps.h +8 -0
index 4e227c4dd2..f88cbf6ae3 100644
@@ -23,6 +23,14 @@ void handle_wo_wi(struct cpu_user_regs *regs, int regidx, bool read,
 void handle_ro_raz(struct cpu_user_regs *regs, int regidx, bool read,
                    const union hsr hsr, int min_el);
 
+/* Co-processor registers emulation (see arch/arm/vcpreg.c). */
+void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr);
+void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr);
+void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr);
+void do_cp14_64(struct cpu_user_regs *regs, const union hsr hsr);
+void do_cp14_dbg(struct cpu_user_regs *regs, const union hsr hsr);
+void do_cp(struct cpu_user_regs *regs, const union hsr hsr);
+
 #endif /* __ASM_ARM_TRAPS__ */
 /*
  * Local variables:
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#19 lore raw

PATCH 10/11 xen/arm: Move sysregs.h in arm64 sub-directory

In reply to Julien Grall

sysregs.h contains only code protected by #ifdef CONFIG_ARM_64. Move it in arm64 sub-directory to reflect that and remove the #ifdef.

At the same time, fixup the guards.

---
 xen/include/asm-arm/arm64/processor.h     |  2 ++
 xen/include/asm-arm/{ => arm64}/sysregs.h | 10 +++-------
 xen/include/asm-arm/processor.h           |  1 -
 3 files changed, 5 insertions(+), 8 deletions(-)
 rename xen/include/asm-arm/{ => arm64}/sysregs.h (98%)
xen/include/asm-arm/arm64/processor.h +2 -0
index 24f836b023..c18ab7203d 100644
@@ -3,6 +3,8 @@
 
 #include <xen/stringify.h>
 
+#include <asm/arm64/sysregs.h>
+
 #ifndef __ASSEMBLY__
 
 /* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */
xen/include/asm-arm/arm64/sysregs.h renamed from xen/include/asm-arm/sysregs.h +3 -7
similarity index 98%
rename from xen/include/asm-arm/sysregs.h
rename to xen/include/asm-arm/arm64/sysregs.h
index 887368e248..084d2a1e5d 100644
@@ -1,7 +1,5 @@
-#ifndef __ASM_ARM_SYSREGS_H
-#define __ASM_ARM_SYSREGS_H
-
-#ifdef CONFIG_ARM_64
+#ifndef __ASM_ARM_ARM64_SYSREGS_H
+#define __ASM_ARM_ARM64_SYSREGS_H
 
 #include <xen/stringify.h>
 
@@ -168,9 +166,7 @@
 #define ICH_AP1R2_EL2             __AP1Rx_EL2(2)
 #define ICH_AP1R3_EL2             __AP1Rx_EL2(3)
 
-#endif
-
-#endif
+#endif /* _ASM_ARM_ARM64_SYSREGS_H */
 
 /*
  * Local variables:
xen/include/asm-arm/processor.h +0 -1
index 855ded1b07..9eacb1be29 100644
@@ -2,7 +2,6 @@
 #define __ASM_ARM_PROCESSOR_H
 
 #include <asm/cpregs.h>
-#include <asm/sysregs.h>
 #ifndef __ASSEMBLY__
 #include <xen/types.h>
 #endif
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#20 lore raw

PATCH 11/11 xen/arm: Limit the scope of cpregs.h

In reply to Julien Grall

Currently, cpregs.h is included in pretty much every files even for arm64. However, the only use for arm64 is when emulating co-processors.

For arm32, cpregs.h rely on the presence of processor.h (define *_SYSREG helpers). So move the inclusion in asm-arm/arm32/processor.h.

cpregs.h will also be directly included in the co-processors emulation to accomodate arm64.

---
 xen/arch/arm/smp.c                    | 1 -
 xen/arch/arm/vcpreg.c                 | 1 +
 xen/arch/arm/vgic-v3.c                | 1 +
 xen/arch/arm/vtimer.c                 | 2 ++
 xen/include/asm-arm/arm32/processor.h | 2 ++
 xen/include/asm-arm/percpu.h          | 1 -
 xen/include/asm-arm/processor.h       | 1 -
 7 files changed, 6 insertions(+), 3 deletions(-)
xen/arch/arm/smp.c +0 -1
index e7df0874d6..554f4992e6 100644
@@ -1,6 +1,5 @@
 #include <asm/system.h>
 #include <asm/smp.h>
-#include <asm/cpregs.h>
 #include <asm/page.h>
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
xen/arch/arm/vcpreg.c +1 -0
index f3b08403fb..e363183ba8 100644
@@ -18,6 +18,7 @@
 
 #include <xen/sched.h>
 
+#include <asm/cpregs.h>
 #include <asm/current.h>
 #include <asm/regs.h>
 #include <asm/traps.h>
xen/arch/arm/vgic-v3.c +1 -0
index cbeac28b28..a0cf993d13 100644
@@ -26,6 +26,7 @@
 #include <xen/softirq.h>
 #include <xen/sizes.h>
 
+#include <asm/cpregs.h>
 #include <asm/current.h>
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
xen/arch/arm/vtimer.c +2 -0
index 9c7e8f441c..0460962f08 100644
@@ -22,6 +22,7 @@
 #include <xen/sched.h>
 #include <xen/timer.h>
 
+#include <asm/cpregs.h>
 #include <asm/div64.h>
 #include <asm/gic.h>
 #include <asm/irq.h>
@@ -29,6 +30,7 @@
 #include <asm/time.h>
 #include <asm/vgic.h>
 #include <asm/vreg.h>
+#include <asm/regs.h>
 
 /*
  * Check if regs is allowed access, user_gate is tail end of a
xen/include/asm-arm/arm32/processor.h +2 -0
index 68cc82147e..fb330812af 100644
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARM_ARM32_PROCESSOR_H
 #define __ASM_ARM_ARM32_PROCESSOR_H
 
+#include <asm/cpregs.h>
+
 #define ACTLR_CAXX_SMP      (1<<6)
 
 #ifndef __ASSEMBLY__
xen/include/asm-arm/percpu.h +0 -1
index 7968532462..cdf64e0f77 100644
@@ -4,7 +4,6 @@
 #ifndef __ASSEMBLY__
 
 #include <xen/types.h>
-#include <asm/cpregs.h>
 #if defined(CONFIG_ARM_32)
 # include <asm/arm32/processor.h>
 #elif defined(CONFIG_ARM_64)
xen/include/asm-arm/processor.h +0 -1
index 9eacb1be29..51ce802063 100644
@@ -1,7 +1,6 @@
 #ifndef __ASM_ARM_PROCESSOR_H
 #define __ASM_ARM_PROCESSOR_H
 
-#include <asm/cpregs.h>
 #ifndef __ASSEMBLY__
 #include <xen/types.h>
 #endif
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#21 lore raw

Re: [PATCH 11/11] xen/arm: Limit the scope of cpregs.h

Hi Julien,

Quoted 6 lines · Julien Grall

Currently, cpregs.h is included in pretty much every files even for arm64. However, the only use for arm64 is when emulating co-processors.

For arm32, cpregs.h rely on the presence of processor.h (define *_SYSREG helpers). So move the inclusion in asm-arm/arm32/processor.h.

Should it say that processor.h relies on cpregs.h instead of the other way round because processor.h
includes cpregs.h?

Quoted 107 lines

cpregs.h will also be directly included in the co-processors emulation to accomodate arm64.

---
 xen/arch/arm/smp.c                    | 1 -
 xen/arch/arm/vcpreg.c                 | 1 +
 xen/arch/arm/vgic-v3.c                | 1 +
 xen/arch/arm/vtimer.c                 | 2 ++
 xen/include/asm-arm/arm32/processor.h | 2 ++
 xen/include/asm-arm/percpu.h          | 1 -
 xen/include/asm-arm/processor.h       | 1 -
 7 files changed, 6 insertions(+), 3 deletions(-)
xen/arch/arm/smp.c +0 -1
index e7df0874d6..554f4992e6 100644
@@ -1,6 +1,5 @@
 #include <asm/system.h>
 #include <asm/smp.h>
-#include <asm/cpregs.h>
 #include <asm/page.h>
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
xen/arch/arm/vcpreg.c +1 -0
index f3b08403fb..e363183ba8 100644
@@ -18,6 +18,7 @@
 
 #include <xen/sched.h>
 
+#include <asm/cpregs.h>
 #include <asm/current.h>
 #include <asm/regs.h>
 #include <asm/traps.h>
xen/arch/arm/vgic-v3.c +1 -0
index cbeac28b28..a0cf993d13 100644
@@ -26,6 +26,7 @@
 #include <xen/softirq.h>
 #include <xen/sizes.h>
 
+#include <asm/cpregs.h>
 #include <asm/current.h>
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
xen/arch/arm/vtimer.c +2 -0
index 9c7e8f441c..0460962f08 100644
@@ -22,6 +22,7 @@
 #include <xen/sched.h>
 #include <xen/timer.h>
 
+#include <asm/cpregs.h>
 #include <asm/div64.h>
 #include <asm/gic.h>
 #include <asm/irq.h>
@@ -29,6 +30,7 @@
 #include <asm/time.h>
 #include <asm/vgic.h>
 #include <asm/vreg.h>
+#include <asm/regs.h>
 
 /*
  * Check if regs is allowed access, user_gate is tail end of a
xen/include/asm-arm/arm32/processor.h +2 -0
index 68cc82147e..fb330812af 100644
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARM_ARM32_PROCESSOR_H
 #define __ASM_ARM_ARM32_PROCESSOR_H
 
+#include <asm/cpregs.h>
+
 #define ACTLR_CAXX_SMP      (1<<6)
 
 #ifndef __ASSEMBLY__
xen/include/asm-arm/percpu.h +0 -1
index 7968532462..cdf64e0f77 100644
@@ -4,7 +4,6 @@
 #ifndef __ASSEMBLY__
 
 #include <xen/types.h>
-#include <asm/cpregs.h>
 #if defined(CONFIG_ARM_32)
 # include <asm/arm32/processor.h>
 #elif defined(CONFIG_ARM_64)
xen/include/asm-arm/processor.h +0 -2
index 9eacb1be29..51ce802063 100644
@@ -1,7 +1,6 @@
 #ifndef __ASM_ARM_PROCESSOR_H
 #define __ASM_ARM_PROCESSOR_H
 
-#include <asm/cpregs.h>
 #ifndef __ASSEMBLY__
 #include <xen/types.h>
 #endif
--
Quoted 2 lines

2.11.0

Regards,
Bhupinder

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#22 lore raw

Re: [PATCH 11/11] xen/arm: Limit the scope of cpregs.h

Quoted 1 line · Bhupinder Thakur

Hi Julien,

Hi Bhupinder,

Quoted 10 lines · Julien Grall
Quoted 6 lines

Currently, cpregs.h is included in pretty much every files even for arm64. However, the only use for arm64 is when emulating co-processors.

For arm32, cpregs.h rely on the presence of processor.h (define *_SYSREG helpers). So move the inclusion in asm-arm/arm32/processor.h.

Should it say that processor.h relies on cpregs.h instead of the other way round because processor.h
includes cpregs.h?

I can reword to "For arm32, all the users of processor.h expects cpregs.h to be included in order to access co-processors. So move the inclusion in ....".

Quoted 3 lines
Quoted 3 lines

cpregs.h will also be directly included in the co-processors emulation to accomodate arm64.

Just noticed a typo here. I will fix it.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel