[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 11/15] target/arm/kvm64: Add kvm_arch_get/put
From: |
Andrew Jones |
Subject: |
Re: [Qemu-devel] [PATCH v3 11/15] target/arm/kvm64: Add kvm_arch_get/put_sve |
Date: |
Tue, 6 Aug 2019 14:24:00 +0200 |
User-agent: |
NeoMutt/20180716 |
On Fri, Aug 02, 2019 at 11:07:54AM -0700, Richard Henderson wrote:
> On 8/2/19 5:25 AM, Andrew Jones wrote:
> > +/*
> > + * SVE registers are encoded in KVM's memory in an endianness-invariant
> > format.
> > + * The byte at offset i from the start of the in-memory representation
> > contains
> > + * the bits [(7 + 8 * i) : (8 * i)] of the register value. As this means
> > the
> > + * lowest offsets are stored in the lowest memory addresses, then that
> > nearly
> > + * matches QEMU's representation, which is to use an array of host-endian
> > + * uint64_t's, where the lower offsets are at the lower indices. To
> > complete
> > + * the translation we just need to byte swap the uint64_t's on big-endian
> > hosts.
> > + */
> > +#ifdef HOST_WORDS_BIGENDIAN
> > +static uint64_t *sve_bswap64(uint64_t *dst, uint64_t *src, int nr)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < nr; ++i) {
> > + dst[i] = bswap64(src[i]);
> > + }
> > +
> > + return dst;
> > +}
> > +#endif
>
> Maybe better as
>
> static uint64_t *sve_bswap64(uint64_t *tmp, uint64_t *src, int nr)
> {
> #ifdef HOST_WORDS_BIGENDIAN
> int i;
>
> for (i = 0; i < nr; ++i) {
> tmp[i] = bswap64(src[i]);
> }
>
> return tmp;
> #else
> return src;
> #endif
> }
>
> and then the rest of the ifdefs can be removed.
Will do for v4.
>
> Otherwise,
> Reviewed-by: Richard Henderson <address@hidden>
Thanks!
drew
- [Qemu-devel] [PATCH v3 05/15] target/arm/helper: zcr: Add build bug next to value range assumption, (continued)
- [Qemu-devel] [PATCH v3 05/15] target/arm/helper: zcr: Add build bug next to value range assumption, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 06/15] target/arm/cpu: Use div-round-up to determine predicate register array size, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 07/15] target/arm: Allow SVE to be disabled via a CPU property, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 09/15] target/arm/kvm64: Fix error returns, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 10/15] target/arm/kvm64: Move the get/put of fpsimd registers out, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 08/15] target/arm/cpu64: max cpu: Introduce sve<vl-bits> properties, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 11/15] target/arm/kvm64: Add kvm_arch_get/put_sve, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 12/15] target/arm/kvm64: max cpu: Enable SVE when available, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 13/15] target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 15/15] target/arm/kvm: host cpu: Add support for sve<vl-bits> properties, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH v3 14/15] target/arm/cpu64: max cpu: Support sve properties with KVM, Andrew Jones, 2019/08/02
- [Qemu-devel] [PATCH] HACK: Centralize sve property checks, Richard Henderson, 2019/08/09
- Re: [Qemu-devel] [PATCH v3 00/15] target/arm/kvm: enable SVE in guests, Peter Maydell, 2019/08/15
- [Qemu-devel] [PATCH v3 00/15] target/arm/kvm: enable SVE in guests, Zhang, Lei, 2019/08/20