From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve1lw-0004Z1-EN for qemu-devel@nongnu.org; Wed, 06 Nov 2013 06:59:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve1lq-00082R-07 for qemu-devel@nongnu.org; Wed, 06 Nov 2013 06:59:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve1lp-00080l-NX for qemu-devel@nongnu.org; Wed, 06 Nov 2013 06:59:37 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA6Bxa8l003275 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Nov 2013 06:59:36 -0500 Date: Wed, 6 Nov 2013 12:59:30 +0100 From: Igor Mammedov Message-ID: <20131106125930.3be6fb4e@nial.usersys.redhat.com> In-Reply-To: <20131106015543.GA20766@amt.cnet> References: <20131024211158.064049176@amt.cnet> <20131024211249.723543071@amt.cnet> <20131106014930.GA20468@amt.cnet> <20131106015543.GA20766@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v3) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: aarcange@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com, Gerd Hoffmann On Tue, 5 Nov 2013 23:55:43 -0200 Marcelo Tosatti wrote: > > > v2: condition enablement of new mapping to new machine types (Paolo) > v3: fix changelog > > ----- > > > Align guest physical address and host physical address > beyond guest 4GB on a 1GB boundary. > > Otherwise 1GB TLBs cannot be cached for the range. > > Signed-off-by: Marcelo Tosatti > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 0c313fe..534e067 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -1116,7 +1116,7 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory, [...] > + /* > + * > + * If 1GB hugepages are used to back guest RAM, map guest address > + * space in the range [ramsize,ramsize+holesize] to the ram block > + * range [holestart, 4GB] > + * > + * 0 h 4G [ramsize,ramsize+holesize] > + * > + * guest-addr-space [ ] [ ][xxx] > + * /----------/ > + * contiguous-ram-block [ ][xxx][ ] > + * > + * So that memory beyond 4GB is aligned on a 1GB boundary, > + * at the host physical address space. > + * > + */ > + if (guest_info->gb_align) { 'gb_align' is one shot usage, it would be better to just add it as an argument to pc_memory_init(). That would allow to avoid extending PcGuestInfo needlessly, since gb_align isn't reused. > + unsigned long holesize = 0x100000000ULL - below_4g_mem_size; > + > + memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", ram, > + 0x100000000ULL, > + above_4g_mem_size - holesize); > + memory_region_add_subregion(system_memory, 0x100000000ULL, > ram_above_4g); [...] > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index 6083839..00afe4a 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -20,6 +20,7 @@ typedef struct PcPciInfo { > struct PcGuestInfo { > bool has_pci_info; > bool isapc_ram_fw; > + bool gb_align; > FWCfgState *fw_cfg; > }; it doesn't apply anymore.