[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: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v3 11/15] target/arm/kvm64: Add kvm_arch_get/put_sve |
Date: |
Fri, 2 Aug 2019 11:07:54 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
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.
Otherwise,
Reviewed-by: Richard Henderson <address@hidden>
r~
- [Qemu-devel] [PATCH v3 04/15] tests: arm: Introduce cpu feature tests, (continued)
- [Qemu-devel] [PATCH v3 04/15] tests: arm: Introduce cpu feature tests, Andrew Jones, 2019/08/02
- [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
- Re: [Qemu-devel] [PATCH v3 11/15] target/arm/kvm64: Add kvm_arch_get/put_sve,
Richard Henderson <=
- [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