From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
aik@ozlabs.ru, Alexander Graf <agraf@suse.de>,
qemu-ppc@nongnu.org, Paul Mackerras <paulus@samba.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 1/4] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN
Date: Wed, 17 Jul 2013 16:37:34 +1000 [thread overview]
Message-ID: <1374043057-27208-2-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1374043057-27208-1-git-send-email-aik@ozlabs.ru>
From: David Gibson <david@gibson.dropbear.id.au>
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 <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
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 27e2aaf..606bdb9 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1789,6 +1789,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);
+}
int kvmppc_get_htab_fd(bool write)
{
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 4ae7bf2..12564ef 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);
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_token(uint32_t token,
+ const char *function)
+{
+ return -1;
+}
+
static inline int kvmppc_get_htab_fd(bool write)
{
return -1;
--
1.8.3.2
next prev parent reply other threads:[~2013-07-17 6:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 6:37 [Qemu-devel] RFC: [PATCH 0/4] xics: in-kernel support Alexey Kardashevskiy
2013-07-17 6:37 ` Alexey Kardashevskiy [this message]
2013-07-17 6:37 ` [Qemu-devel] [PATCH 2/4] xics: add pre_save/post_load/cpu_setup dispatchers Alexey Kardashevskiy
2013-07-17 6:37 ` [Qemu-devel] [PATCH 3/4] xics: rework initialization Alexey Kardashevskiy
2013-07-31 19:22 ` Andreas Färber
2013-07-17 6:37 ` [Qemu-devel] [PATCH 4/4] xics: Support for in-kernel XICS interrupt controller Alexey Kardashevskiy
2013-07-31 18:05 ` Anthony Liguori
2013-07-31 19:52 ` Andreas Färber
2013-07-31 20:47 ` Peter Maydell
2013-08-01 0:14 ` Alexey Kardashevskiy
2013-08-01 1:29 ` Andreas Färber
2013-08-01 2:08 ` Alexey Kardashevskiy
2013-08-01 3:07 ` Andreas Färber
2013-08-01 3:22 ` Alexey Kardashevskiy
2013-08-06 14:14 ` Andreas Färber
2013-08-02 14:57 ` Alexey Kardashevskiy
2013-08-03 2:45 ` Alexey Kardashevskiy
2013-07-30 2:29 ` [Qemu-devel] RFC: [PATCH 0/4] xics: in-kernel support Alexey Kardashevskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374043057-27208-2-git-send-email-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=paulus@samba.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).