From patchwork Fri Aug 18 19:49:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110431 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343521qge; Fri, 18 Aug 2017 12:50:09 -0700 (PDT) X-Received: by 10.84.141.1 with SMTP id 1mr11190190plu.141.1503085808952; Fri, 18 Aug 2017 12:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085808; cv=none; d=google.com; s=arc-20160816; b=qLml3fjhiMcnk360ps+eLxfljUpR5po/uMVJnQHdl9XdURJ7tWCt2XfgLJ2gjOg2aD GYGJWOoWaFyt6VTLjik7LLNUN5jv20gwBsrVk1hqbm4gUI3QYHivjEXT37IXlummT0+L s9tpAX+EPvXHjyO2HwiN4//Qv0GcWzy29PloFu51DOoRm7SsJta6mWoNjZRRronxWvP9 vdR7j3OToSjT89zESvszLx1EiDTeZ2z5mAg1kUiPR3+owb6+eCnJYpdI+D6CLIF19CY4 c5QWsfdHk3TGU6Kjd0hmqiLdCCUzaUUvpUtkkToyHdA2a4YCJUCXD95yhiezLQpytv5h mqJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IPR9NEkicUA/SccOezMbnMeR4TgpVTvkvCrq2bdASoA=; b=fpRcnDbko2a66/kRjcQ5vYOFw/EyTvewb2msXgPhikIDqhySs1mS0t+PYQqovFSAd5 8b2ynI59M6Z6BrY2+g/qUgtS+zq6HuwCg0GLOrE5n8ZeEkqp+7e/9LATLsHh15YaBx8H YiROjG9z83KPTLAzOwCDm93ikpeB6HbAmURI4yvvTFAmIN91lq251yjh6r4kiJ1rUeI7 Dn0nxomSpk37Z7fsEPFwAvmkRR9w0Jp02IaP3C9bK7qoZXhe7GV0r1hTRH6Z7b29wd/P tGt7zpFfeXRHLiFJ4WRhc8cBJIWTRYt6dbPA0MRLD2z7KCBaszUFFkGxZw7MaLXgme4G OODg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHSg76qf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 83si4009025pga.778.2017.08.18.12.50.08; Fri, 18 Aug 2017 12:50:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHSg76qf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbdHRTuF (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:05 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:35207 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbdHRTuC (ORCPT ); Fri, 18 Aug 2017 15:50:02 -0400 Received: by mail-wr0-f170.google.com with SMTP id 49so64623128wrw.2 for ; Fri, 18 Aug 2017 12:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IPR9NEkicUA/SccOezMbnMeR4TgpVTvkvCrq2bdASoA=; b=GHSg76qfYVOKKDF2jYdqHqUalPS8u8ioIYH+BjTyGm1wwe0l20Csitwvmeh2FyuoYl tgUErlj05+DcbWHczKQCBTh7JeeoN8hb6/CsOdGk3/W8bP7iC8AMTJdHGq9ZO8Ydirl3 1C53/cBJWCsIv23LhpGdPMlbd+3lMlaSLrE4M= 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; bh=IPR9NEkicUA/SccOezMbnMeR4TgpVTvkvCrq2bdASoA=; b=eZJa7O2522vvBblBQASmsyiFWTR1VWsiKjNg8S5SoJAGOOzvrvRsFhrAw6wZyjDv4i Nv1CCMYv/LvXQ3cyPzk7bOHZPKJuK/8N/VLFX0dZA+9suMuxkL4UPjcFbdVTNEx9fh76 ubxGFLNFPajcHS3iRBVR71uRe8/wkX1czkL3yqsiZY9yd3gbOzgVRhAtXmGWcGZjJnJf yjK6L6FyQyclruV54Ja3pbmf0scIN4CC6MK8pe5DnL35lsC65UaLYBOsmHHZew3uOIN/ MszX27zUGMa+vnC/bi0hjkE5Q/X7yLbsfUoFnJSaheUdXAX8A7oWnUAMVl/F9ZxtL9Ks N8MQ== X-Gm-Message-State: AHYfb5h8FDxsDPAzZYK85XgCSfw7uTi1idVbf2OJAd9hOo6yQPKHGP1E yBK/CMz3wNEybaB4 X-Received: by 10.223.184.50 with SMTP id h47mr6446215wrf.163.1503085801682; Fri, 18 Aug 2017 12:50:01 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.49.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:00 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 01/14] efi: arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP Date: Fri, 18 Aug 2017 20:49:34 +0100 Message-Id: <20170818194947.19347-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On ARM, regions of memory that are described by UEFI as having special significance to the firmware itself are omitted from the linear mapping. This is necessary since we cannot guarantee that alternate mappings of the same physical region will use attributes that are compatible with the ones we use for the linear mapping, and aliases with mismatched attributes are prohibited by the architecture. The above does not apply to ACPI reclaim regions: such regions have no special significance to the firmware, and it is up to the OS to decide whether or not to preserve them after it has consumed their contents, and for how long, after which time the OS can use the memory in any way it likes. In the Linux case, such regions are preserved indefinitely, and are simply treated the same way as other 'reserved' memory types. Punching holes into the linear mapping causes page table fragmentation, which increases TLB pressure, and so we should avoid doing so if we can. So add a special case for regions of type EFI_ACPI_RECLAIM_MEMORY, and memblock_reserve() them instead of marking them MEMBLOCK_NOMAP. Acked-by: Mark Rutland Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.11.0 diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index 1027d7b44358..0aa4ce7b4fbb 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -159,6 +159,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md) switch (md->type) { case EFI_LOADER_CODE: case EFI_LOADER_DATA: + case EFI_ACPI_RECLAIM_MEMORY: case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: @@ -211,6 +212,10 @@ static __init void reserve_regions(void) if (!is_usable_memory(md)) memblock_mark_nomap(paddr, size); + + /* keep ACPI reclaim memory intact for kexec etc. */ + if (md->type == EFI_ACPI_RECLAIM_MEMORY) + memblock_reserve(paddr, size); } } } From patchwork Fri Aug 18 19:49:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110432 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343648qge; Fri, 18 Aug 2017 12:50:16 -0700 (PDT) X-Received: by 10.84.198.129 with SMTP id p1mr10756498pld.120.1503085816274; Fri, 18 Aug 2017 12:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085816; cv=none; d=google.com; s=arc-20160816; b=R/DhZLkMi9+cV6Q9rE8u4EDKRJJ7zamw1EDoTzpJs3cSEc1J3FteX7x4VuylqivLV7 o79ydP1xy0Jls0VrVEC+2PpuHvLcpSJ8acs9JeNfgZDer0k/WZZkw+/OZwEZBVWLKhqU 9EYlPmqll6hDnJMsEHZFMcwahvEkUuhjfWExD3ufi+RnlY771o0gT//jxLsRZYrOkgL3 W40xt8guk0Pv/l6aY4P1OUWEoMb0ombMKi4c48xssld/up08PkrzybIQsPQNDV+UzzPz UCuC3kBjerIiC29YQFfv6YhwXb4BrbHID6qAhhKgWa+Tgneer8G+kuknhj32PiG9Nslh 1d0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Z0+SLxi1kGjJPoVkBM6KHhp6X1FtnIZAZfQZp/xRwyE=; b=ReMLrPcwZeubhFliir270W3/aV3mzkmf61lO97kWuksFBHgQstnhqiapgt1bHXEKvP BIAqxr25nVgtvPNavnOFApZr5T9Kte7/qf0AZTwk+q7EH2Iphue0sralwNC6WTGtCz2k e3a+Ucr/T+TPU7/ES0U6WClB/R180ioyVxjZzuPAh/z0/ozRc7qxe+qVnPxLP98SWiaA p/mtBGzbznXxcqg2qVCxH7he7OarZY22flyr8rEI4ACaMkEdJTNZKJu1X+5cKzMMgY+a P+zIZFERl5ddEPZH1vhlSwWRGOLL5UGaTihXyjE1Q8dOZ6QgjVi7fauuCwyV60UyR5Pu Vm3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QSWkDge1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 83si4009025pga.778.2017.08.18.12.50.15; Fri, 18 Aug 2017 12:50:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QSWkDge1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752311AbdHRTuK (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:10 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35330 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbdHRTuF (ORCPT ); Fri, 18 Aug 2017 15:50:05 -0400 Received: by mail-wm0-f49.google.com with SMTP id m85so7245960wma.0 for ; Fri, 18 Aug 2017 12:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z0+SLxi1kGjJPoVkBM6KHhp6X1FtnIZAZfQZp/xRwyE=; b=QSWkDge1DP9SpTIHo66eW4NvznV4gTvfmUQB/LybpGiYu13jrTwo9d2OF0U2uPjFeA k8EjJiHggPunRY6umNwmRQM7VCsIqJtszTDk7Ii91a9Rg67tZU3PLydLxH8bMmGT2I0J v3P1EtsfllV8WpaT4RE2oWQDOAROLpW5g9Z1Y= 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; bh=Z0+SLxi1kGjJPoVkBM6KHhp6X1FtnIZAZfQZp/xRwyE=; b=QEABsFY0ce4bYUMaNmb34UDgYP9towmfA1D+2/sFO+pU06SxOV2IDFRqUBCWvvL4MD dgK1X3yKJs1FGa+tpQrKJJNNJsHrwk48RAl2ForcWlhdodqA/8QBk196hCnM3yvm5Hr3 o/JNLNgtWYYiGAIlC2qGy2Ye3KPx5u7S6cBVsKKo4czoxNnY3Z9OlwbY3S0wEcWF27L3 V5c34/z5TFE6/EUIB5K827+o0hisg3nopU7rwJGnKONDkEFzpaMgU0w4aVT0y7mVHe6N LJ7w+FkBxHM3/KF4ZPYa3t0yqJjvRt3D69tgXWIK1FER3L2cJIdq7lXD5+1QMB/OjuXj ykjA== X-Gm-Message-State: AHYfb5iq27+1ohW4Vs5/ylxAHRkqI/EGW0o1G9HR2yGWkTHYXDqzmRUM APzX8zwR6cZ0alru X-Received: by 10.28.92.14 with SMTP id q14mr1986728wmb.144.1503085803949; Fri, 18 Aug 2017 12:50:03 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:03 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 02/14] efi/libstub: arm64: use hidden attribute for struct screen_info reference Date: Fri, 18 Aug 2017 20:49:35 +0100 Message-Id: <20170818194947.19347-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To prevent the compiler from emitting absolute references to screen_info when building position independent code, redeclare the symbol with hidden visibility. Cc: Matt Fleming Tested-by: Matthias Kaehlcke Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/efi.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 8f3043aba873..464ac850c5e2 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -81,6 +81,9 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base, #define alloc_screen_info(x...) &screen_info #define free_screen_info(x...) +/* redeclare as 'hidden' so the compiler will generate relative references */ +extern struct screen_info screen_info __attribute__((__visibility__("hidden"))); + static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt) { } From patchwork Fri Aug 18 19:49:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110443 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1345869qge; Fri, 18 Aug 2017 12:52:41 -0700 (PDT) X-Received: by 10.99.103.6 with SMTP id b6mr9589066pgc.336.1503085961085; Fri, 18 Aug 2017 12:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085961; cv=none; d=google.com; s=arc-20160816; b=Y/+5n73HZAWPDDtbJ9DTEiVrlVaCDgKle7yYIeZ72uw3IMhcogH9J02h6b8rPgtwM2 qQEMU8t3Jo1c8X4ZsrJEH7+WBO7WYKuqYBkMe9Alqw4jbk6T8l0jM9ygC6hbyqqIr+aP l51ZrJI6zlaw3JxbJf/K4jLcSnLRQ4GEoTqYhWmupesrR2SoiP4LyELEKfjq5acdZl5/ KhtRS2fuibrAXf7jkrCGKNj+GDCuGVXZbJEbnl1vbLSmBkXIg3733DYMTVlcek+l9h2+ BVJUmSi+Jv3DBGzx3ZYOsYdF0SgDSpFfFjAhQZJJchetlFHTh+0LOzfbjRz14A3TH2/+ BNIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IHfiWsmSwmFrWaFFXqnCLzNgZCfFqTgAp2MvSCL0oV0=; b=n66ncmImDt6wVlAgMMQWKpqEX2yU/JVCLaHVVU56+OfJZj19OfaLkng5DVcNvxpkPB moF6e6aXLyH6+N6e1AsR8hzaFFKv63wfQCZ9k75UsTH2mbcWnE444xm3CB10dbU8//uk TvhJVq1BTO3RChz7kg1CacPl/XkBiXvL7N9KExLyjwPo6KuAo16wmtjXeD+fdt3WsteR u/2T17jZnQOs4ShIKWDjfxSVmczG6B0Qo84fp3CLWd9PQLoa3sF8DR0PpcMRnlqKM5h9 n7iEC/PbvXsnuR8h3n+uLr3F7AGjLvN72Qb1iyMzX6eJonXdDqx5EZ81UHOtMDNZyZzd Ly9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=itzu5IgD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v67si2667031pfd.551.2017.08.18.12.52.40; Fri, 18 Aug 2017 12:52:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=itzu5IgD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752376AbdHRTuP (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:15 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:33981 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbdHRTuK (ORCPT ); Fri, 18 Aug 2017 15:50:10 -0400 Received: by mail-wr0-f169.google.com with SMTP id y96so70961332wrc.1 for ; Fri, 18 Aug 2017 12:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IHfiWsmSwmFrWaFFXqnCLzNgZCfFqTgAp2MvSCL0oV0=; b=itzu5IgDoRF31onOcEU+VtZAs7HgZZOgrL2piJYP6oI3clG62a3cSmzSyioB8X3VqJ XvV+UQhZhiiuC7dQCsVplPoa5ReGN/+2mYQsvdlEA8aKqs/fJgjFj6PlpdFPZVJgur3z G6Gm18P7Qfq/7cKzEuKvuc9pWXpKmXmMmKsy8= 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; bh=IHfiWsmSwmFrWaFFXqnCLzNgZCfFqTgAp2MvSCL0oV0=; b=GsDhGQxSyg6YU3Gn7LxxnpjZ1yxngl9+VkbifnO30pSNaTNvWaTFwKkxg+USWzE21/ Nvrt6XYiZLiMRek0+9zGi/0/qPoWAINb8jZZma4g6/7S5Oae8KtJxOrLHhxWBHdTyGhN pbQ6+iZE53mia9geKEaxsMTsfjKpDaygp5l7kUaPFKu0wc7fjBLMaZXRUMcKyxAnquQW BTOIx+GNnbEQz05dYcc+H3HTtgW3IWokr2XPNSfwHhiDqkrssfqzUmL3+lzPNc66sc8b 0TOl8OmJbW2jyp1J7yGPlRlfSUnHQyC5Jj4K2tNhFdF57Xw1kOxMwRvjeOs8QD5QN701 TihQ== X-Gm-Message-State: AHYfb5hVrC3jVxM4SwklECMTEIjHDnOpMmxXvi4GJ7SPrcyZ9ryznj41 IinHczYG6+wpvgEE X-Received: by 10.223.146.195 with SMTP id 61mr6731954wrn.169.1503085809145; Fri, 18 Aug 2017 12:50:09 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:08 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 04/14] efi/libstub: arm64: set -fpie when building the EFI stub Date: Fri, 18 Aug 2017 20:49:37 +0100 Message-Id: <20170818194947.19347-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang may emit absolute symbol references when building in non-PIC mode, even when using the default 'small' code model, which is already mostly position independent to begin with, due to its use of adrp/add pairs that have a relative range of +/- 4 GB. The remedy is to pass the -fpie flag, which can be done safely now that the code has been updated to avoid GOT indirections (which may be emitted due to the compiler assuming that the PIC/PIE code may end up in a shared library that is subject to ELF symbol preemption) Passing -fpie when building code that needs to execute at an a priori unknown offset is arguably an improvement in any case, and given that the recent visibility changes allow the PIC build to pass with GCC as well, let's add -fpie for all arm64 builds rather than only for Clang. Cc: Matt Fleming Tested-by: Matthias Kaehlcke Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 37e24f525162..cf81e6cf5ae8 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -10,7 +10,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ -mno-mmx -mno-sse -cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) +cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ -fno-builtin -fpic -mno-single-pic-base From patchwork Fri Aug 18 19:49:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110434 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343811qge; Fri, 18 Aug 2017 12:50:26 -0700 (PDT) X-Received: by 10.99.98.193 with SMTP id w184mr9481413pgb.358.1503085826231; Fri, 18 Aug 2017 12:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085826; cv=none; d=google.com; s=arc-20160816; b=yMzvOWCcG557pBzCw3NYEAat+HeaigIkvxhfaIwi3Whhg03lvB4iUbDJDw0YGkcGer mR19JHlGjFaLdcp8RnJqkxlbFU7364dnEYh/hIJKWnmwBKpE2Sa+kfhpxQtee399gvbX qkhYOSWHoK38kX5SEpDTtmBiUd6u2uzWrsSpVTOEGAh4G4z8jrhmcsjdGLeTSRHaJ8UU zC18Qe21q7c0D4y4GUPbj1Qs/7S+vhVcDxDpZ+8LfU6pVCDj+fuMo1ybkCuyMtlhnDgW 8+WS3rcb7N5mr/KuyKWD7ePiAbChSE4hJYu/xtoXXQwtjOzzjOgToUwGrU3DKF0k4Mo5 n4Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=mWBui8nQ13i4pSyHO99kXXh9ZBaxA44tSJsyNwftcS8=; b=jT/J8uxLcOty3RmAAwZtrdaYr79R7xhqm0j9T2xJpCuN2bDf1v2hvZBLoYqN6Nlsie t+SD8frualG5Pg3OrjKLPXz6xinvQrrcZaRO8TATy/IMNiNQ3bswZ9z/70Wrlph0hNS1 vCNwAYWyGzJz5iOg5S/lwcgKnZBjEVPLwqNHMZzmptxKRlAm5xg0Dn05YOKPbIQTvCb5 kj1LQYq9O/CqU3N4iPbTXiYV7L/eTJTSdlgkqKmO/jK4bJefI5tFc0p9iqUcJ7aLE6xo 2xt2KGVPYklRLq8O3mMwgVzFOxywVRVp1DTw8YVXawsElGFEtG4WMgHOmcL7iwBYmySy M2Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U2P9tsrF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66si4067940pfb.38.2017.08.18.12.50.25; Fri, 18 Aug 2017 12:50:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U2P9tsrF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752516AbdHRTuW (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:22 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:35403 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbdHRTuS (ORCPT ); Fri, 18 Aug 2017 15:50:18 -0400 Received: by mail-wm0-f48.google.com with SMTP id m85so7249774wma.0 for ; Fri, 18 Aug 2017 12:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mWBui8nQ13i4pSyHO99kXXh9ZBaxA44tSJsyNwftcS8=; b=U2P9tsrFHStxeutXQtfr2QJikX4anATrE/NbeB5CDwrhr2LPvFvgwbBGLB0MYd6N+x vlafydUcqhYvwqNF1vp6Syp7G5ErEvNgs4r1XeR477HYiaz7WwJtyIlFPA8BFqfC7khU lDXHF20geIOMpzGt6V7JQQBPAQwyBZCpZev0I= 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; bh=mWBui8nQ13i4pSyHO99kXXh9ZBaxA44tSJsyNwftcS8=; b=OZZau84VtFiwYKQoTyxJfBMccCZjzkBjlSD3ybowRnV5Cgs7JiYUZEbHhdx8aNcb/M fUWjH22nFTNYcgSX3vTMrGCWDWujSbjBr767I6jzDUDve1OJTM7zsQl6t3VL0ceL1Lgc jxlHeWkDqjadM1pI8qgzlXwCMbNKFGDMTviwkzbdD8doSzQZ/9GTW3auyeVjRYjBHeCL EQsgb0OKyOzW5kFteG/IJVCNLeWUoHrzNjUGQILE/+/x2HckEq8CBe0HyP2z8l6rYCQQ q/YH77wWRV/AZ4NDaxtXy8aeWQyaHVqwpjpg1JEAZdKCoqT32lC1C90B6AcRozPaS6lP 61bw== X-Gm-Message-State: AHYfb5iVFtbT5rL9xlmi/r84JxM5LIOvLLQn8KZuxWXUGBDCuoiuExL7 9vS7oSRdTIoviiqh X-Received: by 10.28.232.8 with SMTP id f8mr2352155wmh.24.1503085817392; Fri, 18 Aug 2017 12:50:17 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:16 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 07/14] drivers/fbdev: efifb: allow BAR to be moved instead of claiming it Date: Fri, 18 Aug 2017 20:49:40 +0100 Message-Id: <20170818194947.19347-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On UEFI systems, the firmware may expose a Graphics Output Protocol (GOP) instance to which the efifb driver attempts to attach in order to provide a minimal, unaccelerated framebuffer. The GOP protocol itself is not very sophisticated, and only describes the offset and size of the framebuffer in memory, and the pixel format. If the GOP framebuffer is provided by a PCI device, it will have been configured and enabled by the UEFI firmware, and the GOP protocol will simply point into a live BAR region. However, the GOP protocol itself does not describe this relation, and so we have to take care not to reconfigure the BAR without taking efifb's dependency on it into account. Commit 55d728a40d36 ("efi/fb: Avoid reconfiguration of BAR that covers the framebuffer") attempted to do so by claiming the BAR resource early on, which prevents the PCI resource allocation routines from changing it. However, it turns out that this only works if the PCI device is not behind any bridges, since the bridge resources need to be claimed first. So instead, allow the BAR to be moved, but make the efifb driver deal with that gracefully. So record the resource that covers the BAR early on, and if it turns out to have moved by the time we probe the efifb driver, update the framebuffer address accordingly. While this is less likely to occur on x86, given that the firmware's PCI resource allocation is more likely to be preserved, this is a worthwhile sanity check to have in place, and so let's remove the preprocessor conditional that makes it !X86 only. Cc: Matt Fleming Reviewed-by: Peter Jones Acked-by: Bartlomiej Zolnierkiewicz Acked-by: Bjorn Helgaas Signed-off-by: Ard Biesheuvel --- drivers/video/fbdev/efifb.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) -- 2.11.0 diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index ff01bed7112f..994b5f3a4d73 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -146,6 +146,10 @@ ATTRIBUTE_GROUPS(efifb); static bool pci_dev_disabled; /* FB base matches BAR of a disabled device */ +static struct pci_dev *efifb_pci_dev; /* dev with BAR covering the efifb */ +static struct resource *bar_resource; +static u64 bar_offset; + static int efifb_probe(struct platform_device *dev) { struct fb_info *info; @@ -200,6 +204,13 @@ static int efifb_probe(struct platform_device *dev) efifb_fix.smem_start |= ext_lfb_base; } + if (bar_resource && + bar_resource->start + bar_offset != efifb_fix.smem_start) { + dev_info(&efifb_pci_dev->dev, + "BAR has moved, updating efifb address\n"); + efifb_fix.smem_start = bar_resource->start + bar_offset; + } + efifb_defined.bits_per_pixel = screen_info.lfb_depth; efifb_defined.xres = screen_info.lfb_width; efifb_defined.yres = screen_info.lfb_height; @@ -364,15 +375,13 @@ static struct platform_driver efifb_driver = { builtin_platform_driver(efifb_driver); -#if defined(CONFIG_PCI) && !defined(CONFIG_X86) - -static bool pci_bar_found; /* did we find a BAR matching the efifb base? */ +#if defined(CONFIG_PCI) -static void claim_efifb_bar(struct pci_dev *dev, int idx) +static void record_efifb_bar_resource(struct pci_dev *dev, int idx, u64 offset) { u16 word; - pci_bar_found = true; + efifb_pci_dev = dev; pci_read_config_word(dev, PCI_COMMAND, &word); if (!(word & PCI_COMMAND_MEMORY)) { @@ -383,12 +392,8 @@ static void claim_efifb_bar(struct pci_dev *dev, int idx) return; } - if (pci_claim_resource(dev, idx)) { - pci_dev_disabled = true; - dev_err(&dev->dev, - "BAR %d: failed to claim resource for efifb!\n", idx); - return; - } + bar_resource = &dev->resource[idx]; + bar_offset = offset; dev_info(&dev->dev, "BAR %d: assigned to efifb\n", idx); } @@ -399,7 +404,7 @@ static void efifb_fixup_resources(struct pci_dev *dev) u64 size = screen_info.lfb_size; int i; - if (pci_bar_found || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) + if (efifb_pci_dev || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) return; if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) @@ -415,7 +420,7 @@ static void efifb_fixup_resources(struct pci_dev *dev) continue; if (res->start <= base && res->end >= base + size - 1) { - claim_efifb_bar(dev, i); + record_efifb_bar_resource(dev, i, base - res->start); break; } } From patchwork Fri Aug 18 19:49:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110435 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343882qge; Fri, 18 Aug 2017 12:50:30 -0700 (PDT) X-Received: by 10.84.169.227 with SMTP id h90mr10706747plb.145.1503085830483; Fri, 18 Aug 2017 12:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085830; cv=none; d=google.com; s=arc-20160816; b=NdaySjFmMPYm9QZFgAQVgxFPn764gt2cWbwWAfhY1Et4c5QAaxzlyoLnDgyUxx/FBn wHIuWX+jWWtWzKS6hocncxFt1c4ANjf2EnJxPDsXAOMR5QYr5soXicYCFB5fqdtZmVsS cxi+gAlOxxMal+L+fU8KaUyNF6O08/GrJf0vk4+Md+PRbTDUiNcfd1NPH94jUOuyvGjY Evrs+9EqoTRNmOhDiuBvQylvZ1dSzuLYT26Xbg2ieudA22bsvXZvv1f6saYfV080deeA uCcBK6dFi6i9yhObIFSIwMWxODuX/9SkkHDFZzynCieaWik+TsLffHt4KaihFGBVmKVH /wxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vC3Ol0wcPZLLJ3ZETLARU3ukDSyM+4q2XGXBNcAJ+iI=; b=XOSIidtpyqvKmmHub8vhaTFYXw/GODyImlB6by8AGH2AcdfQCgVe26OriJQ+srezmh ui4aMdAUyfspB4U9qRm2+B4Jy7G9cCY4AUwM+H8mRO//TvwlnXWr/oODrZQelFYKDjhu BrUTQuqnLpjiOn/4emxsco2h8Rq4m28S2yPIa+OaM1hnYuS4nu7C0F5GZMc4LJFT/SPx pjY/qsG9w9wTBgxJs8zdBDY/DCLXuPhueEC7bguLKHkL/MQd4Tm9dqGIfW1Qd8rCBv22 FlnFK634CsfXhC7bTIKQGSm03WSzzSpydrowxs8VrsihY/1gC1D00DV0EzEK6y5WTCKg KNbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMytqu3e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si1856751pli.352.2017.08.18.12.50.30; Fri, 18 Aug 2017 12:50:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMytqu3e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752457AbdHRTu1 (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:27 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37293 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbdHRTuY (ORCPT ); Fri, 18 Aug 2017 15:50:24 -0400 Received: by mail-wm0-f45.google.com with SMTP id i66so7295705wmg.0 for ; Fri, 18 Aug 2017 12:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vC3Ol0wcPZLLJ3ZETLARU3ukDSyM+4q2XGXBNcAJ+iI=; b=aMytqu3eAPXVYnv11NS3jhy83FySGmw2hV/I7qFiMvb1oZgZwyKqTDv2s0SbO7HIBN Dr9pTlGVI7RTEVZrS3sDDNdeTkp5ZbKzhTHdXGrFmcBurGlyVflypWtDsmX1dL9WPyLU 8F3glYQ2nxLWoigiVLc1DQ2ftqCgz3aSKoCyA= 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; bh=vC3Ol0wcPZLLJ3ZETLARU3ukDSyM+4q2XGXBNcAJ+iI=; b=tmzCC5VLGHxFEukkFBKsxMBN2unfZ2TvCeIKiBGxfC3HJ/rGQdzstWy/cFzgMXH+0a W9Oa7VutTd9FX7dViM8AeVD5ZproS2Rayr2blDsR2ya58CubXGmXh/J8pXRvGx4VUsXH izAz4sXCBVYFk13hbi0NcMypafe8RgtAhdlY3F1uZpFEV3Sx1HSM56tLeoPYED14h/ea NgyXvm71e1JuvPoN7WyI3QNE48FFVaS+Xsd6xMuLqj7/ONSznbDraQae6OpXQcdfihQl 7M818D56pv59FFZOOp1LtXJ5F6n+e3ByPtkULLp6Coeg9QtgUdPbCeXGHDvO4uWN/bbW NcCg== X-Gm-Message-State: AHYfb5iceiQn5lQc46KURBmUzubU54GpRtS5XmI/GLWopHV2v21n+gS5 ZOXfpysWhrZjSQRz X-Received: by 10.28.62.149 with SMTP id l143mr2251295wma.126.1503085823108; Fri, 18 Aug 2017 12:50:23 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:21 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 09/14] arm: efi: remove pointless dummy .reloc section Date: Fri, 18 Aug 2017 20:49:42 +0100 Message-Id: <20170818194947.19347-10-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel's EFI PE/COFF header contains a dummy .reloc section, and an explanatory comment that claims that this is required for the EFI application loader to accept the Image as a relocatable image (i.e., one that can be loaded at any offset and fixed up in place) This was inherited from the x86 implementation, which has elaborate host tooling to mangle the PE/COFF header post-link time, and which populates the .reloc section with a single dummy base relocation. On ARM, no such tooling exists, and the .reloc section remains empty, and is never even exposed via the BaseRelocationTable directory entry, which is where the PE/COFF loader looks for it. The PE/COFF spec is unclear about relocatable images that do not require any fixups, but the EDK2 implementation, which is the de facto reference for PE/COFF in the UEFI space, clearly does not care, and explicitly mentions (in a comment) that relocatable images with no base relocations are perfectly fine, as long as they don't have the RELOCS_STRIPPED attribute set (which is not the case for our PE/COFF image) So simply remove the .reloc section altogether. Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) -- 2.11.0 diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index 4169b900d9d4..309d6198d335 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -41,7 +41,7 @@ pe_header: coff_header: .short 0x01c2 @ ARM or Thumb - .short 2 @ nr_sections + .short 1 @ nr_sections .long 0 @ TimeDateStamp .long 0 @ PointerToSymbolTable .long 0 @ NumberOfSymbols @@ -96,22 +96,6 @@ extra_header_fields: .quad 0 @ BaseRelocationTable section_table: - @ - @ The EFI application loader requires a relocation section - @ because EFI applications must be relocatable. This is a - @ dummy section as far as we are concerned. - @ - .ascii ".reloc\0\0" - .long 0 @ VirtualSize - .long 0 @ VirtualAddress - .long 0 @ SizeOfRawData - .long 0 @ PointerToRawData - .long 0 @ PointerToRelocations - .long 0 @ PointerToLineNumbers - .short 0 @ NumberOfRelocations - .short 0 @ NumberOfLineNumbers - .long 0x42000040 @ Characteristics - .ascii ".text\0\0\0" .long _end - __efi_start @ VirtualSize .long __efi_start @ VirtualAddress From patchwork Fri Aug 18 19:49:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110439 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1344714qge; Fri, 18 Aug 2017 12:51:21 -0700 (PDT) X-Received: by 10.84.130.78 with SMTP id 72mr10709175plc.471.1503085881897; Fri, 18 Aug 2017 12:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085881; cv=none; d=google.com; s=arc-20160816; b=tGaLio7bj8ghYd8eBFl75Jdf+otpJPvAeMg7rWQXp1znaPnPHuITabETYt+ZmB3/2A +4wilnVyGlFWZG/70WvmABGYRNMdhho2rTxOjLdXdfRj++HY6+hpjIH/pKK3uCJZZvIs 6ApreWu7+v3v3iS0Jtdqu2a6VA6DzuiOK3NwB28CUgo806AxmfGgcrbrXY2TxI6TGz/Q jGnf2dPjaHUUuSUVUUU2V0edBszhvdCO6gvN82nu+4KthkXsiW2lGX+UHDx4fW+gtriK YujYAnVSFAzGmmANirxmsfe6lHLMnn54eS5Tw3yd4ukxd7UMky22pc8KcPcQFCvjViNI EakA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=P9AejXuUQMTxu9RyKCi6DlhrmoQgf09XYztLTXCHdH0=; b=dv+3694WDhU/O096JT9/VTD0JdBEFPf9hGfcCdwI67ALTEiknuCfFdekP0cvqJkdp8 hEMduJZ/ZDZCFmG9Mn9FmWBl1zoygRZyH/ewS1mFVrxgXkXyczY2ykWDqNe1NahGHGjJ BM7qQ7jovn9H/D56dU+nXINvWM/SMfjOaDkxtyjaZwj9YlvYJ9JNoi2OTeNf3eU0zk8P yW3AWFgWdDdWQlK+qrLAk/6ForLNOTwDT+F8BMKFEl3tfZ2lGqhOs2tsCDi9BvCvG7Nr qDWPyeUytJ5N40nY7jVlUAwy8+9dwu/U8ElauOoWZRcyXnHe5EfA9+R4LtqJJo5+pBC4 UcNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K97TsZtR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m61si4383544plb.435.2017.08.18.12.51.21; Fri, 18 Aug 2017 12:51:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K97TsZtR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594AbdHRTud (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:33 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37306 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbdHRTu1 (ORCPT ); Fri, 18 Aug 2017 15:50:27 -0400 Received: by mail-wm0-f46.google.com with SMTP id i66so7296365wmg.0 for ; Fri, 18 Aug 2017 12:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P9AejXuUQMTxu9RyKCi6DlhrmoQgf09XYztLTXCHdH0=; b=K97TsZtRKVrTxyiy5DjP1DfaC2YQVasYzQ+UaCk2yrFWNlCYlfgIQxpYBpqemwcqUy lSKSwwT8k0wvqfLbsgwq1blb3LlWorko3OwKwIgsxGV98P9Hav3Oc/PtJQQCNjpx5its 22wDgJmImvAOdzypjC5bfGK7JefPU3XVGNsR0= 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; bh=P9AejXuUQMTxu9RyKCi6DlhrmoQgf09XYztLTXCHdH0=; b=cEd2JKkDBgFnL8C3KyUbiAImWjorAwPFl8YtqjzzE4c9ZfmsXv0zbhwy6swhLiWDSZ TKXg6aUIcgweXfvKSSfdU20UlltODrt1DzIPZxWCrrpiWZ8NI8RnvhmsLsOaZ7WvdiTQ 6WlyX5gpgiXunzMy+q1bUc/lkmwAP1T8Ad6rJg3SA4GdluD2pJzYkUxn/w+wuCeM/GEd XJkoSDeKhHeQzAlX8eez7/rdw8qkZ3mml5oct4VXRf3gfLVp7ccD3xawXRj2j7+r0QX3 tVfWZyFdYSoLEnaMDwQIxJ5dEFpGPZZ5iN3Jo5k3J3yEVVlWSLH2m8ZqAZce547IQZKL Blzw== X-Gm-Message-State: AHYfb5i+iqm82ih1UxOULB0rk4E5ZHvIdiFq73TillwGlPfsinL6W6RL +kjFD9IoflMlnMCo X-Received: by 10.28.232.8 with SMTP id f8mr2352320wmh.24.1503085825703; Fri, 18 Aug 2017 12:50:25 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:24 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 10/14] arm: efi: replace open coded constants with symbolic ones Date: Fri, 18 Aug 2017 20:49:43 +0100 Message-Id: <20170818194947.19347-11-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the various open coded constants in the EFI PE/COFF header with definitions from pe.h, or expressions based on local symbols. Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 128 ++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 61 deletions(-) -- 2.11.0 diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index 309d6198d335..542e1ad432ae 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Linaro Ltd + * Copyright (C) 2013-2017 Linaro Ltd * Authors: Roy Franz * Ard Biesheuvel * @@ -8,6 +8,9 @@ * published by the Free Software Foundation. */ +#include +#include + .macro __nop #ifdef CONFIG_EFI_STUB @ This is almost but not quite a NOP, since it does clobber the @@ -15,7 +18,7 @@ @ PE/COFF expects the magic string "MZ" at offset 0, while the @ ARM/Linux boot protocol expects an executable instruction @ there. - .inst 'M' | ('Z' << 8) | (0x1310 << 16) @ tstne r0, #0x4d000 + .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 #else AR_CLASS( mov r0, r0 ) M_CLASS( nop.w ) @@ -34,78 +37,81 @@ @ The only 2 fields of the MSDOS header that are used are this @ PE/COFF offset, and the "MZ" bytes at offset 0x0. @ - .long pe_header - start @ Offset to the PE header. + .long pe_header - start @ Offset to the PE header. pe_header: - .ascii "PE\0\0" + .long PE_MAGIC coff_header: - .short 0x01c2 @ ARM or Thumb - .short 1 @ nr_sections - .long 0 @ TimeDateStamp - .long 0 @ PointerToSymbolTable - .long 0 @ NumberOfSymbols - .short section_table - optional_header - @ SizeOfOptionalHeader - .short 0x306 @ Characteristics. - @ IMAGE_FILE_32BIT_MACHINE | - @ IMAGE_FILE_DEBUG_STRIPPED | - @ IMAGE_FILE_EXECUTABLE_IMAGE | - @ IMAGE_FILE_LINE_NUMS_STRIPPED + .short IMAGE_FILE_MACHINE_THUMB @ Machine + .short section_count @ NumberOfSections + .long 0 @ TimeDateStamp + .long 0 @ PointerToSymbolTable + .long 0 @ NumberOfSymbols + .short section_table - optional_header @ SizeOfOptionalHeader + .short IMAGE_FILE_32BIT_MACHINE | \ + IMAGE_FILE_DEBUG_STRIPPED | \ + IMAGE_FILE_EXECUTABLE_IMAGE | \ + IMAGE_FILE_LINE_NUMS_STRIPPED @ Characteristics optional_header: - .short 0x10b @ PE32 format - .byte 0x02 @ MajorLinkerVersion - .byte 0x14 @ MinorLinkerVersion - .long _end - __efi_start @ SizeOfCode - .long 0 @ SizeOfInitializedData - .long 0 @ SizeOfUninitializedData - .long efi_stub_entry - start @ AddressOfEntryPoint - .long start_offset @ BaseOfCode - .long 0 @ data + .short PE_OPT_MAGIC_PE32 @ PE32 format + .byte 0x02 @ MajorLinkerVersion + .byte 0x14 @ MinorLinkerVersion + .long _end - __efi_start @ SizeOfCode + .long 0 @ SizeOfInitializedData + .long 0 @ SizeOfUninitializedData + .long efi_stub_entry - start @ AddressOfEntryPoint + .long start_offset @ BaseOfCode + .long 0 @ BaseOfData extra_header_fields: - .long 0 @ ImageBase - .long 0x200 @ SectionAlignment - .long 0x200 @ FileAlignment - .short 0 @ MajorOperatingSystemVersion - .short 0 @ MinorOperatingSystemVersion - .short 0 @ MajorImageVersion - .short 0 @ MinorImageVersion - .short 0 @ MajorSubsystemVersion - .short 0 @ MinorSubsystemVersion - .long 0 @ Win32VersionValue + .long 0 @ ImageBase + .long SZ_512 @ SectionAlignment + .long SZ_512 @ FileAlignment + .short 0 @ MajorOsVersion + .short 0 @ MinorOsVersion + .short 0 @ MajorImageVersion + .short 0 @ MinorImageVersion + .short 0 @ MajorSubsystemVersion + .short 0 @ MinorSubsystemVersion + .long 0 @ Win32VersionValue - .long _end - start @ SizeOfImage - .long start_offset @ SizeOfHeaders - .long 0 @ CheckSum - .short 0xa @ Subsystem (EFI application) - .short 0 @ DllCharacteristics - .long 0 @ SizeOfStackReserve - .long 0 @ SizeOfStackCommit - .long 0 @ SizeOfHeapReserve - .long 0 @ SizeOfHeapCommit - .long 0 @ LoaderFlags - .long 0x6 @ NumberOfRvaAndSizes + .long _end - start @ SizeOfImage + .long start_offset @ SizeOfHeaders + .long 0 @ CheckSum + .short IMAGE_SUBSYSTEM_EFI_APPLICATION @ Subsystem + .short 0 @ DllCharacteristics + .long 0 @ SizeOfStackReserve + .long 0 @ SizeOfStackCommit + .long 0 @ SizeOfHeapReserve + .long 0 @ SizeOfHeapCommit + .long 0 @ LoaderFlags + .long (section_table - .) / 8 @ NumberOfRvaAndSizes - .quad 0 @ ExportTable - .quad 0 @ ImportTable - .quad 0 @ ResourceTable - .quad 0 @ ExceptionTable - .quad 0 @ CertificationTable - .quad 0 @ BaseRelocationTable + .quad 0 @ ExportTable + .quad 0 @ ImportTable + .quad 0 @ ResourceTable + .quad 0 @ ExceptionTable + .quad 0 @ CertificationTable + .quad 0 @ BaseRelocationTable section_table: .ascii ".text\0\0\0" - .long _end - __efi_start @ VirtualSize - .long __efi_start @ VirtualAddress - .long _edata - __efi_start @ SizeOfRawData - .long __efi_start @ PointerToRawData - .long 0 @ PointerToRelocations - .long 0 @ PointerToLineNumbers - .short 0 @ NumberOfRelocations - .short 0 @ NumberOfLineNumbers - .long 0xe0000020 @ Characteristics + .long _end - __efi_start @ VirtualSize + .long __efi_start @ VirtualAddress + .long _edata - __efi_start @ SizeOfRawData + .long __efi_start @ PointerToRawData + .long 0 @ PointerToRelocations + .long 0 @ PointerToLineNumbers + .short 0 @ NumberOfRelocations + .short 0 @ NumberOfLineNumbers + .long IMAGE_SCN_CNT_CODE | \ + IMAGE_SCN_MEM_READ | \ + IMAGE_SCN_MEM_WRITE | \ + IMAGE_SCN_MEM_EXECUTE @ Characteristics + + .set section_count, (. - section_table) / 40 .align 9 __efi_start: From patchwork Fri Aug 18 19:49:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110436 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1344036qge; Fri, 18 Aug 2017 12:50:38 -0700 (PDT) X-Received: by 10.98.68.155 with SMTP id m27mr5991515pfi.215.1503085838037; Fri, 18 Aug 2017 12:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085838; cv=none; d=google.com; s=arc-20160816; b=icJiNLmS6/MgbnJvSBcPhHPnWXIz7vv+TQQMIItLA8OLvrI4kl+ZxHWTTyVRNjheVt e6pD7qPl91GOU6IpSTZIBb/M59yu5BxgaO3vOD/iyUSJSsYIaGf+Ll+O4TI19K2Gbr1F 4M9q7hh890rhvP7e39QjIcnet4oLc2z7yn3PG0ITNNZE4xdLFDpyzlxFZgGBK3MscEbc 62WK6n/RHc8FxMUPFFi/zN73us9V3Qjmlb7RcTlTdP7d6CE/wJuORM/xZ7myQjfLWYyM 3blw5mKa8pybQqwCIXJ0yOhR/6DEFwAj47nVWMvfZKeG1XuqZd3FqEM+b/HLl0GDvDYK 00pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=OKMtyUY89mMSWf6DmC7W0XVK+iW6P+jn9wyRegRXa/4=; b=ZIE8jpBjOeOrfcB2nI/DlzxlFsS+Eeu5LUyEllWp62HZENsYnynW9h4snNP7p/XUBI fDClpd8Z5SlDxIyQWkPJr8k855/Y86afhDQetS/FGT6+Iik24dnuYs5sN8QhEfqWPXsg 8rrm8IyX/dD730uiaEQwATQooRTyUBCmwPowdsudhQLk5fnYTlNe8qn0fXYuHoxIim4p AuNMQtzygeRVTVGSEgTXQBVk5YMmPGFp07YmCzr6B77L8z0UF+d9RewPp7BhymfFGG12 t0d0pQitpZjoF/efFX85975JsKlB5qyKHaMPd+XI8YRKkEkYZBX0zP/aXg1puflzTEdW Wl1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hM/2Dko5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si3971707pgr.186.2017.08.18.12.50.37; Fri, 18 Aug 2017 12:50:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hM/2Dko5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752628AbdHRTuf (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:35 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34020 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbdHRTuc (ORCPT ); Fri, 18 Aug 2017 15:50:32 -0400 Received: by mail-wm0-f52.google.com with SMTP id c14so2105121wmh.1 for ; Fri, 18 Aug 2017 12:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OKMtyUY89mMSWf6DmC7W0XVK+iW6P+jn9wyRegRXa/4=; b=hM/2Dko5Pn/1jaXvD1x+E/MTihdGwugKsRivizkTFmHJjrwsJduG9wwGewzIXUGdn2 sx1tySjxU3jrizZKa/rJtzWSK2qi2a+xEULHj6/1g8eVIpVgZ04uxfujQNQKjV6zgJLP Azv21Xp0qZ4kKwFa37PPCh1X7pJWJ4ud1ltvo= 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; bh=OKMtyUY89mMSWf6DmC7W0XVK+iW6P+jn9wyRegRXa/4=; b=jjuOu3M7520qUKkfhfVLrXv1xL8ithX808JU5VMn7iQkYwgD5lHRdnKg77l1zBVGyv V5PrVLdaUVI81Zz5bPt5YFbI6CxMk3cZxFMuSTn3s7ZAvVm6wiO7do/ZbuKlOmCamkmu 6UFRDe0s5PSudg0oOYZ7cv/3ikDxihza35qdnkX5JM4HpbQsZkXmIEwklvzW1+Cn6/ef ABgjG772vVHwCmFuq8A9Eze9NIvijG7CkxRWY69UfcddBstr5InMep5WB7e4AsoXH7fn RQ6cUZ0Efcza4sUp+wutiP5a+K3U2Bfd89rGPtZF5TPb13MbjgSeogaN0Fqev+H6sRer fCNw== X-Gm-Message-State: AHYfb5ggfbVdJd5K2gTqnhpHHv7CCRuBVjg1kgwW+EfCvaRzCKUZl8l+ HH6sAS/6Wm9h+k/H X-Received: by 10.28.35.77 with SMTP id j74mr2298257wmj.168.1503085831076; Fri, 18 Aug 2017 12:50:31 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:30 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Arvind Yadav , Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming , Douglas_Warzecha Subject: [PATCH 12/14] firmware: dcdbas: constify attribute_group structures. Date: Fri, 18 Aug 2017 20:49:45 +0100 Message-Id: <20170818194947.19347-13-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arvind Yadav attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Cc: Matt Fleming Cc: Douglas_Warzecha Signed-off-by: Ard Biesheuvel --- drivers/firmware/dcdbas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 2fe1a130189f..c16600f30611 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c @@ -534,7 +534,7 @@ static struct attribute *dcdbas_dev_attrs[] = { NULL }; -static struct attribute_group dcdbas_attr_group = { +static const struct attribute_group dcdbas_attr_group = { .attrs = dcdbas_dev_attrs, .bin_attrs = dcdbas_bin_attrs, }; From patchwork Fri Aug 18 19:49:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110437 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1344122qge; Fri, 18 Aug 2017 12:50:42 -0700 (PDT) X-Received: by 10.84.217.20 with SMTP id o20mr6449819pli.460.1503085842817; Fri, 18 Aug 2017 12:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085842; cv=none; d=google.com; s=arc-20160816; b=OVWen3aVe2NwxDbUywuZFzFBvDPGQYxDcVxHLDyOnX8lrZw6a+6x13V6Cfq1miRgbe PXp+mffsOm4ycHbLbYaB7m7rZU7GhXePt4UGlyZCC5BN094GDZ95G48XIXdxfzQzAdFq psHvp4QW0MBC6Dfi89EOeYpjGnzMVVBpvv8zF4IkeLeA1sLsqyIGyOZBg/+nO3TtAvFV bZTv9RgT/Fmqkqv1Cb6rzNHHWqIlM4UYZivLFM0pEbG3N8srAnKsjsQ0mlln3ZxlcM/2 fwIf+rZxooW0XZqaxoYvbDaV0jKRRGVm1zTXwL6WvKmB3tTdIiqIe714jvwzyLAEy1gB hD0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XQcVV2uPWKWYAbY23GNmnvtJTDbNp+dAe+biELBbMAY=; b=btxYVp1MKq4KqclOJPOMMTOcqys3z38/iMnQC37juM3/tip3k+rFb0f8CWWxyo/AvN KBuPBxVjFfWrQA2UsWuaaBN2OBQfdZ0VzW8zCLJXlGqrbafvqzpdN8ccq6Eod7nPJ6FZ qtuqr1hbGym3XKro2RnhSKIxlY4+a9Zz7YvRVYfrWuGbJU5ycVapXwvpLfWaLOgXoA3Q kpkyXH8Z3waRxzB/36115ug5zoCJIEGHoxHGgLZY4nxty0AdX2bzC6SQ5xdtJoAiGDHb OCuIuXCq9OPGnz+pZ+fKzLcqSYYTYYcXzjqDElOsMPfrXACiqFH9T+qnQtmoEzrJm2n+ WCbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cz2K9Xic; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si3971707pgr.186.2017.08.18.12.50.42; Fri, 18 Aug 2017 12:50:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cz2K9Xic; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752661AbdHRTuk (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:40 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37364 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752138AbdHRTuh (ORCPT ); Fri, 18 Aug 2017 15:50:37 -0400 Received: by mail-wm0-f46.google.com with SMTP id i66so7299025wmg.0 for ; Fri, 18 Aug 2017 12:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XQcVV2uPWKWYAbY23GNmnvtJTDbNp+dAe+biELBbMAY=; b=cz2K9XiccfRoJvOOuLwfbnfHsf4C8XC/klBTzNZHlYGmIz4vTcwH5f+MCl56qIvPF5 tytiMNzW3NomgS84WH83/Z1rhfIKAuBjIFmTsy4fzB1TJ65VqKHnmppsko1S1LS9DJNg OWo/GnSADcFNKmfPA1gLBNfMhRCz1agIQK79A= 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; bh=XQcVV2uPWKWYAbY23GNmnvtJTDbNp+dAe+biELBbMAY=; b=P51YgZdn/F5BQlaoRXu826wLDk22dHsqlXqsDCEUb+2edmQv+clpjo4LGVuMshV7NQ cuBUEh/b5XaS3cJ13ufWs5CzjYypw792hhG6tDG2x7GYoTiAzR0xuly4/PW4Q810htXx IhYGvnuid9ZLRyWxdMYZLrkI6acZukjak5MFbA0mjZzVFFT1v+li2LgmCaFC3LGJ4ELV lmqelaDavQGzjD+v6H8KlPFjb2kZ5dTw0YXbLVsBTw3soQQPBlFlvdH9+J1dymfZUnY3 TvMkBVO51Jm25bsP5rqn1dihnLl/yFQ70xhSZVNWupFcl2ieI3GrFLZ9LJFZi/srC3r8 QUPA== X-Gm-Message-State: AHYfb5gT+j/tsnwSXNp1bdwKacMWNC9LoemygsjLlImf7WRhzGUfnbTG 0fvrW3aebzyTz0Of X-Received: by 10.28.46.197 with SMTP id u188mr1971016wmu.26.1503085836498; Fri, 18 Aug 2017 12:50:36 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:35 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Arvind Yadav , Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 14/14] firmware: efi: esrt: constify attribute_group structures. Date: Fri, 18 Aug 2017 20:49:47 +0100 Message-Id: <20170818194947.19347-15-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arvind Yadav attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/esrt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c index 8554d7aec31c..bd7ed3c1148a 100644 --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -230,7 +230,7 @@ static umode_t esrt_attr_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group esrt_attr_group = { +static const struct attribute_group esrt_attr_group = { .attrs = esrt_attrs, .is_visible = esrt_attr_is_visible, };