From patchwork Tue Oct 26 03:48:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12583817 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 576D1C433EF for ; Tue, 26 Oct 2021 03:50:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1B61360F9D for ; Tue, 26 Oct 2021 03:50:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1B61360F9D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=BjS2T91n2rCI/PLrKoKeTExqIPFseKJfDC6ZwuAYD+Q=; b=M+h 9vgT2c3lyvj43VvuAi3+T/jZGu5WfsQZGtfZvKU2grcqZcdllygk4c+O7hEGAVtxBghojAYBd8sBC ZcLczlystMakxJDYwZbckIo0Xw0Uau6PKn/xEzfdyi32OYe749mEbk7wqhfbhnBqX6I8C+IuVdWJT FCEIBWZrdp3Vm+Ey6FjLYdytx4+ekeswfOeoASxe/4LSd2htGz0p9pyk2s+n+5mGGrZGTfzjSwJKW /4TZfrIfRqDXsNeMe/Vflw7gDosJYbZIfi4TH5bhJndBCwf658RV8+L58asH3ciO2f/o3A+kUFCm6 LIvX5gciNCwgDKtw876Q1nJsi7cdtuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfDSc-000YCq-Uw; Tue, 26 Oct 2021 03:49:15 +0000 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfDSZ-000YCH-3L for linux-arm-kernel@lists.infradead.org; Tue, 26 Oct 2021 03:49:12 +0000 Received: by mail-pf1-x44a.google.com with SMTP id w196-20020a627bcd000000b0047c07de537aso1234612pfc.6 for ; Mon, 25 Oct 2021 20:49:06 -0700 (PDT) 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=7iOZYOC7ZjNVKOW5DcjY3nkn1EOW75nFUVGzhIFmIFw=; b=bfldP58vpkScYkSETLw3bNSr9CX2yjQ6c3SpkbGmaDoLx7TdI/WW48DcElb1IfeoCM CjrdxcXi3SC+or4cMZnv8TvvX6czM3uU3iIflFPDMF+VKrzaai8569VmmXNa7yThMjYi iT2XlmnsdzoKfNPVDOnXFNw4qvoSl1pwP8gyJMp6tBYT1Aqkicf9ilrCBNpw8G8GulAF Jzp5nhiCcuc4hAPYlqr7EzXONLkYy30j5euiv9Yzfh2HG/HSr+jcehHsqpNkhShjOGdw 0FEyxauLDujAi7Mdjkl9mpZsrF+XwfLReVMOFT3ddvE4LUuiLE8ZYta7932BXdRbFlIu bYAw== 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=7iOZYOC7ZjNVKOW5DcjY3nkn1EOW75nFUVGzhIFmIFw=; b=7UOY2PMAe2NILJFjXeFrKxFGB5Ur3vj/aXqnuZCCgPyejwBlszfVdxWYhGV/M0PJ7d 5Vsq4hYoO0wk5qhIf5iiRCo5P04v1ie1/KH5QafK319gdqK4ObKihKF9R9/hlAh/7eeU zNpqOIL3kywOdLvC9UAZk/ZLZxlkzHGviC1MttDDJwX5dqOfceGNX/C1wOc8usgoAKxG pOAnBn5swvV1rvp+qHHXIiSYoY2+8I6KTqOwVDNr3incq62WJKaL0D636HLuiFzIVqQp 5auPqJP6EoOlo5gD+5uAsEXT0QnfyZYy5bz6Pzego3mdspqSS8W/M0x2R9KaprKpP7mg WnyA== X-Gm-Message-State: AOAM53289dbeJx7/3v8UDxW9zYRCT87tl477mJo1h1I2wjK9sd6AUPfB s3fivZ5YBeNMFPHdzfhuybZohaP8aiY= X-Google-Smtp-Source: ABdhPJyFqf6Z8d+iHtT5yJw48e/V9qYHkRUkmMeBHUeHRnckTrgubTChLOT81C3otoHpKokMFwtKvkffN0A= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a62:5a41:0:b0:448:152d:78bf with SMTP id o62-20020a625a41000000b00448152d78bfmr22507195pfb.77.1635220146362; Mon, 25 Oct 2021 20:49:06 -0700 (PDT) Date: Mon, 25 Oct 2021 20:48:44 -0700 Message-Id: <20211026034844.1393437-1-reijiw@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 From: Reiji Watanabe To: Catalin Marinas , Will Deacon Cc: Marc Zyngier , 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-20211025_204911_187100_6A796953 X-CRM114-Status: UNSURE ( 8.88 ) 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 Currently, clear_page() uses DC ZVA instruction unconditionally. But it should make sure that DCZID_EL0.DZP, which indicates whether or not use of DC ZVA instruction is prohibited, is zero when using the instruction. Use stp as memset does instead when DCZID_EL0.DZP == 1. Signed-off-by: Reiji Watanabe --- arch/arm64/lib/clear_page.S | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S index b84b179edba3..7ce1bfa4081c 100644 --- a/arch/arm64/lib/clear_page.S +++ b/arch/arm64/lib/clear_page.S @@ -16,6 +16,7 @@ */ SYM_FUNC_START_PI(clear_page) mrs x1, dczid_el0 + tbnz x1, #4, 2f /* Branch if DC GVA is prohibited */ and w1, w1, #0xf mov x2, #4 lsl x1, x2, x1 @@ -25,5 +26,15 @@ SYM_FUNC_START_PI(clear_page) tst x0, #(PAGE_SIZE - 1) b.ne 1b ret + +2: mov x1, #(PAGE_SIZE) + sub x0, x0, #16 /* Pre-bias. */ +3: stp xzr, xzr, [x0, #16] + stp xzr, xzr, [x0, #32] + stp xzr, xzr, [x0, #48] + stp xzr, xzr, [x0, #64]! + subs x1, x1, #64 + b.gt 3b + ret SYM_FUNC_END_PI(clear_page) EXPORT_SYMBOL(clear_page)