Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4383286ioa; Wed, 27 Apr 2022 02:34:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylZms4n/kTdjpry2K5EFXkMVZVQB+p6IdGuEZ7s7dsrO/8vqCWAAKIKzpcNAtVsat/gXNK X-Received: by 2002:a63:4e62:0:b0:398:cb40:19b0 with SMTP id o34-20020a634e62000000b00398cb4019b0mr23498998pgl.445.1651052063185; Wed, 27 Apr 2022 02:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651052063; cv=none; d=google.com; s=arc-20160816; b=EojALnoHADXAOjwU9tCK0A2UV0osXm7gw74x//1zG3dVYIGerTzDOSI9/x8rC3Xcfz Jf9ylGHc9gWJVaZvmQw/O4prB9696Xol7+5QvTpqjc5NLgrhVLNg6eMXnDjUCNa8wtqF NUNAZZEmjOCDJ8EDC95DC5StR1xa8Xlom9HwrUhjhrki85gI5qxti9fbDVFJmbMKveuU xfjlTB3SnHIMrC8nXcnfkjDQHndMwbPtvVQYni8BUKUEWkIJgOTO6EwUCZGguIs/1RBd 2uGGRVcwtmTXS8yNXv33m1+WJDvasu7vA1j7r3Vnqn31XG07tmnYVLjT94n1/ADphOVM 0XqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=cMBrzzqxE/3IvTrOxpwCELCkP6VKhCb4KOEmHQTJnjE=; b=i/oqga49Un+efW0tSwE3KDn7lqGik3injhpwtdHGbviXRcE6HBYlEIm1IgXNT9j4f5 EOpsCXeWjcEYXD4ILbzoBsvn6qACJKFk+NJKW6CS9DLECET/+DrPTyrB8aYgjoRCwRbV aRxj+zT0+tF/hud2g7trFyMVN93XUberSXvh/Gu1awzI8yPaKqiTJgifkvuepga7V7Dl 2RPlIST/F7os5qtmqtbBYV0Gz9jv2sfp0XQnUIa4YkjQgyGYIkstk1l3oxAdlFcjTdeL olJQySWRdlT/i9Y+mL58o3a2whAVaxmo2eKTKExhs8reJdykf13PEQkCrqLWkDd7ntKi qUng== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h12-20020a170902f54c00b001590572af7bsi1253898plf.409.2022.04.27.02.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 02:34:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 12751260A91; Wed, 27 Apr 2022 02:14:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354946AbiDZUbx (ORCPT + 99 others); Tue, 26 Apr 2022 16:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354755AbiDZUbu (ORCPT ); Tue, 26 Apr 2022 16:31:50 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FAD2644F4; Tue, 26 Apr 2022 13:28:41 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 810B892009C; Tue, 26 Apr 2022 22:28:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 7B0E992009B; Tue, 26 Apr 2022 21:28:39 +0100 (BST) Date: Tue, 26 Apr 2022 21:28:39 +0100 (BST) From: "Maciej W. Rozycki" To: "Jason A. Donenfeld" cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, tglx@linutronix.de, arnd@arndb.de, Thomas Bogendoerfer Subject: Re: [PATCH v6 09/17] mips: use fallback for random_get_entropy() instead of just c0 random In-Reply-To: <20220423212623.1957011-10-Jason@zx2c4.com> Message-ID: References: <20220423212623.1957011-1-Jason@zx2c4.com> <20220423212623.1957011-10-Jason@zx2c4.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE 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 Sat, 23 Apr 2022, Jason A. Donenfeld wrote: > diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h > index b05bb70a2e46..8cfa485d19e6 100644 > --- a/arch/mips/include/asm/timex.h > +++ b/arch/mips/include/asm/timex.h [...] > + if (cpu_has_3kex) > + c0_random = (read_c0_random() >> 8) & 0x3f; Hmm, I wonder whether we do need to mask the contents of the register out here given that known implementations return zeros in reserved bits. Even though R3000 documentation I have access to makes no guarantee as to the values of the reserved bits here I think we can safely proceed according to what systems we do actually support do (even though it only saves one instruction). > else > - return 0; /* no usable register */ > + c0_random = read_c0_random() & 0x3f; Here the architecture guarantees unused bits to be zero, but the number of them varies between implementations. However we'll only ever use this leg for the R4000/R4400 processors, which have 48 TLB entries, and for the Ingenic XBurst cores, which I have now verified in documentation (which user-reported dumps from /proc/cpuinfo are consistent with) that have 32 TLB entries. So I think this mask operation can go as well. I guess these updates can be made with a follow-up change though. Maciej