All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Reiji Watanabe <reijiw@google.com>
Cc: Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Peter Collingbourne <pcc@google.com>,
	Evgenii Stepanov <eugenis@google.com>,
	linux-arm-kernel@lists.infradead.org,
	Peter Shier <pshier@google.com>,
	Ricardo Koller <ricarkol@google.com>,
	Oliver Upton <oupton@google.com>,
	Jing Zhang <jingzhangos@google.com>,
	Raghavendra Rao Anata <rananta@google.com>
Subject: Re: [PATCH v2 2/2] arm64: mte: DC {GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1
Date: Fri, 3 Dec 2021 18:29:48 +0000	[thread overview]
Message-ID: <YapiHEdG05hW69Td@arm.com> (raw)
In-Reply-To: <20211108071149.823570-3-reijiw@google.com>

On Sun, Nov 07, 2021 at 11:11:49PM -0800, Reiji Watanabe wrote:
> diff --git a/arch/arm64/lib/mte.S b/arch/arm64/lib/mte.S
> index e83643b3995f..e62c048af337 100644
> --- a/arch/arm64/lib/mte.S
> +++ b/arch/arm64/lib/mte.S
> @@ -43,17 +43,23 @@ SYM_FUNC_END(mte_clear_page_tags)
>   *	x0 - address to the beginning of the page
>   */
>  SYM_FUNC_START(mte_zero_clear_page_tags)
> +	and	x0, x0, #(1 << MTE_TAG_SHIFT) - 1	// clear the tag
>  	mrs	x1, dczid_el0
> +	tbnz	x1, #4, 2f	// Branch if DC GZVA is prohibited
>  	and	w1, w1, #0xf
>  	mov	x2, #4
>  	lsl	x1, x2, x1
> -	and	x0, x0, #(1 << MTE_TAG_SHIFT) - 1	// clear the tag
>  
>  1:	dc	gzva, x0
>  	add	x0, x0, x1
>  	tst	x0, #(PAGE_SIZE - 1)
>  	b.ne	1b
>  	ret
> +
> +2:	stzg	x0, [x0], #16

Nitpick: MTE_GRANULE_SIZE instead of 16.

> +	tst	x0, #(PAGE_SIZE - 1)
> +	b.ne	2b
> +	ret
>  SYM_FUNC_END(mte_zero_clear_page_tags)

We can use stz2g here since we know it's always a PAGE_SIZE and an even
number of tag granules.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-03 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08  7:11 [PATCH v2 0/2] arm64: DC {ZVA,GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1 Reiji Watanabe
2021-11-08  7:11 ` [PATCH v2 1/2] arm64: clear_page() shouldn't use DC ZVA " Reiji Watanabe
2021-11-16 23:00   ` Robin Murphy
2021-11-18  8:18     ` Reiji Watanabe
2021-11-18 11:42       ` Robin Murphy
2021-11-08  7:11 ` [PATCH v2 2/2] arm64: mte: DC {GVA,GZVA} shouldn't be used " Reiji Watanabe
2021-12-03 18:29   ` Catalin Marinas [this message]
2021-12-03 18:51     ` Catalin Marinas
2021-12-04  8:03       ` Reiji Watanabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YapiHEdG05hW69Td@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=eugenis@google.com \
    --cc=jingzhangos@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@google.com \
    --cc=pcc@google.com \
    --cc=pshier@google.com \
    --cc=rananta@google.com \
    --cc=reijiw@google.com \
    --cc=ricarkol@google.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.