[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 13/17] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-ppc] [PATCH 13/17] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN |
Date: |
Thu, 27 Jun 2013 16:45:56 +1000 |
From: David Gibson <address@hidden>
Recent PowerKVM allows the kernel to intercept some RTAS calls from the
guest directly. This is used to implement the more efficient in-kernel
XICS for example. qemu is still responsible for assigning the RTAS token
numbers however, and needs to tell the kernel which RTAS function name is
assigned to a given token value. This patch adds a convenience wrapper for
the KVM_PPC_RTAS_DEFINE_TOKEN ioctl() which is used for this purpose.
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
target-ppc/kvm.c | 14 ++++++++++++++
target-ppc/kvm_ppc.h | 7 +++++++
2 files changed, 21 insertions(+)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index c89dd58..33ddf63 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1787,6 +1787,20 @@ static int kvm_ppc_register_host_cpu_type(void)
return 0;
}
+int kvmppc_define_rtas_token(uint32_t token, const char *function)
+{
+ struct kvm_rtas_token_args args = {
+ .token = token,
+ };
+
+ if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_RTAS)) {
+ return -ENOENT;
+ }
+
+ strncpy(args.name, function, sizeof(args.name));
+
+ return kvm_vm_ioctl(kvm_state, KVM_PPC_RTAS_DEFINE_TOKEN, &args);
+}
bool kvm_arch_stop_on_emulation_error(CPUState *cpu)
{
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 771cfbe..21939a8 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -38,6 +38,7 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int
hash_shift);
#endif /* !CONFIG_USER_ONLY */
int kvmppc_fixup_cpu(PowerPCCPU *cpu);
bool kvmppc_has_cap_epr(void);
+int kvmppc_define_rtas_token(uint32_t token, const char *function);
#else
@@ -159,6 +160,12 @@ static inline bool kvmppc_has_cap_epr(void)
{
return false;
}
+
+static inline int kvmppc_define_rtas_token(uint32_t token,
+ const char *function)
+{
+ return -1;
+}
#endif
#ifndef CONFIG_KVM
--
1.7.10.4
- [Qemu-ppc] [PATCH 03/17] savevm: Implement VMS_DIVIDE flag, (continued)
- [Qemu-ppc] [PATCH 03/17] savevm: Implement VMS_DIVIDE flag, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 04/17] target-ppc: Convert ppc cpu savevm to VMStateDescription, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 05/17] pseries: savevm support for XICS interrupt controller, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 06/17] pseries: savevm support for VIO devices, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 07/17] pseries: savevm support for PAPR VIO logical lan, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 08/17] pseries: savevm support for PAPR TCE tables, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 09/17] pseries: rework PAPR virtual SCSI, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 10/17] pseries: savevm support for PAPR virtual SCSI, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 11/17] pseries: savevm support for pseries machine, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 12/17] pseries: savevm support for PCI host bridge, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 13/17] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN,
Alexey Kardashevskiy <=
- [Qemu-ppc] [PATCH 14/17] pseries: Support for in-kernel XICS interrupt controller, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 15/17] pseries: savevm support with KVM, Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 16/17] ppc64: Enable QEMU to run on POWER 8 DD1 chip., Alexey Kardashevskiy, 2013/06/27
- [Qemu-ppc] [PATCH 17/17] spapr-pci: rework MSI/MSIX, Alexey Kardashevskiy, 2013/06/27