From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/29] ARM: KVM: convert GP registers from u32 to unsigned long
Date: Tue, 5 Mar 2013 02:42:55 +0000 [thread overview]
Message-ID: <1362451403-23460-2-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1362451403-23460-1-git-send-email-marc.zyngier@arm.com>
On 32bit ARM, unsigned long is guaranteed to be a 32bit quantity.
On 64bit ARM, it is a 64bit quantity.
In order to be able to share code between the two architectures,
convert the registers to be unsigned long, so the core code can
be oblivious of the change.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/kvm_emulate.h | 12 ++++++------
arch/arm/include/uapi/asm/kvm.h | 12 ++++++------
arch/arm/kvm/coproc.c | 4 ++--
arch/arm/kvm/coproc.h | 4 ++--
arch/arm/kvm/emulate.c | 22 +++++++++++-----------
arch/arm/kvm/mmio.c | 2 +-
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index fd61199..510488a 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -23,8 +23,8 @@
#include <asm/kvm_asm.h>
#include <asm/kvm_mmio.h>
-u32 *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
-u32 *vcpu_spsr(struct kvm_vcpu *vcpu);
+unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
+unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);
int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run);
void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);
@@ -37,14 +37,14 @@ static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
return 1;
}
-static inline u32 *vcpu_pc(struct kvm_vcpu *vcpu)
+static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
{
- return (u32 *)&vcpu->arch.regs.usr_regs.ARM_pc;
+ return &vcpu->arch.regs.usr_regs.ARM_pc;
}
-static inline u32 *vcpu_cpsr(struct kvm_vcpu *vcpu)
+static inline unsigned long *vcpu_cpsr(struct kvm_vcpu *vcpu)
{
- return (u32 *)&vcpu->arch.regs.usr_regs.ARM_cpsr;
+ return &vcpu->arch.regs.usr_regs.ARM_cpsr;
}
static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu)
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
index 023bfeb..c1ee007 100644
--- a/arch/arm/include/uapi/asm/kvm.h
+++ b/arch/arm/include/uapi/asm/kvm.h
@@ -53,12 +53,12 @@
#define KVM_ARM_FIQ_spsr fiq_regs[7]
struct kvm_regs {
- struct pt_regs usr_regs;/* R0_usr - R14_usr, PC, CPSR */
- __u32 svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */
- __u32 abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */
- __u32 und_regs[3]; /* SP_und, LR_und, SPSR_und */
- __u32 irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */
- __u32 fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */
+ struct pt_regs usr_regs; /* R0_usr - R14_usr, PC, CPSR */
+ unsigned long svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */
+ unsigned long abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */
+ unsigned long und_regs[3]; /* SP_und, LR_und, SPSR_und */
+ unsigned long irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */
+ unsigned long fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */
};
/* Supported Processor Types */
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 4ea9a98..38e76bc 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -76,7 +76,7 @@ static bool access_dcsw(struct kvm_vcpu *vcpu,
const struct coproc_params *p,
const struct coproc_reg *r)
{
- u32 val;
+ unsigned long val;
int cpu;
cpu = get_cpu();
@@ -298,7 +298,7 @@ static int emulate_cp15(struct kvm_vcpu *vcpu,
}
/* If access function fails, it should complain. */
} else {
- kvm_err("Unsupported guest CP15 access at: %08x\n",
+ kvm_err("Unsupported guest CP15 access at: %08lx\n",
*vcpu_pc(vcpu));
print_cp_instr(params);
}
diff --git a/arch/arm/kvm/coproc.h b/arch/arm/kvm/coproc.h
index 992adfa..b7301d3 100644
--- a/arch/arm/kvm/coproc.h
+++ b/arch/arm/kvm/coproc.h
@@ -84,7 +84,7 @@ static inline bool read_zero(struct kvm_vcpu *vcpu,
static inline bool write_to_read_only(struct kvm_vcpu *vcpu,
const struct coproc_params *params)
{
- kvm_debug("CP15 write to read-only register at: %08x\n",
+ kvm_debug("CP15 write to read-only register at: %08lx\n",
*vcpu_pc(vcpu));
print_cp_instr(params);
return false;
@@ -93,7 +93,7 @@ static inline bool write_to_read_only(struct kvm_vcpu *vcpu,
static inline bool read_from_write_only(struct kvm_vcpu *vcpu,
const struct coproc_params *params)
{
- kvm_debug("CP15 read to write-only register at: %08x\n",
+ kvm_debug("CP15 read to write-only register at: %08lx\n",
*vcpu_pc(vcpu));
print_cp_instr(params);
return false;
diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c
index d61450a..d3094eb 100644
--- a/arch/arm/kvm/emulate.c
+++ b/arch/arm/kvm/emulate.c
@@ -109,10 +109,10 @@ static const unsigned long vcpu_reg_offsets[VCPU_NR_MODES][15] = {
* Return a pointer to the register number valid in the current mode of
* the virtual CPU.
*/
-u32 *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num)
+unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num)
{
- u32 *reg_array = (u32 *)&vcpu->arch.regs;
- u32 mode = *vcpu_cpsr(vcpu) & MODE_MASK;
+ unsigned long *reg_array = (unsigned long *)&vcpu->arch.regs;
+ unsigned long mode = *vcpu_cpsr(vcpu) & MODE_MASK;
switch (mode) {
case USR_MODE...SVC_MODE:
@@ -141,9 +141,9 @@ u32 *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num)
/*
* Return the SPSR for the current mode of the virtual CPU.
*/
-u32 *vcpu_spsr(struct kvm_vcpu *vcpu)
+unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu)
{
- u32 mode = *vcpu_cpsr(vcpu) & MODE_MASK;
+ unsigned long mode = *vcpu_cpsr(vcpu) & MODE_MASK;
switch (mode) {
case SVC_MODE:
return &vcpu->arch.regs.KVM_ARM_SVC_spsr;
@@ -257,9 +257,9 @@ static u32 exc_vector_base(struct kvm_vcpu *vcpu)
*/
void kvm_inject_undefined(struct kvm_vcpu *vcpu)
{
- u32 new_lr_value;
- u32 new_spsr_value;
- u32 cpsr = *vcpu_cpsr(vcpu);
+ unsigned long new_lr_value;
+ unsigned long new_spsr_value;
+ unsigned long cpsr = *vcpu_cpsr(vcpu);
u32 sctlr = vcpu->arch.cp15[c1_SCTLR];
bool is_thumb = (cpsr & PSR_T_BIT);
u32 vect_offset = 4;
@@ -291,9 +291,9 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
*/
static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)
{
- u32 new_lr_value;
- u32 new_spsr_value;
- u32 cpsr = *vcpu_cpsr(vcpu);
+ unsigned long new_lr_value;
+ unsigned long new_spsr_value;
+ unsigned long cpsr = *vcpu_cpsr(vcpu);
u32 sctlr = vcpu->arch.cp15[c1_SCTLR];
bool is_thumb = (cpsr & PSR_T_BIT);
u32 vect_offset;
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 98a870f..c186bc9 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -33,7 +33,7 @@
*/
int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
{
- __u32 *dest;
+ unsigned long *dest;
unsigned int len;
int mask;
--
1.7.12.4
next prev parent reply other threads:[~2013-03-05 2:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 2:42 [PATCH 00/29] ARM: KVM: pre-arm64 KVM/arm rework Marc Zyngier
2013-03-05 2:42 ` Marc Zyngier [this message]
2013-03-05 2:42 ` [PATCH 02/29] ARM: KVM: abstract fault register accesses Marc Zyngier
2013-03-05 2:42 ` [PATCH 03/29] ARM: KVM: abstract HSR_ISV away Marc Zyngier
2013-03-05 2:42 ` [PATCH 04/29] ARM: KVM: abstract HSR_WNR away Marc Zyngier
2013-03-05 2:42 ` [PATCH 05/29] ARM: KVM: abstract HSR_SSE away Marc Zyngier
2013-03-05 2:43 ` [PATCH 06/29] ARM: KVM: abstract HSR_SRT_{MASK,SHIFT} away Marc Zyngier
2013-03-05 2:43 ` [PATCH 07/29] ARM: KVM: abstract external abort detection away Marc Zyngier
2013-03-05 2:43 ` [PATCH 08/29] ARM: KVM: abstract S1TW " Marc Zyngier
2013-03-05 2:43 ` [PATCH 09/29] ARM: KVM: abstract SAS decoding away Marc Zyngier
2013-03-05 2:43 ` [PATCH 10/29] ARM: KVM: abstract IL " Marc Zyngier
2013-03-05 2:43 ` [PATCH 11/29] ARM: KVM: abstract exception class " Marc Zyngier
2013-03-05 2:43 ` [PATCH 12/29] ARM: KVM: abstract fault " Marc Zyngier
2013-03-05 2:43 ` [PATCH 13/29] ARM: KVM: abstract HSR_EC_IABT away Marc Zyngier
2013-03-05 2:43 ` [PATCH 14/29] ARM: KVM: move kvm_condition_valid to emulate.c Marc Zyngier
2013-03-05 2:43 ` [PATCH 15/29] ARM: KVM: move exit handler selection to a separate file Marc Zyngier
2013-03-05 2:43 ` [PATCH 16/29] ARM: KVM: move kvm_handle_wfi to handle_exit.c Marc Zyngier
2013-03-05 2:43 ` [PATCH 17/29] ARM: KVM: abstract most MMU operations Marc Zyngier
2013-03-05 2:43 ` [PATCH 18/29] ARM: KVM: remove superfluous include from kvm_vgic.h Marc Zyngier
2013-03-05 2:43 ` [PATCH 19/29] ARM: KVM: move hyp init to kvm_host.h Marc Zyngier
2013-03-05 2:43 ` [PATCH 20/29] ARM: KVM: use kvm_kernel_vfp_t as an abstract type for VFP containers Marc Zyngier
2013-03-05 2:43 ` [PATCH 21/29] ARM: KVM: allow HYP mappings to be at an offset from kernel mappings Marc Zyngier
2013-03-05 2:43 ` [PATCH 22/29] ARM: KVM: fix address validation for HYP mappings Marc Zyngier
2013-03-05 2:43 ` [PATCH 23/29] ARM: KVM: sanitize freeing of HYP page tables Marc Zyngier
2013-03-05 2:43 ` [PATCH 24/29] ARM: KVM: move kvm_target_cpu to guest.c Marc Zyngier
2013-03-05 2:43 ` [PATCH 25/29] ARM: KVM: fix fault_ipa computing Marc Zyngier
2013-03-05 2:43 ` [PATCH 26/29] ARM: KVM: vgic: decouple alignment restriction from page size Marc Zyngier
2013-03-05 2:43 ` [PATCH 27/29] ARM: KVM: move include of asm/idmap.h to kvm_mmu.h Marc Zyngier
2013-03-05 2:43 ` [PATCH 28/29] ARM: KVM: change kvm_tlb_flush_vmid to kvm_tlb_flush_vmid_ipa Marc Zyngier
2013-03-05 2:43 ` [PATCH 29/29] ARM: KVM: Fix length of mmio access Marc Zyngier
2013-03-07 0:11 ` [kvmarm] [PATCH 00/29] ARM: KVM: pre-arm64 KVM/arm rework Christoffer Dall
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=1362451403-23460-2-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).