From nobody Fri Jun 03 14:22:24 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8387E1B5F38F; Fri, 3 Jun 2022 14:22:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LF4pS2rGmz3K8M; Fri, 3 Jun 2022 14:22:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654266144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AeBoCzM8+8XIHUa2rYWcFWUQ+GjHyi6OzEroqCeWPmI=; b=WnJdWRHPC9XiX48uafL5QsPWRUaWmuoJeu7zmdHrt4FZXJK8iG5ciPM9G8OkKHJ9pqFbYN /ZuO4WDz4tqJ3jJkiNRk9B+I7M7FYJI/Tbw8XWgd2qwWhM6CwBUy3haLgcMVFCMpdytQor R9/whYXiPdiUtuDZuiSXQVXB6zKEW+ApI6nsNbmqBpdYcxg0Lvbv4LJbQk3d631JkXpqZ5 21UnCoJ7q7/rk0OZdcsu2HGyY8HZizyb43ubumVKoa0EIfOxe3dA++FPF6b/+71JZZAbsa PYA6OoGoaUGKtMA50hOw4y+Wp1f+obBPjpaSomDMQBa2CH/xlYoE6K70pfImQg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43130286C; Fri, 3 Jun 2022 14:22:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 253EMO7t030534; Fri, 3 Jun 2022 14:22:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 253EMOSP030533; Fri, 3 Jun 2022 14:22:24 GMT (envelope-from git) Date: Fri, 3 Jun 2022 14:22:24 GMT Message-Id: <202206031422.253EMOSP030533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 99902b1c5221 - main - linuxkpi/dmi: don't match exactly on DMI_MATCH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99902b1c52219bae4b9f3684e3ebd83152a1add4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654266144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AeBoCzM8+8XIHUa2rYWcFWUQ+GjHyi6OzEroqCeWPmI=; b=xgGXoYbW8yVPP+ofYA5Awtz+gpjs/DrbbwZWzwmobQ0UY693HVpvJocyrJshxrsx79Yf39 Ome2xAJu4hDhdL2e0uvMNu1yaiRSnNzd1Wd0Zcx0s+UFVdRlaRpxqnOu5jdN5+BTm3o2JC DG6Fx8aQAa+uthzggLaJyzIxq2OlB1okKN0o4wQJ4OHCm6OhUz5OyWSjKA2nlN0dJvO0Av 2Cbk9H13AIuKj4fI2NChUMRHDqqdSGfLf/ZWq7FVnzWe/nFYaDnQonp3n0IYIH5s3GjYhi /tSIADCnpZyBVC54R5Z2GB+O7tOj6GKNawVFqc8W0RMOBbsYTGsf2I1qkkr9Cw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654266144; a=rsa-sha256; cv=none; b=p7fDXTVMkZIe7cZN+j/N1nsBZSVKWzmZQWuETRSkcE8o47R8PwanDQQprpUoGCjNE3u+9L SYU7pYTePM1hjMuTQ5Xy1jjJx0J+lwnWrv+b8FkTFs9Ti8CA4/xZJSmifJOjRVpP/2flFu c5KrDRXybLryU+03Py8o7SUWMyWzkhGGGXSWWMITi1YfRskJLO7tPI45Svub3vYezSLcgP yG2hrUMdZ1DR4yTn+t9+aZkuq0a04DIjXjQQRBtTsT/KKq3eD9McvE7o5cQBfixrRpWqF1 624emk3ecYz6QovFX5YvMe1XFEbBqvmR5IiTItDqNOoad8gmL7yiMfZ5fESjBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=99902b1c52219bae4b9f3684e3ebd83152a1add4 commit 99902b1c52219bae4b9f3684e3ebd83152a1add4 Author: Corvin Köhne AuthorDate: 2022-06-03 14:20:45 +0000 Commit: Emmanuel Vadot CommitDate: 2022-06-03 14:20:45 +0000 linuxkpi/dmi: don't match exactly on DMI_MATCH Linux has two defines to check dmi data. DMI_MATCH checks if the dmi string includes substr. DMI_EXACT_MATCH checks if the dmi string exactly matches substr. Compat layer should have the same behaviour. The new definition of dmi_strmatch shouldn't break any driver. A driver would break if it uses the highest bit of the slot field. Nevertheless, linux uses the same definition and FreeBSD uses dmi_field values as slot which are lower than 128. Sponsored by: Beckhoff Automation GmbH & Co. KG MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35395 --- sys/compat/linuxkpi/common/include/linux/mod_devicetable.h | 5 +++-- sys/compat/linuxkpi/common/src/linux_dmi.c | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h b/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h index 5609c6f775e9..441faab6df81 100644 --- a/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h +++ b/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h @@ -55,7 +55,8 @@ enum dmi_field { }; struct dmi_strmatch { - unsigned char slot; + unsigned char slot : 7; + unsigned char exact_match : 1; char substr[79]; }; @@ -67,6 +68,6 @@ struct dmi_system_id { }; #define DMI_MATCH(a, b) { .slot = a, .substr = b } -#define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, } +#define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 } #endif /* __LINUXKPI_LINUX_MOD_DEVICETABLE_H__ */ diff --git a/sys/compat/linuxkpi/common/src/linux_dmi.c b/sys/compat/linuxkpi/common/src/linux_dmi.c index c0bb9a9f50d6..f5350751a496 100644 --- a/sys/compat/linuxkpi/common/src/linux_dmi.c +++ b/sys/compat/linuxkpi/common/src/linux_dmi.c @@ -82,9 +82,13 @@ linux_dmi_matches(const struct dmi_system_id *dsi) for (i = 0; i < nitems(dsi->matches); i++) { if (dsi->matches[i].slot == DMI_NONE) break; - if (dmi_match(dsi->matches[i].slot, - dsi->matches[i].substr) == false) - return (false); + if (dsi->matches[i].exact_match) { + return (dmi_match(dsi->matches[i].slot, + dsi->matches[i].substr)); + } else { + return (strstr(dmi_data[dsi->matches[i].slot], + dsi->matches[i].substr) != NULL); + } } return (true);