Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp423559rdg; Thu, 12 Oct 2023 09:22:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpbVh1LWdjS5UeaEAO9p39MnyLDqTQB0rER/YV+Beu91GwLtZ6PtQsmOIQSQDQEBW/A4xD X-Received: by 2002:a17:903:110d:b0:1c1:fe97:bf34 with SMTP id n13-20020a170903110d00b001c1fe97bf34mr27734878plh.24.1697127734250; Thu, 12 Oct 2023 09:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697127734; cv=none; d=google.com; s=arc-20160816; b=jTrpIqrotUuNt5k5wtxhoBxd5Wyyk4vTDkeUvoRMByY9GRPFbtk/oso5q9V7aLWE/I b51p/TFEfYnsLLU6aslyUnn+7UrubzyWlsfMi3qfFyG/MQ71pmfQWhi1t7Rz1BcsRcTl 8pyQ3tGnlacaqLswSBoIlC1g9GD5GAhuZHUR2h8ckHQy+oSXjSp29oonQaWH3P3IZ5Dn ZJIRRRewCFqfSVP7idF8FD7c6mIohrRmAPh5hdqLoj/LDCh7k5U7y4RTC9IAFaqc0l69 uv1zVvtd3poFQ8gXlqeejGU5PYkpQsJYy9kAstclZMFFbA4gmPoabzfRT/erGbn3djji gngw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3SPN7XBgYtAbtWzOHt/0rYEE5hOBz9Hk2ZUOg0QfyB0=; fh=NMsXZhTwzDJCvHgmTODYS5M2x+7L4XrowdX2eTp3l9w=; b=m4neqeMGiN7UxUrRN3TLP35B5zem6o/2F2QfWZ0DWlpaugv1C6FrzRGBMije12j/zm M/6lSxQYSzkOSeF65S/B0j/dkzn0kJuurLZFajL8zxzwabeE3HP6/+bDdEUuWe+wlUKV NOe2fVlDqCt1vgfk7SKn+ObNr/ZuGQ92VXD7r+FQYgEu9+2uxquaLvM0MEzAgTsC16cr 1PN65kYsL3sicDLMEPrqOB4Rz3dlD62QPU5WiKPQ1skDiUsgX9NuW8qPKl6GKXCsdnmP Zjq6fZGgBCgv/QPczYiFRUVdIl+3ncOZpDGKSHzAOs9alD9iIxkdwb/JJupOn4o8abGm hKlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TNKw66xF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x8-20020a170902b40800b001c38666f77dsi2346306plr.596.2023.10.12.09.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 09:22:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TNKw66xF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8F74A8069D8A; Thu, 12 Oct 2023 09:21:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379480AbjJLQVP (ORCPT + 99 others); Thu, 12 Oct 2023 12:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344060AbjJLQVL (ORCPT ); Thu, 12 Oct 2023 12:21:11 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F73DA9; Thu, 12 Oct 2023 09:21:10 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-503397ee920so1503425e87.1; Thu, 12 Oct 2023 09:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697127668; x=1697732468; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3SPN7XBgYtAbtWzOHt/0rYEE5hOBz9Hk2ZUOg0QfyB0=; b=TNKw66xFB7Gmzg3kLfSQCIKjkEZRmAxFb1/RiyohVI3cY8qHEzndaJBsOkvlhpPkOu WOSwTcLhQKwol4UZ+k9mxK3JzBnf3sEk13GfhO9Gpa09iKtetrceM2DjPrat+/wAgpVo Bw2OM4xNcHmLGNTp/HOPChEUEf6fMawZ1ALZQBWTPSuX+TxZOLUuIpCQuzah0fHQn/dq jdpsksDVqrEXLccCQbfi9+qxnN3ehb6dddmH1RD8OZeAXGsW4pgSeTE3JQzPY87DEW8o V35E4MV2yyqsmKIXc1CNZgmUU6NK8XFvFFt1ijMItlxyvOUmbLepvtVv8KS3cGeKTOet 6jyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697127668; x=1697732468; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3SPN7XBgYtAbtWzOHt/0rYEE5hOBz9Hk2ZUOg0QfyB0=; b=ESgYAgQSU//Y9Xzo3ggqBgoDQ/7NKFpJSs+mzG7K1negl02ANf7EQX5i+xlpcnpKAI uHEmj89U+Jmzeqjc65Z3hiKFXAZ3LjKLoCr6de0wTRBc6zfrFp2kLy/YF2r/j+gf1/nK gCVBWTGbngKkq57WhGQoPyiDCRJkLMSyOgK4lNATBMGAJmvn+DVvHBlAmlexM/vsAf5C WZ7GghnQYrzUaFLL8rZvGnQn1Gm2n9r7tqfF5DOGs4Q1YxjoYNTT1UqZsux5LanBZ/qr iL7NGLLAFqwMJ2JAvYzRnuUmOuqXGmh69HonKX/V/IxIEFfrHGAFOfT+/lw/q7uICsRs 049A== X-Gm-Message-State: AOJu0YzchpT3Gz9EofEanaiONAKH5b5O8yf6OrJwm+u9iuZrUazjUWVM CWckAnOc6aflpvRh601t0D8= X-Received: by 2002:a05:6512:5ca:b0:4fa:5e76:7ad4 with SMTP id o10-20020a05651205ca00b004fa5e767ad4mr17671439lfo.10.1697127667970; Thu, 12 Oct 2023 09:21:07 -0700 (PDT) Received: from hp-power-15.localdomain (78-62-135-63.static.zebra.lt. [78.62.135.63]) by smtp.gmail.com with ESMTPSA id br34-20020a056512402200b005068e7a2e7dsm2557470lfb.77.2023.10.12.09.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 09:21:07 -0700 (PDT) From: Siarhei Volkau To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Siarhei Volkau Cc: Paul Cercueil Subject: [PATCH] MIPS: Take in account load hazards for HI/LO restoring Date: Thu, 12 Oct 2023 19:20:27 +0300 Message-ID: <20231012162027.3411684-1-lis8215@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 09:21:30 -0700 (PDT) MIPS CPUs usually have 1 to 4 cycles load hazards, thus doing load and right after move to HI/LO will usually stall the pipeline for significant amount of time. Let's take it into account and separate loads and mthi/lo in instruction sequence. The patch uses t6 and t7 registers as temporaries in addition to t8. The patch tries to deal with SmartMIPS, but I know little about and haven't tested it. Signed-off-by: Siarhei Volkau --- arch/mips/include/asm/stackframe.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index a8705aef47e1..3821d91b00fd 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h @@ -308,17 +308,11 @@ jal octeon_mult_restore #endif #ifdef CONFIG_CPU_HAS_SMARTMIPS - LONG_L $24, PT_ACX(sp) - mtlhx $24 - LONG_L $24, PT_HI(sp) - mtlhx $24 - LONG_L $24, PT_LO(sp) - mtlhx $24 -#elif !defined(CONFIG_CPU_MIPSR6) + LONG_L $14, PT_ACX(sp) +#endif +#if defined(CONFIG_CPU_HAS_SMARTMIPS) || !defined(CONFIG_CPU_MIPSR6) LONG_L $24, PT_LO(sp) - mtlo $24 - LONG_L $24, PT_HI(sp) - mthi $24 + LONG_L $15, PT_HI(sp) #endif #ifdef CONFIG_32BIT cfi_ld $8, PT_R8, \docfi @@ -327,6 +321,14 @@ cfi_ld $10, PT_R10, \docfi cfi_ld $11, PT_R11, \docfi cfi_ld $12, PT_R12, \docfi +#ifdef CONFIG_CPU_HAS_SMARTMIPS + mtlhx $14 + mtlhx $15 + mtlhx $24 +#elif !defined(CONFIG_CPU_MIPSR6) + mtlo $24 + mthi $15 +#endif cfi_ld $13, PT_R13, \docfi cfi_ld $14, PT_R14, \docfi cfi_ld $15, PT_R15, \docfi -- 2.41.0