public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: <qemu-devel@nongnu.org>, Leon Alrae <leon.alrae@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, <kvm@vger.kernel.org>,
	Aurelien Jarno <aurelien@aurel32.net>,
	James Hogan <james.hogan@imgtec.com>
Subject: [PATCH v5 4/7] mips/kvm: Support unsigned KVM registers
Date: Wed, 3 Feb 2016 17:16:50 +0000	[thread overview]
Message-ID: <1454519813-18797-5-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1454519813-18797-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>
---
Changes in v3:
- Fix big endian (the pointer passed to the kernel must be for the
  actual 32-bit value, not a temporary 64-bit value, otherwise on big
  endian systems the kernel will only interpret the upper half).
---
 target-mips/kvm.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/target-mips/kvm.c b/target-mips/kvm.c
index 57cde9dd4df6..abdd6b66256c 100644
--- a/target-mips/kvm.c
+++ b/target-mips/kvm.c
@@ -248,6 +248,17 @@ 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)
+{
+    struct kvm_one_reg cp0reg = {
+        .id = reg_id,
+        .addr = (uintptr_t)addr
+    };
+
+    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)
 {
@@ -282,6 +293,17 @@ static inline int kvm_mips_get_one_reg(CPUState *cs, uint64_t reg_id,
     return kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &cp0reg);
 }
 
+static inline int kvm_mips_get_one_ureg(CPUState *cs, uint64_t reg_id,
+                                        uint32_t *addr)
+{
+    struct kvm_one_reg cp0reg = {
+        .id = reg_id,
+        .addr = (uintptr_t)addr
+    };
+
+    return kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &cp0reg);
+}
+
 static inline int kvm_mips_get_one_ulreg(CPUState *cs, uint64_t reg_id,
                                          target_ulong *addr)
 {
-- 
2.4.10


  parent reply	other threads:[~2016-02-03 17:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 17:16 [PATCH v5 0/7] mips/kvm: Support FPU & SIMD (MSA) in MIPS KVM guests James Hogan
2016-02-03 17:16 ` [PATCH v5 1/7] mips/kvm: Remove a couple of noisy DPRINTFs James Hogan
2016-02-03 17:16 ` [PATCH v5 2/7] mips/kvm: Implement PRid CP0 register James Hogan
2016-02-03 17:16 ` [PATCH v5 3/7] mips/kvm: Implement Config CP0 registers James Hogan
2016-02-03 17:16 ` James Hogan [this message]
2016-02-03 17:16 ` [PATCH v5 5/7] mips/kvm: Support signed 64-bit KVM registers James Hogan
2016-02-03 17:16 ` [PATCH v5 6/7] mips/kvm: Support FPU in MIPS KVM guests James Hogan
2016-02-03 17:16 ` [PATCH v5 7/7] mips/kvm: Support MSA " James Hogan
2016-02-04 10:04 ` [PATCH v5 0/7] mips/kvm: Support FPU & SIMD (MSA) " Leon Alrae
2016-02-05 10:46   ` 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=1454519813-18797-5-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