From patchwork Thu May 17 23:31:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 915862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40n6zZ00NJz9s1w for ; Fri, 18 May 2018 09:32:42 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r9daS0Fq"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40n6zY5Yc6zF284 for ; Fri, 18 May 2018 09:32:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r9daS0Fq"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=bsingharora@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r9daS0Fq"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40n6y93xcLzF26D for ; Fri, 18 May 2018 09:31:29 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id t12-v6so3445165plo.7 for ; Thu, 17 May 2018 16:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=m4xBQs2sigM5WHAYAsC9WDFKtHDZidwgz0zNQQE5mGo=; b=r9daS0FqXvj9L5G+e+bP6S9yR2xMjarR0X8ihJBOHZkBdNYGP+IZxxUzU/6teHQoRe JQaPcnKCPvOkqDil0T/fmPgzltRfApdr1/+YTEG04Y16/t6KW6M0FVM6wmyXqCWo6uGy cl4rThoSMV3ziTBhRNaCLFiauUCIHfojNg+F6/y7mGHKqYHiodF/LrHrf2ViTlZ/U3d2 z0PQk3Q0rcY3SP67TVMG3DpzwS+fRcOmvmx6alSCD0ynlA2KmogVvVfqJGL35MF/YSbI 0JM2Mk95sVZHBGsT48t00TjhMVI5MSszRcDAER7ffJWzjiy/9h35/RbYfLU2Kw0JY/qA svNA== 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=m4xBQs2sigM5WHAYAsC9WDFKtHDZidwgz0zNQQE5mGo=; b=Gg81fZ8cQuNWFJLJNdJ2oWphtidSVnCcb87w/0AHReCElidrhrTvleU18uCCzx5eCz WlDrgMBYwAD9ei2kubPrB/OVArIUdJv0+obWhbuz9wPhvXDm5onRKW1xWkXiPIQ9y55a 0WyzJeTl5Iq8fwzNSj89M6BeoRXRN7WtjiZj9IJfFRuQvO7zfDrBB/XpHyWKu6ScMv+J ZgdsdEiBIB2DX1XwqV2BZJO8qMnfxVBX16PC1mrsYUjK1nf2ilR4mJGazg25uUNl3X5J w/LgrxUtz81JhuOq1zr6NwQB8Un88eeK0SaE0IRp5KMN3OyH7wg2xzSOJcAZB9eimtmX Lgxw== X-Gm-Message-State: ALKqPwfatmlQJTiuXM47w/NrSrB0HKGbkZJo0Na55c2zsc22Vq7+evza O8DPn+lkbM0iVRk5TsmHbRQR6izO X-Google-Smtp-Source: AB8JxZrgQ4BjGT271uHwr+vuFSAHuswYoeHnBR1bTBQDqX8Z560rsqsYzU40wbrJ/MOazzwNQrabOg== X-Received: by 2002:a17:902:70c9:: with SMTP id l9-v6mr7037633plt.382.1526599887280; Thu, 17 May 2018 16:31:27 -0700 (PDT) Received: from localhost.localdomain (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.gmail.com with ESMTPSA id q76-v6sm12805990pfi.139.2018.05.17.16.31.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 16:31:26 -0700 (PDT) From: Balbir singh To: skiboot@lists.ozlabs.org Date: Fri, 18 May 2018 09:31:03 +1000 Message-Id: <20180517233105.8243-5-bsingharora@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517233105.8243-1-bsingharora@gmail.com> References: <20180517233105.8243-1-bsingharora@gmail.com> Subject: [Skiboot] [PATCH 4/6] p9/stop_api: Remove unnecessary stores X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Caught by scan-build, good compilers will optimise them away anyway, but it's good to not have unnecessary code to begin with. I guess we need to propagate these fixes back to other sources, so that our rebasing is easy in the future. Signed-off-by: Balbir singh --- libpore/p9_stop_api.C | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libpore/p9_stop_api.C b/libpore/p9_stop_api.C index 5c0f2e5e..c1a731f5 100644 --- a/libpore/p9_stop_api.C +++ b/libpore/p9_stop_api.C @@ -182,8 +182,8 @@ static StopReturnCode_t validateSprImageInputs( void* const i_pImage, static uint32_t getOriInstruction( const uint16_t i_Rs, const uint16_t i_Ra, const uint16_t i_data ) { - uint32_t oriInstOpcode = 0; - oriInstOpcode = 0; + uint32_t oriInstOpcode; + oriInstOpcode = ORI_OPCODE << 26; oriInstOpcode |= i_Rs << 21; oriInstOpcode |= i_Ra << 16; @@ -237,7 +237,7 @@ static uint32_t getOrisInstruction( const uint16_t i_Rs, const uint16_t i_Ra, const uint16_t i_data ) { uint32_t orisInstOpcode; - orisInstOpcode = 0; + orisInstOpcode = ORIS_OPCODE << 26; orisInstOpcode |= ( i_Rs & 0x001F ) << 21 | ( i_Ra & 0x001F ) << 16; orisInstOpcode |= i_data; @@ -278,8 +278,8 @@ static uint32_t getMtsprInstruction( const uint16_t i_Rs, const uint16_t i_Spr ) static uint32_t getRldicrInstruction( const uint16_t i_Ra, const uint16_t i_Rs, const uint16_t i_sh, uint16_t i_me ) { - uint32_t rldicrInstOpcode = 0; - rldicrInstOpcode = 0; + uint32_t rldicrInstOpcode; + rldicrInstOpcode = ((RLDICR_OPCODE << 26 ) | ( i_Rs << 21 ) | ( i_Ra << 16 )); rldicrInstOpcode |= ( ( i_sh & 0x001F ) << 11 ) | (RLDICR_CONST << 2 ); rldicrInstOpcode |= (( i_sh & 0x0020 ) >> 4); @@ -412,7 +412,6 @@ static StopReturnCode_t updateSprEntryInImage( uint32_t* i_pSprEntryLocation, *i_pSprEntryLocation = tempInst; i_pSprEntryLocation += SIZE_PER_SPR_RESTORE_INST; - tempRegData = (uint16_t)i_regData; //get bit b48-b63 of SPR restore value to R0 tempInst = getOriInstruction( regRs, regRa, (uint16_t)i_regData ); *i_pSprEntryLocation = tempInst;