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: Gal Hammer
Subject: Re: [Qemu-devel] [PATCH V15 4/5] i386: add a Virtual Machine Generation ID device
Date: Mon, 08 Jun 2015 16:42:16 +0300
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 03/06/2015 19:37, Paolo Bonzini wrote:

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:

I've applied the change offered below. Thanks.

There are two unanswered questions:

1. You wrote that I should not use the memory_region_init_io() function. Should I use memory_region_init_ram() instead?

2. Is it possible to create a sysbus device using the "-device" command line argument? I vaguely recall that it is not possible to do it and that's the reason that I specifically add the device in the pc init.

Thanks,

    Gal.

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]