Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp495406pxb; Wed, 13 Apr 2022 06:38:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziA6EsPEsDnhTpyS09SXHywP2vX/YXhnwwW6OQkRfHZMye9n50pkdcvsHj0cmedCj0ATNM X-Received: by 2002:a17:902:dac5:b0:158:5db6:3503 with SMTP id q5-20020a170902dac500b001585db63503mr16307843plx.76.1649857110851; Wed, 13 Apr 2022 06:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649857110; cv=none; d=google.com; s=arc-20160816; b=Qz60tHyzrCvRUKoNt/rxi0l9cAyXKVc2M//pLGSTZ8TI9T11i0A8UgzEKtulFo+Z/H GwqFLejy1CUibFUrYIUaTxMW/w1Gd4PcTFhyWjH6JyAUrBKfRCRIdLanaL61NeRspXum eqeXoha/1gQ65spIiL+cn3wD4/S/LrLT5Tb1MkYbGpocfu6zZhHdHoEUglKzOQ2zwNjE 2YzUlWcjTz8bgGjzV5zSDaeWs9O5pKZr7j0FmhluxR4Pm+t5qKsLNFY+iP2PlrFLG/4N 6+v4Qtdft7Bk8aCCsynZxAKTSBH3BOB+5gVZ++wQ3t/dhl4kNNB+tMGpm6ziSORGqob8 iZHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gwwGHu/kUMtzWbNVENzqf/cbed0N54Cas9skXOt024o=; b=ZiNgivUiM3yi6uWGX7lmrKChYJsG3LrO3tfK0qNEAoXbLrodYLY98ISXBmBhiOocSi 0fIc5OlLUXXyTuljw85xDrG0gyoHT5vQsymuRyFi26lYDpzGwRZtUi43rLJB7kO9V50M EOCCvLlQsHPzVuUVXqCJ81xRl5zSyVK+0Cn7PcG/DIpDGNmAx4WGu0Xq48CqS7hqS+ab tHErJpnxdErDM7GUu7eOA53X4TysXwOGRF39HXjexm204ylde/f8ZqnAOlkEimU1f+yJ 7T23DQ34v0f/ForIxCe5amxd7s5sdMmJa0T6/V9ES7HfDcEIlJXmZXxf6VFO8swm5PI7 xUfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=XPnqVjG6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a17090311ce00b00156a7f60b5bsi15783950plh.379.2022.04.13.06.38.14; Wed, 13 Apr 2022 06:38:30 -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; dkim=pass header.i=@vrull.eu header.s=google header.b=XPnqVjG6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234299AbiDMJMQ (ORCPT + 99 others); Wed, 13 Apr 2022 05:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234279AbiDMJMF (ORCPT ); Wed, 13 Apr 2022 05:12:05 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 752EB186C2 for ; Wed, 13 Apr 2022 02:09:44 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id o20-20020a05600c511400b0038ebbbb2ad8so767774wms.0 for ; Wed, 13 Apr 2022 02:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gwwGHu/kUMtzWbNVENzqf/cbed0N54Cas9skXOt024o=; b=XPnqVjG6h0UqhmNIPxikuceAuDekilIJ8T7vPpT4es4yah+70QMaFq1ZJgjKjC0ysb /OOCXveVq7AxK8PP3+X9/cJWZSEhjvknXaHwbtZWvECzXTwhiz8RvRR9n9gJ8JKJq0ij Ec4lCA0rRcVHxI2+LlU9084ORpwvoSfBzhz+dC/h5+ytDlWeihmcpiEA8WjcO63Uc7LX MQULtqO6+f51msdsVyPA9QpbR8k+PVyG5EPW48DOs6jbZTNSM060mNbJNLi8pJ9f4z5q 8KuSwphoN8QK5WZFEYW3bK62hb9rf7Mdg/7gJPj6I5/4xN7hrNKKNgl7C5cyUuj4hTPS B3vQ== 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; bh=gwwGHu/kUMtzWbNVENzqf/cbed0N54Cas9skXOt024o=; b=HkqRHSDgSX/SZebAKRwzMn1b/9wv3vGwSHab1lAj1HJ+Xg/91hdlVcFy2mRCW/ARFC 34iATlqnXQ6cjtBjO48pM3VfwLCNoEksAf5aynhyCYBognf37J3XUSXOwsuRT+4/7E4W 6gdGjlu7I+4kiseA5FRuUv8jDT+c6MAs5SnwULOgH0Mcs6AeHxNAY+CrLlkr9olVA6hF I4F9WzNYDTpeD0+XK2sJQbBW9Uz+WasDE4voXGrn/W0qG/vOYhOLXEp9hDkBMBTH4NFp deaBtpQtn+EfnhrEWyyWvFJlQxsR52vOWs0QQPpE6h4+hsOUig9HCyHOkG8Fn2wvjgIx mmGQ== X-Gm-Message-State: AOAM533xclljCi0JWPEu1xUwNYMqMDBA1BnQ7zDgET5qFCbgKEUETpL5 It630Bn9vWqhggYp1XCVjRAvvbCmzD1O1MRk00cgMA== X-Received: by 2002:a05:600c:35d4:b0:38f:6799:a386 with SMTP id r20-20020a05600c35d400b0038f6799a386mr664904wmq.196.1649840982912; Wed, 13 Apr 2022 02:09:42 -0700 (PDT) MIME-Version: 1.0 References: <20220413030307.133807-1-heiko@sntech.de> <20220413030307.133807-9-heiko@sntech.de> In-Reply-To: <20220413030307.133807-9-heiko@sntech.de> From: Philipp Tomsich Date: Wed, 13 Apr 2022 11:09:31 +0200 Message-ID: Subject: Re: [PATCH v9 08/12] riscv: Fix accessing pfn bits in PTEs for non-32bit variants To: Heiko Stuebner Cc: palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, wefu@redhat.com, liush@allwinnertech.com, guoren@kernel.org, atishp@atishpatra.org, anup@brainfault.org, drew@beagleboard.org, hch@lst.de, arnd@arndb.de, wens@csie.org, maxime@cerno.tech, gfavor@ventanamicro.com, andrea.mondelli@huawei.com, behrensj@mit.edu, xinhaoqu@huawei.com, mick@ics.forth.gr, allen.baum@esperantotech.com, jscheid@ventanamicro.com, rtrauben@gmail.com, samuel@sholland.org, cmuellner@linux.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 13 Apr 2022 at 05:04, Heiko Stuebner wrote: > > On rv32 the PFN part of PTEs is defined to use bits [xlen-1:10] > while on rv64 it is defined to use bits [53:10], leaving [63:54] > as reserved. > > With upcoming optional extensions like svpbmt these previously > reserved bits will get used so simply right-shifting the PTE > to get the PFN won't be enough. > > So introduce a _PAGE_PFN_MASK constant to mask the correct bits > for both rv32 and rv64 before shifting. > > Signed-off-by: Heiko Stuebner Reviewed-by: Philipp Tomsich