1c9c97b8cSDave Airlie /************************************************************************** 2c9c97b8cSDave Airlie * 3c9c97b8cSDave Airlie * Copyright 2009 Red Hat Inc. 4c9c97b8cSDave Airlie * All Rights Reserved. 5c9c97b8cSDave Airlie * 6c9c97b8cSDave Airlie * Permission is hereby granted, free of charge, to any person obtaining a 7c9c97b8cSDave Airlie * copy of this software and associated documentation files (the 8c9c97b8cSDave Airlie * "Software"), to deal in the Software without restriction, including 9c9c97b8cSDave Airlie * without limitation the rights to use, copy, modify, merge, publish, 10c9c97b8cSDave Airlie * distribute, sub license, and/or sell copies of the Software, and to 11c9c97b8cSDave Airlie * permit persons to whom the Software is furnished to do so, subject to 12c9c97b8cSDave Airlie * the following conditions: 13c9c97b8cSDave Airlie * 14c9c97b8cSDave Airlie * The above copyright notice and this permission notice (including the 15c9c97b8cSDave Airlie * next paragraph) shall be included in all copies or substantial portions 16c9c97b8cSDave Airlie * of the Software. 17c9c97b8cSDave Airlie * 18c9c97b8cSDave Airlie * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19c9c97b8cSDave Airlie * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20c9c97b8cSDave Airlie * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21c9c97b8cSDave Airlie * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 22c9c97b8cSDave Airlie * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23c9c97b8cSDave Airlie * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24c9c97b8cSDave Airlie * USE OR OTHER DEALINGS IN THE SOFTWARE. 25c9c97b8cSDave Airlie * 26c9c97b8cSDave Airlie * 27c9c97b8cSDave Airlie **************************************************************************/ 28c9c97b8cSDave Airlie /* 29c9c97b8cSDave Airlie * Authors: 30c9c97b8cSDave Airlie * Dave Airlie <airlied@redhat.com> 31c9c97b8cSDave Airlie */ 32c9c97b8cSDave Airlie 33c9c97b8cSDave Airlie #ifndef _DRM_CACHE_H_ 34c9c97b8cSDave Airlie #define _DRM_CACHE_H_ 35c9c97b8cSDave Airlie 36f9a87bd7SGabriel Krisman Bertazi #include <linux/scatterlist.h> 37f9a87bd7SGabriel Krisman Bertazi 38c9c97b8cSDave Airlie void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 39f9a87bd7SGabriel Krisman Bertazi void drm_clflush_sg(struct sg_table *st); 40f9a87bd7SGabriel Krisman Bertazi void drm_clflush_virt_range(void *addr, unsigned long length); 41c9c97b8cSDave Airlie 424b0e4e4aSDave Airlie static inline bool drm_arch_can_wc_memory(void) 434b0e4e4aSDave Airlie { 444b0e4e4aSDave Airlie #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) 454b0e4e4aSDave Airlie return false; 46221004c6SHuacai Chen #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) 47221004c6SHuacai Chen return false; 484b0e4e4aSDave Airlie #else 494b0e4e4aSDave Airlie return true; 504b0e4e4aSDave Airlie #endif 514b0e4e4aSDave Airlie } 524b0e4e4aSDave Airlie 53c9c97b8cSDave Airlie #endif 54