From nobody Mon Feb 9 12:24:04 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 28BDD1F5F6 for ; Fri, 19 Dec 2025 05:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766122638; cv=none; b=j+h+nHd7hG6UHZyI/Qm28YrIxH37P9o13ytIND1iYf50WdjowepJXothYEwocBsys8YaMLTr+sd5n7AIZnInS56GVFKweHIZ4jspu+qCO9Yh5ePcThltvT1/9o16W2H6nyb0fLta6sMIxH38s3B3JDTF2CVzhZ9VcoC1GMHxi3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766122638; c=relaxed/simple; bh=oXHMuHXV30gXK0zo04y1oVqzgP5bQsiQpukq82bkvqo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=JAq4A2/OUiaxxhvbK/1C6BCLAoZc3qNxOuhb1DXh6C7KQSsvquUIHjZPz48tnbscp1rPLvFj29GRufs5TlcmSQyvYO7KLfm8tFfk5YuzEWm3A263RUtOZATMc/ZzymjHJpOc2tZjOcLqLFpQchy8MX8rIcIcOookxH38kKFhw7M= 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=L49GxZgR; arc=none smtp.client-ip=209.85.214.182 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="L49GxZgR" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2a0d67f1877so17058225ad.2 for ; Thu, 18 Dec 2025 21:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766122636; x=1766727436; 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=/NkbhnSjmQqWyentKViHSvnUd2t4Anb4J6Vl3+26IzI=; b=L49GxZgR/udXIBxm0qL/iLFe6nEGLnEHuOf1smhFvXSVChamREmFNiGlLh4EgQdK0t u4U7FaIs1+N6ahVxKvoRd+P4Us+yrwfnE0lzo17YMHo4pPOu3itj7ghjO6RzacbIgBVm 4OID9IrPJYWwGXmuGS+VGeWlUq4IpWW1zrg9BN5rxS7KvRG2pqHHjMDUC7Dr7F6wJDdu D2x8g9Jr7HGXjmVrIb44Lu5iJ4biSSWJxlg0hCAW98yrJb64KcQ84s6/xcM4ktWottt/ pgikJvs+983xVkOA5+XbrZX/h+kjZCYflkGQe+fhOGaB4yiL6zHRlADqc/XPyua0RNfW OkqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766122636; x=1766727436; 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=/NkbhnSjmQqWyentKViHSvnUd2t4Anb4J6Vl3+26IzI=; b=cq8m7c+rlKKS48Cvdfl1KTkvHnQk0tJah4cvAkneNMzq2YPqTcKXo3wdNS5ERw9Ig8 kVdyo+uYymgvlXf7RUh77ioZ0vJChKgvBACV4zpnyyppNrQIkQJjuvlnXziGMHLprQWw lBGGsjmx8GT5IyJOXZprzElW+zAh0vZgcovn2JT3yM+leRsDanRuvboEiqgeg5oHgvYq gv82mviKtJAKD38EXsBerigigybwthQFXtGO1qzXmFoJgOFUaow19VDlDNc8+2jIkyzj xg6eawWdRNbzyQObn2EWrdHrPWaCTTF8MqOifCgy0FU/dUzyaPSVrED2D5ytbakoAJc7 tylQ== X-Forwarded-Encrypted: i=1; AJvYcCWD6+Z6cs+WS7z+dpeik2CWfwOFnKIH66URtgzoQtpOkF9D7ewppDgN/CLXYwbzfCRvoipHeWt3//aqvuM=@vger.kernel.org X-Gm-Message-State: AOJu0YweJMhjHawuPYbN4E19m9nqtW/ZEg5dMltLTDAB5whj0zvbrLRg nfK+uYrheI5kBdTIIk+635Tr6pO7tW/2QdOUMyc7cnDBUMcK+FkMQca0 X-Gm-Gg: AY/fxX7GQF5jl1u26UVjyEUIMeM33CuUXi86Ucoyy3WWtOXRGCt5i527/JOwPTAmxFP 4gyet54JgsSFGaExNlWdxk2radVyvUAZQYWOCpKgV2raU87cwZBY3TSdV7Im++IiqCvlCJ65hTI 6iqQeKgMLsv0I+6gdgb6oB4BcIe/6qrFH1hRog2Bul1cYKDT8jEfeatjRfZpgtbQn6QI2RTo/EQ mE3kNb9+L8F/dc2RfhIifpHUvc4B6yaGq/ZH83+POIhwXjeuXKFA+KMlBA6pqVdElgK7FENEmnM PtHvNKc34p0A3zdpTru80sLwHzf8GsBYoELOw6OfUS9whNXlPhLD5149O+hNQE6xu0HUDnwIbQ3 22oQFPXKw74UjZwMmmCDrt1wS4XHHsB//001ModAb5WIDhPhHKsflGYD62EIz8Yws4f6e30Puko 5LLqo7/aLReSsnAdluhGas0ie12XK7dw== X-Google-Smtp-Source: AGHT+IFcyO2/N6WJqTTUC8Xpz+F+HK73QiRxiWGBBRL+WIr6e3loB6zfy831gEjAtlMYHTHv9HUDPQ== X-Received: by 2002:a17:903:2290:b0:2a1:3cd9:a739 with SMTP id d9443c01a7336-2a2f2830ba1mr17129295ad.43.1766122636315; Thu, 18 Dec 2025 21:37:16 -0800 (PST) Received: from Barrys-MBP.hub ([47.72.129.29]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3d4d895sm9930215ad.54.2025.12.18.21.37.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Dec 2025 21:37:15 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: catalin.marinas@arm.com, m.szyprowski@samsung.com, robin.murphy@arm.com, will@kernel.org Cc: ada.coupriediaz@arm.com, anshuman.khandual@arm.com, ardb@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, maz@kernel.org, ryan.roberts@arm.com, surenb@google.com, v-songbaohua@oppo.com, zhengtangquan@oppo.com Subject: [PATCH 1/6] arm64: Provide dcache_by_myline_op_nosync helper Date: Fri, 19 Dec 2025 13:36:53 +0800 Message-Id: <20251219053658.84978-2-21cnbao@gmail.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20251219053658.84978-1-21cnbao@gmail.com> References: <20251219053658.84978-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: 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 | 79 ++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/as= sembler.h index f0ca7196f6fa..7d84a9ca7880 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -366,22 +366,7 @@ alternative_else alternative_endif .endm =20 -/* - * Macro to perform a data cache maintenance for the interval - * [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 - sub \tmp, \linesz, #1 - bic \start, \start, \tmp -.Ldcache_op\@: + .macro __dcache_op_line op, start .ifc \op, cvau __dcache_op_workaround_clean_cache \op, \start .else @@ -399,14 +384,54 @@ alternative_endif .endif .endif .endif - add \start, \start, \linesz - cmp \start, \end - b.lo .Ldcache_op\@ - dsb \domain + .endm + +/* + * Macro to perform a data cache maintenance for the interval + * [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 + sub \tmp, \linesz, #1 + bic \start, \start, \tmp +.Ldcache_op\@: + __dcache_op_line \op, \start + add \start, \start, \linesz + cmp \start, \end + b.lo .Ldcache_op\@ =20 + dsb \domain _cond_uaccess_extable .Ldcache_op\@, \fixup .endm =20 +/* + * Macro to perform a data cache maintenance for the interval + * [start, end) with dcache line size explicitly provided. + * It won't wait for the completion of the dc operation. + * + * op: operation passed to dc instruction + * start: starting virtual address of the region + * end: end virtual address of the region + * linesz: dcache line size + * Corrupts: start, end, tmp + */ + .macro dcache_by_myline_op_nosync op, start, end, linesz, tmp + sub \tmp, \linesz, #1 + bic \start, \start, \tmp +.Ldcache_op\@: + __dcache_op_line \op, \start + add \start, \start, \linesz + cmp \start, \end + b.lo .Ldcache_op\@ + .endm + /* * Macro to perform a data cache maintenance for the interval * [start, end) @@ -423,6 +448,20 @@ alternative_endif dcache_by_myline_op \op, \domain, \start, \end, \tmp1, \tmp2, \fixup .endm =20 +/* + * Macro to perform a data cache maintenance for the interval + * [start, end). It won=E2=80=99t wait for the dc operation to complete. + * + * op: operation passed to dc instruction + * start: starting virtual address of the region + * end: end virtual address of the region + * Corrupts: start, end, tmp1, tmp2 + */ + .macro dcache_by_line_op_nosync op, start, end, tmp1, tmp2 + dcache_line_size \tmp1, \tmp2 + dcache_by_myline_op_nosync \op, \start, \end, \tmp1, \tmp2 + .endm + /* * Macro to perform an instruction cache maintenance for the interval * [start, end) --=20 2.39.3 (Apple Git-146)