Skip to content

Commit 0616ea3

Browse files
committed
Merge branch 'for-next/esr-elx-64-bit' into for-next/core
* for-next/esr-elx-64-bit: : Treat ESR_ELx as a 64-bit register. KVM: arm64: uapi: Add kvm_debug_exit_arch.hsr_high KVM: arm64: Treat ESR_EL2 as a 64-bit register arm64: Treat ESR_ELx as a 64-bit register arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall arm64: Make ESR_ELx_xVC_IMM_MASK compatible with assembly
2 parents d6fc5db + 18f3976 commit 0616ea3

27 files changed

+147
-140
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5713,6 +5713,8 @@ affect the device's behavior. Current defined flags::
57135713
#define KVM_RUN_X86_SMM (1 << 0)
57145714
/* x86, set if bus lock detected in VM */
57155715
#define KVM_RUN_BUS_LOCK (1 << 1)
5716+
/* arm64, set for KVM_EXIT_DEBUG */
5717+
#define KVM_DEBUG_ARCH_HSR_HIGH_VALID (1 << 0)
57165718

57175719
::
57185720

arch/arm64/include/asm/debug-monitors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct task_struct;
6464

6565
struct step_hook {
6666
struct list_head node;
67-
int (*fn)(struct pt_regs *regs, unsigned int esr);
67+
int (*fn)(struct pt_regs *regs, unsigned long esr);
6868
};
6969

7070
void register_user_step_hook(struct step_hook *hook);
@@ -75,7 +75,7 @@ void unregister_kernel_step_hook(struct step_hook *hook);
7575

7676
struct break_hook {
7777
struct list_head node;
78-
int (*fn)(struct pt_regs *regs, unsigned int esr);
78+
int (*fn)(struct pt_regs *regs, unsigned long esr);
7979
u16 imm;
8080
u16 mask; /* These bits are ignored when comparing with imm */
8181
};

arch/arm64/include/asm/esr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
#define ESR_ELx_WFx_ISS_TI (UL(1) << 0)
139139
#define ESR_ELx_WFx_ISS_WFI (UL(0) << 0)
140140
#define ESR_ELx_WFx_ISS_WFE (UL(1) << 0)
141-
#define ESR_ELx_xVC_IMM_MASK ((1UL << 16) - 1)
141+
#define ESR_ELx_xVC_IMM_MASK ((UL(1) << 16) - 1)
142142

143143
#define DISR_EL1_IDS (UL(1) << 24)
144144
/*
@@ -341,14 +341,14 @@
341341
#ifndef __ASSEMBLY__
342342
#include <asm/types.h>
343343

344-
static inline bool esr_is_data_abort(u32 esr)
344+
static inline bool esr_is_data_abort(unsigned long esr)
345345
{
346-
const u32 ec = ESR_ELx_EC(esr);
346+
const unsigned long ec = ESR_ELx_EC(esr);
347347

348348
return ec == ESR_ELx_EC_DABT_LOW || ec == ESR_ELx_EC_DABT_CUR;
349349
}
350350

351-
const char *esr_get_class_string(u32 esr);
351+
const char *esr_get_class_string(unsigned long esr);
352352
#endif /* __ASSEMBLY */
353353

354354
#endif /* __ASM_ESR_H */

arch/arm64/include/asm/exception.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
#define __exception_irq_entry __kprobes
2020
#endif
2121

22-
static inline u32 disr_to_esr(u64 disr)
22+
static inline unsigned long disr_to_esr(u64 disr)
2323
{
24-
unsigned int esr = ESR_ELx_EC_SERROR << ESR_ELx_EC_SHIFT;
24+
unsigned long esr = ESR_ELx_EC_SERROR << ESR_ELx_EC_SHIFT;
2525

2626
if ((disr & DISR_EL1_IDS) == 0)
2727
esr |= (disr & DISR_EL1_ESR_MASK);
@@ -57,24 +57,24 @@ asmlinkage void call_on_irq_stack(struct pt_regs *regs,
5757
void (*func)(struct pt_regs *));
5858
asmlinkage void asm_exit_to_user_mode(struct pt_regs *regs);
5959

60-
void do_mem_abort(unsigned long far, unsigned int esr, struct pt_regs *regs);
60+
void do_mem_abort(unsigned long far, unsigned long esr, struct pt_regs *regs);
6161
void do_undefinstr(struct pt_regs *regs);
6262
void do_bti(struct pt_regs *regs);
63-
void do_debug_exception(unsigned long addr_if_watchpoint, unsigned int esr,
63+
void do_debug_exception(unsigned long addr_if_watchpoint, unsigned long esr,
6464
struct pt_regs *regs);
65-
void do_fpsimd_acc(unsigned int esr, struct pt_regs *regs);
66-
void do_sve_acc(unsigned int esr, struct pt_regs *regs);
67-
void do_sme_acc(unsigned int esr, struct pt_regs *regs);
68-
void do_fpsimd_exc(unsigned int esr, struct pt_regs *regs);
69-
void do_sysinstr(unsigned int esr, struct pt_regs *regs);
70-
void do_sp_pc_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs);
71-
void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr);
72-
void do_cp15instr(unsigned int esr, struct pt_regs *regs);
65+
void do_fpsimd_acc(unsigned long esr, struct pt_regs *regs);
66+
void do_sve_acc(unsigned long esr, struct pt_regs *regs);
67+
void do_sme_acc(unsigned long esr, struct pt_regs *regs);
68+
void do_fpsimd_exc(unsigned long esr, struct pt_regs *regs);
69+
void do_sysinstr(unsigned long esr, struct pt_regs *regs);
70+
void do_sp_pc_abort(unsigned long addr, unsigned long esr, struct pt_regs *regs);
71+
void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr);
72+
void do_cp15instr(unsigned long esr, struct pt_regs *regs);
7373
void do_el0_svc(struct pt_regs *regs);
7474
void do_el0_svc_compat(struct pt_regs *regs);
75-
void do_ptrauth_fault(struct pt_regs *regs, unsigned int esr);
76-
void do_serror(struct pt_regs *regs, unsigned int esr);
75+
void do_ptrauth_fault(struct pt_regs *regs, unsigned long esr);
76+
void do_serror(struct pt_regs *regs, unsigned long esr);
7777
void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags);
7878

79-
void panic_bad_stack(struct pt_regs *regs, unsigned int esr, unsigned long far);
79+
void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
8080
#endif /* __ASM_EXCEPTION_H */

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu)
235235
return mode != PSR_MODE_EL0t;
236236
}
237237

238-
static __always_inline u32 kvm_vcpu_get_esr(const struct kvm_vcpu *vcpu)
238+
static __always_inline u64 kvm_vcpu_get_esr(const struct kvm_vcpu *vcpu)
239239
{
240240
return vcpu->arch.fault.esr_el2;
241241
}
242242

243243
static __always_inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu)
244244
{
245-
u32 esr = kvm_vcpu_get_esr(vcpu);
245+
u64 esr = kvm_vcpu_get_esr(vcpu);
246246

247247
if (esr & ESR_ELx_CV)
248248
return (esr & ESR_ELx_COND_MASK) >> ESR_ELx_COND_SHIFT;
@@ -373,7 +373,7 @@ static __always_inline bool kvm_vcpu_abt_issea(const struct kvm_vcpu *vcpu)
373373

374374
static __always_inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu)
375375
{
376-
u32 esr = kvm_vcpu_get_esr(vcpu);
376+
u64 esr = kvm_vcpu_get_esr(vcpu);
377377
return ESR_ELx_SYS64_ISS_RT(esr);
378378
}
379379

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ struct kvm_arch {
153153
};
154154

155155
struct kvm_vcpu_fault_info {
156-
u32 esr_el2; /* Hyp Syndrom Register */
156+
u64 esr_el2; /* Hyp Syndrom Register */
157157
u64 far_el2; /* Hyp Fault Address Register */
158158
u64 hpfar_el2; /* Hyp IPA Fault Address Register */
159159
u64 disr_el1; /* Deferred [SError] Status Register */

arch/arm64/include/asm/kvm_ras.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Was this synchronous external abort a RAS notification?
1515
* Returns '0' for errors handled by some RAS subsystem, or -ENOENT.
1616
*/
17-
static inline int kvm_handle_guest_sea(phys_addr_t addr, unsigned int esr)
17+
static inline int kvm_handle_guest_sea(phys_addr_t addr, u64 esr)
1818
{
1919
/* apei_claim_sea(NULL) expects to mask interrupts itself */
2020
lockdep_assert_irqs_enabled();

arch/arm64/include/asm/system_misc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ void die(const char *msg, struct pt_regs *regs, int err);
2323
struct siginfo;
2424
void arm64_notify_die(const char *str, struct pt_regs *regs,
2525
int signo, int sicode, unsigned long far,
26-
int err);
26+
unsigned long err);
2727

28-
void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
28+
void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned long,
2929
struct pt_regs *),
3030
int sig, int code, const char *name);
3131

arch/arm64/include/asm/traps.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct undef_hook {
2424

2525
void register_undef_hook(struct undef_hook *hook);
2626
void unregister_undef_hook(struct undef_hook *hook);
27-
void force_signal_inject(int signal, int code, unsigned long address, unsigned int err);
27+
void force_signal_inject(int signal, int code, unsigned long address, unsigned long err);
2828
void arm64_notify_segfault(unsigned long addr);
2929
void arm64_force_sig_fault(int signo, int code, unsigned long far, const char *str);
3030
void arm64_force_sig_mceerr(int code, unsigned long far, short lsb, const char *str);
@@ -57,7 +57,7 @@ static inline int in_entry_text(unsigned long ptr)
5757
* errors share the same encoding as an all-zeros encoding from a CPU that
5858
* doesn't support RAS.
5959
*/
60-
static inline bool arm64_is_ras_serror(u32 esr)
60+
static inline bool arm64_is_ras_serror(unsigned long esr)
6161
{
6262
WARN_ON(preemptible());
6363

@@ -77,9 +77,9 @@ static inline bool arm64_is_ras_serror(u32 esr)
7777
* We treat them as Uncontainable.
7878
* Non-RAS SError's are reported as Uncontained/Uncategorized.
7979
*/
80-
static inline u32 arm64_ras_serror_get_severity(u32 esr)
80+
static inline unsigned long arm64_ras_serror_get_severity(unsigned long esr)
8181
{
82-
u32 aet = esr & ESR_ELx_AET;
82+
unsigned long aet = esr & ESR_ELx_AET;
8383

8484
if (!arm64_is_ras_serror(esr)) {
8585
/* Not a RAS error, we can't interpret the ESR. */
@@ -98,6 +98,6 @@ static inline u32 arm64_ras_serror_get_severity(u32 esr)
9898
return aet;
9999
}
100100

101-
bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned int esr);
102-
void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr);
101+
bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned long esr);
102+
void __noreturn arm64_serror_panic(struct pt_regs *regs, unsigned long esr);
103103
#endif

arch/arm64/include/uapi/asm/kvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ struct kvm_guest_debug_arch {
139139
__u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS];
140140
};
141141

142+
#define KVM_DEBUG_ARCH_HSR_HIGH_VALID (1 << 0)
142143
struct kvm_debug_exit_arch {
143144
__u32 hsr;
145+
__u32 hsr_high; /* ESR_EL2[61:32] */
144146
__u64 far; /* used for watchpoints */
145147
};
146148

0 commit comments

Comments
 (0)