Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1480219iob; Fri, 29 Apr 2022 06:20:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvK1+8ryiMqz5c/afhNZe4vOq+tz0MywAmp3VXc85bVo6D+2Mk2FxqSCrbH6FiULpXXNOe X-Received: by 2002:a17:902:c952:b0:15e:89be:49ea with SMTP id i18-20020a170902c95200b0015e89be49eamr159828pla.32.1651238427634; Fri, 29 Apr 2022 06:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651238427; cv=none; d=google.com; s=arc-20160816; b=DT1EFu5aS1uEpJ3EfQvIodYBDz7thHgwumIqPS06S1fyRXwytZv3weZilede2WJ77I r4DhwuX4QfKWGf3Nq6es2iNsbD6Eqm+yfwvS/kqPYluEDRKiV+CvY1iR1G2P/lcnPZtn E67pO0MtRRNRI/dOH5hCODlvEAKBxX/W0bqdWEUNK0DnSCGtBdMJKEedFUl7JRtf3xYZ dNiuDqvAFHTp4VxMDqVaydKUrqmngamNT1P7IXEmEqCBtxqnlfAIETmRyYBqkuRqEoju a5J3q5+xYVf4Xq2QSiV6JvGEXPlEHpo+V3+vHX0A46nB7yJtvUcH6DiUZK67ysvFce1t Z1hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=ojIYzArEKxoCmbUHz9saGT0XVzZPGDef6gYS6nIrizo=; b=fAHGptlp2/9vPg5U9voeY6XdSHRVYl+CtkwvVGHdXd88C6qsdn6Y/cNIcptGb0TzQ9 uBhZxqrHVXVK20h9rmji3fAjWy1pojoyCqKqQClW0ReXMo5WxFMcD7q8kmGxcNUaD0m+ OOCL4WcuXKa6mfxOssCa6j/hPSMcD3KX+fmi31kGMM3aHPPFTFttQNbMY4BUMElgt3kl c2/IU+B+lGCUgsdARn0L5Eh2iTNnvCG/+lZjJRyipPA/+MF4URA1cRk3x1NbszEmU50c KUCitzaS8FXqpfQADzai+5k8LyXfNu7SgRfFO3CpJXwjWNnC2LsXu3sinjtUMsfGsuYN 8bMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amsat.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a63d14c000000b003aa6987721esi6802515pgj.380.2022.04.29.06.20.10; Fri, 29 Apr 2022 06:20:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amsat.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359691AbiD2NHo convert rfc822-to-8bit (ORCPT + 99 others); Fri, 29 Apr 2022 09:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238686AbiD2NHm (ORCPT ); Fri, 29 Apr 2022 09:07:42 -0400 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA62BCAB85; Fri, 29 Apr 2022 06:04:19 -0700 (PDT) Received: by mail-yb1-f174.google.com with SMTP id g28so14318516ybj.10; Fri, 29 Apr 2022 06:04:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ycd1bPuiSrNE0SR6b+uO4l9ZEm/fD3tp9CiU84zTTmU=; b=5zPZXmz+32c5o1tN5qdniB8ttQuR2ZHlD7U09g20gj5hHBDxvpLbzHU8EZN51wyZ+g 8rtvy5cWcaAPVoAPTJnUDu50SPshf5x9ahZRZIXlOn62OK388H/Eqc16OAScxyoKIPj3 E/7CbrGqyRdsfWofxqtSLkM6+gtPeEscai2sTl8u9gaXRGyHNK7CuyZxOaPzIMpSHh/M E3ygBF86NFU2ob6KZuoGArocQNlP/Z7GL+AV0mSBBUnS+nDKYZ/8GbmBaDwfHCNO2qhY BdLUvcs6QqcBTyFbbhMFKXyqPyvtWrT6zB2LRaOTnSU/Sq8KrcsdwFzQLd+uZDFPzDp4 woYA== X-Gm-Message-State: AOAM532sWV3t2a7k8r/+wIcvIEyqtZSlJg8PsarYQxruQ7yPT0wwuDLe Ago1PjRpnK5KrXXRDyMtSsT3sljEc0RP30nX1Fj20ilXHk0= X-Received: by 2002:a25:6e89:0:b0:642:57b:ccd7 with SMTP id j131-20020a256e89000000b00642057bccd7mr35395074ybc.115.1651237458734; Fri, 29 Apr 2022 06:04:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Date: Fri, 29 Apr 2022 15:04:07 +0200 Message-ID: Subject: Re: [PATCH] MIPS: Fix CP0 counter erratum detection for R4k CPUs To: "Maciej W. Rozycki" Cc: Thomas Bogendoerfer , "open list:BROADCOM NVRAM DRIVER" , open list , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Mon, Apr 25, 2022 at 9:39 AM Maciej W. Rozycki wrote: > > Fix the discrepancy between the two places we check for the CP0 counter > erratum in along with the incorrect comparison of the R4400 revision > number against 0x30 which matches none and consistently consider all > R4000 and R4400 processors affected, as documented in processor errata > publications[1][2][3], following the mapping between CP0 PRId register > values and processor models: > > PRId | Processor Model > ---------+-------------------- > 00000422 | R4000 Revision 2.2 > 00000430 | R4000 Revision 3.0 > 00000440 | R4400 Revision 1.0 > 00000450 | R4400 Revision 2.0 > 00000460 | R4400 Revision 3.0 > > No other revision of either processor has ever been spotted. > > Contrary to what has been stated in commit ce202cbb9e0b ("[MIPS] Assume > R4000/R4400 newer than 3.0 don't have the mfc0 count bug") marking the > CP0 counter as buggy does not preclude it from being used as either a > clock event or a clock source device. It just cannot be used as both at > a time, because in that case clock event interrupts will be occasionally > lost, and the use as a clock event device takes precedence. > > Compare against 0x4ff in `can_use_mips_counter' so that a single machine > instruction is produced. > > References: > > [1] "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", MIPS > Technologies Inc., May 10, 1994, Erratum 53, p.13 > > [2] "MIPS R4400PC/SC Errata, Processor Revision 1.0", MIPS Technologies > Inc., February 9, 1994, Erratum 21, p.4 > > [3] "MIPS R4400PC/SC Errata, Processor Revision 2.0 & 3.0", MIPS > Technologies Inc., January 24, 1995, Erratum 14, p.3 > > Signed-off-by: Maciej W. Rozycki > Fixes: ce202cbb9e0b ("[MIPS] Assume R4000/R4400 newer than 3.0 don't have the mfc0 count bug") > Cc: stable@vger.kernel.org # v2.6.24+ > --- > arch/mips/include/asm/timex.h | 8 ++++---- > arch/mips/kernel/time.c | 11 +++-------- > 2 files changed, 7 insertions(+), 12 deletions(-) Reviewed-by: Philippe Mathieu-Daudé