Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp387179pxk; Thu, 3 Sep 2020 02:19:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8IE8qao5SOkkPTDf8F3QMj/no0nahP0DNv4Ilu8HyXjjBZpndgnju+JD3VnOWS/LO3X6q X-Received: by 2002:a50:e68a:: with SMTP id z10mr2160838edm.100.1599124750137; Thu, 03 Sep 2020 02:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599124750; cv=none; d=google.com; s=arc-20160816; b=AZObJ5t8NQjlD3cS9H3xrsU8F9ceu0QDZ9CwTX9X3g1IC6k/v3rGYMyni64H3WhOyk LPYFPtBshSQPa2J3cJtrAbu+I9ZrtWuR7TnKmubrkqFr3Ae+w1jk5JX7rV+uf8HDjJ2O TtOQtaRLFBJfoADbEwQDSMYYkxWa8UUBteLVMlcRkqReQMTfDihGFcc15m3jTSKoUj0Y 685cEjYETmKT3LjaUR+2Wmd1Mb88QWoHfOWsduAVy9I4fbAle5Ux2tI2hvWm+gCEzFyc ZnYojwVbzZcjgdCOm1SPTliIPb2dUlzglv97SNV2e+bms664yZ8XPPN5uk6d2jUYPSjK zVtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ks8zbpt3K53ylw0T/eWvGEXanQshe4hPX9kTva9RnTk=; b=G76UnplSsBIVm1813Bdfb4eE8WpbbWhl/gEQfun1bXdJ5jowTreItcT1nZj7qmUf8+ kK+aMqKCqeeb+HcV1sm34hwJoShZwoGFH7ObhA75eZXm0NDj+vGuQqrPBQqfo43n6Z4f L5CptTOFZ7mQQ2/Sd4nIgustY9aCZygUXJLGeSrklAwa7D67A6RsycAm21k96QRdmGwd 56uWPb5DRfHTUYS1LBGhzvE4ERRIB36JAU0COJIKtVm0zMo3AXNEz6U65nS9hfzjjDM1 Q2salS/f4YzqUCHBbGZHL0o5thYwGXAIMNOcqjB1FLCeSyhRrzXzJbTAZOl6Cj/8Wpef yShw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VDPMh54U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si1478944ejw.12.2020.09.03.02.18.46; Thu, 03 Sep 2020 02:19:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VDPMh54U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728232AbgICJRr (ORCPT + 99 others); Thu, 3 Sep 2020 05:17:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgICJRl (ORCPT ); Thu, 3 Sep 2020 05:17:41 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 562A0C061247 for ; Thu, 3 Sep 2020 02:17:41 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id l17so1882917edq.12 for ; Thu, 03 Sep 2020 02:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ks8zbpt3K53ylw0T/eWvGEXanQshe4hPX9kTva9RnTk=; b=VDPMh54UU9w25z4QHVBYJjPLF92rQvlDEmZh2WtnxD3Bzdp7sogs2sroU5P8Ur3FAw dv6ULAm2SlhYlvBSIAuPvDAxIDfiPm+Xl5qQW6TODWahjjtzYxh3+twFOVluLHMIgxz6 w2Eh0wttggdlvWHo3aw1Rmp6MBbEUcdHEpVWstWJJH51qV9CchXfrCoAG4KXmvAEDlob 46JIR8MQRfQ8Jfm3o1xNopn3QfNSGesPEGM2pKxNzZMTPmzwXW7dEhiRXFHJcAydDEnK dOqVw2ar8bKWyJY1V9CQN8WlsrUu+0XVUERIfK37nCxqpwsTFFpOaGTWPpcwdI2fGHIi AaQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ks8zbpt3K53ylw0T/eWvGEXanQshe4hPX9kTva9RnTk=; b=qFdnx9Oyv6OLf4fXp/lDZ32u1lR7DbV03UTjv3PG8RT2SBW2lujfnG17Sntm//FgXw FtqVSS9GzZ0XHsEeF+C9iL3MpgN93WuLxEsB2GAGUL/eU2Kul+U5eHnru1fBVbPF3xGd E6iuQjLWTwkFQxF7mxdIfUMPOpXoxebbVGlMDm4Fq4p0vol9mB8kVlEARBm4HpmfNvlY tU1N7qH8YyAN2M2EqlXnNIaNMjeddOzJ40EAhHqtLXXEzknKf1MgS4pJ27mv+SdoZ/Ll 4ipFjvqi3RUjau7vvP94TReaW+kZJrd7kmV4LgZwssNSFkYuWlNbzRGd6n60D84gaRf8 jJxA== X-Gm-Message-State: AOAM531C+ERgcglPqnVENetqZToYzsc2GkqNFCq0U8+D7ktqzBgbY7xk 6xohbLyiCAcqLQL+B3hN21vaZA== X-Received: by 2002:a50:f69a:: with SMTP id d26mr1970262edn.21.1599124657089; Thu, 03 Sep 2020 02:17:37 -0700 (PDT) Received: from localhost (dynamic-2a00-1028-919a-a06e-64ac-0036-822c-68d3.ipv6.broadband.iol.cz. [2a00:1028:919a:a06e:64ac:36:822c:68d3]) by smtp.gmail.com with ESMTPSA id ot19sm2547529ejb.121.2020.09.03.02.17.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 02:17:36 -0700 (PDT) From: David Brazdil To: Marc Zyngier , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Arnd Bergmann Cc: James Morse , Julien Thierry , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, kernel-team@android.com, David Brazdil Subject: [PATCH v2 01/10] Macros to override naming of percpu symbols and sections Date: Thu, 3 Sep 2020 11:17:03 +0200 Message-Id: <20200903091712.46456-2-dbrazdil@google.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903091712.46456-1-dbrazdil@google.com> References: <20200903091712.46456-1-dbrazdil@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Modify generic linker script macros to generate section/symbol names for percpu area using overridable macros. No functional changes. This will allow arm64 linker script to define a second KVM-specific percpu data section using the generic PERCPU_SECTION macro. Signed-off-by: David Brazdil --- include/asm-generic/vmlinux.lds.h | 40 +++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 5430febd34be..8f3f5c45e891 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -920,6 +920,20 @@ #define INIT_RAM_FS #endif +/* + * Macros to override the naming of percpu symbols and sections. + * Used by arm64 linker script to define a separate percpu area for KVM. + */ +#define PERCPU_SECTION_BASE_NAME .data..percpu + +#ifndef PERCPU_SECTION_NAME +#define PERCPU_SECTION_NAME(suffix) PERCPU_SECTION_BASE_NAME ## suffix +#endif + +#ifndef PERCPU_SYMBOL_NAME +#define PERCPU_SYMBOL_NAME(name) name +#endif + /* * Memory encryption operates on a page basis. Since we need to clear * the memory encryption mask for this section, it needs to be aligned @@ -931,7 +945,7 @@ #ifdef CONFIG_AMD_MEM_ENCRYPT #define PERCPU_DECRYPTED_SECTION \ . = ALIGN(PAGE_SIZE); \ - *(.data..percpu..decrypted) \ + *(PERCPU_SECTION_NAME(..decrypted)) \ . = ALIGN(PAGE_SIZE); #else #define PERCPU_DECRYPTED_SECTION @@ -975,17 +989,17 @@ * sharing between subsections for different purposes. */ #define PERCPU_INPUT(cacheline) \ - __per_cpu_start = .; \ - *(.data..percpu..first) \ + PERCPU_SYMBOL_NAME(__per_cpu_start) = .; \ + *(PERCPU_SECTION_NAME(..first)) \ . = ALIGN(PAGE_SIZE); \ - *(.data..percpu..page_aligned) \ + *(PERCPU_SECTION_NAME(..page_aligned)) \ . = ALIGN(cacheline); \ - *(.data..percpu..read_mostly) \ + *(PERCPU_SECTION_NAME(..read_mostly)) \ . = ALIGN(cacheline); \ - *(.data..percpu) \ - *(.data..percpu..shared_aligned) \ + *(PERCPU_SECTION_NAME()) \ + *(PERCPU_SECTION_NAME(..shared_aligned)) \ PERCPU_DECRYPTED_SECTION \ - __per_cpu_end = .; + PERCPU_SYMBOL_NAME(__per_cpu_end) = .; /** * PERCPU_VADDR - define output section for percpu area @@ -1012,11 +1026,11 @@ * address, use PERCPU_SECTION. */ #define PERCPU_VADDR(cacheline, vaddr, phdr) \ - __per_cpu_load = .; \ - .data..percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) { \ + PERCPU_SYMBOL_NAME(__per_cpu_load) = .; \ + PERCPU_SECTION_NAME() vaddr : AT(PERCPU_SYMBOL_NAME(__per_cpu_load) - LOAD_OFFSET) { \ PERCPU_INPUT(cacheline) \ } phdr \ - . = __per_cpu_load + SIZEOF(.data..percpu); + . = PERCPU_SYMBOL_NAME(__per_cpu_load) + SIZEOF(PERCPU_SECTION_NAME()); /** * PERCPU_SECTION - define output section for percpu area, simple version @@ -1032,8 +1046,8 @@ */ #define PERCPU_SECTION(cacheline) \ . = ALIGN(PAGE_SIZE); \ - .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ - __per_cpu_load = .; \ + PERCPU_SECTION_NAME() : AT(ADDR(PERCPU_SECTION_NAME()) - LOAD_OFFSET) { \ + PERCPU_SYMBOL_NAME(__per_cpu_load) = .; \ PERCPU_INPUT(cacheline) \ } -- 2.28.0.402.g5ffc5be6b7-goog