From patchwork Tue Jul 25 09:50:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 9861603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 26F67601A1 for ; Tue, 25 Jul 2017 09:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11DC328600 for ; Tue, 25 Jul 2017 09:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0684D2860E; Tue, 25 Jul 2017 09:52:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B20F828600 for ; Tue, 25 Jul 2017 09:52:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZwTw-0008VU-ED; Tue, 25 Jul 2017 09:50:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZwTv-0008Uv-6u for xen-devel@lists.xenproject.org; Tue, 25 Jul 2017 09:50:23 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id 1A/E7-01724-E5417795; Tue, 25 Jul 2017 09:50:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVyuP0Ov26sSHm kwa7tNhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b5ww9YCs7zV8xsncPWwLiTt4uRk0NCwEji 7cR/TF2MXBxCAgsZJX5s2MUGkmATUJXYcP0UK4gtIhAksaGjlQnEZhaokGj5f4kFxBYWcJXYP +kvWD0LUP2mrx1gNq+AscS8my+ZIRbIS3QcmAxWzylgIjFj7lIgmwNombHEup+8Exi5FzAyrG LUKE4tKkst0jW01EsqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECPRuPQMD4w7G38f 9DjFKcjApifKm7yqLFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBKypcHikkWJSanlqRlpkDDDOY tAQHj5IIbz5Imre4IDG3ODMdInWKUZfj1YT/35iEWPLy81KlxHldQIoEQIoySvPgRsBC/hKjr JQwLyMDA4MQT0FqUW5mCar8K0ZxDkYlYV4ukCk8mXklcJteAR3BBHTEnBmlIEeUJCKkpBoYjz sVOpbMnLVt1r2jttLz4orfMvanNhxwcA+6Pd8uye/WNBOumvg6tm/XU4X/v1FWFvz7b8E+w+U HSx/ofvzwdsJWjmJ3/n+P5j9c3pm1RC8gf8nMfYuPxXBzzgjesfnzx0burkaJjysntZqGpr6f UCl5jvVj4kutU5+TGtYbpf08+Ge+2Mmnb5VYijMSDbWYi4oTAcQj72x0AgAA X-Env-Sender: jgross@suse.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1500976221!107063353!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44335 invoked from network); 25 Jul 2017 09:50:21 -0000 Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by server-8.tower-31.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 25 Jul 2017 09:50:21 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A8E8AAC40; Tue, 25 Jul 2017 09:50:21 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Date: Tue, 25 Jul 2017 11:50:11 +0200 Message-Id: <20170725095013.2939-2-jgross@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170725095013.2939-1-jgross@suse.com> References: <20170725095013.2939-1-jgross@suse.com> Cc: Juergen Gross , boris.ostrovsky@oracle.com, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com Subject: [Xen-devel] [PATCH 1/3] x86: provide an init_mem_mapping hypervisor hook X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Provide a hook in hypervisor_x86 called after setting up initial memory mapping. This is needed e.g. by Xen HVM guests to map the hypervisor shared info page. Signed-off-by: Juergen Gross --- arch/x86/include/asm/hypervisor.h | 10 ++++++++++ arch/x86/mm/init.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 21126155a739..60ebda5e5101 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h @@ -43,6 +43,9 @@ struct hypervisor_x86 { /* pin current vcpu to specified physical cpu (run rarely) */ void (*pin_vcpu)(int); + + /* called during init_mem_mapping() to setup early mappings. */ + void (*init_mem_mapping)(void); }; extern const struct hypervisor_x86 *x86_hyper; @@ -57,8 +60,15 @@ extern const struct hypervisor_x86 x86_hyper_kvm; extern void init_hypervisor_platform(void); extern bool hypervisor_x2apic_available(void); extern void hypervisor_pin_vcpu(int cpu); + +static inline void hypervisor_init_mem_mapping(void) +{ + if (x86_hyper->init_mem_mapping) + x86_hyper->init_mem_mapping(); +} #else static inline void init_hypervisor_platform(void) { } static inline bool hypervisor_x2apic_available(void) { return false; } +static inline void hypervisor_init_mem_mapping(void) { } #endif /* CONFIG_HYPERVISOR_GUEST */ #endif /* _ASM_X86_HYPERVISOR_H */ diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 673541eb3b3f..bf3f1065d6ad 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -18,6 +18,7 @@ #include /* for MAX_DMA_PFN */ #include #include +#include /* * We need to define the tracepoints somewhere, and tlb.c @@ -636,6 +637,8 @@ void __init init_mem_mapping(void) load_cr3(swapper_pg_dir); __flush_tlb_all(); + hypervisor_init_mem_mapping(); + early_memtest(0, max_pfn_mapped << PAGE_SHIFT); }