From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Helge Deller <deller@gmx.de>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 08/49] parisc: Improve cache flushing for PCXL in arch_sync_dma_for_cpu()
Date: Mon, 19 Jun 2023 12:29:46 +0200 [thread overview]
Message-ID: <20230619102130.294527793@linuxfoundation.org> (raw)
In-Reply-To: <20230619102129.856988902@linuxfoundation.org>
From: Helge Deller <deller@gmx.de>
[ Upstream commit 59fa12646d9f56c842b4d5b6418ed77af625c588 ]
Add comment in arch_sync_dma_for_device() and handle the direction flag in
arch_sync_dma_for_cpu().
When receiving data from the device (DMA_FROM_DEVICE) unconditionally
purge the data cache in arch_sync_dma_for_cpu().
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/parisc/kernel/pci-dma.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 04c48f1ef3fbd..20084336704fc 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -464,13 +464,29 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
size_t size, enum dma_data_direction dir)
{
+ /*
+ * fdc: The data cache line is written back to memory, if and only if
+ * it is dirty, and then invalidated from the data cache.
+ */
flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
}
void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
size_t size, enum dma_data_direction dir)
{
- flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
+ unsigned long addr = (unsigned long) phys_to_virt(paddr);
+
+ switch (dir) {
+ case DMA_TO_DEVICE:
+ case DMA_BIDIRECTIONAL:
+ flush_kernel_dcache_range(addr, size);
+ return;
+ case DMA_FROM_DEVICE:
+ purge_kernel_dcache_range_asm(addr, addr + size);
+ return;
+ default:
+ BUG();
+ }
}
void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
--
2.39.2
next prev parent reply other threads:[~2023-06-19 10:41 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 10:29 [PATCH 4.19 00/49] 4.19.287-rc1 review Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 01/49] power: supply: ab8500: Fix external_power_changed race Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 02/49] power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() + schedule() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 03/49] ARM: dts: vexpress: add missing cache properties Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 04/49] power: supply: Ratelimit no data debug output Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 05/49] regulator: Fix error checking for debugfs_create_dir Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 06/49] irqchip/meson-gpio: Mark OF related data as maybe unused Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 07/49] power: supply: Fix logic checking if system is running from battery Greg Kroah-Hartman
2023-06-19 10:29 ` Greg Kroah-Hartman [this message]
2023-06-19 10:29 ` [PATCH 4.19 09/49] MIPS: Alchemy: fix dbdma2 Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 10/49] mips: Move initrd_start check after initrd address sanitisation Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 11/49] xen/blkfront: Only check REQ_FUA for writes Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 12/49] ocfs2: fix use-after-free when unmounting read-only filesystem Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 13/49] ocfs2: check new file size on fallocate call Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 14/49] nios2: dts: Fix tse_mac "max-frame-size" property Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 15/49] nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 16/49] nilfs2: fix possible out-of-bounds segment allocation in resize ioctl Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 17/49] kexec: support purgatories with .text.hot sections Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 18/49] powerpc/purgatory: remove PGO flags Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 19/49] nouveau: fix client work fence deletion race Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 20/49] RDMA/uverbs: Restrict usage of privileged QKEYs Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.19 21/49] net: usb: qmi_wwan: add support for Compal RXM-G1 Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 22/49] Remove DECnet support from kernel Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 23/49] USB: serial: option: add Quectel EM061KGL series Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 24/49] usb: dwc3: gadget: Reset num TRBs before giving back the request Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 25/49] usb: gadget: f_ncm: Add OS descriptor support Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 26/49] usb: gadget: f_ncm: Fix NTP-32 support Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 27/49] netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 28/49] ping6: Fix send to link-local addresses with VRF Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 29/49] RDMA/rxe: Remove the unused variable obj Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 30/49] RDMA/rxe: Removed unused name from rxe_task struct Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 31/49] RDMA/rxe: Fix the use-before-initialization error of resp_pkts Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 32/49] IB/uverbs: Fix to consider event queue closing also upon non-blocking mode Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 33/49] IB/isert: Fix dead lock in ib_isert Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 34/49] IB/isert: Fix possible list corruption in CMA handler Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 35/49] IB/isert: Fix incorrect release of isert connection Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 36/49] sctp: fix an error code in sctp_sf_eat_auth() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 37/49] igb: fix nvm.ops.read() error handling Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 38/49] drm/nouveau/dp: check for NULL nv_connector->native_mode Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 39/49] drm/nouveau/kms: Dont change EDID when it hasnt actually changed Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 40/49] drm/nouveau: add nv_encoder pointer check for NULL Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 41/49] net: lapbether: only support ethernet devices Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 42/49] net: tipc: resize nlattr array to correct size Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 43/49] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 44/49] neighbour: Remove unused inline function neigh_key_eq16() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 45/49] net: Remove unused inline function dst_hold_and_use() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 46/49] neighbour: delete neigh_lookup_nodev as not used Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 47/49] drm/nouveau/kms: Fix NULL pointer dereference in nouveau_connector_detect_depth Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 48/49] powerpc: Fix defconfig choice logic when cross compiling Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 4.19 49/49] mmc: block: ensure error propagation for non-blk Greg Kroah-Hartman
2023-06-20 9:19 ` [PATCH 4.19 00/49] 4.19.287-rc1 review Chris Paterson
2023-06-20 10:21 ` Jon Hunter
2023-06-20 10:46 ` Sudip Mukherjee (Codethink)
2023-06-20 11:04 ` Naresh Kamboju
2023-06-20 21:05 ` Shuah Khan
2023-06-21 0:37 ` Guenter Roeck
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=20230619102130.294527793@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=deller@gmx.de \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).