On 10/21/2009 08:06 PM, Anthony Liguori wrote:
Alexander Graf wrote:
So you would prefer a special #ifdef for s390 in generic code over a
specifically for this purpose exported function?
Well, you're the boss. I like the special function better, but
whatever you say.
How is someone supposed to figure out what _qemu_ram_alloc is for?
Nothing in your patch really indicates that.
However, an ugly #ifdef immediately tells someone, oh, s390 kvm needs
this terrible hack, so let's keep bugging those guys to eliminate the
need for that.
What about this:
-ram_addr_t qemu_ram_alloc(ram_addr_t size)
+ram_addr_t qemu_ram_alloc_at(ram_addr_t size, void *map_at)
{
RAMBlock *new_block;
size = TARGET_PAGE_ALIGN(size);
new_block = qemu_malloc(sizeof(*new_block));
- new_block->host = qemu_vmalloc(size);
+ if (map_at) {
+ new_block->host = map_at;
+ } else {
+ new_block->host = qemu_vmalloc(size);
+ }
#ifdef MADV_MERGEABLE
madvise(new_block->host, size, MADV_MERGEABLE);
#endif
and calling mmap where you're currently calling _qemu_ram_alloc?
Paolo