trivial: Adjust synaptics-mst amdgpu safety check

The previous safety check was introduced due to a bug in the kernel
where it would produce a traceback and hang the offending process.

This code was fixed in kernel 5.2.0:
8ae5b1d78d

Add a new configuration option that will allow disabling the safety
checks if a new enough kernel is in place.  This configuration option
is necessary because some Linux distributions may backport drm, and thus
this commit but still need the feature to work.
This commit is contained in:
Mario Limonciello 2021-06-16 13:46:58 -05:00 committed by Mario Limonciello
parent 3a48af58c2
commit 9e6a8bd318
4 changed files with 21 additions and 9 deletions

View File

@ -319,6 +319,7 @@ done
%config(noreplace)%{_sysconfdir}/fwupd/uefi_capsule.conf
%endif
%config(noreplace)%{_sysconfdir}/fwupd/redfish.conf
%config(noreplace)%{_sysconfdir}/fwupd/synaptics_mst.conf
%config(noreplace)%{_sysconfdir}/fwupd/thunderbolt.conf
%dir %{_libexecdir}/fwupd
%{_libexecdir}/fwupd/fwupd

View File

@ -23,12 +23,19 @@ struct FuPluginData {
/* see https://github.com/fwupd/fwupd/issues/1121 for more details */
static gboolean
fu_synaptics_mst_check_amdgpu_safe (GError **error)
fu_synaptics_mst_check_amdgpu_safe (FuPlugin *plugin, GError **error)
{
gsize bufsz = 0;
g_autofree gchar *minimum_kernel = NULL;
g_autofree gchar *buf = NULL;
g_auto(GStrv) lines = NULL;
minimum_kernel = fu_plugin_get_config_value (plugin, "MinimumAmdGpuKernelVersion");
if (minimum_kernel == NULL) {
g_debug ("Ignoring kernel safety checks");
return TRUE;
}
/* no module support in the kernel, we can't test for amdgpu module */
if (!g_file_test ("/proc/modules", G_FILE_TEST_EXISTS))
return TRUE;
@ -38,13 +45,8 @@ fu_synaptics_mst_check_amdgpu_safe (GError **error)
lines = g_strsplit (buf, "\n", -1);
for (guint i = 0; lines[i] != NULL; i++) {
if (g_str_has_prefix (lines[i], "amdgpu ")) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"amdgpu has known issues with synaptics_mst");
return FALSE;
}
if (g_str_has_prefix (lines[i], "amdgpu "))
return fu_common_check_kernel_version (minimum_kernel, error);
}
return TRUE;
@ -146,7 +148,7 @@ fu_plugin_backend_device_added (FuPlugin *plugin, FuDevice *device, GError **err
gboolean
fu_plugin_startup (FuPlugin *plugin, GError **error)
{
return fu_synaptics_mst_check_amdgpu_safe (error);
return fu_synaptics_mst_check_amdgpu_safe (plugin, error);
}
gboolean

View File

@ -36,6 +36,10 @@ shared_module('fu_plugin_synaptics_mst',
],
)
install_data(['synaptics_mst.conf'],
install_dir: join_paths(sysconfdir, 'fwupd')
)
if get_option('tests')
testdatadirs = environment()
testdatadirs.set('G_TEST_SRCDIR', meson.current_source_dir())

View File

@ -0,0 +1,5 @@
[synaptics_mst]
# Minimum kernel version to allow use of this plugin on amdgpu
# It's important that all backports from this kernel have been
# made if using an older kernel
MinimumAmdGpuKernelVersion=5.2.0