mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 04:35:27 +07:00
fd0944baad
When the 'regs' field was added to struct kvm_vcpu_arch, the code was changed to use several of the fields inside regs (e.g., gpr, lr, etc.) but not the ccr field, because the ccr field in struct pt_regs is 64 bits on 64-bit platforms, but the cr field in kvm_vcpu_arch is only 32 bits. This changes the code to use the regs.ccr field instead of cr, and changes the assembly code on 64-bit platforms to use 64-bit loads and stores instead of 32-bit ones. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@ozlabs.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
118 lines
2.7 KiB
C
118 lines
2.7 KiB
C
/*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License, version 2, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* Copyright SUSE Linux Products GmbH 2010
|
|
*
|
|
* Authors: Alexander Graf <agraf@suse.de>
|
|
*/
|
|
|
|
#ifndef __ASM_KVM_BOOKE_H__
|
|
#define __ASM_KVM_BOOKE_H__
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/kvm_host.h>
|
|
|
|
/*
|
|
* Number of available lpids. Only the low-order 6 bits of LPID rgister are
|
|
* implemented on e500mc+ cores.
|
|
*/
|
|
#define KVMPPC_NR_LPIDS 64
|
|
|
|
#define KVMPPC_INST_EHPRIV 0x7c00021c
|
|
#define EHPRIV_OC_SHIFT 11
|
|
/* "ehpriv 1" : ehpriv with OC = 1 is used for debug emulation */
|
|
#define EHPRIV_OC_DEBUG 1
|
|
|
|
static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
|
|
{
|
|
vcpu->arch.regs.gpr[num] = val;
|
|
}
|
|
|
|
static inline ulong kvmppc_get_gpr(struct kvm_vcpu *vcpu, int num)
|
|
{
|
|
return vcpu->arch.regs.gpr[num];
|
|
}
|
|
|
|
static inline void kvmppc_set_cr(struct kvm_vcpu *vcpu, u32 val)
|
|
{
|
|
vcpu->arch.regs.ccr = val;
|
|
}
|
|
|
|
static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.regs.ccr;
|
|
}
|
|
|
|
static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, ulong val)
|
|
{
|
|
vcpu->arch.regs.xer = val;
|
|
}
|
|
|
|
static inline ulong kvmppc_get_xer(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.regs.xer;
|
|
}
|
|
|
|
static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
|
|
{
|
|
/* XXX Would need to check TLB entry */
|
|
return false;
|
|
}
|
|
|
|
static inline void kvmppc_set_ctr(struct kvm_vcpu *vcpu, ulong val)
|
|
{
|
|
vcpu->arch.regs.ctr = val;
|
|
}
|
|
|
|
static inline ulong kvmppc_get_ctr(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.regs.ctr;
|
|
}
|
|
|
|
static inline void kvmppc_set_lr(struct kvm_vcpu *vcpu, ulong val)
|
|
{
|
|
vcpu->arch.regs.link = val;
|
|
}
|
|
|
|
static inline ulong kvmppc_get_lr(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.regs.link;
|
|
}
|
|
|
|
static inline void kvmppc_set_pc(struct kvm_vcpu *vcpu, ulong val)
|
|
{
|
|
vcpu->arch.regs.nip = val;
|
|
}
|
|
|
|
static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.regs.nip;
|
|
}
|
|
|
|
static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.fault_dear;
|
|
}
|
|
|
|
static inline bool kvmppc_supports_magic_page(struct kvm_vcpu *vcpu)
|
|
{
|
|
/* Magic page is only supported on e500v2 */
|
|
#ifdef CONFIG_KVM_E500V2
|
|
return true;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
#endif /* __ASM_KVM_BOOKE_H__ */
|