From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH] x86/xen: during early setup, only 1:1 map the ISA region Date: Tue, 16 Jul 2013 12:36:31 +0100 Message-ID: <51E5303F.5020901@citrix.com> References: <1373909381-20954-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1373909381-20954-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: Aurelien Chartier , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 15/07/13 18:29, David Vrabel wrote: > From: David Vrabel > > During early setup, when the reserved regions and MMIO holes are being > setup as 1:1 in the p2m, clear any mappings instead of making them 1:1 > (execept for the ISA region which is expected to be mapped). > > This fixes a regression introduced in 3.5 by 83d51ab473dd (xen/setup: > update VA mapping when releasing memory during setup) which caused > hosts with tboot to fail to boot. > > tboot marks a region in the e820 map as unusable and the dom0 kernel > would attempt to map this region and Xen does not permit unusable > regions to be mapped by guests. Don't apply this one just yet as it can cause boot crashes in find_ibft_region() on certain machines (depending on their e820). Best hold off until I can put it through a few more machines in our lab. The fixed patch is: --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -215,13 +215,19 @@ static void __init xen_set_identity_and_release_chunk( unsigned long pfn; /* - * If the PFNs are currently mapped, the VA mapping also needs - * to be updated to be 1:1. + * If the PFNs are currently mapped, clear the mappings + * (except for the ISA region which must be 1:1 mapped) to + * release the refcounts (in Xen) on the original frames. */ - for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) + for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) { + pte_t pte = __pte_ma(0); + + if (pfn < PFN_UP(ISA_END_ADDRESS)) + pte = mfn_pte(pfn, PAGE_KERNEL_IO); + (void)HYPERVISOR_update_va_mapping( - (unsigned long)__va(pfn << PAGE_SHIFT), - mfn_pte(pfn, PAGE_KERNEL_IO), 0); + (unsigned long)__va(pfn << PAGE_SHIFT), pte, 0); + } if (start_pfn < nr_pages) *released += xen_release_chunk( David