From b57297c14d94dac9bdef7570b7b33d70b10171f3 Mon Sep 17 00:00:00 2001
From: Jozef Wludzik <jozef.wludzik@intel.com>
Date: Tue, 26 Mar 2024 14:43:29 +0100
Subject: [PATCH 1/2] Fix the compilation warning when using gcc-13 (#25)

Added missing headers. Fixed compilation error about casting from
unsigned to signed int.

Upstream-Status: Backport [https://github.com/intel/linux-npu-driver/commit/4bcbf2abe94eb4d9c083bd616b58e309a82d008a]

Signed-off-by: Jozef Wludzik <jozef.wludzik@intel.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
 umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp | 7 ++++---
 umd/vpu_driver/include/umd_common.hpp                  | 1 +
 validation/umd-test/umd_prime_buffers.h                | 9 +++++++--
 validation/umd-test/utilities/data_handle.h            | 1 +
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp b/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp
index f206ebe..682e5b4 100644
--- a/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp
+++ b/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp
@@ -5,12 +5,13 @@
  *
  */
 
-#include <dlfcn.h>
-#include <memory>
-
 #include "vpux_driver_compiler.h"
 #include "vpu_driver/source/utilities/log.hpp"
 
+#include <array>
+#include <dlfcn.h>
+#include <memory>
+
 class Vcl {
   public:
     static Vcl &sym() {
diff --git a/umd/vpu_driver/include/umd_common.hpp b/umd/vpu_driver/include/umd_common.hpp
index 0c874a3..5ad9be2 100644
--- a/umd/vpu_driver/include/umd_common.hpp
+++ b/umd/vpu_driver/include/umd_common.hpp
@@ -7,6 +7,7 @@
 
 #pragma once
 
+#include <cstdint>
 #include <limits>
 #include <linux/kernel.h>
 #include <stdexcept>
diff --git a/validation/umd-test/umd_prime_buffers.h b/validation/umd-test/umd_prime_buffers.h
index 6f7c7de..ab4814c 100644
--- a/validation/umd-test/umd_prime_buffers.h
+++ b/validation/umd-test/umd_prime_buffers.h
@@ -6,12 +6,17 @@
  */
 
 #pragma once
+
+#include "umd_test.h"
+
 #include <fcntl.h>
-#include <linux/kernel.h>
 #include <linux/dma-buf.h>
 #include <linux/dma-heap.h>
+#include <linux/kernel.h>
+#include <stdint.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#include <unistd.h>
 
 #define ALLIGN_TO_PAGE(x) __ALIGN_KERNEL((x), (UmdTest::PAGE_SIZE))
 
@@ -60,7 +65,7 @@ class PrimeBufferHelper {
             return false;
 
         bufferFd = heapAlloc.fd;
-        buffers.insert({heapAlloc.fd, {size, nullptr}});
+        buffers.insert({static_cast<int>(heapAlloc.fd), {size, nullptr}});
         return true;
     }
 
diff --git a/validation/umd-test/utilities/data_handle.h b/validation/umd-test/utilities/data_handle.h
index d6e0ec0..5d937b2 100644
--- a/validation/umd-test/utilities/data_handle.h
+++ b/validation/umd-test/utilities/data_handle.h
@@ -6,6 +6,7 @@
  */
 
 #include <linux/kernel.h>
+#include <stdint.h>
 #include <string>
 #include <vector>
 
-- 
2.43.0

