Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4068189rdb; Thu, 14 Sep 2023 10:44:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhBtDjqjhEWSVvclb0OFmtZ+lLvsiuAwJmSZQ3OH0aLwfBoRNSaPHcWGqDSuFKCnyxKJ64 X-Received: by 2002:a17:90a:7848:b0:267:f9ab:15bb with SMTP id y8-20020a17090a784800b00267f9ab15bbmr5623560pjl.14.1694713474432; Thu, 14 Sep 2023 10:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694713474; cv=none; d=google.com; s=arc-20160816; b=q5BfAYYUl32WOOdReNWqF8YE1UGJBS8VmIH/nhQMkHX0qYgVUkNMSnm40OTJjsAKWL huiibHimEUhovMGI8G5OhM5iGgRx3e1JA/oLj4qkiAEdZYWuC4xK5JnMc6xayw5iUR7n +y+4A7HgSYNzfNzfXmENfaZzLt/ZFtP5Hkcodp/cDYKp9tuxutvg1R9XF+PLG935JaLT C4K/7PadjYSMySzKfGuJ+m2QclT5dr5fEuzIXI/MagJxWFtMsk3f9T8dZrxbmIQJdSDM PfrobncJkSHny1HRnaHGf6sALzDiOHeuBCK/llqFUoKn/dlnymQDb5d6K1HzlXLyp2qT b0Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tTSFFCEklU3rymDjavG8uRpZ8kDhF1TBoipwhP4eAVs=; fh=nd9OpmTXn3UaOmylogHfl13HTRVn6jH17KppfjzmVNo=; b=eykVsA/iadHnLpSf+W8CEV6amzm5bAbVvECp0SmdqAvvh5M+kdo45BsGDAFGJpKOXR M09LtZmMRTTwNv9AvZJtVKi+vuWcTRx8GbR7j5BhbgbEqzV8RZMnbVIYtFVH1RGg6cC4 xCBMRp86lZ1nibBNaLV42jliAxkUqV/241Nnu/cZZj8cYl056GTLmGgUqFuBD+F9ssH8 8lEtnACo4JhSVc/+RKsSIuNFy/QFf0nFfSfdRmrb+5AFSF+RLfWH25/g2gJP38pIvRtm Q09ysAkmmhUoR3VcCJnCCCeLrNeCReX7c+z8yAAt3uOixyGOufMiKW/Wtn95nAXETjAL Xvvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l3-20020a17090ac58300b0026b7bee6873si4178849pjt.112.2023.09.14.10.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:44:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3E967836D605; Thu, 14 Sep 2023 10:37:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239714AbjINRh0 (ORCPT + 99 others); Thu, 14 Sep 2023 13:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237398AbjINRhZ (ORCPT ); Thu, 14 Sep 2023 13:37:25 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4531B10C7; Thu, 14 Sep 2023 10:37:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B111C433C8; Thu, 14 Sep 2023 17:37:14 +0000 (UTC) Date: Thu, 14 Sep 2023 18:37:12 +0100 From: Catalin Marinas To: Kuan-Ying Lee =?utf-8?B?KOadjuWGoOepjik=?= Cc: "dietmar.eggemann@arm.com" , "hughd@google.com" , "peterz@infradead.org" , "maz@kernel.org" , "rostedt@goodmis.org" , "rppt@kernel.org" , "yuzenghui@huawei.com" , "james.morse@arm.com" , "vschneid@redhat.com" , "bristot@redhat.com" , "juri.lelli@redhat.com" , "alexandru.elisei@arm.com" , "suzuki.poulose@arm.com" , "mingo@redhat.com" , "akpm@linux-foundation.org" , "mhiramat@kernel.org" , "bsegall@google.com" , "mgorman@suse.de" , "arnd@arndb.de" , "oliver.upton@linux.dev" , "vincent.guittot@linaro.org" , "will@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , Qun-wei Lin =?utf-8?B?KOael+e+pOW0tCk=?= , "linux-mm@kvack.org" , "hyesoo.yu@samsung.com" , "kcc@google.com" , "kvmarm@lists.linux.dev" , "david@redhat.com" , Casper Li =?utf-8?B?KOadjuS4reamrik=?= , "steven.price@arm.com" , Chinwen Chang =?utf-8?B?KOW8temMpuaWhyk=?= , "eugenis@google.com" , "linux-arm-kernel@lists.infradead.org" , "pcc@google.com" , "vincenzo.frascino@arm.com" , "linux-arch@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "anshuman.khandual@arm.com" Subject: Re: [PATCH RFC 00/37] Add support for arm64 MTE dynamic tag storage reuse Message-ID: References: <20230823131350.114942-1-alexandru.elisei@arm.com> <0dc2afaf8a976ef8eb9af711fd941f1bbfd71321.camel@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0dc2afaf8a976ef8eb9af711fd941f1bbfd71321.camel@mediatek.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 10:37:35 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Hi Kuan-Ying, On Wed, Sep 13, 2023 at 08:11:40AM +0000, Kuan-Ying Lee (李冠穎) wrote: > On Wed, 2023-08-23 at 14:13 +0100, Alexandru Elisei wrote: > > diff --git a/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > b/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > index 60472d65a355..bd050373d6cf 100644 > > --- a/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > +++ b/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > @@ -165,10 +165,28 @@ C1_L2: l2-cache1 { > > }; > > }; > > > > - memory@80000000 { > > + memory0: memory@80000000 { > > device_type = "memory"; > > - reg = <0x00000000 0x80000000 0 0x80000000>, > > - <0x00000008 0x80000000 0 0x80000000>; > > + reg = <0x00 0x80000000 0x00 0x7c000000>; > > + }; > > + > > + metadata0: metadata@c0000000 { > > + compatible = "arm,mte-tag-storage"; > > + reg = <0x00 0xfc000000 0x00 0x3e00000>; > > + block-size = <0x1000>; > > + memory = <&memory0>; > > + }; > > + > > + memory1: memory@880000000 { > > + device_type = "memory"; > > + reg = <0x08 0x80000000 0x00 0x7c000000>; > > + }; > > + > > + metadata1: metadata@8c0000000 { > > + compatible = "arm,mte-tag-storage"; > > + reg = <0x08 0xfc000000 0x00 0x3e00000>; > > + block-size = <0x1000>; > > + memory = <&memory1>; > > }; > > > > AFAIK, the above memory configuration means that there are two region > of dram(0x80000000-0xfc000000 and 0x8_80000000-0x8_fc0000000) and this > is called PDD memory map. > > Document[1] said there are some constraints of tag memory as below. > > | The following constraints apply to the tag regions in DRAM: > | 1. The tag region cannot be interleaved with the data region. > | The tag region must also be above the data region within DRAM. > | > | 2.The tag region in the physical address space cannot straddle > | multiple regions of a memory map. > | > | PDD memory map is not allowed to have part of the tag region between > | 2GB-4GB and another part between 34GB-64GB. > > I'm not sure if we can separate tag memory with the above > configuration. Or do I miss something? > > [1] https://developer.arm.com/documentation/101569/0300/?lang=en > (Section 5.4.6.1) Good point, thanks. The above dts some random layout we picked as an example, it doesn't match any real hardware and we didn't pay attention to the interconnect limitations (we fake the tag storage on the model). I'll try to dig out how the mtu_tag_addr_shutter registers work and how the sparse DRAM space is compressed to a smaller tag range. But that's something done by firmware and the kernel only learns the tag storage location from the DT (provided by firmware). We also don't need to know the fine-grained mapping between 32 bytes of data and 1 byte (2 tags) in the tag storage, only the block size in the tag storage space that covers all interleaving done by the interconnect (it can be from 1 byte to something larger like a page; the kernel will then use the lowest common multiple between a page size and this tag block size to figure out how many pages to reserve). -- Catalin