DMA cache coherence management

前端 未结 2 1036
栀梦
栀梦 2020-12-29 05:29

My question is this: how can I determine when it is safe to disable cache snooping when I am correctly using [pci_]dma_sync_single_for_{cpu,device} in my device

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 05:38

    Maybe a bit overdue, but:

    If you disable cache snooping, hardware will no longer take care of cache coherency. Hence, the kernel needs to do this itself. Over the past few days, I've spent some tiem reviewing the X86 variants of [pci_]dma_sync_single_for_{cpu,device}. I've found no indication that they perform any efforts to maintain coherency. This seems consistent with the fact that cache snooping is by default turned on in the PCI(e) spec.

    Hence, if you are turning off cache snooping, you will have to maintain coherency yourself, in your driver. Possibly by calling clflush_cache_range() (X86) or similar?

    Refs:

    • http://lkml.indiana.edu/hypermail/linux/kernel/0709.0/1329.html

提交回复
热议问题