From: James Hogan <james.hogan@imgtec.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: James Hogan <james.hogan@imgtec.com>,
Leon Alrae <leon.alrae@imgtec.com>,
kvm@vger.kernel.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH v2 6/9] mips/kvm: Support unsigned KVM registers
Date: Wed, 25 Mar 2015 10:23:51 +0000 [thread overview]
Message-ID: <1427279034-9459-7-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1427279034-9459-1-git-send-email-james.hogan@imgtec.com>
Add KVM register access functions for the uint32_t type. This is
required for FP and MSA control registers, which are represented as
unsigned 32-bit integers.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
---
target-mips/kvm.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/target-mips/kvm.c b/target-mips/kvm.c
index ead8c5f73930..4e5c8ba3d10c 100644
--- a/target-mips/kvm.c
+++ b/target-mips/kvm.c
@@ -243,6 +243,18 @@ static inline int kvm_mips_put_one_reg(CPUState *cs, uint64_t reg_id,
return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &cp0reg);
}
+static inline int kvm_mips_put_one_ureg(CPUState *cs, uint64_t reg_id,
+ uint32_t *addr)
+{
+ uint64_t val64 = *addr;
+ struct kvm_one_reg cp0reg = {
+ .id = reg_id,
+ .addr = (uintptr_t)&val64
+ };
+
+ return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &cp0reg);
+}
+
static inline int kvm_mips_put_one_ulreg(CPUState *cs, uint64_t reg_id,
target_ulong *addr)
{
@@ -283,6 +295,23 @@ static inline int kvm_mips_get_one_reg(CPUState *cs, uint64_t reg_id,
return ret;
}
+static inline int kvm_mips_get_one_ureg(CPUState *cs, uint64_t reg_id,
+ uint32_t *addr)
+{
+ int ret;
+ uint64_t val64 = 0;
+ struct kvm_one_reg cp0reg = {
+ .id = reg_id,
+ .addr = (uintptr_t)&val64
+ };
+
+ ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &cp0reg);
+ if (ret >= 0) {
+ *addr = val64;
+ }
+ return ret;
+}
+
static inline int kvm_mips_get_one_ulreg(CPUState *cs, uint64 reg_id,
target_ulong *addr)
{
--
2.0.5
next prev parent reply other threads:[~2015-03-25 10:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 10:23 [Qemu-devel] [PATCH v2 0/9] mips/kvm: Support FPU & SIMD (MSA) in MIPS KVM guests James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 1/9] DONT APPLY: linux-headers: Update MIPS KVM headers James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 2/9] mips/kvm: Sync with newer " James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 3/9] mips/kvm: Remove a couple of noisy DPRINTFs James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 4/9] mips/kvm: Implement PRid CP0 register James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 5/9] mips/kvm: Implement Config CP0 registers James Hogan
2015-03-25 10:23 ` James Hogan [this message]
2015-04-24 10:39 ` [Qemu-devel] [PATCH v3 6/9] mips/kvm: Support unsigned KVM registers James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 7/9] mips/kvm: Support signed 64-bit " James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 8/9] mips/kvm: Support FPU in MIPS KVM guests James Hogan
2015-03-25 10:23 ` [Qemu-devel] [PATCH v2 9/9] mips/kvm: Support MSA " James Hogan
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=1427279034-9459-7-git-send-email-james.hogan@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=aurelien@aurel32.net \
--cc=kvm@vger.kernel.org \
--cc=leon.alrae@imgtec.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@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).