qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V15 4/5] i386: add a Virtual Machine Generation


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH V15 4/5] i386: add a Virtual Machine Generation ID device
Date: Wed, 03 Jun 2015 18:37:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Since Michael said he'd merge this version, there's just one thing I
would change.  You can access the region only one byte at a time, and
let the memory core fix endianness here:

On 27/04/2015 13:19, Gal Hammer wrote:
> +static uint64_t vmgenid_ram_read(void *opaque, hwaddr addr,
> +                                 unsigned size)
> +{
> +    VmGenIdState *s = VMGENID(opaque);
> +    uint64_t value;
> +
> +    memcpy(&value, s->guid + addr, size);

value = s->guid[addr];

> +    return value;
> +}
> +
> +static const MemoryRegionOps vmgenid_ram_ops = {
> +    .read = vmgenid_ram_read,
> +    .valid = {
> +        .min_access_size = 4,
> +        .max_access_size = 4,
> +    },

And instead of this .valid declaration, use this:

    .valid.min_access_size = 1,
    .valid.max_access_size = 4,
    .impl.min_access_size = 1,
    .impl.max_access_size = 1,


> +    .endianness = DEVICE_NATIVE_ENDIAN,

    .endianness = DEVICE_LITTLE_ENDIAN


> +};

Thanks,

Paolo



reply via email to

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