From patchwork Thu Sep 26 09:45:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11162121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2E3813B1 for ; Thu, 26 Sep 2019 09:50:14 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF5F9222C0 for ; Thu, 26 Sep 2019 09:50:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="X4XxJfbY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF5F9222C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQOW-0005UW-C7; Thu, 26 Sep 2019 09:49:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQOV-0005SD-49 for xen-devel@lists.xenproject.org; Thu, 26 Sep 2019 09:49:03 +0000 X-Inumbo-ID: dd4f1e92-e042-11e9-8628-bc764e2007e4 Received: from smtp-fw-33001.amazon.com (unknown [207.171.190.10]) by localhost (Halon) with ESMTPS id dd4f1e92-e042-11e9-8628-bc764e2007e4; Thu, 26 Sep 2019 09:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1569491340; x=1601027340; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=3nNvQG1v8uYo6cTIKpiw9dRaihrielmfxq5scEhNceU=; b=X4XxJfbYjWbj0UuvetiLCUNOyydqQqm4ZGx6G8v7ufNiCXt+5gOdJeUa hv2yvr9kS09TS8nq5l4gYFv2ZM+wQ5Ggd96SZ0uErHAf7T/EOPpH9nZCt rx5X2Hq0Akm2EarQHYrK6zbi2c1DdTl9U8zbQhTkA/CV2sSHhubL/dXCf 8=; X-IronPort-AV: E=Sophos;i="5.64,551,1559520000"; d="scan'208";a="836988835" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-1a-715bee71.us-east-1.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 26 Sep 2019 09:48:27 +0000 Received: from EX13MTAUWA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-715bee71.us-east-1.amazon.com (Postfix) with ESMTPS id E26B6A18A8; Thu, 26 Sep 2019 09:48:16 +0000 (UTC) Received: from EX13D19UWA003.ant.amazon.com (10.43.160.170) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:47:49 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D19UWA003.ant.amazon.com (10.43.160.170) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:47:48 +0000 Received: from u9d785c4ba99158.ant.amazon.com (10.125.106.58) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 09:47:47 +0000 From: To: Date: Thu, 26 Sep 2019 10:45:53 +0100 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [RFC PATCH 30/84] efi: avoid using global variable in copy_mapping X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Wei Liu We will soon switch efi_l4_table to use ephemeral mapping. Make copy_mapping take a pointer to the mapping instead of using the global variable. No functional change intended. Signed-off-by: Wei Liu --- xen/common/efi/boot.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 62b5944e61..64a287690a 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1423,7 +1423,8 @@ static int __init parse_efi_param(const char *s) custom_param("efi", parse_efi_param); #ifndef USE_SET_VIRTUAL_ADDRESS_MAP -static __init void copy_mapping(unsigned long mfn, unsigned long end, +static __init void copy_mapping(l4_pgentry_t *l4, + unsigned long mfn, unsigned long end, bool (*is_valid)(unsigned long smfn, unsigned long emfn)) { @@ -1431,7 +1432,7 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end, for ( ; mfn < end; mfn = next ) { - l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)]; + l4_pgentry_t l4e = l4[l4_table_offset(mfn << PAGE_SHIFT)]; l3_pgentry_t *l3src, *l3dst; unsigned long va = (unsigned long)mfn_to_virt(mfn); @@ -1446,7 +1447,7 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end, BUG_ON(mfn_eq(l3t_mfn, INVALID_MFN)); l3dst = map_xen_pagetable_new(l3t_mfn); clear_page(l3dst); - efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] = + l4[l4_table_offset(mfn << PAGE_SHIFT)] = l4e_from_mfn(l3t_mfn, __PAGE_HYPERVISOR); } else @@ -1606,7 +1607,7 @@ void __init efi_init_memory(void) BUG_ON(!efi_l4_pgtable); clear_page(efi_l4_pgtable); - copy_mapping(0, max_page, ram_range_valid); + copy_mapping(efi_l4_pgtable, 0, max_page, ram_range_valid); /* Insert non-RAM runtime mappings inside the direct map. */ for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size ) @@ -1619,7 +1620,7 @@ void __init efi_init_memory(void) desc->Type == EfiBootServicesData))) && desc->VirtualStart != INVALID_VIRTUAL_ADDRESS && desc->VirtualStart != desc->PhysicalStart ) - copy_mapping(PFN_DOWN(desc->PhysicalStart), + copy_mapping(efi_l4_pgtable, PFN_DOWN(desc->PhysicalStart), PFN_UP(desc->PhysicalStart + (desc->NumberOfPages << EFI_PAGE_SHIFT)), rt_range_valid);