xref: /kernel/linux/linux-5.10/arch/x86/include/asm/xen/page-coherent.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/arch/x86/include/asm/xen/
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_XEN_PAGE_COHERENT_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_XEN_PAGE_COHERENT_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/page.h>
68c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cistatic inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
98c2ecf20Sopenharmony_ci		dma_addr_t *dma_handle, gfp_t flags,
108c2ecf20Sopenharmony_ci		unsigned long attrs)
118c2ecf20Sopenharmony_ci{
128c2ecf20Sopenharmony_ci	void *vstart = (void*)__get_free_pages(flags, get_order(size));
138c2ecf20Sopenharmony_ci	*dma_handle = virt_to_phys(vstart);
148c2ecf20Sopenharmony_ci	return vstart;
158c2ecf20Sopenharmony_ci}
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
188c2ecf20Sopenharmony_ci		void *cpu_addr, dma_addr_t dma_handle,
198c2ecf20Sopenharmony_ci		unsigned long attrs)
208c2ecf20Sopenharmony_ci{
218c2ecf20Sopenharmony_ci	free_pages((unsigned long) cpu_addr, get_order(size));
228c2ecf20Sopenharmony_ci}
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#endif /* _ASM_X86_XEN_PAGE_COHERENT_H */
25

Indexes created Thu Nov 07 10:32:03 CST 2024