Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3415229rwb; Tue, 16 Aug 2022 02:34:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6oI/QKPWhpskSMCxZDLcreA8fdRXAr8d/VbtZXI4vygyOPFtwSgeWGdQS7MAGTY1R48I41 X-Received: by 2002:a05:6402:4303:b0:43d:94f5:8081 with SMTP id m3-20020a056402430300b0043d94f58081mr17429405edc.288.1660642445894; Tue, 16 Aug 2022 02:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660642445; cv=none; d=google.com; s=arc-20160816; b=t5Ikint/KdxaN/DYwgVLzqgoCjpLSwjYFsIJb61rvCeizia+ZZs09FFb7yAmBfMnxF JXAO4stMYEFPoV3RLuYdtKrK5o/xE/Aj9pZez356M/b+qtTE7S3b9oc/gEYczNU81cYm XS3vG4eN1eZXK9E1IIluXw1YhH3gaHulEXy06jerSBGntBQrDz9Fgfk5DBDdOVIgk+Em 5qnlRS/VSFUqiyXtSe3FnZ2FS7ZpLgAThHH35D8uVzkuD6dNfr2BGMYss+BtVRwMRnDE chTPnDnQO3Ceq9mf60tx9Di+rKaejRAXrQaISGsFr5WBFT7KmoQsv4wKOaP7qkGhImKA dZkA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OzF7FQfHgV31dJK+6qcdXcvzP4+cOUyKhDTkROCyla0=; b=R16jFiJvZHmBecN4vUVUpIKEPWTZqmUe5avArwKw2NgK26VgJwhw+O2Xur6gviXgMX 5uWyj8x/Niu4OeF9ElotNrE17Im/t+5afsxIRSiX1pXQY8DxFWOXbxXhm85QYjd6ZOCB DlsECn7VkrSQAW4ItKaymRxDYJOu7eoNT+tU/PMHdQRjlNMW/Jrw567mN/N38ipRUo+R nQ/n1El0r6VbqviubLN12UsbPCdxS4x/Lo99FvZcGvosi/pOfyt4/WKlvJXNinWjuA7I GS7dGOS7B1Kf3D0zk/aUvSYkKNMw6EY71bL0dg6tB9WH+f/kGwOvCpuJw78z27fOvqlq 6Chw== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di9-20020a170906730900b0072f473358besi10451988ejc.730.2022.08.16.02.33.40; Tue, 16 Aug 2022 02:34:05 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233655AbiHPJbi (ORCPT + 99 others); Tue, 16 Aug 2022 05:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233631AbiHPJac (ORCPT ); Tue, 16 Aug 2022 05:30:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E2B3DEC9 for ; Tue, 16 Aug 2022 00:51:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD3BAB81647 for ; Tue, 16 Aug 2022 07:51:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3A48C433D7; Tue, 16 Aug 2022 07:51:46 +0000 (UTC) Date: Tue, 16 Aug 2022 08:51:47 +0100 From: Catalin Marinas To: Peter Collingbourne Cc: Evgenii Stepanov , Marc Zyngier , Will Deacon , Vincenzo Frascino , Andrey Konovalov , Mark Brown , Linux ARM , LKML Subject: Re: [PATCH] mte: Follow arm64.nomte override in MMU setup. Message-ID: References: <20220805214734.1937451-1-eugenis@google.com> <875yj1x0k0.wl-maz@kernel.org> <87v8r1uztz.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 Tue, Aug 09, 2022 at 06:24:23PM -0700, Peter Collingbourne wrote: > On Tue, Aug 9, 2022 at 10:29 AM Evgenii Stepanov wrote: > > On Tue, Aug 9, 2022 at 9:49 AM Marc Zyngier wrote: > > > In which case what is the tag memory doing in the linear map? > > > Shouldn't it be marked as reserved, not mapped, and in general > > > completely ignored by the NS OS? > > > > That would be wasteful. The idea is to only reserve the parts of the > > tag memory that correspond to the TZ carveout and release the rest to > > the NS OS. > > More generally, one can imagine a system where *any* tagged memory > transaction can result in an SError because the MTE implementation was > not configured by an earlier bootloader phase, e.g. because the > bootloader was configured to disable MTE at runtime. On such systems, > the kernel must refrain from causing tagged memory transactions to be > issued via the linear map, and that's exactly what this patch does. The problem is that it doesn't. The 8.5 architecture allows any Normal Cacheable (even non-tagged) mapping to fetch tags. It may happen that on certain implementations setting MAIR to non-tagged works but that's not guaranteed and with the Linux kernel we tend to stick to the architected behaviour (with a few exceptions like PMU counters and errata). There is an ongoing discussion with the architects and partners on whether we can tighten the architecture as not to cause visible side-effects like SError but not sure whether that has been closed yet (just back from holiday). Until that's sorted, tag storage cannot be reused in an arm64-generic way in the kernel. -- Catalin