intel/common: Move intel_clflush.h to intel_mem.h/intel_mem.c
authorJordan Justen <jordan.l.justen@intel.com>
Mon, 10 Apr 2023 06:37:50 +0000 (23:37 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 6 Sep 2023 01:39:53 +0000 (01:39 +0000)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22379>

src/gallium/drivers/crocus/crocus_bufmgr.c
src/gallium/drivers/iris/iris_bufmgr.c
src/intel/common/intel_mem.c [moved from src/intel/common/intel_clflush.h with 93% similarity]
src/intel/common/intel_mem.h [new file with mode: 0644]
src/intel/common/meson.build
src/intel/tools/intel_sanitize_gpu.c
src/intel/vulkan/anv_private.h
src/intel/vulkan_hasvk/anv_private.h

index 357ea98..6233370 100644 (file)
@@ -51,7 +51,7 @@
 #include <time.h>
 
 #include "errno.h"
-#include "common/intel_clflush.h"
+#include "common/intel_mem.h"
 #include "dev/intel_debug.h"
 #include "common/intel_gem.h"
 #include "dev/intel_device_info.h"
index fd4f01e..a00203c 100644 (file)
@@ -49,7 +49,7 @@
 
 #include "errno.h"
 #include "common/intel_aux_map.h"
-#include "common/intel_clflush.h"
+#include "common/intel_mem.h"
 #include "dev/intel_debug.h"
 #include "common/intel_gem.h"
 #include "dev/intel_device_info.h"
similarity index 93%
rename from src/intel/common/intel_clflush.h
rename to src/intel/common/intel_mem.c
index a4f33cb..8d8452d 100644 (file)
  * IN THE SOFTWARE.
  */
 
-#ifndef INTEL_CLFLUSH_H
-#define INTEL_CLFLUSH_H
+#include "intel_mem.h"
 
-#define CACHELINE_SIZE 64
-#define CACHELINE_MASK 63
+#include <stdint.h>
 
 #ifdef SUPPORT_INTEL_INTEGRATED_GPUS
-static inline void
+void
 intel_clflush_range(void *start, size_t size)
 {
    void *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK);
@@ -40,14 +38,14 @@ intel_clflush_range(void *start, size_t size)
    }
 }
 
-static inline void
+void
 intel_flush_range(void *start, size_t size)
 {
    __builtin_ia32_mfence();
    intel_clflush_range(start, size);
 }
 
-static inline void
+void
 intel_invalidate_range(void *start, size_t size)
 {
    if (size == 0)
@@ -69,5 +67,3 @@ intel_invalidate_range(void *start, size_t size)
    __builtin_ia32_mfence();
 }
 #endif /* SUPPORT_INTEL_INTEGRATED_GPUS */
-
-#endif
diff --git a/src/intel/common/intel_mem.h b/src/intel/common/intel_mem.h
new file mode 100644 (file)
index 0000000..599995d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef INTEL_MEM_H
+#define INTEL_MEM_H
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CACHELINE_SIZE 64
+#define CACHELINE_MASK 63
+
+#ifdef SUPPORT_INTEL_INTEGRATED_GPUS
+void intel_clflush_range(void *start, size_t size);
+void intel_flush_range(void *start, size_t size);
+void intel_invalidate_range(void *start, size_t size);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* INTEL_MEM_H */
index ec6ae6c..bc71a27 100644 (file)
@@ -32,7 +32,6 @@ files_libintel_common = files(
   'intel_aux_map.c',
   'intel_aux_map.h',
   'intel_buffer_alloc.h',
-  'intel_clflush.h',
   'intel_decoder.h',
   'intel_disasm.c',
   'intel_disasm.h',
@@ -51,6 +50,8 @@ files_libintel_common = files(
   'intel_uuid.h',
   'intel_measure.c',
   'intel_measure.h',
+  'intel_mem.c',
+  'intel_mem.h',
   'intel_pixel_hash.h'
 )
 
index 827f5ba..a333250 100644 (file)
@@ -43,7 +43,7 @@
 
 #define MESA_LOG_TAG "INTEL-SANITIZE-GPU"
 #include "util/log.h"
-#include "common/intel_clflush.h"
+#include "common/intel_mem.h"
 
 static int (*libc_open)(const char *pathname, int flags, mode_t mode);
 static int (*libc_close)(int fd);
index c990d94..3d8bb37 100644 (file)
 #define VG(x) ((void)0)
 #endif
 
-#include "common/intel_clflush.h"
 #include "common/intel_decoder.h"
 #include "common/intel_engine.h"
 #include "common/intel_gem.h"
 #include "common/intel_l3_config.h"
 #include "common/intel_measure.h"
+#include "common/intel_mem.h"
 #include "common/intel_sample_positions.h"
 #include "dev/intel_device_info.h"
 #include "blorp/blorp.h"
index a632bd5..663f3cc 100644 (file)
 #define VG(x) ((void)0)
 #endif
 
-#include "common/intel_clflush.h"
 #include "common/intel_decoder.h"
 #include "common/intel_engine.h"
 #include "common/intel_gem.h"
 #include "common/intel_l3_config.h"
 #include "common/intel_measure.h"
+#include "common/intel_mem.h"
 #include "common/intel_sample_positions.h"
 #include "dev/intel_device_info.h"
 #include "blorp/blorp.h"