From patchwork Fri Jul 17 12:20:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1331094 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=PyQ8VOZf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B7VZb467Kz9sR4 for ; Fri, 17 Jul 2020 22:20:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 079A081BF7; Fri, 17 Jul 2020 14:20:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="PyQ8VOZf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D8C5F81BF9; Fri, 17 Jul 2020 14:20:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BCD3C819E8 for ; Fri, 17 Jul 2020 14:20:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06HCEAfO000951; Fri, 17 Jul 2020 14:20:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=Qq0+ZZ7Lfqsv2cvNlnmgfM8i4siwNBjS1JWiSNo12Kg=; b=PyQ8VOZfKc6hzdQKpZChTmFjwTHTxe3ouLEC5wEh05yMOmPVeWA7FgDeCwUdmH1JpNdG saDfJj6xoP+3OjqZec6RXPOM2RZVN0x/ntgkPAB54l0PWzlFl4MiW/g8kvOFiT/6vwBd g+WDkxsmwzYYv6W+gJxOa3IVZxCWjZ4PUld7KUplpcA3XqyO2zjafhN8I+bCXMVyYaGe aTyIxo/A1EvS0hRRaOdkQaou6CngtYnA0phQqqxITgE6e1IrV50r1Ce+3AK6ZHgG28Tt mNb1Kxku0YndFukBrY+9m7nWEyi06dVPtRTh3z2dbsGX3c0BqRM1I70dDaFRHa5PcsSi tg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 327bkvruy4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jul 2020 14:20:18 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BE22110002A; Fri, 17 Jul 2020 14:20:17 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 55D092B33BE; Fri, 17 Jul 2020 14:20:17 +0200 (CEST) Received: from localhost (10.75.127.44) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 17 Jul 2020 14:20:17 +0200 From: Patrick Delaunay To: CC: Yann Gautier , Patrick Delaunay , Jon Hunter , Simon Glass , U-Boot STM32 Subject: [PATCH] psci: put psci_method in .data section if EFI_LOADER is not enabled Date: Fri, 17 Jul 2020 14:20:15 +0200 Message-ID: <20200717142009.1.I33bddfcff61ece321e626b04e34f9b53d016d6f2@changeid> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG6NODE2.st.com (10.75.127.17) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-17_06:2020-07-17, 2020-07-17 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Yann Gautier Move the variable psci_method in .data section when EFI is not activated and the psci driver safely access it before relocation. Without this patch the variable is located in .bss section and the psci probe requested before relocation corrupts the device tree (probe is requested by board_f.c::print_resetinfo()). When EFI_LOADER is activated, this variable in already located in the .data.efi_runtime section by __efi_runtime_data. Signed-off-by: Yann Gautier Signed-off-by: Patrick Delaunay --- drivers/firmware/psci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 23cf807591..7d2e49fd3e 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -25,7 +25,11 @@ #define PSCI_METHOD_HVC 1 #define PSCI_METHOD_SMC 2 +#if CONFIG_IS_ENABLED(EFI_LOADER) int __efi_runtime_data psci_method; +#else +int psci_method __attribute__ ((section(".data"))); +#endif unsigned long __efi_runtime invoke_psci_fn (unsigned long function_id, unsigned long arg0,