Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp956227pxb; Wed, 15 Sep 2021 17:59:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0jSFckcVhxxD/WMH7+GcY1jxag1NdOFalmmW3smt+XN7vkfSBTveS1sPtmvFQ4g5Tp4Fk X-Received: by 2002:a05:6402:1913:: with SMTP id e19mr3315875edz.9.1631753948450; Wed, 15 Sep 2021 17:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631753948; cv=none; d=google.com; s=arc-20160816; b=L3kyDjAAIru5D0lD8Qn/YxAx9xw/hmYjT6KqcwzUnvMPm9/BZ6OpVgAVt9XH/Y/66C 69iI3GlG4vfdWeSr6jc1on/NQDhwziKRWbCRqKr/BNS2U7lgYGTmYHQU5qORjg86R5wz Xve3WHx4mOXiO+TNojZikzZicSts3x/1fzVoexv3OWFMfNPri51Lrfv96AVsHjxvQOa1 wNk+NEOAikdf/QT2LcW3gwEX4mSELpsKucHnj/2bI1dKAT2n4r6+MsNl+1N2tcZub6T7 9Br3pTEXyGnplERE0Q4LIXRySUUMd0FC02wBDcSlfi6tAGX9pLCujBnSQyqp4RqqBiFR mmWA== 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=PPYvDD2Y2Mlg+PX6HNHTeussw4Rj1uHKFk53wZUOv0I=; b=p7ApqgYFq7vNPVaqdaqr/NCHojb3PGbzb2SK2f84P/oDMzOWD9h59ZlKLAx5EwgPjx 5NHCe5qZHHsfBnIrTX9ReL3Gz/CIwbQbqF3yHPbJCVQvucAB/LdSyLdR6e46MooV9Yfx hj3mvcIh+xofntXDevzAKMM3LBCNkYHZrJaXbzcHPdhEoBZiJ21ohdBxAc2XKPQ+/5vc W/HT7pxkQsJ++8937CuKegSQw3DyO59fNWbq4RiBxaTfPhfb2Rz5IWf7krPmV/KSadTN FfOngPJmRGli5y+/MDHq2vH/abcB2Y3pupVENBeAaQUoGb9qBsXQNpOmfLJKxBGCy0i2 hVew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WCvnczTQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si1728970edv.199.2021.09.15.17.58.44; Wed, 15 Sep 2021 17:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WCvnczTQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbhIPAua (ORCPT + 99 others); Wed, 15 Sep 2021 20:50:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:49228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233405AbhIPAua (ORCPT ); Wed, 15 Sep 2021 20:50:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 78A9761186 for ; Thu, 16 Sep 2021 00:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631753350; bh=0fKIb1wSJtzBX6f3dXc+/Xbaxxti6nBaEoOdmYLZUIk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WCvnczTQPx2dh1r9Q2ZKG5wBOfjDM8AxcKQHwq5bUKOcy/kF4rvxBJv9Tn/T9Gjll ysjVntR1bAPllMoGBE0Lr6QgPig14HlVYVgp4mglTOu9sBKg5WDY5nKghhUsUirveX vd5/OfJ1mUx3hbzdHVLGy/9JYEQSiw0OyTq3vdGuPJDgqY2g1oPdgU9/gqB61SsQtV jAAZtlLKseywDxOGO04SYZAr1mzmLV+5H8ndbtuc8u275zUs69aBO1NdetVUkP6ccS L/PeQEd0lIMjohnGzF1Q6nStfu//tF+xGPVO0qq6XbFW6ZNXQ3lmqmMk5oZp8Eyxxw YnJIHB/CLVcvw== Received: by mail-lf1-f49.google.com with SMTP id b18so10350207lfb.1 for ; Wed, 15 Sep 2021 17:49:10 -0700 (PDT) X-Gm-Message-State: AOAM531j3X+9DqErtb0Oyqdf7XloCwknjDsOtZKQQetaZLfW4tPSzDPg Gi9w4YhRJr76rG7pMWgoNW0XS08T12tb2oB3RYM= X-Received: by 2002:a2e:3307:: with SMTP id d7mr2546833ljc.292.1631753348776; Wed, 15 Sep 2021 17:49:08 -0700 (PDT) MIME-Version: 1.0 References: <20210911092139.79607-1-guoren@kernel.org> <20210911092139.79607-3-guoren@kernel.org> <20210915074727.GB20024@lst.de> In-Reply-To: <20210915074727.GB20024@lst.de> From: Guo Ren Date: Thu, 16 Sep 2021 08:48:57 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH V4 2/6] riscv: errata: pgtable: Add custom Svpbmt supported for Allwinner D1 To: Christoph Hellwig Cc: Anup Patel , Atish Patra , Palmer Dabbelt , =?UTF-8?Q?Christoph_M=C3=BCllner?= , Philipp Tomsich , liush , wefu@redhat.com, =?UTF-8?B?V2VpIFd1ICjlkLTkvJ8p?= , Drew Fustini , linux-riscv , Linux Kernel Mailing List , taiten.peng@canonical.com, aniket.ponkshe@canonical.com, heinrich.schuchardt@canonical.com, gordan.markus@canonical.com, Guo Ren , Arnd Bergmann , Chen-Yu Tsai , Maxime Ripard , Daniel Lustig , Greg Favor , Andrea Mondelli , Jonathan Behrens , Xinhaoqu , Bill Huffman , Nick Kossifidis , Allen Baum , Josh Scheid , Richard Trauben Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 3:47 PM Christoph Hellwig wrote: > > This is the wrong way around. We need to design around the PBMT > definitions. I've defined them in arch/riscv/include/asm/pgtable-bits.h first, that follow current latest draft. Then I undefine them in errata/thead/errata.c to illustrate we should follow standard PBMT, not a custom one. > If we want to hack in support for completely broken SOCs > that intentionally violate the specification it should be done after > the fact, When c9xx was released in 2018, there is no clear direction for how to solve the non-coherent problem. We just thought PBMT is the correct direction, but we can't predict how encoding exactly in the highest bits. (Maybe we should keep the highest bits zero for _P/SXXX in pgtable.h, but it was really hard to guess at that time.) So don't imply we "intentionally" here! When the svpbmt is frozen in the future, we would follow that in our next-generation processor. > in a separate patch, using alternatives and clearly documenting > how broken these SOCs are. Okay, I would separate errata into another patch. About documenting, I've illustrated c9xx PTE format's detail and using undef _PAGE_XXX to show that we replaced standard's in errata: +/* + * T-HEAD C9xx PTE format: + * | 63 | 62 | 61 | 60 | 59-8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 + * SO C B SH RSW D A G U X W R V + * ^ ^ ^ ^ ^ + * BIT(63): SO - Strong Order + * BIT(62): C - Cacheable + * BIT(61): B - Bufferable + * BIT(60): SH - Shareable + * + * MT_MASK : [63 - 59] + * MT_PMA : C + SH + * MT_NC : (none) + * MT_IO : SO + */ +#undef _PAGE_MT_MASK +#undef _PAGE_MT_PMA +#undef _PAGE_MT_NC +#undef _PAGE_MT_IO + +#define _PAGE_MT_MASK 0xf800000000000000 +#define _PAGE_MT_PMA 0x5000000000000000 +#define _PAGE_MT_NC 0x0 +#define _PAGE_MT_IO 0x8000000000000000 +#endif -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/