head 1.2; access; symbols pkgsrc-2018Q4:1.1.0.2 pkgsrc-2018Q4-base:1.1; locks; strict; comment @# @; 1.2 date 2019.03.07.11.13.26; author bouyer; state dead; branches; next 1.1; commitid Gzute5jK7xPyjqeB; 1.1 date 2018.11.28.14.00.49; author bouyer; state Exp; branches; next ; commitid C93LX9fVeilTsI1B; desc @@ 1.2 log @Update to 4.11.1nb1 PKGREVISION set to 1 on purpose, because this is not a stock 4.11.1 kernel (it includes security patches). 4.11.1 includes all security patches up to XSA282. Apply official patches for XSA284, XSA285, XSA287, XSA288, XSA290, XSA291, XSA292, XSA293 and XSA294. Other changes since 4.11.0 are mostly bugfixes, no new features. @ text @$NetBSD: patch-XSA282-1,v 1.1 2018/11/28 14:00:49 bouyer Exp $ From: Jan Beulich Subject: x86: extend get_platform_badpages() interface Use a structure so along with an address (now frame number) an order can also be specified. This is part of XSA-282. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- xen/arch/x86/guest/xen.c.orig +++ xen/arch/x86/guest/xen.c @@@@ -40,7 +40,7 @@@@ bool __read_mostly xen_guest; static __read_mostly uint32_t xen_cpuid_base; extern char hypercall_page[]; static struct rangeset *mem; -static unsigned long __initdata reserved_pages[2]; +static struct platform_bad_page __initdata reserved_pages[2]; DEFINE_PER_CPU(unsigned int, vcpu_id); @@@@ -326,7 +326,7 @@@@ void __init hypervisor_fixup_e820(struct panic("Unable to get " #p); \ mark_pfn_as_ram(e820, pfn); \ ASSERT(i < ARRAY_SIZE(reserved_pages)); \ - reserved_pages[i++] = pfn << PAGE_SHIFT; \ + reserved_pages[i++].mfn = pfn; \ }) MARK_PARAM_RAM(HVM_PARAM_STORE_PFN); if ( !pv_console ) @@@@ -334,7 +334,7 @@@@ void __init hypervisor_fixup_e820(struct #undef MARK_PARAM_RAM } -const unsigned long *__init hypervisor_reserved_pages(unsigned int *size) +const struct platform_bad_page *__init hypervisor_reserved_pages(unsigned int *size) { ASSERT(xen_guest); --- xen/arch/x86/mm.c.orig +++ xen/arch/x86/mm.c @@@@ -5768,23 +5768,23 @@@@ void arch_dump_shared_mem_info(void) mem_sharing_get_nr_saved_mfns()); } -const unsigned long *__init get_platform_badpages(unsigned int *array_size) +const struct platform_bad_page *__init get_platform_badpages(unsigned int *array_size) { u32 igd_id; - static unsigned long __initdata bad_pages[] = { - 0x20050000, - 0x20110000, - 0x20130000, - 0x20138000, - 0x40004000, + static const struct platform_bad_page __initconst snb_bad_pages[] = { + { .mfn = 0x20050000 >> PAGE_SHIFT }, + { .mfn = 0x20110000 >> PAGE_SHIFT }, + { .mfn = 0x20130000 >> PAGE_SHIFT }, + { .mfn = 0x20138000 >> PAGE_SHIFT }, + { .mfn = 0x40004000 >> PAGE_SHIFT }, }; - *array_size = ARRAY_SIZE(bad_pages); + *array_size = ARRAY_SIZE(snb_bad_pages); igd_id = pci_conf_read32(0, 0, 2, 0, 0); - if ( !IS_SNB_GFX(igd_id) ) - return NULL; + if ( IS_SNB_GFX(igd_id) ) + return snb_bad_pages; - return bad_pages; + return NULL; } void paging_invlpg(struct vcpu *v, unsigned long va) --- xen/common/page_alloc.c.orig +++ xen/common/page_alloc.c @@@@ -270,7 +270,7 @@@@ void __init init_boot_pages(paddr_t ps, unsigned long bad_spfn, bad_epfn; const char *p; #ifdef CONFIG_X86 - const unsigned long *badpage = NULL; + const struct platform_bad_page *badpage; unsigned int i, array_size; BUILD_BUG_ON(8 * sizeof(frame_table->u.free.first_dirty) < @@@@ -299,8 +299,8 @@@@ void __init init_boot_pages(paddr_t ps, { for ( i = 0; i < array_size; i++ ) { - bootmem_region_zap(*badpage >> PAGE_SHIFT, - (*badpage >> PAGE_SHIFT) + 1); + bootmem_region_zap(badpage->mfn, + badpage->mfn + (1U << badpage->order)); badpage++; } } @@@@ -312,8 +312,8 @@@@ void __init init_boot_pages(paddr_t ps, { for ( i = 0; i < array_size; i++ ) { - bootmem_region_zap(*badpage >> PAGE_SHIFT, - (*badpage >> PAGE_SHIFT) + 1); + bootmem_region_zap(badpage->mfn, + badpage->mfn + (1U << badpage->order)); badpage++; } } --- xen/include/asm-x86/guest/xen.h.orig +++ xen/include/asm-x86/guest/xen.h @@@@ -37,7 +37,7 @@@@ void hypervisor_ap_setup(void); int hypervisor_alloc_unused_page(mfn_t *mfn); int hypervisor_free_unused_page(mfn_t mfn); void hypervisor_fixup_e820(struct e820map *e820); -const unsigned long *hypervisor_reserved_pages(unsigned int *size); +const struct platform_bad_page *hypervisor_reserved_pages(unsigned int *size); uint32_t hypervisor_cpuid_base(void); void hypervisor_resume(void); @@@@ -65,7 +65,7 @@@@ static inline void hypervisor_fixup_e820 ASSERT_UNREACHABLE(); } -static inline const unsigned long *hypervisor_reserved_pages(unsigned int *size) +static inline const struct platform_bad_page *hypervisor_reserved_pages(unsigned int *size) { ASSERT_UNREACHABLE(); return NULL; --- xen/include/asm-x86/mm.h.orig +++ xen/include/asm-x86/mm.h @@@@ -348,7 +348,13 @@@@ void zap_ro_mpt(mfn_t mfn); bool is_iomem_page(mfn_t mfn); -const unsigned long *get_platform_badpages(unsigned int *array_size); +struct platform_bad_page { + unsigned long mfn; + unsigned int order; +}; + +const struct platform_bad_page *get_platform_badpages(unsigned int *array_size); + /* Per page locks: * page_lock() is used for two purposes: pte serialization, and memory sharing. * @ 1.1 log @Apply available security patches relevant for Xen 4.11, up to XSA282. Bump PKGREVISION @ text @d1 1 a1 1 $NetBSD: $ @