kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: Shannon Zhao <shannon.zhao@linux.alibaba.com>
To: kvmarm@lists.cs.columbia.edu, maz@kernel.org,
	james.morse@arm.com, suzuki.poulose@arm.com,
	christoffer.dall@arm.com
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 6/7] KVM: arm/arm64: Move target table register into register table init function
Date: Thu, 24 Oct 2019 18:27:49 +0800	[thread overview]
Message-ID: <1571912870-18471-7-git-send-email-shannon.zhao@linux.alibaba.com> (raw)
In-Reply-To: <1571912870-18471-1-git-send-email-shannon.zhao@linux.alibaba.com>

This prepares for making kvm arm compile as a module.

Signed-off-by: Shannon Zhao <shannon.zhao@linux.alibaba.com>
---
 arch/arm/kvm/coproc.c                | 3 +++
 arch/arm/kvm/coproc.h                | 3 +++
 arch/arm/kvm/coproc_a15.c            | 4 +---
 arch/arm/kvm/coproc_a7.c             | 4 +---
 arch/arm64/kvm/sys_regs.c            | 1 +
 arch/arm64/kvm/sys_regs.h            | 2 ++
 arch/arm64/kvm/sys_regs_generic_v8.c | 5 +----
 7 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 07745ee..58e48b1 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -1404,6 +1404,9 @@ void kvm_coproc_table_init(void)
 {
 	unsigned int i;
 
+	coproc_a7_init();
+	coproc_a15_init();
+
 	/* Make sure tables are unique and in order. */
 	BUG_ON(check_reg_table(cp15_regs, ARRAY_SIZE(cp15_regs)));
 	BUG_ON(check_reg_table(invariant_cp15, ARRAY_SIZE(invariant_cp15)));
diff --git a/arch/arm/kvm/coproc.h b/arch/arm/kvm/coproc.h
index 637065b..592118c 100644
--- a/arch/arm/kvm/coproc.h
+++ b/arch/arm/kvm/coproc.h
@@ -127,4 +127,7 @@ bool access_vm_reg(struct kvm_vcpu *vcpu,
 		   const struct coproc_params *p,
 		   const struct coproc_reg *r);
 
+void coproc_a7_init(void);
+void coproc_a15_init(void);
+
 #endif /* __ARM_KVM_COPROC_LOCAL_H__ */
diff --git a/arch/arm/kvm/coproc_a15.c b/arch/arm/kvm/coproc_a15.c
index 36bf154..ece74b2f 100644
--- a/arch/arm/kvm/coproc_a15.c
+++ b/arch/arm/kvm/coproc_a15.c
@@ -31,9 +31,7 @@
 	.num = ARRAY_SIZE(a15_regs),
 };
 
-static int __init coproc_a15_init(void)
+void coproc_a15_init(void)
 {
 	kvm_register_target_coproc_table(&a15_target_table);
-	return 0;
 }
-late_initcall(coproc_a15_init);
diff --git a/arch/arm/kvm/coproc_a7.c b/arch/arm/kvm/coproc_a7.c
index 40f643e..74616f5 100644
--- a/arch/arm/kvm/coproc_a7.c
+++ b/arch/arm/kvm/coproc_a7.c
@@ -34,9 +34,7 @@
 	.num = ARRAY_SIZE(a7_regs),
 };
 
-static int __init coproc_a7_init(void)
+void coproc_a7_init(void)
 {
 	kvm_register_target_coproc_table(&a7_target_table);
-	return 0;
 }
-late_initcall(coproc_a7_init);
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 2071260..9dd164d 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -2738,6 +2738,7 @@ void kvm_sys_reg_table_init(void)
 	unsigned int i;
 	struct sys_reg_desc clidr;
 
+	sys_reg_genericv8_init();
 	/* Make sure tables are unique and in order. */
 	BUG_ON(check_sysreg_table(sys_reg_descs, ARRAY_SIZE(sys_reg_descs)));
 	BUG_ON(check_sysreg_table(cp14_regs, ARRAY_SIZE(cp14_regs)));
diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h
index 9bca031..f11cb63 100644
--- a/arch/arm64/kvm/sys_regs.h
+++ b/arch/arm64/kvm/sys_regs.h
@@ -140,6 +140,8 @@ const struct sys_reg_desc *find_reg_by_id(u64 id,
 					  const struct sys_reg_desc table[],
 					  unsigned int num);
 
+void sys_reg_genericv8_init(void);
+
 #define Op0(_x) 	.Op0 = _x
 #define Op1(_x) 	.Op1 = _x
 #define CRn(_x)		.CRn = _x
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c
index 2b4a3e2..3e4bacd 100644
--- a/arch/arm64/kvm/sys_regs_generic_v8.c
+++ b/arch/arm64/kvm/sys_regs_generic_v8.c
@@ -61,7 +61,7 @@ static void reset_actlr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
 	},
 };
 
-static int __init sys_reg_genericv8_init(void)
+void sys_reg_genericv8_init(void)
 {
 	unsigned int i;
 
@@ -81,7 +81,4 @@ static int __init sys_reg_genericv8_init(void)
 					  &genericv8_target_table);
 	kvm_register_target_sys_reg_table(KVM_ARM_TARGET_GENERIC_V8,
 					  &genericv8_target_table);
-
-	return 0;
 }
-late_initcall(sys_reg_genericv8_init);
-- 
1.8.3.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  parent reply	other threads:[~2019-10-24 12:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 10:27 [PATCH RFC 0/7] Support KVM being compiled as a kernel module on arm64 Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 1/7] KVM: ARM: call hyp_cpu_pm_exit on correct fail and exit path Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 2/7] KVM: arch_timer: Fix resource leak on error path Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 3/7] KVM: vgic: make vgic parameters work well for module Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 4/7] KVM: vgic: Add hyp uninitialize function Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 5/7] KVM: arch_timer: " Shannon Zhao
2019-10-24 10:27 ` Shannon Zhao [this message]
2019-10-24 10:27 ` [PATCH RFC 7/7] KVM: ARM: Support KVM being compiled as a kernel module Shannon Zhao
2019-10-24 10:58 ` [PATCH RFC 0/7] Support KVM being compiled as a kernel module on arm64 James Morse
2019-10-24 13:41   ` Marc Zyngier
2019-10-25  2:48     ` Shannon Zhao
2019-10-25 10:12       ` Christoffer Dall
2019-10-25 10:43       ` Marc Zyngier
2019-10-25  2:24   ` Shannon Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1571912870-18471-7-git-send-email-shannon.zhao@linux.alibaba.com \
    --to=shannon.zhao@linux.alibaba.com \
    --cc=christoffer.dall@arm.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).