From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve27j-00030j-SA for qemu-devel@nongnu.org; Wed, 06 Nov 2013 07:22:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve27d-0007YX-S7 for qemu-devel@nongnu.org; Wed, 06 Nov 2013 07:22:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve27d-0007Xs-KB for qemu-devel@nongnu.org; Wed, 06 Nov 2013 07:22:09 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA6CM8D7007906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Nov 2013 07:22:08 -0500 Date: Wed, 6 Nov 2013 13:22:02 +0100 From: Igor Mammedov Message-ID: <20131106132202.4a7080d3@nial.usersys.redhat.com> In-Reply-To: <527A30FE.2070107@redhat.com> References: <20131024211158.064049176@amt.cnet> <20131024211249.723543071@amt.cnet> <20131106014930.GA20468@amt.cnet> <20131106015543.GA20766@amt.cnet> <20131106125930.3be6fb4e@nial.usersys.redhat.com> <527A30FE.2070107@redhat.com> 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: Paolo Bonzini Cc: aarcange@redhat.com, Marcelo Tosatti , qemu-devel@nongnu.org, gleb@redhat.com, Gerd Hoffmann On Wed, 06 Nov 2013 13:07:26 +0100 Paolo Bonzini wrote: > Il 06/11/2013 12:59, Igor Mammedov ha scritto: > > 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. > > No, Marcelo's way is better. pc_memory_init already has too many > arguments, moving them to PcGuestInfo (which ultimately might become > properties of the /machine QOM object) is the right thing to do. In general I agree. But unless there is plans to reuse gb_align in future, it doesn't really belong to PcGuestInfo (this change however looks like cannibalizing structure for argument passing only). > > Paolo > > >> + 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. > > > >