From patchwork Mon Dec 6 00:47:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12694854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9DFEFC433F5 for ; Mon, 6 Dec 2021 00:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=iKihR4Xzyfcpxv7WUOWh9zreDKRmxrh9glYKz9y1lU0=; b=LXb ZSYzEFfXFERT4QD+v26y96fibN9PtuuiDbsSg/ghLiKtAdnelTCAk9p5PZtMRNKXLhlu84jwYT3Bc cyqEopdKsCPhby/6tLsymioa5NdvRtUzIEZ20cJg1AmbW78IVqNNK1Pt5mFn6mQOr/QS2bsFVDs2w 93RacVeWcxjk8kfYKGFXCCLkZtWamiLZiQUUJ3tp69DA3dzMgHIgdmA5k6FhmKDWzt/+SL6Nq5DMU QDjlKrxtkI2xuwV/eCDZ+y+rwmimYGzQ+fc0AQQXuA/QiTweSqJIkyjTcaG0vFBBepiVD0jMThWM6 sHUW6uCVZnJhGXhubhRNieuJ62vmclw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mu2Ac-002GJb-Pd; Mon, 06 Dec 2021 00:47:54 +0000 Received: from mail-pg1-x549.google.com ([2607:f8b0:4864:20::549]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mu2AZ-002GHr-1O for linux-arm-kernel@lists.infradead.org; Mon, 06 Dec 2021 00:47:52 +0000 Received: by mail-pg1-x549.google.com with SMTP id w7-20020a634907000000b0032d64927016so5742834pga.17 for ; Sun, 05 Dec 2021 16:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=aqzXKflTKl+0fWINnIfl4ZsZs+0t1QQnHSzaC0CSPuk=; b=jzlpkcj23VWgChM6qu2m3QgA+TyIym5haeTeS50G3kg+4FG84TlDSYhT9t2th1NJhs T7ESI2C89MxTCo/FvKfe679woemXcnMTEwdg/YrjqfjdtkCCbq1YBzrsyrR+jOgu5EIq DsyW6usTFfrsev8BIHUtSPwrtB1/jPrGxIvKl0IQd/thaUqXQwXSEAMIWqnj2Tmz1Ve4 IzoGuEZw9goxSBwMawSUcncog8oRxs3at/GZBQlmcA0sZsdUCoxDLJSdi5k07CvcOZUP cJ4p5hapBHDl0Dr0Y+gCeiR0rzYsHiqE/jE97y9LjG8VxAn7J2htDrviPRVnKEXA8tKk kYHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=aqzXKflTKl+0fWINnIfl4ZsZs+0t1QQnHSzaC0CSPuk=; b=6cWkSiiikj2Vgmn0obGp6BR2kwKpVkycQazAORNo5Dd0jMe416mx/l4xdLlD370+Va 7B2M1fxi2rI1YtrRnaEqq4c2WJApFmvmcioCdVqT+oWo4HcBiFrPYF+d/6seU6gsH+/g 11f8/8UWBNpBXQ5G6U5GiJnxzwWd0ZSymWgrFqKsm7N/yVDelvsv/0NOPc10nymyEIbS Lp81OYrpmv1sUK+dC4CCOTqBJFPipu0dMWGtqiPrlEiiI44o+84Nc++MnLgnocwseRJ3 ApDLq9preHGK4Wb5jO7ZXruPWQRPb+w4pN3C/Y4cxXWZVQgvRnjPcM5u6lMv6rsa96+y 1fyQ== X-Gm-Message-State: AOAM5301MQcN57WO+9TT+nB7/zM1e9H8r3z0cPP+GAU6dbj6A7HPnO9p wok4MZzPWtppDd6wo6cGa/LBDuetilM= X-Google-Smtp-Source: ABdhPJy59OcLDBUV2OGKKrrcdD3hVzV/wbKPU6dVf7S8CtpJumWnGQCKudH3dIh3ywec4Bw4OjxkS3l1D1c= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a17:902:ecc1:b0:142:fae:f686 with SMTP id a1-20020a170902ecc100b001420faef686mr39957113plh.24.1638751667951; Sun, 05 Dec 2021 16:47:47 -0800 (PST) Date: Sun, 5 Dec 2021 16:47:34 -0800 Message-Id: <20211206004736.1520989-1-reijiw@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.34.1.400.ga245620fadb-goog Subject: [PATCH v4 0/2] arm64: DC {ZVA,GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1 From: Reiji Watanabe To: Catalin Marinas , Will Deacon Cc: Marc Zyngier , Robin Murphy , Mark Rutland , Peter Collingbourne , Evgenii Stepanov , guanghuifeng@linux.alibaba.com, linux-arm-kernel@lists.infradead.org, Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata , Reiji Watanabe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211205_164751_113430_F2C70BCD X-CRM114-Status: UNSURE ( 7.90 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DCZID_EL0.DZP indicates whether or not use of DC {ZVA,GVA,GZVA} is prohibited. However, clear_page(), mte_set_mem_tag_range(), and mte_zero_clear_page_tags() use those instructions without checking it. Fix those functions not to use DC {ZVA,GVA,GZVA} when DCZID_EL0.DZP == 1. v4: - Fix mte_zero_clear_page_tags to use stz2g instead of stzg. [Catalin] - Fix mte_zero_clear_page_tags to use MTE_GRANULE_SIZE instead of 16. [Catalin] v3: https://lore.kernel.org/all/20211119060927.3185381-1-reijiw@google.com/ - Use stnp instead of stp in clear_page(). v2: https://lore.kernel.org/all/20211108071149.823570-1-reijiw@google.com/ - Fix mte_set_mem_tag_range() and mte_zero_clear_page_tags() not to use DC {GVA,GZVA} when DCZID_EL0.DZP == 1. [Mark] - Fix a typo of the comment in clear_page(). [Mark] - Fix a loop of for stp in clear_page() for more consistency with the existing loop. [Mark] v1: https://lore.kernel.org/all/20211026034844.1393437-1-reijiw@google.com/ Reiji Watanabe (2): arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 arm64: mte: DC {GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1 arch/arm64/include/asm/mte-kasan.h | 8 +++++--- arch/arm64/lib/clear_page.S | 10 ++++++++++ arch/arm64/lib/mte.S | 8 +++++++- 3 files changed, 22 insertions(+), 4 deletions(-) base-commit: 0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1