From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29EDDC43460 for ; Fri, 7 May 2021 19:01:29 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99E126147D for ; Fri, 7 May 2021 19:01:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99E126147D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=t3bjaOnAdw+bTiZlnIsjQBUd4drZ3Rmp1I4N9ger3vw=; b=PId7CiMTZE1n8ul9cMfhYnT+zA l6A6af+9l9uPjejaZX8wjxh8X+6OzbclYCwjUtkGiY6UdxIoM3GUmU8i9ZvLegs3KkVxiAJqaYWsU LhVQPTr053GWtD9+06vy5tICIWCvAQ/ncwLkA2pIbn8oZU4I43bGxSYHTGjRgRu1Pt9JdCOPt4xjJ hCbDZm+ptzu+A8W5p+LsjKvv1uddmFk/9sGIIpWHvTgD1k0oKBAFsOd8b0X0aKZhE/D+quI8vs4qx EVyDoVQtb+d9Dh8o1hryBQhQmjw8Uc7yaWGMAiOKhiOx6QRO66RGJa0KIczSLst8PDsQVDlz4GhjK MzMCDICw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf5h4-007pyK-Bi; Fri, 07 May 2021 18:59:23 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf5h2-007pyB-8L for linux-arm-kernel@desiato.infradead.org; Fri, 07 May 2021 18:59:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:From:Subject: Mime-Version:Message-Id:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=bUlmaJ3DBmOWkEirS18krGME+5oWQAss7CnV2FEmkzk=; b=rHtefQ/fDUsSH++GDfvHdn5mws HhZ2hn0yf3+dqYfprrebzXRuDNAdThb9unbzid2ileGH0rfReal8fyODqIrr9AtiZXT1mdn4CBcYy 2yy2RWusdvHPtdS8IDo7r3yrJx/UQL7g9kPeVxVVtf2pjsTtAmww8IVRLrt1nEGvqz4wFal4rVN/O hu5+uvbTLn2cyfwBbQA27zLXdn7A2ov/H1HHGCfVqkt2j1HIPyYQCvqo5fMNUuZLl+ZElZfF0A6th a+RxWrkl6BkgFkN1lfboUhaqo+UJKN0+gQqQxwU0euDAlbczaveHI2MsbXNpb7tpNHnrnlV1dtKpX RNzVD66A==; Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf5gz-0077KM-A3 for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 18:59:18 +0000 Received: by mail-yb1-xb49.google.com with SMTP id o186-20020a2528c30000b02904f824478356so11087475ybo.4 for ; Fri, 07 May 2021 11:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=bUlmaJ3DBmOWkEirS18krGME+5oWQAss7CnV2FEmkzk=; b=XQ9v8g7z6GB9VUIw2oYSL5SOghNhEZ3cWe+NMcSCmNIOhOKFkVY2XX+4CwUArSk/Vv UyW34xEruNFEDNzFGOXySQTM4Ppv9gcHMPA/aG/MCn1Z8ILau/LwYHLiKzzBwD1vz9L9 xLxn6PN7liWUlV9I4haX9SDN4WTwvZv0qVd2WMCYIBfZafSSNC+62McNoGOUdGs/gAq6 EWJjlyD+QuO0Elqfj8pZIKiqBGSsbuO4kVocrfhreLo2PEGy16FDg0ofh3IOEV1nQ8bv Ll3FXexPAiCUDZaA/JQRjPN7ZUbVykeSQJO1wrdm0U3AyvR8YeIxkbVYvk2f+BqsvZ+4 HAog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=bUlmaJ3DBmOWkEirS18krGME+5oWQAss7CnV2FEmkzk=; b=ZhAdgpVqfHfOTAZZgSMYjefAwt+LHfm+962EN4NZI8vcBc+NhvbPrWd7wvXkUPqsWj FWBJieRWk1nb1/r8+/VEFVfzL2zSMNUs+N/0JBYBpIQqBoWMDhWO8rnETQdY+ocNb+ZP M2I6xjWYUgsdi2q0xwhUE7hqUoq3Tn1mP8wVrwCVassrgxHGRjW7vUC1pKkZ/tfGxake 5NennpsY+TXbVvSDOg57UbwKTyOdcBhBRZj89F3cFc9PvRcLJz9Mx7ryTJxM0kDA3t1+ UQD4+4EShd+xkcj968VyWE7fyOB42pQAM7TLSqB4OCnLut/C6M6dNSGUsTSU1A6XzSxD O/cA== X-Gm-Message-State: AOAM532cSt/uN/J/EcA7aoI6LerBTGUIkxTAlfDT3tO/atsKVtLSGNv2 SoEpVejKJaBUa+dhmwpimvmPbGM= X-Google-Smtp-Source: ABdhPJwbAM/J36vBWavQC7bJD9ssurzMNB9MreR8OB6/9spaIo9+Ja5ENG1xLTKBo6cktzQtD+Uopkk= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:f4bc:e4fd:1d93:96b2]) (user=pcc job=sendgmr) by 2002:a25:2bc1:: with SMTP id r184mr15777161ybr.51.1620413950833; Fri, 07 May 2021 11:59:10 -0700 (PDT) Date: Fri, 7 May 2021 11:59:05 -0700 Message-Id: <20210507185905.1745402-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog Subject: [PATCH v2] arm64: mte: initialize RGSR_EL1.SEED in __cpu_setup From: Peter Collingbourne To: Catalin Marinas , Vincenzo Frascino , Will Deacon , Mark Rutland Cc: Peter Collingbourne , Evgenii Stepanov , Andrey Konovalov , linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_115917_387084_DE055A2B X-CRM114-Status: GOOD ( 12.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A valid implementation choice for the ChooseRandomNonExcludedTag() pseudocode function used by IRG is to behave in the same way as with GCR_EL1.RRND=0. This would mean that RGSR_EL1.SEED is used as an LFSR which must have a non-zero value in order for IRG to properly produce pseudorandom numbers. However, RGSR_EL1 is reset to an UNKNOWN value on soft reset and thus may reset to 0. Therefore we must initialize RGSR_EL1.SEED to a non-zero value in order to ensure that IRG behaves as expected. Signed-off-by: Peter Collingbourne Fixes: 3b714d24ef17 ("arm64: mte: CPU feature detection and initial sysreg configuration") Cc: # 5.10 Link: https://linux-review.googlesource.com/id/I2b089b6c7d6f17ee37e2f0db7df5ad5bcc04526c --- arch/arm64/mm/proc.S | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 0a48191534ff..97d7bcd8d4f2 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -447,6 +447,18 @@ SYM_FUNC_START(__cpu_setup) mov x10, #(SYS_GCR_EL1_RRND | SYS_GCR_EL1_EXCL_MASK) msr_s SYS_GCR_EL1, x10 + /* + * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then + * RGSR_EL1.SEED must be non-zero for IRG to produce + * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we + * must initialize it. + */ + mrs x10, CNTVCT_EL0 + ands x10, x10, #SYS_RGSR_EL1_SEED_MASK + csinc x10, x10, xzr, ne + lsl x10, x10, #SYS_RGSR_EL1_SEED_SHIFT + msr_s SYS_RGSR_EL1, x10 + /* clear any pending tag check faults in TFSR*_EL1 */ msr_s SYS_TFSR_EL1, xzr msr_s SYS_TFSRE0_EL1, xzr -- 2.31.1.607.g51e8a6a459-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel