[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v4 01/12] target-ppc: Add helper for KVM_PPC_RTAS_DEFI
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-ppc] [PATCH v4 01/12] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN |
Date: |
Fri, 30 Aug 2013 15:28:22 +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>
---
Changes:
v4:
* kvmppc_define_rtas_token renamed to kvmppc_define_rtas_kernel_token
---
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 3969273..5e72c22 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1790,6 +1790,20 @@ static int kvm_ppc_register_host_cpu_type(void)
return 0;
}
+int kvmppc_define_rtas_kernel_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);
+}
int kvmppc_get_htab_fd(bool write)
{
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 4ae7bf2..5f78e4b 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_kernel_token(uint32_t token, const char *function);
int kvmppc_get_htab_fd(bool write);
int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns);
int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
@@ -164,6 +165,12 @@ static inline bool kvmppc_has_cap_epr(void)
return false;
}
+static inline int kvmppc_define_rtas_kernel_token(uint32_t token,
+ const char *function)
+{
+ return -1;
+}
+
static inline int kvmppc_get_htab_fd(bool write)
{
return -1;
--
1.8.4.rc4
- [Qemu-ppc] [PATCH v4 00/12] xics: reworks and in-kernel support, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 01/12] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN,
Alexey Kardashevskiy <=
- [Qemu-ppc] [PATCH v4 11/12] xics: Implement H_IPOLL, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 08/12] xics: split to xics and xics-common, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 02/12] xics: move reset and cpu_setup, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 05/12] xics: add pre_save/post_load dispatchers, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 04/12] xics: replace fprintf with error_report, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 06/12] xics: convert init() to realize(), Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 12/12] xics: Implement H_XIRR_X, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 07/12] xics: add missing const specifiers to TypeInfo, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 10/12] xics-kvm: Support for in-kernel XICS interrupt controller, Alexey Kardashevskiy, 2013/08/30
- [Qemu-ppc] [PATCH v4 09/12] xics: add cpu_setup callback, Alexey Kardashevskiy, 2013/08/30