Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933089AbbGGTbs (ORCPT ); Tue, 7 Jul 2015 15:31:48 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:23161 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932751AbbGGTbo (ORCPT ); Tue, 7 Jul 2015 15:31:44 -0400 Date: Tue, 7 Jul 2015 15:31:28 -0400 From: Konrad Rzeszutek Wilk To: Boris Ostrovsky Cc: david.vrabel@citrix.com, roger.pau@citrix.com, elena.ufimtseva@oracle.com, stefano.stabellini@eu.citrix.com, tim@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, ian.campbell@citrix.com, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/6] xen/x86/pvh: Properly set page tables for 32-bit PVH guests Message-ID: <20150707193128.GC6372@l.oracle.com> References: <1436240065-10813-1-git-send-email-boris.ostrovsky@oracle.com> <1436240065-10813-4-git-send-email-boris.ostrovsky@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436240065-10813-4-git-send-email-boris.ostrovsky@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2351 Lines: 60 On Mon, Jul 06, 2015 at 11:34:22PM -0400, Boris Ostrovsky wrote: > 32-bit PVH guests don't want to write-protect/pin page tables. > > Signed-off-by: Boris Ostrovsky Reviewed-by: Konrad Rzeszutek Wilk > --- > arch/x86/xen/mmu.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c > index dd151b2..b473df8 100644 > --- a/arch/x86/xen/mmu.c > +++ b/arch/x86/xen/mmu.c > @@ -1762,8 +1762,9 @@ void __init xen_setup_machphys_mapping(void) > machine_to_phys_nr = MACH2PHYS_NR_ENTRIES; > } > #ifdef CONFIG_X86_32 > - WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1)) > - < machine_to_phys_mapping); > + if (!xen_feature(XENFEAT_auto_translated_physmap)) > + WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1)) > + < machine_to_phys_mapping); > #endif > } > > @@ -1958,15 +1959,18 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) > initial_page_table[KERNEL_PGD_BOUNDARY] = > __pgd(__pa(initial_kernel_pmd) | _PAGE_PRESENT); > > - set_page_prot(initial_kernel_pmd, PAGE_KERNEL_RO); > - set_page_prot(initial_page_table, PAGE_KERNEL_RO); > - set_page_prot(empty_zero_page, PAGE_KERNEL_RO); > + if (!xen_feature(XENFEAT_auto_translated_physmap)) { > + set_page_prot(initial_kernel_pmd, PAGE_KERNEL_RO); > + set_page_prot(initial_page_table, PAGE_KERNEL_RO); > + set_page_prot(empty_zero_page, PAGE_KERNEL_RO); > > - pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); > + pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); > > - pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, > - PFN_DOWN(__pa(initial_page_table))); > - xen_write_cr3(__pa(initial_page_table)); > + pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, > + PFN_DOWN(__pa(initial_page_table))); > + xen_write_cr3(__pa(initial_page_table)); > + } else > + native_write_cr3(__pa(initial_page_table)); > > memblock_reserve(__pa(xen_start_info->pt_base), > xen_start_info->nr_pt_frames * PAGE_SIZE); > -- > 1.8.1.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/