From nobody Fri Jan 9 08:12:27 2026 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 445D31E3DF2 for ; Fri, 26 Dec 2025 22:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766789607; cv=none; b=Ik/Br4fqVxTGeOjC0sufVHQYs/H+BnAUeYowYtAj+COm0GcJvMHoo2q/e7BebEqel4bq2iCd8v3CE7ZrzjaKqIBIimOmu5T8aQfJB/5gzzbFEfIv7lH9PZE+/ZCTUnHt6ROFR9mcjqmSTXw83mCqoA2gCQG4fQG5emn/SlJKOwg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766789607; c=relaxed/simple; bh=H9oEURFppzzQh4ad5CY+gHDo/cE8xRpGzvsht30sTGY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JO1EkYBLO0TnVwlYIUCIdaEBdz+thR/3IqP1bpszFiKDmmOb4ZEVG/gBWX8fY/z1tzPtwkJF6qx65AGwIXYlwHSQHigW7/WsipQKAbwxRQXuJmuHG/xWHWXrz73f0XMh/BHZJ/JowvpVPsS0cXUabjuespp/9Dp7t4lXAkfjbVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Xx9FrvZM; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xx9FrvZM" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2a07f8dd9cdso80579725ad.1 for ; Fri, 26 Dec 2025 14:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766789605; x=1767394405; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6YZZU/iwW88zjNDDGdCYX7IlRTUynqMqN8pEJHwT790=; b=Xx9FrvZM+Nx9UJLresHMiIGCErd3ssYr5ZrfAYFm7LtQWpV4PbC5JiOiTu9ROAtkfY OmFufGczklGPL/19GGxYlvvAQ+ekEpD6O0PdMwNJRr8g5jJ+nGJDGt56DUoxWDGTqmnf J6UNSN/pLGL9ANsh3sic8VZU01B5+4iUpKNQ+uo47+oKeTH4w6P281UYBYmK1E9gdC7P ns0F8mtvYRjEW9zZ8VCYjveCEIjkzcfmZehAAEu8SfCh+CMUf0n0GPY7iyjomuctaHJN 0CKRhGA/RkwvLQNyyoHibimDnj+miEUAAj9qx8VzCsBiwG0gIPkPrm4QKhysNpRn/1pd o4Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766789605; x=1767394405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6YZZU/iwW88zjNDDGdCYX7IlRTUynqMqN8pEJHwT790=; b=C6WXx9ADwBm7UHyEWz0gUzOh0Pw65aUiIU0NGzMjFBPUZE2BD+/b9MLZ2OcTO/OT5A MCvymA7eONDcw1+4Ewbk7In6qBbC1yXMklJZ67f8P0PmctLASphpSeARbRi5bel/EDXH qiiMF2Ek8KpF8Vc4B2Uyh3Y845Fm51XMcdzC1bgbtKbPTjt4KJx8yxaqF39WHZdxZW9Y iip/q5HJS6CYfBjhQFNEe/7PG5U6UdZ99xAik/jDhRYkvZwrvF0Ja+G+cPD2/DvCoh0E /xIx/lKoyDBHnL1ZI9cALqY9wmct4T3ibzzo8CpHZQ5yvcSyHl+CYhXOEb1+CZ9VKxhV a7hA== X-Gm-Message-State: AOJu0YxPxOtym1sltQC+dJmNt1+oKBtY836+woSa76u3+5lVf3cL759A 9qnNJImRm10pZIEJvrDF7UJipWUxiEx8rE/Rp9CHGbz0XH34jGcJhw3L X-Gm-Gg: AY/fxX5kPfrX3E7bS4vdcut+BaN3Xcg6W3bvO3zYHK/r+F6Bt7/Kv9qx2U9ddmC4b8F 9ww9+CbuZmH0E+ktbIp16Nqhh6mzw2pOp0iia7Z3BKMWw/XAEaO1tzS//XuGw8rf+vli1ty++Hy Hfb18rH0eficUnqseKUzFDbTqnJhuRcZdKECUrp9rUVhyAusu74ALIMiPGJvLuK5Tox6q98o3Rb iIrIVhx/csx4MLKRs7dSG5Qko414ERONve9dEi5Y52eoB/5uNAoChh/pdcN1kficS2YOGGsHQwu 6SAdJ4WnuIZOMosSXDvle71/ceK1cCb3Prl1OtP2WQaQiU53LKLwbxmuy4MauwmDp+w3MOjQo1V QB/cndC7iyoenbSV7u2ElWIrFagviCuVCySFuqPc3hJAH2E6zmXbK94jWFbLArTofYjPibaQgRR KB38n2LfS+bSyE X-Google-Smtp-Source: AGHT+IEPpw6k3H5B3GfQJ5gfoJrvfI68uwFervPMjcjEQdlc2KG+bnnPwgqGQJuYg9SuR5JsgGZOMA== X-Received: by 2002:a17:902:da81:b0:2a1:c72:a41d with SMTP id d9443c01a7336-2a2f2940678mr262079485ad.40.1766789605397; Fri, 26 Dec 2025 14:53:25 -0800 (PST) Received: from barry-desktop.hub ([47.72.129.29]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34e772ac1acsm9981428a91.9.2025.12.26.14.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Dec 2025 14:53:24 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: catalin.marinas@arm.com, m.szyprowski@samsung.com, robin.murphy@arm.com, will@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Barry Song , Leon Romanovsky , Ada Couprie Diaz , Ard Biesheuvel , Marc Zyngier , Anshuman Khandual , Ryan Roberts , Suren Baghdasaryan , Tangquan Zheng Subject: [PATCH v2 1/8] arm64: Provide dcache_by_myline_op_nosync helper Date: Sat, 27 Dec 2025 11:52:41 +1300 Message-ID: <20251226225254.46197-2-21cnbao@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251226225254.46197-1-21cnbao@gmail.com> References: <20251226225254.46197-1-21cnbao@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Barry Song dcache_by_myline_op ensures completion of the data cache operations for a region, while dcache_by_myline_op_nosync only issues them without waiting. This enables deferred synchronization so completion for multiple regions can be handled together later. Cc: Leon Romanovsky Cc: Catalin Marinas Cc: Will Deacon Cc: Marek Szyprowski Cc: Robin Murphy Cc: Ada Couprie Diaz Cc: Ard Biesheuvel Cc: Marc Zyngier Cc: Anshuman Khandual Cc: Ryan Roberts Cc: Suren Baghdasaryan Cc: Tangquan Zheng Signed-off-by: Barry Song --- arch/arm64/include/asm/assembler.h | 24 +++++++++++++++++++----- arch/arm64/kernel/relocate_kernel.S | 3 ++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/as= sembler.h index f0ca7196f6fa..b408ed61866f 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -371,14 +371,13 @@ alternative_endif * [start, end) with dcache line size explicitly provided. * * op: operation passed to dc instruction - * domain: domain used in dsb instruction * start: starting virtual address of the region * end: end virtual address of the region * linesz: dcache line size * fixup: optional label to branch to on user fault * Corrupts: start, end, tmp */ - .macro dcache_by_myline_op op, domain, start, end, linesz, tmp, fixup + .macro raw_dcache_by_myline_op op, start, end, linesz, tmp, fixup sub \tmp, \linesz, #1 bic \start, \start, \tmp .Ldcache_op\@: @@ -402,14 +401,13 @@ alternative_endif add \start, \start, \linesz cmp \start, \end b.lo .Ldcache_op\@ - dsb \domain =20 _cond_uaccess_extable .Ldcache_op\@, \fixup .endm =20 /* * Macro to perform a data cache maintenance for the interval - * [start, end) + * [start, end) and wait for completion * * op: operation passed to dc instruction * domain: domain used in dsb instruction @@ -420,7 +418,23 @@ alternative_endif */ .macro dcache_by_line_op op, domain, start, end, tmp1, tmp2, fixup dcache_line_size \tmp1, \tmp2 - dcache_by_myline_op \op, \domain, \start, \end, \tmp1, \tmp2, \fixup + raw_dcache_by_myline_op \op, \start, \end, \tmp1, \tmp2, \fixup + dsb \domain + .endm + +/* + * Macro to perform a data cache maintenance for the interval + * [start, end) without waiting for completion + * + * op: operation passed to dc instruction + * start: starting virtual address of the region + * end: end virtual address of the region + * fixup: optional label to branch to on user fault + * Corrupts: start, end, tmp1, tmp2 + */ + .macro dcache_by_line_op_nosync op, start, end, tmp1, tmp2, fixup + dcache_line_size \tmp1, \tmp2 + raw_dcache_by_myline_op \op, \start, \end, \tmp1, \tmp2, \fixup .endm =20 /* diff --git a/arch/arm64/kernel/relocate_kernel.S b/arch/arm64/kernel/reloca= te_kernel.S index 413f899e4ac6..71938eb3a3a3 100644 --- a/arch/arm64/kernel/relocate_kernel.S +++ b/arch/arm64/kernel/relocate_kernel.S @@ -64,7 +64,8 @@ SYM_CODE_START(arm64_relocate_new_kernel) mov x19, x13 copy_page x13, x12, x1, x2, x3, x4, x5, x6, x7, x8 add x1, x19, #PAGE_SIZE - dcache_by_myline_op civac, sy, x19, x1, x15, x20 + raw_dcache_by_myline_op civac, x19, x1, x15, x20 + dsb sy b .Lnext .Ltest_indirection: tbz x16, IND_INDIRECTION_BIT, .Ltest_destination --=20 2.43.0