2008-12-16 13:43:58 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2008 IBM Corporation.
|
|
|
|
* Authors: Hollis Blanchard <hollisb@us.ibm.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the GNU GPL license version 2 or later.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KVM_PPC_H__
|
|
|
|
#define __KVM_PPC_H__
|
|
|
|
|
2011-09-30 01:39:11 +04:00
|
|
|
#include "memory.h"
|
|
|
|
|
2008-12-16 13:43:58 +03:00
|
|
|
void kvmppc_init(void);
|
|
|
|
|
2011-07-21 04:54:51 +04:00
|
|
|
#ifdef CONFIG_KVM
|
|
|
|
|
2010-02-09 19:37:05 +03:00
|
|
|
uint32_t kvmppc_get_tbfreq(void);
|
2011-07-21 04:29:15 +04:00
|
|
|
uint64_t kvmppc_get_clockfreq(void);
|
pseries: Add device tree properties for VMX/VSX and DFP under kvm
Sufficiently recent PAPR specifications define properties "ibm,vmx"
and "ibm,dfp" on the CPU node which advertise whether the VMX vector
extensions (or the later VSX version) and/or the Decimal Floating
Point operations from IBM's recent POWER CPUs are available.
Currently we do not put these in the guest device tree and the guest
kernel will consequently assume they are not available. This is good,
because they are not supported under TCG. VMX is similar enough to
Altivec that it might be trivial to support, but VSX and DFP would
both require significant work to support in TCG.
However, when running under kvm on a host which supports these
instructions, there's no reason not to let the guest use them. This
patch, therefore, checks for the relevant support on the host CPU
and, if present, advertises them to the guest as well.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-10 22:31:01 +04:00
|
|
|
uint32_t kvmppc_get_vmx(void);
|
|
|
|
uint32_t kvmppc_get_dfp(void);
|
2010-08-03 17:22:42 +04:00
|
|
|
int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len);
|
2010-08-30 15:49:15 +04:00
|
|
|
int kvmppc_set_interrupt(CPUState *env, int irq, int level);
|
2011-08-09 19:57:37 +04:00
|
|
|
void kvmppc_set_papr(CPUState *env);
|
2011-09-30 01:39:10 +04:00
|
|
|
int kvmppc_smt_threads(void);
|
2011-10-23 21:25:04 +04:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
2011-09-30 01:39:11 +04:00
|
|
|
off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
|
2011-09-30 01:39:12 +04:00
|
|
|
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
|
|
|
|
int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
|
2011-10-23 21:25:04 +04:00
|
|
|
#endif /* !CONFIG_USER_ONLY */
|
2011-10-13 02:40:32 +04:00
|
|
|
const ppc_def_t *kvmppc_host_cpu_def(void);
|
2010-08-30 15:49:15 +04:00
|
|
|
|
2011-07-21 04:54:51 +04:00
|
|
|
#else
|
|
|
|
|
|
|
|
static inline uint32_t kvmppc_get_tbfreq(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint64_t kvmppc_get_clockfreq(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
pseries: Add device tree properties for VMX/VSX and DFP under kvm
Sufficiently recent PAPR specifications define properties "ibm,vmx"
and "ibm,dfp" on the CPU node which advertise whether the VMX vector
extensions (or the later VSX version) and/or the Decimal Floating
Point operations from IBM's recent POWER CPUs are available.
Currently we do not put these in the guest device tree and the guest
kernel will consequently assume they are not available. This is good,
because they are not supported under TCG. VMX is similar enough to
Altivec that it might be trivial to support, but VSX and DFP would
both require significant work to support in TCG.
However, when running under kvm on a host which supports these
instructions, there's no reason not to let the guest use them. This
patch, therefore, checks for the relevant support on the host CPU
and, if present, advertises them to the guest as well.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-10 22:31:01 +04:00
|
|
|
static inline uint32_t kvmppc_get_vmx(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t kvmppc_get_dfp(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-21 04:54:51 +04:00
|
|
|
static inline int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int kvmppc_set_interrupt(CPUState *env, int irq, int level)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-08-09 19:57:37 +04:00
|
|
|
static inline void kvmppc_set_papr(CPUState *env)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-30 01:39:10 +04:00
|
|
|
static inline int kvmppc_smt_threads(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-23 21:25:04 +04:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
2011-09-30 01:39:11 +04:00
|
|
|
static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-30 01:39:12 +04:00
|
|
|
static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
|
|
|
|
uint32_t window_size, int *fd)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
|
|
|
|
uint32_t window_size)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
2011-10-23 21:25:04 +04:00
|
|
|
#endif /* !CONFIG_USER_ONLY */
|
2011-09-30 01:39:12 +04:00
|
|
|
|
2011-10-13 02:40:32 +04:00
|
|
|
static inline const ppc_def_t *kvmppc_host_cpu_def(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-07-21 04:54:51 +04:00
|
|
|
#endif
|
|
|
|
|
2011-04-01 08:15:30 +04:00
|
|
|
#ifndef CONFIG_KVM
|
|
|
|
#define kvmppc_eieio() do { } while (0)
|
|
|
|
#else
|
|
|
|
#define kvmppc_eieio() \
|
|
|
|
do { \
|
|
|
|
if (kvm_enabled()) { \
|
|
|
|
asm volatile("eieio" : : : "memory"); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
2010-08-30 15:49:15 +04:00
|
|
|
#ifndef KVM_INTERRUPT_SET
|
|
|
|
#define KVM_INTERRUPT_SET -1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef KVM_INTERRUPT_UNSET
|
|
|
|
#define KVM_INTERRUPT_UNSET -2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef KVM_INTERRUPT_SET_LEVEL
|
|
|
|
#define KVM_INTERRUPT_SET_LEVEL -3
|
|
|
|
#endif
|
2010-02-09 19:37:05 +03:00
|
|
|
|
2008-12-16 13:43:58 +03:00
|
|
|
#endif /* __KVM_PPC_H__ */
|