From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH 1/2] x86/xen: set regions above the end of RAM as 1:1 Date: Mon, 6 Jan 2014 11:20:52 +0000 Message-ID: <52CA9194.8040600@citrix.com> References: <1388767522-11768-1-git-send-email-david.vrabel@citrix.com> <1388767522-11768-2-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: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Boris Ostrovsky , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 03/01/14 18:12, Stefano Stabellini wrote: > On Fri, 3 Jan 2014, David Vrabel wrote: >> From: David Vrabel >> >> PCI devices may have BARs located above the end of RAM so mark such >> frames as identity frames in the p2m (instead of the default of >> missing). >> >> PFNs outside the p2m (above MAX_P2M_PFN) are also considered to be >> identity frames for the same reason. >> >> Signed-off-by: David Vrabel > > Shouldn't this be the case only for dom0? I don't see why. DomUs can have PCI devices with high MMIO regions passed-through. >> --- a/arch/x86/xen/p2m.c >> +++ b/arch/x86/xen/p2m.c >> @@ -481,7 +481,7 @@ unsigned long get_phys_to_machine(unsigned long pfn) >> unsigned topidx, mididx, idx; >> >> if (unlikely(pfn >= MAX_P2M_PFN)) >> - return INVALID_P2M_ENTRY; >> + return IDENTITY_FRAME(pfn); >> >> topidx = p2m_top_index(pfn); >> mididx = p2m_mid_index(pfn); >> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c >> index 68c054f..6d7798f 100644 >> --- a/arch/x86/xen/setup.c >> +++ b/arch/x86/xen/setup.c >> @@ -412,6 +412,16 @@ char * __init xen_memory_setup(void) >> max_pfn = min(MAX_DOMAIN_PAGES, last_pfn); >> mem_end = PFN_PHYS(max_pfn); >> } >> + >> + /* >> + * Set the rest as identity mapped, in case PCI BARs are >> + * located here. >> + * >> + * PFNs above MAX_P2M_PFN are considered identity mapped as >> + * well. >> + */ >> + set_phys_range_identity(max_pfn + 1, ~0ul); >> + > > Wouldn't this increase the size of the P2M considerably? I thought the p2m code would be smart but I see I need to add a p2m_mid_identity page (similar to the existign p2m_mid_missing page) and make sure we use it. David