qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]