Skip to content

Commit 3023c05

Browse files
t-8chgroeck
authored andcommitted
hwmon: (powerz) Avoid cacheline sharing for DMA buffer
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: 4381a36 ("hwmon: add POWER-Z driver") Cc: stable@vger.kernel.org # ca085fa: dma-mapping: add __dma_from_device_group_begin()/end() Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20260408-powerz-cacheline-alias-v1-1-1254891be0dd@weissschuh.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent a7c0aaa commit 3023c05

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/hwmon/powerz.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <linux/completion.h>
88
#include <linux/device.h>
9+
#include <linux/dma-mapping.h>
910
#include <linux/hwmon.h>
1011
#include <linux/module.h>
1112
#include <linux/mutex.h>
@@ -33,7 +34,9 @@ struct powerz_sensor_data {
3334
} __packed;
3435

3536
struct powerz_priv {
36-
char transfer_buffer[64]; /* first member to satisfy DMA alignment */
37+
__dma_from_device_group_begin();
38+
char transfer_buffer[64];
39+
__dma_from_device_group_end();
3740
struct mutex mutex;
3841
struct completion completion;
3942
struct urb *urb;

0 commit comments

Comments
 (0)