From patchwork Mon Jan 17 13:24:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Singh Tomar X-Patchwork-Id: 1580780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=eS3LB4G4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jct2k3xkMz9sRR for ; Tue, 18 Jan 2022 00:26:06 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Jct2k2hypz30DM for ; Tue, 18 Jan 2022 00:26:06 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=eS3LB4G4; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=abhishek@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=eS3LB4G4; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Jct2c1Vmsz2x9G for ; Tue, 18 Jan 2022 00:25:59 +1100 (AEDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20HDMLvO008640 for ; Mon, 17 Jan 2022 13:25:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=uVKawoMGwGKhG/baAigjO6hwZRAfRSH46uBLScvAens=; b=eS3LB4G4TfZkYV+jyir33o6ECX1zrUpUOgCwJcuVIl9hEAaCT9EtT6nZPa57TF+FtLMd 7ZuaHEBXC3vYtzYrXecN1Vsbu2UduhOmuOY5UsjtTU/Q761qQUtEC720ST4EPXt/t8IK okDnCjEyhFVVzcFQ4McshMXs+fdSSjuexI5UBYdCPTjkY9XfhBBBqnL/cUjmSjAvdiCo PAxx62tCpRiNs7fI0gA6ZGer+3oCsnmLNP1sCeQNeev+0k4VjVOCWux3GUwBMGNkUtlx aCw3CnQH3E1Jru4anH8FhIfTYWudIcaqdVleF0SmfZNIYyZz+w6xXpmKvY1qQpEOwcFP GA== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dn75vtvpu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 13:25:56 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20HDHlNV023629 for ; Mon, 17 Jan 2022 13:25:55 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 3dknw93j8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 13:25:55 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HDPpRh44302720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 13:25:51 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C79E7A4051; Mon, 17 Jan 2022 13:25:51 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D8ACA4053; Mon, 17 Jan 2022 13:25:50 +0000 (GMT) Received: from li-22421c4c-355e-11b2-a85c-fdc6c782cba9.ibm.com.com (unknown [9.43.23.24]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 13:25:50 +0000 (GMT) From: Abhishek Singh Tomar To: skiboot@lists.ozlabs.org Date: Mon, 17 Jan 2022 18:54:37 +0530 Message-Id: <20220117132437.60286-1-abhishek@linux.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PCIV14rY6eOai4MeGRGVhND2GgqjdFWt X-Proofpoint-GUID: PCIV14rY6eOai4MeGRGVhND2GgqjdFWt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_05,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 phishscore=0 mlxscore=0 suspectscore=0 adultscore=0 clxscore=1011 mlxlogscore=999 impostorscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170084 Subject: [Skiboot] [PATCH] Use volatile pointer for constant address asignment X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abhishek Singh Tomar Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" use volatile pointer to avoid optimization introduced with gcc-11 on constant address asignment to pointer. Resolves : the warray ofset warning during compilation. Signed-off-by: Abhishek Singh Tomar --- core/console.c | 2 +- core/fast-reboot.c | 6 ++++-- core/init.c | 6 +++++- core/opal-dump.c | 7 ++++--- hdata/spira.c | 2 +- hdata/spira.h | 2 +- hw/fsp/fsp.c | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/core/console.c b/core/console.c index 2a150902..229bc84a 100644 --- a/core/console.c +++ b/core/console.c @@ -15,7 +15,7 @@ #include #include -static char *con_buf = (char *)INMEM_CON_START; +static char *volatile con_buf = (char *)INMEM_CON_START; static size_t con_in; static size_t con_out; static bool con_wrapped; diff --git a/core/fast-reboot.c b/core/fast-reboot.c index fedfa88c..3e3db68e 100644 --- a/core/fast-reboot.c +++ b/core/fast-reboot.c @@ -307,6 +307,8 @@ void __noreturn fast_reboot_entry(void); void __noreturn fast_reboot_entry(void) { struct cpu_thread *cpu = this_cpu(); + void *volatile kerneal_load_base_addr = KERNEL_LOAD_BASE; + void *volatile initramfs_load_base_addr = INITRAMFS_LOAD_BASE; if (proc_gen == proc_gen_p8) { /* We reset our ICP first ! Otherwise we might get stray @@ -425,8 +427,8 @@ void __noreturn fast_reboot_entry(void) * Mambo may have embedded payload here, so don't clear * it at all. */ - memset(KERNEL_LOAD_BASE, 0, KERNEL_LOAD_SIZE); - memset(INITRAMFS_LOAD_BASE, 0, INITRAMFS_LOAD_SIZE); + memset(kerneal_load_base_addr, 0, KERNEL_LOAD_SIZE); + memset(initramfs_load_base_addr, 0, INITRAMFS_LOAD_SIZE); } /* Start preloading kernel and ramdisk */ diff --git a/core/init.c b/core/init.c index b4d33518..00f667e1 100644 --- a/core/init.c +++ b/core/init.c @@ -869,7 +869,11 @@ void copy_exception_vectors(void) * this is the boot flag used by CPUs still potentially entering * skiboot. */ - memcpy((void *)0x100, (void *)(SKIBOOT_BASE + 0x100), + void *volatile exception_vectors_start_addr = (void*)(SKIBOOT_BASE + 0x100); + void *volatile dst = (void*)0x100; + + + memcpy(dst,exception_vectors_start_addr, EXCEPTION_VECTORS_END - 0x100); sync_icache(); } diff --git a/core/opal-dump.c b/core/opal-dump.c index 4f54a3ef..4943fedd 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -301,6 +301,7 @@ static int64_t opal_mpipl_update(enum opal_mpipl_ops ops, u64 src, u64 dest, u64 size) { int rc; + void *volatile mdrt_table_base_addr =(void*) MDRT_TABLE_BASE; switch (ops) { case OPAL_MPIPL_ADD_RANGE: @@ -330,7 +331,7 @@ static int64_t opal_mpipl_update(enum opal_mpipl_ops ops, free(opal_mpipl_cpu_data); opal_mpipl_cpu_data = NULL; /* Clear MDRT table */ - memset((void *)MDRT_TABLE_BASE, 0, MDRT_TABLE_SIZE); + memset(mdrt_table_base_addr, 0, MDRT_TABLE_SIZE); /* Set MDRT count to max allocated count */ ntuple_mdrt->act_cnt = cpu_to_be16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)); rc = OPAL_SUCCESS; @@ -529,8 +530,8 @@ bool is_mpipl_enabled(void) void opal_mpipl_init(void) { - void *mdst_base = (void *)MDST_TABLE_BASE; - void *mddt_base = (void *)MDDT_TABLE_BASE; + void *volatile mdst_base = (void *)MDST_TABLE_BASE; + void *volatile mddt_base = (void *)MDDT_TABLE_BASE; struct dt_node *dump_node; dump_node = dt_find_by_path(opal_node, "dump"); diff --git a/hdata/spira.c b/hdata/spira.c index 1a351462..3bbec351 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -236,7 +236,7 @@ __section(".spirah.data") struct spirah spirah = { }; /* The service processor SPIRA-S structure */ -struct spiras *spiras; +struct spiras *volatile spiras; /* Overridden for testing. */ #ifndef spira_check_ptr diff --git a/hdata/spira.h b/hdata/spira.h index 8def23bd..6df3df56 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -150,7 +150,7 @@ struct spiras { u8 reserved[0x180]; } __packed __align(0x100); -extern struct spiras *spiras; +extern struct spiras *volatile spiras; /* This macro can be used to check the validity of a pointer returned diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c index 2c5f9d71..259e83a3 100644 --- a/hw/fsp/fsp.c +++ b/hw/fsp/fsp.c @@ -91,7 +91,7 @@ static enum ipl_state ipl_state = ipl_initial; static struct fsp *first_fsp; static struct fsp *active_fsp; static u16 fsp_curseq = 0x8000; -static __be64 *fsp_tce_table; +static __be64 *volatile fsp_tce_table; #define FSP_INBOUND_SIZE 0x00100000UL static void *fsp_inbound_buf = NULL;