Skip to contentSkip to conversation

target-arm: Split cp helper API to new C file

PATCH In review Peter Crosthwaite 3 participants 3 messages Jun 15, 2015 – Jun 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-arm: Split cp helper API to new C file

Move the ARM coprocessor API to a new C file. helper.c is huge and splitting off this self contained piece increases modularity.

---
I also need this for multi-arch where, this file needs to remain obj-y while the others in target-arm are converted to arch-obj-y. This is because these are the only APIs that are directly callable from system level code.

---
 dtc                      |   2 +-
 target-arm/Makefile.objs |   1 +
 target-arm/cp.c          | 330 +++++++++++++++++++++++++++++++++++++++++++++++
 target-arm/helper.c      | 326 ----------------------------------------------
 4 files changed, 332 insertions(+), 327 deletions(-)
 create mode 100644 target-arm/cp.c
dtc +1 -1
index 65cc4d2..bc895d6 160000
@@ -1 +1 @@
-Subproject commit 65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf
+Subproject commit bc895d6d09695d05ceb8b52486ffe861d6cfbdde
target-arm/Makefile.objs +1 -0
index 9460b40..6d9f62e 100644
@@ -5,6 +5,7 @@ obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o
 obj-$(call land,$(CONFIG_KVM),$(TARGET_AARCH64)) += kvm64.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 obj-y += translate.o op_helper.o helper.o cpu.o
+obj-y += cp.o
 obj-y += neon_helper.o iwmmxt_helper.o
 obj-y += gdbstub.o
 obj-$(CONFIG_SOFTMMU) += psci.o
target-arm/cp.c new file +330 -0

330 lines not on this page · raw message

target-arm/helper.c +0 -326

338 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 9 lines · Peter Crosthwaite

Move the ARM coprocessor API to a new C file. helper.c is huge and splitting off this self contained piece increases modularity.

---
I also need this for multi-arch where, this file needs to remain obj-y while the others in target-arm are converted to arch-obj-y. This is because these are the only APIs that are directly callable from system level code.

Quoted 7 lines
---
 dtc                      |   2 +-
 target-arm/Makefile.objs |   1 +
 target-arm/cp.c          | 330 +++++++++++++++++++++++++++++++++++++++++++++++
 target-arm/helper.c      | 326 ----------------------------------------------
 4 files changed, 332 insertions(+), 327 deletions(-)
 create mode 100644 target-arm/cp.c

I've wondered before about splitting this out, but we haven't had a good enough reason to justify the inevitable breaking of patches in flight before.

I don't understand where your dividing line is between code that's been moved and code that hasn't, though: why do we only need to move the registration functions, but not the code that calls those registration functions, and not the actual data we register or the functions those cpreg structures define to be called from translated code (except for the read-zero/write-ignore functions, which you have moved). Can you clarify?

dtc line 1

Quoted 7 lines
dtc +1 -1
index 65cc4d2..bc895d6 160000
@@ -1 +1 @@
-Subproject commit 65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf
+Subproject commit bc895d6d09695d05ceb8b52486ffe861d6cfbdde

Stray submodule change.

thanks
-- PMM

#2 lore raw
Quoted 22 lines · Peter Maydell
Quoted 9 lines · Peter Crosthwaite

Move the ARM coprocessor API to a new C file. helper.c is huge and splitting off this self contained piece increases modularity.

---
I also need this for multi-arch where, this file needs to remain obj-y while the others in target-arm are converted to arch-obj-y. This is because these are the only APIs that are directly callable from system level code.

Quoted 7 lines
---
 dtc                      |   2 +-
 target-arm/Makefile.objs |   1 +
 target-arm/cp.c          | 330 +++++++++++++++++++++++++++++++++++++++++++++++
 target-arm/helper.c      | 326 ----------------------------------------------
 4 files changed, 332 insertions(+), 327 deletions(-)
 create mode 100644 target-arm/cp.c

I've wondered before about splitting this out, but we haven't had a good enough reason to justify the inevitable breaking of patches in flight before.

Quoted 9 lines

I don't understand where your dividing line is between code that's been moved and code that hasn't, though: why do we only need to move the registration functions, but not the code that calls those registration functions, and not the actual data we register or the functions those cpreg structures define to be called from translated code (except for the read-zero/write-ignore functions, which you have moved). Can you clarify?

My criteria is APIs that are called outside of target-arm/:

[pcrost@xsjsorenbubuntu arm]$ git grep cp_reg .
pxa2xx.c:370: define_arm_cp_regs_with_opaque(s->cpu, pxa_cp_reginfo, s);
pxa2xx_pic.c:290: define_arm_cp_regs_with_opaque(cpu, pxa_pic_cp_reginfo, s);

The goal is to split of universally accessible APIs from those private to target-arm. Note arm_cp_read_zero is refd by PXA cp reg definitions leading to that anomaly on the RAZWI functions.

After this patch nothing outside target-arm/ calls into helper.c.

Splitting just the registration-core might be a good start, as in-flight patches to that are rare. With the core migrated the different cpreg defs can be migrated gradually if we want to do your longer list of movements.

Quoted 10 lines

dtc line 1

Quoted 7 lines
dtc +1 -1
index 65cc4d2..bc895d6 160000
@@ -1 +1 @@
-Subproject commit 65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf
+Subproject commit bc895d6d09695d05ceb8b52486ffe861d6cfbdde

Stray submodule change.

Doh.

Regards,
Peter

Quoted 3 lines

thanks
-- PMM