From: Rusty Russell <rusty@rustcorp.com.au>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Rusty Russell <rusty.russell@linaro.org>,
Avi Kivity <avi@redhat.com>,
Christoffer Dall <c.dall@virtualopensystems.com>,
Alexander Graf <agraf@suse.de>,
kvmarm@lists.cs.columbia.edu, kvm-devel <kvm@vger.kernel.org>
Subject: Re: [RFC 0/5] Making KVM_GET_ONE_REG/KVM_SET_ONE_REG generic.
Date: Wed, 05 Sep 2012 16:18:27 +0930 [thread overview]
Message-ID: <87ipbtj77o.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAFEAcA-PRvmuUzibqqd_eNVh_NDpBnFAJAO6mnU-t_ugK7dK2A@mail.gmail.com>
Peter Maydell <peter.maydell@linaro.org> writes:
> On 1 September 2012 13:28, Rusty Russell <rusty@rustcorp.com.au> wrote:
>> Rusty Russell (8):
>> KVM: ARM: Fix walk_msrs()
>> KVM: Move KVM_SET_ONE_REG/KVM_GET_ONE_REG to generic code.
>> KVM: Add KVM_REG_SIZE() helper.
>> KVM: ARM: use KVM_SET_ONE_REG/KVM_GET_ONE_REG.
>> KVM: Add KVM_VCPU_GET_REG_LIST.
>> KVM: ARM: Use KVM_VCPU_GET_REG_LIST.
>> KVM: ARM: Access all registers via KVM_GET_ONE_REG/KVM_SET_ONE_REG.
>> KVM ARM: Update api.txt
>
> So I was thinking about this, and I remembered that the SET_ONE_REG/
> GET_ONE_REG API has userspace pass a pointer to the variable the
> kernel should read/write (unlike the _MSR x86 ioctls, where the
> actual data value is sent back and forth in the struct). Further,
> the kernel only writes a data value of the size of the register
> (rather than always reading/writing a uint64_t).
>
> This is a problem because it means userspace needs to know the
> size of each register, and the kernel doesn't provide any way
> to determine the size. This defeats the idea that userspace should
> be able to migrate kernel register state without having to know
> the semantics of all the registers involved.
It's there. There are bits in the id which indicate the size:
#define KVM_REG_SIZE_SHIFT 52
#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
#define KVM_REG_SIZE_U8 0x0000000000000000ULL
#define KVM_REG_SIZE_U16 0x0010000000000000ULL
#define KVM_REG_SIZE_U32 0x0020000000000000ULL
#define KVM_REG_SIZE_U64 0x0030000000000000ULL
#define KVM_REG_SIZE_U128 0x0040000000000000ULL
#define KVM_REG_SIZE_U256 0x0050000000000000ULL
#define KVM_REG_SIZE_U512 0x0060000000000000ULL
#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
And my patches added a helper:
#define KVM_REG_SIZE(id) \
(1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
> I could live with "always read/write 64 bits". I definitely don't
> want to have to deal with matching up register widths to accesses
> in userspace, please.
I changed my mind about the old scheme when I realized we have to deal
with 128-bit FPU registers.
Cheers,
Rusty.
next prev parent reply other threads:[~2012-09-05 8:21 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-28 23:37 [RFC 0/5] Making KVM_GET_ONE_REG/KVM_SET_ONE_REG generic Rusty Russell
2012-08-28 23:45 ` [RFC 1/5] KVM: Move KVM_SET_ONE_REG/KVM_GET_ONE_REG to generic code Rusty Russell
2012-09-01 9:11 ` Avi Kivity
2012-09-01 10:18 ` Peter Maydell
2012-09-01 10:44 ` Avi Kivity
2012-08-28 23:46 ` [RFC 2/5] KVM: ARM: use KVM_SET_ONE_REG/KVM_GET_ONE_REG Rusty Russell
2012-08-29 15:10 ` Christoffer Dall
2012-08-28 23:47 ` [RFC 3/5] KVM: Add KVM_VCPU_GET_REG_LIST Rusty Russell
2012-08-29 15:13 ` Christoffer Dall
2012-08-28 23:47 ` [RFC 4/5] KVM: ARM: Use KVM_VCPU_GET_REG_LIST Rusty Russell
2012-08-29 15:14 ` Christoffer Dall
2012-08-28 23:48 ` [RFC 5/5] KVM: ARM: Access all registers via KVM_GET_ONE_REG/KVM_SET_ONE_REG Rusty Russell
2012-08-29 15:29 ` Christoffer Dall
2012-09-01 9:14 ` Avi Kivity
2012-08-29 15:36 ` Peter Maydell
2012-08-29 18:21 ` Rusty Russell
2012-09-01 9:16 ` Avi Kivity
2012-09-01 10:25 ` Peter Maydell
2012-09-01 19:40 ` Christoffer Dall
2012-09-04 13:09 ` Peter Maydell
2012-09-04 14:29 ` Christoffer Dall
2012-09-05 6:37 ` Rusty Russell
2012-08-29 18:16 ` Rusty Russell
2012-08-29 16:30 ` [RFC 0/5] Making KVM_GET_ONE_REG/KVM_SET_ONE_REG generic Peter Maydell
2012-08-29 18:39 ` Rusty Russell
2012-09-01 9:21 ` Avi Kivity
2012-09-01 12:35 ` Rusty Russell
2012-09-03 9:20 ` Avi Kivity
2012-09-03 12:33 ` Rusty Russell
2012-09-03 12:49 ` Peter Maydell
2012-09-04 11:48 ` Avi Kivity
2012-09-04 13:59 ` Alexander Graf
2012-09-06 14:44 ` Avi Kivity
2012-09-05 6:43 ` Rusty Russell
2012-09-01 12:28 ` Rusty Russell
2012-09-01 12:37 ` Rusty Russell
2012-09-04 13:31 ` Peter Maydell
2012-09-05 3:15 ` Alexander Graf
2012-09-05 6:48 ` Rusty Russell [this message]
2012-09-05 8:52 ` Peter Maydell
2012-09-06 1:44 ` Rusty Russell
2012-09-06 7:37 ` Peter Maydell
2012-09-06 14:48 ` Avi Kivity
2012-09-06 15:08 ` Alexander Graf
2012-09-06 15:16 ` Avi Kivity
2012-09-06 15:23 ` Peter Maydell
2012-09-06 15:35 ` Avi Kivity
2012-09-06 23:00 ` Rusty Russell
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=87ipbtj77o.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=c.dall@virtualopensystems.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=peter.maydell@linaro.org \
--cc=rusty.russell@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.