From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0D4521A434 for ; Tue, 5 May 2026 00:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777940129; cv=none; b=Dy+GBs/CKhE9MAq3Wyq+M8h+gFHn88KRJq3waX30x/GV9tgbh6lytoxmQ3ZmTLVZTxrzsuGANaeq9LxdaKUb0p7u+Mwc/0EKPNt9I6YLQkoqP/qq8cBKwT7om48Mx9bQwYszl9QEQqFILi2amUv62aMvim2OQZQkPNFYSUD/QFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777940129; c=relaxed/simple; bh=yWo8jXyvP7/yvKmbPCdk7i+AKwWFJ4tg6caNrW1SA88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l3VDaEsB/9GtvEwjaQIuw1HB/WOMqL2QDJkLY4sTo0djdKiI47arGvunLZHkab1Ctu1BSic95uT7wS1eyD7LoiqUmlZv+V2Ff8rSAMqMKJPtsMdEpgf9xAQHAKyu2/K1GxjmRy+9FEwRyTmV4LlRB/gS1aYjHhns8nYedv0QEAo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eJ4cNqps; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eJ4cNqps" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 497C9C2BCB9; Tue, 5 May 2026 00:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777940128; bh=yWo8jXyvP7/yvKmbPCdk7i+AKwWFJ4tg6caNrW1SA88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJ4cNqpsi7Fe5MkXcv+qBhwC+FNe+C38qMmO7NNxmnB82z/hkYlvHW8oOWAC6qa+x keGpAhjYbXI2Y4GrxkhfbkHTLGcEqyHLYgKQQNx3DLqYqeqaJNzPSXF7BzI+2YtWUx hRCMvrF+217Yc/y2DpTyC9x8fkWtpHY6BnfpQM45yJX4WSfCOyMrkOeUbPiuO7SwFf Nm4BG5V2N/yALHLQPUhFGHBl4r68ENRCXzRLM9xkVJXHOKlLV8vZAYTtwXr8OPIOCp we+VYmaIR1RPATZDn5huimR8BBnYSgx/m6nXKmHd6OyNpojYHPFd29gaaHSOhMwGMI 0AbkV0MH8Po2g== From: Sasha Levin To: stable@vger.kernel.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Guenter Roeck , Sasha Levin Subject: [PATCH 6.18.y 2/2] hwmon: (powerz) Avoid cacheline sharing for DMA buffer Date: Mon, 4 May 2026 20:15:22 -0400 Message-ID: <20260505001522.124823-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260505001522.124823-1-sashal@kernel.org> References: <2026050159-extinct-precision-0d22@gregkh> <20260505001522.124823-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Thomas Weißschuh [ Upstream commit 3023c050af3600bf451153335dea5e073c9a3088 ] Depending on the architecture the transfer buffer may share a cacheline with the following mutex. As the buffer may be used for DMA, that is problematic. Use the high-level DMA helpers to make sure that cacheline sharing can not happen. Also drop the comment, as the helpers are documentation enough. https://sashiko.dev/#/message/20260408175814.934BFC19421%40smtp.kernel.org Fixes: 4381a36abdf1c ("hwmon: add POWER-Z driver") Cc: stable@vger.kernel.org # ca085faabb42: dma-mapping: add __dma_from_device_group_begin()/end() Signed-off-by: Thomas Weißschuh Link: https://lore.kernel.org/r/20260408-powerz-cacheline-alias-v1-1-1254891be0dd@weissschuh.net Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/powerz.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/powerz.c b/drivers/hwmon/powerz.c index a75b941bd6e2f..dbe6b7ee16446 100644 --- a/drivers/hwmon/powerz.c +++ b/drivers/hwmon/powerz.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -33,7 +34,9 @@ struct powerz_sensor_data { } __packed; struct powerz_priv { - char transfer_buffer[64]; /* first member to satisfy DMA alignment */ + __dma_from_device_group_begin(); + char transfer_buffer[64]; + __dma_from_device_group_end(); struct mutex mutex; struct completion completion; struct urb *urb; -- 2.53.0