Accepting request 1118125 from home:chrBrd:branches:hardware

- Remove `fix-kernel-gte-6.4.patch` as it has been merged upstream.
- Fix ueficert package builds.

OBS-URL: https://build.opensuse.org/request/show/1118125
OBS-URL: https://build.opensuse.org/package/show/hardware/gasket-driver?expand=0&rev=15
This commit is contained in:
Chris Bradbury 2023-10-17 00:33:05 +00:00 committed by Git OBS Bridge
parent 2e105514f9
commit c2905939b6
8 changed files with 41 additions and 94 deletions

View File

@ -11,7 +11,7 @@ https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService
<param name="url">https://github.com/google/gasket-driver</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="revision">97aeba5</param>
<param name="revision">main</param>
<param name="version">1.0.18</param>
</service>
<!-- Compress source files into a tarball. -->

View File

@ -1,23 +0,0 @@
From a87c105c14e826dafd4b25c36fa7c7c657a7ad03 Mon Sep 17 00:00:00 2001
From: hibby50 <hibby50@gmail.com>
Date: Thu, 20 Apr 2023 14:16:06 -0400
Subject: [PATCH] import DMA_BUF regardless of kernel version
---
src/gasket_page_table.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/gasket_page_table.c b/src/gasket_page_table.c
index e81ab2b..0e768e0 100644
--- a/src/gasket_page_table.c
+++ b/src/gasket_page_table.c
@@ -53,9 +53,7 @@
#include <linux/version.h>
#include <linux/vmalloc.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
MODULE_IMPORT_NS(DMA_BUF);
-#endif
#include "gasket_constants.h"
#include "gasket_core.h"

View File

@ -1,43 +0,0 @@
From 83cbe8264fc63511e4e6250f2426749951a340c8 Mon Sep 17 00:00:00 2001
From: Chris Bradbury <chris@binaryspanner.com>
Date: Fri, 14 Jul 2023 18:55:56 +0100
Subject: [PATCH] Amend use of `class_create()` for kernels >= 6.4
The function signature for `class_create()` was changed in kernels >= 6.4.x to only accept a single argument (see kernel commit #dcfbb67).
This change will conditionally modify how `class_create()` is called depending on the kernel version.
---
src/gasket_core.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/gasket_core.c b/src/gasket_core.c
index 139616b..b1c2726 100644
--- a/src/gasket_core.c
+++ b/src/gasket_core.c
@@ -27,6 +27,7 @@
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/sched.h>
+#include <linux/version.h>
#ifdef GASKET_KERNEL_TRACE_SUPPORT
#define CREATE_TRACE_POINTS
@@ -1837,8 +1838,15 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc)
internal = &g_descs[desc_idx];
mutex_init(&internal->mutex);
memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX);
- internal->class =
- class_create(driver_desc->module, driver_desc->name);
+
+ /* Function signature for `class_create()` is changed in kernel >= 6.4.x
+ * to only accept a single argument.
+ * */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
+ internal->class = class_create(driver_desc->module, driver_desc->name);
+#else
+ internal->class = class_create(driver_desc->name);
+#endif
if (IS_ERR(internal->class)) {
pr_err("Cannot register %s class [ret=%ld]\n",

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e189a8829b8a50d13f472037e2e2b387cb7335d00a86b9f22f67669e98fad675
size 257035
oid sha256:0dfde4e03666e728432b508a524e92495d3bf2bc131241042d89b370479b73b7
size 257547

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 17 00:00:26 UTC 2023 - Chris Bradbury <chris@binaryspanner.com>
- Remove `fix-kernel-gte-6.4.patch` as it has been merged upstream.
- Fix ueficert package builds.
-------------------------------------------------------------------
Wed Jul 19 23:18:19 UTC 2023 - Chris Bradbury <opensuse@chrbrd.com>

View File

@ -1,4 +1,4 @@
name: gasket-driver
version: 1.0.18
mtime: 1645731663
commit: 97aeba584efd18983850c36dcf7384b0185284b3
mtime: 1693941990
commit: 09385d485812088e04a98a6e1227bf92663e0b59

View File

@ -51,24 +51,16 @@ Requires: %{name}-kmp
%sysusers_requires
# The dma-buf symbols used by this driver were moved into their own `DMA_BUF`
# module namespace in kernel 5.16. Consequently, the upstream source conditionally
# imports the `DMA_BUF` module namespace if the kernel version is >= 5.16.
# This patch removes that condition, allowing this module to be built for kernels
# that have backported the `DMA_BUF` namespace changes.
# See:
# https://github.com/google/gasket-driver/pull/10
# https://github.com/google/gasket-driver/commit/a87c105c14e826dafd4b25c36fa7c7c657a7ad03.patch
# PATCH-FIX-OPENSUSE fix-for-backported-dma-buf-ns.patch gh#google/gasket-driver!10
Patch0: fix-for-backported-dma-buf-ns.patch
# module namespace in kernel 5.16. Upstream's current attempt at fixing this
# doesn't work with GCC versions that don't support the `__has_include` directive,
# which is the case for Leap 15.5.
# The function signature for `class_create()` was changed in kernels >= 6.4.x to only accept a
# single argument (see kernel commit #dcfbb67).
# This patch conditionally modifies how `class_create()` is called depending on the kernel version.
# See:
# https://github.com/google/gasket-driver/pull/13
# https://github.com/google/gasket-driver/commit/83cbe8264fc63511e4e6250f2426749951a340c8.patch
# PATCH-FIX-OPENSUSE fix-kernel-gte-6.4.patch gh#google/gasket-driver!13
Patch1: fix-kernel-gte-6.4.patch
# https://github.com/google/gasket-driver/pull/16
# https://github.com/google/gasket-driver/issues/17
#
# PATCH-FIX-OPENSUSE leap-15-5-fix-for-backported-dma-buf-ns.patch gh#google/gasket-driver!10
Patch0: leap-15-5-fix-for-backported-dma-buf-ns.patch
# This directive instructs the build service to temporarily save the project's
# certificate as %%_sourcedir/_projectcert.crt. See:
@ -78,10 +70,9 @@ Patch1: fix-kernel-gte-6.4.patch
#
# needssslcertforbuild
#
# Having included the above directive, using the `-c` flag below will cause
# the "ueficert" package to get built. `%%_sourcedir` must be prefixed as the
# working dir is changed before the build service attempts to source the certificate.
%kernel_module_package -p preamble -c %_sourcedir/_projectcert.crt
# Having included the above directive, the below will cause the "ueficert" package
#to get built.
%kernel_module_package -p %_sourcedir/preamble
%description
The Coral Gasket Driver allows usage of the Coral EdgeTPU on Linux systems.
@ -94,6 +85,11 @@ The driver contains two modules:
# This magic "KMP" subpackage is documented in
# https://en.opensuse.org/Kernel_Module_Packages#Specfile_mechanisms
@ -114,9 +110,6 @@ mkdir -p obj
%patch0 -p1
%endif
# Apply patches without conditions.
%patch1 -p1
%build
# Build the kernel modules.
for flavor in %flavors_to_build; do

View File

@ -0,0 +1,14 @@
diff --git a/src/gasket_page_table.c b/src/gasket_page_table.c
index c9067cb..0e768e0 100644
--- a/src/gasket_page_table.c
+++ b/src/gasket_page_table.c
@@ -53,9 +53,7 @@
#include <linux/version.h>
#include <linux/vmalloc.h>
-#if __has_include(<linux/dma-buf.h>)
MODULE_IMPORT_NS(DMA_BUF);
-#endif
#include "gasket_constants.h"
#include "gasket_core.h"