qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v6)


From: Paolo Bonzini
Subject: Re: [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v6)
Date: Wed, 13 Nov 2013 16:49:45 -0500 (EST)

> > > +    if (guest_info->gb_align && above_4g_mem_size > holesize) {
> > > +        /* Round the allocation up to 2 MB to use more hugepages.
> 
> To align to 2MB boundary, the number of hugepages is the same.

Right.

> > > +         * Remove the slack from the [yyy] piece so that pieceonesize
> > > +         * (and thus the start of piecetwo) remains aligned.
> > > +         */
> > > +        align_offset = ROUND_UP(memsize, 1UL << 21) - memsize;
> > > +        piecetwosize = holesize - align_offset;
> > > +    } else {
> > > +        /* There's no "piece one", all memory above 4G starts
> 
> Piece two.

I'm calling "piece one" the part that is aligned at 0x100000000 in the
RAM block, and "piece two" the part that starts at below_4g_mem_size.
I'll change to "there's no [zzzzz] region".

> > > +         * at below_4g_mem_size in the RAM block.  Also no need
> > > +         * to align anything.
> > > +         */
> > > +        align_offset = 0;
> > > +        piecetwosize = above_4g_mem_size;
> > > +    }
> > > +
> > >      ram = g_malloc(sizeof(*ram));
> > > -    memory_region_init_ram(ram, NULL, "pc.ram",
> > > -                           below_4g_mem_size + above_4g_mem_size);
> > > +    memory_region_init_ram(ram, NULL, "pc.ram", memsize + align_offset);
> > >      vmstate_register_ram_global(ram);
> > >      *ram_memory = ram;
> > > +
> > >      ram_below_4g = g_malloc(sizeof(*ram_below_4g));
> > >      memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram,
> > >                               0, below_4g_mem_size);
> > >      memory_region_add_subregion(system_memory, 0, ram_below_4g);
> > > +
> > > +    pieceonesize = above_4g_mem_size - piecetwosize;
> > > +    if (pieceonesize) {
> > > +        ram_above_4g_pieceone =
> > > g_malloc(sizeof(*ram_above_4g_pieceone));
> > > +        memory_region_init_alias(ram_above_4g_pieceone, NULL,
> > > +                                 "ram-above-4g-pieceone", ram,
> > > +                                 0x100000000ULL, pieceonesize);
> > > +        memory_region_add_subregion(system_memory, 0x100000000ULL,
> > > +                                    ram_above_4g_pieceone);
> > > +    }
> > 
> > Can you change the name of aliases and subregions without breaking
> > migration?

Yes, memory regions are invisible except for RAM regions.

> Test with Q35?

Will do.  Thanks for the review!

Paolo



reply via email to

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