Skip to contentSkip to conversation

start qemu failed with --enable-kvm -vga std

Qemu-devel Peng Huang 6 participants 20 messages Apr 8, 2009

lore
Share & tools
lore

Peng Huang

author
#0 lore raw

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Regards,
Peng Huang

hw/pc.c +1 -1
index f9cfd1f..7775c7b 100644
@@ -876,7 +876,7 @@ vga_bios_error:
             exit(1);
         }
        /* Round up vga bios size to the next 2k boundary */
-       vga_bios_size = (vga_bios_size + 2047) & ~2047;
+       vga_bios_size = (vga_bios_size + 4095) & ~4095;
        option_rom_start = 0xc0000 + vga_bios_size;
 
         /* setup basic memory access */
#1 lore raw
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

This is almost certainly the wrong way to fix this.

Paul

#2 lore raw
In reply to Peng Huang
Quoted 3 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Regards,

Anthony Liguori

Quoted 18 lines

Regards,
Peng Huang

hw/pc.c +1 -1
index f9cfd1f..7775c7b 100644
@@ -876,7 +876,7 @@ vga_bios_error:
             exit(1);
         }
        /* Round up vga bios size to the next 2k boundary */
-       vga_bios_size = (vga_bios_size + 2047) & ~2047;
+       vga_bios_size = (vga_bios_size + 4095) & ~4095;
        option_rom_start = 0xc0000 + vga_bios_size;
 
         /* setup basic memory access */
#3 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 7 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#4 lore raw
Quoted 11 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

My next free time slot is reserved now for the anyway required enhancement of kvm's slot management in qemu. kvm-userspace could catch up afterwards (finally fixing its broken text console after reset...).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 21 lines · Jan Kiszka
Quoted 11 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Quoted 8 lines

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

I've considered this, but then the alignment constraints become implicit, rather than explicit. Consider the option rom registration code itself.

We should start loading option roms right after vga. If kvm layer aligns the region
implicitly, then where will option roms start? At better, we would have to tell qemu back that such an alignment were made, to start looking for option roms in the right place.

I believe being explicit, and requiring page alignment is safer, and does not hurt.

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#6 lore raw
Quoted 29 lines · Glauber Costa
Quoted 19 lines · Jan Kiszka
Quoted 10 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Quoted 8 lines

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

Quoted 4 lines

I've considered this, but then the alignment constraints become implicit, rather than explicit. Consider the option rom registration code itself.

We should start loading option roms right after vga. If kvm layer

Unless I misread something, this is about option ROMs after VGA ROM.

Quoted 5 lines

aligns the region
implicitly, then where will option roms start? At better, we would have to tell qemu back that such an alignment were made, to start looking for option roms in the right place.

My ideas is to merge both ROM regions (given we are actually talking about compatible stuff here): the 2k VGA ROM would first be expanded to 4k, then the next option ROM starting after the VGA would extend the latter. But that's plain theory so far.

Quoted 2 lines

I believe being explicit, and requiring page alignment is safer, and does not hurt.

In this case, we would waste 2k of (sometimes) precious low mem...

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#7 lore raw
Quoted 48 lines · Jan Kiszka
Quoted 29 lines · Glauber Costa
Quoted 19 lines · Jan Kiszka
Quoted 10 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Quoted 8 lines

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

Quoted 4 lines

I've considered this, but then the alignment constraints become implicit, rather than explicit. Consider the option rom registration code itself.

We should start loading option roms right after vga. If kvm layer

Unless I misread something, this is about option ROMs after VGA ROM.

Quoted 5 lines

aligns the region
implicitly, then where will option roms start? At better, we would have to tell qemu back that such an alignment were made, to start looking for option roms in the right place.

My ideas is to merge both ROM regions (given we are actually talking about compatible stuff here): the 2k VGA ROM would first be expanded to 4k, then the next option ROM starting after the VGA would extend the latter. But that's plain theory so far.

Quoted 5 lines
Quoted 2 lines

I believe being explicit, and requiring page alignment is safer, and does not hurt.

In this case, we would waste 2k of (sometimes) precious low mem...

If we can merge the regions, then I agree with you. We'll probably have an alignment requirement anyway, but it can well be handled in kvm layer.

However, as you ack yourself, it is likely to take some time. In the mean time, I believe this fix is acceptable. Unless you're planning on having something to fix it in the next few days.

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#8 lore raw
Quoted 51 lines · Glauber Costa
Quoted 40 lines · Jan Kiszka
Quoted 28 lines · Glauber Costa
Quoted 19 lines · Jan Kiszka
Quoted 10 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Quoted 8 lines

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

Quoted 4 lines

I've considered this, but then the alignment constraints become implicit, rather than explicit. Consider the option rom registration code itself.

We should start loading option roms right after vga. If kvm layer

Unless I misread something, this is about option ROMs after VGA ROM.

Quoted 5 lines

aligns the region
implicitly, then where will option roms start? At better, we would have to tell qemu back that such an alignment were made, to start looking for option roms in the right place.

Quoted 9 lines

My ideas is to merge both ROM regions (given we are actually talking about compatible stuff here): the 2k VGA ROM would first be expanded to 4k, then the next option ROM starting after the VGA would extend the latter. But that's plain theory so far.

Quoted 2 lines

I believe being explicit, and requiring page alignment is safer, and does not hurt.

In this case, we would waste 2k of (sometimes) precious low mem...

Quoted 6 lines

If we can merge the regions, then I agree with you. We'll probably have an alignment requirement anyway, but it can well be handled in kvm layer.

However, as you ack yourself, it is likely to take some time. In the mean time, I believe this fix is acceptable. Unless you're planning on having something to fix it in the next few days.

Easter is coming - if I find my eggs quickly, there might be some time left... ;)

I leave the decision up to the maintainers if we should merge this workaround first, or wait a bit longer until we know for sure if we can fix it in a cleaner way.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#9 lore raw
Quoted 55 lines · Jan Kiszka
Quoted 54 lines · Glauber Costa
Quoted 40 lines · Jan Kiszka
Quoted 28 lines · Glauber Costa
Quoted 19 lines · Jan Kiszka
Quoted 10 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Quoted 8 lines

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

Quoted 4 lines

I've considered this, but then the alignment constraints become implicit, rather than explicit. Consider the option rom registration code itself.

We should start loading option roms right after vga. If kvm layer

Unless I misread something, this is about option ROMs after VGA ROM.

Quoted 5 lines

aligns the region
implicitly, then where will option roms start? At better, we would have to tell qemu back that such an alignment were made, to start looking for option roms in the right place.

Quoted 9 lines

My ideas is to merge both ROM regions (given we are actually talking about compatible stuff here): the 2k VGA ROM would first be expanded to 4k, then the next option ROM starting after the VGA would extend the latter. But that's plain theory so far.

Quoted 2 lines

I believe being explicit, and requiring page alignment is safer, and does not hurt.

In this case, we would waste 2k of (sometimes) precious low mem...

If we can merge the regions, then I agree with you. We'll probably have an alignment requirement anyway, but it can well be handled in kvm layer.

Quoted 6 lines
Quoted 3 lines

However, as you ack yourself, it is likely to take some time. In the mean time, I believe this fix is acceptable. Unless you're planning on having something to fix it in the next few days.

Easter is coming - if I find my eggs quickly, there might be some time left... ;)

You're not planning to use this opportunity to fill qemu code with easter eggs, are you? ;-)

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#10 lore raw
In reply to Jan Kiszka
Quoted 59 lines · Jan Kiszka
Quoted 51 lines · Glauber Costa
Quoted 40 lines · Jan Kiszka
Quoted 28 lines · Glauber Costa
Quoted 19 lines · Jan Kiszka
Quoted 10 lines · Glauber Costa
Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Peng Huang

Hi,

The HEAD version qemu can not execute a VM with --enable-kvm -vga std or -vga vmware on kernel 2.6.29.1-46.fc11.x86_64. I found it is because of qemu call cpu_register_physical_memory with a wrong size. Below patch can fix it on my box. Please test it.

Glauber came up with a similar patch for kvm-userspace and is currently attempting to root cause the issue.

Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

Quoted 8 lines

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

We only map ROM regions here. So rounding them up/down and sending properly aligned requests to the kernel should finally have the same result for all involved pages. Only if non-compatible regions overlap due to such roundings, we should bail out - and start to consider changing device code.

Quoted 4 lines

I've considered this, but then the alignment constraints become implicit, rather than explicit. Consider the option rom registration code itself.

We should start loading option roms right after vga. If kvm layer

Unless I misread something, this is about option ROMs after VGA ROM.

Quoted 5 lines

aligns the region
implicitly, then where will option roms start? At better, we would have to tell qemu back that such an alignment were made, to start looking for option roms in the right place.

Quoted 9 lines

My ideas is to merge both ROM regions (given we are actually talking about compatible stuff here): the 2k VGA ROM would first be expanded to 4k, then the next option ROM starting after the VGA would extend the latter. But that's plain theory so far.

Quoted 2 lines

I believe being explicit, and requiring page alignment is safer, and does not hurt.

In this case, we would waste 2k of (sometimes) precious low mem...

Quoted 6 lines

If we can merge the regions, then I agree with you. We'll probably have an alignment requirement anyway, but it can well be handled in kvm layer.

However, as you ack yourself, it is likely to take some time. In the mean time, I believe this fix is acceptable. Unless you're planning on having something to fix it in the next few days.

Quoted 6 lines

Easter is coming - if I find my eggs quickly, there might be some time left... ;)

I leave the decision up to the maintainers if we should merge this workaround first, or wait a bit longer until we know for sure if we can fix it in a cleaner way.

In all seriousness, no matter how good your series for improving kvm registration
are, it is unlikely to hit the stable branch. So I believe a good deal would have something
on the line of this patch applied to stable, leaving unstable as is, until we can find a better
solution.

What do you think, anthony?

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#11 lore raw

In message: <[email protected]>
Glauber Costa <[email protected]> writes:
: In all seriousness, no matter how good your series for improving kvm : registration
: are, it is unlikely to hit the stable branch. So I believe a good deal : would have something
: on the line of this patch applied to stable, leaving unstable as is, : until we can find a better
: solution.

Huh? It is unlikely to be merged into stable, so let's commit it to stable?

Warner

#12 lore raw
Quoted 10 lines · M. Warner Losh

In message: <[email protected]> Glauber Costa <[email protected]> writes:
: In all seriousness, no matter how good your series for improving kvm : registration
: are, it is unlikely to hit the stable branch. So I believe a good deal : would have something
: on the line of this patch applied to stable, leaving unstable as is, : until we can find a better
: solution.

Quoted 2 lines

Huh?  It is unlikely to be merged into stable, so let's commit it to stable?

Yes. It is a kohan, and whenever you understand it, you'll reach enlightment. So I won't
explain that to you ;-)

I meant that Jan's forthcoming series that heavily touch kvm memory registration (the beautiful way)
is unlikely to get into stable. So I'd advocate applying this patch (the said ugly way) to stable.
Otherwise we'll get -vga std broken for good.

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#13 lore raw

In message: <[email protected]>
Glauber Costa <[email protected]> writes:
: On Wed, Apr 8, 2009 at 2:39 PM, M. Warner Losh <[email protected]> wrote:
: > In message: <[email protected]> : >            Glauber Costa <[email protected]> writes:
: > : In all seriousness, no matter how good your series for improving kvm : > : registration
: > : are, it is unlikely to hit the stable branch. So I believe a good deal : > : would have something
: > : on the line of this patch applied to stable, leaving unstable as is, : > : until we can find a better
: > : solution.
: >
: > Huh?  It is unlikely to be merged into stable, so let's commit it to : > stable?
: Yes. It is a kohan, and whenever you understand it, you'll reach : enlightment. So I won't
: explain that to you ;-)

I am the tree that falls in the forrest, if I'm deaf, do I still make a sound?

: I meant that Jan's forthcoming series that heavily touch kvm memory : registration (the beautiful way)
: is unlikely to get into stable. So I'd advocate applying this patch : (the said ugly way) to stable.
: Otherwise we'll get -vga std broken for good.

OK. That makes sense...

Warner

#14 lore raw
In reply to M. Warner Losh
Quoted 11 lines · M. Warner Losh

In message: <[email protected]>

Glauber Costa <[email protected]> writes:
: In all seriousness, no matter how good your series for improving kvm : registration
: are, it is unlikely to hit the stable branch. So I believe a good deal : would have something
: on the line of this patch applied to stable, leaving unstable as is, : until we can find a better
: solution.

Quoted 2 lines

Huh? It is unlikely to be merged into stable, so let's commit it to stable?

I think the suggestion is that we apply an ugly hack on just the stable branch, and fix it properly later on the development.

FWIW I think this is a bad idea. We should never fix something on the stable branch that isn't also fixed on the development branch. If the changes are causing problems, then my suggestion is to revert the original change (i.e. the support for >64k roms).

Paul

#15 lore raw
Quoted 15 lines · Paul Brook
Quoted 11 lines · M. Warner Losh

In message: <[email protected]>

            Glauber Costa <[email protected]> writes:
: In all seriousness, no matter how good your series for improving kvm : registration
: are, it is unlikely to hit the stable branch. So I believe a good deal : would have something
: on the line of this patch applied to stable, leaving unstable as is, : until we can find a better
: solution.

Quoted 2 lines

Huh?  It is unlikely to be merged into stable, so let's commit it to stable?

Quoted 7 lines

I think the suggestion is that we apply an ugly hack on just the stable branch, and fix it properly later on the development.

FWIW I think this is a bad idea. We should never fix something on the stable branch that isn't also fixed on the development branch. If the changes are causing problems, then my suggestion is to revert the original change (i.e. the support for >64k roms).

Just checked, and the > 64 roms patch is not on stable branch.

So this is a non issue.

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#16 lore raw
In reply to Glauber Costa
Quoted 11 lines · Glauber Costa

In all seriousness, no matter how good your series for improving kvm registration
are, it is unlikely to hit the stable branch. So I believe a good deal would have something
on the line of this patch applied to stable, leaving unstable as is, until we can find a better
solution.

What do you think, anthony?

As mentioned on IRC, we don't have this problem in stable.

Regards,

Anthony Liguori

#17 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka

Easter is coming - if I find my eggs quickly, there might be some time left... ;)

I leave the decision up to the maintainers if we should merge this workaround first, or wait a bit longer until we know for sure if we can fix it in a cleaner way.

I'd rather wait for a proper fix so I'll let Glauber's patch age a bit in my queue.

Regards,

Anthony Liguori

Quoted 1 line
#18 lore raw
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Jan Kiszka

Easter is coming - if I find my eggs quickly, there might be some time left... ;)

Quoted 7 lines
Quoted 4 lines

I leave the decision up to the maintainers if we should merge this workaround first, or wait a bit longer until we know for sure if we can fix it in a cleaner way.

I'd rather wait for a proper fix so I'll let Glauber's patch age a bit in my queue.

Beware.

If it ages too much, I'll want to drink it.

#19 lore raw
In reply to Jan Kiszka
Quoted 11 lines
Quoted 8 lines

I believe this is in fact the root cause. KVM slot management code probably require
memory to be page aligned. By trying to register a region that is not page aligned,
the ioctl may fail. I, however, did not see this happening in qemu upstream (only kvm-userspace),
and have absolutely no idea about why. But the patch makes perfect sense to me.

But this really sounds like a limitation that should better be fixed in the kvm layer, not the device/machine code.

I was meaning more why we're creating regions for individual roms. Just map the whole block at once.

FWIW kvm probably needs to be able to handle small regions anyway, some PCI devices require them.

Paul