From 4ccc9dfd8e38348d527d3704b87a680ba43756cd Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Wed, 12 Jun 2024 23:03:17 +0200 Subject: kernel 6.9.4 --- ...-pci-drop-redundant-pci_enable_pcie_error.patch | 6 +- SOURCES/0001-amd-pstate.patch | 880 ++-- SOURCES/0001-ntsync.patch | 478 +- SOURCES/Patchlist.changelog | 154 +- SOURCES/amdgpu-ignore-min-pcap.patch | 13 + SOURCES/amdgpu-si-cik-default.patch | 16 +- SOURCES/cachy-bore.patch | 44 +- SOURCES/check-kabi | 39 +- SOURCES/cpupower.service | 13 - SOURCES/def_variants.yaml.fedora | 504 ++ SOURCES/def_variants.yaml.rhel | 521 +++ SOURCES/filter-aarch64.sh | 18 - SOURCES/filter-aarch64.sh.fedora | 20 - SOURCES/filter-aarch64.sh.rhel | 18 - SOURCES/filter-armv7hl.sh | 18 - SOURCES/filter-armv7hl.sh.fedora | 18 - SOURCES/filter-armv7hl.sh.rhel | 0 SOURCES/filter-i686.sh | 14 - SOURCES/filter-i686.sh.fedora | 14 - SOURCES/filter-i686.sh.rhel | 0 SOURCES/filter-modules.sh | 193 - SOURCES/filter-modules.sh.fedora | 204 - SOURCES/filter-modules.sh.rhel | 177 - SOURCES/filter-ppc64le.sh | 14 - SOURCES/filter-ppc64le.sh.fedora | 14 - SOURCES/filter-ppc64le.sh.rhel | 14 - SOURCES/filter-s390x.sh | 12 - SOURCES/filter-s390x.sh.fedora | 12 - SOURCES/filter-s390x.sh.rhel | 12 - SOURCES/filter-x86_64.sh | 12 - SOURCES/filter-x86_64.sh.fedora | 12 - SOURCES/filter-x86_64.sh.rhel | 12 - SOURCES/filtermods.py | 1099 +++++ SOURCES/generate_bls_conf.sh | 35 - SOURCES/generate_crashkernel_default.sh | 25 - SOURCES/kernel-aarch64-16k-debug-fedora.config | 118 +- SOURCES/kernel-aarch64-16k-fedora.config | 120 +- SOURCES/kernel-aarch64-64k-debug-rhel.config | 150 +- SOURCES/kernel-aarch64-64k-rhel.config | 150 +- SOURCES/kernel-aarch64-debug-fedora.config | 117 +- SOURCES/kernel-aarch64-debug-rhel.config | 150 +- SOURCES/kernel-aarch64-fedora.config | 119 +- SOURCES/kernel-aarch64-rhel.config | 150 +- SOURCES/kernel-aarch64-rt-debug-rhel.config | 150 +- SOURCES/kernel-aarch64-rt-rhel.config | 150 +- SOURCES/kernel-ppc64le-debug-fedora.config | 93 +- SOURCES/kernel-ppc64le-debug-rhel.config | 111 +- SOURCES/kernel-ppc64le-fedora.config | 95 +- SOURCES/kernel-ppc64le-rhel.config | 111 +- SOURCES/kernel-s390x-debug-fedora.config | 92 +- SOURCES/kernel-s390x-debug-rhel.config | 110 +- SOURCES/kernel-s390x-fedora.config | 94 +- SOURCES/kernel-s390x-rhel.config | 110 +- SOURCES/kernel-s390x-zfcpdump-rhel.config | 108 +- SOURCES/kernel-x86_64-debug-fedora.config | 90 +- SOURCES/kernel-x86_64-debug-rhel.config | 103 +- SOURCES/kernel-x86_64-fedora.config | 92 +- SOURCES/kernel-x86_64-rhel.config | 103 +- SOURCES/kernel-x86_64-rt-debug-rhel.config | 103 +- SOURCES/kernel-x86_64-rt-rhel.config | 103 +- SOURCES/kernel.changelog | 379 +- SOURCES/linux-surface.patch | 4938 +++++++++++++------- SOURCES/mod-blacklist.sh | 164 - SOURCES/mod-denylist.sh | 112 +- SOURCES/mod-extra.list | 195 - SOURCES/mod-extra.list.fedora | 200 - SOURCES/mod-extra.list.rhel | 326 -- SOURCES/mod-internal.list | 99 - SOURCES/mod-kvm.list | 5 - SOURCES/mod-partner.list | 2 - SOURCES/parallel_xz.sh | 26 - SOURCES/patch-6.9-redhat.patch | 1775 +++++++ SOURCES/redhatsecureboot301.cer | Bin 899 -> 0 bytes SOURCES/redhatsecurebootca1.cer | Bin 977 -> 0 bytes SOURCES/rhelima.x509 | Bin 0 -> 727 bytes SOURCES/rhelima_centos.x509 | Bin 0 -> 726 bytes SOURCES/rhelimaca1.x509 | Bin 0 -> 908 bytes SOURCES/rog-ally-gyro-fix.patch | 101 - SOURCES/rpminspect.yaml | 2 +- SOURCES/secureboot.cer | Bin 899 -> 0 bytes SOURCES/secureboot_ppc.cer | Bin 899 -> 0 bytes SOURCES/secureboot_s390.cer | Bin 899 -> 0 bytes SOURCES/securebootca.cer | Bin 977 -> 0 bytes SOURCES/steamdeck-oled-audio.patch | 4 +- SOURCES/steamdeck-oled-refresh-rate.patch | 174 - SOURCES/steamdeck-oled-wifi.patch | 434 +- SOURCES/t2linux.patch | 92 +- SOURCES/tkg-unprivileged-CLONE_NEWUSER.patch | 6 +- SOURCES/update_scripts.sh | 12 - .../valve-gamescope-framerate-control-fixups.patch | 177 + SOURCES/x509.genkey | 16 - SPECS/kernel.spec | 804 ++-- TOOLS/patch_configs.py | 4 +- 93 files changed, 11027 insertions(+), 6547 deletions(-) delete mode 100644 SOURCES/cpupower.service create mode 100644 SOURCES/def_variants.yaml.fedora create mode 100644 SOURCES/def_variants.yaml.rhel delete mode 100644 SOURCES/filter-aarch64.sh delete mode 100644 SOURCES/filter-aarch64.sh.fedora delete mode 100644 SOURCES/filter-aarch64.sh.rhel delete mode 100644 SOURCES/filter-armv7hl.sh delete mode 100644 SOURCES/filter-armv7hl.sh.fedora delete mode 100644 SOURCES/filter-armv7hl.sh.rhel delete mode 100644 SOURCES/filter-i686.sh delete mode 100644 SOURCES/filter-i686.sh.fedora delete mode 100644 SOURCES/filter-i686.sh.rhel delete mode 100755 SOURCES/filter-modules.sh delete mode 100755 SOURCES/filter-modules.sh.fedora delete mode 100755 SOURCES/filter-modules.sh.rhel delete mode 100644 SOURCES/filter-ppc64le.sh delete mode 100644 SOURCES/filter-ppc64le.sh.fedora delete mode 100644 SOURCES/filter-ppc64le.sh.rhel delete mode 100644 SOURCES/filter-s390x.sh delete mode 100644 SOURCES/filter-s390x.sh.fedora delete mode 100644 SOURCES/filter-s390x.sh.rhel delete mode 100644 SOURCES/filter-x86_64.sh delete mode 100644 SOURCES/filter-x86_64.sh.fedora delete mode 100644 SOURCES/filter-x86_64.sh.rhel create mode 100755 SOURCES/filtermods.py delete mode 100755 SOURCES/generate_bls_conf.sh delete mode 100755 SOURCES/generate_crashkernel_default.sh delete mode 100755 SOURCES/mod-blacklist.sh delete mode 100644 SOURCES/mod-extra.list delete mode 100644 SOURCES/mod-extra.list.fedora delete mode 100644 SOURCES/mod-extra.list.rhel delete mode 100644 SOURCES/mod-internal.list delete mode 100644 SOURCES/mod-kvm.list delete mode 100644 SOURCES/mod-partner.list delete mode 100755 SOURCES/parallel_xz.sh create mode 100644 SOURCES/patch-6.9-redhat.patch delete mode 100644 SOURCES/redhatsecureboot301.cer delete mode 100644 SOURCES/redhatsecurebootca1.cer create mode 100644 SOURCES/rhelima.x509 create mode 100644 SOURCES/rhelima_centos.x509 create mode 100644 SOURCES/rhelimaca1.x509 delete mode 100644 SOURCES/secureboot.cer delete mode 100644 SOURCES/secureboot_ppc.cer delete mode 100644 SOURCES/secureboot_s390.cer delete mode 100644 SOURCES/securebootca.cer delete mode 100644 SOURCES/steamdeck-oled-refresh-rate.patch delete mode 100755 SOURCES/update_scripts.sh delete mode 100644 SOURCES/x509.genkey diff --git a/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch b/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch index 6eac856..d2d4f0b 100644 --- a/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch +++ b/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch @@ -51,9 +51,9 @@ diff --git a/include/linux/aer.h b/include/linux/aer.h index 29cc10220..94ce49a5f 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h -@@ -41,9 +41,20 @@ struct aer_capability_regs { - }; - +@@ -40,9 +40,20 @@ + int pcie_read_tlp_log(struct pci_dev *dev, int where, struct pcie_tlp_log *log); + #if defined(CONFIG_PCIEAER) +/* PCIe port driver needs this function to enable AER */ +int pci_enable_pcie_error_reporting(struct pci_dev *dev); diff --git a/SOURCES/0001-amd-pstate.patch b/SOURCES/0001-amd-pstate.patch index d7fd4b3..6e929f5 100644 --- a/SOURCES/0001-amd-pstate.patch +++ b/SOURCES/0001-amd-pstate.patch @@ -1,578 +1,430 @@ -From 1449b07b2bd2af451bba8ba17f7b01cf30b6471f Mon Sep 17 00:00:00 2001 +From 841eda55513de3b157eb94460e37e7b779980e0c Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Fri, 23 Feb 2024 17:11:08 +0100 -Subject: [PATCH 1/7] amd-pstate +Date: Wed, 12 Jun 2024 18:19:17 +0200 +Subject: [PATCH 02/11] amd-pstate Signed-off-by: Peter Jung --- - .../admin-guide/kernel-parameters.txt | 5 + - Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- - arch/x86/Kconfig | 5 +- - drivers/acpi/cppc_acpi.c | 13 ++ - drivers/acpi/processor_driver.c | 6 + - drivers/cpufreq/amd-pstate.c | 179 +++++++++++++++++- - include/acpi/cppc_acpi.h | 5 + - include/linux/amd-pstate.h | 10 + - include/linux/cpufreq.h | 1 + - 9 files changed, 272 insertions(+), 11 deletions(-) + drivers/cpufreq/amd-pstate.c | 267 +++++++++++++++++++++-------------- + include/linux/amd-pstate.h | 20 ++- + 2 files changed, 178 insertions(+), 109 deletions(-) -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index b72e2049c487..95164b35f973 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -363,6 +363,11 @@ - selects a performance level in this range and appropriate - to the current workload. - -+ amd_prefcore= -+ [X86] -+ disable -+ Disable amd-pstate preferred core. -+ - amijoy.map= [HW,JOY] Amiga joystick support - Map of devices attached to JOY0DAT and JOY1DAT - Format: , -diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst -index 1cf40f69278c..0b832ff529db 100644 ---- a/Documentation/admin-guide/pm/amd-pstate.rst -+++ b/Documentation/admin-guide/pm/amd-pstate.rst -@@ -300,8 +300,8 @@ platforms. The AMD P-States mechanism is the more performance and energy - efficiency frequency management method on AMD processors. - - --AMD Pstate Driver Operation Modes --================================= -+``amd-pstate`` Driver Operation Modes -+====================================== - - ``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode, - non-autonomous (passive) mode and guided autonomous (guided) mode. -@@ -353,6 +353,48 @@ is activated. In this mode, driver requests minimum and maximum performance - level and the platform autonomously selects a performance level in this range - and appropriate to the current workload. - -+``amd-pstate`` Preferred Core -+================================= -+ -+The core frequency is subjected to the process variation in semiconductors. -+Not all cores are able to reach the maximum frequency respecting the -+infrastructure limits. Consequently, AMD has redefined the concept of -+maximum frequency of a part. This means that a fraction of cores can reach -+maximum frequency. To find the best process scheduling policy for a given -+scenario, OS needs to know the core ordering informed by the platform through -+highest performance capability register of the CPPC interface. -+ -+``amd-pstate`` preferred core enables the scheduler to prefer scheduling on -+cores that can achieve a higher frequency with lower voltage. The preferred -+core rankings can dynamically change based on the workload, platform conditions, -+thermals and ageing. -+ -+The priority metric will be initialized by the ``amd-pstate`` driver. The ``amd-pstate`` -+driver will also determine whether or not ``amd-pstate`` preferred core is -+supported by the platform. -+ -+``amd-pstate`` driver will provide an initial core ordering when the system boots. -+The platform uses the CPPC interfaces to communicate the core ranking to the -+operating system and scheduler to make sure that OS is choosing the cores -+with highest performance firstly for scheduling the process. When ``amd-pstate`` -+driver receives a message with the highest performance change, it will -+update the core ranking and set the cpu's priority. -+ -+``amd-pstate`` Preferred Core Switch -+================================= -+Kernel Parameters -+----------------- -+ -+``amd-pstate`` peferred core`` has two states: enable and disable. -+Enable/disable states can be chosen by different kernel parameters. -+Default enable ``amd-pstate`` preferred core. -+ -+``amd_prefcore=disable`` -+ -+For systems that support ``amd-pstate`` preferred core, the core rankings will -+always be advertised by the platform. But OS can choose to ignore that via the -+kernel parameter ``amd_prefcore=disable``. -+ - User Space Interface in ``sysfs`` - General - =========================================== - -@@ -385,6 +427,19 @@ control its functionality at the system level. They are located in the - to the operation mode represented by that string - or to be - unregistered in the "disable" case. - -+``prefcore`` -+ Preferred core state of the driver: "enabled" or "disabled". -+ -+ "enabled" -+ Enable the ``amd-pstate`` preferred core. -+ -+ "disabled" -+ Disable the ``amd-pstate`` preferred core -+ -+ -+ This attribute is read-only to check the state of preferred core set -+ by the kernel parameter. -+ - ``cpupower`` tool support for ``amd-pstate`` - =============================================== - -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 1566748f16c4..4fd69cd4241a 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -1054,8 +1054,9 @@ config SCHED_MC - - config SCHED_MC_PRIO - bool "CPU core priorities scheduler support" -- depends on SCHED_MC && CPU_SUP_INTEL -- select X86_INTEL_PSTATE -+ depends on SCHED_MC -+ select X86_INTEL_PSTATE if CPU_SUP_INTEL -+ select X86_AMD_PSTATE if CPU_SUP_AMD && ACPI - select CPU_FREQ - default y - help -diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c -index 7ff269a78c20..ad388a0e8484 100644 ---- a/drivers/acpi/cppc_acpi.c -+++ b/drivers/acpi/cppc_acpi.c -@@ -1154,6 +1154,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf) - return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf); - } - -+/** -+ * cppc_get_highest_perf - Get the highest performance register value. -+ * @cpunum: CPU from which to get highest performance. -+ * @highest_perf: Return address. -+ * -+ * Return: 0 for success, -EIO otherwise. -+ */ -+int cppc_get_highest_perf(int cpunum, u64 *highest_perf) -+{ -+ return cppc_get_perf(cpunum, HIGHEST_PERF, highest_perf); -+} -+EXPORT_SYMBOL_GPL(cppc_get_highest_perf); -+ - /** - * cppc_get_epp_perf - Get the epp register value. - * @cpunum: CPU from which to get epp preference value. -diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c -index 4bd16b3f0781..67db60eda370 100644 ---- a/drivers/acpi/processor_driver.c -+++ b/drivers/acpi/processor_driver.c -@@ -27,6 +27,7 @@ - #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 - #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 - #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 -+#define ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED 0x85 - - MODULE_AUTHOR("Paul Diefenbaugh"); - MODULE_DESCRIPTION("ACPI Processor Driver"); -@@ -83,6 +84,11 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) - acpi_bus_generate_netlink_event(device->pnp.device_class, - dev_name(&device->dev), event, 0); - break; -+ case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED: -+ cpufreq_update_limits(pr->id); -+ acpi_bus_generate_netlink_event(device->pnp.device_class, -+ dev_name(&device->dev), event, 0); -+ break; - default: - acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event); - break; diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c -index 1791d37fbc53..54df68773620 100644 +index 28166df81cf8d..cde3b91b4422a 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -64,6 +65,7 @@ static struct cpufreq_driver amd_pstate_driver; - static struct cpufreq_driver amd_pstate_epp_driver; +@@ -68,6 +68,7 @@ static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state = AMD_PSTATE_UNDEFINED; static bool cppc_enabled; -+static bool amd_pstate_prefcore = true; + static bool amd_pstate_prefcore = true; ++static struct quirk_entry *quirks; /* * AMD Energy Preference Performance (EPP) -@@ -296,14 +298,12 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) - &cap1); - if (ret) - return ret; -- -- /* -- * TODO: Introduce AMD specific power feature. -- * -- * CPPC entry doesn't indicate the highest performance in some ASICs. -+ -+ /* Some CPUs have different highest_perf from others, it is safer -+ * to read it than to assume some erroneous value, leading to performance issues. - */ - highest_perf = amd_get_highest_perf(); -- if (highest_perf > AMD_CPPC_HIGHEST_PERF(cap1)) -+ if(highest_perf > AMD_CPPC_HIGHEST_PERF(cap1)) - highest_perf = AMD_CPPC_HIGHEST_PERF(cap1); +@@ -112,6 +113,41 @@ static unsigned int epp_values[] = { - WRITE_ONCE(cpudata->highest_perf, highest_perf); -@@ -311,6 +311,7 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) - WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1)); - WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1)); - WRITE_ONCE(cpudata->lowest_perf, AMD_CPPC_LOWEST_PERF(cap1)); -+ WRITE_ONCE(cpudata->prefcore_ranking, AMD_CPPC_HIGHEST_PERF(cap1)); - WRITE_ONCE(cpudata->min_limit_perf, AMD_CPPC_LOWEST_PERF(cap1)); - return 0; - } -@@ -324,8 +325,11 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) - if (ret) - return ret; + typedef int (*cppc_mode_transition_fn)(int); -+ /* Some CPUs have different highest_perf from others, it is safer -+ * to read it than to assume some erroneous value, leading to performance issues. ++static struct quirk_entry quirk_amd_7k62 = { ++ .nominal_freq = 2600, ++ .lowest_freq = 550, ++}; ++ ++static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi) ++{ ++ /** ++ * match the broken bios for family 17h processor support CPPC V2 ++ * broken BIOS lack of nominal_freq and lowest_freq capabilities ++ * definition in ACPI tables + */ - highest_perf = amd_get_highest_perf(); -- if (highest_perf > cppc_perf.highest_perf) -+ if(highest_perf > cppc_perf.highest_perf) - highest_perf = cppc_perf.highest_perf; - - WRITE_ONCE(cpudata->highest_perf, highest_perf); -@@ -334,6 +338,7 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) - WRITE_ONCE(cpudata->lowest_nonlinear_perf, - cppc_perf.lowest_nonlinear_perf); - WRITE_ONCE(cpudata->lowest_perf, cppc_perf.lowest_perf); -+ WRITE_ONCE(cpudata->prefcore_ranking, cppc_perf.highest_perf); - WRITE_ONCE(cpudata->min_limit_perf, cppc_perf.lowest_perf); ++ if (boot_cpu_has(X86_FEATURE_ZEN2)) { ++ quirks = dmi->driver_data; ++ pr_info("Overriding nominal and lowest frequencies for %s\n", dmi->ident); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = { ++ { ++ .callback = dmi_matched_7k62_bios_bug, ++ .ident = "AMD EPYC 7K62", ++ .matches = { ++ DMI_MATCH(DMI_BIOS_VERSION, "5.14"), ++ DMI_MATCH(DMI_BIOS_RELEASE, "12/12/2019"), ++ }, ++ .driver_data = &quirk_amd_7k62, ++ }, ++ {} ++}; ++MODULE_DEVICE_TABLE(dmi, amd_pstate_quirks_table); ++ + static inline int get_mode_idx_from_str(const char *str, size_t size) + { + int i; +@@ -620,78 +656,6 @@ static void amd_pstate_adjust_perf(unsigned int cpu, + cpufreq_cpu_put(policy); + } - if (cppc_state == AMD_PSTATE_ACTIVE) -@@ -706,6 +711,114 @@ static void amd_perf_ctl_reset(unsigned int cpu) - wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0); +-static int amd_get_min_freq(struct amd_cpudata *cpudata) +-{ +- struct cppc_perf_caps cppc_perf; +- +- int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); +- if (ret) +- return ret; +- +- /* Switch to khz */ +- return cppc_perf.lowest_freq * 1000; +-} +- +-static int amd_get_max_freq(struct amd_cpudata *cpudata) +-{ +- struct cppc_perf_caps cppc_perf; +- u32 max_perf, max_freq, nominal_freq, nominal_perf; +- u64 boost_ratio; +- +- int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); +- if (ret) +- return ret; +- +- nominal_freq = cppc_perf.nominal_freq; +- nominal_perf = READ_ONCE(cpudata->nominal_perf); +- max_perf = READ_ONCE(cpudata->highest_perf); +- +- boost_ratio = div_u64(max_perf << SCHED_CAPACITY_SHIFT, +- nominal_perf); +- +- max_freq = nominal_freq * boost_ratio >> SCHED_CAPACITY_SHIFT; +- +- /* Switch to khz */ +- return max_freq * 1000; +-} +- +-static int amd_get_nominal_freq(struct amd_cpudata *cpudata) +-{ +- struct cppc_perf_caps cppc_perf; +- +- int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); +- if (ret) +- return ret; +- +- /* Switch to khz */ +- return cppc_perf.nominal_freq * 1000; +-} +- +-static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) +-{ +- struct cppc_perf_caps cppc_perf; +- u32 lowest_nonlinear_freq, lowest_nonlinear_perf, +- nominal_freq, nominal_perf; +- u64 lowest_nonlinear_ratio; +- +- int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); +- if (ret) +- return ret; +- +- nominal_freq = cppc_perf.nominal_freq; +- nominal_perf = READ_ONCE(cpudata->nominal_perf); +- +- lowest_nonlinear_perf = cppc_perf.lowest_nonlinear_perf; +- +- lowest_nonlinear_ratio = div_u64(lowest_nonlinear_perf << SCHED_CAPACITY_SHIFT, +- nominal_perf); +- +- lowest_nonlinear_freq = nominal_freq * lowest_nonlinear_ratio >> SCHED_CAPACITY_SHIFT; +- +- /* Switch to khz */ +- return lowest_nonlinear_freq * 1000; +-} +- + static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) + { + struct amd_cpudata *cpudata = policy->driver_data; +@@ -705,7 +669,7 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) + if (state) + policy->cpuinfo.max_freq = cpudata->max_freq; + else +- policy->cpuinfo.max_freq = cpudata->nominal_freq; ++ policy->cpuinfo.max_freq = cpudata->nominal_freq * 1000; + + policy->max = policy->cpuinfo.max_freq; + +@@ -844,9 +808,93 @@ static void amd_pstate_update_limits(unsigned int cpu) + mutex_unlock(&amd_pstate_driver_lock); } +/* -+ * Set amd-pstate preferred core enable can't be done directly from cpufreq callbacks -+ * due to locking, so queue the work for later. -+ */ -+static void amd_pstste_sched_prefcore_workfn(struct work_struct *work) -+{ -+ sched_set_itmt_support(); -+} -+static DECLARE_WORK(sched_prefcore_work, amd_pstste_sched_prefcore_workfn); -+ -+/* -+ * Get the highest performance register value. -+ * @cpu: CPU from which to get highest performance. -+ * @highest_perf: Return address. -+ * -+ * Return: 0 for success, -EIO otherwise. ++ * Get pstate transition delay time from ACPI tables that firmware set ++ * instead of using hardcode value directly. + */ -+static int amd_pstate_get_highest_perf(int cpu, u32 *highest_perf) ++static u32 amd_pstate_get_transition_delay_us(unsigned int cpu) +{ -+ int ret; ++ u32 transition_delay_ns; + -+ if (boot_cpu_has(X86_FEATURE_CPPC)) { -+ u64 cap1; ++ transition_delay_ns = cppc_get_transition_latency(cpu); ++ if (transition_delay_ns == CPUFREQ_ETERNAL) ++ return AMD_PSTATE_TRANSITION_DELAY; + -+ ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1); -+ if (ret) -+ return ret; -+ WRITE_ONCE(*highest_perf, AMD_CPPC_HIGHEST_PERF(cap1)); -+ } else { -+ u64 cppc_highest_perf; -+ -+ ret = cppc_get_highest_perf(cpu, &cppc_highest_perf); -+ if (ret) -+ return ret; -+ WRITE_ONCE(*highest_perf, cppc_highest_perf); -+ } -+ -+ return (ret); ++ return transition_delay_ns / NSEC_PER_USEC; +} + -+#define CPPC_MAX_PERF U8_MAX -+ -+static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) ++/* ++ * Get pstate transition latency value from ACPI tables that firmware ++ * set instead of using hardcode value directly. ++ */ ++static u32 amd_pstate_get_transition_latency(unsigned int cpu) +{ -+ int ret, prio; -+ u32 highest_perf; -+ -+ ret = amd_pstate_get_highest_perf(cpudata->cpu, &highest_perf); -+ if (ret) -+ return; -+ -+ cpudata->hw_prefcore = true; -+ /* check if CPPC preferred core feature is enabled*/ -+ if (highest_perf < CPPC_MAX_PERF) -+ prio = (int)highest_perf; -+ else { -+ pr_debug("AMD CPPC preferred core is unsupported!\n"); -+ cpudata->hw_prefcore = false; -+ return; -+ } ++ u32 transition_latency; + -+ if (!amd_pstate_prefcore) -+ return; ++ transition_latency = cppc_get_transition_latency(cpu); ++ if (transition_latency == CPUFREQ_ETERNAL) ++ return AMD_PSTATE_TRANSITION_LATENCY; + -+ /* -+ * The priorities can be set regardless of whether or not -+ * sched_set_itmt_support(true) has been called and it is valid to -+ * update them at any time after it has been called. -+ */ -+ sched_set_itmt_core_prio(prio, cpudata->cpu); -+ -+ schedule_work(&sched_prefcore_work); ++ return transition_latency; +} + -+static void amd_pstate_update_limits(unsigned int cpu) ++/* ++ * amd_pstate_init_freq: Initialize the max_freq, min_freq, ++ * nominal_freq and lowest_nonlinear_freq for ++ * the @cpudata object. ++ * ++ * Requires: highest_perf, lowest_perf, nominal_perf and ++ * lowest_nonlinear_perf members of @cpudata to be ++ * initialized. ++ * ++ * Returns 0 on success, non-zero value on failure. ++ */ ++static int amd_pstate_init_freq(struct amd_cpudata *cpudata) +{ -+ struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); -+ struct amd_cpudata *cpudata = policy->driver_data; -+ u32 prev_high = 0, cur_high = 0; + int ret; -+ bool highest_perf_changed = false; ++ u32 min_freq; ++ u32 highest_perf, max_freq; ++ u32 nominal_perf, nominal_freq; ++ u32 lowest_nonlinear_perf, lowest_nonlinear_freq; ++ u32 boost_ratio, lowest_nonlinear_ratio; ++ struct cppc_perf_caps cppc_perf; ++ ++ ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); ++ if (ret) ++ return ret; + -+ mutex_lock(&amd_pstate_driver_lock); -+ if ((!amd_pstate_prefcore) || (!cpudata->hw_prefcore)) -+ goto free_cpufreq_put; ++ if (quirks && quirks->lowest_freq) ++ min_freq = quirks->lowest_freq * 1000; ++ else ++ min_freq = cppc_perf.lowest_freq * 1000; + -+ ret = amd_pstate_get_highest_perf(cpu, &cur_high); -+ if (ret) -+ goto free_cpufreq_put; ++ if (quirks && quirks->nominal_freq) ++ nominal_freq = quirks->nominal_freq ; ++ else ++ nominal_freq = cppc_perf.nominal_freq; + -+ prev_high = READ_ONCE(cpudata->prefcore_ranking); -+ if (prev_high != cur_high) { -+ highest_perf_changed = true; -+ WRITE_ONCE(cpudata->prefcore_ranking, cur_high); ++ nominal_perf = READ_ONCE(cpudata->nominal_perf); + -+ if (cur_high < CPPC_MAX_PERF) -+ sched_set_itmt_core_prio((int)cur_high, cpu); -+ } ++ highest_perf = READ_ONCE(cpudata->highest_perf); ++ boost_ratio = div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf); ++ max_freq = (nominal_freq * boost_ratio >> SCHED_CAPACITY_SHIFT) * 1000; + -+free_cpufreq_put: -+ cpufreq_cpu_put(policy); ++ lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); ++ lowest_nonlinear_ratio = div_u64(lowest_nonlinear_perf << SCHED_CAPACITY_SHIFT, ++ nominal_perf); ++ lowest_nonlinear_freq = (nominal_freq * lowest_nonlinear_ratio >> SCHED_CAPACITY_SHIFT) * 1000; + -+ if (!highest_perf_changed) -+ cpufreq_update_policy(cpu); ++ WRITE_ONCE(cpudata->min_freq, min_freq); ++ WRITE_ONCE(cpudata->lowest_nonlinear_freq, lowest_nonlinear_freq); ++ WRITE_ONCE(cpudata->nominal_freq, nominal_freq); ++ WRITE_ONCE(cpudata->max_freq, max_freq); + -+ mutex_unlock(&amd_pstate_driver_lock); ++ return 0; +} + static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { - int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; -@@ -727,6 +840,8 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) - - cpudata->cpu = policy->cpu; +- int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; ++ int min_freq, max_freq, nominal_freq, ret; + struct device *dev; + struct amd_cpudata *cpudata; -+ amd_pstate_init_prefcore(cpudata); -+ - ret = amd_pstate_init_perf(cpudata); +@@ -871,20 +919,25 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) if (ret) goto free_cpudata1; -@@ -877,6 +992,28 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, - return sysfs_emit(buf, "%u\n", perf); - } -+static ssize_t show_amd_pstate_prefcore_ranking(struct cpufreq_policy *policy, -+ char *buf) -+{ -+ u32 perf; -+ struct amd_cpudata *cpudata = policy->driver_data; -+ -+ perf = READ_ONCE(cpudata->prefcore_ranking); -+ -+ return sysfs_emit(buf, "%u\n", perf); -+} -+ -+static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy, -+ char *buf) -+{ -+ bool hw_prefcore; -+ struct amd_cpudata *cpudata = policy->driver_data; -+ -+ hw_prefcore = READ_ONCE(cpudata->hw_prefcore); -+ -+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(hw_prefcore)); -+} -+ - static ssize_t show_energy_performance_available_preferences( - struct cpufreq_policy *policy, char *buf) +- min_freq = amd_get_min_freq(cpudata); +- max_freq = amd_get_max_freq(cpudata); +- nominal_freq = amd_get_nominal_freq(cpudata); +- lowest_nonlinear_freq = amd_get_lowest_nonlinear_freq(cpudata); ++ ret = amd_pstate_init_freq(cpudata); ++ if (ret) ++ goto free_cpudata1; + +- if (min_freq < 0 || max_freq < 0 || min_freq > max_freq) { +- dev_err(dev, "min_freq(%d) or max_freq(%d) value is incorrect\n", +- min_freq, max_freq); ++ min_freq = READ_ONCE(cpudata->min_freq); ++ max_freq = READ_ONCE(cpudata->max_freq); ++ nominal_freq = READ_ONCE(cpudata->nominal_freq); ++ ++ if (min_freq <= 0 || max_freq <= 0 || ++ nominal_freq <= 0 || min_freq > max_freq) { ++ dev_err(dev, ++ "min_freq(%d) or max_freq(%d) or nominal_freq (%d) value is incorrect, check _CPC in ACPI tables\n", ++ min_freq, max_freq, nominal_freq); + ret = -EINVAL; + goto free_cpudata1; + } + +- policy->cpuinfo.transition_latency = AMD_PSTATE_TRANSITION_LATENCY; +- policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; ++ policy->cpuinfo.transition_latency = amd_pstate_get_transition_latency(policy->cpu); ++ policy->transition_delay_us = amd_pstate_get_transition_delay_us(policy->cpu); + + policy->min = min_freq; + policy->max = max_freq; +@@ -912,13 +965,8 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) + goto free_cpudata2; + } + +- /* Initial processor data capability frequencies */ +- cpudata->max_freq = max_freq; +- cpudata->min_freq = min_freq; + cpudata->max_limit_freq = max_freq; + cpudata->min_limit_freq = min_freq; +- cpudata->nominal_freq = nominal_freq; +- cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq; + + policy->driver_data = cpudata; + +@@ -982,7 +1030,7 @@ static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy, + int max_freq; + struct amd_cpudata *cpudata = policy->driver_data; + +- max_freq = amd_get_max_freq(cpudata); ++ max_freq = READ_ONCE(cpudata->max_freq); + if (max_freq < 0) + return max_freq; + +@@ -995,7 +1043,7 @@ static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli + int freq; + struct amd_cpudata *cpudata = policy->driver_data; + +- freq = amd_get_lowest_nonlinear_freq(cpudata); ++ freq = READ_ONCE(cpudata->lowest_nonlinear_freq); + if (freq < 0) + return freq; + +@@ -1306,7 +1354,7 @@ static bool amd_pstate_acpi_pm_profile_undefined(void) + + static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) { -@@ -1074,18 +1211,29 @@ static ssize_t status_store(struct device *a, struct device_attribute *b, - return ret < 0 ? ret : count; - } - -+static ssize_t prefcore_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(amd_pstate_prefcore)); -+} -+ - cpufreq_freq_attr_ro(amd_pstate_max_freq); - cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); - - cpufreq_freq_attr_ro(amd_pstate_highest_perf); -+cpufreq_freq_attr_ro(amd_pstate_prefcore_ranking); -+cpufreq_freq_attr_ro(amd_pstate_hw_prefcore); - cpufreq_freq_attr_rw(energy_performance_preference); - cpufreq_freq_attr_ro(energy_performance_available_preferences); - static DEVICE_ATTR_RW(status); -+static DEVICE_ATTR_RO(prefcore); - - static struct freq_attr *amd_pstate_attr[] = { - &amd_pstate_max_freq, - &amd_pstate_lowest_nonlinear_freq, - &amd_pstate_highest_perf, -+ &amd_pstate_prefcore_ranking, -+ &amd_pstate_hw_prefcore, - NULL, - }; - -@@ -1093,6 +1241,8 @@ static struct freq_attr *amd_pstate_epp_attr[] = { - &amd_pstate_max_freq, - &amd_pstate_lowest_nonlinear_freq, - &amd_pstate_highest_perf, -+ &amd_pstate_prefcore_ranking, -+ &amd_pstate_hw_prefcore, - &energy_performance_preference, - &energy_performance_available_preferences, - NULL, -@@ -1100,6 +1250,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { +- int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; ++ int min_freq, max_freq, nominal_freq, ret; + struct amd_cpudata *cpudata; + struct device *dev; + u64 value; +@@ -1333,13 +1381,18 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) + if (ret) + goto free_cpudata1; - static struct attribute *pstate_global_attributes[] = { - &dev_attr_status.attr, -+ &dev_attr_prefcore.attr, - NULL - }; +- min_freq = amd_get_min_freq(cpudata); +- max_freq = amd_get_max_freq(cpudata); +- nominal_freq = amd_get_nominal_freq(cpudata); +- lowest_nonlinear_freq = amd_get_lowest_nonlinear_freq(cpudata); +- if (min_freq < 0 || max_freq < 0 || min_freq > max_freq) { +- dev_err(dev, "min_freq(%d) or max_freq(%d) value is incorrect\n", +- min_freq, max_freq); ++ ret = amd_pstate_init_freq(cpudata); ++ if (ret) ++ goto free_cpudata1; ++ ++ min_freq = READ_ONCE(cpudata->min_freq); ++ max_freq = READ_ONCE(cpudata->max_freq); ++ nominal_freq = READ_ONCE(cpudata->nominal_freq); ++ if (min_freq <= 0 || max_freq <= 0 || ++ nominal_freq <= 0 || min_freq > max_freq) { ++ dev_err(dev, ++ "min_freq(%d) or max_freq(%d) or nominal_freq(%d) value is incorrect, check _CPC in ACPI tables\n", ++ min_freq, max_freq, nominal_freq); + ret = -EINVAL; + goto free_cpudata1; + } +@@ -1349,12 +1402,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) + /* It will be updated by governor */ + policy->cur = policy->cpuinfo.min_freq; + +- /* Initial processor data capability frequencies */ +- cpudata->max_freq = max_freq; +- cpudata->min_freq = min_freq; +- cpudata->nominal_freq = nominal_freq; +- cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq; +- + policy->driver_data = cpudata; -@@ -1151,6 +1302,8 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) - cpudata->cpu = policy->cpu; - cpudata->epp_policy = 0; + cpudata->epp_cached = amd_pstate_get_epp(cpudata, 0); +@@ -1394,6 +1441,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) -+ amd_pstate_init_prefcore(cpudata); + static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) + { ++ struct amd_cpudata *cpudata = policy->driver_data; + - ret = amd_pstate_init_perf(cpudata); - if (ret) - goto free_cpudata1; -@@ -1432,6 +1585,7 @@ static struct cpufreq_driver amd_pstate_driver = { - .suspend = amd_pstate_cpu_suspend, - .resume = amd_pstate_cpu_resume, - .set_boost = amd_pstate_set_boost, -+ .update_limits = amd_pstate_update_limits, - .name = "amd-pstate", - .attr = amd_pstate_attr, - }; -@@ -1446,6 +1600,7 @@ static struct cpufreq_driver amd_pstate_epp_driver = { - .online = amd_pstate_epp_cpu_online, - .suspend = amd_pstate_epp_suspend, - .resume = amd_pstate_epp_resume, -+ .update_limits = amd_pstate_update_limits, - .name = "amd-pstate-epp", - .attr = amd_pstate_epp_attr, - }; -@@ -1567,7 +1722,17 @@ static int __init amd_pstate_param(char *str) - - return amd_pstate_set_driver(mode_idx); - } ++ if (cpudata) { ++ kfree(cpudata); ++ policy->driver_data = NULL; ++ } + -+static int __init amd_prefcore_param(char *str) -+{ -+ if (!strcmp(str, "disable")) -+ amd_pstate_prefcore = false; + pr_debug("CPU %d exiting\n", policy->cpu); + return 0; + } +@@ -1672,6 +1726,11 @@ static int __init amd_pstate_init(void) + if (cpufreq_get_current_driver()) + return -EEXIST; + ++ quirks = NULL; + -+ return 0; -+} ++ /* check if this machine need CPPC quirks */ ++ dmi_check_system(amd_pstate_quirks_table); + - early_param("amd_pstate", amd_pstate_param); -+early_param("amd_prefcore", amd_prefcore_param); - - MODULE_AUTHOR("Huang Rui "); - MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver"); -diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h -index 6126c977ece0..c0b69ffe7bdb 100644 ---- a/include/acpi/cppc_acpi.h -+++ b/include/acpi/cppc_acpi.h -@@ -139,6 +139,7 @@ struct cppc_cpudata { - #ifdef CONFIG_ACPI_CPPC_LIB - extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf); - extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf); -+extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf); - extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs); - extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); - extern int cppc_set_enable(int cpu, bool enable); -@@ -165,6 +166,10 @@ static inline int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf) - { - return -ENOTSUPP; - } -+static inline int cppc_get_highest_perf(int cpunum, u64 *highest_perf) -+{ -+ return -ENOTSUPP; -+} - static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs) - { - return -ENOTSUPP; + switch (cppc_state) { + case AMD_PSTATE_UNDEFINED: + /* Disable on the following configs by default: diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h -index 6ad02ad9c7b4..d21838835abd 100644 +index d21838835abda..d58fc022ec466 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h -@@ -39,11 +39,16 @@ struct amd_aperf_mperf { - * @cppc_req_cached: cached performance request hints - * @highest_perf: the maximum performance an individual processor may reach, - * assuming ideal conditions -+ * For platforms that do not support the preferred core feature, the -+ * highest_pef may be configured with 166 or 255, to avoid max frequency -+ * calculated wrongly. we take the fixed value as the highest_perf. - * @nominal_perf: the maximum sustained performance level of the processor, - * assuming ideal operating conditions - * @lowest_nonlinear_perf: the lowest performance level at which nonlinear power - * savings are achieved +@@ -49,13 +49,17 @@ struct amd_aperf_mperf { * @lowest_perf: the absolute lowest performance level of the processor -+ * @prefcore_ranking: the preferred core ranking, the higher value indicates a higher -+ * priority. - * @max_freq: the frequency that mapped to highest_perf - * @min_freq: the frequency that mapped to lowest_perf - * @nominal_freq: the frequency that mapped to nominal_perf -@@ -52,6 +57,9 @@ struct amd_aperf_mperf { + * @prefcore_ranking: the preferred core ranking, the higher value indicates a higher + * priority. +- * @max_freq: the frequency that mapped to highest_perf +- * @min_freq: the frequency that mapped to lowest_perf +- * @nominal_freq: the frequency that mapped to nominal_perf +- * @lowest_nonlinear_freq: the frequency that mapped to lowest_nonlinear_perf ++ * @min_limit_perf: Cached value of the performance corresponding to policy->min ++ * @max_limit_perf: Cached value of the performance corresponding to policy->max ++ * @min_limit_freq: Cached value of policy->min (in khz) ++ * @max_limit_freq: Cached value of policy->max (in khz) ++ * @max_freq: the frequency (in khz) that mapped to highest_perf ++ * @min_freq: the frequency (in khz) that mapped to lowest_perf ++ * @nominal_freq: the frequency (in khz) that mapped to nominal_perf ++ * @lowest_nonlinear_freq: the frequency (in khz) that mapped to lowest_nonlinear_perf + * @cur: Difference of Aperf/Mperf/tsc count between last and current sample * @prev: Last Aperf/Mperf/tsc count value read from register - * @freq: current cpu frequency value +- * @freq: current cpu frequency value ++ * @freq: current cpu frequency value (in khz) * @boost_supported: check whether the Processor or SBIOS supports boost mode -+ * @hw_prefcore: check whether HW supports preferred core featue. -+ * Only when hw_prefcore and early prefcore param are true, -+ * AMD P-State driver supports preferred core featue. - * @epp_policy: Last saved policy used to set energy-performance preference - * @epp_cached: Cached CPPC energy-performance preference value - * @policy: Cpufreq policy value -@@ -70,6 +78,7 @@ struct amd_cpudata { - u32 nominal_perf; - u32 lowest_nonlinear_perf; - u32 lowest_perf; -+ u32 prefcore_ranking; - u32 min_limit_perf; - u32 max_limit_perf; - u32 min_limit_freq; -@@ -85,6 +94,7 @@ struct amd_cpudata { - - u64 freq; - bool boost_supported; -+ bool hw_prefcore; - - /* EPP feature related attributes*/ - s16 epp_policy; -diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h -index 1c5ca92a0555..5d62beea2712 100644 ---- a/include/linux/cpufreq.h -+++ b/include/linux/cpufreq.h -@@ -263,6 +263,7 @@ static inline bool cpufreq_supports_freq_invariance(void) - return false; - } - static inline void disable_cpufreq(void) { } -+static inline void cpufreq_update_limits(unsigned int cpu) { } - #endif - - #ifdef CONFIG_CPU_FREQ_STAT + * @hw_prefcore: check whether HW supports preferred core featue. + * Only when hw_prefcore and early prefcore param are true, +@@ -124,4 +128,10 @@ static const char * const amd_pstate_mode_string[] = { + [AMD_PSTATE_GUIDED] = "guided", + NULL, + }; ++ ++struct quirk_entry { ++ u32 nominal_freq; ++ u32 lowest_freq; ++}; ++ + #endif /* _LINUX_AMD_PSTATE_H */ -- -2.43.2 +2.45.2 diff --git a/SOURCES/0001-ntsync.patch b/SOURCES/0001-ntsync.patch index fa47d21..ea60a73 100644 --- a/SOURCES/0001-ntsync.patch +++ b/SOURCES/0001-ntsync.patch @@ -1,44 +1,49 @@ -Subject: [PATCH v2 0/31] NT synchronization primitive driver -From: Elizabeth Figura -Date: Mon, 19 Feb 2024 16:38:02 -0600 -Message-Id: <20240219223833.95710-1-zfigura@codeweavers.com> -MIME-Version: 1.0 -Content-Type: text/plain; charset="utf-8" -Content-Transfer-Encoding: 7bit +From 4e05dd5270a7e43940c9321c7be008d97143aca9 Mon Sep 17 00:00:00 2001 +From: Peter Jung +Date: Wed, 12 Jun 2024 18:20:30 +0200 +Subject: [PATCH 09/11] ntsync -This patch series introduces a new char misc driver, /dev/ntsync, which is used -to implement Windows NT synchronization primitives. +Signed-off-by: Peter Jung +--- + Documentation/userspace-api/index.rst | 1 + + .../userspace-api/ioctl/ioctl-number.rst | 2 + + Documentation/userspace-api/ntsync.rst | 398 +++++ + MAINTAINERS | 9 + + drivers/misc/Kconfig | 11 + + drivers/misc/Makefile | 1 + + drivers/misc/ntsync.c | 1232 +++++++++++++++ + include/uapi/linux/ntsync.h | 62 + + tools/testing/selftests/Makefile | 1 + + .../selftests/drivers/ntsync/.gitignore | 1 + + .../testing/selftests/drivers/ntsync/Makefile | 7 + + tools/testing/selftests/drivers/ntsync/config | 1 + + .../testing/selftests/drivers/ntsync/ntsync.c | 1407 +++++++++++++++++ + 13 files changed, 3133 insertions(+) + create mode 100644 Documentation/userspace-api/ntsync.rst + create mode 100644 drivers/misc/ntsync.c + create mode 100644 include/uapi/linux/ntsync.h + create mode 100644 tools/testing/selftests/drivers/ntsync/.gitignore + create mode 100644 tools/testing/selftests/drivers/ntsync/Makefile + create mode 100644 tools/testing/selftests/drivers/ntsync/config + create mode 100644 tools/testing/selftests/drivers/ntsync/ntsync.c - Documentation/userspace-api/index.rst | 1 + - Documentation/userspace-api/ioctl/ioctl-number.rst | 2 + - Documentation/userspace-api/ntsync.rst | 399 ++++++ - MAINTAINERS | 9 + - drivers/misc/Kconfig | 11 + - drivers/misc/Makefile | 1 + - drivers/misc/ntsync.c | 1159 ++++++++++++++++ - include/uapi/linux/ntsync.h | 62 + - tools/testing/selftests/Makefile | 1 + - tools/testing/selftests/drivers/ntsync/Makefile | 8 + - tools/testing/selftests/drivers/ntsync/config | 1 + - tools/testing/selftests/drivers/ntsync/ntsync.c | 1407 ++++++++++++++++++++ - 12 files changed, 3061 insertions(+) diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst -index 09f61bd2ac2e..f5a72ed27def 100644 +index afecfe3cc4a86..d5745a500fa7b 100644 --- a/Documentation/userspace-api/index.rst +++ b/Documentation/userspace-api/index.rst -@@ -34,6 +34,7 @@ place where this information is gathered. - tee - isapnp - dcdbas +@@ -62,6 +62,7 @@ Everything else + vduse + futex2 + perf_ring_buffer + ntsync .. only:: subproject and html diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst -index 457e16f06e04..2f5c6994f042 100644 +index c472423412bf2..a141e8e65c5d3 100644 --- a/Documentation/userspace-api/ioctl/ioctl-number.rst +++ b/Documentation/userspace-api/ioctl/ioctl-number.rst -@@ -173,6 +173,8 @@ Code Seq# Include File Comments +@@ -174,6 +174,8 @@ Code Seq# Include File Comments 'M' 00-0F drivers/video/fsl-diu-fb.h conflict! 'N' 00-1F drivers/usb/scanner.h 'N' 40-7F drivers/block/nvme.c @@ -49,10 +54,10 @@ index 457e16f06e04..2f5c6994f042 100644 'P' 60-6F sound/sscape_ioctl.h conflict! diff --git a/Documentation/userspace-api/ntsync.rst b/Documentation/userspace-api/ntsync.rst new file mode 100644 -index 000000000000..202c2350d3af +index 0000000000000..767844637a7df --- /dev/null +++ b/Documentation/userspace-api/ntsync.rst -@@ -0,0 +1,399 @@ +@@ -0,0 +1,398 @@ +=================================== +NT synchronization primitive driver +=================================== @@ -76,10 +81,11 @@ index 000000000000..202c2350d3af +semaphores, mutexes, and events. + +A semaphore holds a single volatile 32-bit counter, and a static 32-bit -+integer denoting the maximum value. It is considered signaled when the -+counter is nonzero. The counter is decremented by one when a wait is -+satisfied. Both the initial and maximum count are established when the -+semaphore is created. ++integer denoting the maximum value. It is considered signaled (that is, ++can be acquired without contention, or will wake up a waiting thread) ++when the counter is nonzero. The counter is decremented by one when a ++wait is satisfied. Both the initial and maximum count are established ++when the semaphore is created. + +A mutex holds a volatile 32-bit recursion count, and a volatile 32-bit +identifier denoting its owner. A mutex is considered signaled when its @@ -99,10 +105,11 @@ index 000000000000..202c2350d3af +driver does not actually validate that a calling thread provides +consistent or unique identifiers. + -+An event holds a volatile boolean state denoting whether it is signaled -+or not. There are two types of events, auto-reset and manual-reset. An -+auto-reset event is designaled when a wait is satisfied; a manual-reset -+event is not. The event type is specified when the event is created. ++An event is similar to a semaphore with a maximum count of one. It holds ++a volatile boolean state denoting whether it is signaled or not. There ++are two types of events, auto-reset and manual-reset. An auto-reset ++event is designaled when a wait is satisfied; a manual-reset event is ++not. The event type is specified when the event is created. + +Unless specified otherwise, all operations on an object are atomic and +totally ordered with respect to other operations on the same object. @@ -395,8 +402,7 @@ index 000000000000..202c2350d3af + operations on the same object. If two wait operations (with different + ``owner`` identifiers) are queued on the same mutex, only one is + signaled. If two wait operations are queued on the same semaphore, -+ and a value of one is posted to it, only one is signaled. The order -+ in which threads are signaled is not specified. ++ and a value of one is posted to it, only one is signaled. + + If an abandoned mutex is acquired, the ioctl fails with + ``EOWNERDEAD``. Although this is a failure return, the function may @@ -405,9 +411,7 @@ index 000000000000..202c2350d3af + abandoned, and ``index`` is still set to the index of the mutex. + + The ``alert`` argument is an "extra" event which can terminate the -+ wait, independently of all other objects. If members of ``objs`` and -+ ``alert`` are both simultaneously signaled, a member of ``objs`` will -+ always be given priority and acquired first. ++ wait, independently of all other objects. + + It is valid to pass the same object more than once, including by + passing the same event in the ``objs`` array and in ``alert``. If a @@ -453,10 +457,10 @@ index 000000000000..202c2350d3af + ``objs`` and in ``alert``. If this is attempted, the function fails + with ``EINVAL``. diff --git a/MAINTAINERS b/MAINTAINERS -index 9ed4d3868539..d83dd35d9f73 100644 +index 28e20975c26f5..5845f3dd0488d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15595,6 +15595,15 @@ T: git https://github.com/Paragon-Software-Group/linux-ntfs3.git +@@ -15721,6 +15721,15 @@ T: git https://github.com/Paragon-Software-Group/linux-ntfs3.git F: Documentation/filesystems/ntfs3.rst F: fs/ntfs3/ @@ -473,7 +477,7 @@ index 9ed4d3868539..d83dd35d9f73 100644 M: Finn Thain L: linux-m68k@lists.linux-m68k.org diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 4fb291f0bf7c..801ed229ed7d 100644 +index 4fb291f0bf7c8..801ed229ed7dc 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -506,6 +506,17 @@ config OPEN_DICE @@ -495,7 +499,7 @@ index 4fb291f0bf7c..801ed229ed7d 100644 tristate "Guest vCPU stall detector" depends on OF && HAS_IOMEM diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index ea6ea5bbbc9c..153a3f4837e8 100644 +index ea6ea5bbbc9c6..153a3f4837e8c 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -59,6 +59,7 @@ obj-$(CONFIG_PVPANIC) += pvpanic/ @@ -508,10 +512,10 @@ index ea6ea5bbbc9c..153a3f4837e8 100644 obj-$(CONFIG_GP_PCI1XXXX) += mchp_pci1xxxx/ diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c new file mode 100644 -index 000000000000..f54c81dada3d +index 0000000000000..87a24798a5c7b --- /dev/null +++ b/drivers/misc/ntsync.c -@@ -0,0 +1,1159 @@ +@@ -0,0 +1,1232 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * ntsync.c - Kernel driver for NT synchronization primitives @@ -527,6 +531,7 @@ index 000000000000..f54c81dada3d +#include +#include +#include ++#include +#include +#include +#include @@ -557,6 +562,7 @@ index 000000000000..f54c81dada3d + +struct ntsync_obj { + spinlock_t lock; ++ int dev_locked; + + enum ntsync_type type; + @@ -571,7 +577,7 @@ index 000000000000..f54c81dada3d + } sem; + struct { + __u32 count; -+ __u32 owner; ++ pid_t owner; + bool ownerdead; + } mutex; + struct { @@ -600,10 +606,6 @@ index 000000000000..f54c81dada3d + * Therefore we first check whether all_hint is zero, and, if it is, + * we skip trying to wake "all" waiters. + * -+ * This hint isn't protected by any lock. It might change during the -+ * course of a wake, but there's no meaningful race there; it's only a -+ * hint. -+ * + * Since wait requests must originate from user-space threads, we're + * limited here by PID_MAX_LIMIT, so there's no risk of overflow. + */ @@ -622,7 +624,7 @@ index 000000000000..f54c81dada3d + __u32 owner; + + /* -+ * Protected via atomic_cmpxchg(). Only the thread that wins the ++ * Protected via atomic_try_cmpxchg(). Only the thread that wins the + * compare-and-swap may actually change object states and wake this + * task. + */ @@ -641,19 +643,111 @@ index 000000000000..f54c81dada3d + * If one thread is trying to acquire several objects, another thread + * cannot touch the object at the same time. + * -+ * We achieve this by grabbing multiple object locks at the same time. -+ * However, this creates a lock ordering problem. To solve that problem, -+ * wait_all_lock is taken first whenever multiple objects must be locked -+ * at the same time. ++ * This device-wide lock is used to serialize wait-for-all ++ * operations, and operations on an object that is involved in a ++ * wait-for-all. + */ -+ spinlock_t wait_all_lock; ++ struct mutex wait_all_lock; + + struct file *file; +}; + ++/* ++ * Single objects are locked using obj->lock. ++ * ++ * Multiple objects are 'locked' while holding dev->wait_all_lock. ++ * In this case however, individual objects are not locked by holding ++ * obj->lock, but by setting obj->dev_locked. ++ * ++ * This means that in order to lock a single object, the sequence is slightly ++ * more complicated than usual. Specifically it needs to check obj->dev_locked ++ * after acquiring obj->lock, if set, it needs to drop the lock and acquire ++ * dev->wait_all_lock in order to serialize against the multi-object operation. ++ */ ++ ++static void dev_lock_obj(struct ntsync_device *dev, struct ntsync_obj *obj) ++{ ++ lockdep_assert_held(&dev->wait_all_lock); ++ lockdep_assert(obj->dev == dev); ++ spin_lock(&obj->lock); ++ /* ++ * By setting obj->dev_locked inside obj->lock, it is ensured that ++ * anyone holding obj->lock must see the value. ++ */ ++ obj->dev_locked = 1; ++ spin_unlock(&obj->lock); ++} ++ ++static void dev_unlock_obj(struct ntsync_device *dev, struct ntsync_obj *obj) ++{ ++ lockdep_assert_held(&dev->wait_all_lock); ++ lockdep_assert(obj->dev == dev); ++ spin_lock(&obj->lock); ++ obj->dev_locked = 0; ++ spin_unlock(&obj->lock); ++} ++ ++static void obj_lock(struct ntsync_obj *obj) ++{ ++ struct ntsync_device *dev = obj->dev; ++ ++ for (;;) { ++ spin_lock(&obj->lock); ++ if (likely(!obj->dev_locked)) ++ break; ++ ++ spin_unlock(&obj->lock); ++ mutex_lock(&dev->wait_all_lock); ++ spin_lock(&obj->lock); ++ /* ++ * obj->dev_locked should be set and released under the same ++ * wait_all_lock section, since we now own this lock, it should ++ * be clear. ++ */ ++ lockdep_assert(!obj->dev_locked); ++ spin_unlock(&obj->lock); ++ mutex_unlock(&dev->wait_all_lock); ++ } ++} ++ ++static void obj_unlock(struct ntsync_obj *obj) ++{ ++ spin_unlock(&obj->lock); ++} ++ ++static bool ntsync_lock_obj(struct ntsync_device *dev, struct ntsync_obj *obj) ++{ ++ bool all; ++ ++ obj_lock(obj); ++ all = atomic_read(&obj->all_hint); ++ if (unlikely(all)) { ++ obj_unlock(obj); ++ mutex_lock(&dev->wait_all_lock); ++ dev_lock_obj(dev, obj); ++ } ++ ++ return all; ++} ++ ++static void ntsync_unlock_obj(struct ntsync_device *dev, struct ntsync_obj *obj, bool all) ++{ ++ if (all) { ++ dev_unlock_obj(dev, obj); ++ mutex_unlock(&dev->wait_all_lock); ++ } else { ++ obj_unlock(obj); ++ } ++} ++ ++#define ntsync_assert_held(obj) \ ++ lockdep_assert((lockdep_is_held(&(obj)->lock) != LOCK_STATE_NOT_HELD) || \ ++ ((lockdep_is_held(&(obj)->dev->wait_all_lock) != LOCK_STATE_NOT_HELD) && \ ++ (obj)->dev_locked)) ++ +static bool is_signaled(struct ntsync_obj *obj, __u32 owner) +{ -+ lockdep_assert_held(&obj->lock); ++ ntsync_assert_held(obj); + + switch (obj->type) { + case NTSYNC_TYPE_SEM: @@ -680,15 +774,16 @@ index 000000000000..f54c81dada3d +{ + __u32 count = q->count; + bool can_wake = true; ++ int signaled = -1; + __u32 i; + + lockdep_assert_held(&dev->wait_all_lock); + if (locked_obj) -+ lockdep_assert_held(&locked_obj->lock); ++ lockdep_assert(locked_obj->dev_locked); + + for (i = 0; i < count; i++) { + if (q->entries[i].obj != locked_obj) -+ spin_lock_nest_lock(&q->entries[i].obj->lock, &dev->wait_all_lock); ++ dev_lock_obj(dev, q->entries[i].obj); + } + + for (i = 0; i < count; i++) { @@ -698,7 +793,7 @@ index 000000000000..f54c81dada3d + } + } + -+ if (can_wake && atomic_cmpxchg(&q->signaled, -1, 0) == -1) { ++ if (can_wake && atomic_try_cmpxchg(&q->signaled, &signaled, 0)) { + for (i = 0; i < count; i++) { + struct ntsync_obj *obj = q->entries[i].obj; + @@ -724,7 +819,7 @@ index 000000000000..f54c81dada3d + + for (i = 0; i < count; i++) { + if (q->entries[i].obj != locked_obj) -+ spin_unlock(&q->entries[i].obj->lock); ++ dev_unlock_obj(dev, q->entries[i].obj); + } +} + @@ -733,7 +828,7 @@ index 000000000000..f54c81dada3d + struct ntsync_q_entry *entry; + + lockdep_assert_held(&dev->wait_all_lock); -+ lockdep_assert_held(&obj->lock); ++ lockdep_assert(obj->dev_locked); + + list_for_each_entry(entry, &obj->all_waiters, node) + try_wake_all(dev, entry->q, obj); @@ -743,15 +838,17 @@ index 000000000000..f54c81dada3d +{ + struct ntsync_q_entry *entry; + -+ lockdep_assert_held(&sem->lock); ++ ntsync_assert_held(sem); ++ lockdep_assert(sem->type == NTSYNC_TYPE_SEM); + + list_for_each_entry(entry, &sem->any_waiters, node) { + struct ntsync_q *q = entry->q; ++ int signaled = -1; + + if (!sem->u.sem.count) + break; + -+ if (atomic_cmpxchg(&q->signaled, -1, entry->index) == -1) { ++ if (atomic_try_cmpxchg(&q->signaled, &signaled, entry->index)) { + sem->u.sem.count--; + wake_up_process(q->task); + } @@ -762,17 +859,19 @@ index 000000000000..f54c81dada3d +{ + struct ntsync_q_entry *entry; + -+ lockdep_assert_held(&mutex->lock); ++ ntsync_assert_held(mutex); ++ lockdep_assert(mutex->type == NTSYNC_TYPE_MUTEX); + + list_for_each_entry(entry, &mutex->any_waiters, node) { + struct ntsync_q *q = entry->q; ++ int signaled = -1; + + if (mutex->u.mutex.count == UINT_MAX) + break; + if (mutex->u.mutex.owner && mutex->u.mutex.owner != q->owner) + continue; + -+ if (atomic_cmpxchg(&q->signaled, -1, entry->index) == -1) { ++ if (atomic_try_cmpxchg(&q->signaled, &signaled, entry->index)) { + if (mutex->u.mutex.ownerdead) + q->ownerdead = true; + mutex->u.mutex.ownerdead = false; @@ -787,15 +886,17 @@ index 000000000000..f54c81dada3d +{ + struct ntsync_q_entry *entry; + -+ lockdep_assert_held(&event->lock); ++ ntsync_assert_held(event); ++ lockdep_assert(event->type == NTSYNC_TYPE_EVENT); + + list_for_each_entry(entry, &event->any_waiters, node) { + struct ntsync_q *q = entry->q; ++ int signaled = -1; + + if (!event->u.event.signaled) + break; + -+ if (atomic_cmpxchg(&q->signaled, -1, entry->index) == -1) { ++ if (atomic_try_cmpxchg(&q->signaled, &signaled, entry->index)) { + if (!event->u.event.manual) + event->u.event.signaled = false; + wake_up_process(q->task); @@ -811,7 +912,7 @@ index 000000000000..f54c81dada3d +{ + __u32 sum; + -+ lockdep_assert_held(&sem->lock); ++ ntsync_assert_held(sem); + + if (check_add_overflow(sem->u.sem.count, count, &sum) || + sum > sem->u.sem.max) @@ -827,6 +928,7 @@ index 000000000000..f54c81dada3d + __u32 __user *user_args = argp; + __u32 prev_count; + __u32 args; ++ bool all; + int ret; + + if (copy_from_user(&args, argp, sizeof(args))) @@ -835,30 +937,18 @@ index 000000000000..f54c81dada3d + if (sem->type != NTSYNC_TYPE_SEM) + return -EINVAL; + -+ if (atomic_read(&sem->all_hint) > 0) { -+ spin_lock(&dev->wait_all_lock); -+ spin_lock_nest_lock(&sem->lock, &dev->wait_all_lock); ++ all = ntsync_lock_obj(dev, sem); + -+ prev_count = sem->u.sem.count; -+ ret = post_sem_state(sem, args); -+ if (!ret) { ++ prev_count = sem->u.sem.count; ++ ret = post_sem_state(sem, args); ++ if (!ret) { ++ if (all) + try_wake_all_obj(dev, sem); -+ try_wake_any_sem(sem); -+ } -+ -+ spin_unlock(&sem->lock); -+ spin_unlock(&dev->wait_all_lock); -+ } else { -+ spin_lock(&sem->lock); -+ -+ prev_count = sem->u.sem.count; -+ ret = post_sem_state(sem, args); -+ if (!ret) -+ try_wake_any_sem(sem); -+ -+ spin_unlock(&sem->lock); ++ try_wake_any_sem(sem); + } + ++ ntsync_unlock_obj(dev, sem, all); ++ + if (!ret && put_user(prev_count, user_args)) + ret = -EFAULT; + @@ -871,7 +961,7 @@ index 000000000000..f54c81dada3d +static int unlock_mutex_state(struct ntsync_obj *mutex, + const struct ntsync_mutex_args *args) +{ -+ lockdep_assert_held(&mutex->lock); ++ ntsync_assert_held(mutex); + + if (mutex->u.mutex.owner != args->owner) + return -EPERM; @@ -887,6 +977,7 @@ index 000000000000..f54c81dada3d + struct ntsync_device *dev = mutex->dev; + struct ntsync_mutex_args args; + __u32 prev_count; ++ bool all; + int ret; + + if (copy_from_user(&args, argp, sizeof(args))) @@ -897,30 +988,18 @@ index 000000000000..f54c81dada3d + if (mutex->type != NTSYNC_TYPE_MUTEX) + return -EINVAL; + -+ if (atomic_read(&mutex->all_hint) > 0) { -+ spin_lock(&dev->wait_all_lock); -+ spin_lock_nest_lock(&mutex->lock, &dev->wait_all_lock); ++ all = ntsync_lock_obj(dev, mutex); + -+ prev_count = mutex->u.mutex.count; -+ ret = unlock_mutex_state(mutex, &args); -+ if (!ret) { ++ prev_count = mutex->u.mutex.count; ++ ret = unlock_mutex_state(mutex, &args); ++ if (!ret) { ++ if (all) + try_wake_all_obj(dev, mutex); -+ try_wake_any_mutex(mutex); -+ } -+ -+ spin_unlock(&mutex->lock); -+ spin_unlock(&dev->wait_all_lock); -+ } else { -+ spin_lock(&mutex->lock); -+ -+ prev_count = mutex->u.mutex.count; -+ ret = unlock_mutex_state(mutex, &args); -+ if (!ret) -+ try_wake_any_mutex(mutex); -+ -+ spin_unlock(&mutex->lock); ++ try_wake_any_mutex(mutex); + } + ++ ntsync_unlock_obj(dev, mutex, all); ++ + if (!ret && put_user(prev_count, &user_args->count)) + ret = -EFAULT; + @@ -933,7 +1012,7 @@ index 000000000000..f54c81dada3d + */ +static int kill_mutex_state(struct ntsync_obj *mutex, __u32 owner) +{ -+ lockdep_assert_held(&mutex->lock); ++ ntsync_assert_held(mutex); + + if (mutex->u.mutex.owner != owner) + return -EPERM; @@ -948,6 +1027,7 @@ index 000000000000..f54c81dada3d +{ + struct ntsync_device *dev = mutex->dev; + __u32 owner; ++ bool all; + int ret; + + if (get_user(owner, (__u32 __user *)argp)) @@ -958,28 +1038,17 @@ index 000000000000..f54c81dada3d + if (mutex->type != NTSYNC_TYPE_MUTEX) + return -EINVAL; + -+ if (atomic_read(&mutex->all_hint) > 0) { -+ spin_lock(&dev->wait_all_lock); -+ spin_lock_nest_lock(&mutex->lock, &dev->wait_all_lock); ++ all = ntsync_lock_obj(dev, mutex); + -+ ret = kill_mutex_state(mutex, owner); -+ if (!ret) { ++ ret = kill_mutex_state(mutex, owner); ++ if (!ret) { ++ if (all) + try_wake_all_obj(dev, mutex); -+ try_wake_any_mutex(mutex); -+ } -+ -+ spin_unlock(&mutex->lock); -+ spin_unlock(&dev->wait_all_lock); -+ } else { -+ spin_lock(&mutex->lock); -+ -+ ret = kill_mutex_state(mutex, owner); -+ if (!ret) -+ try_wake_any_mutex(mutex); -+ -+ spin_unlock(&mutex->lock); ++ try_wake_any_mutex(mutex); + } + ++ ntsync_unlock_obj(dev, mutex, all); ++ + return ret; +} + @@ -987,34 +1056,22 @@ index 000000000000..f54c81dada3d +{ + struct ntsync_device *dev = event->dev; + __u32 prev_state; ++ bool all; + + if (event->type != NTSYNC_TYPE_EVENT) + return -EINVAL; + -+ if (atomic_read(&event->all_hint) > 0) { -+ spin_lock(&dev->wait_all_lock); -+ spin_lock_nest_lock(&event->lock, &dev->wait_all_lock); ++ all = ntsync_lock_obj(dev, event); + -+ prev_state = event->u.event.signaled; -+ event->u.event.signaled = true; ++ prev_state = event->u.event.signaled; ++ event->u.event.signaled = true; ++ if (all) + try_wake_all_obj(dev, event); -+ try_wake_any_event(event); -+ if (pulse) -+ event->u.event.signaled = false; -+ -+ spin_unlock(&event->lock); -+ spin_unlock(&dev->wait_all_lock); -+ } else { -+ spin_lock(&event->lock); -+ -+ prev_state = event->u.event.signaled; -+ event->u.event.signaled = true; -+ try_wake_any_event(event); -+ if (pulse) -+ event->u.event.signaled = false; ++ try_wake_any_event(event); ++ if (pulse) ++ event->u.event.signaled = false; + -+ spin_unlock(&event->lock); -+ } ++ ntsync_unlock_obj(dev, event, all); + + if (put_user(prev_state, (__u32 __user *)argp)) + return -EFAULT; @@ -1024,17 +1081,19 @@ index 000000000000..f54c81dada3d + +static int ntsync_event_reset(struct ntsync_obj *event, void __user *argp) +{ ++ struct ntsync_device *dev = event->dev; + __u32 prev_state; ++ bool all; + + if (event->type != NTSYNC_TYPE_EVENT) + return -EINVAL; + -+ spin_lock(&event->lock); ++ all = ntsync_lock_obj(dev, event); + + prev_state = event->u.event.signaled; + event->u.event.signaled = false; + -+ spin_unlock(&event->lock); ++ ntsync_unlock_obj(dev, event, all); + + if (put_user(prev_state, (__u32 __user *)argp)) + return -EFAULT; @@ -1045,16 +1104,21 @@ index 000000000000..f54c81dada3d +static int ntsync_sem_read(struct ntsync_obj *sem, void __user *argp) +{ + struct ntsync_sem_args __user *user_args = argp; ++ struct ntsync_device *dev = sem->dev; + struct ntsync_sem_args args; ++ bool all; + + if (sem->type != NTSYNC_TYPE_SEM) + return -EINVAL; + + args.sem = 0; -+ spin_lock(&sem->lock); ++ ++ all = ntsync_lock_obj(dev, sem); ++ + args.count = sem->u.sem.count; + args.max = sem->u.sem.max; -+ spin_unlock(&sem->lock); ++ ++ ntsync_unlock_obj(dev, sem, all); + + if (copy_to_user(user_args, &args, sizeof(args))) + return -EFAULT; @@ -1064,18 +1128,23 @@ index 000000000000..f54c81dada3d +static int ntsync_mutex_read(struct ntsync_obj *mutex, void __user *argp) +{ + struct ntsync_mutex_args __user *user_args = argp; ++ struct ntsync_device *dev = mutex->dev; + struct ntsync_mutex_args args; ++ bool all; + int ret; + + if (mutex->type != NTSYNC_TYPE_MUTEX) + return -EINVAL; + + args.mutex = 0; -+ spin_lock(&mutex->lock); ++ ++ all = ntsync_lock_obj(dev, mutex); ++ + args.count = mutex->u.mutex.count; + args.owner = mutex->u.mutex.owner; + ret = mutex->u.mutex.ownerdead ? -EOWNERDEAD : 0; -+ spin_unlock(&mutex->lock); ++ ++ ntsync_unlock_obj(dev, mutex, all); + + if (copy_to_user(user_args, &args, sizeof(args))) + return -EFAULT; @@ -1085,16 +1154,21 @@ index 000000000000..f54c81dada3d +static int ntsync_event_read(struct ntsync_obj *event, void __user *argp) +{ + struct ntsync_event_args __user *user_args = argp; ++ struct ntsync_device *dev = event->dev; + struct ntsync_event_args args; ++ bool all; + + if (event->type != NTSYNC_TYPE_EVENT) + return -EINVAL; + + args.event = 0; -+ spin_lock(&event->lock); ++ ++ all = ntsync_lock_obj(dev, event); ++ + args.manual = event->u.event.manual; + args.signaled = event->u.event.signaled; -+ spin_unlock(&event->lock); ++ ++ ntsync_unlock_obj(dev, event, all); + + if (copy_to_user(user_args, &args, sizeof(args))) + return -EFAULT; @@ -1270,6 +1344,9 @@ index 000000000000..f54c81dada3d + struct file *file = fget(fd); + struct ntsync_obj *obj; + ++ if (!file) ++ return NULL; ++ + if (file->f_op != &ntsync_obj_fops) { + fput(file); + return NULL; @@ -1332,9 +1409,6 @@ index 000000000000..f54c81dada3d + __u32 total_count; + __u32 i, j; + -+ if (!args->owner) -+ return -EINVAL; -+ + if (args->pad || (args->flags & ~NTSYNC_WAIT_REALTIME)) + return -EINVAL; + @@ -1414,6 +1488,7 @@ index 000000000000..f54c81dada3d + __u32 i, total_count; + struct ntsync_q *q; + int signaled; ++ bool all; + int ret; + + if (copy_from_user(&args, argp, sizeof(args))) @@ -1433,9 +1508,9 @@ index 000000000000..f54c81dada3d + struct ntsync_q_entry *entry = &q->entries[i]; + struct ntsync_obj *obj = entry->obj; + -+ spin_lock(&obj->lock); ++ all = ntsync_lock_obj(dev, obj); + list_add_tail(&entry->node, &obj->any_waiters); -+ spin_unlock(&obj->lock); ++ ntsync_unlock_obj(dev, obj, all); + } + + /* @@ -1452,9 +1527,9 @@ index 000000000000..f54c81dada3d + if (atomic_read(&q->signaled) != -1) + break; + -+ spin_lock(&obj->lock); ++ all = ntsync_lock_obj(dev, obj); + try_wake_any_obj(obj); -+ spin_unlock(&obj->lock); ++ ntsync_unlock_obj(dev, obj, all); + } + + /* sleep */ @@ -1467,9 +1542,9 @@ index 000000000000..f54c81dada3d + struct ntsync_q_entry *entry = &q->entries[i]; + struct ntsync_obj *obj = entry->obj; + -+ spin_lock(&obj->lock); ++ all = ntsync_lock_obj(dev, obj); + list_del(&entry->node); -+ spin_unlock(&obj->lock); ++ ntsync_unlock_obj(dev, obj, all); + + put_obj(obj); + } @@ -1508,7 +1583,7 @@ index 000000000000..f54c81dada3d + + /* queue ourselves */ + -+ spin_lock(&dev->wait_all_lock); ++ mutex_lock(&dev->wait_all_lock); + + for (i = 0; i < args.count; i++) { + struct ntsync_q_entry *entry = &q->entries[i]; @@ -1527,16 +1602,16 @@ index 000000000000..f54c81dada3d + struct ntsync_q_entry *entry = &q->entries[args.count]; + struct ntsync_obj *obj = entry->obj; + -+ spin_lock_nest_lock(&obj->lock, &dev->wait_all_lock); ++ dev_lock_obj(dev, obj); + list_add_tail(&entry->node, &obj->any_waiters); -+ spin_unlock(&obj->lock); ++ dev_unlock_obj(dev, obj); + } + + /* check if we are already signaled */ + + try_wake_all(dev, q, NULL); + -+ spin_unlock(&dev->wait_all_lock); ++ mutex_unlock(&dev->wait_all_lock); + + /* + * Check if the alert event is signaled, making sure to do so only @@ -1547,9 +1622,9 @@ index 000000000000..f54c81dada3d + struct ntsync_obj *obj = q->entries[args.count].obj; + + if (atomic_read(&q->signaled) == -1) { -+ spin_lock(&obj->lock); ++ bool all = ntsync_lock_obj(dev, obj); + try_wake_any_obj(obj); -+ spin_unlock(&obj->lock); ++ ntsync_unlock_obj(dev, obj, all); + } + } + @@ -1559,7 +1634,7 @@ index 000000000000..f54c81dada3d + + /* and finally, unqueue */ + -+ spin_lock(&dev->wait_all_lock); ++ mutex_lock(&dev->wait_all_lock); + + for (i = 0; i < args.count; i++) { + struct ntsync_q_entry *entry = &q->entries[i]; @@ -1575,19 +1650,21 @@ index 000000000000..f54c81dada3d + + put_obj(obj); + } ++ ++ mutex_unlock(&dev->wait_all_lock); ++ + if (args.alert) { + struct ntsync_q_entry *entry = &q->entries[args.count]; + struct ntsync_obj *obj = entry->obj; ++ bool all; + -+ spin_lock_nest_lock(&obj->lock, &dev->wait_all_lock); ++ all = ntsync_lock_obj(dev, obj); + list_del(&entry->node); -+ spin_unlock(&obj->lock); ++ ntsync_unlock_obj(dev, obj, all); + + put_obj(obj); + } + -+ spin_unlock(&dev->wait_all_lock); -+ + signaled = atomic_read(&q->signaled); + if (signaled != -1) { + struct ntsync_wait_args __user *user_args = argp; @@ -1613,7 +1690,7 @@ index 000000000000..f54c81dada3d + if (!dev) + return -ENOMEM; + -+ spin_lock_init(&dev->wait_all_lock); ++ mutex_init(&dev->wait_all_lock); + + file->private_data = dev; + dev->file = file; @@ -1673,7 +1750,7 @@ index 000000000000..f54c81dada3d +MODULE_LICENSE("GPL"); diff --git a/include/uapi/linux/ntsync.h b/include/uapi/linux/ntsync.h new file mode 100644 -index 000000000000..b5e835d8dba8 +index 0000000000000..4a8095a3fc34c --- /dev/null +++ b/include/uapi/linux/ntsync.h @@ -0,0 +1,62 @@ @@ -1713,10 +1790,10 @@ index 000000000000..b5e835d8dba8 + __u64 timeout; + __u64 objs; + __u32 count; -+ __u32 owner; + __u32 index; -+ __u32 alert; + __u32 flags; ++ __u32 owner; ++ __u32 alert; + __u32 pad; +}; + @@ -1740,41 +1817,47 @@ index 000000000000..b5e835d8dba8 + +#endif diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile -index 15b6a111c3be..6c714a4e6478 100644 +index e1504833654db..6f95206325e1f 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile -@@ -15,6 +15,7 @@ TARGETS += cpu-hotplug - TARGETS += damon +@@ -16,6 +16,7 @@ TARGETS += damon + TARGETS += devices TARGETS += dmabuf-heaps TARGETS += drivers/dma-buf +TARGETS += drivers/ntsync TARGETS += drivers/s390x/uvdevice TARGETS += drivers/net/bonding TARGETS += drivers/net/team +diff --git a/tools/testing/selftests/drivers/ntsync/.gitignore b/tools/testing/selftests/drivers/ntsync/.gitignore +new file mode 100644 +index 0000000000000..848573a3d3eaf +--- /dev/null ++++ b/tools/testing/selftests/drivers/ntsync/.gitignore +@@ -0,0 +1 @@ ++ntsync diff --git a/tools/testing/selftests/drivers/ntsync/Makefile b/tools/testing/selftests/drivers/ntsync/Makefile new file mode 100644 -index 000000000000..a34da5ccacf0 +index 0000000000000..dbf2b055c0b28 --- /dev/null +++ b/tools/testing/selftests/drivers/ntsync/Makefile -@@ -0,0 +1,8 @@ +@@ -0,0 +1,7 @@ +# SPDX-LICENSE-IDENTIFIER: GPL-2.0-only +TEST_GEN_PROGS := ntsync + -+top_srcdir =../../../../.. -+CFLAGS += -I$(top_srcdir)/usr/include ++CFLAGS += $(KHDR_INCLUDES) +LDLIBS += -lpthread + +include ../../lib.mk diff --git a/tools/testing/selftests/drivers/ntsync/config b/tools/testing/selftests/drivers/ntsync/config new file mode 100644 -index 000000000000..60539c826d06 +index 0000000000000..60539c826d062 --- /dev/null +++ b/tools/testing/selftests/drivers/ntsync/config @@ -0,0 +1 @@ +CONFIG_WINESYNC=y diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testing/selftests/drivers/ntsync/ntsync.c new file mode 100644 -index 000000000000..5fa2c9a0768c +index 0000000000000..5fa2c9a0768c0 --- /dev/null +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c @@ -0,0 +1,1407 @@ @@ -3185,3 +3268,6 @@ index 000000000000..5fa2c9a0768c +} + +TEST_HARNESS_MAIN +-- +2.45.2 + diff --git a/SOURCES/Patchlist.changelog b/SOURCES/Patchlist.changelog index 783f3c4..1ad8a76 100644 --- a/SOURCES/Patchlist.changelog +++ b/SOURCES/Patchlist.changelog @@ -1,123 +1,93 @@ -"https://gitlab.com/cki-project/kernel-ark/-/commit"/8accb0715306213277b8e86c3a53f62c7e63ac6b - 8accb0715306213277b8e86c3a53f62c7e63ac6b sunrpc: use the struct net as the svc proc private +https://gitlab.com/cki-project/kernel-ark/-/commit/a058bf42a79af81598f7404ad550ff677eb2be4d + a058bf42a79af81598f7404ad550ff677eb2be4d lsm: update security_lock_kernel_down -"https://gitlab.com/cki-project/kernel-ark/-/commit"/bc8a66a7f9a128ef3c0c52c8ffbb1edfdc965a0c - bc8a66a7f9a128ef3c0c52c8ffbb1edfdc965a0c Reapply "drm/qxl: simplify qxl_fence_wait" +https://gitlab.com/cki-project/kernel-ark/-/commit/c1cadf2e615cbb9af6b7f9edde762b1d3dea9c0c + c1cadf2e615cbb9af6b7f9edde762b1d3dea9c0c random: replace import_single_range() with import_ubuf() -"https://gitlab.com/cki-project/kernel-ark/-/commit"/18bb30c3fa125866e460064fcb8779ec08197a2b - 18bb30c3fa125866e460064fcb8779ec08197a2b e1000e: change usleep_range to udelay in PHY mdic access +https://gitlab.com/cki-project/kernel-ark/-/commit/3700812249f29081392b820339445a1d801092b5 + 3700812249f29081392b820339445a1d801092b5 crypto: rng - Override drivers/char/random in FIPS mode -"https://gitlab.com/cki-project/kernel-ark/-/commit"/21b019ce62997d78fe5e42f4a04b64cd9d9b11b8 - 21b019ce62997d78fe5e42f4a04b64cd9d9b11b8 drm/nouveau/dp: Don't probe eDP ports twice harder +https://gitlab.com/cki-project/kernel-ark/-/commit/38603aa6f9160a2a2672c1eabd3824912b9138f4 + 38603aa6f9160a2a2672c1eabd3824912b9138f4 random: Add hook to override device reads and getrandom(2) -"https://gitlab.com/cki-project/kernel-ark/-/commit"/fb6f1f07d22bc6bac44c87e7623cf252e8c57473 - fb6f1f07d22bc6bac44c87e7623cf252e8c57473 drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports +https://gitlab.com/cki-project/kernel-ark/-/commit/adcfffd16fe8e29ea3d89dae57d2ba2f7dce15a6 + adcfffd16fe8e29ea3d89dae57d2ba2f7dce15a6 scsi: sd: Add "probe_type" module parameter to allow synchronous probing -"https://gitlab.com/cki-project/kernel-ark/-/commit"/5122018da124756713dfe49cad50a7653ade7bf0 - 5122018da124756713dfe49cad50a7653ade7bf0 drm/dp: Don't attempt AUX transfers when eDP panels are not powered +https://gitlab.com/cki-project/kernel-ark/-/commit/a40f874c560bfdca05a43033f0da5892e07c0717 + a40f874c560bfdca05a43033f0da5892e07c0717 Revert "Remove EXPERT from ARCH_FORCE_MAX_ORDER for aarch64" -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e56840b5f971b4d0f4032f6f5ab95c0c5ba40f8e - e56840b5f971b4d0f4032f6f5ab95c0c5ba40f8e nouveau: fix devinit paths to only handle display on GSP. +https://gitlab.com/cki-project/kernel-ark/-/commit/af64073bd494d1b47c287fc0108ba96a35d0367b + af64073bd494d1b47c287fc0108ba96a35d0367b Remove EXPERT from ARCH_FORCE_MAX_ORDER for aarch64 -"https://gitlab.com/cki-project/kernel-ark/-/commit"/252ea3336f8ee7551675d82e1899125aa6e730b6 - 252ea3336f8ee7551675d82e1899125aa6e730b6 Bluetooth: l2cap: Don't double set the HCI_CONN_MGMT_CONNECTED bit +https://gitlab.com/cki-project/kernel-ark/-/commit/b1f7767cb10f5580f27a85879af827211582240d + b1f7767cb10f5580f27a85879af827211582240d redhat: version two of Makefile.rhelver tweaks -"https://gitlab.com/cki-project/kernel-ark/-/commit"/9ba38d5f5c49d3f4a9e429d05aa73cb397db5071 - 9ba38d5f5c49d3f4a9e429d05aa73cb397db5071 Revert "Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT" +https://gitlab.com/cki-project/kernel-ark/-/commit/982f7106d82a1e440cbcd67ce63d7ce7cd50e5e5 + 982f7106d82a1e440cbcd67ce63d7ce7cd50e5e5 redhat: adapt to upstream Makefile change -"https://gitlab.com/cki-project/kernel-ark/-/commit"/fccd579ad79c032dd402f674fd94e80ad52519f6 - fccd579ad79c032dd402f674fd94e80ad52519f6 xfs: fix SEEK_HOLE/DATA for regions with active COW extents +https://gitlab.com/cki-project/kernel-ark/-/commit/e3f67e0f1b929889e65bbfe5fb95b5a1fa0be860 + e3f67e0f1b929889e65bbfe5fb95b5a1fa0be860 Change acpi_bus_get_acpi_device to acpi_get_acpi_dev -"https://gitlab.com/cki-project/kernel-ark/-/commit"/43f3e284f6c98c0cb6133ac90e0b4bba02975053 - 43f3e284f6c98c0cb6133ac90e0b4bba02975053 drivers/firmware: skip simpledrm if nvidia-drm.modeset=1 is set +https://gitlab.com/cki-project/kernel-ark/-/commit/f4cf25715646744728f260cbd557200859531f45 + f4cf25715646744728f260cbd557200859531f45 REDHAT: coresight: etm4x: Disable coresight on HPE Apollo 70 -"https://gitlab.com/cki-project/kernel-ark/-/commit"/6a6428d08805f225c5425fc7c2b3c093267cb206 - 6a6428d08805f225c5425fc7c2b3c093267cb206 drm/amd: Flush GFXOFF requests in prepare stage +https://gitlab.com/cki-project/kernel-ark/-/commit/972bc4c647a0fd5e77b16cb5961acf33779cd85e + 972bc4c647a0fd5e77b16cb5961acf33779cd85e KEYS: Make use of platform keyring for module signature verify -"https://gitlab.com/cki-project/kernel-ark/-/commit"/bbd16c78228ab6d4515fc98bd574a9a213e9428c - bbd16c78228ab6d4515fc98bd574a9a213e9428c scsi: sd: Add "probe_type" module parameter to allow synchronous probing +https://gitlab.com/cki-project/kernel-ark/-/commit/a81bc7d379eec8d7d656a214c5d61b766da600f3 + a81bc7d379eec8d7d656a214c5d61b766da600f3 Input: rmi4 - remove the need for artificial IRQ in case of HID -"https://gitlab.com/cki-project/kernel-ark/-/commit"/4ba4ea03ce77743ecaafe073c13ee9104c8ca035 - 4ba4ea03ce77743ecaafe073c13ee9104c8ca035 Enable IO_URING for RHEL +https://gitlab.com/cki-project/kernel-ark/-/commit/75e64275d4826f21b0a52a0bc502fc45409dd162 + 75e64275d4826f21b0a52a0bc502fc45409dd162 ARM: tegra: usb no reset -"https://gitlab.com/cki-project/kernel-ark/-/commit"/0cf9bb0b41288aab528f3fbf4086d0c76ce88173 - 0cf9bb0b41288aab528f3fbf4086d0c76ce88173 redhat: version two of Makefile.rhelver tweaks +https://gitlab.com/cki-project/kernel-ark/-/commit/bd8667dc26d8e02a694bd16410cf3ff98a12dd33 + bd8667dc26d8e02a694bd16410cf3ff98a12dd33 s390: Lock down the kernel when the IPL secure flag is set -"https://gitlab.com/cki-project/kernel-ark/-/commit"/1ca4785aeb44058d4e5acb99e16be613bf37926a - 1ca4785aeb44058d4e5acb99e16be613bf37926a redhat: adapt to upstream Makefile change +https://gitlab.com/cki-project/kernel-ark/-/commit/eb4d5c8c36cda70fb6d202ffc02e1e88bd9cfbfb + eb4d5c8c36cda70fb6d202ffc02e1e88bd9cfbfb efi: Lock down the kernel if booted in secure boot mode -"https://gitlab.com/cki-project/kernel-ark/-/commit"/14831277fd82f7f62df986976a4edadef9e43b87 - 14831277fd82f7f62df986976a4edadef9e43b87 Change acpi_bus_get_acpi_device to acpi_get_acpi_dev +https://gitlab.com/cki-project/kernel-ark/-/commit/f4ba6bed48d0f4fcb4cedc79d0328e4423f82b32 + f4ba6bed48d0f4fcb4cedc79d0328e4423f82b32 efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode -"https://gitlab.com/cki-project/kernel-ark/-/commit"/69c26425cb8ae9147be185a3ba413b79ac8c4f8f - 69c26425cb8ae9147be185a3ba413b79ac8c4f8f RHEL: disable io_uring support +https://gitlab.com/cki-project/kernel-ark/-/commit/491147cb07452a185d4a45ac5eacda5e1610269f + 491147cb07452a185d4a45ac5eacda5e1610269f security: lockdown: expose a hook to lock the kernel down -"https://gitlab.com/cki-project/kernel-ark/-/commit"/08e9f18744a7a0b5bc84c919ec105fb99d9d2fde - 08e9f18744a7a0b5bc84c919ec105fb99d9d2fde REDHAT: coresight: etm4x: Disable coresight on HPE Apollo 70 +https://gitlab.com/cki-project/kernel-ark/-/commit/23a6deaae098060905cd45e10bf76623e6780b0c + 23a6deaae098060905cd45e10bf76623e6780b0c Make get_cert_list() use efi_status_to_str() to print error messages. -"https://gitlab.com/cki-project/kernel-ark/-/commit"/42d31ca68d9fbb52bff28197a7e696ea30c3035f - 42d31ca68d9fbb52bff28197a7e696ea30c3035f KEYS: Make use of platform keyring for module signature verify +https://gitlab.com/cki-project/kernel-ark/-/commit/d4b0376586d603bbb8645df9765307d1e41a5873 + d4b0376586d603bbb8645df9765307d1e41a5873 Add efi_status_to_str() and rework efi_status_to_err(). -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e67e74e3dffef6782558be57c8d72dfdd0ac8cbc - e67e74e3dffef6782558be57c8d72dfdd0ac8cbc Input: rmi4 - remove the need for artificial IRQ in case of HID +https://gitlab.com/cki-project/kernel-ark/-/commit/a503547abadf03a34b2e0ca68006e21500dff7d0 + a503547abadf03a34b2e0ca68006e21500dff7d0 iommu/arm-smmu: workaround DMA mode issues -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e1bb15a36310bb1ee3efe393aee787b0a4e5da68 - e1bb15a36310bb1ee3efe393aee787b0a4e5da68 ARM: tegra: usb no reset +https://gitlab.com/cki-project/kernel-ark/-/commit/c71c74bfaad1f6416f0f381abd64763ad2561669 + c71c74bfaad1f6416f0f381abd64763ad2561669 ipmi: do not configure ipmi for HPE m400 -"https://gitlab.com/cki-project/kernel-ark/-/commit"/7fd47518d3f5b3cde52cc7f69cfa23c8d9dd9694 - 7fd47518d3f5b3cde52cc7f69cfa23c8d9dd9694 s390: Lock down the kernel when the IPL secure flag is set +https://gitlab.com/cki-project/kernel-ark/-/commit/68825f508efb8b68ece87efce84927b61f2f8421 + 68825f508efb8b68ece87efce84927b61f2f8421 ahci: thunderx2: Fix for errata that affects stop engine -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e194067631100a35dff56c22c932275cd8f5117a - e194067631100a35dff56c22c932275cd8f5117a efi: Lock down the kernel if booted in secure boot mode +https://gitlab.com/cki-project/kernel-ark/-/commit/d9e09cccc36eb88ea94f7012af07fe90b5ae7148 + d9e09cccc36eb88ea94f7012af07fe90b5ae7148 Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon -"https://gitlab.com/cki-project/kernel-ark/-/commit"/05eb3ce5832f61fe1179f97df1edaae7756845e0 - 05eb3ce5832f61fe1179f97df1edaae7756845e0 efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode +https://gitlab.com/cki-project/kernel-ark/-/commit/0f80caf1384053933abbed494860f4382785a559 + 0f80caf1384053933abbed494860f4382785a559 tags.sh: Ignore redhat/rpm -"https://gitlab.com/cki-project/kernel-ark/-/commit"/011d5de9e72565b4907691ca680f7acff3883301 - 011d5de9e72565b4907691ca680f7acff3883301 security: lockdown: expose a hook to lock the kernel down +https://gitlab.com/cki-project/kernel-ark/-/commit/79fb8fec7b0127a8c0c3c0ff3639f69d8df95ced + 79fb8fec7b0127a8c0c3c0ff3639f69d8df95ced aarch64: acpi scan: Fix regression related to X-Gene UARTs -"https://gitlab.com/cki-project/kernel-ark/-/commit"/35aba3c9b506369a785ee7e921250794467c7e76 - 35aba3c9b506369a785ee7e921250794467c7e76 Make get_cert_list() use efi_status_to_str() to print error messages. +https://gitlab.com/cki-project/kernel-ark/-/commit/92c71a695476a9dceedba19c80426b04212e83e1 + 92c71a695476a9dceedba19c80426b04212e83e1 ACPI / irq: Workaround firmware issue on X-Gene based m400 -"https://gitlab.com/cki-project/kernel-ark/-/commit"/45587f041c409279acf4277c952a7e254e2c86c4 - 45587f041c409279acf4277c952a7e254e2c86c4 Add efi_status_to_str() and rework efi_status_to_err(). +https://gitlab.com/cki-project/kernel-ark/-/commit/271b9d1c79a8f8bdd0be002164fb26197d8f97c7 + 271b9d1c79a8f8bdd0be002164fb26197d8f97c7 ACPI: APEI: arm64: Ignore broken HPE moonshot APEI support -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e8784fbb8ae25ee646dacdfa6d5c42ae0427b9f3 - e8784fbb8ae25ee646dacdfa6d5c42ae0427b9f3 iommu/arm-smmu: workaround DMA mode issues +https://gitlab.com/cki-project/kernel-ark/-/commit/0ffa30e9c57ac3ba7541a4f8de93529261057492 + 0ffa30e9c57ac3ba7541a4f8de93529261057492 Introduce CONFIG_RH_DISABLE_DEPRECATED -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e97750f18aac0903b827a11a2d0eca473c207082 - e97750f18aac0903b827a11a2d0eca473c207082 ipmi: do not configure ipmi for HPE m400 +https://gitlab.com/cki-project/kernel-ark/-/commit/a37d01ec36990daa364c76348e2943abc990fb80 + a37d01ec36990daa364c76348e2943abc990fb80 Pull the RHEL version defines out of the Makefile -"https://gitlab.com/cki-project/kernel-ark/-/commit"/d8dae8587fc775f80a6894f7dc0c3148f1000bb6 - d8dae8587fc775f80a6894f7dc0c3148f1000bb6 kABI: Add generic kABI macros to use for kABI workarounds - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/6061cfe2ed054bd0cde8d694c8099f2747820e69 - 6061cfe2ed054bd0cde8d694c8099f2747820e69 ahci: thunderx2: Fix for errata that affects stop engine - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/19144aca889ee46ca25f3f14266735cbe5de8a06 - 19144aca889ee46ca25f3f14266735cbe5de8a06 Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e7f519e5398d0dd661b41de5c73c1c099f831829 - e7f519e5398d0dd661b41de5c73c1c099f831829 tags.sh: Ignore redhat/rpm - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/8065810fdf3486d1df4c6e887043f4c05fbb40c5 - 8065810fdf3486d1df4c6e887043f4c05fbb40c5 put RHEL info into generated headers - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/a9a02e615b01548ef1472364bc0c924ec9e24ea6 - a9a02e615b01548ef1472364bc0c924ec9e24ea6 aarch64: acpi scan: Fix regression related to X-Gene UARTs - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/20aab9c5cf6c185848dad3b2680365e592060fe3 - 20aab9c5cf6c185848dad3b2680365e592060fe3 ACPI / irq: Workaround firmware issue on X-Gene based m400 - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/dea39bf98ce0a5d43c19762bfb73fef4c1ecc04a - dea39bf98ce0a5d43c19762bfb73fef4c1ecc04a modules: add rhelversion MODULE_INFO tag - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/2600fc4c9eae94ae27a1db2e97f48c57981ddc3a - 2600fc4c9eae94ae27a1db2e97f48c57981ddc3a ACPI: APEI: arm64: Ignore broken HPE moonshot APEI support - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/e74a567e42d4f275a7e2fc18dac9c69990faa6fa - e74a567e42d4f275a7e2fc18dac9c69990faa6fa Pull the RHEL version defines out of the Makefile - -"https://gitlab.com/cki-project/kernel-ark/-/commit"/b3c3c4bbd0be73161abaa6279b81a01329db8c56 - b3c3c4bbd0be73161abaa6279b81a01329db8c56 [initial commit] Add Red Hat variables in the top level makefile +https://gitlab.com/cki-project/kernel-ark/-/commit/4263a1d58a8680d200652698c52a0d77d25a50d3 + 4263a1d58a8680d200652698c52a0d77d25a50d3 [initial commit] Add Red Hat variables in the top level makefile diff --git a/SOURCES/amdgpu-ignore-min-pcap.patch b/SOURCES/amdgpu-ignore-min-pcap.patch index 11ab34f..e067f7c 100644 --- a/SOURCES/amdgpu-ignore-min-pcap.patch +++ b/SOURCES/amdgpu-ignore-min-pcap.patch @@ -1,3 +1,16 @@ +From 2fd82fbebecfe8afbfb76cf918039ef1aa9fd494 Mon Sep 17 00:00:00 2001 +From: Steven Barrett +Date: Fri, 15 Mar 2024 12:36:51 -0500 +Subject: [PATCH] Cachy: drm/amdgpu/pm: Allow override of min_power_limit with + ignore_min_pcap + +--- + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++ + drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 +++ + drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++++++++++-- + 4 files changed, 26 insertions(+), 2 deletions(-) + diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 50f57d4dfd8f..b83697b75221 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h diff --git a/SOURCES/amdgpu-si-cik-default.patch b/SOURCES/amdgpu-si-cik-default.patch index d2d3178..ec3735d 100644 --- a/SOURCES/amdgpu-si-cik-default.patch +++ b/SOURCES/amdgpu-si-cik-default.patch @@ -13,32 +13,32 @@ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgp index 81edf66dbea8..5021d03089ff 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -@@ -582,13 +582,8 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644); +@@ -595,13 +595,8 @@ */ #ifdef CONFIG_DRM_AMDGPU_SI - + -#if IS_ENABLED(CONFIG_DRM_RADEON) || IS_ENABLED(CONFIG_DRM_RADEON_MODULE) --int amdgpu_si_support = 0; +-int amdgpu_si_support; -MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))"); -#else int amdgpu_si_support = 1; MODULE_PARM_DESC(si_support, "SI support (1 = enabled (default), 0 = disabled)"); -#endif - + module_param_named(si_support, amdgpu_si_support, int, 0444); #endif -@@ -601,13 +596,8 @@ module_param_named(si_support, amdgpu_si_support, int, 0444); +@@ -614,13 +609,8 @@ */ #ifdef CONFIG_DRM_AMDGPU_CIK - + -#if IS_ENABLED(CONFIG_DRM_RADEON) || IS_ENABLED(CONFIG_DRM_RADEON_MODULE) --int amdgpu_cik_support = 0; +-int amdgpu_cik_support; -MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))"); -#else int amdgpu_cik_support = 1; MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)"); -#endif - + module_param_named(cik_support, amdgpu_cik_support, int, 0444); #endif diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c diff --git a/SOURCES/cachy-bore.patch b/SOURCES/cachy-bore.patch index 4437383..9f0fcc4 100644 --- a/SOURCES/cachy-bore.patch +++ b/SOURCES/cachy-bore.patch @@ -1,9 +1,9 @@ -From eadef3d0f478dc82de92a71a2a5c9cd1874ea4e8 Mon Sep 17 00:00:00 2001 -From: Piotr Gorski -Date: Mon, 29 Apr 2024 21:26:00 +0200 +From 61efc6f62710e42ca623e209f901394d4f356cc9 Mon Sep 17 00:00:00 2001 +From: Peter Jung +Date: Thu, 30 May 2024 10:45:04 +0200 Subject: [PATCH] bore -Signed-off-by: Piotr Gorski +Signed-off-by: Peter Jung --- include/linux/sched.h | 10 ++ init/Kconfig | 17 +++ @@ -15,7 +15,7 @@ Signed-off-by: Piotr Gorski 7 files changed, 512 insertions(+), 17 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h -index ffe8f618a..0ab0b0424 100644 +index 3c2abbc587b49..e7bf3a034aa20 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -547,6 +547,16 @@ struct sched_entity { @@ -36,7 +36,7 @@ index ffe8f618a..0ab0b0424 100644 u64 slice; diff --git a/init/Kconfig b/init/Kconfig -index c8a155cf7..874bd0158 100644 +index 664bedb9a71fb..6f9c7fc90707a 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1279,6 +1279,23 @@ config CHECKPOINT_RESTORE @@ -64,10 +64,10 @@ index c8a155cf7..874bd0158 100644 bool "Automatic process group scheduling" select CGROUPS diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 9116bcc90..a38919fe8 100644 +index d211d40a2edc9..362df741dc85e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4507,6 +4507,138 @@ int wake_up_state(struct task_struct *p, unsigned int state) +@@ -4516,6 +4516,138 @@ int wake_up_state(struct task_struct *p, unsigned int state) return try_to_wake_up(p, state, 0); } @@ -206,7 +206,7 @@ index 9116bcc90..a38919fe8 100644 /* * Perform scheduler related setup for a newly forked process p. * p is forked by current. -@@ -4523,6 +4655,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) +@@ -4532,6 +4664,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) p->se.prev_sum_exec_runtime = 0; p->se.nr_migrations = 0; p->se.vruntime = 0; @@ -216,7 +216,7 @@ index 9116bcc90..a38919fe8 100644 p->se.vlag = 0; p->se.slice = sysctl_sched_base_slice; INIT_LIST_HEAD(&p->se.group_node); -@@ -4839,6 +4974,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs) +@@ -4848,6 +4983,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs) void sched_post_fork(struct task_struct *p) { @@ -226,7 +226,7 @@ index 9116bcc90..a38919fe8 100644 uclamp_post_fork(p); } -@@ -9910,6 +10048,11 @@ void __init sched_init(void) +@@ -9931,6 +10069,11 @@ void __init sched_init(void) BUG_ON(&dl_sched_class != &stop_sched_class + 1); #endif @@ -239,7 +239,7 @@ index 9116bcc90..a38919fe8 100644 #ifdef CONFIG_FAIR_GROUP_SCHED diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c -index 8d5d98a58..b17861261 100644 +index 8d5d98a5834df..b1786126171e9 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -167,7 +167,52 @@ static const struct file_operations sched_feat_fops = { @@ -346,7 +346,7 @@ index 8d5d98a58..b17861261 100644 P(se.avg.runnable_sum); P(se.avg.util_sum); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index aee5e7a70..d6824d030 100644 +index 213c94d027a4c..3c2d149d0235d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -19,6 +19,9 @@ @@ -695,7 +695,7 @@ index aee5e7a70..d6824d030 100644 update_deadline(cfs_rq, curr); update_min_vruntime(cfs_rq); -@@ -5177,6 +5399,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) +@@ -5183,6 +5405,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) * * EEVDF: placement strategy #1 / #2 */ @@ -705,7 +705,7 @@ index aee5e7a70..d6824d030 100644 if (sched_feat(PLACE_LAG) && cfs_rq->nr_running) { struct sched_entity *curr = cfs_rq->curr; unsigned long load; -@@ -5466,7 +5691,7 @@ pick_next_entity(struct cfs_rq *cfs_rq) +@@ -5472,7 +5697,7 @@ pick_next_entity(struct cfs_rq *cfs_rq) cfs_rq->next && entity_eligible(cfs_rq, cfs_rq->next)) return cfs_rq->next; @@ -714,7 +714,7 @@ index aee5e7a70..d6824d030 100644 } static bool check_cfs_rq_runtime(struct cfs_rq *cfs_rq); -@@ -6809,6 +7034,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) +@@ -6835,6 +7060,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) bool was_sched_idle = sched_idle_rq(rq); util_est_dequeue(&rq->cfs, p); @@ -729,7 +729,7 @@ index aee5e7a70..d6824d030 100644 for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); -@@ -8343,10 +8576,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int +@@ -8369,10 +8602,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int cfs_rq = cfs_rq_of(se); update_curr(cfs_rq); @@ -741,7 +741,7 @@ index aee5e7a70..d6824d030 100644 goto preempt; return; -@@ -8564,16 +8794,25 @@ static void yield_task_fair(struct rq *rq) +@@ -8590,16 +8820,25 @@ static void yield_task_fair(struct rq *rq) /* * Are we the only task in the tree? */ @@ -767,7 +767,7 @@ index aee5e7a70..d6824d030 100644 /* * Tell update_rq_clock() that we've just updated, * so we don't do microscopic update in schedule() -@@ -12663,6 +12902,9 @@ static void task_fork_fair(struct task_struct *p) +@@ -12660,6 +12899,9 @@ static void task_fork_fair(struct task_struct *p) curr = cfs_rq->curr; if (curr) update_curr(cfs_rq); @@ -778,7 +778,7 @@ index aee5e7a70..d6824d030 100644 rq_unlock(rq, &rf); } diff --git a/kernel/sched/features.h b/kernel/sched/features.h -index 143f55df8..bfeb9f653 100644 +index 143f55df890b1..bfeb9f65383d9 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -5,8 +5,26 @@ @@ -810,7 +810,7 @@ index 143f55df8..bfeb9f653 100644 /* * Prefer to schedule the task we woke last (assuming it failed diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index 8c817d0a9..05c0a1157 100644 +index ae50f212775e5..8c976d27f6e9c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1967,7 +1967,11 @@ static inline void dirty_sched_domain_sysctl(int cpu) @@ -836,5 +836,5 @@ index 8c817d0a9..05c0a1157 100644 #ifdef CONFIG_SCHED_DEBUG extern int sysctl_resched_latency_warn_ms; -- -2.44.0.325.g11c821f2f2 +2.45.1 diff --git a/SOURCES/check-kabi b/SOURCES/check-kabi index 3809209..f9d4dcb 100755 --- a/SOURCES/check-kabi +++ b/SOURCES/check-kabi @@ -41,8 +41,7 @@ def load_symvers(symvers, filename): break if in_line == "\n": continue - checksum, symbol, directory, type, *ns = in_line.split() - ns = ns[0] if ns else None + checksum, symbol, directory, type = in_line.split() symvers[symbol] = in_line[0:-1] @@ -58,8 +57,7 @@ def load_kabi(kabi, filename): break if in_line == "\n": continue - checksum, symbol, directory, type, *ns = in_line.split() - ns = ns[0] if ns else None + checksum, symbol, directory, type = in_line.split() kabi[symbol] = in_line[0:-1] @@ -71,14 +69,11 @@ def check_kabi(symvers, kabi): warn = 0 changed_symbols = [] moved_symbols = [] - ns_symbols = [] for symbol in kabi: - abi_hash, abi_sym, abi_dir, abi_type, *abi_ns = kabi[symbol].split() - abi_ns = abi_ns[0] if abi_ns else None + abi_hash, abi_sym, abi_dir, abi_type = kabi[symbol].split() if symbol in symvers: - sym_hash, sym_sym, sym_dir, sym_type, *sym_ns = symvers[symbol].split() - sym_ns = sym_ns[0] if sym_ns else None + sym_hash, sym_sym, sym_dir, sym_type = symvers[symbol].split() if abi_hash != sym_hash: fail = 1 changed_symbols.append(symbol) @@ -86,10 +81,6 @@ def check_kabi(symvers, kabi): if abi_dir != sym_dir: warn = 1 moved_symbols.append(symbol) - - if abi_ns != sym_ns: - warn = 1 - ns_symbols.append(symbol) else: fail = 1 changed_symbols.append(symbol) @@ -105,21 +96,13 @@ def check_kabi(symvers, kabi): if warn: print("*** WARNING - ABI SYMBOLS MOVED ***") - if moved_symbols: - print("") - print("The following symbols moved (typically caused by moving a symbol from being") - print("provided by the kernel vmlinux out to a loadable module):") - print("") - for symbol in moved_symbols: - print(symbol) - print("") - if ns_symbols: - print("") - print("The following symbols changed symbol namespaces:") - print("") - for symbol in ns_symbols: - print(symbol) - print("") + print("") + print("The following symbols moved (typically caused by moving a symbol from being") + print("provided by the kernel vmlinux out to a loadable module):") + print("") + for symbol in moved_symbols: + print(symbol) + print("") """Halt the build, if we got errors and/or warnings. In either case, double-checkig is required to avoid introducing / concealing diff --git a/SOURCES/cpupower.service b/SOURCES/cpupower.service deleted file mode 100644 index 5f10ab7..0000000 --- a/SOURCES/cpupower.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Configure CPU power related settings -After=syslog.target - -[Service] -Type=oneshot -RemainAfterExit=yes -EnvironmentFile=/etc/sysconfig/cpupower -ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS -ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS - -[Install] -WantedBy=multi-user.target diff --git a/SOURCES/def_variants.yaml.fedora b/SOURCES/def_variants.yaml.fedora new file mode 100644 index 0000000..ecac2ae --- /dev/null +++ b/SOURCES/def_variants.yaml.fedora @@ -0,0 +1,504 @@ +packages: + - name: modules-core + depends-on: [] + - name: modules + depends-on: + - modules-core + - name: modules-internal + depends-on: + - modules-core + - modules + - name: modules-extra + depends-on: + - modules-core + - modules + - name: modules-rt-kvm + if_variant_in: ["rt"] + depends-on: + - modules-core + + +rules: + - arch/x86/kvm/kvm(-amd|-intel|\.).*: modules-rt-kvm + if_variant_in: ["rt"] + + - arch/.*: modules-core + - crypto/.*: modules-core + + - drivers/accel/.*: modules-core + - drivers/accessibility/.*: modules-core + - drivers/acpi/video.*: modules + - drivers/acpi/.*: modules-core + - drivers/ata/.*: modules-core + + - drivers/base/.*(kunit|test).*: modules-internal + - drivers/base/regmap/regmap-sdw.*: modules + - drivers/base/.*: modules-core + - drivers/block/floppy.*: modules-extra + - drivers/block/rnbd.*: modules + - drivers/block/.*: modules-core + - drivers/bus/.*: modules-core + + - drivers/cdx/.*: modules-core + - drivers/char/mwave.*: modules + - drivers/char/.*: modules-core + - drivers/clk/.*test.*: modules-internal + - drivers/clk/.*: modules-core + - drivers/counter/.*: modules-core + - drivers/cpufreq/.*: modules-core + - drivers/crypto/caam/.*: modules + - drivers/crypto/cavium/.*: modules + - drivers/crypto/chelsio/.*: modules + - drivers/crypto/hisilicon/.*: modules + - drivers/crypto/marvell/.*: modules + - drivers/crypto/.*: modules-core + - drivers/cxl/.*: modules-core + + - drivers/dax/.*: modules-core + - drivers/dca/.*: modules-core + - drivers/devfreq/.*: modules-core + - drivers/dma/dmatest.*: modules-internal + - drivers/dma/.*: modules-core + + - drivers/edac/.*: modules-core + - drivers/extcon/.*: modules-core + + - drivers/firmware/iscsi_ibft.*: modules + - drivers/firmware/.*: modules-core + - drivers/fsi/.*: modules-core + + - drivers/gnss/.*: modules-core + - drivers/gpio/gpio-dln2.*: modules-extra + - drivers/gpio/gpio-ljca.*: modules + - drivers/gpio/.*: modules-core + - drivers/gpu/drm/i915/kvmgt.*: modules-rt-kvm + if_variant_in: ["rt"] + - drivers/gpu/drm/display/drm_.*: modules-core + - drivers/gpu/drm/drm.*: modules-core + - drivers/gpu/drm/etnaviv/.*: modules-core + - drivers/gpu/drm/gud/.*: modules-core + - drivers/gpu/drm/hyperv/.*: modules-core + - drivers/gpu/drm/imagination/.*: modules-core + - drivers/gpu/drm/lima/.*: modules-core + - drivers/gpu/drm/mxsfb/.*: modules-core + - drivers/gpu/drm/panfrost/.*: modules-core + - drivers/gpu/drm/qxl/.*: modules-core + - drivers/gpu/drm/scheduler/.*: modules-core + - drivers/gpu/drm/solomon/.*: modules-core + - drivers/gpu/drm/tests/.*: modules-internal + - drivers/gpu/drm/tidss/.*: modules-core + - drivers/gpu/drm/tiny/.*: modules-core + - drivers/gpu/drm/ttm/.*: modules-core + - drivers/gpu/drm/udl/.*: modules-core + - drivers/gpu/drm/v3d/.*: modules-core + - drivers/gpu/drm/vgem/.*: modules-core + - drivers/gpu/drm/virtio/.*: modules-core + - drivers/gpu/drm/vkms/.*: modules-core + - drivers/gpu/drm/vmwgfx/.*: modules-core + - drivers/gpu/drm/xlnx/.*: modules-core + - drivers/gpu/host1x/.*: modules-core + + - drivers/hid/.*test.*: modules-internal + - drivers/hid/hid-asus.*: modules + - drivers/hid/hid-nintendo.*: modules + - drivers/hid/hid-picolcd.*: modules + - drivers/hid/hid-playstation.*: modules + - drivers/hid/surface-hid.*: modules + - drivers/hid/hid-prodikeys.*: modules + - drivers/hid/.*: modules-core + - drivers/hte/.*: modules-core + - drivers/hv/.*: modules-core + - drivers/hwmon/asus_wmi_sensors.*: modules + - drivers/hwmon/dell-smm-hwmon.*: modules + - drivers/hwmon/hp-wmi-sensors.*: modules + - drivers/hwmon/intel-m10-bmc-hwmon.*: modules + - drivers/hwmon/nct6775.*: modules + - drivers/hwmon/.*: modules-core + - drivers/hwspinlock/.*: modules-core + - drivers/hwtracing/.*: modules-core + + - drivers/i2c/busses/i2c-dln2.*: modules-extra + - drivers/i2c/busses/i2c-ljca.*: modules + - drivers/i2c/.*: modules-core + - drivers/i3c/.*: modules-core + - drivers/iio/adc/dln2-adc.*: modules-extra + - drivers/iio/accel/.*: modules + - drivers/iio/common/cros_ec_sensors/.*: modules + - drivers/iio/light/.*: modules + - drivers/iio/pressure/.*: modules + - drivers/iio/proximity/.*: modules + - drivers/iio/test/.*: modules-internal + - drivers/iio/.*: modules-core + - drivers/input/gameport/.*: modules + - drivers/input/joystick/.*: modules-extra + - drivers/input/misc/pcspkr.*: modules-extra + - drivers/input/tablet/.*: modules + - drivers/input/tests/.*: modules-internal + - drivers/input/touchscreen/.*: modules + - drivers/input/.*: modules-core + - drivers/interconnect/.*: modules-core + - drivers/iommu/.*: modules-core + - drivers/irqchip/.*: modules-core + + - drivers/mailbox/.*: modules-core + - drivers/md/.*: modules-core + - drivers/memory/dfl-emif.*: modules + - drivers/memory/.*: modules-core + - drivers/message/fusion/mptctl.*: modules-extra + - drivers/message/fusion/mptfc.*: modules-extra + - drivers/message/fusion/.*: modules + - drivers/message/.*: modules-core + - drivers/mfd/dln2.*: modules-extra + - drivers/misc/.*: modules-core + - drivers/mux/.*: modules-core + + - drivers/net/amt.ko: modules-core + - drivers/net/bareudp.ko: modules-core + - drivers/net/bonding/.*: modules-core + - drivers/net/can/slcan/slcan.*: modules-extra + - drivers/net/can/usb/ems_usb.*: modules-extra + - drivers/net/can/vcan.*: modules-extra + - drivers/net/dummy.ko: modules-core + - drivers/net/eql.ko: modules-core + + - drivers/net/ethernet/8390/.*: modules-core + - drivers/net/ethernet/adi/.*: modules-core + - drivers/net/ethernet/agere/.*: modules-core + - drivers/net/ethernet/altera/.*: modules-core + - drivers/net/ethernet/amazon/.*: modules-core + - drivers/net/ethernet/amd/.*: modules-core + - drivers/net/ethernet/apm/.*: modules-core + - drivers/net/ethernet/asix/.*: modules-core + - drivers/net/ethernet/brocade/.*: modules-core + - drivers/net/ethernet/cavium/.*: modules-core + - drivers/net/ethernet/dnet.ko: modules-core + - drivers/net/ethernet/engleder/.*: modules-core + - drivers/net/ethernet/ethoc.ko: modules-core + - drivers/net/ethernet/fealnx.ko: modules-core + - drivers/net/ethernet/freescale/.*: modules-core + - drivers/net/ethernet/fungible/.*: modules-core + - drivers/net/ethernet/google/.*: modules-core + - drivers/net/ethernet/hisilicon/.*: modules-core + - drivers/net/ethernet/ibm/.*: modules-core + - drivers/net/ethernet/intel/.*: modules-core + - drivers/net/ethernet/jme.ko: modules-core + - drivers/net/ethernet/litex/.*: modules-core + - drivers/net/ethernet/mellanox/.*: modules-core + - drivers/net/ethernet/microsoft/.*: modules-core + - drivers/net/ethernet/natsemi/.*: modules-core + - drivers/net/ethernet/netronome/.*: modules-core + - drivers/net/ethernet/pensando/.*: modules-core + - drivers/net/ethernet/rocker/rocker.*: modules-internal + - drivers/net/ethernet/qualcomm/.*: modules-core + - drivers/net/ethernet/realtek/.*: modules-core + - drivers/net/ethernet/renesas/.*: modules-core + - drivers/net/ethernet/socionext/.*: modules-core + - drivers/net/ethernet/vertexcom/.*: modules-core + - drivers/net/ethernet/wangxun/.*: modules-core + - drivers/net/ethernet/xilinx/.*: modules-core + + - drivers/net/fjes/.*: modules-core + - drivers/net/geneve.ko: modules-core + - drivers/net/gtp.ko: modules-core + - drivers/net/hamradio/.*: modules-extra + - drivers/net/hyperv/.*: modules-core + - drivers/net/ifb.ko: modules-core + - drivers/net/ipa/.*: modules-core + - drivers/net/ipvlan/.*: modules-core + - drivers/net/macsec.ko: modules-core + - drivers/net/macvlan.ko: modules-core + - drivers/net/macvtap.ko: modules-core + - drivers/net/mctp/.*: modules-core + - drivers/net/mdio.*: modules-core + - drivers/net/mhi_net.ko: modules-core + - drivers/net/mii.ko: modules-core + - drivers/net/net_failover.ko: modules-core + - drivers/net/netdevsim/netdevsim.*: modules-internal + - drivers/net/netconsole.ko: modules-core + - drivers/net/nlmon.ko: modules-core + - drivers/net/pcs/.*: modules-core + - drivers/net/phy/.*: modules-core + - drivers/net/rionet.ko: modules-core + - drivers/net/slip/slip.*: modules-extra + - drivers/net/sungem_phy.ko: modules-core + - drivers/net/tap.ko: modules-core + - drivers/net/team/.*: modules-core + - drivers/net/thunderbolt/.*: modules-core + - drivers/net/tun.ko: modules-core + - drivers/net/veth.ko: modules-core + - drivers/net/virtio_net.ko: modules-core + - drivers/net/vmxnet3/.*: modules-core + - drivers/net/vrf.ko: modules-core + - drivers/net/vsockmon.ko: modules-core + - drivers/net/vxlan/.*: modules-core + - drivers/net/wireguard/.*: modules-core + - drivers/net/wireless/virtual/mac80211_hwsim.*: modules-internal + - drivers/net/wwan/wwan_hwsim.*: modules-internal + - drivers/net/wwan/.*: modules-core + - drivers/net/xen.*: modules-core + + - drivers/nvdimm/.*: modules-core + - drivers/nvme/host/nvme-rdma.*: modules + - drivers/nvme/target/nvmet-rdma.*: modules + - drivers/nvme/.*: modules-core + - drivers/nvmem/nvmem_u-boot-env.*: modules + - drivers/nvmem/.*: modules-core + + - drivers/parport/parport_serial.*: modules + - drivers/parport/.*: modules-core + - drivers/pci/pcie/aer_inject.*: modules-extra + - drivers/pci/.*: modules-core + - drivers/perf/.*: modules-core + - drivers/phy/.*: modules-core + - drivers/pinctrl/.*: modules-core + - drivers/platform/chrome/.*test.*: modules-internal + - drivers/pmdomain/.*: modules-core + - drivers/powercap/intel_rapl_tpmi.*: modules + - drivers/powercap/.*: modules-core + - drivers/pps/.*: modules-core + - drivers/ptp/ptp_kvm.*: modules-rt-kvm + if_variant_in: ["rt"] + - drivers/ptp/ptp_dfl_tod.*: modules + - drivers/ptp/.*: modules-core + - drivers/pwm/.*: modules-core + + - drivers/rapidio/.*: modules-core + - drivers/regulator/arizona-micsupp.*: modules + - drivers/regulator/.*: modules-core + - drivers/remoteproc/.*: modules-core + - drivers/reset/.*: modules-core + - drivers/rpmsg/.*: modules-core + - drivers/rtc/.*test.*: modules-internal + - drivers/rtc/.*: modules-core + + - drivers/s390/.*: modules-core + + - drivers/scsi/3w.*: modules-core + - drivers/scsi/BusLogic.ko: modules-core + - drivers/scsi/a100u2w.ko: modules-core + - drivers/scsi/advansys.ko: modules-core + - drivers/scsi/am53c974.ko: modules-core + - drivers/scsi/arcmsr.*: modules-core + - drivers/scsi/atp870u.ko: modules-core + - drivers/scsi/ch.ko: modules-core + - drivers/scsi/cxlflash/.*: modules-core + - drivers/scsi/dc395x.ko: modules-core + - drivers/scsi/device_handler/.*: modules-core + - drivers/scsi/dmx3191d.ko: modules-core + - drivers/scsi/elx/.*: modules-core + - drivers/scsi/esp_scsi.ko: modules-core + - drivers/scsi/fdomain.*: modules-core + - drivers/scsi/hpsa.ko: modules-core + - drivers/scsi/hptiop.ko: modules-core + - drivers/scsi/hv_storvsc.ko: modules-core + - drivers/scsi/ibmvscsi.*: modules-core + - drivers/scsi/initio.ko: modules-core + - drivers/scsi/ipr.ko: modules-core + - drivers/scsi/ips.ko: modules-core + - drivers/scsi/iscsi_tcp.ko: modules-core + - drivers/scsi/libfc/.*: modules-core + - drivers/scsi/libiscsi.*: modules-core + - drivers/scsi/mpi3mr/.*: modules-core + - drivers/scsi/mvumi.ko: modules-core + - drivers/scsi/myrb.ko: modules-core + - drivers/scsi/myrs.ko: modules-core + - drivers/scsi/raid_class.ko: modules-core + - drivers/scsi/scsi_debug.ko: modules-core + - drivers/scsi/scsi_transport_.*: modules-core + - drivers/scsi/ses.ko: modules-core + - drivers/scsi/smartpqi/.*: modules-core + - drivers/scsi/snic/.*: modules-core + - drivers/scsi/st.ko: modules-core + - drivers/scsi/stex.ko: modules-core + - drivers/scsi/virtio_scsi.ko: modules-core + - drivers/scsi/vmw_pvscsi.ko: modules-core + - drivers/scsi/wd719x.ko: modules-core + - drivers/scsi/xen-scsifront.ko: modules-core + + - drivers/slimbus/.*: modules-core + - drivers/soc/.*: modules-core + - drivers/spi/spi-altera-dfl.*: modules + - drivers/spi/spi-dln2.*: modules-extra + - drivers/spi/spi-ljca.*: modules + - drivers/spi/.*: modules-core + - drivers/spmi/.*: modules-core + + - drivers/target/iscsi/cxgbit/cxgbit.*: modules + - drivers/target/sbp/sbp_target.*: modules + - drivers/target/target_core_user.*: modules + - drivers/target/.*: modules-core + - drivers/tee/.*: modules-core + - drivers/thermal/intel/int340x_thermal/int3406_thermal.*: modules + - drivers/thermal/.*: modules-core + - drivers/thunderbolt/.*: modules-core + + - drivers/ufs/.*: modules-core + - drivers/usb/atm/.*: modules + - drivers/usb/gadget/function/usb_f_midi2.*: modules + - drivers/usb/image/.*: modules + - drivers/usb/misc/trancevibrator.*: modules-extra + - drivers/usb/misc/.*: modules + - drivers/usb/serial/.*: modules + - drivers/usb/typec/mux/nb7vpq904m.*: modules + - drivers/usb/usbip/.*: modules-extra + - drivers/usb/.*: modules-core + + - drivers/vdpa/mlx5/mlx5_vdpa.*: modules + - drivers/vdpa/pds/pds_vdpa.*: modules + - drivers/vdpa/.*: modules-core + - drivers/vfio/pci/mlx5/mlx5-vfio-pci.*: modules + - drivers/vfio/pci/pds/pds-vfio-pc.*: modules + - drivers/vfio/.*: modules-core + - drivers/vhost/.*: modules-core + - drivers/video/backlight/apple_bl.*: modules + - drivers/video/.*: modules-core + - drivers/virt/.*: modules-core + - drivers/virtio/.*: modules-core + + - drivers/watchdog/iTCO_wdt.*: modules + - drivers/watchdog/.*: modules-core + + - drivers/xen/.*: modules-core + + - drivers/w1/masters/ds2482.*: modules-extra + - drivers/w1/masters/ds2490.*: modules-extra + - drivers/w1/slaves/w1_ds2408.*: modules-extra + - drivers/w1/slaves/w1_ds2423.*: modules-extra + - drivers/w1/slaves/w1_ds2431.*: modules-extra + - drivers/w1/slaves/w1_ds2433.*: modules-extra + - drivers/w1/slaves/w1_ds2780.*: modules-extra + - drivers/w1/slaves/w1_ds2781.*: modules-extra + - drivers/w1/slaves/w1_ds28e04.*: modules-extra + - drivers/w1/slaves/w1_smem.*: modules-extra + - drivers/w1/slaves/w1_therm.*: modules-extra + + - fs/.*test.*: modules-internal + - fs/9p/.*: modules-core + - fs/afs/.*: modules-core + - fs/affs/affs.*: modules-extra + - fs/bcachefs/.*: modules-core + - fs/befs/befs.*: modules-extra + - fs/binfmt_misc.ko: modules-core + - fs/cachefiles/.*: modules-core + - fs/ceph/.*: modules-core + - fs/coda/coda.*: modules-extra + - fs/dlm/.*: modules-extra + - fs/erofs/.*: modules-core + - fs/exfat/.*: modules-core + - fs/f2fs/.*: modules-core + - fs/fat/.*: modules-core + - fs/fuse/cuse.*: modules-extra + - fs/fuse/.*: modules-core + - fs/gfs2/.*: modules-extra + - fs/isofs/.*: modules-core + - fs/lockd/.*: modules-core + - fs/netfs/.*: modules-core + - fs/nfs.*: modules-core + - fs/nilfs2/nilfs2.*: modules-extra + - fs/nls/.*: modules-core + - fs/ntfs3/.*: modules-core + - fs/ocfs2/.*: modules-extra + - fs/orangefs/.*: modules-core + - fs/overlayfs/.*: modules-core + - fs/pstore/.*: modules-core + - fs/smb/.*: modules-core + - fs/squashfs/.*: modules-core + - fs/sysv/.*: modules-extra + - fs/ubifs/.*: modules-extra + - fs/udf/.*: modules-core + - fs/ufs/.*: modules-extra + - fs/vboxsf/.*: modules-core + - fs/xfs/.*: modules-core + - fs/zonefs/.*: modules-core + + - kernel/.*test.*: modules-internal + - kernel/locking/locktorture.*: modules-internal + - kernel/rcu/rcuscale.*: modules-internal + - kernel/rcu/rcutorture.*: modules-internal + - kernel/rcu/refscale.*: modules-internal + - kernel/resource_kunit.*: modules-internal + - kernel/scftorture.*: modules-internal + - kernel/torture.*: modules-internal + - kernel/.*: modules-core + + - lib/.*(test|kunit).*: modules-internal + - lib/.*: modules-core + + - mm/kasan/kasan_test: modules-internal + - mm/kfence/.*test.*: modules-internal + + - net/.*test.*: modules-internal + - net/802/.*: modules-core + - net/8021q/.*: modules-core + - net/9p/9pnet_rdma.ko: modules + - net/9p/.*: modules-core + - net/appletalk/appletalk.*: modules-extra + - net/atm/br2684.*: modules-extra + - net/atm/clip.*: modules-extra + - net/atm/lec.*: modules-extra + - net/atm/pppoatm.*: modules-extra + - net/ax25/ax25.*: modules-extra + - net/batman-adv/batman-adv.*: modules-extra + - net/bridge/.*: modules-core + - net/ceph/.*: modules-core + - net/core/pktgen.*: modules-internal + - net/core/.*: modules-core + - net/dns_resolver/.*: modules-core + - net/hsr/.*: modules-core + - net/ife/.*: modules-core + - net/ipv4/tcp_bic.*: modules-extra + - net/ipv4/tcp_highspeed.*: modules-extra + - net/ipv4/tcp_htcp.*: modules-extra + - net/ipv4/tcp_hybla.*: modules-extra + - net/ipv4/tcp_illinois.*: modules-extra + - net/ipv4/tcp_lp.*: modules-extra + - net/ipv4/tcp_scalable.*: modules-extra + - net/ipv4/tcp_vegas.*: modules-extra + - net/ipv4/tcp_veno.*: modules-extra + - net/ipv4/tcp_westwood.*: modules-extra + - net/ipv4/tcp_yeah.*: modules-extra + - net/ipv4/.*: modules-core + - net/ipv6/.*: modules-core + - net/iucv/.*: modules-core + - net/kcm/.*: modules-core + - net/key/.*: modules-core + - net/l2tp/l2tp_debugfs.*: modules-extra + - net/l2tp/l2tp_eth.*: modules-extra + - net/l2tp/l2tp_netlink.*: modules-extra + - net/l2tp/l2tp_ppp.*: modules-extra + - net/llc/.*: modules-core + - net/netfilter/.*: modules-core + - net/netrom/netrom.*: modules-extra + - net/nsh/.*: modules-core + - net/openvswitch/.*: modules-core + - net/psample/.*: modules-core + - net/qrtr/.*: modules-core + - net/rds/rds.*: modules-extra + - net/rose/rose.*: modules-extra + - net/rxrpc/.*: modules-core + - net/sched/sch_choke.*: modules-extra + - net/sched/sch_drr.*: modules-extra + - net/sched/sch_etf.*: modules-extra + - net/sched/sch_gred.*: modules-extra + - net/sched/sch_mqprio.ko: modules-extra + - net/sched/sch_multiq.*: modules-extra + - net/sched/sch_netem.*: modules-extra + - net/sched/sch_qfq.*: modules-extra + - net/sched/sch_red.*: modules-extra + - net/sched/sch_sfb.*: modules-extra + - net/sched/sch_teql.*: modules-extra + - net/sched/.*: modules-core + - net/sunrpc/xprtrdma/rpcrdma.*: modules + - net/sunrpc/.*: modules-core + - net/tipc/.*: modules-core + - net/tls/.*: modules-core + - net/vmw_vsock/.*: modules-core + - net/xdp/.*: modules-core + - net/xfrm/.*: modules-core + + - sound/pci/.*test.*: modules-internal + - sound/soc/.*test.*: modules-internal + + - virt/.*: modules-core + + - default: modules diff --git a/SOURCES/def_variants.yaml.rhel b/SOURCES/def_variants.yaml.rhel new file mode 100644 index 0000000..5f64ee5 --- /dev/null +++ b/SOURCES/def_variants.yaml.rhel @@ -0,0 +1,521 @@ +packages: + - name: modules-core + depends-on: [] + - name: modules + depends-on: + - modules-core + - name: modules-internal + depends-on: + - modules-core + - modules + - name: modules-extra + depends-on: + - modules-core + - modules + - name: modules-rt-kvm + if_variant_in: ["rt"] + depends-on: + - modules-core + - name: modules-partner + depends-on: + - modules-core + - modules + +rules: + - arch/x86/kvm/kvm(-amd|-intel|\.).*: modules-rt-kvm + if_variant_in: ["rt"] + + - arch/.*: modules-core + - block/t10-pi.ko: modules-core + - crypto/.*: modules-core + + - drivers/accel/.*: modules-core + - drivers/accessibility/.*: modules-core + - drivers/acpi/video.*: modules + - drivers/acpi/.*: modules-core + - drivers/ata/.*: modules-core + + - drivers/base/.*(kunit|test).*: modules-internal + - drivers/base/regmap/regmap-sdw.*: modules + - drivers/base/.*: modules-core + - drivers/block/floppy.*: modules-extra + - drivers/block/rnbd.*: modules + - drivers/block/.*: modules-core + - drivers/bus/.*: modules-core + + - drivers/cdrom/.*: modules-core + - drivers/cdx/.*: modules-core + - drivers/char/mwave.*: modules + - drivers/char/.*: modules-core + - drivers/clk/.*test.*: modules-internal + - drivers/clk/.*: modules-core + - drivers/counter/.*: modules-core + - drivers/cpufreq/amd-pstate-ut.ko: modules-internal + - drivers/cpufreq/.*: modules-core + - drivers/crypto/caam/.*: modules + - drivers/crypto/cavium/.*: modules + - drivers/crypto/chelsio/.*: modules + - drivers/crypto/hisilicon/.*: modules + - drivers/crypto/marvell/.*: modules + - drivers/crypto/.*: modules-core + - drivers/cxl/.*: modules-core + + - drivers/dax/.*: modules-core + - drivers/dca/.*: modules-core + - drivers/devfreq/.*: modules-core + - drivers/dma/dmatest.*: modules-internal + - drivers/dma/.*: modules-core + + - drivers/edac/.*: modules-core + - drivers/extcon/.*: modules-core + + - drivers/firmware/iscsi_ibft.*: modules + - drivers/firmware/.*: modules-core + - drivers/fsi/.*: modules-core + + - drivers/gnss/.*: modules-core + - drivers/gpio/gpio-dln2.*: modules-extra + - drivers/gpio/gpio-ljca.*: modules + - drivers/gpio/.*: modules-core + - drivers/gpu/drm/i915/kvmgt.*: modules-rt-kvm + if_variant_in: ["rt"] + - drivers/gpu/drm/display/drm_.*: modules-core + - drivers/gpu/drm/drm.*: modules-core + - drivers/gpu/drm/etnaviv/.*: modules-core + - drivers/gpu/drm/gud/.*: modules-core + - drivers/gpu/drm/hyperv/.*: modules-core + - drivers/gpu/drm/imagination/.*: modules-core + - drivers/gpu/drm/lima/.*: modules-core + - drivers/gpu/drm/mxsfb/.*: modules-core + - drivers/gpu/drm/panfrost/.*: modules-core + - drivers/gpu/drm/qxl/.*: modules-core + - drivers/gpu/drm/scheduler/.*: modules-core + - drivers/gpu/drm/solomon/.*: modules-core + - drivers/gpu/drm/tests/.*: modules-internal + - drivers/gpu/drm/tidss/.*: modules-core + - drivers/gpu/drm/tiny/.*: modules-core + - drivers/gpu/drm/ttm/.*: modules-core + - drivers/gpu/drm/udl/.*: modules-core + - drivers/gpu/drm/v3d/.*: modules-core + - drivers/gpu/drm/vgem/.*: modules-core + - drivers/gpu/drm/virtio/.*: modules-core + - drivers/gpu/drm/vkms/.*: modules-core + - drivers/gpu/drm/vmwgfx/.*: modules-core + - drivers/gpu/drm/xlnx/.*: modules-core + - drivers/gpu/host1x/.*: modules-core + + - drivers/hid/.*test.*: modules-internal + - drivers/hid/hid-asus.*: modules + - drivers/hid/hid-nintendo.*: modules + - drivers/hid/hid-picolcd.*: modules + - drivers/hid/hid-playstation.*: modules + - drivers/hid/surface-hid.*: modules + - drivers/hid/hid-prodikeys.*: modules + - drivers/hid/.*: modules-core + - drivers/hte/.*: modules-core + - drivers/hv/.*: modules-core + - drivers/hwmon/asus_wmi_sensors.*: modules + - drivers/hwmon/dell-smm-hwmon.*: modules + - drivers/hwmon/hp-wmi-sensors.*: modules + - drivers/hwmon/intel-m10-bmc-hwmon.*: modules + - drivers/hwmon/nct6775.*: modules + - drivers/hwmon/ntc_thermistor.*: modules + - drivers/hwmon/.*: modules-core + - drivers/hwspinlock/.*: modules-core + - drivers/hwtracing/.*: modules-core + + - drivers/i2c/busses/i2c-dln2.*: modules-extra + - drivers/i2c/busses/i2c-ljca.*: modules + - drivers/i2c/.*: modules-core + - drivers/i3c/.*: modules-core + - drivers/iio/adc/dln2-adc.*: modules-extra + - drivers/iio/test/.*: modules-internal + - drivers/input/gameport/.*: modules + - drivers/input/joystick/.*: modules-extra + - drivers/input/tablet/.*: modules + - drivers/input/tests/.*: modules-internal + - drivers/input/touchscreen/.*: modules + - drivers/input/.*: modules-core + - drivers/interconnect/.*: modules-core + - drivers/iommu/.*: modules-core + - drivers/irqchip/.*: modules-core + + - drivers/mailbox/.*: modules-core + - drivers/md/.*: modules-core + - drivers/memory/dfl-emif.*: modules + - drivers/memory/.*: modules-core + - drivers/message/fusion/mptctl.*: modules-extra + - drivers/message/fusion/mptfc.*: modules-extra + - drivers/message/fusion/.*: modules + - drivers/message/.*: modules-core + - drivers/mfd/dln2.*: modules-extra + - drivers/misc/.*: modules-core + - drivers/mux/.*: modules-core + + - drivers/net/amt.ko: modules-core + - drivers/net/bareudp.ko: modules-core + - drivers/net/bonding/.*: modules-core + - drivers/net/can/slcan/slcan.*: modules-extra + - drivers/net/can/usb/ems_usb.*: modules-extra + - drivers/net/can/vcan.*: modules-extra + - drivers/net/dummy.ko: modules-core + - drivers/net/eql.ko: modules-core + + - drivers/net/ethernet/8390/.*: modules-core + - drivers/net/ethernet/adi/.*: modules-core + - drivers/net/ethernet/agere/.*: modules-core + - drivers/net/ethernet/altera/.*: modules-core + - drivers/net/ethernet/amazon/.*: modules-core + - drivers/net/ethernet/amd/.*: modules-core + - drivers/net/ethernet/apm/.*: modules-core + - drivers/net/ethernet/asix/.*: modules-core + - drivers/net/ethernet/brocade/.*: modules-core + - drivers/net/ethernet/cavium/.*: modules-core + - drivers/net/ethernet/dnet.ko: modules-core + - drivers/net/ethernet/engleder/.*: modules-core + - drivers/net/ethernet/ethoc.ko: modules-core + - drivers/net/ethernet/fealnx.ko: modules-core + - drivers/net/ethernet/freescale/.*: modules-core + - drivers/net/ethernet/fungible/.*: modules-core + - drivers/net/ethernet/google/.*: modules-core + - drivers/net/ethernet/hisilicon/.*: modules-core + - drivers/net/ethernet/huawei/.*: modules-core + - drivers/net/ethernet/ibm/.*: modules-core + - drivers/net/ethernet/intel/.*: modules-core + - drivers/net/ethernet/jme.ko: modules-core + - drivers/net/ethernet/litex/.*: modules-core + - drivers/net/ethernet/mellanox/.*: modules-core + - drivers/net/ethernet/microsoft/.*: modules-core + - drivers/net/ethernet/myricom/.*: modules-core + - drivers/net/ethernet/natsemi/.*: modules-core + - drivers/net/ethernet/netronome/.*: modules-core + - drivers/net/ethernet/pensando/.*: modules-core + - drivers/net/ethernet/rocker/rocker.*: modules-internal + - drivers/net/ethernet/qualcomm/.*: modules-core + - drivers/net/ethernet/realtek/.*: modules-core + - drivers/net/ethernet/renesas/.*: modules-core + - drivers/net/ethernet/socionext/.*: modules-core + - drivers/net/ethernet/vertexcom/.*: modules-core + - drivers/net/ethernet/wangxun/.*: modules-core + - drivers/net/ethernet/xilinx/.*: modules-core + + - drivers/net/fjes/.*: modules-core + - drivers/net/geneve.ko: modules-core + - drivers/net/gtp.ko: modules-core + - drivers/net/hamradio/.*: modules-extra + - drivers/net/hyperv/.*: modules-core + - drivers/net/ifb.ko: modules-core + - drivers/net/ipa/.*: modules-core + - drivers/net/ipvlan/.*: modules-core + - drivers/net/macsec.ko: modules-core + - drivers/net/macvlan.ko: modules-core + - drivers/net/macvtap.ko: modules-core + - drivers/net/mctp/.*: modules-core + - drivers/net/mdio.*: modules-core + - drivers/net/mhi_net.ko: modules-core + - drivers/net/mii.ko: modules-core + - drivers/net/net_failover.ko: modules-core + - drivers/net/netdevsim/netdevsim.*: modules-internal + - drivers/net/netconsole.ko: modules-core + - drivers/net/nlmon.ko: modules-core + - drivers/net/pcs/.*: modules-core + - drivers/net/phy/.*: modules-core + - drivers/net/rionet.ko: modules-core + - drivers/net/slip/slip.*: modules-extra + - drivers/net/sungem_phy.ko: modules-core + - drivers/net/tap.ko: modules-core + - drivers/net/team/.*: modules-core + - drivers/net/thunderbolt/.*: modules-core + - drivers/net/tun.ko: modules-core + - drivers/net/veth.ko: modules-core + - drivers/net/virtio_net.ko: modules-core + - drivers/net/vmxnet3/.*: modules-core + - drivers/net/vrf.ko: modules-core + - drivers/net/vsockmon.ko: modules-core + - drivers/net/vxlan/.*: modules-core + - drivers/net/wan/hdlc.*: modules-core + - drivers/net/wireguard/.*: modules-core + - drivers/net/wireless/virtual/mac80211_hwsim.*: modules-internal + - drivers/net/wwan/wwan_hwsim.*: modules-internal + - drivers/net/wwan/.*: modules-core + - drivers/net/xen.*: modules-core + + - drivers/nvdimm/.*: modules-core + - drivers/nvme/host/nvme-rdma.*: modules + - drivers/nvme/target/nvmet-rdma.*: modules + - drivers/nvme/.*: modules-core + - drivers/nvmem/nvmem_u-boot-env.*: modules + - drivers/nvmem/.*: modules-core + + - drivers/parport/parport_serial.*: modules + - drivers/parport/.*: modules-core + - drivers/pci/pcie/aer_inject.*: modules-extra + - drivers/pci/.*: modules-core + - drivers/perf/.*: modules-core + - drivers/phy/.*: modules-core + - drivers/pinctrl/.*: modules-core + - drivers/platform/chrome/.*test.*: modules-internal + - drivers/platform/x86/intel/intel_vsec.*: modules-core + - drivers/pmdomain/.*: modules-core + - drivers/powercap/intel_rapl_tpmi.*: modules + - drivers/powercap/.*: modules-core + - drivers/pps/.*: modules-core + - drivers/ptp/ptp_kvm.*: modules-rt-kvm + if_variant_in: ["rt"] + - drivers/ptp/ptp_dfl_tod.*: modules + - drivers/ptp/.*: modules-core + - drivers/pwm/.*: modules-core + + - drivers/rapidio/.*: modules-core + - drivers/regulator/arizona-micsupp.*: modules + - drivers/regulator/.*: modules-core + - drivers/remoteproc/.*: modules-core + - drivers/reset/.*: modules-core + - drivers/rpmsg/.*: modules-core + - drivers/rtc/.*test.*: modules-internal + - drivers/rtc/.*: modules-core + + - drivers/s390/net/ism.*: modules + - drivers/s390/.*: modules-core + + - drivers/scsi/3w.*: modules-core + - drivers/scsi/BusLogic.ko: modules-core + - drivers/scsi/a100u2w.ko: modules-core + - drivers/scsi/advansys.ko: modules-core + - drivers/scsi/am53c974.ko: modules-core + - drivers/scsi/arcmsr.*: modules-core + - drivers/scsi/atp870u.ko: modules-core + - drivers/scsi/ch.ko: modules-core + - drivers/scsi/cxlflash/.*: modules-core + - drivers/scsi/dc395x.ko: modules-core + - drivers/scsi/device_handler/.*: modules-core + - drivers/scsi/dmx3191d.ko: modules-core + - drivers/scsi/elx/.*: modules-core + - drivers/scsi/esp_scsi.ko: modules-core + - drivers/scsi/fdomain.*: modules-core + - drivers/scsi/hpsa.ko: modules-core + - drivers/scsi/hptiop.ko: modules-core + - drivers/scsi/hv_storvsc.ko: modules-core + - drivers/scsi/ibmvscsi.*: modules-core + - drivers/scsi/initio.ko: modules-core + - drivers/scsi/ipr.ko: modules-core + - drivers/scsi/ips.ko: modules-core + - drivers/scsi/iscsi_tcp.ko: modules-core + - drivers/scsi/libfc/.*: modules-core + - drivers/scsi/libiscsi.*: modules-core + - drivers/scsi/mpi3mr/.*: modules-core + - drivers/scsi/mvumi.ko: modules-core + - drivers/scsi/myrb.ko: modules-core + - drivers/scsi/myrs.ko: modules-core + - drivers/scsi/raid_class.ko: modules-core + - drivers/scsi/scsi_debug.ko: modules-core + - drivers/scsi/scsi_transport_.*: modules-core + - drivers/scsi/sd_mod.ko: modules-core + - drivers/scsi/ses.ko: modules-core + - drivers/scsi/sg.ko: modules-core + - drivers/scsi/smartpqi/.*: modules-core + - drivers/scsi/snic/.*: modules-core + - drivers/scsi/sr_mod.ko: modules-core + - drivers/scsi/st.ko: modules-core + - drivers/scsi/stex.ko: modules-core + - drivers/scsi/virtio_scsi.ko: modules-core + - drivers/scsi/vmw_pvscsi.ko: modules-core + - drivers/scsi/wd719x.ko: modules-core + - drivers/scsi/xen-scsifront.ko: modules-core + + - drivers/slimbus/.*: modules-core + - drivers/soc/.*: modules-core + - drivers/spi/spi-altera-dfl.*: modules + - drivers/spi/spi-dln2.*: modules-extra + - drivers/spi/spi-ljca.*: modules + - drivers/spi/.*: modules-core + - drivers/spmi/.*: modules-core + + - drivers/target/iscsi/cxgbit/cxgbit.*: modules + - drivers/target/sbp/sbp_target.*: modules + - drivers/target/target_core_user.*: modules + - drivers/target/.*: modules-core + - drivers/tee/.*: modules-core + - drivers/thermal/intel/int340x_thermal/int3406_thermal.*: modules + - drivers/thermal/.*: modules-core + - drivers/thunderbolt/.*: modules-core + + - drivers/ufs/.*: modules-core + - drivers/usb/atm/.*: modules + - drivers/usb/gadget/function/usb_f_midi2.*: modules + - drivers/usb/image/.*: modules + - drivers/usb/misc/trancevibrator.*: modules-extra + - drivers/usb/misc/.*: modules + - drivers/usb/serial/.*: modules + - drivers/usb/typec/mux/nb7vpq904m.*: modules + - drivers/usb/usbip/.*: modules-extra + - drivers/usb/.*: modules-core + + - drivers/vdpa/mlx5/mlx5_vdpa.*: modules + - drivers/vdpa/pds/pds_vdpa.*: modules + - drivers/vdpa/.*: modules-core + - drivers/vfio/pci/mlx5/mlx5-vfio-pci.*: modules + - drivers/vfio/pci/pds/pds-vfio-pc.*: modules + - drivers/vfio/.*: modules-core + - drivers/vhost/.*: modules-core + - drivers/video/backlight/apple_bl.*: modules + - drivers/video/.*: modules-core + - drivers/virt/.*: modules-core + - drivers/virtio/.*: modules-core + + - drivers/watchdog/.*: modules-core + + - drivers/xen/.*: modules-core + + - drivers/w1/masters/ds2482.*: modules-extra + - drivers/w1/masters/ds2490.*: modules-extra + - drivers/w1/slaves/w1_ds2408.*: modules-extra + - drivers/w1/slaves/w1_ds2423.*: modules-extra + - drivers/w1/slaves/w1_ds2431.*: modules-extra + - drivers/w1/slaves/w1_ds2433.*: modules-extra + - drivers/w1/slaves/w1_ds2780.*: modules-extra + - drivers/w1/slaves/w1_ds2781.*: modules-extra + - drivers/w1/slaves/w1_ds28e04.*: modules-extra + - drivers/w1/slaves/w1_smem.*: modules-extra + - drivers/w1/slaves/w1_therm.*: modules-extra + + - fs/.*test.*: modules-internal + - fs/9p/.*: modules-core + - fs/afs/.*: modules-partner + - fs/affs/affs.*: modules-extra + - fs/bcachefs/.*: modules-core + - fs/befs/befs.*: modules-extra + - fs/binfmt_misc.ko: modules-core + - fs/cachefiles/.*: modules-core + - fs/ceph/.*: modules-core + - fs/coda/coda.*: modules-extra + - fs/dlm/.*: modules-core + - fs/erofs/.*: modules-core + - fs/exfat/.*: modules-core + - fs/ext4/.*: modules-core + - fs/f2fs/.*: modules-core + - fs/fat/.*: modules-core + - fs/fuse/cuse.*: modules-extra + - fs/fuse/.*: modules-core + - fs/gfs2/.*: modules-core + - fs/isofs/.*: modules-core + - fs/jbd2/.*: modules-core + - fs/lockd/.*: modules-core + - fs/mbcache.ko: modules-core + - fs/netfs/.*: modules-core + - fs/nfs.*: modules-core + - fs/nilfs2/nilfs2.*: modules-extra + - fs/nls/.*: modules-core + - fs/ntfs3/.*: modules-core + - fs/ocfs2/.*: modules-extra + - fs/orangefs/.*: modules-core + - fs/overlayfs/.*: modules-core + - fs/pstore/.*: modules-core + - fs/sysv/.*: modules-extra + - fs/ubifs/.*: modules-extra + - fs/udf/.*: modules-core + - fs/ufs/.*: modules-extra + - fs/vboxsf/.*: modules-core + - fs/xfs/.*: modules-core + - fs/zonefs/.*: modules-core + + - kernel/.*test.*: modules-internal + - kernel/locking/locktorture.*: modules-internal + - kernel/rcu/rcuscale.*: modules-internal + - kernel/rcu/rcutorture.*: modules-internal + - kernel/rcu/refscale.*: modules-internal + - kernel/resource_kunit.*: modules-internal + - kernel/scftorture.*: modules-internal + - kernel/torture.*: modules-internal + - kernel/.*: modules-core + + - lib/test_lockup.*: modules-extra + - lib/.*(test|kunit).*: modules-internal + - lib/.*: modules-core + + - mm/kasan/kasan_test: modules-internal + - mm/kfence/.*test.*: modules-internal + - mm/zsmalloc.ko: modules-core + + - net/.*test.*: modules-internal + - net/802/.*: modules-core + - net/8021q/.*: modules-core + - net/9p/9pnet_rdma.ko: modules + - net/9p/.*: modules-core + - net/appletalk/appletalk.*: modules-extra + - net/atm/br2684.*: modules-extra + - net/atm/clip.*: modules-extra + - net/atm/lec.*: modules-extra + - net/atm/pppoatm.*: modules-extra + - net/ax25/ax25.*: modules-extra + - net/batman-adv/batman-adv.*: modules-extra + - net/bridge/br_netfilter.*: modules-extra + - net/bridge/netfilter/ebt.*: modules-extra + - net/bridge/.*: modules-core + - net/ceph/.*: modules-core + - net/core/pktgen.*: modules-internal + - net/core/.*: modules-core + - net/dns_resolver/.*: modules-core + - net/hsr/.*: modules-core + - net/ife/.*: modules-core + - net/ipv4/netfilter/arp.*: modules-extra + - net/ipv4/netfilter/ip[_t].*: modules-extra + - net/ipv4/tcp_bic.*: modules-extra + - net/ipv4/tcp_highspeed.*: modules-extra + - net/ipv4/tcp_htcp.*: modules-extra + - net/ipv4/tcp_hybla.*: modules-extra + - net/ipv4/tcp_illinois.*: modules-extra + - net/ipv4/tcp_lp.*: modules-extra + - net/ipv4/tcp_scalable.*: modules-extra + - net/ipv4/tcp_vegas.*: modules-extra + - net/ipv4/tcp_veno.*: modules-extra + - net/ipv4/tcp_westwood.*: modules-extra + - net/ipv4/tcp_yeah.*: modules-extra + - net/ipv4/.*: modules-core + - net/ipv6/netfilter/ebt.*: modules-extra + - net/ipv6/netfilter/ip6[_t].*: modules-extra + - net/ipv6/.*: modules-core + - net/iucv/.*: modules-core + - net/kcm/.*: modules-core + - net/key/.*: modules-core + - net/l2tp/.*: modules-extra + - net/llc/.*: modules-core + - net/netfilter/ipset/.*: modules-extra + - net/netfilter/nft_compat.*: modules-extra + - net/netfilter/xt_.*: modules-extra + - net/netfilter/.*: modules-core + - net/netrom/netrom.*: modules-extra + - net/nsh/.*: modules-core + - net/openvswitch/.*: modules-core + - net/psample/.*: modules-core + - net/qrtr/.*: modules-core + - net/rds/rds.*: modules-extra + - net/rose/rose.*: modules-extra + - net/rxrpc/.*: modules-partner + - net/sched/sch_choke.*: modules-extra + - net/sched/sch_drr.*: modules-extra + - net/sched/sch_gred.*: modules-extra + - net/sched/sch_mqprio.ko: modules-extra + - net/sched/sch_multiq.*: modules-extra + - net/sched/sch_netem.*: modules-extra + - net/sched/sch_qfq.*: modules-extra + - net/sched/sch_red.*: modules-extra + - net/sched/sch_sfb.*: modules-extra + - net/sched/sch_teql.*: modules-extra + - net/sched/.*: modules-core + - net/sctp/.*: modules-extra + - net/sunrpc/xprtrdma/rpcrdma.*: modules + - net/sunrpc/.*: modules-core + - net/tipc/.*: modules-extra + - net/tls/.*: modules-core + - net/vmw_vsock/.*: modules-core + - net/xdp/.*: modules-core + - net/xfrm/.*: modules-core + + - samples/.*: modules-internal + - sound/pci/.*test.*: modules-internal + - sound/soc/.*test.*: modules-internal + + - virt/.*: modules-core + + - default: modules diff --git a/SOURCES/filter-aarch64.sh b/SOURCES/filter-aarch64.sh deleted file mode 100644 index 14090bb..0000000 --- a/SOURCES/filter-aarch64.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash - -# This is the aarch64 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick message mmc mtd nfc ntb pcmcia power ssb soundwire staging tty uio w1" - -ethdrvs="3com adaptec arc alteon atheros broadcom cadence calxeda chelsio cisco dec dlink emulex marvell micrel myricom neterion nvidia packetengines qlogic rdc sfc silan sis smsc stmicro sun tehuti ti via wiznet xircom" - -drmdrvs="amd arm bridge ast exynos hisilicon i2c imx mgag200 meson msm nouveau panel pl111 radeon rockchip tegra sun4i tiny vc4" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr rnbd-client rnbd-server mlx5_vdpa dfl-emif octeontx2-cpt octeontx2-cptvf spi-altera-dfl rvu_cptpf rvu_cptvf regmap-sdw regmap-sdw-mbq hid-playstation hid-nintendo" diff --git a/SOURCES/filter-aarch64.sh.fedora b/SOURCES/filter-aarch64.sh.fedora deleted file mode 100644 index ce8e7df..0000000 --- a/SOURCES/filter-aarch64.sh.fedora +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/bash - -# This is the aarch64 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -overrides="aux-bridge aux-hpd-bridge cec" - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick message mmc mtd nfc ntb pcmcia power ssb soundwire staging tty uio w1" - -ethdrvs="3com adaptec arc alteon atheros broadcom cadence calxeda chelsio cisco dec dlink emulex marvell micrel myricom neterion nvidia packetengines qlogic rdc sfc silan sis smsc stmicro sun tehuti ti via wiznet xircom" - -drmdrvs="amd arm bridge ast exynos hisilicon i2c imx mgag200 meson msm nouveau panel pl111 radeon rockchip tegra sun4i tiny vc4" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr rnbd-client rnbd-server mlx5_vdpa dfl-emif octeontx2-cpt octeontx2-cptvf spi-altera-dfl rvu_cptpf rvu_cptvf regmap-sdw regmap-sdw-mbq hid-playstation hid-nintendo nvmem_u-boot-env intel-m10-bmc-pmci intel-m10-bmc-hwmon ptp_dfl_tod pds_vdpa usb_f_midi2 cs42l43-sdw" diff --git a/SOURCES/filter-aarch64.sh.rhel b/SOURCES/filter-aarch64.sh.rhel deleted file mode 100644 index e088c8e..0000000 --- a/SOURCES/filter-aarch64.sh.rhel +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash - -# This is the aarch64 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fmc infiniband isdn leds media memstick message mmc mtd mwave nfc ntb pcmcia platform power ssb staging tty uio uwb w1" - -ethdrvs="3com adaptec arc alteon atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell micrel myricom neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti via wiznet xircom" - -drmdrvs="amd arm bridge ast exynos hisilicon i2c imx mgag200 meson msm nouveau panel radeon rockchip tegra sun4i tinydrm vc4" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls" diff --git a/SOURCES/filter-armv7hl.sh b/SOURCES/filter-armv7hl.sh deleted file mode 100644 index e773b39..0000000 --- a/SOURCES/filter-armv7hl.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash - -# This is the armv7hl override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband media memstick message nfc ntb pcmcia ssb soundwire staging tty uio w1" - -ethdrvs="3com adaptec alteon altera amd atheros broadcom cadence chelsio cisco dec dlink emulex mellanox micrel myricom natsemi neterion nvidia packetengines qlogic rdc sfc silan sis sun tehuti via wiznet xircom" - -drmdrvs="amd arm armada bridge ast exynos etnaviv hisilicon i2c imx meson mgag200 msm nouveau omapdrm panel pl111 radeon rockchip sti stm sun4i tegra tilcdc tiny vc4" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr bq27xxx_battery_hdq mlx5_vdpa dfl-emif spi-altera-dfl hid-playstation hid-nintendo" diff --git a/SOURCES/filter-armv7hl.sh.fedora b/SOURCES/filter-armv7hl.sh.fedora deleted file mode 100644 index d35fd84..0000000 --- a/SOURCES/filter-armv7hl.sh.fedora +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash - -# This is the armv7hl override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband media memstick message nfc ntb pcmcia ssb soundwire staging tty uio w1" - -ethdrvs="3com adaptec alteon altera amd atheros broadcom cadence chelsio cisco dec dlink emulex mellanox micrel myricom natsemi neterion nvidia packetengines qlogic rdc sfc silan sis sun tehuti via wiznet xircom" - -drmdrvs="amd arm armada bridge ast exynos etnaviv hisilicon i2c imx meson mgag200 msm nouveau omapdrm panel pl111 radeon rockchip sti stm sun4i tegra tilcdc tiny vc4" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr bq27xxx_battery_hdq mlx5_vdpa dfl-emif spi-altera-dfl hid-playstation hid-nintendo intel-m10-bmc-pmci" diff --git a/SOURCES/filter-armv7hl.sh.rhel b/SOURCES/filter-armv7hl.sh.rhel deleted file mode 100644 index e69de29..0000000 diff --git a/SOURCES/filter-i686.sh b/SOURCES/filter-i686.sh deleted file mode 100644 index 3ab2f63..0000000 --- a/SOURCES/filter-i686.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -# This is the i686 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio w1" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject hid-sensor-hub hid-sensor-magn-3d hid-sensor-incl-3d hid-sensor-gyro-3d hid-sensor-iio-common hid-sensor-accel-3d hid-sensor-trigger hid-sensor-als hid-sensor-rotation hid-sensor-temperature hid-sensor-humidity target_core_user sbp_target cxgbit chcr parport_serial regmap-sdw hid-asus" diff --git a/SOURCES/filter-i686.sh.fedora b/SOURCES/filter-i686.sh.fedora deleted file mode 100644 index 3ab2f63..0000000 --- a/SOURCES/filter-i686.sh.fedora +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -# This is the i686 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio w1" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject hid-sensor-hub hid-sensor-magn-3d hid-sensor-incl-3d hid-sensor-gyro-3d hid-sensor-iio-common hid-sensor-accel-3d hid-sensor-trigger hid-sensor-als hid-sensor-rotation hid-sensor-temperature hid-sensor-humidity target_core_user sbp_target cxgbit chcr parport_serial regmap-sdw hid-asus" diff --git a/SOURCES/filter-i686.sh.rhel b/SOURCES/filter-i686.sh.rhel deleted file mode 100644 index e69de29..0000000 diff --git a/SOURCES/filter-modules.sh b/SOURCES/filter-modules.sh deleted file mode 100755 index 2e77c34..0000000 --- a/SOURCES/filter-modules.sh +++ /dev/null @@ -1,193 +0,0 @@ -#! /bin/bash -# -# Called as filter-modules.sh list-of-modules Arch - -# This script filters the modules into the kernel-core and kernel-modules -# subpackages. We list out subsystems/subdirs to prune from the installed -# module directory. What is left is put into the kernel-core package. What is -# pruned is contained in the kernel-modules package. -# -# This file contains the default subsys/subdirs to prune from all architectures. -# If an architecture needs to differ, we source a per-arch filter-.sh file -# that contains the set of override lists to be used instead. If a module or -# subsys should be in kernel-modules on all arches, please change the defaults -# listed here. - -# Overrides is individual modules which need to remain in kernel-core due to deps. -overrides="cec" - -# Set the default dirs/modules to filter out -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio w1" - -chardrvs="mwave pcmcia" - -netdrvs="appletalk can dsa hamradio ieee802154 ppp slip usb wireless" - -ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex marvell mellanox neterion nvidia packetengines qlogic rdc sfc silan sis smsc stmicro sun tehuti ti wiznet xircom" - -iiodrvs="accel light pressure proximity" - -iiocommondrvs="cros_ec_sensors" - -inputdrvs="gameport tablet touchscreen" - -hiddrvs="surface-hid" - -scsidrvs="aacraid aic7xxx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic isci libsas lpfc megaraid mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf" - -usbdrvs="atm image misc serial" - -fsdrvs="affs befs coda cramfs dlm ecryptfs hfs hfsplus jfs jffs2 minix nilfs2 ocfs2 reiserfs romfs squashfs sysv ubifs ufs" - -netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dsa ieee802154 l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless" - -drmdrvs="amd ast bridge gma500 i2c i915 mgag200 nouveau panel radeon" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr parport_serial regmap-sdw regmap-sdw-mbq arizona-micsupp hid-asus iTCO_wdt rnbd-client rnbd-server mlx5_vdpa spi-altera-dfl nct6775 hid-playstation hid-nintendo asus_wmi_sensors asus_wmi_ec_sensors" - -# Grab the arch-specific filter list overrides -source ./filter-$2.sh - -filter_dir() { - filelist=$1 - dir=$2 - - grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp - - if [ $? -ne 0 ] - then - echo "Couldn't remove ${dir}. Skipping." - else - grep -e "${dir}/" ${filelist} >> k-d.list - mv ${filelist}.tmp $filelist - fi - - return 0 -} - -filter_ko() { - filelist=$1 - mod=$2 - - grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp - - if [ $? -ne 0 ] - then - echo "Couldn't remove ${mod}.ko Skipping." - else - grep -e "${mod}.ko" ${filelist} >> k-d.list - mv ${filelist}.tmp $filelist - fi - - return 0 -} - -# Filter the drivers/ subsystems -for subsys in ${driverdirs} -do - filter_dir $1 drivers/${subsys} -done - -# Filter the networking drivers -for netdrv in ${netdrvs} -do - filter_dir $1 drivers/net/${netdrv} -done - -# Filter the char drivers -for char in ${chardrvs} -do - filter_dir $1 drivers/char/${char} -done - -# Filter the ethernet drivers -for eth in ${ethdrvs} -do - filter_dir $1 drivers/net/ethernet/${eth} -done - -# SCSI -for scsi in ${scsidrvs} -do - filter_dir $1 drivers/scsi/${scsi} -done - -# IIO -for iio in ${iiodrvs} -do - filter_dir $1 drivers/iio/${iio} -done - -# IIO Common -for iio in ${iiocommondrvs} -do - filter_dir $1 drivers/iio/common/${iio} -done - -# Input -for input in ${inputdrvs} -do - filter_dir $1 drivers/input/${input} -done - -# hid -for hid in ${hiddrvs} -do - filter_dir $1 drivers/hid/${hid} -done - -# USB -for usb in ${usbdrvs} -do - filter_dir $1 drivers/usb/${usb} -done - -# Filesystems -for fs in ${fsdrvs} -do - filter_dir $1 fs/${fs} -done - -# Network protocols -for prot in ${netprots} -do - filter_dir $1 kernel/net/${prot} -done - -# DRM -for drm in ${drmdrvs} -do - filter_dir $1 drivers/gpu/drm/${drm} -done - -# Just kill sound. -filter_dir $1 kernel/sound -filter_dir $1 kernel/drivers/soundwire - -# Now go through and filter any single .ko files that might have deps on the -# things we filtered above -for mod in ${singlemods} -do - filter_ko $1 ${mod} -done - -# Now process the override list to bring those modules back into core -for mod in ${overrides} -do - grep -v -e "/${mod}.ko" k-d.list > k-d.list.tmp - if [ $? -ne 0 ] - then - echo "Couldn't save ${mod}.ko Skipping." - else - grep -e "/${mod}.ko" k-d.list >> $filelist - mv k-d.list.tmp k-d.list - fi - -done - -# Go through our generated drivers list and remove the .ko files. We'll -# restore them later. -for mod in `cat k-d.list` -do - rm -rf $mod -done diff --git a/SOURCES/filter-modules.sh.fedora b/SOURCES/filter-modules.sh.fedora deleted file mode 100755 index 6df7bf7..0000000 --- a/SOURCES/filter-modules.sh.fedora +++ /dev/null @@ -1,204 +0,0 @@ -#! /bin/bash -# -# Called as filter-modules.sh list-of-modules Arch - -# This script filters the modules into the kernel-core and kernel-modules -# subpackages. We list out subsystems/subdirs to prune from the installed -# module directory. What is left is put into the kernel-core package. What is -# pruned is contained in the kernel-modules package. -# -# This file contains the default subsys/subdirs to prune from all architectures. -# If an architecture needs to differ, we source a per-arch filter-.sh file -# that contains the set of override lists to be used instead. If a module or -# subsys should be in kernel-modules on all arches, please change the defaults -# listed here. - -# Overrides is individual modules which need to remain in kernel-core due to deps. -overrides="cec" - -# Set the default dirs/modules to filter out -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio w1" - -chardrvs="mwave pcmcia" - -netdrvs="appletalk can dsa hamradio ieee802154 ppp slip usb wireless" - -ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex marvell mellanox neterion nvidia packetengines qlogic rdc sfc silan sis smsc stmicro sun tehuti ti wiznet xircom" - -cryptdrvs="bcm caam cavium chelsio hisilicon marvell qat" - -iiodrvs="accel light pressure proximity" - -iiocommondrvs="cros_ec_sensors" - -inputdrvs="gameport tablet touchscreen" - -hiddrvs="surface-hid" - -scsidrvs="aacraid aic7xxx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic isci libsas lpfc megaraid mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf" - -usbdrvs="atm image misc serial" - -fsdrvs="affs befs coda cramfs dlm ecryptfs hfs hfsplus jfs jffs2 minix nilfs2 ocfs2 reiserfs romfs sysv ubifs ufs" - -netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dsa ieee802154 l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless" - -drmdrvs="amd ast bridge gma500 i2c i915 mgag200 nouveau panel radeon xe" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr parport_serial regmap-sdw regmap-sdw-mbq arizona-micsupp hid-asus iTCO_wdt rnbd-client rnbd-server mlx5_vdpa spi-altera-dfl nct6775 hid-playstation hid-nintendo asus_wmi_sensors asus_wmi_ec_sensors mlx5-vfio-pci video int3406_thermal apple_bl ptp_dfl_tod intel-m10-bmc-hwmon intel_rapl_tpmi pds_vdpa hp-wmi-sensors pds-vfio-pci gpio-ljca spi-ljca i2c-ljca dell-smm-hwmon" - -# Grab the arch-specific filter list overrides -source ./filter-$2.sh - -filter_dir() { - filelist=$1 - dir=$2 - - grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp - - if [ $? -ne 0 ] - then - echo "Couldn't remove ${dir}. Skipping." - else - grep -e "${dir}/" ${filelist} >> k-d.list - mv ${filelist}.tmp $filelist - fi - - return 0 -} - -filter_ko() { - filelist=$1 - mod=$2 - - grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp - - if [ $? -ne 0 ] - then - echo "Couldn't remove ${mod}.ko Skipping." - else - grep -e "${mod}.ko" ${filelist} >> k-d.list - mv ${filelist}.tmp $filelist - fi - - return 0 -} - -# HACK: move surface_fan and surface_temp to kernel-modules -singlemods="${singlemods} surface_fan surface_temp" - -# Filter the drivers/ subsystems -for subsys in ${driverdirs} -do - filter_dir $1 drivers/${subsys} -done - -# Filter the networking drivers -for netdrv in ${netdrvs} -do - filter_dir $1 drivers/net/${netdrv} -done - -# Filter the char drivers -for char in ${chardrvs} -do - filter_dir $1 drivers/char/${char} -done - -# Filter the ethernet drivers -for eth in ${ethdrvs} -do - filter_dir $1 drivers/net/ethernet/${eth} -done - -# Filter the crypto drivers -for crypt in ${cryptdrvs} -do - filter_dir $1 drivers/crypto/${crypt} -done - -# SCSI -for scsi in ${scsidrvs} -do - filter_dir $1 drivers/scsi/${scsi} -done - -# IIO -for iio in ${iiodrvs} -do - filter_dir $1 drivers/iio/${iio} -done - -# IIO Common -for iio in ${iiocommondrvs} -do - filter_dir $1 drivers/iio/common/${iio} -done - -# Input -for input in ${inputdrvs} -do - filter_dir $1 drivers/input/${input} -done - -# hid -for hid in ${hiddrvs} -do - filter_dir $1 drivers/hid/${hid} -done - -# USB -for usb in ${usbdrvs} -do - filter_dir $1 drivers/usb/${usb} -done - -# Filesystems -for fs in ${fsdrvs} -do - filter_dir $1 fs/${fs} -done - -# Network protocols -for prot in ${netprots} -do - filter_dir $1 kernel/net/${prot} -done - -# DRM -for drm in ${drmdrvs} -do - filter_dir $1 drivers/gpu/drm/${drm} -done - -# Just kill sound. -filter_dir $1 kernel/sound -filter_dir $1 kernel/drivers/soundwire - -# Now go through and filter any single .ko files that might have deps on the -# things we filtered above -for mod in ${singlemods} -do - filter_ko $1 ${mod} -done - -# Now process the override list to bring those modules back into core -for mod in ${overrides} -do - grep -v -e "/${mod}.ko" k-d.list > k-d.list.tmp - if [ $? -ne 0 ] - then - echo "Couldn't save ${mod}.ko Skipping." - else - grep -e "/${mod}.ko" k-d.list >> $filelist - mv k-d.list.tmp k-d.list - fi - -done - -# Go through our generated drivers list and remove the .ko files. We'll -# restore them later. -for mod in `cat k-d.list` -do - rm -rf $mod -done diff --git a/SOURCES/filter-modules.sh.rhel b/SOURCES/filter-modules.sh.rhel deleted file mode 100755 index b899ad6..0000000 --- a/SOURCES/filter-modules.sh.rhel +++ /dev/null @@ -1,177 +0,0 @@ -#! /bin/bash -# -# Called as filter-modules.sh list-of-modules Arch - -# This script filters the modules into the kernel-core and kernel-modules -# subpackages. We list out subsystems/subdirs to prune from the installed -# module directory. What is left is put into the kernel-core package. What is -# pruned is contained in the kernel-modules package. -# -# This file contains the default subsys/subdirs to prune from all architectures. -# If an architecture needs to differ, we source a per-arch filter-.sh file -# that contains the set of override lists to be used instead. If a module or -# subsys should be in kernel-modules on all arches, please change the defaults -# listed here. - -# Overrides is individual modules which need to remain in kernel-core due to deps. -overrides="cec isst_if_common isst_tpmi_core isst_tpmi intel_vsec intel_vsec_tpmi" - -# Set the default dirs/modules to filter out -driverdirs="atm auxdisplay bcma bluetooth firewire fmc iio infiniband isdn leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb staging tty uio uwb w1" - -chardrvs="mwave pcmcia" - -netdrvs="appletalk can dsa hamradio ieee802154 irda ppp slip usb wireless" - -ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti wiznet xircom" - -cryptdrvs="bcm caam cavium chelsio hisilicon marvell qat" - -inputdrvs="gameport tablet touchscreen" - -scsidrvs="aacraid aic7xxx aic94xx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic hisi_sas isci libsas lpfc megaraid mpt2sas mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf" - -usbdrvs="atm image misc serial wusbcore" - -fsdrvs="affs befs coda cramfs ecryptfs hfs hfsplus jfs minix ncpfs nilfs2 ocfs2 reiserfs romfs smb squashfs sysv ubifs ufs" - -netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dccp dsa ieee802154 irda l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless" - -drmdrvs="amd ast gma500 i2c i915 mgag200 nouveau radeon via " - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject hid-sensor-hub target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls parport_serial ism regmap-sdw regmap-sdw-mbq arizona-micsupp hid-asus nct6775 ntc_thermistor video apple_bl kasan_test intel-m10-bmc-hwmon dell-smm-hwmon" - -# Grab the arch-specific filter list overrides -source ./filter-$2.sh - -filter_dir() { - filelist=$1 - dir=$2 - - grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp - - if [ $? -ne 0 ] - then - echo "Couldn't remove ${dir}. Skipping." - else - grep -e "${dir}/" ${filelist} >> k-d.list - mv ${filelist}.tmp $filelist - fi - - return 0 -} - -filter_ko() { - filelist=$1 - mod=$2 - - grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp - - if [ $? -ne 0 ] - then - echo "Couldn't remove ${mod}.ko Skipping." - else - grep -e "${mod}.ko" ${filelist} >> k-d.list - mv ${filelist}.tmp $filelist - fi - - return 0 -} - -# Filter the drivers/ subsystems -for subsys in ${driverdirs} -do - filter_dir $1 drivers/${subsys} -done - -# Filter the networking drivers -for netdrv in ${netdrvs} -do - filter_dir $1 drivers/net/${netdrv} -done - -# Filter the char drivers -for char in ${chardrvs} -do - filter_dir $1 drivers/char/${char} -done - -# Filter the ethernet drivers -for eth in ${ethdrvs} -do - filter_dir $1 drivers/net/ethernet/${eth} -done - -# Filter the crypto drivers -for crypt in ${cryptdrvs} -do - filter_dir $1 drivers/crypto/${crypt} -done - -# SCSI -for scsi in ${scsidrvs} -do - filter_dir $1 drivers/scsi/${scsi} -done - -# Input -for input in ${inputdrvs} -do - filter_dir $1 drivers/input/${input} -done - -# USB -for usb in ${usbdrvs} -do - filter_dir $1 drivers/usb/${usb} -done - -# Filesystems -for fs in ${fsdrvs} -do - filter_dir $1 fs/${fs} -done - -# Network protocols -for prot in ${netprots} -do - filter_dir $1 kernel/net/${prot} -done - -# DRM -for drm in ${drmdrvs} -do - filter_dir $1 drivers/gpu/drm/${drm} -done - -# Just kill sound. -filter_dir $1 kernel/sound -filter_dir $1 kernel/drivers/soundwire - -# Now go through and filter any single .ko files that might have deps on the -# things we filtered above -for mod in ${singlemods} -do - filter_ko $1 ${mod} -done - -# Now process the override list to bring those modules back into core -for mod in ${overrides} -do - grep -v -e "/${mod}.ko" k-d.list > k-d.list.tmp - if [ $? -ne 0 ] - then - echo "Couldn't save ${mod}.ko Skipping." - else - grep -e "/${mod}.ko" k-d.list >> $filelist - mv k-d.list.tmp k-d.list - fi - -done - -# Go through our generated drivers list and remove the .ko files. We'll -# restore them later. -for mod in `cat k-d.list` -do - rm -rf $mod -done diff --git a/SOURCES/filter-ppc64le.sh b/SOURCES/filter-ppc64le.sh deleted file mode 100644 index 085b64a..0000000 --- a/SOURCES/filter-ppc64le.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -# This is the ppc64le override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick message mmc mtd nfc ntb pcmcia platform power ssb staging tty uio w1" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr rnbd-client rnbd-server mlx5_vdpa hid-playstation hid-nintendo" diff --git a/SOURCES/filter-ppc64le.sh.fedora b/SOURCES/filter-ppc64le.sh.fedora deleted file mode 100644 index 6e4a999..0000000 --- a/SOURCES/filter-ppc64le.sh.fedora +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -# This is the ppc64le override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick message mmc mtd nfc ntb pcmcia platform power ssb staging tty uio w1" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr rnbd-client rnbd-server mlx5_vdpa hid-playstation hid-nintendo mlx5-vfio-pci nvmem_u-boot-env intel-m10-bmc-pmci intel-m10-bmc-hwmon ptp_dfl_tod pds_vdpa pds-vfio-pci nb7vpq904m" diff --git a/SOURCES/filter-ppc64le.sh.rhel b/SOURCES/filter-ppc64le.sh.rhel deleted file mode 100644 index d80956d..0000000 --- a/SOURCES/filter-ppc64le.sh.rhel +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -# This is the ppc64le override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -driverdirs="atm auxdisplay bcma bluetooth firewire fmc infiniband isdn leds media memstick message mmc mtd mwave nfc ntb pcmcia platform power ssb staging tty uio uwb w1" - -singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls" diff --git a/SOURCES/filter-s390x.sh b/SOURCES/filter-s390x.sh deleted file mode 100644 index 04f7110..0000000 --- a/SOURCES/filter-s390x.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# This is the s390x override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -# Defaults work so no need to override diff --git a/SOURCES/filter-s390x.sh.fedora b/SOURCES/filter-s390x.sh.fedora deleted file mode 100644 index 04f7110..0000000 --- a/SOURCES/filter-s390x.sh.fedora +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# This is the s390x override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -# Defaults work so no need to override diff --git a/SOURCES/filter-s390x.sh.rhel b/SOURCES/filter-s390x.sh.rhel deleted file mode 100644 index 04f7110..0000000 --- a/SOURCES/filter-s390x.sh.rhel +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# This is the s390x override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -# Defaults work so no need to override diff --git a/SOURCES/filter-x86_64.sh b/SOURCES/filter-x86_64.sh deleted file mode 100644 index 1aa80f2..0000000 --- a/SOURCES/filter-x86_64.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# This is the x86_64 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -# Defaults work so no need to override diff --git a/SOURCES/filter-x86_64.sh.fedora b/SOURCES/filter-x86_64.sh.fedora deleted file mode 100644 index 1aa80f2..0000000 --- a/SOURCES/filter-x86_64.sh.fedora +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# This is the x86_64 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -# Defaults work so no need to override diff --git a/SOURCES/filter-x86_64.sh.rhel b/SOURCES/filter-x86_64.sh.rhel deleted file mode 100644 index 1aa80f2..0000000 --- a/SOURCES/filter-x86_64.sh.rhel +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# This is the x86_64 override file for the core/drivers package split. The -# module directories listed here and in the generic list in filter-modules.sh -# will be moved to the resulting kernel-modules package for this arch. -# Anything not listed in those files will be in the kernel-core package. -# -# Please review the default list in filter-modules.sh before making -# modifications to the overrides below. If something should be removed across -# all arches, remove it in the default instead of per-arch. - -# Defaults work so no need to override diff --git a/SOURCES/filtermods.py b/SOURCES/filtermods.py new file mode 100755 index 0000000..9d7e33d --- /dev/null +++ b/SOURCES/filtermods.py @@ -0,0 +1,1099 @@ +#!/usr/bin/env python3 +""" +filter kmods into groups for packaging, see filtermods.adoc +""" + +import argparse +import os +import re +import subprocess +import sys +import yaml +import unittest + +from logging import getLogger, DEBUG, INFO, WARN, ERROR, CRITICAL, NOTSET, FileHandler, StreamHandler, Formatter, Logger +from typing import Optional + +log = getLogger('filtermods') + + +def get_td(filename): + script_dir = os.path.dirname(os.path.realpath(__file__)) + return os.path.join(script_dir, 'filtermods-testdata', filename) + + +def run_command(cmd, cwddir=None): + p = subprocess.Popen(cmd, cwd=cwddir, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + out, err = p.communicate() + out_str = out.decode('utf-8') + err_str = err.decode('utf-8') + return p.returncode, out_str, err_str + + +def safe_run_command(cmd, cwddir=None): + log.info('%s', cmd) + retcode, out, err = run_command(cmd, cwddir) + if retcode != 0: + log.warning('Command failed: %s, ret_code: %d', cmd, retcode) + log.warning(out) + log.warning(err) + raise Exception(err) + log.info(' ^^[OK]') + return retcode, out, err + + +def setup_logging(log_filename, stdout_log_level): + log_format = '%(asctime)s %(levelname)7.7s %(funcName)20.20s:%(lineno)4s %(message)s' + log = getLogger('filtermods') + log.setLevel(DEBUG) + + handler = StreamHandler(sys.stdout) + formatter = Formatter(log_format, '%H:%M:%S') + handler.setFormatter(formatter) + handler.setLevel(stdout_log_level) + log.addHandler(handler) + log.debug('stdout logging on') + + if log_filename: + file_handler = FileHandler(log_filename, 'w') + file_handler.setFormatter(formatter) + file_handler.setLevel(DEBUG) + log.addHandler(file_handler) + log.info('file logging on: %s', log_filename) + + return log + + +def canon_modname(kmod_pathname: str) -> str: + name = os.path.basename(kmod_pathname) + if name.endswith('.xz'): + name = name[:-3] + return name + + +class HierarchyObject: + def __init__(self): + self.depends_on = set() + + +def get_topo_order(obj_list: list[HierarchyObject], func_get_linked_objs=lambda x: x.depends_on) -> list[HierarchyObject]: + topo_order = [] + objs_to_sort = set(obj_list) + objs_sorted = set() + + while len(objs_to_sort) > 0: + no_deps = set() + for obj in objs_to_sort: + linked = func_get_linked_objs(obj) + if not linked: + no_deps.add(obj) + else: + all_deps_sorted = True + for dep in linked: + if dep not in objs_sorted: + all_deps_sorted = False + break + if all_deps_sorted: + no_deps.add(obj) + + for obj in no_deps: + topo_order.append(obj) + objs_sorted.add(obj) + objs_to_sort.remove(obj) + + return topo_order + + +class KMod(HierarchyObject): + def __init__(self, kmod_pathname: str) -> None: + super(KMod, self).__init__() + self.name: str = canon_modname(kmod_pathname) + self.kmod_pathname: str = kmod_pathname + self.is_dependency_for: set[KMod] = set() + self.assigned_to_pkg: Optional[KModPackage] = None + self.preferred_pkg: Optional[KModPackage] = None + self.rule_specifity: int = 0 + self.allowed_list: Optional[set[KModPackage]] = None + self.err = 0 + + def __str__(self): + depends_on = '' + for kmod in self.depends_on: + depends_on = depends_on + ' ' + kmod.name + return '%s {%s}' % (self.name, depends_on) + + +class KModList(): + def __init__(self) -> None: + self.name_to_kmod_map: dict[str, KMod] = {} + self.topo_order: Optional[list[KMod]] = None + + def get(self, kmod_pathname, create_if_missing=False): + kmod_name = canon_modname(kmod_pathname) + if kmod_name in self.name_to_kmod_map: + return self.name_to_kmod_map[kmod_name] + if not create_if_missing: + return None + + kmod = KMod(kmod_pathname) + # log.debug('Adding kmod %s (%s) to list', kmod.name, kmod.kmod_pathname) + if kmod.kmod_pathname != kmod_pathname: + raise Exception('Already have %s, but path changed? %s', kmod_name, kmod_pathname) + if not kmod.name: + raise Exception('Each kmod needs a name') + self.name_to_kmod_map[kmod_name] = kmod + return kmod + + def process_depmod_line(self, line): + tmp = line.split(':') + if len(tmp) != 2: + raise Exception('Depmod line has unexpected format: %s', line) + kmod_pathname = tmp[0].strip() + dependencies_pathnames = tmp[1].strip() + kmod = self.get(kmod_pathname, create_if_missing=True) + + if dependencies_pathnames: + for dep_pathname in dependencies_pathnames.split(' '): + dep_kmod = self.get(dep_pathname, create_if_missing=True) + kmod.depends_on.add(dep_kmod) + dep_kmod.is_dependency_for.add(kmod) + + def load_depmod_file(self, filepath): + with open(filepath) as f: + lines = f.readlines() + for line in lines: + if not line or line.startswith('#'): + continue + self.process_depmod_line(line) + log.info('depmod %s loaded, number of kmods: %s', filepath, len(self.name_to_kmod_map)) + + def dump(self): + for kmod in self.name_to_kmod_map.values(): + print(kmod) + + def get_topo_order(self): + if self.topo_order is None: + self.topo_order = get_topo_order(self.name_to_kmod_map.values()) + # TODO: what if we add something after? + return self.topo_order + + def get_alphabetical_order(self): + kmods = list(self.name_to_kmod_map.values()) + kmods.sort(key=lambda k: k.kmod_pathname) + return kmods + + def load_kmods_from_dir(self, topdir): + ret = [] + for root, dirs, files in os.walk(topdir): + for filename in files: + if filename.endswith('.xz'): + filename = filename[:-3] + if filename.endswith('.ko'): + kmod_pathname = os.path.join(root, filename) + ret.append(kmod_pathname) + + return ret + + def check_depmod_has_all_kmods(self, dirpath): + ret = self.load_kmods_from_dir(dirpath) + for kmod_pathname in ret: + kmod = self.get(kmod_pathname) + if not kmod: + raise Exception('Could not find kmod %s in depmod', kmod_pathname) + log.debug('OK: all (%s) kmods from %s are known', len(ret), dirpath) + + +class KModPackage(HierarchyObject): + def _get_depends_on(pkg): + return pkg.depends_on + + def _get_deps_for(pkg): + return pkg.is_dependency_for + + def __init__(self, name: str, depends_on=[]) -> None: + self.name: str = name + self.depends_on: set[KModPackage] = set(depends_on) + self.is_dependency_for: set[KModPackage] = set() + + for pkg in self.depends_on: + pkg.is_dependency_for.add(self) + self.all_depends_on_list: list[KModPackage] = self._get_all_linked(KModPackage._get_depends_on) + self.all_depends_on: set[KModPackage] = set(self.all_depends_on_list) + self.all_deps_for: Optional[set[KModPackage]] = None + self.default = False + log.debug('KModPackage created %s, depends_on: %s', name, [pkg.name for pkg in depends_on]) + + def __repr__(self): + return self.name + + def get_all_deps_for(self): + if self.all_deps_for is None: + self.all_deps_for = set(self._get_all_linked(KModPackage._get_deps_for)) + return self.all_deps_for + + def _get_all_linked(self, func_get_links): + ret = [] + explore = func_get_links(self) + + while len(explore) > 0: + new_explore = set() + for pkg in explore: + if pkg not in ret: + ret.append(pkg) + for dep in func_get_links(pkg): + new_explore.add(dep) + explore = new_explore + return ret + + +class KModPackageList(HierarchyObject): + def __init__(self) -> None: + self.name_to_obj: dict[str, KModPackage] = {} + self.kmod_pkg_list: list[KModPackage] = [] + self.rules: list[tuple[str, str, str]] = [] + + def get(self, pkgname): + if pkgname in self.name_to_obj: + return self.name_to_obj[pkgname] + return None + + def add_kmod_pkg(self, pkg): + self.name_to_obj[pkg.name] = pkg + self.kmod_pkg_list.append(pkg) + + def __iter__(self): + return iter(self.kmod_pkg_list) + + +def get_kmods_matching_re(kmod_list: KModList, param_re: str) -> list[KMod]: + ret = [] + # first subdir can be anything - this is because during build everything + # goes to kernel, but subpackages can move it (e.g. to extra) + param_re = '[^/]+/' + param_re + pattern = re.compile(param_re) + + for kmod in kmod_list.get_topo_order(): + m = pattern.match(kmod.kmod_pathname) + if m: + ret.append(kmod) + return ret + + +def walk_kmod_chain(kmod, myfunc): + visited = set() + + def visit_kmod(kmod, parent_kmod, func_to_call): + func_to_call(kmod, parent_kmod) + visited.add(kmod) + for dep in kmod.depends_on: + if dep not in visited: + visit_kmod(dep, kmod, func_to_call) + + visit_kmod(kmod, None, myfunc) + return visited + + +# is pkg a parent to any pkg from "alist" +def is_pkg_parent_to_any(pkg: KModPackage, alist: set[KModPackage]) -> bool: + if pkg in alist: + return True + + for some_pkg in alist: + if some_pkg in pkg.all_depends_on: + return True + return False + + +# is pkg a child to any pkg from "alist" +def is_pkg_child_to_any(pkg: KModPackage, alist: set[KModPackage]) -> bool: + if pkg in alist: + return True + + for some_pkg in alist: + if pkg in some_pkg.all_depends_on: + return True + return False + + +def update_allowed(kmod: KMod, visited: set[KMod], update_linked: bool = False) -> int: + num_updated = 0 + init = False + to_remove = set() + + if kmod in visited: + return num_updated + visited.add(kmod) + + # if we have nothing, try to initialise based on parents and children + if kmod.allowed_list is None: + init_allowed_list: set[KModPackage] = set() + + # init from children + for kmod_dep in kmod.depends_on: + if kmod_dep.allowed_list: + init_allowed_list.update(kmod_dep.allowed_list) + init = True + + if init: + # also add any pkgs that pkgs from list could depend on + deps_for = set() + for pkg in init_allowed_list: + deps_for.update(pkg.get_all_deps_for()) + init_allowed_list.update(deps_for) + + # init from parents + if not init: + for kmod_par in kmod.is_dependency_for: + if kmod_par.allowed_list: + init_allowed_list.update(kmod_par.allowed_list) + # also add any pkgs that depend on pkgs from list + for pkg in kmod_par.allowed_list: + init_allowed_list.update(pkg.all_depends_on) + init = True + + if init: + kmod.allowed_list = init_allowed_list + log.debug('%s: init to %s', kmod.name, [x.name for x in kmod.allowed_list]) + + kmod_allowed_list = kmod.allowed_list or set() + # log.debug('%s: update to %s', kmod.name, [x.name for x in kmod_allowed_list]) + + # each allowed is parent to at least one child allowed [for _all_ children] + for pkg in kmod_allowed_list: + for kmod_dep in kmod.depends_on: + if kmod_dep.allowed_list is None or kmod_dep.err: + continue + if not is_pkg_parent_to_any(pkg, kmod_dep.allowed_list): + to_remove.add(pkg) + log.debug('%s: remove %s from allowed, child: %s [%s]', + kmod.name, [pkg.name], kmod_dep.name, [x.name for x in kmod_dep.allowed_list]) + + # each allowed is child to at least one parent allowed [for _all_ parents] + for pkg in kmod_allowed_list: + for kmod_par in kmod.is_dependency_for: + if kmod_par.allowed_list is None or kmod_par.err: + continue + + if not is_pkg_child_to_any(pkg, kmod_par.allowed_list): + to_remove.add(pkg) + log.debug('%s: remove %s from allowed, parent: %s %s', + kmod.name, [pkg.name], kmod_par.name, [x.name for x in kmod_par.allowed_list]) + + for pkg in to_remove: + kmod_allowed_list.remove(pkg) + num_updated = num_updated + 1 + if len(kmod_allowed_list) == 0: + log.error('%s: cleared entire allow list', kmod.name) + kmod.err = 1 + + if init or to_remove or update_linked: + if to_remove: + log.debug('%s: updated to %s', kmod.name, [x.name for x in kmod_allowed_list]) + + for kmod_dep in kmod.depends_on: + num_updated = num_updated + update_allowed(kmod_dep, visited) + + for kmod_dep in kmod.is_dependency_for: + num_updated = num_updated + update_allowed(kmod_dep, visited) + + return num_updated + + +def apply_initial_labels(pkg_list: KModPackageList, kmod_list: KModList, treat_default_as_wants=False): + log.debug('') + for cur_rule in ['needs', 'wants', 'default']: + for package_name, rule_type, rule in pkg_list.rules: + pkg_obj = pkg_list.get(package_name) + + if not pkg_obj: + log.error('no package with name %s', package_name) + + if cur_rule != rule_type: + continue + + if rule_type == 'default' and treat_default_as_wants: + rule_type = 'wants' + + if 'needs' == rule_type: + # kmod_matching is already in topo_order + kmod_matching = get_kmods_matching_re(kmod_list, rule) + for kmod in kmod_matching: + if kmod.assigned_to_pkg and kmod.assigned_to_pkg != pkg_obj: + log.error('%s: can not be required by 2 pkgs %s %s', kmod.name, kmod.assigned_to_pkg, pkg_obj.name) + else: + kmod.assigned_to_pkg = pkg_obj + kmod.allowed_list = set([pkg_obj]) + kmod.rule_specifity = len(kmod_matching) + log.debug('%s: needed by %s', kmod.name, [pkg_obj.name]) + + if 'wants' == rule_type: + # kmod_matching is already in topo_order + kmod_matching = get_kmods_matching_re(kmod_list, rule) + for kmod in kmod_matching: + if kmod.allowed_list is None: + kmod.allowed_list = set(pkg_obj.all_depends_on) + kmod.allowed_list.add(pkg_obj) + kmod.preferred_pkg = pkg_obj + kmod.rule_specifity = len(kmod_matching) + log.debug('%s: wanted by %s, init allowed to %s', kmod.name, [pkg_obj.name], [pkg.name for pkg in kmod.allowed_list]) + else: + if kmod.assigned_to_pkg: + log.debug('%s: ignoring wants by %s, already assigned to %s', kmod.name, pkg_obj.name, kmod.assigned_to_pkg.name) + else: + # rule specifity may not be good idea, so just log it + # e.g. .*test.* may not be more specific than arch/x86/.* + log.debug('already have wants for %s %s, new rule: %s', kmod.name, kmod.preferred_pkg, rule) + + if 'default' == rule_type: + pkg_obj.default = True + + +def settle(kmod_list: KModList) -> None: + kmod_topo_order = list(kmod_list.get_topo_order()) + + for i in range(0, 25): + log.debug('settle start %s', i) + + ret = 0 + for kmod in kmod_topo_order: + visited: set[KMod] = set() + ret = ret + update_allowed(kmod, visited) + log.debug('settle %s updated nodes: %s', i, ret) + + if ret == 0: + break + + kmod_topo_order.reverse() + + +# phase 1 - propagate initial labels +def propagate_labels_1(pkg_list: KModPackageList, kmod_list: KModList): + log.info('') + settle(kmod_list) + + +def pick_closest_to_preffered(preferred_pkg: KModPackage, allowed_set: set[KModPackage]): + for child in preferred_pkg.all_depends_on_list: + if child in allowed_set: + return child + return None + + +# phase 2 - if some kmods allow more than one pkg, pick wanted package +def propagate_labels_2(pkg_list: KModPackageList, kmod_list: KModList): + log.info('') + ret = 0 + for kmod in kmod_list.get_topo_order(): + update_linked = False + + if kmod.allowed_list is None and kmod.preferred_pkg: + log.error('%s: has no allowed list but has preferred_pkg %s', kmod.name, kmod.preferred_pkg.name) + kmod.err = 1 + + if kmod.allowed_list and kmod.preferred_pkg: + chosen_pkg = None + if kmod.preferred_pkg in kmod.allowed_list: + chosen_pkg = kmod.preferred_pkg + else: + chosen_pkg = pick_closest_to_preffered(kmod.preferred_pkg, kmod.allowed_list) + + if chosen_pkg is not None: + kmod.allowed_list = set([chosen_pkg]) + log.debug('%s: making to prefer %s (preffered is %s), allowed: %s', kmod.name, chosen_pkg.name, + kmod.preferred_pkg.name, [pkg.name for pkg in kmod.allowed_list]) + update_linked = True + + visited: set[KMod] = set() + ret = ret + update_allowed(kmod, visited, update_linked) + + log.debug('updated nodes: %s', ret) + settle(kmod_list) + + +# Is this the best pick? ¯\_(ツ)_/¯ +def pick_topmost_allowed(allowed_set: set[KModPackage]) -> KModPackage: + topmost = next(iter(allowed_set)) + for pkg in allowed_set: + if len(pkg.all_depends_on) > len(topmost.all_depends_on): + topmost = pkg + + return topmost + + +# phase 3 - assign everything else that remained +def propagate_labels_3(pkg_list: KModPackageList, kmod_list: KModList): + log.info('') + ret = 0 + kmod_topo_order = list(kmod_list.get_topo_order()) + # do reverse topo order to cover children faster + kmod_topo_order.reverse() + + default_pkg = None + default_name = '' + for pkg_obj in pkg_list: + if pkg_obj.default: + if default_pkg: + log.error('Already have default pkg: %s / %s', default_pkg.name, pkg_obj.name) + else: + default_pkg = pkg_obj + default_name = default_pkg.name + + for kmod in kmod_topo_order: + update_linked = False + chosen_pkg = None + + if kmod.allowed_list is None: + if default_pkg: + chosen_pkg = default_pkg + else: + log.error('%s not assigned and there is no default', kmod.name) + elif len(kmod.allowed_list) > 1: + if default_pkg: + if default_pkg in kmod.allowed_list: + chosen_pkg = default_pkg + else: + chosen_pkg = pick_closest_to_preffered(default_pkg, kmod.allowed_list) + if chosen_pkg: + log.debug('closest is %s', chosen_pkg.name) + if not chosen_pkg: + # multiple pkgs are allowed, but none is preferred or default + chosen_pkg = pick_topmost_allowed(kmod.allowed_list) + log.debug('topmost is %s', chosen_pkg.name) + + if chosen_pkg: + kmod.allowed_list = set([chosen_pkg]) + log.debug('%s: making to prefer %s (default: %s)', kmod.name, [chosen_pkg.name], default_name) + update_linked = True + + visited: set[KMod] = set() + ret = ret + update_allowed(kmod, visited, update_linked) + + log.debug('updated nodes: %s', ret) + settle(kmod_list) + + +def load_config(config_pathname: str, kmod_list: KModList, variants=[]): + kmod_pkg_list = KModPackageList() + + with open(config_pathname, 'r') as file: + yobj = yaml.safe_load(file) + + for pkg_dict in yobj['packages']: + pkg_name = pkg_dict['name'] + depends_on = pkg_dict.get('depends-on', []) + if_variant_in = pkg_dict.get('if_variant_in') + + if if_variant_in is not None: + if not (set(variants) & set(if_variant_in)): + log.debug('Skipping %s for variants %s', pkg_name, variants) + continue + + pkg_dep_list = [] + for pkg_dep_name in depends_on: + pkg_dep = kmod_pkg_list.get(pkg_dep_name) + pkg_dep_list.append(pkg_dep) + + pkg_obj = kmod_pkg_list.get(pkg_name) + if not pkg_obj: + pkg_obj = KModPackage(pkg_name, pkg_dep_list) + kmod_pkg_list.add_kmod_pkg(pkg_obj) + else: + log.error('package %s already exists?', pkg_name) + + rules_list = yobj.get('rules', []) + for rule_dict in rules_list: + if_variant_in = rule_dict.get('if_variant_in') + exact_pkg = rule_dict.get('exact_pkg') + + for key, value in rule_dict.items(): + if key in ['if_variant_in', 'exact_pkg']: + continue + + if if_variant_in is not None: + if not (set(variants) & set(if_variant_in)): + continue + + rule = key + package_name = value + + if not kmod_pkg_list.get(package_name): + raise Exception('Unknown package ' + package_name) + + rule_type = 'wants' + if exact_pkg is True: + rule_type = 'needs' + elif key == 'default': + rule_type = 'default' + rule = '.*' + + log.debug('found rule: %s', (package_name, rule_type, rule)) + kmod_pkg_list.rules.append((package_name, rule_type, rule)) + + log.info('loaded config, rules: %s', len(kmod_pkg_list.rules)) + return kmod_pkg_list + + +def make_pictures(pkg_list: KModPackageList, kmod_list: KModList, filename: str, print_allowed=True): + f = open(filename + '.dot', 'w') + + f.write('digraph {\n') + f.write('node [style=filled fillcolor="#f8f8f8"]\n') + f.write(' subgraph kmods {\n') + f.write(' "Legend" [shape=note label="kmod name\\n{desired package}\\nresulting package(s)"]\n') + + for kmod in kmod_list.get_topo_order(): + pkg_name = '' + attr = '' + if kmod.assigned_to_pkg: + attr = 'fillcolor="#eddad5" color="#b22800"' + pkg_name = kmod.assigned_to_pkg.name + "!" + if kmod.preferred_pkg: + attr = 'fillcolor="#ddddf5" color="#b268fe"' + pkg_name = kmod.preferred_pkg.name + "?" + allowed = '' + if kmod.allowed_list and print_allowed: + allowed = '=' + ' '.join([pkg.name for pkg in kmod.allowed_list]) + f.write(' "%s" [label="%s\\n%s\\n%s" shape=box %s] \n' % (kmod.name, kmod.name, pkg_name, allowed, attr)) + + for kmod in kmod_list.get_topo_order(): + for kmod_dep in kmod.depends_on: + f.write(' "%s" -> "%s";\n' % (kmod.name, kmod_dep.name)) + f.write(' }\n') + + f.write(' subgraph packages {\n') + for pkg in pkg_list: + desc = '' + if pkg.default: + desc = '/default' + f.write(' "%s" [label="%s\\n%s"] \n' % (pkg.name, pkg.name, desc)) + for pkg_dep in pkg.depends_on: + f.write(' "%s" -> "%s";\n' % (pkg.name, pkg_dep.name)) + f.write(' }\n') + f.write('}\n') + + f.close() + + # safe_run_command('dot -Tpng -Gdpi=150 %s.dot > %s.png' % (filename, filename)) + safe_run_command('dot -Tsvg %s.dot > %s.svg' % (filename, filename)) + + +def sort_kmods(depmod_pathname: str, config_str: str, variants=[], do_pictures=''): + log.info('%s %s', depmod_pathname, config_str) + kmod_list = KModList() + kmod_list.load_depmod_file(depmod_pathname) + + pkg_list = load_config(config_str, kmod_list, variants) + + basename = os.path.splitext(config_str)[0] + + apply_initial_labels(pkg_list, kmod_list) + if '0' in do_pictures: + make_pictures(pkg_list, kmod_list, basename + "_0", print_allowed=False) + + try: + + propagate_labels_1(pkg_list, kmod_list) + if '1' in do_pictures: + make_pictures(pkg_list, kmod_list, basename + "_1") + propagate_labels_2(pkg_list, kmod_list) + propagate_labels_3(pkg_list, kmod_list) + finally: + if 'f' in do_pictures: + make_pictures(pkg_list, kmod_list, basename + "_f") + + return pkg_list, kmod_list + + +def abbrev_list_for_report(alist: list[KMod]) -> str: + tmp_str = [] + for kmod in alist[:2]: + if kmod.allowed_list: + tmp_str.append('%s(%s)' % (kmod.name, ' '.join([x.name for x in kmod.allowed_list]))) + ret = ', '.join(tmp_str) + other_len = len(alist[2:]) + if other_len > 0: + ret = ret + ' and %s other(s)' % (other_len) + return ret + + +def print_report(pkg_list: KModPackageList, kmod_list: KModList): + log.info('*'*26 + ' REPORT ' + '*'*26) + + kmods_err = 0 + kmods_moved = 0 + kmods_good = 0 + for kmod in kmod_list.get_topo_order(): + if not kmod.allowed_list: + log.error('%s: not assigned to any package! Please check the full log for details', kmod.name) + kmods_err = kmods_err + 1 + continue + + if len(kmod.allowed_list) > 1: + log.error('%s: assigned to more than one package! Please check the full log for details', kmod.name) + kmods_err = kmods_err + 1 + continue + + if not kmod.preferred_pkg: + # config doesn't care where it ended up + kmods_good = kmods_good + 1 + continue + + if kmod.preferred_pkg in kmod.allowed_list: + # it ended up where it needs to be + kmods_good = kmods_good + 1 + continue + + bad_parent_list = [] + for kmod_parent in kmod.is_dependency_for: + if not is_pkg_child_to_any(kmod.preferred_pkg, kmod_parent.allowed_list): + bad_parent_list.append(kmod_parent) + + bad_child_list = [] + for kmod_child in kmod.depends_on: + if not is_pkg_parent_to_any(kmod.preferred_pkg, kmod_child.allowed_list): + bad_child_list.append(kmod_parent) + + log.info('%s: wanted by %s but ended up in %s', kmod.name, [kmod.preferred_pkg.name], [pkg.name for pkg in kmod.allowed_list]) + if bad_parent_list: + log.info('\thas conflicting parent: %s', abbrev_list_for_report(bad_parent_list)) + if bad_child_list: + log.info('\thas conflicting children: %s', abbrev_list_for_report(bad_child_list)) + + kmods_moved = kmods_moved + 1 + + log.info('No. of kmod(s) assigned to preferred package: %s', kmods_good) + log.info('No. of kmod(s) moved to a related package: %s', kmods_moved) + log.info('No. of kmod(s) which could not be assigned: %s', kmods_err) + log.info('*'*60) + + return kmods_err + + +def write_modules_lists(path_prefix: str, pkg_list: KModPackageList, kmod_list: KModList): + kmod_list_alphabetical = sorted(kmod_list.get_topo_order(), key=lambda x: x.kmod_pathname) + for pkg in pkg_list: + output_path = os.path.join(path_prefix, pkg.name + '.list') + i = 0 + with open(output_path, "w") as file: + for kmod in kmod_list_alphabetical: + if kmod.allowed_list and pkg in kmod.allowed_list: + file.write(kmod.kmod_pathname) + file.write('\n') + i = i + 1 + log.info('Module list %s created with %s kmods', output_path, i) + + +class FiltermodTests(unittest.TestCase): + do_pictures = '' + + def setUp(self): + self.pkg_list = None + self.kmod_list = None + + def _is_kmod_pkg(self, kmodname, pkgnames): + self.assertIsNotNone(self.pkg_list) + self.assertIsNotNone(self.kmod_list) + + if type(pkgnames) is str: + pkgnames = [pkgnames] + + expected_pkgs = [] + for pkgname in pkgnames: + pkg = self.pkg_list.get(pkgname) + self.assertIsNotNone(pkg) + expected_pkgs.append(pkg) + + kmod = self.kmod_list.get(kmodname) + self.assertIsNotNone(kmod) + + if expected_pkgs: + self.assertTrue(len(kmod.allowed_list) == 1) + self.assertIn(next(iter(kmod.allowed_list)), expected_pkgs) + else: + self.assertEqual(kmod.allowed_list, set()) + + def test1a(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test1.dep'), get_td('test1.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._is_kmod_pkg('kmod1', 'modules-core') + self._is_kmod_pkg('kmod2', 'modules-core') + self._is_kmod_pkg('kmod3', 'modules') + self._is_kmod_pkg('kmod4', 'modules') + + def test1b(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test1.dep'), get_td('test1.yaml'), + do_pictures=FiltermodTests.do_pictures, + variants=['rt']) + + self.assertIsNotNone(self.pkg_list.get('rt-kvm')) + self._is_kmod_pkg('kmod1', 'modules-core') + self._is_kmod_pkg('kmod2', 'modules-core') + self._is_kmod_pkg('kmod3', 'modules') + self._is_kmod_pkg('kmod4', 'rt-kvm') + + def test2(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test2.dep'), get_td('test2.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._is_kmod_pkg('kmod1', 'modules-extra') + self._is_kmod_pkg('kmod2', 'modules') + self._is_kmod_pkg('kmod3', 'modules-core') + self._is_kmod_pkg('kmod4', 'modules-core') + self._is_kmod_pkg('kmod5', 'modules-core') + self._is_kmod_pkg('kmod6', 'modules-extra') + self._is_kmod_pkg('kmod8', 'modules') + + def test3(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test3.dep'), get_td('test3.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._is_kmod_pkg('kmod2', ['modules-core', 'modules']) + self._is_kmod_pkg('kmod4', ['modules-core', 'modules-extra']) + self._is_kmod_pkg('kmod5', 'modules-core') + self._is_kmod_pkg('kmod6', 'modules-core') + + def test4(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test4.dep'), get_td('test4.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._is_kmod_pkg('kmod0', 'modules') + self._is_kmod_pkg('kmod1', 'modules') + self._is_kmod_pkg('kmod2', 'modules') + self._is_kmod_pkg('kmod3', 'modules') + self._is_kmod_pkg('kmod4', 'modules') + self._is_kmod_pkg('kmod5', 'modules') + self._is_kmod_pkg('kmod6', 'modules') + self._is_kmod_pkg('kmod7', 'modules-partner2') + self._is_kmod_pkg('kmod8', 'modules-partner') + self._is_kmod_pkg('kmod9', 'modules-partner') + + def _check_preffered_pkg(self, kmodname, pkgname): + kmod = self.kmod_list.get(kmodname) + self.assertIsNotNone(kmod) + self.assertEqual(kmod.preferred_pkg.name, pkgname) + + def test5(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test5.dep'), get_td('test5.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._check_preffered_pkg('kmod2', 'modules') + self._check_preffered_pkg('kmod3', 'modules-partner') + self._check_preffered_pkg('kmod4', 'modules-partner') + + def test6(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test6.dep'), get_td('test6.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._is_kmod_pkg('kmod2', 'modules-core') + self._is_kmod_pkg('kmod3', 'modules') + self._is_kmod_pkg('kmod4', 'modules') + self._is_kmod_pkg('kmod1', []) + + def test7(self): + self.pkg_list, self.kmod_list = sort_kmods(get_td('test7.dep'), get_td('test7.yaml'), + do_pictures=FiltermodTests.do_pictures) + + self._is_kmod_pkg('kmod1', 'modules-core') + self._is_kmod_pkg('kmod2', 'modules-core') + self._is_kmod_pkg('kmod3', 'modules-other') + self._is_kmod_pkg('kmod4', 'modules') + + +def do_rpm_mapping_test(config_pathname, kmod_rpms): + kmod_dict = {} + + def get_kmods_matching_re(pkgname, param_re): + matched = [] + param_re = '^kernel/' + param_re + pattern = re.compile(param_re) + + for kmod_pathname, kmod_rec in kmod_dict.items(): + m = pattern.match(kmod_pathname) + if m: + matched.append(kmod_pathname) + + return matched + + for kmod_rpm in kmod_rpms.split(): + filename = os.path.basename(kmod_rpm) + + m = re.match(r'.*-modules-([^-]+)', filename) + if not m: + raise Exception('Unrecognized rpm ' + kmod_rpm + ', expected a kernel-modules* rpm') + pkgname = 'modules-' + m.group(1) + m = re.match(r'modules-([0-9.]+)', pkgname) + if m: + pkgname = 'modules' + + tmpdir = os.path.join('tmp.filtermods', filename, pkgname) + if not os.path.exists(tmpdir): + log.info('creating tmp dir %s', tmpdir) + os.makedirs(tmpdir) + safe_run_command('rpm2cpio %s | cpio -id' % (os.path.abspath(kmod_rpm)), cwddir=tmpdir) + else: + log.info('using cached content of tmp dir: %s', tmpdir) + + for path, subdirs, files in os.walk(tmpdir): + for name in files: + ret = re.match(r'.*/'+pkgname+'/lib/modules/[^/]+/[^/]+/(.*)', os.path.join(path, name)) + if not ret: + continue + + kmod_pathname = 'kernel/' + ret.group(1) + if not kmod_pathname.endswith('.xz') and not kmod_pathname.endswith('.ko'): + continue + if kmod_pathname in kmod_dict: + if pkgname not in kmod_dict[kmod_pathname]['target_pkgs']: + kmod_dict[kmod_pathname]['target_pkgs'].append(pkgname) + else: + kmod_dict[kmod_pathname] = {} + kmod_dict[kmod_pathname]['target_pkgs'] = [pkgname] + kmod_dict[kmod_pathname]['pkg'] = None + kmod_dict[kmod_pathname]['matched'] = False + + kmod_pkg_list = load_config(config_pathname, None) + + for package_name, rule_type, rule in kmod_pkg_list.rules: + kmod_names = get_kmods_matching_re(package_name, rule) + + for kmod_pathname in kmod_names: + kmod_rec = kmod_dict[kmod_pathname] + + if not kmod_rec['matched']: + kmod_rec['matched'] = True + kmod_rec['pkg'] = package_name + for kmod_pathname, kmod_rec in kmod_dict.items(): + if kmod_rec['pkg'] not in kmod_rec['target_pkgs']: + log.warning('kmod %s wanted by config in %s, in tree it is: %s', kmod_pathname, [kmod_rec['pkg']], kmod_rec['target_pkgs']) + elif len(kmod_rec['target_pkgs']) > 1: + # if set(kmod_rec['target_pkgs']) != set(['modules', 'modules-core']): + log.warning('kmod %s multiple matches in tree: %s/%s', kmod_pathname, [kmod_rec['pkg']], kmod_rec['target_pkgs']) + + +def cmd_sort(options): + do_pictures = '' + if options.graphviz: + do_pictures = '0f' + + pkg_list, kmod_list = sort_kmods(options.depmod, options.config, + options.variants, do_pictures) + ret = print_report(pkg_list, kmod_list) + if options.output: + write_modules_lists(options.output, pkg_list, kmod_list) + + return ret + + +def cmd_print_rule_map(options): + kmod_list = KModList() + kmod_list.load_depmod_file(options.depmod) + pkg_list = load_config(options.config, kmod_list, options.variants) + apply_initial_labels(pkg_list, kmod_list, treat_default_as_wants=True) + + for kmod in kmod_list.get_alphabetical_order(): + print('%-20s %s' % (kmod.preferred_pkg, kmod.kmod_pathname)) + + +def cmd_selftest(options): + if options.graphviz: + FiltermodTests.do_pictures = '0f' + + for arg in ['selftest', '-g', '--graphviz']: + if arg in sys.argv: + sys.argv.remove(arg) + + unittest.main() + sys.exit(0) + + +def cmd_cmp2rpm(options): + do_rpm_mapping_test(options.config, options.kmod_rpms) + + +def main(): + global log + + parser = argparse.ArgumentParser() + parser.add_argument('-v', '--verbose', dest='verbose', + help='be more verbose', action='count', default=4) + parser.add_argument('-q', '--quiet', dest='quiet', + help='be more quiet', action='count', default=0) + parser.add_argument('-l', '--log-filename', dest='log_filename', + help='log filename', default='filtermods.log') + + subparsers = parser.add_subparsers(dest='cmd') + + def add_graphviz_arg(p): + p.add_argument('-g', '--graphviz', dest='graphviz', + help='generate graphviz visualizations', + action='store_true', default=False) + + def add_config_arg(p): + p.add_argument('-c', '--config', dest='config', required=True, + help='path to yaml config with rules') + + def add_depmod_arg(p): + p.add_argument('-d', '--depmod', dest='depmod', required=True, + help='path to modules.dep file') + + def add_output_arg(p): + p.add_argument('-o', '--output', dest='output', default=None, + help='output $module_name.list files to directory specified by this parameter') + + def add_variants_arg(p): + p.add_argument('-r', '--variants', dest='variants', action='append', default=[], + help='variants to enable in config') + + def add_kmod_rpms_arg(p): + p.add_argument('-k', '--kmod-rpms', dest='kmod_rpms', required=True, + help='compare content of specified rpm(s) against yaml config rules') + + parser_sort = subparsers.add_parser('sort', help='assign kmods specified by modules.dep using rules from yaml config') + add_config_arg(parser_sort) + add_depmod_arg(parser_sort) + add_output_arg(parser_sort) + add_variants_arg(parser_sort) + add_graphviz_arg(parser_sort) + + parser_rule_map = subparsers.add_parser('rulemap', help='print how yaml config maps to kmods') + add_config_arg(parser_rule_map) + add_depmod_arg(parser_rule_map) + add_variants_arg(parser_rule_map) + + parser_test = subparsers.add_parser('selftest', help='runs a self-test') + add_graphviz_arg(parser_test) + + parser_cmp2rpm = subparsers.add_parser('cmp2rpm', help='compare ruleset against RPM(s)') + add_config_arg(parser_cmp2rpm) + add_kmod_rpms_arg(parser_cmp2rpm) + + options = parser.parse_args() + + if options.cmd == "selftest": + options.verbose = options.verbose - 2 + options.verbose = max(options.verbose - options.quiet, 0) + levels = [NOTSET, CRITICAL, ERROR, WARN, INFO, DEBUG] + stdout_log_level = levels[min(options.verbose, len(levels) - 1)] + + log = setup_logging(options.log_filename, stdout_log_level) + + ret = 0 + if options.cmd == "sort": + ret = cmd_sort(options) + elif options.cmd == "rulemap": + cmd_print_rule_map(options) + elif options.cmd == "selftest": + cmd_selftest(options) + elif options.cmd == "cmp2rpm": + cmd_cmp2rpm(options) + else: + parser.print_help() + + return ret + + +if __name__ == '__main__': + # import profile + # profile.run('main()', sort=1) + sys.exit(main()) diff --git a/SOURCES/generate_bls_conf.sh b/SOURCES/generate_bls_conf.sh deleted file mode 100755 index 03b2182..0000000 --- a/SOURCES/generate_bls_conf.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -e - -# shellcheck disable=SC1091 -. /etc/os-release - -kernelver=$1 && shift -rootfs=$1 && shift -variant=$1 && shift - -output="${rootfs}/lib/modules/${kernelver}/bls.conf" -date=$(date -u +%Y%m%d%H%M%S) - -if [ "${variant:-5}" = "debug" ]; then - debugname=" with debugging" - debugid="-debug" -else - debugname="" - debugid="" -fi - -# shellcheck will complain about bootprefix being referenced but not assigned, -# but that is perfectly OK here. -# shellcheck disable=SC2154 -cat > "$output" < "$output" < [6.8.12-0] -- sunrpc: use the struct net as the svc proc private (Josef Bacik) -- Linux v6.8.12 +* Wed Jun 12 2024 Justin M. Forbes [6.9.4-0] +- Add libbpf workaround for F39 to patches (Justin M. Forbes) +- Linux v6.9.4 Resolves: -* Sun May 26 2024 Justin M. Forbes [6.8.11-0] +* Thu May 30 2024 Justin M. Forbes [6.9.3-0] +- Linux v6.9.3 +Resolves: + +* Sun May 26 2024 Justin M. Forbes [6.9.2-0] - redhat/configs: fedora: aarch64: Re-enable CUSE (Neal Gompa) -- Remove f38 from release_targets (Justin M. Forbes) -- Add more Bugs addressed by 6.8.10 to BugsFixed (Justin M. Forbes) -- Linux v6.8.11 +- Linux v6.9.2 +Resolves: + +* Tue May 21 2024 Justin M. Forbes [6.9.1-0] +- Fix mismatch in IO_URING since we dropped the RHEL patch (Justin M. Forbes) +- Set up for stable Fedora (Justin M. Forbes) +- Linux v6.9.1 +Resolves: + +* Mon May 13 2024 Justin M. Forbes [6.9.0-1] +- Reset RHEL_RELEASE to 0 for 6.10 (Justin M. Forbes) +- configs: move CONFIG_BLK_DEV_UBLK into rhel/configs/generic (Ming Lei) +- configs: move CONFIG_BLK_SED_OPAL into redhat/configs/common/generic (Ming Lei) +- RHEL-21097: rhel: aarch64 stop blocking a number of HW sensors (Peter Robinson) +- redhat/configs: enable RTL8822BU for rhel (Jose Ignacio Tornos Martinez) +- redhat/configs: remove CONFIG_DMA_PERNUMA_CMA and switch CONFIG_DMA_NUMA_CMA off (Jerry Snitselaar) +- redhat: add IMA certificates (Jan Stancek) +- redhat/kernel.spec: fix typo in move_kmod_list() variable (Jan Stancek) +Resolves: + +* Mon May 13 2024 Fedora Kernel Team [6.9.0-64] +- Linux v6.9.0 Resolves: -* Fri May 17 2024 Augusto Caringi [6.8.10-0] -- redhat/configs: Enable CONFIG_DEBUG_INFO_BTF_MODULES (Augusto Caringi) -- Add bugs to BugsFixed for 6.8.10 (Justin M. Forbes) +* Sat May 11 2024 Fedora Kernel Team [6.9.0-0.rc7.cf87f46fd34d.63] +- Linux v6.9.0-0.rc7.cf87f46fd34d +Resolves: + +* Fri May 10 2024 Fedora Kernel Team [6.9.0-0.rc7.448b3fe5a0ea.62] +- redhat: make filtermods.py less verbose by default (Jan Stancek) +- Linux v6.9.0-0.rc7.448b3fe5a0ea +Resolves: + +* Thu May 09 2024 Fedora Kernel Team [6.9.0-0.rc7.45db3ab70092.61] +- scsi: sd: condition probe_type under RHEL_DIFFERENCES (Eric Chanudet) +- scsi: sd: remove unused sd_probe_types (Eric Chanudet) - Turn on INIT_ON_ALLOC_DEFAULT_ON for Fedora (Justin M. Forbes) -- Reapply "drm/qxl: simplify qxl_fence_wait" (Linus Torvalds) -- BugsFixed updates for 6.8.10 (Justin M. Forbes) -- e1000e: change usleep_range to udelay in PHY mdic access (Vitaly Lifshits) -- Linux v6.8.10 +- Linux v6.9.0-0.rc7.45db3ab70092 Resolves: -* Thu May 02 2024 Augusto Caringi [6.8.9-0] -- redhat/configs: Enable CONFIG_CPU_MITIGATIONS (Augusto Caringi) +* Wed May 08 2024 Fedora Kernel Team [6.9.0-0.rc7.dccb07f2914c.60] +- Consolidate configs to common for 6.9 (Justin M. Forbes) +Resolves: + +* Tue May 07 2024 Fedora Kernel Team [6.9.0-0.rc7.dccb07f2914c.59] +- redhat/rhel_files: move tipc.ko and tipc_diag.ko to modules-extra (Xin Long) [RHEL-23931] +- redhat: move amd-pstate-ut.ko to modules-internal (Jan Stancek) +- redhat/configs: enable CONFIG_LEDS_TRIGGER_NETDEV also for RHEL (Michal Schmidt) [RHEL-32110] +- redhat/configs: Remove CONFIG_AMD_IOMMU_V2 (Jerry Snitselaar) +- Linux v6.9.0-0.rc7.dccb07f2914c +Resolves: RHEL-23931, RHEL-32110 + +* Mon May 06 2024 Fedora Kernel Team [6.9.0-0.rc7.58] +- Linux v6.9.0-0.rc7 +Resolves: + +* Sat May 04 2024 Fedora Kernel Team [6.9.0-0.rc6.7367539ad4b0.57] +- Set DEBUG_INFO_BTF_MODULES for Fedora (Justin M. Forbes) +- Linux v6.9.0-0.rc6.7367539ad4b0 +Resolves: + +* Fri May 03 2024 Fedora Kernel Team [6.9.0-0.rc6.f03359bca01b.56] +- Linux v6.9.0-0.rc6.f03359bca01b +Resolves: + +* Thu May 02 2024 Fedora Kernel Team [6.9.0-0.rc6.0106679839f7.55] +- redhat: Use redhatsecureboot701 for ppc64le (Jan Stancek) +- redhat: switch the kernel package to use certs from system-sb-certs (Jan Stancek) +- redhat: replace redhatsecureboot303 signing key with redhatsecureboot601 (Jan Stancek) +- redhat: drop certificates that were deprecated after GRUB's BootHole flaw (Jan Stancek) +- redhat: correct file name of redhatsecurebootca1 (Jan Stancek) +- redhat: align file names with names of signing keys for ppc and s390 (Jan Stancek) +Resolves: + +* Thu May 02 2024 Fedora Kernel Team [6.9.0-0.rc6.0106679839f7.54] +- Linux v6.9.0-0.rc6.0106679839f7 +Resolves: + +* Wed May 01 2024 Fedora Kernel Team [6.9.0-0.rc6.18daea77cca6.53] +- redhat/configs: Enable CONFIG_DM_VDO in RHEL (Benjamin Marzinski) +- redhat/configs: Enable DRM_NOUVEAU_GSP_DEFAULT everywhere (Neal Gompa) +- Linux v6.9.0-0.rc6.18daea77cca6 +Resolves: + +* Tue Apr 30 2024 Fedora Kernel Team [6.9.0-0.rc6.52] +- kernel.spec: adjust for livepatching kselftests (Joe Lawrence) +- redhat/configs: remove CONFIG_TEST_LIVEPATCH (Joe Lawrence) - Turn on CONFIG_RANDOM_KMALLOC_CACHES for Fedora (Justin M. Forbes) -- drm/nouveau/dp: Don't probe eDP ports twice harder (Lyude Paul) -- drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports (Lyude Paul) -- drm/dp: Don't attempt AUX transfers when eDP panels are not powered (Douglas Anderson) -- Linux v6.8.9 +- Set Fedora configs for 6.9 (Justin M. Forbes) +Resolves: + +* Mon Apr 29 2024 Fedora Kernel Team [6.9.0-0.rc6.51] +- gitlab-ci: enable pipelines with c10s buildroot (Michael Hofmann) +- Linux v6.9.0-0.rc6 Resolves: -* Sat Apr 27 2024 Justin M. Forbes [6.8.8-0] -- Update BugsFixed for 6.8.8 (Justin M. Forbes) +* Sun Apr 28 2024 Fedora Kernel Team [6.9.0-0.rc5.2c8159388952.50] +- Linux v6.9.0-0.rc5.2c8159388952 +Resolves: + +* Sat Apr 27 2024 Fedora Kernel Team [6.9.0-0.rc5.5eb4573ea63d.49] +- Linux v6.9.0-0.rc5.5eb4573ea63d +Resolves: + +* Fri Apr 26 2024 Fedora Kernel Team [6.9.0-0.rc5.c942a0cd3603.48] - Turn on ISM for Fedora (Justin M. Forbes) +- Linux v6.9.0-0.rc5.c942a0cd3603 +Resolves: + +* Thu Apr 25 2024 Fedora Kernel Team [6.9.0-0.rc5.e88c4cfcb7b8.47] +- Linux v6.9.0-0.rc5.e88c4cfcb7b8 +Resolves: + +* Wed Apr 24 2024 Fedora Kernel Team [6.9.0-0.rc5.9d1ddab261f3.46] +- redhat/configs: enable CONFIG_TEST_LOCKUP for non-debug kernels (Čestmír Kalina) +- redhat/rhel_files: add test_lockup.ko to modules-extra (Čestmír Kalina) - Turn off some Fedora UBSAN options to avoid false positives (Justin M. Forbes) +- Linux v6.9.0-0.rc5.9d1ddab261f3 +Resolves: + +* Tue Apr 23 2024 Fedora Kernel Team [6.9.0-0.rc5.71b1543c83d6.45] +- Linux v6.9.0-0.rc5.71b1543c83d6 +Resolves: + +* Mon Apr 22 2024 Fedora Kernel Team [6.9.0-0.rc5.44] - fedora: aarch64: Enable a QCom Robotics platforms requirements (Peter Robinson) +- fedora: updates for 6.9 merge window (Peter Robinson) +- gitlab-ci: rename GitLab jobs ark -> rawhide (Michael Hofmann) +- Linux v6.9.0-0.rc5 +Resolves: + +* Sun Apr 21 2024 Fedora Kernel Team [6.9.0-0.rc4.977b1ef51866.43] +- Linux v6.9.0-0.rc4.977b1ef51866 +Resolves: + +* Sat Apr 20 2024 Fedora Kernel Team [6.9.0-0.rc4.13a2e429f644.42] +- Linux v6.9.0-0.rc4.13a2e429f644 +Resolves: + +* Fri Apr 19 2024 Fedora Kernel Team [6.9.0-0.rc4.2668e3ae2ef3.41] +- gitlab-ci: harmonize DataWarehouse tree names (Michael Hofmann) +- redhat/configs: Enable CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON for rhel (Jerry Snitselaar) +- spec: make sure posttrans script doesn't fail if /boot is non-POSIX (glb) +- Linux v6.9.0-0.rc4.2668e3ae2ef3 +Resolves: + +* Thu Apr 18 2024 Fedora Kernel Team [6.9.0-0.rc4.8cd26fd90c1a.40] - Turn on UBSAN for Fedora (Justin M. Forbes) -- Linux v6.8.8 +- Linux v6.9.0-0.rc4.8cd26fd90c1a Resolves: -* Wed Apr 17 2024 Augusto Caringi [6.8.7-0] -- redhat/configs: Enable CONFIG_MITIGATION_SPECTRE_BHI (Augusto Caringi) +* Wed Apr 17 2024 Fedora Kernel Team [6.9.0-0.rc4.96fca68c4fbf.39] - Turn on XEN_BALLOON_MEMORY_HOTPLUG for Fedora (Justin M. Forbes) -- Linux v6.8.7 Resolves: -* Sat Apr 13 2024 Justin M. Forbes [6.8.6-0] -- nouveau: fix devinit paths to only handle display on GSP. (Dave Airlie) -- Add bluetooth bug to Bugsfixed for 6.8.6 (Justin M. Forbes) -- Bluetooth: l2cap: Don't double set the HCI_CONN_MGMT_CONNECTED bit (Archie Pusaka) -- Linux v6.8.6 +* Tue Apr 16 2024 Fedora Kernel Team [6.9.0-0.rc4.96fca68c4fbf.38] +- Linux v6.9.0-0.rc4.96fca68c4fbf +Resolves: + +* Mon Apr 15 2024 Fedora Kernel Team [6.9.0-0.rc4.37] +- Linux v6.9.0-0.rc4 Resolves: -* Wed Apr 10 2024 Justin M. Forbes [6.8.5-0] -- Set configs for SPECTRE_BHI (Justin M. Forbes) -- Add AMD PMF bug (Justin M. Forbes) +* Sun Apr 14 2024 Fedora Kernel Team [6.9.0-0.rc3.7efd0a74039f.36] +- Linux v6.9.0-0.rc3.7efd0a74039f +Resolves: + +* Sat Apr 13 2024 Fedora Kernel Team [6.9.0-0.rc3.8f2c057754b2.35] +- docs: point out that python3-pyyaml is now required (Thorsten Leemhuis) +- Linux v6.9.0-0.rc3.8f2c057754b2 +Resolves: + +* Fri Apr 12 2024 Fedora Kernel Team [6.9.0-0.rc3.586b5dfb51b9.34] +- Use LLVM=1 for clang_lto build (Nikita Popov) +- redhat: fix def_variants.yaml check (Jan Stancek) +- Linux v6.9.0-0.rc3.586b5dfb51b9 +Resolves: + +* Thu Apr 11 2024 Fedora Kernel Team [6.9.0-0.rc3.e8c39d0f57f3.33] +- redhat: sanity check yaml files (Jan Stancek) +- spec: rework filter-mods and mod-denylist (Jan Stancek) +- Linux v6.9.0-0.rc3.e8c39d0f57f3 +Resolves: + +* Wed Apr 10 2024 Fedora Kernel Team [6.9.0-0.rc3.2c71fdf02a95.32] +- Linux v6.9.0-0.rc3.2c71fdf02a95 +Resolves: + +* Tue Apr 09 2024 Fedora Kernel Team [6.9.0-0.rc3.20cb38a7af88.31] +- Linux v6.9.0-0.rc3.20cb38a7af88 +Resolves: + +* Mon Apr 08 2024 Fedora Kernel Team [6.9.0-0.rc3.30] +- Linux v6.9.0-0.rc3 +Resolves: + +* Sun Apr 07 2024 Fedora Kernel Team [6.9.0-0.rc2.f2f80ac80987.29] +- Linux v6.9.0-0.rc2.f2f80ac80987 +Resolves: + +* Sat Apr 06 2024 Fedora Kernel Team [6.9.0-0.rc2.6c6e47d69d82.28] +- redhat/configs: remove CONFIG_INTEL_MENLOW as it is obsolete. (David Arcari) +- Linux v6.9.0-0.rc2.6c6e47d69d82 +Resolves: + +* Fri Apr 05 2024 Fedora Kernel Team [6.9.0-0.rc2.8cb4a9a82b21.27] +- Linux v6.9.0-0.rc2.8cb4a9a82b21 +Resolves: + +* Thu Apr 04 2024 Fedora Kernel Team [6.9.0-0.rc2.c85af715cac0.26] +- Linux v6.9.0-0.rc2.c85af715cac0 +Resolves: + +* Wed Apr 03 2024 Fedora Kernel Team [6.9.0-0.rc2.026e680b0a08.25] +- arch/x86: Fix XSAVE check for x86_64-v2 check (Prarit Bhargava) +- redhat/Makefile.variables: unquote a variable (Thorsten Leemhuis) +Resolves: + +* Tue Apr 02 2024 Fedora Kernel Team [6.9.0-0.rc2.026e680b0a08.24] +- redhat/configs: build in Tegra210 SPI driver (Mark Salter) +- redhat/configs: aarch64: Enable ARM_FFA driver (Mark Salter) +- Base automotive-devel on rt-devel (Don Zickus) +- Linux v6.9.0-0.rc2.026e680b0a08 +Resolves: + +* Mon Apr 01 2024 Fedora Kernel Team [6.9.0-0.rc2.23] +- Linux v6.9.0-0.rc2 +Resolves: + +* Sun Mar 31 2024 Fedora Kernel Team [6.9.0-0.rc1.712e14250dd2.22] +- Linux v6.9.0-0.rc1.712e14250dd2 +Resolves: + +* Sat Mar 30 2024 Fedora Kernel Team [6.9.0-0.rc1.486291a0e624.21] - redhat/configs: Enable CONFIG_AMDTEE for x86 (David Arcari) -- Add CVE fix for 6.8.5 (Justin M. Forbes) -- Linux v6.8.5 +- redhat/configs: enable CONFIG_TEST_LOCKUP for debug kernel (Čestmír Kalina) +- Linux v6.9.0-0.rc1.486291a0e624 Resolves: -* Thu Apr 04 2024 Justin M. Forbes [6.8.4-0] -- Linux v6.8.4 +* Fri Mar 29 2024 Fedora Kernel Team [6.9.0-0.rc1.317c7bc0ef03.20] +- Linux v6.9.0-0.rc1.317c7bc0ef03 Resolves: -* Wed Apr 03 2024 Justin M. Forbes [6.8.3-0] -- Fix up redhat directory for stable reabses (Justin M. Forbes) -- Add some CVE fixes for 6.8.3 (Justin M. Forbes) -- Add bug to BugsFixed (Justin M. Forbes) -- Revert "Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT" (Johan Hovold) -- Config updates for stable (Justin M. Forbes) -- Linux v6.8.3 +* Thu Mar 28 2024 Fedora Kernel Team [6.9.0-0.rc1.8d025e2092e2.19] +- Linux v6.9.0-0.rc1.8d025e2092e2 Resolves: -* Tue Mar 26 2024 Justin M. Forbes [6.8.2-0] -- xfs: fix SEEK_HOLE/DATA for regions with active COW extents (Dave Chinner) +* Wed Mar 27 2024 Fedora Kernel Team [6.9.0-0.rc1.7033999ecd7b.18] +- kernel.spec: fix libperf-debuginfo content (Jan Stancek) +- Turn on DM_VDO for Fedora (Justin M. Forbes) - redhat: make libperf-devel require libperf %%{version}-%%{release} (Jan Stancek) - kernel.spec: drop custom mode also for System.map ghost entry (Jan Stancek) -- kernel.spec: fix libperf-debuginfo content (Jan Stancek) -- redhat/kernel.spec.template: enable cross for base/RT (Peter Robinson) -- redhat/kernel.spec.template: Fix cross compiling (Peter Robinson) -- Add more bugs to BugsFixed (Justin M. Forbes) -- Add bug to BugsFixed (Justin M. Forbes) +- Octopus merges are too conservative, serialize instead (Don Zickus) +- Add tracking branches for rt-devel (Don Zickus) +- Linux v6.9.0-0.rc1.7033999ecd7b +Resolves: + +* Tue Mar 26 2024 Fedora Kernel Team [6.9.0-0.rc1.928a87efa423.17] +- all: clean-up i915 (Peter Robinson) - Turn on CONFIG_READ_ONLY_THP_FOR_FS for Fedora (Justin M. Forbes) -- Change fedora-stable-release.sh to use git am (Justin M. Forbes) -- drivers/firmware: skip simpledrm if nvidia-drm.modeset=1 is set (Javier Martinez Canillas) -- Revert libcpupower soname bump for F38/39 (Justin M. Forbes) -- Fix up requires for UKI (Justin M. Forbes) -- drm/amd: Flush GFXOFF requests in prepare stage (Mario Limonciello) -- Linux v6.8.2 +- redhat/kernel.spec.template: fix rtonly build (Jan Stancek) +- redhat/kernel.spec.template: add extra flags for tools build (Scott Weaver) +- Add iio-test-gts to mod-internal.list (Thorsten Leemhuis) +- Linux v6.9.0-0.rc1.928a87efa423 Resolves: -* Wed Mar 20 2024 Augusto Caringi [6.8.1-0] -- redhat/configs: Enable CONFIG_MITIGATION_RFDS (Augusto Caringi) +* Mon Mar 25 2024 Fedora Kernel Team [6.9.0-0.rc1.16] +- redhat/kernel.spec.template: update license (Scott Weaver) +- Fix typo in maintaining.rst file (Augusto Caringi) +- Linux v6.9.0-0.rc1 +Resolves: + +* Sun Mar 24 2024 Fedora Kernel Team [6.9.0-0.rc0.70293240c5ce.15] +- Linux v6.9.0-0.rc0.70293240c5ce +Resolves: + +* Sat Mar 23 2024 Fedora Kernel Team [6.9.0-0.rc0.bfa8f18691ed.14] +- Enable DRM_CDNS_DSI_J721E for fedora (Andrew Halaney) +- Linux v6.9.0-0.rc0.bfa8f18691ed +Resolves: + +* Fri Mar 22 2024 Fedora Kernel Team [6.9.0-0.rc0.8e938e398669.13] +- Linux v6.9.0-0.rc0.8e938e398669 +Resolves: + +* Thu Mar 21 2024 Fedora Kernel Team [6.9.0-0.rc0.23956900041d.12] +- Linux v6.9.0-0.rc0.23956900041d +Resolves: + +* Wed Mar 20 2024 Fedora Kernel Team [6.9.0-0.rc0.a4145ce1e7bc.11] +- gitlab-ci: do not merge ark-latest for gating pipelines (Michael Hofmann) - fedora: Enable MCP9600 (Peter Robinson) -- temporarily remove LIBBPF_DYNAMIC=1 from perf build (Thorsten Leemhuis) -- Added required files for rebase (Augusto Caringi) -- Linux v6.8.1 +- redhat/configs: Enable & consolidate BF-3 drivers config (Luiz Capitulino) +- redhat: Fix RT kernel kvm subpackage requires (Juri Lelli) +- Add new of_test module to mod-internal.list (Thorsten Leemhuis) +- Add new string kunit modules to mod-internal.list (Thorsten Leemhuis) +- Linux v6.9.0-0.rc0.a4145ce1e7bc +Resolves: + +* Tue Mar 19 2024 Fedora Kernel Team [6.9.0-0.rc0.b3603fcb79b1.10] +- redhat/kernel.spec.template: enable cross for base/RT (Peter Robinson) +- redhat/kernel.spec.template: Fix cross compiling (Peter Robinson) +- arch/x86/kernel/setup.c: fixup rh_check_supported (Scott Weaver) +- Linux v6.9.0-0.rc0.b3603fcb79b1 +Resolves: + +* Mon Mar 18 2024 Fedora Kernel Team [6.9.0-0.rc0.f6cef5f8c37f.9] +- Linux v6.9.0-0.rc0.f6cef5f8c37f +Resolves: + +* Sun Mar 17 2024 Fedora Kernel Team [6.9.0-0.rc0.741e9d668aa5.8] +- Linux v6.9.0-0.rc0.741e9d668aa5 +Resolves: + +* Sat Mar 16 2024 Fedora Kernel Team [6.9.0-0.rc0.66a27abac311.7] +- Enable CONFIG_USB_ONBOARD_HUB for RHEL (Charles Mirabile) +- redhat/Makefile.cross: Add CROSS_BASEONLY (Prarit Bhargava) +- gitlab-ci: fix ark-latest merging for parent pipelines running in forks (Michael Hofmann) +- Linux v6.9.0-0.rc0.66a27abac311 +Resolves: + +* Fri Mar 15 2024 Fedora Kernel Team [6.9.0-0.rc0.e5eb28f6d1af.6] +- Linux v6.9.0-0.rc0.e5eb28f6d1af +Resolves: + +* Fri Mar 15 2024 Fedora Kernel Team [6.9.0-0.rc0.480e035fc4c7.5] +- lsm: update security_lock_kernel_down (Scott Weaver) +Resolves: + +* Thu Mar 14 2024 Fedora Kernel Team [6.9.0-0.rc0.480e035fc4c7.4] +- Linux v6.9.0-0.rc0.480e035fc4c7 +Resolves: + +* Wed Mar 13 2024 Fedora Kernel Team [6.9.0-0.rc0.b0546776ad3f.3] +- Fix changelog after rebase (Augusto Caringi) +- Linux v6.9.0-0.rc0.b0546776ad3f Resolves: -* Tue Mar 12 2024 Fedora Kernel Team [6.8.0-1] +* Tue Mar 12 2024 Fedora Kernel Team [6.9.0-0.rc0.855684c7d938.2] - redhat: remove "END OF CHANGELOG" marker from kernel.changelog (Herton R. Krzesinski) - gitlab-ci: enable all variants for rawhide/eln builder image gating (Michael Hofmann) - Fedora: enable Microchip and their useful drivers (Peter Robinson) @@ -2366,6 +2615,6 @@ Resolves: - [initial commit] Add scripts (Laura Abbott) - [initial commit] Add configs (Laura Abbott) - [initial commit] Add Makefiles (Laura Abbott) -- Linux v6.8.0 +- Linux v6.9.0-0.rc0.855684c7d938 Resolves: rhbz#1471185, rhbz#1495307, rhbz#1509329, rhbz#1518076, rhbz#1518874, rhbz#1519554, rhbz#1546831, rhbz#1559877, rhbz#1561171, rhbz#1563590, rhbz#1565704, rhbz#1565717, rhbz#1572321, rhbz#1574502, rhbz#1590829, rhbz#1595918, rhbz#1598366, rhbz#1602033, rhbz#1609604, rhbz#1610493, rhbz#1613522, rhbz#1638087, rhbz#1652256, rhbz#1652266, rhbz#1663728, rhbz#1670017, rhbz#1722136, rhbz#1730649, rhbz#1802694, rhbz#1810301, rhbz#1821565, rhbz#1831065, rhbz#1855161, rhbz#1856174, rhbz#1856176, rhbz#1858592, rhbz#1858594, rhbz#1858596, rhbz#1858599, rhbz#1869674, rhbz#1871130, rhbz#1876435, rhbz#1876436, rhbz#1876977, rhbz#1877192, rhbz#1880486, rhbz#1890304, rhbz#1903201, rhbz#1915073, rhbz#1915290, rhbz#1930649, rhbz#1939095, rhbz#1940075, rhbz#1940794, rhbz#1943423, rhbz#1945002, rhbz#1945179, rhbz#1945477, rhbz#1947240, rhbz#1948340, rhbz#1952426, rhbz#1952863, rhbz#1953486, rhbz#1956988, rhbz#1957210, rhbz#1957219, rhbz#1957305, rhbz#1957636, rhbz#1957819, rhbz#1961178, rhbz#1962936, rhbz#1964537, rhbz#1967640, rhbz#1972795, rhbz#1976270, rhbz#1976835, rhbz#1976877, rhbz#1976884, rhbz#1977056, rhbz#1977529, rhbz#1978539, rhbz#1979379, rhbz#1981406, rhbz#1983298, rhbz#1986223, rhbz#1988254, rhbz#1988384, rhbz#1990040, rhbz#1993393, rhbz#1994858, rhbz#1998953, rhbz#2000835, rhbz#2002344, rhbz#2004233, rhbz#2004821, rhbz#2006813, rhbz#2007430, rhbz#2012226, rhbz#2014492, rhbz#2019377, rhbz#2020132, rhbz#2022578, rhbz#2023782, rhbz#2024595, rhbz#2025985, rhbz#2026319, rhbz#2027506, rhbz#2031547, rhbz#2032758, rhbz#2034670, rhbz#2038999, rhbz#2040643, rhbz#2041184, rhbz#2041186, rhbz#2041365, rhbz#2041990, rhbz#2042240, rhbz#2042241, rhbz#2043141, rhbz#2044155, rhbz#2053836, rhbz#2054579, rhbz#2062054, rhbz#2062909, rhbz#2071969, rhbz#2089765, rhbz#2115876, rhbz#2120968, rhbz#2122595, rhbz#2140017, rhbz#2142658, rhbz#2149273, rhbz#2153073, rhbz#2166911, rhbz#2188441, rhbz#2208834, rhbz#2216678, rhbz#2227793, rhbz#2231407, rhbz#2233269 diff --git a/SOURCES/linux-surface.patch b/SOURCES/linux-surface.patch index ac7daa5..925163b 100644 --- a/SOURCES/linux-surface.patch +++ b/SOURCES/linux-surface.patch @@ -1,4 +1,41 @@ -From 45a9e7f97fc36942e3d70a78fe5313fa78733933 Mon Sep 17 00:00:00 2001 +From 24686c656a230f642f8ed6c09c184660c08cf46c Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sun, 9 Jun 2024 19:48:58 +0200 +Subject: [PATCH] Revert "efi/x86: Set the PE/COFF header's NX compat flag + unconditionally" + +This reverts commit 891f8890a4a3663da7056542757022870b499bc1. + +Revert because of compatibility issues of MS Surface devices and GRUB +with NX. In short, these devices get stuck on boot with NX advertised. +So to not advertise it, add the respective option back in. + +Signed-off-by: Maximilian Luz +Patchset: secureboot +--- + arch/x86/boot/header.S | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S +index b5c79f43359bc..a1bbedd989e42 100644 +--- a/arch/x86/boot/header.S ++++ b/arch/x86/boot/header.S +@@ -111,7 +111,11 @@ extra_header_fields: + .long salign # SizeOfHeaders + .long 0 # CheckSum + .word IMAGE_SUBSYSTEM_EFI_APPLICATION # Subsystem (EFI application) ++#ifdef CONFIG_EFI_DXE_MEM_ATTRIBUTES + .word IMAGE_DLL_CHARACTERISTICS_NX_COMPAT # DllCharacteristics ++#else ++ .word 0 # DllCharacteristics ++#endif + #ifdef CONFIG_X86_32 + .long 0 # SizeOfStackReserve + .long 0 # SizeOfStackCommit +-- +2.45.1 + +From a494cdb84ee162accff966a0012992e36e4b0c0a Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 18 Oct 2020 16:42:44 +0900 Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI @@ -40,7 +77,7 @@ Patchset: surface3-oemb 3 files changed, 24 insertions(+) diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c -index c15ed7a12784..1ec8edb5aafa 100644 +index c15ed7a12784a..1ec8edb5aafaf 100644 --- a/drivers/platform/surface/surface3-wmi.c +++ b/drivers/platform/surface/surface3-wmi.c @@ -37,6 +37,13 @@ static const struct dmi_system_id surface3_dmi_table[] = { @@ -58,10 +95,10 @@ index c15ed7a12784..1ec8edb5aafa 100644 { } }; diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c -index 20191a4473c2..5ba599b5aba6 100644 +index d0d24a53df746..43e06166a5d95 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c -@@ -3768,6 +3768,15 @@ static const struct dmi_system_id dmi_platform_data[] = { +@@ -3777,6 +3777,15 @@ static const struct dmi_system_id dmi_platform_data[] = { }, .driver_data = (void *)&intel_braswell_platform_data, }, @@ -78,7 +115,7 @@ index 20191a4473c2..5ba599b5aba6 100644 /* * Match for the GPDwin which unfortunately uses somewhat diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c -index 5e2ec60e2954..207868c699f2 100644 +index 5e2ec60e2954b..207868c699f29 100644 --- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c @@ -27,6 +27,14 @@ static const struct dmi_system_id cht_table[] = { @@ -97,9 +134,9 @@ index 5e2ec60e2954..207868c699f2 100644 }; -- -2.44.0 +2.45.1 -From 2c7ff35a85341dcd8fa2ea575088881df9dea874 Mon Sep 17 00:00:00 2001 +From 1abf1feb3b521abe9f9c9e8d68d2014e90ecb20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 3 Nov 2020 13:28:04 +0100 Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface @@ -133,7 +170,7 @@ Patchset: mwifiex 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c -index 5f997becdbaa..9a9929424513 100644 +index 5f997becdbaa2..9a9929424513a 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -1702,9 +1702,21 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) @@ -159,7 +196,7 @@ index 5f997becdbaa..9a9929424513 100644 mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | tx_wrap); } diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c -index dd6d21f1dbfd..f46b06f8d643 100644 +index dd6d21f1dbfd7..f46b06f8d6435 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c @@ -13,7 +13,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { @@ -252,7 +289,7 @@ index dd6d21f1dbfd..f46b06f8d643 100644 static void mwifiex_pcie_set_power_d3cold(struct pci_dev *pdev) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h -index d6ff964aec5b..5d30ae39d65e 100644 +index d6ff964aec5bf..5d30ae39d65ec 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h +++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h @@ -4,6 +4,7 @@ @@ -264,9 +301,9 @@ index d6ff964aec5b..5d30ae39d65e 100644 void mwifiex_initialize_quirks(struct pcie_service_card *card); int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev); -- -2.44.0 +2.45.1 -From 4a326d9e87d1dc4945903560d3d22fbd69a8962c Mon Sep 17 00:00:00 2001 +From 0574bff98f5f5af132783f8f72e8ef22e3f36097 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 4 Oct 2020 00:11:49 +0900 Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+ @@ -288,7 +325,7 @@ Patchset: mwifiex 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c -index 9a9929424513..2273e3029776 100644 +index 9a9929424513a..2273e30297766 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -377,6 +377,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, @@ -313,7 +350,7 @@ index 9a9929424513..2273e3029776 100644 } diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c -index f46b06f8d643..99b024ecbade 100644 +index f46b06f8d6435..99b024ecbadea 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c @@ -14,7 +14,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { @@ -407,7 +444,7 @@ index f46b06f8d643..99b024ecbade 100644 static void mwifiex_pcie_set_power_d3cold(struct pci_dev *pdev) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h -index 5d30ae39d65e..c14eb56eb911 100644 +index 5d30ae39d65ec..c14eb56eb9118 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h +++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h @@ -5,6 +5,7 @@ @@ -419,9 +456,9 @@ index 5d30ae39d65e..c14eb56eb911 100644 void mwifiex_initialize_quirks(struct pcie_service_card *card); int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev); -- -2.44.0 +2.45.1 -From dddda6f9c25716dea1265f71b8286936afa192b5 Mon Sep 17 00:00:00 2001 +From 8a4ee131ced8068371a8fa09da17d82414e6d835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 25 Mar 2021 11:33:02 +0100 Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell @@ -457,7 +494,7 @@ Patchset: mwifiex 1 file changed, 15 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index d31edad7a056..fc08e0c51c87 100644 +index fb716849b60f3..1e7b3798108f7 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -65,6 +65,7 @@ static struct usb_driver btusb_driver; @@ -476,7 +513,7 @@ index d31edad7a056..fc08e0c51c87 100644 /* Intel Bluetooth devices */ { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED }, -@@ -4401,6 +4403,19 @@ static int btusb_probe(struct usb_interface *intf, +@@ -4417,6 +4419,19 @@ static int btusb_probe(struct usb_interface *intf, if (id->driver_info & BTUSB_MARVELL) hdev->set_bdaddr = btusb_set_bdaddr_marvell; @@ -497,9 +534,9 @@ index d31edad7a056..fc08e0c51c87 100644 (id->driver_info & BTUSB_MEDIATEK)) { hdev->setup = btusb_mtk_setup; -- -2.44.0 +2.45.1 -From 7b414f11dfa0be3204b0a43b82a75744f8218d57 Mon Sep 17 00:00:00 2001 +From fc56de38d725edc7c3856c2a2d369e1f170f202f Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 27 Feb 2021 00:45:52 +0100 Subject: [PATCH] ath10k: Add module parameters to override board files @@ -521,7 +558,7 @@ Patchset: ath10k 1 file changed, 58 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c -index 0032f8aa892f..17717b53316b 100644 +index fa5e2e6518313..8921b0ebf36b7 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -39,6 +39,9 @@ static bool fw_diag_log; @@ -554,7 +591,7 @@ index 0032f8aa892f..17717b53316b 100644 static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA988X_HW_2_0_VERSION, -@@ -928,6 +937,42 @@ static int ath10k_init_configure_target(struct ath10k *ar) +@@ -931,6 +940,42 @@ static int ath10k_init_configure_target(struct ath10k *ar) return 0; } @@ -597,7 +634,7 @@ index 0032f8aa892f..17717b53316b 100644 static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, const char *dir, const char *file) -@@ -942,6 +987,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, +@@ -945,6 +990,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, if (dir == NULL) dir = "."; @@ -618,9 +655,9 @@ index 0032f8aa892f..17717b53316b 100644 ret = firmware_request_nowarn(&fw, filename, ar->dev); ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n", -- -2.44.0 +2.45.1 -From 4a1fdfebd3e84fe581b512f73bbc551ec9e2d0e8 Mon Sep 17 00:00:00 2001 +From ee272e8a81f073b5475a3bb2c3085b55f181bc24 Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 30 Jul 2020 13:21:53 +0200 Subject: [PATCH] mei: me: Add Icelake device ID for iTouch @@ -633,7 +670,7 @@ Patchset: ipts 2 files changed, 2 insertions(+) diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h -index aac36750d2c5..2ba8db8a9583 100644 +index c3a6657dcd4a2..82eef2f4eb0a8 100644 --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h @@ -92,6 +92,7 @@ @@ -645,7 +682,7 @@ index aac36750d2c5..2ba8db8a9583 100644 #define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */ diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c -index 8cf636c54032..078d3e773cda 100644 +index 7f59dd38c32f5..a56ad5b3f7790 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c @@ -97,6 +97,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { @@ -657,9 +694,9 @@ index 8cf636c54032..078d3e773cda 100644 {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)}, -- -2.44.0 +2.45.1 -From b1e22125c8f241f49cc3a6b7eaa0b6430bb1f1ce Mon Sep 17 00:00:00 2001 +From 8536601cfc6d7671f4c11cab4dca57674f59b349 Mon Sep 17 00:00:00 2001 From: Liban Hannan Date: Tue, 12 Apr 2022 23:31:12 +0100 Subject: [PATCH] iommu: Use IOMMU passthrough mode for IPTS @@ -683,10 +720,10 @@ Patchset: ipts 1 file changed, 29 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c -index 11652e0bcab3..6c01b1aebf27 100644 +index e4a03588a8a0f..61bc54299a591 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c -@@ -40,6 +40,11 @@ +@@ -39,6 +39,11 @@ #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) @@ -698,24 +735,24 @@ index 11652e0bcab3..6c01b1aebf27 100644 #define IOAPIC_RANGE_START (0xfee00000) #define IOAPIC_RANGE_END (0xfeefffff) #define IOVA_START_ADDR (0x1000) -@@ -148,12 +153,14 @@ int intel_iommu_enabled = 0; +@@ -221,12 +226,14 @@ int intel_iommu_sm = IS_ENABLED(CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON); + int intel_iommu_enabled = 0; EXPORT_SYMBOL_GPL(intel_iommu_enabled); - static int dmar_map_gfx = 1; +static int dmar_map_ipts = 1; static int intel_iommu_superpage = 1; static int iommu_identity_mapping; static int iommu_skip_te_disable; + static int disable_igfx_iommu; - #define IDENTMAP_GFX 2 #define IDENTMAP_AZALIA 4 +#define IDENTMAP_IPTS 16 const struct iommu_ops intel_iommu_ops; static const struct iommu_dirty_ops intel_dirty_ops; -@@ -2412,6 +2419,9 @@ static int device_def_domain_type(struct device *dev) +@@ -2401,6 +2408,9 @@ static int device_def_domain_type(struct device *dev) - if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) + if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) return IOMMU_DOMAIN_IDENTITY; + + if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev)) @@ -723,9 +760,9 @@ index 11652e0bcab3..6c01b1aebf27 100644 } return 0; -@@ -2719,6 +2729,9 @@ static int __init init_dmars(void) - if (!dmar_map_gfx) - iommu_identity_mapping |= IDENTMAP_GFX; +@@ -2701,6 +2711,9 @@ static int __init init_dmars(void) + iommu_set_root_entry(iommu); + } + if (!dmar_map_ipts) + iommu_identity_mapping |= IDENTMAP_IPTS; @@ -733,8 +770,8 @@ index 11652e0bcab3..6c01b1aebf27 100644 check_tylersburg_isoch(); ret = si_domain_init(hw_pass_through); -@@ -4896,6 +4909,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev) - dmar_map_gfx = 0; +@@ -4871,6 +4884,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev) + disable_igfx_iommu = 1; } +static void quirk_iommu_ipts(struct pci_dev *dev) @@ -752,7 +789,7 @@ index 11652e0bcab3..6c01b1aebf27 100644 /* G4x/GM45 integrated gfx dmar support is totally busted. */ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_igfx); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_igfx); -@@ -4931,6 +4956,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx); +@@ -4906,6 +4931,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163A, quirk_iommu_igfx); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx); @@ -764,9 +801,9 @@ index 11652e0bcab3..6c01b1aebf27 100644 { if (risky_device(dev)) -- -2.44.0 +2.45.1 -From fa7796bc06659b87f47d8921d0441314612870b9 Mon Sep 17 00:00:00 2001 +From 664128ab9984f6c774d4064548d9b247041d2520 Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Sun, 11 Dec 2022 12:00:59 +0100 Subject: [PATCH] hid: Add support for Intel Precise Touch and Stylus @@ -833,7 +870,7 @@ Patchset: ipts create mode 100644 drivers/hid/ipts/thread.h diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig -index 4c682c650704..a263e49b2ae2 100644 +index 4c682c6507040..a263e49b2ae29 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -1351,4 +1351,6 @@ source "drivers/hid/amd-sfh-hid/Kconfig" @@ -844,7 +881,7 @@ index 4c682c650704..a263e49b2ae2 100644 + endif # HID_SUPPORT diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile -index 082a728eac60..f4bad1b8d813 100644 +index 082a728eac600..f4bad1b8d813f 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -170,3 +170,5 @@ obj-$(INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ish-hid/ @@ -855,7 +892,7 @@ index 082a728eac60..f4bad1b8d813 100644 +obj-$(CONFIG_HID_IPTS) += ipts/ diff --git a/drivers/hid/ipts/Kconfig b/drivers/hid/ipts/Kconfig new file mode 100644 -index 000000000000..297401bd388d +index 0000000000000..297401bd388dd --- /dev/null +++ b/drivers/hid/ipts/Kconfig @@ -0,0 +1,14 @@ @@ -875,7 +912,7 @@ index 000000000000..297401bd388d + module will be called ipts. diff --git a/drivers/hid/ipts/Makefile b/drivers/hid/ipts/Makefile new file mode 100644 -index 000000000000..883896f68e6a +index 0000000000000..883896f68e6ad --- /dev/null +++ b/drivers/hid/ipts/Makefile @@ -0,0 +1,16 @@ @@ -897,7 +934,7 @@ index 000000000000..883896f68e6a +ipts-objs += thread.o diff --git a/drivers/hid/ipts/cmd.c b/drivers/hid/ipts/cmd.c new file mode 100644 -index 000000000000..63a4934bbc5f +index 0000000000000..63a4934bbc5fa --- /dev/null +++ b/drivers/hid/ipts/cmd.c @@ -0,0 +1,61 @@ @@ -964,7 +1001,7 @@ index 000000000000..63a4934bbc5f +} diff --git a/drivers/hid/ipts/cmd.h b/drivers/hid/ipts/cmd.h new file mode 100644 -index 000000000000..2b4079075b64 +index 0000000000000..2b4079075b642 --- /dev/null +++ b/drivers/hid/ipts/cmd.h @@ -0,0 +1,60 @@ @@ -1030,7 +1067,7 @@ index 000000000000..2b4079075b64 +#endif /* IPTS_CMD_H */ diff --git a/drivers/hid/ipts/context.h b/drivers/hid/ipts/context.h new file mode 100644 -index 000000000000..ba33259f1f7c +index 0000000000000..ba33259f1f7c5 --- /dev/null +++ b/drivers/hid/ipts/context.h @@ -0,0 +1,52 @@ @@ -1088,7 +1125,7 @@ index 000000000000..ba33259f1f7c +#endif /* IPTS_CONTEXT_H */ diff --git a/drivers/hid/ipts/control.c b/drivers/hid/ipts/control.c new file mode 100644 -index 000000000000..5360842d260b +index 0000000000000..5360842d260ba --- /dev/null +++ b/drivers/hid/ipts/control.c @@ -0,0 +1,486 @@ @@ -1580,7 +1617,7 @@ index 000000000000..5360842d260b +} diff --git a/drivers/hid/ipts/control.h b/drivers/hid/ipts/control.h new file mode 100644 -index 000000000000..26629c5144ed +index 0000000000000..26629c5144edb --- /dev/null +++ b/drivers/hid/ipts/control.h @@ -0,0 +1,126 @@ @@ -1712,7 +1749,7 @@ index 000000000000..26629c5144ed +#endif /* IPTS_CONTROL_H */ diff --git a/drivers/hid/ipts/desc.h b/drivers/hid/ipts/desc.h new file mode 100644 -index 000000000000..307438c7c80c +index 0000000000000..307438c7c80cd --- /dev/null +++ b/drivers/hid/ipts/desc.h @@ -0,0 +1,80 @@ @@ -1798,7 +1835,7 @@ index 000000000000..307438c7c80c +#endif /* IPTS_DESC_H */ diff --git a/drivers/hid/ipts/eds1.c b/drivers/hid/ipts/eds1.c new file mode 100644 -index 000000000000..ecbb3a8bdaf6 +index 0000000000000..ecbb3a8bdaf60 --- /dev/null +++ b/drivers/hid/ipts/eds1.c @@ -0,0 +1,103 @@ @@ -1907,7 +1944,7 @@ index 000000000000..ecbb3a8bdaf6 +} diff --git a/drivers/hid/ipts/eds1.h b/drivers/hid/ipts/eds1.h new file mode 100644 -index 000000000000..eeeb6575e3e8 +index 0000000000000..eeeb6575e3e89 --- /dev/null +++ b/drivers/hid/ipts/eds1.h @@ -0,0 +1,35 @@ @@ -1948,7 +1985,7 @@ index 000000000000..eeeb6575e3e8 + enum hid_report_type report_type, enum hid_class_request request_type); diff --git a/drivers/hid/ipts/eds2.c b/drivers/hid/ipts/eds2.c new file mode 100644 -index 000000000000..198dc65d7887 +index 0000000000000..198dc65d78876 --- /dev/null +++ b/drivers/hid/ipts/eds2.c @@ -0,0 +1,144 @@ @@ -2098,7 +2135,7 @@ index 000000000000..198dc65d7887 +} diff --git a/drivers/hid/ipts/eds2.h b/drivers/hid/ipts/eds2.h new file mode 100644 -index 000000000000..064e3716907a +index 0000000000000..064e3716907ab --- /dev/null +++ b/drivers/hid/ipts/eds2.h @@ -0,0 +1,35 @@ @@ -2139,7 +2176,7 @@ index 000000000000..064e3716907a + enum hid_report_type report_type, enum hid_class_request request_type); diff --git a/drivers/hid/ipts/hid.c b/drivers/hid/ipts/hid.c new file mode 100644 -index 000000000000..e34a1a4f9fa7 +index 0000000000000..e34a1a4f9fa77 --- /dev/null +++ b/drivers/hid/ipts/hid.c @@ -0,0 +1,225 @@ @@ -2370,7 +2407,7 @@ index 000000000000..e34a1a4f9fa7 +} diff --git a/drivers/hid/ipts/hid.h b/drivers/hid/ipts/hid.h new file mode 100644 -index 000000000000..1ebe77447903 +index 0000000000000..1ebe77447903a --- /dev/null +++ b/drivers/hid/ipts/hid.h @@ -0,0 +1,24 @@ @@ -2400,7 +2437,7 @@ index 000000000000..1ebe77447903 +#endif /* IPTS_HID_H */ diff --git a/drivers/hid/ipts/main.c b/drivers/hid/ipts/main.c new file mode 100644 -index 000000000000..fb5b5c13ee3e +index 0000000000000..fb5b5c13ee3ea --- /dev/null +++ b/drivers/hid/ipts/main.c @@ -0,0 +1,126 @@ @@ -2532,7 +2569,7 @@ index 000000000000..fb5b5c13ee3e +MODULE_LICENSE("GPL"); diff --git a/drivers/hid/ipts/mei.c b/drivers/hid/ipts/mei.c new file mode 100644 -index 000000000000..1e0395ceae4a +index 0000000000000..1e0395ceae4a4 --- /dev/null +++ b/drivers/hid/ipts/mei.c @@ -0,0 +1,188 @@ @@ -2726,7 +2763,7 @@ index 000000000000..1e0395ceae4a +} diff --git a/drivers/hid/ipts/mei.h b/drivers/hid/ipts/mei.h new file mode 100644 -index 000000000000..973bade6b0fd +index 0000000000000..973bade6b0fdd --- /dev/null +++ b/drivers/hid/ipts/mei.h @@ -0,0 +1,66 @@ @@ -2798,7 +2835,7 @@ index 000000000000..973bade6b0fd +#endif /* IPTS_MEI_H */ diff --git a/drivers/hid/ipts/receiver.c b/drivers/hid/ipts/receiver.c new file mode 100644 -index 000000000000..ef66c3c9db80 +index 0000000000000..ef66c3c9db807 --- /dev/null +++ b/drivers/hid/ipts/receiver.c @@ -0,0 +1,250 @@ @@ -3054,7 +3091,7 @@ index 000000000000..ef66c3c9db80 +} diff --git a/drivers/hid/ipts/receiver.h b/drivers/hid/ipts/receiver.h new file mode 100644 -index 000000000000..3de7da62d40c +index 0000000000000..3de7da62d40c1 --- /dev/null +++ b/drivers/hid/ipts/receiver.h @@ -0,0 +1,16 @@ @@ -3076,7 +3113,7 @@ index 000000000000..3de7da62d40c +#endif /* IPTS_RECEIVER_H */ diff --git a/drivers/hid/ipts/resources.c b/drivers/hid/ipts/resources.c new file mode 100644 -index 000000000000..cc14653b2a9f +index 0000000000000..cc14653b2a9f5 --- /dev/null +++ b/drivers/hid/ipts/resources.c @@ -0,0 +1,131 @@ @@ -3213,7 +3250,7 @@ index 000000000000..cc14653b2a9f +} diff --git a/drivers/hid/ipts/resources.h b/drivers/hid/ipts/resources.h new file mode 100644 -index 000000000000..2068e13285f0 +index 0000000000000..2068e13285f0e --- /dev/null +++ b/drivers/hid/ipts/resources.h @@ -0,0 +1,41 @@ @@ -3260,7 +3297,7 @@ index 000000000000..2068e13285f0 +#endif /* IPTS_RESOURCES_H */ diff --git a/drivers/hid/ipts/spec-data.h b/drivers/hid/ipts/spec-data.h new file mode 100644 -index 000000000000..e8dd98895a7e +index 0000000000000..e8dd98895a7ee --- /dev/null +++ b/drivers/hid/ipts/spec-data.h @@ -0,0 +1,100 @@ @@ -3366,7 +3403,7 @@ index 000000000000..e8dd98895a7e +#endif /* IPTS_SPEC_DATA_H */ diff --git a/drivers/hid/ipts/spec-device.h b/drivers/hid/ipts/spec-device.h new file mode 100644 -index 000000000000..41845f9d9025 +index 0000000000000..41845f9d90257 --- /dev/null +++ b/drivers/hid/ipts/spec-device.h @@ -0,0 +1,290 @@ @@ -3662,7 +3699,7 @@ index 000000000000..41845f9d9025 +#endif /* IPTS_SPEC_DEVICE_H */ diff --git a/drivers/hid/ipts/spec-hid.h b/drivers/hid/ipts/spec-hid.h new file mode 100644 -index 000000000000..5a58d4a0a610 +index 0000000000000..5a58d4a0a610f --- /dev/null +++ b/drivers/hid/ipts/spec-hid.h @@ -0,0 +1,34 @@ @@ -3702,7 +3739,7 @@ index 000000000000..5a58d4a0a610 +#endif /* IPTS_SPEC_HID_H */ diff --git a/drivers/hid/ipts/thread.c b/drivers/hid/ipts/thread.c new file mode 100644 -index 000000000000..355e92bea26f +index 0000000000000..355e92bea26f8 --- /dev/null +++ b/drivers/hid/ipts/thread.c @@ -0,0 +1,84 @@ @@ -3792,7 +3829,7 @@ index 000000000000..355e92bea26f +} diff --git a/drivers/hid/ipts/thread.h b/drivers/hid/ipts/thread.h new file mode 100644 -index 000000000000..1f966b8b32c4 +index 0000000000000..1f966b8b32c45 --- /dev/null +++ b/drivers/hid/ipts/thread.h @@ -0,0 +1,59 @@ @@ -3856,9 +3893,62 @@ index 000000000000..1f966b8b32c4 + +#endif /* IPTS_THREAD_H */ -- -2.44.0 +2.45.1 + +From ee8823ff409dc4507cc2f7c8f8c474735b005938 Mon Sep 17 00:00:00 2001 +From: Jasmin Huber +Date: Mon, 15 Apr 2024 10:22:55 +0200 +Subject: [PATCH] Inlude headers to avoid compiler warnings 6.8 kernels compile + with -Wmissing-prototypes. + +Signed-off-by: Dorian Stoll +Patchset: ipts +--- + drivers/hid/ipts/eds1.c | 1 + + drivers/hid/ipts/eds2.c | 1 + + drivers/hid/ipts/receiver.c | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/drivers/hid/ipts/eds1.c b/drivers/hid/ipts/eds1.c +index ecbb3a8bdaf60..7b9f54388a9f6 100644 +--- a/drivers/hid/ipts/eds1.c ++++ b/drivers/hid/ipts/eds1.c +@@ -14,6 +14,7 @@ + #include "context.h" + #include "control.h" + #include "desc.h" ++#include "eds1.h" + #include "spec-device.h" + + int ipts_eds1_get_descriptor(struct ipts_context *ipts, u8 **desc_buffer, size_t *desc_size) +diff --git a/drivers/hid/ipts/eds2.c b/drivers/hid/ipts/eds2.c +index 198dc65d78876..639940794615d 100644 +--- a/drivers/hid/ipts/eds2.c ++++ b/drivers/hid/ipts/eds2.c +@@ -15,6 +15,7 @@ + #include "context.h" + #include "control.h" + #include "desc.h" ++#include "eds2.h" + #include "spec-data.h" + + int ipts_eds2_get_descriptor(struct ipts_context *ipts, u8 **desc_buffer, size_t *desc_size) +diff --git a/drivers/hid/ipts/receiver.c b/drivers/hid/ipts/receiver.c +index ef66c3c9db807..977724c728c3e 100644 +--- a/drivers/hid/ipts/receiver.c ++++ b/drivers/hid/ipts/receiver.c +@@ -16,6 +16,7 @@ + #include "context.h" + #include "control.h" + #include "hid.h" ++#include "receiver.h" + #include "resources.h" + #include "spec-device.h" + #include "thread.h" +-- +2.45.1 -From 619b488e58367467f52d636b5182ff2134df68c0 Mon Sep 17 00:00:00 2001 +From 4b17942da35790b0e703a87267545f5a9f08e1cf Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Sun, 11 Dec 2022 12:03:38 +0100 Subject: [PATCH] iommu: intel: Disable source id verification for ITHC @@ -3870,7 +3960,7 @@ Patchset: ithc 1 file changed, 16 insertions(+) diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c -index 566297bc87dd..a8cd8f12d593 100644 +index 566297bc87ddb..a8cd8f12d5937 100644 --- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -386,6 +386,22 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev) @@ -3897,9 +3987,9 @@ index 566297bc87dd..a8cd8f12d593 100644 * DMA alias provides us with a PCI device and alias. The only case * where the it will return an alias on a different bus than the -- -2.44.0 +2.45.1 -From ee5106b4069dd150a323dce8bce7879d2b27ed0b Mon Sep 17 00:00:00 2001 +From 14baff1c79b6499868b48e6fb4ada851db35c941 Mon Sep 17 00:00:00 2001 From: quo Date: Sun, 11 Dec 2022 12:10:54 +0100 Subject: [PATCH] hid: Add support for Intel Touch Host Controller @@ -3932,7 +4022,7 @@ Patchset: ithc create mode 100644 drivers/hid/ithc/ithc.h diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig -index a263e49b2ae2..03f0f5af289a 100644 +index a263e49b2ae29..03f0f5af289a4 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -1353,4 +1353,6 @@ source "drivers/hid/surface-hid/Kconfig" @@ -3943,7 +4033,7 @@ index a263e49b2ae2..03f0f5af289a 100644 + endif # HID_SUPPORT diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile -index f4bad1b8d813..d32c194400ae 100644 +index f4bad1b8d813f..d32c194400aea 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -172,3 +172,4 @@ obj-$(CONFIG_AMD_SFH_HID) += amd-sfh-hid/ @@ -3953,7 +4043,7 @@ index f4bad1b8d813..d32c194400ae 100644 +obj-$(CONFIG_HID_ITHC) += ithc/ diff --git a/drivers/hid/ithc/Kbuild b/drivers/hid/ithc/Kbuild new file mode 100644 -index 000000000000..aea83f2ac07b +index 0000000000000..aea83f2ac07b4 --- /dev/null +++ b/drivers/hid/ithc/Kbuild @@ -0,0 +1,6 @@ @@ -3965,7 +4055,7 @@ index 000000000000..aea83f2ac07b + diff --git a/drivers/hid/ithc/Kconfig b/drivers/hid/ithc/Kconfig new file mode 100644 -index 000000000000..ede713023609 +index 0000000000000..ede7130236096 --- /dev/null +++ b/drivers/hid/ithc/Kconfig @@ -0,0 +1,12 @@ @@ -3983,7 +4073,7 @@ index 000000000000..ede713023609 + module will be called ithc. diff --git a/drivers/hid/ithc/ithc-debug.c b/drivers/hid/ithc/ithc-debug.c new file mode 100644 -index 000000000000..1f1f1e33f2e5 +index 0000000000000..1f1f1e33f2e5a --- /dev/null +++ b/drivers/hid/ithc/ithc-debug.c @@ -0,0 +1,130 @@ @@ -4119,7 +4209,7 @@ index 000000000000..1f1f1e33f2e5 + diff --git a/drivers/hid/ithc/ithc-dma.c b/drivers/hid/ithc/ithc-dma.c new file mode 100644 -index 000000000000..ffb8689b8a78 +index 0000000000000..ffb8689b8a780 --- /dev/null +++ b/drivers/hid/ithc/ithc-dma.c @@ -0,0 +1,373 @@ @@ -4498,7 +4588,7 @@ index 000000000000..ffb8689b8a78 + diff --git a/drivers/hid/ithc/ithc-dma.h b/drivers/hid/ithc/ithc-dma.h new file mode 100644 -index 000000000000..93652e4476bf +index 0000000000000..93652e4476bf8 --- /dev/null +++ b/drivers/hid/ithc/ithc-dma.h @@ -0,0 +1,69 @@ @@ -4573,7 +4663,7 @@ index 000000000000..93652e4476bf + diff --git a/drivers/hid/ithc/ithc-main.c b/drivers/hid/ithc/ithc-main.c new file mode 100644 -index 000000000000..87ed4aa70fda +index 0000000000000..87ed4aa70fda0 --- /dev/null +++ b/drivers/hid/ithc/ithc-main.c @@ -0,0 +1,728 @@ @@ -5307,7 +5397,7 @@ index 000000000000..87ed4aa70fda + diff --git a/drivers/hid/ithc/ithc-regs.c b/drivers/hid/ithc/ithc-regs.c new file mode 100644 -index 000000000000..e058721886e3 +index 0000000000000..e058721886e37 --- /dev/null +++ b/drivers/hid/ithc/ithc-regs.c @@ -0,0 +1,96 @@ @@ -5409,7 +5499,7 @@ index 000000000000..e058721886e3 + diff --git a/drivers/hid/ithc/ithc-regs.h b/drivers/hid/ithc/ithc-regs.h new file mode 100644 -index 000000000000..d4007d9e2bac +index 0000000000000..d4007d9e2bacc --- /dev/null +++ b/drivers/hid/ithc/ithc-regs.h @@ -0,0 +1,189 @@ @@ -5604,7 +5694,7 @@ index 000000000000..d4007d9e2bac + diff --git a/drivers/hid/ithc/ithc.h b/drivers/hid/ithc/ithc.h new file mode 100644 -index 000000000000..028e55a4ec53 +index 0000000000000..028e55a4ec53e --- /dev/null +++ b/drivers/hid/ithc/ithc.h @@ -0,0 +1,67 @@ @@ -5676,380 +5766,2961 @@ index 000000000000..028e55a4ec53 +void ithc_log_regs(struct ithc *ithc); + -- -2.44.0 +2.45.1 -From 973bf943acca4abdd932b5fdff032de0af07f96e Mon Sep 17 00:00:00 2001 -From: Maximilian Luz -Date: Sun, 22 Oct 2023 14:57:11 +0200 -Subject: [PATCH] platform/surface: aggregator_registry: Add support for - Surface Laptop Go 3 +From 2537922b2f0c1d0002a2afe6d0fc79695add8e60 Mon Sep 17 00:00:00 2001 +From: quo +Date: Fri, 19 Apr 2024 22:11:09 +0200 +Subject: [PATCH] hid: ithc: Update from quo/ithc-linux -Add SAM client device nodes for the Surface Laptop Go 3. It seems to use -the same SAM client devices as the Surface Laptop Go 1 and 2, so re-use -their node group. + - Added QuickSPI support for Surface Laptop Studio 2 + - Use Latency Tolerance Reporting instead of manual CPU latency adjustments -Signed-off-by: Maximilian Luz -Patchset: surface-sam +Based on: https://github.com/quo/ithc-linux/commit/18afc6ffacd70b49fdee2eb1ab0a8acd159edb31 + +Signed-off-by: Dorian Stoll +Patchset: ithc --- - drivers/platform/surface/surface_aggregator_registry.c | 3 +++ - 1 file changed, 3 insertions(+) + drivers/hid/ithc/Kbuild | 2 +- + drivers/hid/ithc/ithc-debug.c | 33 +- + drivers/hid/ithc/ithc-debug.h | 7 + + drivers/hid/ithc/ithc-dma.c | 125 ++----- + drivers/hid/ithc/ithc-dma.h | 24 +- + drivers/hid/ithc/ithc-hid.c | 207 +++++++++++ + drivers/hid/ithc/ithc-hid.h | 32 ++ + drivers/hid/ithc/ithc-legacy.c | 252 ++++++++++++++ + drivers/hid/ithc/ithc-legacy.h | 8 + + drivers/hid/ithc/ithc-main.c | 386 ++++----------------- + drivers/hid/ithc/ithc-quickspi.c | 578 +++++++++++++++++++++++++++++++ + drivers/hid/ithc/ithc-quickspi.h | 39 +++ + drivers/hid/ithc/ithc-regs.c | 72 +++- + drivers/hid/ithc/ithc-regs.h | 143 ++++---- + drivers/hid/ithc/ithc.h | 71 ++-- + 15 files changed, 1441 insertions(+), 538 deletions(-) + create mode 100644 drivers/hid/ithc/ithc-debug.h + create mode 100644 drivers/hid/ithc/ithc-hid.c + create mode 100644 drivers/hid/ithc/ithc-hid.h + create mode 100644 drivers/hid/ithc/ithc-legacy.c + create mode 100644 drivers/hid/ithc/ithc-legacy.h + create mode 100644 drivers/hid/ithc/ithc-quickspi.c + create mode 100644 drivers/hid/ithc/ithc-quickspi.h -diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c -index aeb3feae40ff..2bc4977037fc 100644 ---- a/drivers/platform/surface/surface_aggregator_registry.c -+++ b/drivers/platform/surface/surface_aggregator_registry.c -@@ -367,6 +367,9 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { - /* Surface Laptop Go 2 */ - { "MSHW0290", (unsigned long)ssam_node_group_slg1 }, +diff --git a/drivers/hid/ithc/Kbuild b/drivers/hid/ithc/Kbuild +index aea83f2ac07b4..4937ba1312973 100644 +--- a/drivers/hid/ithc/Kbuild ++++ b/drivers/hid/ithc/Kbuild +@@ -1,6 +1,6 @@ + obj-$(CONFIG_HID_ITHC) := ithc.o -+ /* Surface Laptop Go 3 */ -+ { "MSHW0440", (unsigned long)ssam_node_group_slg1 }, -+ - /* Surface Laptop Studio */ - { "MSHW0123", (unsigned long)ssam_node_group_sls }, +-ithc-objs := ithc-main.o ithc-regs.o ithc-dma.o ithc-debug.o ++ithc-objs := ithc-main.o ithc-regs.o ithc-dma.o ithc-hid.o ithc-legacy.o ithc-quickspi.o ithc-debug.o --- -2.44.0 - -From 7dedc84364f9c1fb73d271c859dce19b4a9644d6 Mon Sep 17 00:00:00 2001 -From: Maximilian Luz -Date: Mon, 20 Nov 2023 19:47:00 +0100 -Subject: [PATCH] platform/surface: aggregator_registry: Add support for - Surface Laptop Studio 2 - -Add SAM client device nodes for the Surface Laptop Studio 2 (SLS2). The -SLS2 is quite similar to the SLS1, but it does not provide the touchpad -as a SAM-HID device. Therefore, add a new node group for the SLS2 and -update the comments accordingly - -Signed-off-by: Maximilian Luz -Patchset: surface-sam ---- - .../surface/surface_aggregator_registry.c | 25 ++++++++++++++++--- - 1 file changed, 21 insertions(+), 4 deletions(-) - -diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c -index 2bc4977037fc..26cb6229ad16 100644 ---- a/drivers/platform/surface/surface_aggregator_registry.c -+++ b/drivers/platform/surface/surface_aggregator_registry.c -@@ -247,8 +247,8 @@ static const struct software_node *ssam_node_group_sl5[] = { - NULL, - }; + ccflags-y := -std=gnu11 -Wno-declaration-after-statement --/* Devices for Surface Laptop Studio. */ --static const struct software_node *ssam_node_group_sls[] = { -+/* Devices for Surface Laptop Studio 1. */ -+static const struct software_node *ssam_node_group_sls1[] = { - &ssam_node_root, - &ssam_node_bat_ac, - &ssam_node_bat_main, -@@ -263,6 +263,20 @@ static const struct software_node *ssam_node_group_sls[] = { - NULL, - }; +diff --git a/drivers/hid/ithc/ithc-debug.c b/drivers/hid/ithc/ithc-debug.c +index 1f1f1e33f2e5a..2d8c6afe99663 100644 +--- a/drivers/hid/ithc/ithc-debug.c ++++ b/drivers/hid/ithc/ithc-debug.c +@@ -85,10 +85,11 @@ static ssize_t ithc_debugfs_cmd_write(struct file *f, const char __user *buf, si + case 'd': // dma command: cmd len data... + // get report descriptor: d 7 8 0 0 + // enable multitouch: d 3 2 0x0105 +- if (n < 2 || a[1] > (n - 2) * 4) ++ if (n < 1) + return -EINVAL; +- pci_info(ithc->pci, "debug dma command %u with %u bytes of data\n", a[0], a[1]); +- if (ithc_dma_tx(ithc, a[0], a[1], a + 2)) ++ pci_info(ithc->pci, "debug dma command with %u bytes of data\n", n * 4); ++ struct ithc_data data = { .type = ITHC_DATA_RAW, .size = n * 4, .data = a }; ++ if (ithc_dma_tx(ithc, &data)) + pci_err(ithc->pci, "dma tx failed\n"); + break; + default: +@@ -98,6 +99,23 @@ static ssize_t ithc_debugfs_cmd_write(struct file *f, const char __user *buf, si + return len; + } -+/* Devices for Surface Laptop Studio 2. */ -+static const struct software_node *ssam_node_group_sls2[] = { -+ &ssam_node_root, -+ &ssam_node_bat_ac, -+ &ssam_node_bat_main, -+ &ssam_node_tmp_pprof, -+ &ssam_node_pos_tablet_switch, -+ &ssam_node_hid_sam_keyboard, -+ &ssam_node_hid_sam_penstash, -+ &ssam_node_hid_sam_sensors, -+ &ssam_node_hid_sam_ucm_ucsi, -+ NULL, -+}; ++static struct dentry *dbg_dir; + - /* Devices for Surface Laptop Go. */ - static const struct software_node *ssam_node_group_slg1[] = { - &ssam_node_root, -@@ -370,8 +384,11 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { - /* Surface Laptop Go 3 */ - { "MSHW0440", (unsigned long)ssam_node_group_slg1 }, - -- /* Surface Laptop Studio */ -- { "MSHW0123", (unsigned long)ssam_node_group_sls }, -+ /* Surface Laptop Studio 1 */ -+ { "MSHW0123", (unsigned long)ssam_node_group_sls1 }, ++void __init ithc_debug_init_module(void) ++{ ++ struct dentry *d = debugfs_create_dir(DEVNAME, NULL); ++ if (IS_ERR(d)) ++ pr_warn("failed to create debugfs dir (%li)\n", PTR_ERR(d)); ++ else ++ dbg_dir = d; ++} + -+ /* Surface Laptop Studio 2 */ -+ { "MSHW0360", (unsigned long)ssam_node_group_sls2 }, - - { }, - }; --- -2.44.0 - -From 96a7b3dd527f3e1b97e2d089a727c16cd5045aa5 Mon Sep 17 00:00:00 2001 -From: Ivor Wanders -Date: Mon, 18 Dec 2023 19:21:32 -0500 -Subject: [PATCH] platform/surface: aggregator_registry: add entry for fan - speed - -Add an entry for the fan speed function. -Add this new entry to the Surface Pro 9 group. - -Signed-off-by: Ivor Wanders -Link: https://github.com/linux-surface/kernel/pull/144 -Reviewed-by: Maximilian Luz -Patchset: surface-sam ---- - drivers/platform/surface/surface_aggregator_registry.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c -index 26cb6229ad16..f02a933160ff 100644 ---- a/drivers/platform/surface/surface_aggregator_registry.c -+++ b/drivers/platform/surface/surface_aggregator_registry.c -@@ -74,6 +74,12 @@ static const struct software_node ssam_node_tmp_pprof = { - .parent = &ssam_node_root, - }; - -+/* Fan speed function. */ -+static const struct software_node ssam_node_fan_speed = { -+ .name = "ssam:01:05:01:01:01", -+ .parent = &ssam_node_root, -+}; ++void __exit ithc_debug_exit_module(void) ++{ ++ debugfs_remove_recursive(dbg_dir); ++ dbg_dir = NULL; ++} + - /* Tablet-mode switch via KIP subsystem. */ - static const struct software_node ssam_node_kip_tablet_switch = { - .name = "ssam:01:0e:01:00:01", -@@ -319,6 +325,7 @@ static const struct software_node *ssam_node_group_sp9[] = { - &ssam_node_bat_ac, - &ssam_node_bat_main, - &ssam_node_tmp_pprof, -+ &ssam_node_fan_speed, - &ssam_node_pos_tablet_switch, - &ssam_node_hid_kip_keyboard, - &ssam_node_hid_kip_penstash, --- -2.44.0 - -From b4eb65349df9859f65aa9990c24c5036d35382da Mon Sep 17 00:00:00 2001 -From: Ivor Wanders -Date: Thu, 30 Nov 2023 20:20:24 -0500 -Subject: [PATCH] hwmon: add fan speed monitoring driver for Surface devices - -Adds a driver that provides read only access to the fan speed for Microsoft -Surface Pro devices. The fan speed is always regulated by the EC and cannot -be influenced directly. - -Signed-off-by: Ivor Wanders -Link: https://github.com/linux-surface/kernel/pull/144 -Patchset: surface-sam ---- - Documentation/hwmon/index.rst | 1 + - Documentation/hwmon/surface_fan.rst | 25 ++++++++ - MAINTAINERS | 8 +++ - drivers/hwmon/Kconfig | 13 ++++ - drivers/hwmon/Makefile | 1 + - drivers/hwmon/surface_fan.c | 93 +++++++++++++++++++++++++++++ - 6 files changed, 141 insertions(+) - create mode 100644 Documentation/hwmon/surface_fan.rst - create mode 100644 drivers/hwmon/surface_fan.c - -diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst -index c7ed1f73ac06..58be92e94a8d 100644 ---- a/Documentation/hwmon/index.rst -+++ b/Documentation/hwmon/index.rst -@@ -208,6 +208,7 @@ Hardware Monitoring Kernel Drivers - smsc47m1 - sparx5-temp - stpddc60 -+ surface_fan - sy7636a-hwmon - tc654 - tc74 -diff --git a/Documentation/hwmon/surface_fan.rst b/Documentation/hwmon/surface_fan.rst + static const struct file_operations ithc_debugfops_cmd = { + .owner = THIS_MODULE, + .write = ithc_debugfs_cmd_write, +@@ -106,17 +124,18 @@ static const struct file_operations ithc_debugfops_cmd = { + static void ithc_debugfs_devres_release(struct device *dev, void *res) + { + struct dentry **dbgm = res; +- if (*dbgm) +- debugfs_remove_recursive(*dbgm); ++ debugfs_remove_recursive(*dbgm); + } + +-int ithc_debug_init(struct ithc *ithc) ++int ithc_debug_init_device(struct ithc *ithc) + { ++ if (!dbg_dir) ++ return -ENOENT; + struct dentry **dbgm = devres_alloc(ithc_debugfs_devres_release, sizeof(*dbgm), GFP_KERNEL); + if (!dbgm) + return -ENOMEM; + devres_add(&ithc->pci->dev, dbgm); +- struct dentry *dbg = debugfs_create_dir(DEVNAME, NULL); ++ struct dentry *dbg = debugfs_create_dir(pci_name(ithc->pci), dbg_dir); + if (IS_ERR(dbg)) + return PTR_ERR(dbg); + *dbgm = dbg; +diff --git a/drivers/hid/ithc/ithc-debug.h b/drivers/hid/ithc/ithc-debug.h new file mode 100644 -index 000000000000..07942574c4f0 +index 0000000000000..38c53d916bdb5 --- /dev/null -+++ b/Documentation/hwmon/surface_fan.rst -@@ -0,0 +1,25 @@ -+.. SPDX-License-Identifier: GPL-2.0-or-later -+ -+Kernel driver surface_fan -+========================= -+ -+Supported Devices: -+ -+ * Microsoft Surface Pro 9 -+ -+Author: Ivor Wanders -+ -+Description -+----------- -+ -+This provides monitoring of the fan found in some Microsoft Surface Pro devices, -+like the Surface Pro 9. The fan is always controlled by the onboard controller. -+ -+Sysfs interface -+--------------- -+ -+======================= ======= ========================================= -+Name Perm Description -+======================= ======= ========================================= -+``fan1_input`` RO Current fan speed in RPM. -+======================= ======= ========================================= -diff --git a/MAINTAINERS b/MAINTAINERS -index 1aabf1c15bb3..b6416cf3f022 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -14576,6 +14576,14 @@ F: Documentation/driver-api/surface_aggregator/clients/dtx.rst - F: drivers/platform/surface/surface_dtx.c - F: include/uapi/linux/surface_aggregator/dtx.h - -+MICROSOFT SURFACE SENSOR FAN DRIVER -+M: Maximilian Luz -+M: Ivor Wanders -+L: linux-hwmon@vger.kernel.org -+S: Maintained -+F: Documentation/hwmon/surface_fan.rst -+F: drivers/hwmon/surface_fan.c -+ - MICROSOFT SURFACE GPE LID SUPPORT DRIVER - M: Maximilian Luz - L: platform-driver-x86@vger.kernel.org -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index a608264da87d..e762f6138970 100644 ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -1994,6 +1994,19 @@ config SENSORS_SFCTEMP - This driver can also be built as a module. If so, the module - will be called sfctemp. - -+config SENSORS_SURFACE_FAN -+ tristate "Surface Fan Driver" -+ depends on SURFACE_AGGREGATOR -+ help -+ Driver that provides monitoring of the fan on Surface Pro devices that -+ have a fan, like the Surface Pro 9. -+ -+ This makes the fan's current speed accessible through the hwmon -+ system. It does not provide control over the fan, the firmware is -+ responsible for that, this driver merely provides monitoring. ++++ b/drivers/hid/ithc/ithc-debug.h +@@ -0,0 +1,7 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ + -+ Select M or Y here, if you want to be able to read the fan's speed. ++void ithc_debug_init_module(void); ++void ithc_debug_exit_module(void); ++int ithc_debug_init_device(struct ithc *ithc); ++void ithc_log_regs(struct ithc *ithc); + - config SENSORS_ADC128D818 - tristate "Texas Instruments ADC128D818" - depends on I2C -diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile -index 47be39af5c03..30cc90f40844 100644 ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -201,6 +201,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o - obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o - obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o - obj-$(CONFIG_SENSORS_STTS751) += stts751.o -+obj-$(CONFIG_SENSORS_SURFACE_FAN)+= surface_fan.o - obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o - obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o - obj-$(CONFIG_SENSORS_TC74) += tc74.o -diff --git a/drivers/hwmon/surface_fan.c b/drivers/hwmon/surface_fan.c +diff --git a/drivers/hid/ithc/ithc-dma.c b/drivers/hid/ithc/ithc-dma.c +index ffb8689b8a780..bf4eab33062b0 100644 +--- a/drivers/hid/ithc/ithc-dma.c ++++ b/drivers/hid/ithc/ithc-dma.c +@@ -173,10 +173,9 @@ int ithc_dma_rx_init(struct ithc *ithc, u8 channel) + mutex_init(&rx->mutex); + + // Allocate buffers. +- u32 buf_size = DEVCFG_DMA_RX_SIZE(ithc->config.dma_buf_sizes); +- unsigned int num_pages = (buf_size + PAGE_SIZE - 1) / PAGE_SIZE; ++ unsigned int num_pages = (ithc->max_rx_size + PAGE_SIZE - 1) / PAGE_SIZE; + pci_dbg(ithc->pci, "allocating rx buffers: num = %u, size = %u, pages = %u\n", +- NUM_RX_BUF, buf_size, num_pages); ++ NUM_RX_BUF, ithc->max_rx_size, num_pages); + CHECK_RET(ithc_dma_prd_alloc, ithc, &rx->prds, NUM_RX_BUF, num_pages, DMA_FROM_DEVICE); + for (unsigned int i = 0; i < NUM_RX_BUF; i++) + CHECK_RET(ithc_dma_data_alloc, ithc, &rx->prds, &rx->bufs[i]); +@@ -214,10 +213,9 @@ int ithc_dma_tx_init(struct ithc *ithc) + mutex_init(&tx->mutex); + + // Allocate buffers. +- tx->max_size = DEVCFG_DMA_TX_SIZE(ithc->config.dma_buf_sizes); +- unsigned int num_pages = (tx->max_size + PAGE_SIZE - 1) / PAGE_SIZE; ++ unsigned int num_pages = (ithc->max_tx_size + PAGE_SIZE - 1) / PAGE_SIZE; + pci_dbg(ithc->pci, "allocating tx buffers: size = %u, pages = %u\n", +- tx->max_size, num_pages); ++ ithc->max_tx_size, num_pages); + CHECK_RET(ithc_dma_prd_alloc, ithc, &tx->prds, 1, num_pages, DMA_TO_DEVICE); + CHECK_RET(ithc_dma_data_alloc, ithc, &tx->prds, &tx->buf); + +@@ -230,71 +228,6 @@ int ithc_dma_tx_init(struct ithc *ithc) + return 0; + } + +-static int ithc_dma_rx_process_buf(struct ithc *ithc, struct ithc_dma_data_buffer *data, +- u8 channel, u8 buf) +-{ +- if (buf >= NUM_RX_BUF) { +- pci_err(ithc->pci, "invalid dma ringbuffer index\n"); +- return -EINVAL; +- } +- u32 len = data->data_size; +- struct ithc_dma_rx_header *hdr = data->addr; +- u8 *hiddata = (void *)(hdr + 1); +- if (len >= sizeof(*hdr) && hdr->code == DMA_RX_CODE_RESET) { +- // The THC sends a reset request when we need to reinitialize the device. +- // This usually only happens if we send an invalid command or put the device +- // in a bad state. +- CHECK(ithc_reset, ithc); +- } else if (len < sizeof(*hdr) || len != sizeof(*hdr) + hdr->data_size) { +- if (hdr->code == DMA_RX_CODE_INPUT_REPORT) { +- // When the CPU enters a low power state during DMA, we can get truncated +- // messages. For Surface devices, this will typically be a single touch +- // report that is only 1 byte, or a multitouch report that is 257 bytes. +- // See also ithc_set_active(). +- } else { +- pci_err(ithc->pci, "invalid dma rx data! channel %u, buffer %u, size %u, code %u, data size %u\n", +- channel, buf, len, hdr->code, hdr->data_size); +- print_hex_dump_debug(DEVNAME " data: ", DUMP_PREFIX_OFFSET, 32, 1, +- hdr, min(len, 0x400u), 0); +- } +- } else if (hdr->code == DMA_RX_CODE_REPORT_DESCRIPTOR && hdr->data_size > 8) { +- // Response to a 'get report descriptor' request. +- // The actual descriptor is preceded by 8 nul bytes. +- CHECK(hid_parse_report, ithc->hid, hiddata + 8, hdr->data_size - 8); +- WRITE_ONCE(ithc->hid_parse_done, true); +- wake_up(&ithc->wait_hid_parse); +- } else if (hdr->code == DMA_RX_CODE_INPUT_REPORT) { +- // Standard HID input report containing touch data. +- CHECK(hid_input_report, ithc->hid, HID_INPUT_REPORT, hiddata, hdr->data_size, 1); +- } else if (hdr->code == DMA_RX_CODE_FEATURE_REPORT) { +- // Response to a 'get feature' request. +- bool done = false; +- mutex_lock(&ithc->hid_get_feature_mutex); +- if (ithc->hid_get_feature_buf) { +- if (hdr->data_size < ithc->hid_get_feature_size) +- ithc->hid_get_feature_size = hdr->data_size; +- memcpy(ithc->hid_get_feature_buf, hiddata, ithc->hid_get_feature_size); +- ithc->hid_get_feature_buf = NULL; +- done = true; +- } +- mutex_unlock(&ithc->hid_get_feature_mutex); +- if (done) { +- wake_up(&ithc->wait_hid_get_feature); +- } else { +- // Received data without a matching request, or the request already +- // timed out. (XXX What's the correct thing to do here?) +- CHECK(hid_input_report, ithc->hid, HID_FEATURE_REPORT, +- hiddata, hdr->data_size, 1); +- } +- } else { +- pci_dbg(ithc->pci, "unhandled dma rx data! channel %u, buffer %u, size %u, code %u\n", +- channel, buf, len, hdr->code); +- print_hex_dump_debug(DEVNAME " data: ", DUMP_PREFIX_OFFSET, 32, 1, +- hdr, min(len, 0x400u), 0); +- } +- return 0; +-} +- + static int ithc_dma_rx_unlocked(struct ithc *ithc, u8 channel) + { + // Process all filled RX buffers from the ringbuffer. +@@ -316,7 +249,16 @@ static int ithc_dma_rx_unlocked(struct ithc *ithc, u8 channel) + rx->num_received = ++n; + + // process data +- CHECK(ithc_dma_rx_process_buf, ithc, b, channel, tail); ++ struct ithc_data d; ++ if ((ithc->use_quickspi ? ithc_quickspi_decode_rx : ithc_legacy_decode_rx) ++ (ithc, b->addr, b->data_size, &d) < 0) { ++ pci_err(ithc->pci, "invalid dma rx data! channel %u, buffer %u, size %u: %*ph\n", ++ channel, tail, b->data_size, min((int)b->data_size, 64), b->addr); ++ print_hex_dump_debug(DEVNAME " data: ", DUMP_PREFIX_OFFSET, 32, 1, ++ b->addr, min(b->data_size, 0x400u), 0); ++ } else { ++ ithc_hid_process_data(ithc, &d); ++ } + + // give the buffer back to the device + CHECK_RET(ithc_dma_data_buffer_put, ithc, &rx->prds, b, tail); +@@ -331,31 +273,28 @@ int ithc_dma_rx(struct ithc *ithc, u8 channel) + return ret; + } + +-static int ithc_dma_tx_unlocked(struct ithc *ithc, u32 cmdcode, u32 datasize, void *data) ++static int ithc_dma_tx_unlocked(struct ithc *ithc, const struct ithc_data *data) + { +- ithc_set_active(ithc, 100 * USEC_PER_MSEC); +- + // Send a single TX buffer to the THC. +- pci_dbg(ithc->pci, "dma tx command %u, size %u\n", cmdcode, datasize); +- struct ithc_dma_tx_header *hdr; +- // Data must be padded to next 4-byte boundary. +- u8 padding = datasize & 3 ? 4 - (datasize & 3) : 0; +- unsigned int fullsize = sizeof(*hdr) + datasize + padding; +- if (fullsize > ithc->dma_tx.max_size || fullsize > PAGE_SIZE) +- return -EINVAL; ++ pci_dbg(ithc->pci, "dma tx data type %u, size %u\n", data->type, data->size); + CHECK_RET(ithc_dma_data_buffer_get, ithc, &ithc->dma_tx.prds, &ithc->dma_tx.buf, 0); + + // Fill the TX buffer with header and data. +- ithc->dma_tx.buf.data_size = fullsize; +- hdr = ithc->dma_tx.buf.addr; +- hdr->code = cmdcode; +- hdr->data_size = datasize; +- u8 *dest = (void *)(hdr + 1); +- memcpy(dest, data, datasize); +- dest += datasize; +- for (u8 p = 0; p < padding; p++) +- *dest++ = 0; ++ ssize_t sz; ++ if (data->type == ITHC_DATA_RAW) { ++ sz = min(data->size, ithc->max_tx_size); ++ memcpy(ithc->dma_tx.buf.addr, data->data, sz); ++ } else { ++ sz = (ithc->use_quickspi ? ithc_quickspi_encode_tx : ithc_legacy_encode_tx) ++ (ithc, data, ithc->dma_tx.buf.addr, ithc->max_tx_size); ++ } ++ ithc->dma_tx.buf.data_size = sz < 0 ? 0 : sz; + CHECK_RET(ithc_dma_data_buffer_put, ithc, &ithc->dma_tx.prds, &ithc->dma_tx.buf, 0); ++ if (sz < 0) { ++ pci_err(ithc->pci, "failed to encode tx data type %i, size %u, error %i\n", ++ data->type, data->size, (int)sz); ++ return -EINVAL; ++ } + + // Let the THC process the buffer. + bitsb_set(&ithc->regs->dma_tx.control, DMA_TX_CONTROL_SEND); +@@ -363,10 +302,10 @@ static int ithc_dma_tx_unlocked(struct ithc *ithc, u32 cmdcode, u32 datasize, vo + writel(DMA_TX_STATUS_DONE, &ithc->regs->dma_tx.status); + return 0; + } +-int ithc_dma_tx(struct ithc *ithc, u32 cmdcode, u32 datasize, void *data) ++int ithc_dma_tx(struct ithc *ithc, const struct ithc_data *data) + { + mutex_lock(&ithc->dma_tx.mutex); +- int ret = ithc_dma_tx_unlocked(ithc, cmdcode, datasize, data); ++ int ret = ithc_dma_tx_unlocked(ithc, data); + mutex_unlock(&ithc->dma_tx.mutex); + return ret; + } +diff --git a/drivers/hid/ithc/ithc-dma.h b/drivers/hid/ithc/ithc-dma.h +index 93652e4476bf8..1749a5819b3e7 100644 +--- a/drivers/hid/ithc/ithc-dma.h ++++ b/drivers/hid/ithc/ithc-dma.h +@@ -11,27 +11,6 @@ struct ithc_phys_region_desc { + u32 unused; + }; + +-#define DMA_RX_CODE_INPUT_REPORT 3 +-#define DMA_RX_CODE_FEATURE_REPORT 4 +-#define DMA_RX_CODE_REPORT_DESCRIPTOR 5 +-#define DMA_RX_CODE_RESET 7 +- +-struct ithc_dma_rx_header { +- u32 code; +- u32 data_size; +- u32 _unknown[14]; +-}; +- +-#define DMA_TX_CODE_SET_FEATURE 3 +-#define DMA_TX_CODE_GET_FEATURE 4 +-#define DMA_TX_CODE_OUTPUT_REPORT 5 +-#define DMA_TX_CODE_GET_REPORT_DESCRIPTOR 7 +- +-struct ithc_dma_tx_header { +- u32 code; +- u32 data_size; +-}; +- + struct ithc_dma_prd_buffer { + void *addr; + dma_addr_t dma_addr; +@@ -49,7 +28,6 @@ struct ithc_dma_data_buffer { + + struct ithc_dma_tx { + struct mutex mutex; +- u32 max_size; + struct ithc_dma_prd_buffer prds; + struct ithc_dma_data_buffer buf; + }; +@@ -65,5 +43,5 @@ int ithc_dma_rx_init(struct ithc *ithc, u8 channel); + void ithc_dma_rx_enable(struct ithc *ithc, u8 channel); + int ithc_dma_tx_init(struct ithc *ithc); + int ithc_dma_rx(struct ithc *ithc, u8 channel); +-int ithc_dma_tx(struct ithc *ithc, u32 cmdcode, u32 datasize, void *cmddata); ++int ithc_dma_tx(struct ithc *ithc, const struct ithc_data *data); + +diff --git a/drivers/hid/ithc/ithc-hid.c b/drivers/hid/ithc/ithc-hid.c new file mode 100644 -index 000000000000..7c2e3ae3eb40 +index 0000000000000..065646ab499ef --- /dev/null -+++ b/drivers/hwmon/surface_fan.c -@@ -0,0 +1,93 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Surface Fan driver for Surface System Aggregator Module. It provides access -+ * to the fan's rpm through the hwmon system. -+ * -+ * Copyright (C) 2023 Ivor Wanders -+ */ -+ -+#include -+#include -+#include -+#include -+#include ++++ b/drivers/hid/ithc/ithc-hid.c +@@ -0,0 +1,207 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause + -+// SSAM -+SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_fan_rpm_get, __le16, { -+ .target_category = SSAM_SSH_TC_FAN, -+ .command_id = 0x01, -+}); ++#include "ithc.h" + -+// hwmon -+umode_t surface_fan_hwmon_is_visible(const void *drvdata, -+ enum hwmon_sensor_types type, u32 attr, -+ int channel) -+{ -+ return 0444; -+} ++static int ithc_hid_start(struct hid_device *hdev) { return 0; } ++static void ithc_hid_stop(struct hid_device *hdev) { } ++static int ithc_hid_open(struct hid_device *hdev) { return 0; } ++static void ithc_hid_close(struct hid_device *hdev) { } + -+static int surface_fan_hwmon_read(struct device *dev, -+ enum hwmon_sensor_types type, u32 attr, -+ int channel, long *val) ++static int ithc_hid_parse(struct hid_device *hdev) +{ -+ struct ssam_device *sdev = dev_get_drvdata(dev); -+ int ret; -+ __le16 value; -+ -+ ret = __ssam_fan_rpm_get(sdev, &value); -+ if (ret) -+ return ret; ++ struct ithc *ithc = hdev->driver_data; ++ const struct ithc_data get_report_desc = { .type = ITHC_DATA_REPORT_DESCRIPTOR }; ++ WRITE_ONCE(ithc->hid.parse_done, false); ++ for (int retries = 0; ; retries++) { ++ ithc_log_regs(ithc); ++ CHECK_RET(ithc_dma_tx, ithc, &get_report_desc); ++ if (wait_event_timeout(ithc->hid.wait_parse, READ_ONCE(ithc->hid.parse_done), ++ msecs_to_jiffies(200))) { ++ ithc_log_regs(ithc); ++ return 0; ++ } ++ if (retries > 5) { ++ ithc_log_regs(ithc); ++ pci_err(ithc->pci, "failed to read report descriptor\n"); ++ return -ETIMEDOUT; ++ } ++ pci_warn(ithc->pci, "failed to read report descriptor, retrying\n"); ++ } ++} ++ ++static int ithc_hid_raw_request(struct hid_device *hdev, unsigned char reportnum, __u8 *buf, ++ size_t len, unsigned char rtype, int reqtype) ++{ ++ struct ithc *ithc = hdev->driver_data; ++ if (!buf || !len) ++ return -EINVAL; + -+ *val = le16_to_cpu(value); ++ struct ithc_data d = { .size = len, .data = buf }; ++ buf[0] = reportnum; + -+ return ret; ++ if (rtype == HID_OUTPUT_REPORT && reqtype == HID_REQ_SET_REPORT) { ++ d.type = ITHC_DATA_OUTPUT_REPORT; ++ CHECK_RET(ithc_dma_tx, ithc, &d); ++ return 0; ++ } ++ ++ if (rtype == HID_FEATURE_REPORT && reqtype == HID_REQ_SET_REPORT) { ++ d.type = ITHC_DATA_SET_FEATURE; ++ CHECK_RET(ithc_dma_tx, ithc, &d); ++ return 0; ++ } ++ ++ if (rtype == HID_FEATURE_REPORT && reqtype == HID_REQ_GET_REPORT) { ++ d.type = ITHC_DATA_GET_FEATURE; ++ d.data = &reportnum; ++ d.size = 1; ++ ++ // Prepare for response. ++ mutex_lock(&ithc->hid.get_feature_mutex); ++ ithc->hid.get_feature_buf = buf; ++ ithc->hid.get_feature_size = len; ++ mutex_unlock(&ithc->hid.get_feature_mutex); ++ ++ // Transmit 'get feature' request. ++ int r = CHECK(ithc_dma_tx, ithc, &d); ++ if (!r) { ++ r = wait_event_interruptible_timeout(ithc->hid.wait_get_feature, ++ !ithc->hid.get_feature_buf, msecs_to_jiffies(1000)); ++ if (!r) ++ r = -ETIMEDOUT; ++ else if (r < 0) ++ r = -EINTR; ++ else ++ r = 0; ++ } ++ ++ // If everything went ok, the buffer has been filled with the response data. ++ // Return the response size. ++ mutex_lock(&ithc->hid.get_feature_mutex); ++ ithc->hid.get_feature_buf = NULL; ++ if (!r) ++ r = ithc->hid.get_feature_size; ++ mutex_unlock(&ithc->hid.get_feature_mutex); ++ return r; ++ } ++ ++ pci_err(ithc->pci, "unhandled hid request %i %i for report id %i\n", ++ rtype, reqtype, reportnum); ++ return -EINVAL; +} + -+static const struct hwmon_channel_info *const surface_fan_info[] = { -+ HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT), -+ NULL ++// FIXME hid_input_report()/hid_parse_report() currently don't take const buffers, so we have to ++// cast away the const to avoid a compiler warning... ++#define NOCONST(x) ((void *)x) ++ ++void ithc_hid_process_data(struct ithc *ithc, struct ithc_data *d) ++{ ++ WARN_ON(!ithc->hid.dev); ++ if (!ithc->hid.dev) ++ return; ++ ++ switch (d->type) { ++ ++ case ITHC_DATA_IGNORE: ++ return; ++ ++ case ITHC_DATA_ERROR: ++ CHECK(ithc_reset, ithc); ++ return; ++ ++ case ITHC_DATA_REPORT_DESCRIPTOR: ++ // Response to the report descriptor request sent by ithc_hid_parse(). ++ CHECK(hid_parse_report, ithc->hid.dev, NOCONST(d->data), d->size); ++ WRITE_ONCE(ithc->hid.parse_done, true); ++ wake_up(&ithc->hid.wait_parse); ++ return; ++ ++ case ITHC_DATA_INPUT_REPORT: ++ { ++ // Standard HID input report. ++ int r = hid_input_report(ithc->hid.dev, HID_INPUT_REPORT, NOCONST(d->data), d->size, 1); ++ if (r < 0) { ++ pci_warn(ithc->pci, "hid_input_report failed with %i (size %u, report ID 0x%02x)\n", ++ r, d->size, d->size ? *(u8 *)d->data : 0); ++ print_hex_dump_debug(DEVNAME " report: ", DUMP_PREFIX_OFFSET, 32, 1, ++ d->data, min(d->size, 0x400u), 0); ++ } ++ return; ++ } ++ ++ case ITHC_DATA_GET_FEATURE: ++ { ++ // Response to a 'get feature' request sent by ithc_hid_raw_request(). ++ bool done = false; ++ mutex_lock(&ithc->hid.get_feature_mutex); ++ if (ithc->hid.get_feature_buf) { ++ if (d->size < ithc->hid.get_feature_size) ++ ithc->hid.get_feature_size = d->size; ++ memcpy(ithc->hid.get_feature_buf, d->data, ithc->hid.get_feature_size); ++ ithc->hid.get_feature_buf = NULL; ++ done = true; ++ } ++ mutex_unlock(&ithc->hid.get_feature_mutex); ++ if (done) { ++ wake_up(&ithc->hid.wait_get_feature); ++ } else { ++ // Received data without a matching request, or the request already ++ // timed out. (XXX What's the correct thing to do here?) ++ CHECK(hid_input_report, ithc->hid.dev, HID_FEATURE_REPORT, ++ NOCONST(d->data), d->size, 1); ++ } ++ return; ++ } ++ ++ default: ++ pci_err(ithc->pci, "unhandled data type %i\n", d->type); ++ return; ++ } ++} ++ ++static struct hid_ll_driver ithc_ll_driver = { ++ .start = ithc_hid_start, ++ .stop = ithc_hid_stop, ++ .open = ithc_hid_open, ++ .close = ithc_hid_close, ++ .parse = ithc_hid_parse, ++ .raw_request = ithc_hid_raw_request, ++}; ++ ++static void ithc_hid_devres_release(struct device *dev, void *res) ++{ ++ struct hid_device **hidm = res; ++ if (*hidm) ++ hid_destroy_device(*hidm); ++} ++ ++int ithc_hid_init(struct ithc *ithc) ++{ ++ struct hid_device **hidm = devres_alloc(ithc_hid_devres_release, sizeof(*hidm), GFP_KERNEL); ++ if (!hidm) ++ return -ENOMEM; ++ devres_add(&ithc->pci->dev, hidm); ++ struct hid_device *hid = hid_allocate_device(); ++ if (IS_ERR(hid)) ++ return PTR_ERR(hid); ++ *hidm = hid; ++ ++ strscpy(hid->name, DEVFULLNAME, sizeof(hid->name)); ++ strscpy(hid->phys, ithc->phys, sizeof(hid->phys)); ++ hid->ll_driver = &ithc_ll_driver; ++ hid->bus = BUS_PCI; ++ hid->vendor = ithc->vendor_id; ++ hid->product = ithc->product_id; ++ hid->version = 0x100; ++ hid->dev.parent = &ithc->pci->dev; ++ hid->driver_data = ithc; ++ ++ ithc->hid.dev = hid; ++ ++ init_waitqueue_head(&ithc->hid.wait_parse); ++ init_waitqueue_head(&ithc->hid.wait_get_feature); ++ mutex_init(&ithc->hid.get_feature_mutex); ++ ++ return 0; ++} ++ +diff --git a/drivers/hid/ithc/ithc-hid.h b/drivers/hid/ithc/ithc-hid.h +new file mode 100644 +index 0000000000000..599eb912c8c84 +--- /dev/null ++++ b/drivers/hid/ithc/ithc-hid.h +@@ -0,0 +1,32 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ ++ ++enum ithc_data_type { ++ ITHC_DATA_IGNORE, ++ ITHC_DATA_RAW, ++ ITHC_DATA_ERROR, ++ ITHC_DATA_REPORT_DESCRIPTOR, ++ ITHC_DATA_INPUT_REPORT, ++ ITHC_DATA_OUTPUT_REPORT, ++ ITHC_DATA_GET_FEATURE, ++ ITHC_DATA_SET_FEATURE, +}; + -+static const struct hwmon_ops surface_fan_hwmon_ops = { -+ .is_visible = surface_fan_hwmon_is_visible, -+ .read = surface_fan_hwmon_read, ++struct ithc_data { ++ enum ithc_data_type type; ++ u32 size; ++ const void *data; ++}; ++ ++struct ithc_hid { ++ struct hid_device *dev; ++ bool parse_done; ++ wait_queue_head_t wait_parse; ++ wait_queue_head_t wait_get_feature; ++ struct mutex get_feature_mutex; ++ void *get_feature_buf; ++ size_t get_feature_size; +}; + -+static const struct hwmon_chip_info surface_fan_chip_info = { -+ .ops = &surface_fan_hwmon_ops, -+ .info = surface_fan_info, ++int ithc_hid_init(struct ithc *ithc); ++void ithc_hid_process_data(struct ithc *ithc, struct ithc_data *d); ++ +diff --git a/drivers/hid/ithc/ithc-legacy.c b/drivers/hid/ithc/ithc-legacy.c +new file mode 100644 +index 0000000000000..5c1da11e3f1d2 +--- /dev/null ++++ b/drivers/hid/ithc/ithc-legacy.c +@@ -0,0 +1,252 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause ++ ++#include "ithc.h" ++ ++#define DEVCFG_DMA_RX_SIZE(x) ((((x) & 0x3fff) + 1) << 6) ++#define DEVCFG_DMA_TX_SIZE(x) (((((x) >> 14) & 0x3ff) + 1) << 6) ++ ++#define DEVCFG_TOUCH_MASK 0x3f ++#define DEVCFG_TOUCH_ENABLE BIT(0) ++#define DEVCFG_TOUCH_PROP_DATA_ENABLE BIT(1) ++#define DEVCFG_TOUCH_HID_REPORT_ENABLE BIT(2) ++#define DEVCFG_TOUCH_POWER_STATE(x) (((x) & 7) << 3) ++#define DEVCFG_TOUCH_UNKNOWN_6 BIT(6) ++ ++#define DEVCFG_DEVICE_ID_TIC 0x43495424 // "$TIC" ++ ++#define DEVCFG_SPI_CLKDIV(x) (((x) >> 1) & 7) ++#define DEVCFG_SPI_CLKDIV_8 BIT(4) ++#define DEVCFG_SPI_SUPPORTS_SINGLE BIT(5) ++#define DEVCFG_SPI_SUPPORTS_DUAL BIT(6) ++#define DEVCFG_SPI_SUPPORTS_QUAD BIT(7) ++#define DEVCFG_SPI_MAX_TOUCH_POINTS(x) (((x) >> 8) & 0x3f) ++#define DEVCFG_SPI_MIN_RESET_TIME(x) (((x) >> 16) & 0xf) ++#define DEVCFG_SPI_NEEDS_HEARTBEAT BIT(20) // TODO implement heartbeat ++#define DEVCFG_SPI_HEARTBEAT_INTERVAL(x) (((x) >> 21) & 7) ++#define DEVCFG_SPI_UNKNOWN_25 BIT(25) ++#define DEVCFG_SPI_UNKNOWN_26 BIT(26) ++#define DEVCFG_SPI_UNKNOWN_27 BIT(27) ++#define DEVCFG_SPI_DELAY(x) (((x) >> 28) & 7) // TODO use this ++#define DEVCFG_SPI_USE_EXT_READ_CFG BIT(31) // TODO use this? ++ ++struct ithc_device_config { // (Example values are from an SP7+.) ++ u32 irq_cause; // 00 = 0xe0000402 (0xe0000401 after DMA_RX_CODE_RESET) ++ u32 error; // 04 = 0x00000000 ++ u32 dma_buf_sizes; // 08 = 0x000a00ff ++ u32 touch_cfg; // 0c = 0x0000001c ++ u32 touch_state; // 10 = 0x0000001c ++ u32 device_id; // 14 = 0x43495424 = "$TIC" ++ u32 spi_config; // 18 = 0xfda00a2e ++ u16 vendor_id; // 1c = 0x045e = Microsoft Corp. ++ u16 product_id; // 1e = 0x0c1a ++ u32 revision; // 20 = 0x00000001 ++ u32 fw_version; // 24 = 0x05008a8b = 5.0.138.139 (this value looks more random on newer devices) ++ u32 command; // 28 = 0x00000000 ++ u32 fw_mode; // 2c = 0x00000000 (for fw update?) ++ u32 _unknown_30; // 30 = 0x00000000 ++ u8 eds_minor_ver; // 34 = 0x5e ++ u8 eds_major_ver; // 35 = 0x03 ++ u8 interface_rev; // 36 = 0x04 ++ u8 eu_kernel_ver; // 37 = 0x04 ++ u32 _unknown_38; // 38 = 0x000001c0 (0x000001c1 after DMA_RX_CODE_RESET) ++ u32 _unknown_3c; // 3c = 0x00000002 +}; ++static_assert(sizeof(struct ithc_device_config) == 64); ++ ++#define RX_CODE_INPUT_REPORT 3 ++#define RX_CODE_FEATURE_REPORT 4 ++#define RX_CODE_REPORT_DESCRIPTOR 5 ++#define RX_CODE_RESET 7 ++ ++#define TX_CODE_SET_FEATURE 3 ++#define TX_CODE_GET_FEATURE 4 ++#define TX_CODE_OUTPUT_REPORT 5 ++#define TX_CODE_GET_REPORT_DESCRIPTOR 7 ++ ++static int ithc_set_device_enabled(struct ithc *ithc, bool enable) ++{ ++ u32 x = ithc->legacy_touch_cfg = ++ (ithc->legacy_touch_cfg & ~(u32)DEVCFG_TOUCH_MASK) | ++ DEVCFG_TOUCH_HID_REPORT_ENABLE | ++ (enable ? DEVCFG_TOUCH_ENABLE | DEVCFG_TOUCH_POWER_STATE(3) : 0); ++ return ithc_spi_command(ithc, SPI_CMD_CODE_WRITE, ++ offsetof(struct ithc_device_config, touch_cfg), sizeof(x), &x); ++} + -+static int surface_fan_probe(struct ssam_device *sdev) ++int ithc_legacy_init(struct ithc *ithc) +{ -+ struct device *hdev; ++ // Since we don't yet know which SPI config the device wants, use default speed and mode ++ // initially for reading config data. ++ CHECK(ithc_set_spi_config, ithc, 2, true, SPI_MODE_SINGLE, SPI_MODE_SINGLE); ++ ++ // Setting the following bit seems to make reading the config more reliable. ++ bitsl_set(&ithc->regs->dma_rx[0].init_unknown, INIT_UNKNOWN_31); ++ ++ // Setting this bit may be necessary on some ADL devices. ++ switch (ithc->pci->device) { ++ case PCI_DEVICE_ID_INTEL_THC_ADL_P_PORT1: ++ case PCI_DEVICE_ID_INTEL_THC_ADL_P_PORT2: ++ case PCI_DEVICE_ID_INTEL_THC_ADL_M_PORT1: ++ case PCI_DEVICE_ID_INTEL_THC_ADL_M_PORT2: ++ bitsl_set(&ithc->regs->dma_rx[0].init_unknown, INIT_UNKNOWN_5); ++ break; ++ } ++ ++ // Take the touch device out of reset. ++ bitsl(&ithc->regs->control_bits, CONTROL_QUIESCE, 0); ++ CHECK_RET(waitl, ithc, &ithc->regs->control_bits, CONTROL_IS_QUIESCED, 0); ++ for (int retries = 0; ; retries++) { ++ ithc_log_regs(ithc); ++ bitsl_set(&ithc->regs->control_bits, CONTROL_NRESET); ++ if (!waitl(ithc, &ithc->regs->irq_cause, 0xf, 2)) ++ break; ++ if (retries > 5) { ++ pci_err(ithc->pci, "failed to reset device, irq_cause = 0x%08x\n", ++ readl(&ithc->regs->irq_cause)); ++ return -ETIMEDOUT; ++ } ++ pci_warn(ithc->pci, "invalid irq_cause, retrying reset\n"); ++ bitsl(&ithc->regs->control_bits, CONTROL_NRESET, 0); ++ if (msleep_interruptible(1000)) ++ return -EINTR; ++ } ++ ithc_log_regs(ithc); + -+ hdev = devm_hwmon_device_register_with_info(&sdev->dev, -+ "surface_fan", sdev, -+ &surface_fan_chip_info, -+ NULL); -+ if (IS_ERR(hdev)) -+ return PTR_ERR(hdev); ++ CHECK(waitl, ithc, &ithc->regs->dma_rx[0].status, DMA_RX_STATUS_READY, DMA_RX_STATUS_READY); ++ ++ // Read configuration data. ++ u32 spi_cfg; ++ for (int retries = 0; ; retries++) { ++ ithc_log_regs(ithc); ++ struct ithc_device_config config = { 0 }; ++ CHECK_RET(ithc_spi_command, ithc, SPI_CMD_CODE_READ, 0, sizeof(config), &config); ++ u32 *p = (void *)&config; ++ pci_info(ithc->pci, "config: %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", ++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); ++ if (config.device_id == DEVCFG_DEVICE_ID_TIC) { ++ spi_cfg = config.spi_config; ++ ithc->vendor_id = config.vendor_id; ++ ithc->product_id = config.product_id; ++ ithc->product_rev = config.revision; ++ ithc->max_rx_size = DEVCFG_DMA_RX_SIZE(config.dma_buf_sizes); ++ ithc->max_tx_size = DEVCFG_DMA_TX_SIZE(config.dma_buf_sizes); ++ ithc->legacy_touch_cfg = config.touch_cfg; ++ ithc->have_config = true; ++ break; ++ } ++ if (retries > 10) { ++ pci_err(ithc->pci, "failed to read config, unknown device ID 0x%08x\n", ++ config.device_id); ++ return -EIO; ++ } ++ pci_warn(ithc->pci, "failed to read config, retrying\n"); ++ if (msleep_interruptible(100)) ++ return -EINTR; ++ } ++ ithc_log_regs(ithc); + ++ // Apply SPI config and enable touch device. ++ CHECK_RET(ithc_set_spi_config, ithc, ++ DEVCFG_SPI_CLKDIV(spi_cfg), (spi_cfg & DEVCFG_SPI_CLKDIV_8) != 0, ++ spi_cfg & DEVCFG_SPI_SUPPORTS_QUAD ? SPI_MODE_QUAD : ++ spi_cfg & DEVCFG_SPI_SUPPORTS_DUAL ? SPI_MODE_DUAL : ++ SPI_MODE_SINGLE, ++ SPI_MODE_SINGLE); ++ CHECK_RET(ithc_set_device_enabled, ithc, true); ++ ithc_log_regs(ithc); + return 0; +} + -+static const struct ssam_device_id ssam_fan_match[] = { -+ { SSAM_SDEV(FAN, SAM, 0x01, 0x01) }, -+ {}, ++void ithc_legacy_exit(struct ithc *ithc) ++{ ++ CHECK(ithc_set_device_enabled, ithc, false); ++} ++ ++int ithc_legacy_decode_rx(struct ithc *ithc, const void *src, size_t len, struct ithc_data *dest) ++{ ++ const struct { ++ u32 code; ++ u32 data_size; ++ u32 _unknown[14]; ++ } *hdr = src; ++ ++ if (len < sizeof(*hdr)) ++ return -ENODATA; ++ // Note: RX data is not padded, even though TX data must be padded. ++ if (len != sizeof(*hdr) + hdr->data_size) ++ return -EMSGSIZE; ++ ++ dest->data = hdr + 1; ++ dest->size = hdr->data_size; ++ ++ switch (hdr->code) { ++ case RX_CODE_RESET: ++ // The THC sends a reset request when we need to reinitialize the device. ++ // This usually only happens if we send an invalid command or put the device ++ // in a bad state. ++ dest->type = ITHC_DATA_ERROR; ++ return 0; ++ case RX_CODE_REPORT_DESCRIPTOR: ++ // The descriptor is preceded by 8 nul bytes. ++ if (hdr->data_size < 8) ++ return -ENODATA; ++ dest->type = ITHC_DATA_REPORT_DESCRIPTOR; ++ dest->data = (char *)(hdr + 1) + 8; ++ dest->size = hdr->data_size - 8; ++ return 0; ++ case RX_CODE_INPUT_REPORT: ++ dest->type = ITHC_DATA_INPUT_REPORT; ++ return 0; ++ case RX_CODE_FEATURE_REPORT: ++ dest->type = ITHC_DATA_GET_FEATURE; ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ ++ssize_t ithc_legacy_encode_tx(struct ithc *ithc, const struct ithc_data *src, void *dest, ++ size_t maxlen) ++{ ++ struct { ++ u32 code; ++ u32 data_size; ++ } *hdr = dest; ++ ++ size_t src_size = src->size; ++ const void *src_data = src->data; ++ const u64 get_report_desc_data = 0; ++ u32 code; ++ ++ switch (src->type) { ++ case ITHC_DATA_SET_FEATURE: ++ code = TX_CODE_SET_FEATURE; ++ break; ++ case ITHC_DATA_GET_FEATURE: ++ code = TX_CODE_GET_FEATURE; ++ break; ++ case ITHC_DATA_OUTPUT_REPORT: ++ code = TX_CODE_OUTPUT_REPORT; ++ break; ++ case ITHC_DATA_REPORT_DESCRIPTOR: ++ code = TX_CODE_GET_REPORT_DESCRIPTOR; ++ src_size = sizeof(get_report_desc_data); ++ src_data = &get_report_desc_data; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ // Data must be padded to next 4-byte boundary. ++ size_t padded = round_up(src_size, 4); ++ if (sizeof(*hdr) + padded > maxlen) ++ return -EOVERFLOW; ++ ++ // Fill the TX buffer with header and data. ++ hdr->code = code; ++ hdr->data_size = src_size; ++ memcpy_and_pad(hdr + 1, padded, src_data, src_size, 0); ++ ++ return sizeof(*hdr) + padded; ++} ++ +diff --git a/drivers/hid/ithc/ithc-legacy.h b/drivers/hid/ithc/ithc-legacy.h +new file mode 100644 +index 0000000000000..28d6924620722 +--- /dev/null ++++ b/drivers/hid/ithc/ithc-legacy.h +@@ -0,0 +1,8 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ ++ ++int ithc_legacy_init(struct ithc *ithc); ++void ithc_legacy_exit(struct ithc *ithc); ++int ithc_legacy_decode_rx(struct ithc *ithc, const void *src, size_t len, struct ithc_data *dest); ++ssize_t ithc_legacy_encode_tx(struct ithc *ithc, const struct ithc_data *src, void *dest, ++ size_t maxlen); ++ +diff --git a/drivers/hid/ithc/ithc-main.c b/drivers/hid/ithc/ithc-main.c +index 87ed4aa70fda0..2acf02e41d40f 100644 +--- a/drivers/hid/ithc/ithc-main.c ++++ b/drivers/hid/ithc/ithc-main.c +@@ -5,28 +5,6 @@ + MODULE_DESCRIPTION("Intel Touch Host Controller driver"); + MODULE_LICENSE("Dual BSD/GPL"); + +-// Lakefield +-#define PCI_DEVICE_ID_INTEL_THC_LKF_PORT1 0x98d0 +-#define PCI_DEVICE_ID_INTEL_THC_LKF_PORT2 0x98d1 +-// Tiger Lake +-#define PCI_DEVICE_ID_INTEL_THC_TGL_LP_PORT1 0xa0d0 +-#define PCI_DEVICE_ID_INTEL_THC_TGL_LP_PORT2 0xa0d1 +-#define PCI_DEVICE_ID_INTEL_THC_TGL_H_PORT1 0x43d0 +-#define PCI_DEVICE_ID_INTEL_THC_TGL_H_PORT2 0x43d1 +-// Alder Lake +-#define PCI_DEVICE_ID_INTEL_THC_ADL_S_PORT1 0x7ad8 +-#define PCI_DEVICE_ID_INTEL_THC_ADL_S_PORT2 0x7ad9 +-#define PCI_DEVICE_ID_INTEL_THC_ADL_P_PORT1 0x51d0 +-#define PCI_DEVICE_ID_INTEL_THC_ADL_P_PORT2 0x51d1 +-#define PCI_DEVICE_ID_INTEL_THC_ADL_M_PORT1 0x54d0 +-#define PCI_DEVICE_ID_INTEL_THC_ADL_M_PORT2 0x54d1 +-// Raptor Lake +-#define PCI_DEVICE_ID_INTEL_THC_RPL_S_PORT1 0x7a58 +-#define PCI_DEVICE_ID_INTEL_THC_RPL_S_PORT2 0x7a59 +-// Meteor Lake +-#define PCI_DEVICE_ID_INTEL_THC_MTL_PORT1 0x7e48 +-#define PCI_DEVICE_ID_INTEL_THC_MTL_PORT2 0x7e4a +- + static const struct pci_device_id ithc_pci_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_THC_LKF_PORT1) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_THC_LKF_PORT2) }, +@@ -66,15 +44,13 @@ static bool ithc_use_rx1 = true; + module_param_named(rx1, ithc_use_rx1, bool, 0); + MODULE_PARM_DESC(rx1, "Use DMA RX channel 1"); + +-// Values below 250 seem to work well on the SP7+. If this is set too high, you may observe cursor stuttering. +-static int ithc_dma_latency_us = 200; +-module_param_named(dma_latency_us, ithc_dma_latency_us, int, 0); +-MODULE_PARM_DESC(dma_latency_us, "Determines the CPU latency QoS value for DMA transfers (in microseconds), -1 to disable latency QoS"); ++static int ithc_active_ltr_us = -1; ++module_param_named(activeltr, ithc_active_ltr_us, int, 0); ++MODULE_PARM_DESC(activeltr, "Active LTR value override (in microseconds)"); + +-// Values above 1700 seem to work well on the SP7+. If this is set too low, you may observe cursor stuttering. +-static unsigned int ithc_dma_early_us = 2000; +-module_param_named(dma_early_us, ithc_dma_early_us, uint, 0); +-MODULE_PARM_DESC(dma_early_us, "Determines how early the CPU latency QoS value is applied before the next expected IRQ (in microseconds)"); ++static int ithc_idle_ltr_us = -1; ++module_param_named(idleltr, ithc_idle_ltr_us, int, 0); ++MODULE_PARM_DESC(idleltr, "Idle LTR value override (in microseconds)"); + + static bool ithc_log_regs_enabled = false; + module_param_named(logregs, ithc_log_regs_enabled, bool, 0); +@@ -82,44 +58,30 @@ MODULE_PARM_DESC(logregs, "Log changes in register values (for debugging)"); + + // Sysfs attributes + +-static bool ithc_is_config_valid(struct ithc *ithc) +-{ +- return ithc->config.device_id == DEVCFG_DEVICE_ID_TIC; +-} +- + static ssize_t vendor_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct ithc *ithc = dev_get_drvdata(dev); +- if (!ithc || !ithc_is_config_valid(ithc)) ++ if (!ithc || !ithc->have_config) + return -ENODEV; +- return sprintf(buf, "0x%04x", ithc->config.vendor_id); ++ return sprintf(buf, "0x%04x", ithc->vendor_id); + } + static DEVICE_ATTR_RO(vendor); + static ssize_t product_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct ithc *ithc = dev_get_drvdata(dev); +- if (!ithc || !ithc_is_config_valid(ithc)) ++ if (!ithc || !ithc->have_config) + return -ENODEV; +- return sprintf(buf, "0x%04x", ithc->config.product_id); ++ return sprintf(buf, "0x%04x", ithc->product_id); + } + static DEVICE_ATTR_RO(product); + static ssize_t revision_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct ithc *ithc = dev_get_drvdata(dev); +- if (!ithc || !ithc_is_config_valid(ithc)) ++ if (!ithc || !ithc->have_config) + return -ENODEV; +- return sprintf(buf, "%u", ithc->config.revision); ++ return sprintf(buf, "%u", ithc->product_rev); + } + static DEVICE_ATTR_RO(revision); +-static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr, char *buf) +-{ +- struct ithc *ithc = dev_get_drvdata(dev); +- if (!ithc || !ithc_is_config_valid(ithc)) +- return -ENODEV; +- u32 v = ithc->config.fw_version; +- return sprintf(buf, "%i.%i.%i.%i", v >> 24, v >> 16 & 0xff, v >> 8 & 0xff, v & 0xff); +-} +-static DEVICE_ATTR_RO(fw_version); + + static const struct attribute_group *ithc_attribute_groups[] = { + &(const struct attribute_group){ +@@ -128,185 +90,26 @@ static const struct attribute_group *ithc_attribute_groups[] = { + &dev_attr_vendor.attr, + &dev_attr_product.attr, + &dev_attr_revision.attr, +- &dev_attr_fw_version.attr, + NULL + }, + }, + NULL + }; + +-// HID setup +- +-static int ithc_hid_start(struct hid_device *hdev) { return 0; } +-static void ithc_hid_stop(struct hid_device *hdev) { } +-static int ithc_hid_open(struct hid_device *hdev) { return 0; } +-static void ithc_hid_close(struct hid_device *hdev) { } +- +-static int ithc_hid_parse(struct hid_device *hdev) +-{ +- struct ithc *ithc = hdev->driver_data; +- u64 val = 0; +- WRITE_ONCE(ithc->hid_parse_done, false); +- for (int retries = 0; ; retries++) { +- CHECK_RET(ithc_dma_tx, ithc, DMA_TX_CODE_GET_REPORT_DESCRIPTOR, sizeof(val), &val); +- if (wait_event_timeout(ithc->wait_hid_parse, READ_ONCE(ithc->hid_parse_done), +- msecs_to_jiffies(200))) +- return 0; +- if (retries > 5) { +- pci_err(ithc->pci, "failed to read report descriptor\n"); +- return -ETIMEDOUT; +- } +- pci_warn(ithc->pci, "failed to read report descriptor, retrying\n"); +- } +-} +- +-static int ithc_hid_raw_request(struct hid_device *hdev, unsigned char reportnum, __u8 *buf, +- size_t len, unsigned char rtype, int reqtype) +-{ +- struct ithc *ithc = hdev->driver_data; +- if (!buf || !len) +- return -EINVAL; +- u32 code; +- if (rtype == HID_OUTPUT_REPORT && reqtype == HID_REQ_SET_REPORT) { +- code = DMA_TX_CODE_OUTPUT_REPORT; +- } else if (rtype == HID_FEATURE_REPORT && reqtype == HID_REQ_SET_REPORT) { +- code = DMA_TX_CODE_SET_FEATURE; +- } else if (rtype == HID_FEATURE_REPORT && reqtype == HID_REQ_GET_REPORT) { +- code = DMA_TX_CODE_GET_FEATURE; +- } else { +- pci_err(ithc->pci, "unhandled hid request %i %i for report id %i\n", +- rtype, reqtype, reportnum); +- return -EINVAL; +- } +- buf[0] = reportnum; +- +- if (reqtype == HID_REQ_GET_REPORT) { +- // Prepare for response. +- mutex_lock(&ithc->hid_get_feature_mutex); +- ithc->hid_get_feature_buf = buf; +- ithc->hid_get_feature_size = len; +- mutex_unlock(&ithc->hid_get_feature_mutex); +- +- // Transmit 'get feature' request. +- int r = CHECK(ithc_dma_tx, ithc, code, 1, buf); +- if (!r) { +- r = wait_event_interruptible_timeout(ithc->wait_hid_get_feature, +- !ithc->hid_get_feature_buf, msecs_to_jiffies(1000)); +- if (!r) +- r = -ETIMEDOUT; +- else if (r < 0) +- r = -EINTR; +- else +- r = 0; +- } +- +- // If everything went ok, the buffer has been filled with the response data. +- // Return the response size. +- mutex_lock(&ithc->hid_get_feature_mutex); +- ithc->hid_get_feature_buf = NULL; +- if (!r) +- r = ithc->hid_get_feature_size; +- mutex_unlock(&ithc->hid_get_feature_mutex); +- return r; +- } +- +- // 'Set feature', or 'output report'. These don't have a response. +- CHECK_RET(ithc_dma_tx, ithc, code, len, buf); +- return 0; +-} +- +-static struct hid_ll_driver ithc_ll_driver = { +- .start = ithc_hid_start, +- .stop = ithc_hid_stop, +- .open = ithc_hid_open, +- .close = ithc_hid_close, +- .parse = ithc_hid_parse, +- .raw_request = ithc_hid_raw_request, +-}; +- +-static void ithc_hid_devres_release(struct device *dev, void *res) +-{ +- struct hid_device **hidm = res; +- if (*hidm) +- hid_destroy_device(*hidm); +-} +- +-static int ithc_hid_init(struct ithc *ithc) +-{ +- struct hid_device **hidm = devres_alloc(ithc_hid_devres_release, sizeof(*hidm), GFP_KERNEL); +- if (!hidm) +- return -ENOMEM; +- devres_add(&ithc->pci->dev, hidm); +- struct hid_device *hid = hid_allocate_device(); +- if (IS_ERR(hid)) +- return PTR_ERR(hid); +- *hidm = hid; +- +- strscpy(hid->name, DEVFULLNAME, sizeof(hid->name)); +- strscpy(hid->phys, ithc->phys, sizeof(hid->phys)); +- hid->ll_driver = &ithc_ll_driver; +- hid->bus = BUS_PCI; +- hid->vendor = ithc->config.vendor_id; +- hid->product = ithc->config.product_id; +- hid->version = 0x100; +- hid->dev.parent = &ithc->pci->dev; +- hid->driver_data = ithc; +- +- ithc->hid = hid; +- return 0; +-} +- + // Interrupts/polling + +-static enum hrtimer_restart ithc_activity_start_timer_callback(struct hrtimer *t) +-{ +- struct ithc *ithc = container_of(t, struct ithc, activity_start_timer); +- ithc_set_active(ithc, ithc_dma_early_us * 2 + USEC_PER_MSEC); +- return HRTIMER_NORESTART; +-} +- +-static enum hrtimer_restart ithc_activity_end_timer_callback(struct hrtimer *t) +-{ +- struct ithc *ithc = container_of(t, struct ithc, activity_end_timer); +- cpu_latency_qos_update_request(&ithc->activity_qos, PM_QOS_DEFAULT_VALUE); +- return HRTIMER_NORESTART; +-} +- +-void ithc_set_active(struct ithc *ithc, unsigned int duration_us) +-{ +- if (ithc_dma_latency_us < 0) +- return; +- // When CPU usage is very low, the CPU can enter various low power states (C2-C10). +- // This disrupts DMA, causing truncated DMA messages. ERROR_FLAG_DMA_RX_TIMEOUT will be +- // set when this happens. The amount of truncated messages can become very high, resulting +- // in user-visible effects (laggy/stuttering cursor). To avoid this, we use a CPU latency +- // QoS request to prevent the CPU from entering low power states during touch interactions. +- cpu_latency_qos_update_request(&ithc->activity_qos, ithc_dma_latency_us); +- hrtimer_start_range_ns(&ithc->activity_end_timer, +- ns_to_ktime(duration_us * NSEC_PER_USEC), duration_us * NSEC_PER_USEC, HRTIMER_MODE_REL); +-} +- +-static int ithc_set_device_enabled(struct ithc *ithc, bool enable) +-{ +- u32 x = ithc->config.touch_cfg = +- (ithc->config.touch_cfg & ~(u32)DEVCFG_TOUCH_MASK) | DEVCFG_TOUCH_UNKNOWN_2 | +- (enable ? DEVCFG_TOUCH_ENABLE | DEVCFG_TOUCH_UNKNOWN_3 | DEVCFG_TOUCH_UNKNOWN_4 : 0); +- return ithc_spi_command(ithc, SPI_CMD_CODE_WRITE, +- offsetof(struct ithc_device_config, touch_cfg), sizeof(x), &x); +-} +- + static void ithc_disable_interrupts(struct ithc *ithc) + { + writel(0, &ithc->regs->error_control); + bitsb(&ithc->regs->spi_cmd.control, SPI_CMD_CONTROL_IRQ, 0); +- bitsb(&ithc->regs->dma_rx[0].control, DMA_RX_CONTROL_IRQ_UNKNOWN_1 | DMA_RX_CONTROL_IRQ_ERROR | DMA_RX_CONTROL_IRQ_UNKNOWN_4 | DMA_RX_CONTROL_IRQ_DATA, 0); +- bitsb(&ithc->regs->dma_rx[1].control, DMA_RX_CONTROL_IRQ_UNKNOWN_1 | DMA_RX_CONTROL_IRQ_ERROR | DMA_RX_CONTROL_IRQ_UNKNOWN_4 | DMA_RX_CONTROL_IRQ_DATA, 0); ++ bitsb(&ithc->regs->dma_rx[0].control, DMA_RX_CONTROL_IRQ_UNKNOWN_1 | DMA_RX_CONTROL_IRQ_ERROR | DMA_RX_CONTROL_IRQ_READY | DMA_RX_CONTROL_IRQ_DATA, 0); ++ bitsb(&ithc->regs->dma_rx[1].control, DMA_RX_CONTROL_IRQ_UNKNOWN_1 | DMA_RX_CONTROL_IRQ_ERROR | DMA_RX_CONTROL_IRQ_READY | DMA_RX_CONTROL_IRQ_DATA, 0); + bitsb(&ithc->regs->dma_tx.control, DMA_TX_CONTROL_IRQ, 0); + } + + static void ithc_clear_dma_rx_interrupts(struct ithc *ithc, unsigned int channel) + { +- writel(DMA_RX_STATUS_ERROR | DMA_RX_STATUS_UNKNOWN_4 | DMA_RX_STATUS_HAVE_DATA, ++ writel(DMA_RX_STATUS_ERROR | DMA_RX_STATUS_READY | DMA_RX_STATUS_HAVE_DATA, + &ithc->regs->dma_rx[channel].status); + } + +@@ -325,39 +128,22 @@ static void ithc_process(struct ithc *ithc) + { + ithc_log_regs(ithc); + ++ // The THC automatically transitions from LTR idle to active at the start of a DMA transfer. ++ // It does not appear to automatically go back to idle, so we switch it back here, since ++ // the DMA transfer should be complete. ++ ithc_set_ltr_idle(ithc); ++ + bool rx0 = ithc_use_rx0 && (readl(&ithc->regs->dma_rx[0].status) & (DMA_RX_STATUS_ERROR | DMA_RX_STATUS_HAVE_DATA)) != 0; + bool rx1 = ithc_use_rx1 && (readl(&ithc->regs->dma_rx[1].status) & (DMA_RX_STATUS_ERROR | DMA_RX_STATUS_HAVE_DATA)) != 0; + +- // Track time between DMA rx transfers, so we can try to predict when we need to enable CPU latency QoS for the next transfer +- ktime_t t = ktime_get(); +- ktime_t dt = ktime_sub(t, ithc->last_rx_time); +- if (rx0 || rx1) { +- ithc->last_rx_time = t; +- if (dt > ms_to_ktime(100)) { +- ithc->cur_rx_seq_count = 0; +- ithc->cur_rx_seq_errors = 0; +- } +- ithc->cur_rx_seq_count++; +- if (!ithc_use_polling && ithc_dma_latency_us >= 0) { +- // Disable QoS, since the DMA transfer has completed (we re-enable it after a delay below) +- cpu_latency_qos_update_request(&ithc->activity_qos, PM_QOS_DEFAULT_VALUE); +- hrtimer_try_to_cancel(&ithc->activity_end_timer); +- } +- } +- + // Read and clear error bits + u32 err = readl(&ithc->regs->error_flags); + if (err) { + writel(err, &ithc->regs->error_flags); + if (err & ~ERROR_FLAG_DMA_RX_TIMEOUT) + pci_err(ithc->pci, "error flags: 0x%08x\n", err); +- if (err & ERROR_FLAG_DMA_RX_TIMEOUT) { +- // Only log an error if we see a significant number of these errors. +- ithc->cur_rx_seq_errors++; +- if (ithc->cur_rx_seq_errors && ithc->cur_rx_seq_errors % 50 == 0 && ithc->cur_rx_seq_errors > ithc->cur_rx_seq_count / 10) +- pci_err(ithc->pci, "High number of DMA RX timeouts/errors (%u/%u, dt=%lldus). Try adjusting dma_early_us and/or dma_latency_us.\n", +- ithc->cur_rx_seq_errors, ithc->cur_rx_seq_count, ktime_to_us(dt)); +- } ++ if (err & ERROR_FLAG_DMA_RX_TIMEOUT) ++ pci_err(ithc->pci, "DMA RX timeout/error (try decreasing activeltr/idleltr if this happens frequently)\n"); + } + + // Process DMA rx +@@ -372,12 +158,6 @@ static void ithc_process(struct ithc *ithc) + ithc_dma_rx(ithc, 1); + } + +- // Start timer to re-enable QoS for next rx, but only if we've seen an ERROR_FLAG_DMA_RX_TIMEOUT +- if ((rx0 || rx1) && !ithc_use_polling && ithc_dma_latency_us >= 0 && ithc->cur_rx_seq_errors > 0) { +- ktime_t expires = ktime_add(t, ktime_sub_us(dt, ithc_dma_early_us)); +- hrtimer_start_range_ns(&ithc->activity_start_timer, expires, 10 * NSEC_PER_USEC, HRTIMER_MODE_ABS); +- } +- + ithc_log_regs(ithc); + } + +@@ -403,12 +183,8 @@ static int ithc_poll_thread(void *arg) + ithc_process(ithc); + // Decrease polling interval to 20ms if we received data, otherwise slowly + // increase it up to 200ms. +- if (n != ithc->dma_rx[1].num_received) { +- ithc_set_active(ithc, 100 * USEC_PER_MSEC); +- sleep = 20; +- } else { +- sleep = min(200u, sleep + (sleep >> 4) + 1); +- } ++ sleep = n != ithc->dma_rx[1].num_received ? 20 ++ : min(200u, sleep + (sleep >> 4) + 1); + msleep_interruptible(sleep); + } + return 0; +@@ -431,73 +207,44 @@ static void ithc_disable(struct ithc *ithc) + + static int ithc_init_device(struct ithc *ithc) + { ++ // Read ACPI config for QuickSPI mode ++ struct ithc_acpi_config cfg = { 0 }; ++ CHECK_RET(ithc_read_acpi_config, ithc, &cfg); ++ if (!cfg.has_config) ++ pci_info(ithc->pci, "no ACPI config, using legacy mode\n"); ++ else ++ ithc_print_acpi_config(ithc, &cfg); ++ ithc->use_quickspi = cfg.has_config; ++ ++ // Shut down device + ithc_log_regs(ithc); + bool was_enabled = (readl(&ithc->regs->control_bits) & CONTROL_NRESET) != 0; + ithc_disable(ithc); + CHECK_RET(waitl, ithc, &ithc->regs->control_bits, CONTROL_READY, CONTROL_READY); +- +- // Since we don't yet know which SPI config the device wants, use default speed and mode +- // initially for reading config data. +- ithc_set_spi_config(ithc, 10, 0); +- +- // Setting the following bit seems to make reading the config more reliable. +- bitsl_set(&ithc->regs->dma_rx[0].unknown_init_bits, 0x80000000); ++ ithc_log_regs(ithc); + + // If the device was previously enabled, wait a bit to make sure it's fully shut down. + if (was_enabled) + if (msleep_interruptible(100)) + return -EINTR; + +- // Take the touch device out of reset. +- bitsl(&ithc->regs->control_bits, CONTROL_QUIESCE, 0); +- CHECK_RET(waitl, ithc, &ithc->regs->control_bits, CONTROL_IS_QUIESCED, 0); +- for (int retries = 0; ; retries++) { +- ithc_log_regs(ithc); +- bitsl_set(&ithc->regs->control_bits, CONTROL_NRESET); +- if (!waitl(ithc, &ithc->regs->state, 0xf, 2)) +- break; +- if (retries > 5) { +- pci_err(ithc->pci, "failed to reset device, state = 0x%08x\n", readl(&ithc->regs->state)); +- return -ETIMEDOUT; +- } +- pci_warn(ithc->pci, "invalid state, retrying reset\n"); +- bitsl(&ithc->regs->control_bits, CONTROL_NRESET, 0); +- if (msleep_interruptible(1000)) +- return -EINTR; +- } +- ithc_log_regs(ithc); ++ // Set Latency Tolerance Reporting config. The device will automatically ++ // apply these values depending on whether it is active or idle. ++ // If active value is too high, DMA buffer data can become truncated. ++ // By default, we set the active LTR value to 100us, and idle to 100ms. ++ u64 active_ltr_ns = ithc_active_ltr_us >= 0 ? (u64)ithc_active_ltr_us * 1000 ++ : cfg.has_config && cfg.has_active_ltr ? (u64)cfg.active_ltr << 10 ++ : 100 * 1000; ++ u64 idle_ltr_ns = ithc_idle_ltr_us >= 0 ? (u64)ithc_idle_ltr_us * 1000 ++ : cfg.has_config && cfg.has_idle_ltr ? (u64)cfg.idle_ltr << 10 ++ : 100 * 1000 * 1000; ++ ithc_set_ltr_config(ithc, active_ltr_ns, idle_ltr_ns); ++ ++ if (ithc->use_quickspi) ++ CHECK_RET(ithc_quickspi_init, ithc, &cfg); ++ else ++ CHECK_RET(ithc_legacy_init, ithc); + +- // Waiting for the following status bit makes reading config much more reliable, +- // however the official driver does not seem to do this... +- CHECK(waitl, ithc, &ithc->regs->dma_rx[0].status, DMA_RX_STATUS_UNKNOWN_4, DMA_RX_STATUS_UNKNOWN_4); +- +- // Read configuration data. +- for (int retries = 0; ; retries++) { +- ithc_log_regs(ithc); +- memset(&ithc->config, 0, sizeof(ithc->config)); +- CHECK_RET(ithc_spi_command, ithc, SPI_CMD_CODE_READ, 0, sizeof(ithc->config), &ithc->config); +- u32 *p = (void *)&ithc->config; +- pci_info(ithc->pci, "config: %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", +- p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); +- if (ithc_is_config_valid(ithc)) +- break; +- if (retries > 10) { +- pci_err(ithc->pci, "failed to read config, unknown device ID 0x%08x\n", +- ithc->config.device_id); +- return -EIO; +- } +- pci_warn(ithc->pci, "failed to read config, retrying\n"); +- if (msleep_interruptible(100)) +- return -EINTR; +- } +- ithc_log_regs(ithc); +- +- // Apply SPI config and enable touch device. +- CHECK_RET(ithc_set_spi_config, ithc, +- DEVCFG_SPI_MAX_FREQ(ithc->config.spi_config), +- DEVCFG_SPI_MODE(ithc->config.spi_config)); +- CHECK_RET(ithc_set_device_enabled, ithc, true); +- ithc_log_regs(ithc); + return 0; + } + +@@ -527,11 +274,11 @@ static void ithc_stop(void *res) + CHECK(kthread_stop, ithc->poll_thread); + if (ithc->irq >= 0) + disable_irq(ithc->irq); +- CHECK(ithc_set_device_enabled, ithc, false); ++ if (ithc->use_quickspi) ++ ithc_quickspi_exit(ithc); ++ else ++ ithc_legacy_exit(ithc); + ithc_disable(ithc); +- hrtimer_cancel(&ithc->activity_start_timer); +- hrtimer_cancel(&ithc->activity_end_timer); +- cpu_latency_qos_remove_request(&ithc->activity_qos); + + // Clear DMA config. + for (unsigned int i = 0; i < 2; i++) { +@@ -570,9 +317,6 @@ static int ithc_start(struct pci_dev *pci) + ithc->irq = -1; + ithc->pci = pci; + snprintf(ithc->phys, sizeof(ithc->phys), "pci-%s/" DEVNAME, pci_name(pci)); +- init_waitqueue_head(&ithc->wait_hid_parse); +- init_waitqueue_head(&ithc->wait_hid_get_feature); +- mutex_init(&ithc->hid_get_feature_mutex); + pci_set_drvdata(pci, ithc); + CHECK_RET(devm_add_action_or_reset, &pci->dev, ithc_clear_drvdata, pci); + if (ithc_log_regs_enabled) +@@ -596,6 +340,9 @@ static int ithc_start(struct pci_dev *pci) + + // Initialize THC and touch device. + CHECK_RET(ithc_init_device, ithc); ++ ++ // Initialize HID and DMA. ++ CHECK_RET(ithc_hid_init, ithc); + CHECK(devm_device_add_groups, &pci->dev, ithc_attribute_groups); + if (ithc_use_rx0) + CHECK_RET(ithc_dma_rx_init, ithc, 0); +@@ -603,18 +350,10 @@ static int ithc_start(struct pci_dev *pci) + CHECK_RET(ithc_dma_rx_init, ithc, 1); + CHECK_RET(ithc_dma_tx_init, ithc); + +- cpu_latency_qos_add_request(&ithc->activity_qos, PM_QOS_DEFAULT_VALUE); +- hrtimer_init(&ithc->activity_start_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); +- ithc->activity_start_timer.function = ithc_activity_start_timer_callback; +- hrtimer_init(&ithc->activity_end_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); +- ithc->activity_end_timer.function = ithc_activity_end_timer_callback; +- + // Add ithc_stop() callback AFTER setting up DMA buffers, so that polling/irqs/DMA are + // disabled BEFORE the buffers are freed. + CHECK_RET(devm_add_action_or_reset, &pci->dev, ithc_stop, ithc); + +- CHECK_RET(ithc_hid_init, ithc); +- + // Start polling/IRQ. + if (ithc_use_polling) { + pci_info(pci, "using polling instead of irq\n"); +@@ -637,9 +376,11 @@ static int ithc_start(struct pci_dev *pci) + + // hid_add_device() can only be called after irq/polling is started and DMA is enabled, + // because it calls ithc_hid_parse() which reads the report descriptor via DMA. +- CHECK_RET(hid_add_device, ithc->hid); ++ CHECK_RET(hid_add_device, ithc->hid.dev); ++ ++ CHECK(ithc_debug_init_device, ithc); + +- CHECK(ithc_debug_init, ithc); ++ ithc_set_ltr_idle(ithc); + + pci_dbg(pci, "started\n"); + return 0; +@@ -710,17 +451,20 @@ static struct pci_driver ithc_driver = { + .thaw = ithc_thaw, + .restore = ithc_restore, + }, ++ .driver.probe_type = PROBE_PREFER_ASYNCHRONOUS, + //.dev_groups = ithc_attribute_groups, // could use this (since 5.14), however the attributes won't have valid values until config has been read anyway + }; + + static int __init ithc_init(void) + { ++ ithc_debug_init_module(); + return pci_register_driver(&ithc_driver); + } + + static void __exit ithc_exit(void) + { + pci_unregister_driver(&ithc_driver); ++ ithc_debug_exit_module(); + } + + module_init(ithc_init); +diff --git a/drivers/hid/ithc/ithc-quickspi.c b/drivers/hid/ithc/ithc-quickspi.c +new file mode 100644 +index 0000000000000..760e55ead0788 +--- /dev/null ++++ b/drivers/hid/ithc/ithc-quickspi.c +@@ -0,0 +1,578 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause ++ ++// Some public THC/QuickSPI documentation can be found in: ++// - Intel Firmware Support Package repo: https://github.com/intel/FSP ++// - HID over SPI (HIDSPI) spec: https://www.microsoft.com/en-us/download/details.aspx?id=103325 ++ ++#include "ithc.h" ++ ++static const guid_t guid_hidspi = ++ GUID_INIT(0x6e2ac436, 0x0fcf, 0x41af, 0xa2, 0x65, 0xb3, 0x2a, 0x22, 0x0d, 0xcf, 0xab); ++static const guid_t guid_thc_quickspi = ++ GUID_INIT(0x300d35b7, 0xac20, 0x413e, 0x8e, 0x9c, 0x92, 0xe4, 0xda, 0xfd, 0x0a, 0xfe); ++static const guid_t guid_thc_ltr = ++ GUID_INIT(0x84005682, 0x5b71, 0x41a4, 0x8d, 0x66, 0x81, 0x30, 0xf7, 0x87, 0xa1, 0x38); ++ ++// TODO The HIDSPI spec says revision should be 3. Should we try both? ++#define DSM_REV 2 ++ ++struct hidspi_header { ++ u8 type; ++ u16 len; ++ u8 id; ++} __packed; ++static_assert(sizeof(struct hidspi_header) == 4); ++ ++#define HIDSPI_INPUT_TYPE_DATA 1 ++#define HIDSPI_INPUT_TYPE_RESET_RESPONSE 3 ++#define HIDSPI_INPUT_TYPE_COMMAND_RESPONSE 4 ++#define HIDSPI_INPUT_TYPE_GET_FEATURE_RESPONSE 5 ++#define HIDSPI_INPUT_TYPE_DEVICE_DESCRIPTOR 7 ++#define HIDSPI_INPUT_TYPE_REPORT_DESCRIPTOR 8 ++#define HIDSPI_INPUT_TYPE_SET_FEATURE_RESPONSE 9 ++#define HIDSPI_INPUT_TYPE_OUTPUT_REPORT_RESPONSE 10 ++#define HIDSPI_INPUT_TYPE_GET_INPUT_REPORT_RESPONSE 11 ++ ++#define HIDSPI_OUTPUT_TYPE_DEVICE_DESCRIPTOR_REQUEST 1 ++#define HIDSPI_OUTPUT_TYPE_REPORT_DESCRIPTOR_REQUEST 2 ++#define HIDSPI_OUTPUT_TYPE_SET_FEATURE 3 ++#define HIDSPI_OUTPUT_TYPE_GET_FEATURE 4 ++#define HIDSPI_OUTPUT_TYPE_OUTPUT_REPORT 5 ++#define HIDSPI_OUTPUT_TYPE_INPUT_REPORT_REQUEST 6 ++#define HIDSPI_OUTPUT_TYPE_COMMAND 7 ++ ++struct hidspi_device_descriptor { ++ u16 wDeviceDescLength; ++ u16 bcdVersion; ++ u16 wReportDescLength; ++ u16 wMaxInputLength; ++ u16 wMaxOutputLength; ++ u16 wMaxFragmentLength; ++ u16 wVendorID; ++ u16 wProductID; ++ u16 wVersionID; ++ u16 wFlags; ++ u32 dwReserved; ++}; ++static_assert(sizeof(struct hidspi_device_descriptor) == 24); ++ ++static int read_acpi_u32(struct ithc *ithc, const guid_t *guid, u32 func, u32 *dest) ++{ ++ acpi_handle handle = ACPI_HANDLE(&ithc->pci->dev); ++ union acpi_object *o = acpi_evaluate_dsm(handle, guid, DSM_REV, func, NULL); ++ if (!o) ++ return 0; ++ if (o->type != ACPI_TYPE_INTEGER) { ++ pci_err(ithc->pci, "DSM %pUl %u returned type %i instead of integer\n", ++ guid, func, o->type); ++ ACPI_FREE(o); ++ return -1; ++ } ++ pci_dbg(ithc->pci, "DSM %pUl %u = 0x%08x\n", guid, func, (u32)o->integer.value); ++ *dest = (u32)o->integer.value; ++ ACPI_FREE(o); ++ return 1; ++} ++ ++static int read_acpi_buf(struct ithc *ithc, const guid_t *guid, u32 func, size_t len, u8 *dest) ++{ ++ acpi_handle handle = ACPI_HANDLE(&ithc->pci->dev); ++ union acpi_object *o = acpi_evaluate_dsm(handle, guid, DSM_REV, func, NULL); ++ if (!o) ++ return 0; ++ if (o->type != ACPI_TYPE_BUFFER) { ++ pci_err(ithc->pci, "DSM %pUl %u returned type %i instead of buffer\n", ++ guid, func, o->type); ++ ACPI_FREE(o); ++ return -1; ++ } ++ if (o->buffer.length != len) { ++ pci_err(ithc->pci, "DSM %pUl %u returned len %u instead of %zu\n", ++ guid, func, o->buffer.length, len); ++ ACPI_FREE(o); ++ return -1; ++ } ++ memcpy(dest, o->buffer.pointer, len); ++ pci_dbg(ithc->pci, "DSM %pUl %u = 0x%02x\n", guid, func, dest[0]); ++ ACPI_FREE(o); ++ return 1; ++} ++ ++int ithc_read_acpi_config(struct ithc *ithc, struct ithc_acpi_config *cfg) ++{ ++ int r; ++ acpi_handle handle = ACPI_HANDLE(&ithc->pci->dev); ++ ++ cfg->has_config = acpi_check_dsm(handle, &guid_hidspi, DSM_REV, BIT(0)); ++ if (!cfg->has_config) ++ return 0; ++ ++ // HIDSPI settings ++ ++ r = read_acpi_u32(ithc, &guid_hidspi, 1, &cfg->input_report_header_address); ++ if (r < 0) ++ return r; ++ cfg->has_input_report_header_address = r > 0; ++ if (r > 0 && cfg->input_report_header_address > 0xffffff) { ++ pci_err(ithc->pci, "Invalid input report header address 0x%x\n", ++ cfg->input_report_header_address); ++ return -1; ++ } ++ ++ r = read_acpi_u32(ithc, &guid_hidspi, 2, &cfg->input_report_body_address); ++ if (r < 0) ++ return r; ++ cfg->has_input_report_body_address = r > 0; ++ if (r > 0 && cfg->input_report_body_address > 0xffffff) { ++ pci_err(ithc->pci, "Invalid input report body address 0x%x\n", ++ cfg->input_report_body_address); ++ return -1; ++ } ++ ++ r = read_acpi_u32(ithc, &guid_hidspi, 3, &cfg->output_report_body_address); ++ if (r < 0) ++ return r; ++ cfg->has_output_report_body_address = r > 0; ++ if (r > 0 && cfg->output_report_body_address > 0xffffff) { ++ pci_err(ithc->pci, "Invalid output report body address 0x%x\n", ++ cfg->output_report_body_address); ++ return -1; ++ } ++ ++ r = read_acpi_buf(ithc, &guid_hidspi, 4, sizeof(cfg->read_opcode), &cfg->read_opcode); ++ if (r < 0) ++ return r; ++ cfg->has_read_opcode = r > 0; ++ ++ r = read_acpi_buf(ithc, &guid_hidspi, 5, sizeof(cfg->write_opcode), &cfg->write_opcode); ++ if (r < 0) ++ return r; ++ cfg->has_write_opcode = r > 0; ++ ++ u32 flags; ++ r = read_acpi_u32(ithc, &guid_hidspi, 6, &flags); ++ if (r < 0) ++ return r; ++ cfg->has_read_mode = cfg->has_write_mode = r > 0; ++ if (r > 0) { ++ cfg->read_mode = (flags >> 14) & 3; ++ cfg->write_mode = flags & BIT(13) ? cfg->read_mode : SPI_MODE_SINGLE; ++ } ++ ++ // Quick SPI settings ++ ++ r = read_acpi_u32(ithc, &guid_thc_quickspi, 1, &cfg->spi_frequency); ++ if (r < 0) ++ return r; ++ cfg->has_spi_frequency = r > 0; ++ ++ r = read_acpi_u32(ithc, &guid_thc_quickspi, 2, &cfg->limit_packet_size); ++ if (r < 0) ++ return r; ++ cfg->has_limit_packet_size = r > 0; ++ ++ r = read_acpi_u32(ithc, &guid_thc_quickspi, 3, &cfg->tx_delay); ++ if (r < 0) ++ return r; ++ cfg->has_tx_delay = r > 0; ++ if (r > 0) ++ cfg->tx_delay &= 0xffff; ++ ++ // LTR settings ++ ++ r = read_acpi_u32(ithc, &guid_thc_ltr, 1, &cfg->active_ltr); ++ if (r < 0) ++ return r; ++ cfg->has_active_ltr = r > 0; ++ if (r > 0 && (!cfg->active_ltr || cfg->active_ltr > 0x3ff)) { ++ if (cfg->active_ltr != 0xffffffff) ++ pci_warn(ithc->pci, "Ignoring invalid active LTR value 0x%x\n", ++ cfg->active_ltr); ++ cfg->active_ltr = 500; ++ } ++ ++ r = read_acpi_u32(ithc, &guid_thc_ltr, 2, &cfg->idle_ltr); ++ if (r < 0) ++ return r; ++ cfg->has_idle_ltr = r > 0; ++ if (r > 0 && (!cfg->idle_ltr || cfg->idle_ltr > 0x3ff)) { ++ if (cfg->idle_ltr != 0xffffffff) ++ pci_warn(ithc->pci, "Ignoring invalid idle LTR value 0x%x\n", ++ cfg->idle_ltr); ++ cfg->idle_ltr = 500; ++ if (cfg->has_active_ltr && cfg->active_ltr > cfg->idle_ltr) ++ cfg->idle_ltr = cfg->active_ltr; ++ } ++ ++ return 0; ++} ++ ++void ithc_print_acpi_config(struct ithc *ithc, const struct ithc_acpi_config *cfg) ++{ ++ if (!cfg->has_config) { ++ pci_info(ithc->pci, "No ACPI config"); ++ return; ++ } ++ ++ char input_report_header_address[16] = "-"; ++ if (cfg->has_input_report_header_address) ++ sprintf(input_report_header_address, "0x%x", cfg->input_report_header_address); ++ char input_report_body_address[16] = "-"; ++ if (cfg->has_input_report_body_address) ++ sprintf(input_report_body_address, "0x%x", cfg->input_report_body_address); ++ char output_report_body_address[16] = "-"; ++ if (cfg->has_output_report_body_address) ++ sprintf(output_report_body_address, "0x%x", cfg->output_report_body_address); ++ char read_opcode[16] = "-"; ++ if (cfg->has_read_opcode) ++ sprintf(read_opcode, "0x%02x", cfg->read_opcode); ++ char write_opcode[16] = "-"; ++ if (cfg->has_write_opcode) ++ sprintf(write_opcode, "0x%02x", cfg->write_opcode); ++ char read_mode[16] = "-"; ++ if (cfg->has_read_mode) ++ sprintf(read_mode, "%i", cfg->read_mode); ++ char write_mode[16] = "-"; ++ if (cfg->has_write_mode) ++ sprintf(write_mode, "%i", cfg->write_mode); ++ char spi_frequency[16] = "-"; ++ if (cfg->has_spi_frequency) ++ sprintf(spi_frequency, "%u", cfg->spi_frequency); ++ char limit_packet_size[16] = "-"; ++ if (cfg->has_limit_packet_size) ++ sprintf(limit_packet_size, "%u", cfg->limit_packet_size); ++ char tx_delay[16] = "-"; ++ if (cfg->has_tx_delay) ++ sprintf(tx_delay, "%u", cfg->tx_delay); ++ char active_ltr[16] = "-"; ++ if (cfg->has_active_ltr) ++ sprintf(active_ltr, "%u", cfg->active_ltr); ++ char idle_ltr[16] = "-"; ++ if (cfg->has_idle_ltr) ++ sprintf(idle_ltr, "%u", cfg->idle_ltr); ++ ++ pci_info(ithc->pci, "ACPI config: InputHeaderAddr=%s InputBodyAddr=%s OutputBodyAddr=%s ReadOpcode=%s WriteOpcode=%s ReadMode=%s WriteMode=%s Frequency=%s LimitPacketSize=%s TxDelay=%s ActiveLTR=%s IdleLTR=%s\n", ++ input_report_header_address, input_report_body_address, output_report_body_address, ++ read_opcode, write_opcode, read_mode, write_mode, ++ spi_frequency, limit_packet_size, tx_delay, active_ltr, idle_ltr); ++} ++ ++static int ithc_quickspi_init_regs(struct ithc *ithc, const struct ithc_acpi_config *cfg) ++{ ++ pci_dbg(ithc->pci, "initializing QuickSPI registers\n"); ++ ++ // SPI frequency and mode ++ if (!cfg->has_spi_frequency || !cfg->spi_frequency) { ++ pci_err(ithc->pci, "Missing SPI frequency in configuration\n"); ++ return -EINVAL; ++ } ++ unsigned int clkdiv = DIV_ROUND_UP(SPI_CLK_FREQ_BASE, cfg->spi_frequency); ++ bool clkdiv8 = clkdiv > 7; ++ if (clkdiv8) ++ clkdiv = min(7u, DIV_ROUND_UP(clkdiv, 8u)); ++ if (!clkdiv) ++ clkdiv = 1; ++ CHECK_RET(ithc_set_spi_config, ithc, clkdiv, clkdiv8, ++ cfg->has_read_mode ? cfg->read_mode : SPI_MODE_SINGLE, ++ cfg->has_write_mode ? cfg->write_mode : SPI_MODE_SINGLE); ++ ++ // SPI addresses and opcodes ++ if (cfg->has_input_report_header_address) ++ writel(cfg->input_report_header_address, &ithc->regs->spi_header_addr); ++ if (cfg->has_input_report_body_address) ++ writel(cfg->input_report_body_address, &ithc->regs->dma_rx[0].spi_addr); ++ if (cfg->has_output_report_body_address) ++ writel(cfg->output_report_body_address, &ithc->regs->dma_tx.spi_addr); ++ ++ if (cfg->has_read_opcode) { ++ writeb(cfg->read_opcode, &ithc->regs->read_opcode); ++ writeb(cfg->read_opcode, &ithc->regs->read_opcode_single); ++ writeb(cfg->read_opcode, &ithc->regs->read_opcode_dual); ++ writeb(cfg->read_opcode, &ithc->regs->read_opcode_quad); ++ } ++ if (cfg->has_write_opcode) { ++ writeb(cfg->write_opcode, &ithc->regs->write_opcode); ++ writeb(cfg->write_opcode, &ithc->regs->write_opcode_single); ++ writeb(cfg->write_opcode, &ithc->regs->write_opcode_dual); ++ writeb(cfg->write_opcode, &ithc->regs->write_opcode_quad); ++ } ++ ithc_log_regs(ithc); ++ ++ // The rest... ++ bitsl(&ithc->regs->quickspi_config1, ++ QUICKSPI_CONFIG1_UNKNOWN_0(0xff) | QUICKSPI_CONFIG1_UNKNOWN_5(0xff) | ++ QUICKSPI_CONFIG1_UNKNOWN_10(0xff) | QUICKSPI_CONFIG1_UNKNOWN_16(0xffff), ++ QUICKSPI_CONFIG1_UNKNOWN_0(4) | QUICKSPI_CONFIG1_UNKNOWN_5(4) | ++ QUICKSPI_CONFIG1_UNKNOWN_10(22) | QUICKSPI_CONFIG1_UNKNOWN_16(2)); ++ ++ bitsl(&ithc->regs->quickspi_config2, ++ QUICKSPI_CONFIG2_UNKNOWN_0(0xff) | QUICKSPI_CONFIG2_UNKNOWN_5(0xff) | ++ QUICKSPI_CONFIG2_UNKNOWN_12(0xff), ++ QUICKSPI_CONFIG2_UNKNOWN_0(8) | QUICKSPI_CONFIG2_UNKNOWN_5(14) | ++ QUICKSPI_CONFIG2_UNKNOWN_12(2)); ++ ++ u32 pktsize = cfg->has_limit_packet_size && cfg->limit_packet_size == 1 ? 4 : 0x80; ++ bitsl(&ithc->regs->spi_config, ++ SPI_CONFIG_READ_PACKET_SIZE(0xfff) | SPI_CONFIG_WRITE_PACKET_SIZE(0xfff), ++ SPI_CONFIG_READ_PACKET_SIZE(pktsize) | SPI_CONFIG_WRITE_PACKET_SIZE(pktsize)); ++ ++ bitsl_set(&ithc->regs->quickspi_config2, ++ QUICKSPI_CONFIG2_UNKNOWN_16 | QUICKSPI_CONFIG2_UNKNOWN_17); ++ bitsl(&ithc->regs->quickspi_config2, ++ QUICKSPI_CONFIG2_DISABLE_READ_ADDRESS_INCREMENT | ++ QUICKSPI_CONFIG2_DISABLE_WRITE_ADDRESS_INCREMENT | ++ QUICKSPI_CONFIG2_ENABLE_WRITE_STREAMING_MODE, 0); ++ ++ return 0; ++} ++ ++static int wait_for_report(struct ithc *ithc) ++{ ++ CHECK_RET(waitl, ithc, &ithc->regs->dma_rx[0].status, ++ DMA_RX_STATUS_READY, DMA_RX_STATUS_READY); ++ writel(DMA_RX_STATUS_READY, &ithc->regs->dma_rx[0].status); ++ ++ u32 h = readl(&ithc->regs->input_header); ++ ithc_log_regs(ithc); ++ if (INPUT_HEADER_SYNC(h) != INPUT_HEADER_SYNC_VALUE ++ || INPUT_HEADER_VERSION(h) != INPUT_HEADER_VERSION_VALUE) { ++ pci_err(ithc->pci, "invalid input report frame header 0x%08x\n", h); ++ return -ENODATA; ++ } ++ return INPUT_HEADER_REPORT_LENGTH(h) * 4; ++} ++ ++static int ithc_quickspi_init_hidspi(struct ithc *ithc, const struct ithc_acpi_config *cfg) ++{ ++ pci_dbg(ithc->pci, "initializing HIDSPI\n"); ++ ++ // HIDSPI initialization sequence: ++ // "1. The host shall invoke the ACPI reset method to clear the device state." ++ acpi_status s = acpi_evaluate_object(ACPI_HANDLE(&ithc->pci->dev), "_RST", NULL, NULL); ++ if (ACPI_FAILURE(s)) { ++ pci_err(ithc->pci, "ACPI reset failed\n"); ++ return -EIO; ++ } ++ ++ bitsl(&ithc->regs->control_bits, CONTROL_QUIESCE, 0); ++ ++ // "2. Within 1 second, the device shall signal an interrupt and make available to the host ++ // an input report containing a device reset response." ++ int size = wait_for_report(ithc); ++ if (size < 0) ++ return size; ++ if (size < sizeof(struct hidspi_header)) { ++ pci_err(ithc->pci, "SPI data size too small for reset response (%u)\n", size); ++ return -EMSGSIZE; ++ } ++ ++ // "3. The host shall read the reset response from the device at the Input Report addresses ++ // specified in ACPI." ++ u32 in_addr = cfg->has_input_report_body_address ? cfg->input_report_body_address : 0x1000; ++ struct { ++ struct hidspi_header header; ++ union { ++ struct hidspi_device_descriptor device_desc; ++ u32 data[16]; ++ }; ++ } resp = { 0 }; ++ if (size > sizeof(resp)) { ++ pci_err(ithc->pci, "SPI data size for reset response too big (%u)\n", size); ++ return -EMSGSIZE; ++ } ++ CHECK_RET(ithc_spi_command, ithc, SPI_CMD_CODE_READ, in_addr, size, &resp); ++ if (resp.header.type != HIDSPI_INPUT_TYPE_RESET_RESPONSE) { ++ pci_err(ithc->pci, "received type %i instead of reset response\n", resp.header.type); ++ return -ENOMSG; ++ } ++ ++ // "4. The host shall then write an Output Report to the device at the Output Report Address ++ // specified in ACPI, requesting the Device Descriptor from the device." ++ u32 out_addr = cfg->has_output_report_body_address ? cfg->output_report_body_address : 0x1000; ++ struct hidspi_header req = { .type = HIDSPI_OUTPUT_TYPE_DEVICE_DESCRIPTOR_REQUEST }; ++ CHECK_RET(ithc_spi_command, ithc, SPI_CMD_CODE_WRITE, out_addr, sizeof(req), &req); ++ ++ // "5. Within 1 second, the device shall signal an interrupt and make available to the host ++ // an input report containing the Device Descriptor." ++ size = wait_for_report(ithc); ++ if (size < 0) ++ return size; ++ if (size < sizeof(resp.header) + sizeof(resp.device_desc)) { ++ pci_err(ithc->pci, "SPI data size too small for device descriptor (%u)\n", size); ++ return -EMSGSIZE; ++ } ++ ++ // "6. The host shall read the Device Descriptor from the Input Report addresses specified ++ // in ACPI." ++ if (size > sizeof(resp)) { ++ pci_err(ithc->pci, "SPI data size for device descriptor too big (%u)\n", size); ++ return -EMSGSIZE; ++ } ++ memset(&resp, 0, sizeof(resp)); ++ CHECK_RET(ithc_spi_command, ithc, SPI_CMD_CODE_READ, in_addr, size, &resp); ++ if (resp.header.type != HIDSPI_INPUT_TYPE_DEVICE_DESCRIPTOR) { ++ pci_err(ithc->pci, "received type %i instead of device descriptor\n", ++ resp.header.type); ++ return -ENOMSG; ++ } ++ struct hidspi_device_descriptor *d = &resp.device_desc; ++ if (resp.header.len < sizeof(*d)) { ++ pci_err(ithc->pci, "response too small for device descriptor (%u)\n", ++ resp.header.len); ++ return -EMSGSIZE; ++ } ++ if (d->wDeviceDescLength != sizeof(*d)) { ++ pci_err(ithc->pci, "invalid device descriptor length (%u)\n", ++ d->wDeviceDescLength); ++ return -EMSGSIZE; ++ } ++ ++ pci_info(ithc->pci, "Device descriptor: bcdVersion=0x%04x wReportDescLength=%u wMaxInputLength=%u wMaxOutputLength=%u wMaxFragmentLength=%u wVendorID=0x%04x wProductID=0x%04x wVersionID=0x%04x wFlags=0x%04x dwReserved=0x%08x\n", ++ d->bcdVersion, d->wReportDescLength, ++ d->wMaxInputLength, d->wMaxOutputLength, d->wMaxFragmentLength, ++ d->wVendorID, d->wProductID, d->wVersionID, ++ d->wFlags, d->dwReserved); ++ ++ ithc->vendor_id = d->wVendorID; ++ ithc->product_id = d->wProductID; ++ ithc->product_rev = d->wVersionID; ++ ithc->max_rx_size = max_t(u32, d->wMaxInputLength, ++ d->wReportDescLength + sizeof(struct hidspi_header)); ++ ithc->max_tx_size = d->wMaxOutputLength; ++ ithc->have_config = true; ++ ++ // "7. The device and host shall then enter their "Ready" states - where the device may ++ // begin sending Input Reports, and the device shall be prepared for Output Reports from ++ // the host." ++ ++ return 0; ++} ++ ++int ithc_quickspi_init(struct ithc *ithc, const struct ithc_acpi_config *cfg) ++{ ++ bitsl_set(&ithc->regs->control_bits, CONTROL_QUIESCE); ++ CHECK_RET(waitl, ithc, &ithc->regs->control_bits, CONTROL_IS_QUIESCED, CONTROL_IS_QUIESCED); ++ ++ ithc_log_regs(ithc); ++ CHECK_RET(ithc_quickspi_init_regs, ithc, cfg); ++ ithc_log_regs(ithc); ++ CHECK_RET(ithc_quickspi_init_hidspi, ithc, cfg); ++ ithc_log_regs(ithc); ++ ++ // This value is set to 2 in ithc_quickspi_init_regs(). It needs to be set to 1 here, ++ // otherwise DMA will not work. Maybe selects between DMA and PIO mode? ++ bitsl(&ithc->regs->quickspi_config1, ++ QUICKSPI_CONFIG1_UNKNOWN_16(0xffff), QUICKSPI_CONFIG1_UNKNOWN_16(1)); ++ ++ // TODO Do we need to set any of the following bits here? ++ //bitsb_set(&ithc->regs->dma_rx[1].control2, DMA_RX_CONTROL2_UNKNOWN_4); ++ //bitsb_set(&ithc->regs->dma_rx[0].control2, DMA_RX_CONTROL2_UNKNOWN_5); ++ //bitsb_set(&ithc->regs->dma_rx[1].control2, DMA_RX_CONTROL2_UNKNOWN_5); ++ //bitsl_set(&ithc->regs->dma_rx[0].init_unknown, INIT_UNKNOWN_3); ++ //bitsl_set(&ithc->regs->dma_rx[0].init_unknown, INIT_UNKNOWN_31); ++ ++ ithc_log_regs(ithc); ++ ++ return 0; ++} ++ ++void ithc_quickspi_exit(struct ithc *ithc) ++{ ++ // TODO Should we send HIDSPI 'power off' command? ++ //struct hidspi_header h = { .type = HIDSPI_OUTPUT_TYPE_COMMAND, .id = 3, }; ++ //struct ithc_data d = { .type = ITHC_DATA_RAW, .data = &h, .size = sizeof(h) }; ++ //CHECK(ithc_dma_tx, ithc, &d); // or ithc_spi_command() ++} ++ ++int ithc_quickspi_decode_rx(struct ithc *ithc, const void *src, size_t len, struct ithc_data *dest) ++{ ++ const struct hidspi_header *hdr = src; ++ ++ if (len < sizeof(*hdr)) ++ return -ENODATA; ++ // TODO Do we need to handle HIDSPI packet fragmentation? ++ if (len < sizeof(*hdr) + hdr->len) ++ return -EMSGSIZE; ++ if (len > round_up(sizeof(*hdr) + hdr->len, 4)) ++ return -EMSGSIZE; ++ ++ switch (hdr->type) { ++ case HIDSPI_INPUT_TYPE_RESET_RESPONSE: ++ // TODO "When the device detects an error condition, it may interrupt and make ++ // available to the host an Input Report containing an unsolicited Reset Response. ++ // After receiving an unsolicited Reset Response, the host shall initiate the ++ // request procedure from step (4) in the [HIDSPI initialization] process." ++ dest->type = ITHC_DATA_ERROR; ++ return 0; ++ case HIDSPI_INPUT_TYPE_REPORT_DESCRIPTOR: ++ dest->type = ITHC_DATA_REPORT_DESCRIPTOR; ++ dest->data = hdr + 1; ++ dest->size = hdr->len; ++ return 0; ++ case HIDSPI_INPUT_TYPE_DATA: ++ case HIDSPI_INPUT_TYPE_GET_INPUT_REPORT_RESPONSE: ++ dest->type = ITHC_DATA_INPUT_REPORT; ++ dest->data = &hdr->id; ++ dest->size = hdr->len + 1; ++ return 0; ++ case HIDSPI_INPUT_TYPE_GET_FEATURE_RESPONSE: ++ dest->type = ITHC_DATA_GET_FEATURE; ++ dest->data = &hdr->id; ++ dest->size = hdr->len + 1; ++ return 0; ++ case HIDSPI_INPUT_TYPE_SET_FEATURE_RESPONSE: ++ case HIDSPI_INPUT_TYPE_OUTPUT_REPORT_RESPONSE: ++ dest->type = ITHC_DATA_IGNORE; ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ ++ssize_t ithc_quickspi_encode_tx(struct ithc *ithc, const struct ithc_data *src, void *dest, ++ size_t maxlen) ++{ ++ struct hidspi_header *hdr = dest; ++ ++ size_t src_size = src->size; ++ const u8 *src_data = src->data; ++ u8 type; ++ ++ switch (src->type) { ++ case ITHC_DATA_SET_FEATURE: ++ type = HIDSPI_OUTPUT_TYPE_SET_FEATURE; ++ break; ++ case ITHC_DATA_GET_FEATURE: ++ type = HIDSPI_OUTPUT_TYPE_GET_FEATURE; ++ break; ++ case ITHC_DATA_OUTPUT_REPORT: ++ type = HIDSPI_OUTPUT_TYPE_OUTPUT_REPORT; ++ break; ++ case ITHC_DATA_REPORT_DESCRIPTOR: ++ type = HIDSPI_OUTPUT_TYPE_REPORT_DESCRIPTOR_REQUEST; ++ src_size = 0; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ u8 id = 0; ++ if (src_size) { ++ id = *src_data++; ++ src_size--; ++ } ++ ++ // Data must be padded to next 4-byte boundary. ++ size_t padded = round_up(src_size, 4); ++ if (sizeof(*hdr) + padded > maxlen) ++ return -EOVERFLOW; ++ ++ // Fill the TX buffer with header and data. ++ hdr->type = type; ++ hdr->len = (u16)src_size; ++ hdr->id = id; ++ memcpy_and_pad(hdr + 1, padded, src_data, src_size, 0); ++ ++ return sizeof(*hdr) + padded; ++} ++ +diff --git a/drivers/hid/ithc/ithc-quickspi.h b/drivers/hid/ithc/ithc-quickspi.h +new file mode 100644 +index 0000000000000..74d882f6b2f0a +--- /dev/null ++++ b/drivers/hid/ithc/ithc-quickspi.h +@@ -0,0 +1,39 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ ++ ++struct ithc_acpi_config { ++ bool has_config: 1; ++ bool has_input_report_header_address: 1; ++ bool has_input_report_body_address: 1; ++ bool has_output_report_body_address: 1; ++ bool has_read_opcode: 1; ++ bool has_write_opcode: 1; ++ bool has_read_mode: 1; ++ bool has_write_mode: 1; ++ bool has_spi_frequency: 1; ++ bool has_limit_packet_size: 1; ++ bool has_tx_delay: 1; ++ bool has_active_ltr: 1; ++ bool has_idle_ltr: 1; ++ u32 input_report_header_address; ++ u32 input_report_body_address; ++ u32 output_report_body_address; ++ u8 read_opcode; ++ u8 write_opcode; ++ u8 read_mode; ++ u8 write_mode; ++ u32 spi_frequency; ++ u32 limit_packet_size; ++ u32 tx_delay; // us/10 // TODO use? ++ u32 active_ltr; // ns/1024 ++ u32 idle_ltr; // ns/1024 ++}; ++ ++int ithc_read_acpi_config(struct ithc *ithc, struct ithc_acpi_config *cfg); ++void ithc_print_acpi_config(struct ithc *ithc, const struct ithc_acpi_config *cfg); ++ ++int ithc_quickspi_init(struct ithc *ithc, const struct ithc_acpi_config *cfg); ++void ithc_quickspi_exit(struct ithc *ithc); ++int ithc_quickspi_decode_rx(struct ithc *ithc, const void *src, size_t len, struct ithc_data *dest); ++ssize_t ithc_quickspi_encode_tx(struct ithc *ithc, const struct ithc_data *src, void *dest, ++ size_t maxlen); ++ +diff --git a/drivers/hid/ithc/ithc-regs.c b/drivers/hid/ithc/ithc-regs.c +index e058721886e37..c0f13506af205 100644 +--- a/drivers/hid/ithc/ithc-regs.c ++++ b/drivers/hid/ithc/ithc-regs.c +@@ -22,46 +22,104 @@ void bitsb(__iomem u8 *reg, u8 mask, u8 val) + + int waitl(struct ithc *ithc, __iomem u32 *reg, u32 mask, u32 val) + { ++ ithc_log_regs(ithc); + pci_dbg(ithc->pci, "waiting for reg 0x%04x mask 0x%08x val 0x%08x\n", + reg_num(reg), mask, val); + u32 x; + if (readl_poll_timeout(reg, x, (x & mask) == val, 200, 1000*1000)) { ++ ithc_log_regs(ithc); + pci_err(ithc->pci, "timed out waiting for reg 0x%04x mask 0x%08x val 0x%08x\n", + reg_num(reg), mask, val); + return -ETIMEDOUT; + } ++ ithc_log_regs(ithc); + pci_dbg(ithc->pci, "done waiting\n"); + return 0; + } + + int waitb(struct ithc *ithc, __iomem u8 *reg, u8 mask, u8 val) + { ++ ithc_log_regs(ithc); + pci_dbg(ithc->pci, "waiting for reg 0x%04x mask 0x%02x val 0x%02x\n", + reg_num(reg), mask, val); + u8 x; + if (readb_poll_timeout(reg, x, (x & mask) == val, 200, 1000*1000)) { ++ ithc_log_regs(ithc); + pci_err(ithc->pci, "timed out waiting for reg 0x%04x mask 0x%02x val 0x%02x\n", + reg_num(reg), mask, val); + return -ETIMEDOUT; + } ++ ithc_log_regs(ithc); + pci_dbg(ithc->pci, "done waiting\n"); + return 0; + } + +-int ithc_set_spi_config(struct ithc *ithc, u8 speed, u8 mode) ++static void calc_ltr(u64 *ns, unsigned int *val, unsigned int *scale) + { +- pci_dbg(ithc->pci, "setting SPI speed to %i, mode %i\n", speed, mode); +- if (mode == 3) +- mode = 2; ++ unsigned int s = 0; ++ u64 v = *ns; ++ while (v > 0x3ff) { ++ s++; ++ v >>= 5; ++ } ++ if (s > 5) { ++ s = 5; ++ v = 0x3ff; ++ } ++ *val = v; ++ *scale = s; ++ *ns = v << (5 * s); ++} ++ ++void ithc_set_ltr_config(struct ithc *ithc, u64 active_ltr_ns, u64 idle_ltr_ns) ++{ ++ unsigned int active_val, active_scale, idle_val, idle_scale; ++ calc_ltr(&active_ltr_ns, &active_val, &active_scale); ++ calc_ltr(&idle_ltr_ns, &idle_val, &idle_scale); ++ pci_dbg(ithc->pci, "setting active LTR value to %llu ns, idle LTR value to %llu ns\n", ++ active_ltr_ns, idle_ltr_ns); ++ writel(LTR_CONFIG_ENABLE_ACTIVE | LTR_CONFIG_ENABLE_IDLE | LTR_CONFIG_APPLY | ++ LTR_CONFIG_ACTIVE_LTR_SCALE(active_scale) | LTR_CONFIG_ACTIVE_LTR_VALUE(active_val) | ++ LTR_CONFIG_IDLE_LTR_SCALE(idle_scale) | LTR_CONFIG_IDLE_LTR_VALUE(idle_val), ++ &ithc->regs->ltr_config); ++} ++ ++void ithc_set_ltr_idle(struct ithc *ithc) ++{ ++ u32 ltr = readl(&ithc->regs->ltr_config); ++ switch (ltr & (LTR_CONFIG_STATUS_ACTIVE | LTR_CONFIG_STATUS_IDLE)) { ++ case LTR_CONFIG_STATUS_IDLE: ++ break; ++ case LTR_CONFIG_STATUS_ACTIVE: ++ writel(ltr | LTR_CONFIG_TOGGLE | LTR_CONFIG_APPLY, &ithc->regs->ltr_config); ++ break; ++ default: ++ pci_err(ithc->pci, "invalid LTR state 0x%08x\n", ltr); ++ break; ++ } ++} ++ ++int ithc_set_spi_config(struct ithc *ithc, u8 clkdiv, bool clkdiv8, u8 read_mode, u8 write_mode) ++{ ++ if (clkdiv == 0 || clkdiv > 7 || read_mode > SPI_MODE_QUAD || write_mode > SPI_MODE_QUAD) ++ return -EINVAL; ++ static const char * const modes[] = { "single", "dual", "quad" }; ++ pci_dbg(ithc->pci, "setting SPI frequency to %i Hz, %s read, %s write\n", ++ SPI_CLK_FREQ_BASE / (clkdiv * (clkdiv8 ? 8 : 1)), ++ modes[read_mode], modes[write_mode]); + bitsl(&ithc->regs->spi_config, +- SPI_CONFIG_MODE(0xff) | SPI_CONFIG_SPEED(0xff) | SPI_CONFIG_UNKNOWN_18(0xff) | SPI_CONFIG_SPEED2(0xff), +- SPI_CONFIG_MODE(mode) | SPI_CONFIG_SPEED(speed) | SPI_CONFIG_UNKNOWN_18(0) | SPI_CONFIG_SPEED2(speed)); ++ SPI_CONFIG_READ_MODE(0xff) | SPI_CONFIG_READ_CLKDIV(0xff) | ++ SPI_CONFIG_WRITE_MODE(0xff) | SPI_CONFIG_WRITE_CLKDIV(0xff) | ++ SPI_CONFIG_CLKDIV_8, ++ SPI_CONFIG_READ_MODE(read_mode) | SPI_CONFIG_READ_CLKDIV(clkdiv) | ++ SPI_CONFIG_WRITE_MODE(write_mode) | SPI_CONFIG_WRITE_CLKDIV(clkdiv) | ++ (clkdiv8 ? SPI_CONFIG_CLKDIV_8 : 0)); + return 0; + } + + int ithc_spi_command(struct ithc *ithc, u8 command, u32 offset, u32 size, void *data) + { +- pci_dbg(ithc->pci, "SPI command %u, size %u, offset %u\n", command, size, offset); ++ pci_dbg(ithc->pci, "SPI command %u, size %u, offset 0x%x\n", command, size, offset); + if (size > sizeof(ithc->regs->spi_cmd.data)) + return -EINVAL; + +diff --git a/drivers/hid/ithc/ithc-regs.h b/drivers/hid/ithc/ithc-regs.h +index d4007d9e2bacc..a9d2364546442 100644 +--- a/drivers/hid/ithc/ithc-regs.h ++++ b/drivers/hid/ithc/ithc-regs.h +@@ -1,14 +1,34 @@ + /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ + ++#define LTR_CONFIG_ENABLE_ACTIVE BIT(0) ++#define LTR_CONFIG_TOGGLE BIT(1) ++#define LTR_CONFIG_ENABLE_IDLE BIT(2) ++#define LTR_CONFIG_APPLY BIT(3) ++#define LTR_CONFIG_IDLE_LTR_SCALE(x) (((x) & 7) << 4) ++#define LTR_CONFIG_IDLE_LTR_VALUE(x) (((x) & 0x3ff) << 7) ++#define LTR_CONFIG_ACTIVE_LTR_SCALE(x) (((x) & 7) << 17) ++#define LTR_CONFIG_ACTIVE_LTR_VALUE(x) (((x) & 0x3ff) << 20) ++#define LTR_CONFIG_STATUS_ACTIVE BIT(30) ++#define LTR_CONFIG_STATUS_IDLE BIT(31) ++ + #define CONTROL_QUIESCE BIT(1) + #define CONTROL_IS_QUIESCED BIT(2) + #define CONTROL_NRESET BIT(3) ++#define CONTROL_UNKNOWN_24(x) (((x) & 3) << 24) + #define CONTROL_READY BIT(29) + +-#define SPI_CONFIG_MODE(x) (((x) & 3) << 2) +-#define SPI_CONFIG_SPEED(x) (((x) & 7) << 4) +-#define SPI_CONFIG_UNKNOWN_18(x) (((x) & 3) << 18) +-#define SPI_CONFIG_SPEED2(x) (((x) & 0xf) << 20) // high bit = high speed mode? ++#define SPI_CONFIG_READ_MODE(x) (((x) & 3) << 2) ++#define SPI_CONFIG_READ_CLKDIV(x) (((x) & 7) << 4) ++#define SPI_CONFIG_READ_PACKET_SIZE(x) (((x) & 0x1ff) << 7) ++#define SPI_CONFIG_WRITE_MODE(x) (((x) & 3) << 18) ++#define SPI_CONFIG_WRITE_CLKDIV(x) (((x) & 7) << 20) ++#define SPI_CONFIG_CLKDIV_8 BIT(23) // additionally divide clk by 8, for both read and write ++#define SPI_CONFIG_WRITE_PACKET_SIZE(x) (((x) & 0xff) << 24) ++ ++#define SPI_CLK_FREQ_BASE 125000000 ++#define SPI_MODE_SINGLE 0 ++#define SPI_MODE_DUAL 1 ++#define SPI_MODE_QUAD 2 + + #define ERROR_CONTROL_UNKNOWN_0 BIT(0) + #define ERROR_CONTROL_DISABLE_DMA BIT(1) // clears DMA_RX_CONTROL_ENABLE when a DMA error occurs +@@ -53,33 +73,71 @@ + #define DMA_TX_STATUS_UNKNOWN_2 BIT(2) + #define DMA_TX_STATUS_UNKNOWN_3 BIT(3) // busy? + ++#define INPUT_HEADER_VERSION(x) ((x) & 0xf) ++#define INPUT_HEADER_REPORT_LENGTH(x) (((x) >> 8) & 0x3fff) ++#define INPUT_HEADER_SYNC(x) ((x) >> 24) ++#define INPUT_HEADER_VERSION_VALUE 3 ++#define INPUT_HEADER_SYNC_VALUE 0x5a ++ ++#define QUICKSPI_CONFIG1_UNKNOWN_0(x) (((x) & 0x1f) << 0) ++#define QUICKSPI_CONFIG1_UNKNOWN_5(x) (((x) & 0x1f) << 5) ++#define QUICKSPI_CONFIG1_UNKNOWN_10(x) (((x) & 0x1f) << 10) ++#define QUICKSPI_CONFIG1_UNKNOWN_16(x) (((x) & 0xffff) << 16) ++ ++#define QUICKSPI_CONFIG2_UNKNOWN_0(x) (((x) & 0x1f) << 0) ++#define QUICKSPI_CONFIG2_UNKNOWN_5(x) (((x) & 0x1f) << 5) ++#define QUICKSPI_CONFIG2_UNKNOWN_12(x) (((x) & 0xf) << 12) ++#define QUICKSPI_CONFIG2_UNKNOWN_16 BIT(16) ++#define QUICKSPI_CONFIG2_UNKNOWN_17 BIT(17) ++#define QUICKSPI_CONFIG2_DISABLE_READ_ADDRESS_INCREMENT BIT(24) ++#define QUICKSPI_CONFIG2_DISABLE_WRITE_ADDRESS_INCREMENT BIT(25) ++#define QUICKSPI_CONFIG2_ENABLE_WRITE_STREAMING_MODE BIT(27) ++#define QUICKSPI_CONFIG2_IRQ_POLARITY BIT(28) ++ + #define DMA_RX_CONTROL_ENABLE BIT(0) + #define DMA_RX_CONTROL_IRQ_UNKNOWN_1 BIT(1) // rx1 only? + #define DMA_RX_CONTROL_IRQ_ERROR BIT(3) // rx1 only? +-#define DMA_RX_CONTROL_IRQ_UNKNOWN_4 BIT(4) // rx0 only? ++#define DMA_RX_CONTROL_IRQ_READY BIT(4) // rx0 only + #define DMA_RX_CONTROL_IRQ_DATA BIT(5) + ++#define DMA_RX_CONTROL2_UNKNOWN_4 BIT(4) // rx1 only? + #define DMA_RX_CONTROL2_UNKNOWN_5 BIT(5) // rx0 only? + #define DMA_RX_CONTROL2_RESET BIT(7) // resets ringbuffer indices + + #define DMA_RX_WRAP_FLAG BIT(7) + + #define DMA_RX_STATUS_ERROR BIT(3) +-#define DMA_RX_STATUS_UNKNOWN_4 BIT(4) // set in rx0 after using CONTROL_NRESET when it becomes possible to read config (can take >100ms) ++#define DMA_RX_STATUS_READY BIT(4) // set in rx0 after using CONTROL_NRESET when it becomes possible to read config (can take >100ms) + #define DMA_RX_STATUS_HAVE_DATA BIT(5) + #define DMA_RX_STATUS_ENABLED BIT(8) + ++#define INIT_UNKNOWN_GUC_2 BIT(2) ++#define INIT_UNKNOWN_3 BIT(3) ++#define INIT_UNKNOWN_GUC_4 BIT(4) ++#define INIT_UNKNOWN_5 BIT(5) ++#define INIT_UNKNOWN_31 BIT(31) ++ + // COUNTER_RESET can be written to counter registers to reset them to zero. However, in some cases this can mess up the THC. + #define COUNTER_RESET BIT(31) + + struct ithc_registers { +- /* 0000 */ u32 _unknown_0000[1024]; ++ /* 0000 */ u32 _unknown_0000[5]; ++ /* 0014 */ u32 ltr_config; ++ /* 0018 */ u32 _unknown_0018[1018]; + /* 1000 */ u32 _unknown_1000; + /* 1004 */ u32 _unknown_1004; + /* 1008 */ u32 control_bits; + /* 100c */ u32 _unknown_100c; + /* 1010 */ u32 spi_config; +- /* 1014 */ u32 _unknown_1014[3]; ++ /* 1014 */ u8 read_opcode; // maybe for header? ++ /* 1015 */ u8 read_opcode_quad; ++ /* 1016 */ u8 read_opcode_dual; ++ /* 1017 */ u8 read_opcode_single; ++ /* 1018 */ u8 write_opcode; // not used? ++ /* 1019 */ u8 write_opcode_quad; ++ /* 101a */ u8 write_opcode_dual; ++ /* 101b */ u8 write_opcode_single; ++ /* 101c */ u32 _unknown_101c; + /* 1020 */ u32 error_control; + /* 1024 */ u32 error_status; // write to clear + /* 1028 */ u32 error_flags; // write to clear +@@ -100,12 +158,19 @@ struct ithc_registers { + /* 109a */ u8 _unknown_109a; + /* 109b */ u8 num_prds; + /* 109c */ u32 status; // write to clear ++ /* 10a0 */ u32 _unknown_10a0[5]; ++ /* 10b4 */ u32 spi_addr; + } dma_tx; +- /* 10a0 */ u32 _unknown_10a0[7]; +- /* 10bc */ u32 state; // is 0xe0000402 (dev config val 0) after CONTROL_NRESET, 0xe0000461 after first touch, 0xe0000401 after DMA_RX_CODE_RESET ++ /* 10b8 */ u32 spi_header_addr; ++ union { ++ /* 10bc */ u32 irq_cause; // in legacy THC mode ++ /* 10bc */ u32 input_header; // in QuickSPI mode (see HIDSPI spec) ++ }; + /* 10c0 */ u32 _unknown_10c0[8]; + /* 10e0 */ u32 _unknown_10e0_counters[3]; +- /* 10ec */ u32 _unknown_10ec[5]; ++ /* 10ec */ u32 quickspi_config1; ++ /* 10f0 */ u32 quickspi_config2; ++ /* 10f4 */ u32 _unknown_10f4[3]; + struct { + /* 1100/1200 */ u64 addr; // cannot be written with writeq(), must use lo_hi_writeq() + /* 1108/1208 */ u8 num_bufs; +@@ -120,70 +185,30 @@ struct ithc_registers { + /* 1118/1218 */ u64 _unknown_1118_guc_addr; + /* 1120/1220 */ u32 _unknown_1120_guc; + /* 1124/1224 */ u32 _unknown_1124_guc; +- /* 1128/1228 */ u32 unknown_init_bits; // bit 2 = guc related, bit 3 = rx1 related, bit 4 = guc related ++ /* 1128/1228 */ u32 init_unknown; + /* 112c/122c */ u32 _unknown_112c; + /* 1130/1230 */ u64 _unknown_1130_guc_addr; + /* 1138/1238 */ u32 _unknown_1138_guc; + /* 113c/123c */ u32 _unknown_113c; + /* 1140/1240 */ u32 _unknown_1140_guc; +- /* 1144/1244 */ u32 _unknown_1144[23]; ++ /* 1144/1244 */ u32 _unknown_1144[11]; ++ /* 1170/1270 */ u32 spi_addr; ++ /* 1174/1274 */ u32 _unknown_1174[11]; + /* 11a0/12a0 */ u32 _unknown_11a0_counters[6]; + /* 11b8/12b8 */ u32 _unknown_11b8[18]; + } dma_rx[2]; + }; + static_assert(sizeof(struct ithc_registers) == 0x1300); + +-#define DEVCFG_DMA_RX_SIZE(x) ((((x) & 0x3fff) + 1) << 6) +-#define DEVCFG_DMA_TX_SIZE(x) (((((x) >> 14) & 0x3ff) + 1) << 6) +- +-#define DEVCFG_TOUCH_MASK 0x3f +-#define DEVCFG_TOUCH_ENABLE BIT(0) +-#define DEVCFG_TOUCH_UNKNOWN_1 BIT(1) +-#define DEVCFG_TOUCH_UNKNOWN_2 BIT(2) +-#define DEVCFG_TOUCH_UNKNOWN_3 BIT(3) +-#define DEVCFG_TOUCH_UNKNOWN_4 BIT(4) +-#define DEVCFG_TOUCH_UNKNOWN_5 BIT(5) +-#define DEVCFG_TOUCH_UNKNOWN_6 BIT(6) +- +-#define DEVCFG_DEVICE_ID_TIC 0x43495424 // "$TIC" +- +-#define DEVCFG_SPI_MAX_FREQ(x) (((x) >> 1) & 0xf) // high bit = use high speed mode? +-#define DEVCFG_SPI_MODE(x) (((x) >> 6) & 3) +-#define DEVCFG_SPI_UNKNOWN_8(x) (((x) >> 8) & 0x3f) +-#define DEVCFG_SPI_NEEDS_HEARTBEAT BIT(20) // TODO implement heartbeat +-#define DEVCFG_SPI_HEARTBEAT_INTERVAL(x) (((x) >> 21) & 7) +-#define DEVCFG_SPI_UNKNOWN_25 BIT(25) +-#define DEVCFG_SPI_UNKNOWN_26 BIT(26) +-#define DEVCFG_SPI_UNKNOWN_27 BIT(27) +-#define DEVCFG_SPI_DELAY(x) (((x) >> 28) & 7) // TODO use this +-#define DEVCFG_SPI_USE_EXT_READ_CFG BIT(31) // TODO use this? +- +-struct ithc_device_config { // (Example values are from an SP7+.) +- u32 _unknown_00; // 00 = 0xe0000402 (0xe0000401 after DMA_RX_CODE_RESET) +- u32 _unknown_04; // 04 = 0x00000000 +- u32 dma_buf_sizes; // 08 = 0x000a00ff +- u32 touch_cfg; // 0c = 0x0000001c +- u32 _unknown_10; // 10 = 0x0000001c +- u32 device_id; // 14 = 0x43495424 = "$TIC" +- u32 spi_config; // 18 = 0xfda00a2e +- u16 vendor_id; // 1c = 0x045e = Microsoft Corp. +- u16 product_id; // 1e = 0x0c1a +- u32 revision; // 20 = 0x00000001 +- u32 fw_version; // 24 = 0x05008a8b = 5.0.138.139 (this value looks more random on newer devices) +- u32 _unknown_28; // 28 = 0x00000000 +- u32 fw_mode; // 2c = 0x00000000 (for fw update?) +- u32 _unknown_30; // 30 = 0x00000000 +- u32 _unknown_34; // 34 = 0x0404035e (u8,u8,u8,u8 = version?) +- u32 _unknown_38; // 38 = 0x000001c0 (0x000001c1 after DMA_RX_CODE_RESET) +- u32 _unknown_3c; // 3c = 0x00000002 +-}; +- + void bitsl(__iomem u32 *reg, u32 mask, u32 val); + void bitsb(__iomem u8 *reg, u8 mask, u8 val); + #define bitsl_set(reg, x) bitsl(reg, x, x) + #define bitsb_set(reg, x) bitsb(reg, x, x) + int waitl(struct ithc *ithc, __iomem u32 *reg, u32 mask, u32 val); + int waitb(struct ithc *ithc, __iomem u8 *reg, u8 mask, u8 val); +-int ithc_set_spi_config(struct ithc *ithc, u8 speed, u8 mode); ++ ++void ithc_set_ltr_config(struct ithc *ithc, u64 active_ltr_ns, u64 idle_ltr_ns); ++void ithc_set_ltr_idle(struct ithc *ithc); ++int ithc_set_spi_config(struct ithc *ithc, u8 clkdiv, bool clkdiv8, u8 read_mode, u8 write_mode); + int ithc_spi_command(struct ithc *ithc, u8 command, u32 offset, u32 size, void *data); + +diff --git a/drivers/hid/ithc/ithc.h b/drivers/hid/ithc/ithc.h +index 028e55a4ec53e..e90c380444325 100644 +--- a/drivers/hid/ithc/ithc.h ++++ b/drivers/hid/ithc/ithc.h +@@ -1,20 +1,19 @@ + /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ + +-#include +-#include +-#include ++#include ++#include ++#include + #include ++#include + #include +-#include ++#include + #include + #include +-#include + #include + #include +-#include ++#include ++#include + #include +-#include +-#include + + #define DEVNAME "ithc" + #define DEVFULLNAME "Intel Touch Host Controller" +@@ -27,10 +26,37 @@ + + #define NUM_RX_BUF 16 + ++// PCI device IDs: ++// Lakefield ++#define PCI_DEVICE_ID_INTEL_THC_LKF_PORT1 0x98d0 ++#define PCI_DEVICE_ID_INTEL_THC_LKF_PORT2 0x98d1 ++// Tiger Lake ++#define PCI_DEVICE_ID_INTEL_THC_TGL_LP_PORT1 0xa0d0 ++#define PCI_DEVICE_ID_INTEL_THC_TGL_LP_PORT2 0xa0d1 ++#define PCI_DEVICE_ID_INTEL_THC_TGL_H_PORT1 0x43d0 ++#define PCI_DEVICE_ID_INTEL_THC_TGL_H_PORT2 0x43d1 ++// Alder Lake ++#define PCI_DEVICE_ID_INTEL_THC_ADL_S_PORT1 0x7ad8 ++#define PCI_DEVICE_ID_INTEL_THC_ADL_S_PORT2 0x7ad9 ++#define PCI_DEVICE_ID_INTEL_THC_ADL_P_PORT1 0x51d0 ++#define PCI_DEVICE_ID_INTEL_THC_ADL_P_PORT2 0x51d1 ++#define PCI_DEVICE_ID_INTEL_THC_ADL_M_PORT1 0x54d0 ++#define PCI_DEVICE_ID_INTEL_THC_ADL_M_PORT2 0x54d1 ++// Raptor Lake ++#define PCI_DEVICE_ID_INTEL_THC_RPL_S_PORT1 0x7a58 ++#define PCI_DEVICE_ID_INTEL_THC_RPL_S_PORT2 0x7a59 ++// Meteor Lake ++#define PCI_DEVICE_ID_INTEL_THC_MTL_PORT1 0x7e48 ++#define PCI_DEVICE_ID_INTEL_THC_MTL_PORT2 0x7e4a ++ + struct ithc; + + #include "ithc-regs.h" ++#include "ithc-hid.h" + #include "ithc-dma.h" ++#include "ithc-legacy.h" ++#include "ithc-quickspi.h" ++#include "ithc-debug.h" + + struct ithc { + char phys[32]; +@@ -38,30 +64,21 @@ struct ithc { + int irq; + struct task_struct *poll_thread; + +- struct pm_qos_request activity_qos; +- struct hrtimer activity_start_timer; +- struct hrtimer activity_end_timer; +- ktime_t last_rx_time; +- unsigned int cur_rx_seq_count; +- unsigned int cur_rx_seq_errors; +- +- struct hid_device *hid; +- bool hid_parse_done; +- wait_queue_head_t wait_hid_parse; +- wait_queue_head_t wait_hid_get_feature; +- struct mutex hid_get_feature_mutex; +- void *hid_get_feature_buf; +- size_t hid_get_feature_size; +- + struct ithc_registers __iomem *regs; + struct ithc_registers *prev_regs; // for debugging +- struct ithc_device_config config; + struct ithc_dma_rx dma_rx[2]; + struct ithc_dma_tx dma_tx; ++ struct ithc_hid hid; ++ ++ bool use_quickspi; ++ bool have_config; ++ u16 vendor_id; ++ u16 product_id; ++ u32 product_rev; ++ u32 max_rx_size; ++ u32 max_tx_size; ++ u32 legacy_touch_cfg; + }; + + int ithc_reset(struct ithc *ithc); +-void ithc_set_active(struct ithc *ithc, unsigned int duration_us); +-int ithc_debug_init(struct ithc *ithc); +-void ithc_log_regs(struct ithc *ithc); + +-- +2.45.1 + +From b4563a0da733d5759de36d9e555ce81324dca286 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 9 May 2024 16:15:49 +0200 +Subject: [PATCH] serial: Clear UPF_DEAD before calling + tty_port_register_device_attr_serdev() + +If a serdev_device_driver is already loaded for a serdev_tty_port when it +gets registered by tty_port_register_device_attr_serdev() then that +driver's probe() method will be called immediately. + +The serdev_device_driver's probe() method should then be able to call +serdev_device_open() successfully, but because UPF_DEAD is still dead +serdev_device_open() will fail with -ENXIO in this scenario: + + serdev_device_open() + ctrl->ops->open() /* this callback being ttyport_open() */ + tty->ops->open() /* this callback being uart_open() */ + tty_port_open() + port->ops->activate() /* this callback being uart_port_activate() */ + Find bit UPF_DEAD is set in uport->flags and fail with errno -ENXIO. + +Fix this be clearing UPF_DEAD before tty_port_register_device_attr_serdev() +note this only moves up the UPD_DEAD clearing a small bit, before: + + tty_port_register_device_attr_serdev(); + mutex_unlock(&tty_port.mutex); + uart_port.flags &= ~UPF_DEAD; + mutex_unlock(&port_mutex); + +after: + + uart_port.flags &= ~UPF_DEAD; + tty_port_register_device_attr_serdev(); + mutex_unlock(&tty_port.mutex); + mutex_unlock(&port_mutex); + +Reported-by: Weifeng Liu +Closes: https://lore.kernel.org/platform-driver-x86/20240505130800.2546640-1-weifeng.liu.z@gmail.com/ +Tested-by: Weifeng Liu +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20240509141549.63704-1-hdegoede@redhat.com +Signed-off-by: Greg Kroah-Hartman +Patchset: surface-sam +--- + drivers/tty/serial/serial_core.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c +index c476d884356db..b47a277978a0b 100644 +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -3211,6 +3211,9 @@ static int serial_core_add_one_port(struct uart_driver *drv, struct uart_port *u + if (uport->attr_group) + uport->tty_groups[1] = uport->attr_group; + ++ /* Ensure serdev drivers can call serdev_device_open() right away */ ++ uport->flags &= ~UPF_DEAD; ++ + /* + * Register the port whether it's detected or not. This allows + * setserial to be used to alter this port's parameters. +@@ -3221,6 +3224,7 @@ static int serial_core_add_one_port(struct uart_driver *drv, struct uart_port *u + if (!IS_ERR(tty_dev)) { + device_set_wakeup_capable(tty_dev, 1); + } else { ++ uport->flags |= UPF_DEAD; + dev_err(uport->dev, "Cannot register tty device on line %d\n", + uport->line); + } +@@ -3426,8 +3430,6 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port) + if (ret) + goto err_unregister_port_dev; + +- port->flags &= ~UPF_DEAD; +- + mutex_unlock(&port_mutex); + + return 0; +-- +2.45.1 + +From 0864ded554efe90dd9603b61e82c604481ee5125 Mon Sep 17 00:00:00 2001 +From: Weifeng Liu +Date: Sun, 5 May 2024 21:07:50 +0800 +Subject: [PATCH] platform/surface: aggregator: Log critical errors during SAM + probing + +Emits messages upon errors during probing of SAM. Hopefully this could +provide useful context to user for the purpose of diagnosis when +something miserable happen. + +Reviewed-by: Maximilian Luz +Reviewed-by: Andy Shevchenko +Signed-off-by: Weifeng Liu +Link: https://lore.kernel.org/r/20240505130800.2546640-3-weifeng.liu.z@gmail.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Patchset: surface-sam +--- + drivers/platform/surface/aggregator/core.c | 42 ++++++++++++++-------- + 1 file changed, 28 insertions(+), 14 deletions(-) + +diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c +index ba550eaa06fcf..797d0645bd77f 100644 +--- a/drivers/platform/surface/aggregator/core.c ++++ b/drivers/platform/surface/aggregator/core.c +@@ -618,15 +618,17 @@ static const struct acpi_gpio_mapping ssam_acpi_gpios[] = { + + static int ssam_serial_hub_probe(struct serdev_device *serdev) + { +- struct acpi_device *ssh = ACPI_COMPANION(&serdev->dev); ++ struct device *dev = &serdev->dev; ++ struct acpi_device *ssh = ACPI_COMPANION(dev); + struct ssam_controller *ctrl; + acpi_status astatus; + int status; + +- if (gpiod_count(&serdev->dev, NULL) < 0) +- return -ENODEV; ++ status = gpiod_count(dev, NULL); ++ if (status < 0) ++ return dev_err_probe(dev, status, "no GPIO found\n"); + +- status = devm_acpi_dev_add_driver_gpios(&serdev->dev, ssam_acpi_gpios); ++ status = devm_acpi_dev_add_driver_gpios(dev, ssam_acpi_gpios); + if (status) + return status; + +@@ -637,8 +639,10 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev) + + /* Initialize controller. */ + status = ssam_controller_init(ctrl, serdev); +- if (status) ++ if (status) { ++ dev_err_probe(dev, status, "failed to initialize ssam controller\n"); + goto err_ctrl_init; ++ } + + ssam_controller_lock(ctrl); + +@@ -646,12 +650,14 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev) + serdev_device_set_drvdata(serdev, ctrl); + serdev_device_set_client_ops(serdev, &ssam_serdev_ops); + status = serdev_device_open(serdev); +- if (status) ++ if (status) { ++ dev_err_probe(dev, status, "failed to open serdev device\n"); + goto err_devopen; ++ } + + astatus = ssam_serdev_setup_via_acpi(ssh->handle, serdev); + if (ACPI_FAILURE(astatus)) { +- status = -ENXIO; ++ status = dev_err_probe(dev, -ENXIO, "failed to setup serdev\n"); + goto err_devinit; + } + +@@ -667,25 +673,33 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev) + * states. + */ + status = ssam_log_firmware_version(ctrl); +- if (status) ++ if (status) { ++ dev_err_probe(dev, status, "failed to get firmware version\n"); + goto err_initrq; ++ } + + status = ssam_ctrl_notif_d0_entry(ctrl); +- if (status) ++ if (status) { ++ dev_err_probe(dev, status, "D0-entry notification failed\n"); + goto err_initrq; ++ } + + status = ssam_ctrl_notif_display_on(ctrl); +- if (status) ++ if (status) { ++ dev_err_probe(dev, status, "display-on notification failed\n"); + goto err_initrq; ++ } + +- status = sysfs_create_group(&serdev->dev.kobj, &ssam_sam_group); ++ status = sysfs_create_group(&dev->kobj, &ssam_sam_group); + if (status) + goto err_initrq; + + /* Set up IRQ. */ + status = ssam_irq_setup(ctrl); +- if (status) ++ if (status) { ++ dev_err_probe(dev, status, "failed to setup IRQ\n"); + goto err_irq; ++ } + + /* Finally, set main controller reference. */ + status = ssam_try_set_controller(ctrl); +@@ -702,7 +716,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev) + * resumed. In short, this causes some spurious unwanted wake-ups. + * For now let's thus default power/wakeup to false. + */ +- device_set_wakeup_capable(&serdev->dev, true); ++ device_set_wakeup_capable(dev, true); + acpi_dev_clear_dependencies(ssh); + + return 0; +@@ -710,7 +724,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev) + err_mainref: + ssam_irq_free(ctrl); + err_irq: +- sysfs_remove_group(&serdev->dev.kobj, &ssam_sam_group); ++ sysfs_remove_group(&dev->kobj, &ssam_sam_group); + err_initrq: + ssam_controller_lock(ctrl); + ssam_controller_shutdown(ctrl); +-- +2.45.1 + +From d44985653441ba783a830bd5efde2fcf3a3ea271 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Fri, 19 Apr 2024 20:41:47 +0200 +Subject: [PATCH] platform/surface: aggregator: Fix warning when controller is + destroyed in probe + +There is a small window in ssam_serial_hub_probe() where the controller +is initialized but has not been started yet. Specifically, between +ssam_controller_init() and ssam_controller_start(). Any failure in this +window, for example caused by a failure of serdev_device_open(), +currently results in an incorrect warning being emitted. + +In particular, any failure in this window results in the controller +being destroyed via ssam_controller_destroy(). This function checks the +state of the controller and, in an attempt to validate that the +controller has been cleanly shut down before we try and deallocate any +resources, emits a warning if that state is not SSAM_CONTROLLER_STOPPED. + +However, since we have only just initialized the controller and have not +yet started it, its state is SSAM_CONTROLLER_INITIALIZED. Note that this +is the only point at which the controller has this state, as it will +change after we start the controller with ssam_controller_start() and +never revert back. Further, at this point no communication has taken +place and the sender and receiver threads have not been started yet (and +we may not even have an open serdev device either). + +Therefore, it is perfectly safe to call ssam_controller_destroy() with a +state of SSAM_CONTROLLER_INITIALIZED. This, however, means that the +warning currently being emitted is incorrect. Fix it by extending the +check. + +Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/aggregator/controller.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c +index 7fc602e01487d..7e89f547999b2 100644 +--- a/drivers/platform/surface/aggregator/controller.c ++++ b/drivers/platform/surface/aggregator/controller.c +@@ -1354,7 +1354,8 @@ void ssam_controller_destroy(struct ssam_controller *ctrl) + if (ctrl->state == SSAM_CONTROLLER_UNINITIALIZED) + return; + +- WARN_ON(ctrl->state != SSAM_CONTROLLER_STOPPED); ++ WARN_ON(ctrl->state != SSAM_CONTROLLER_STOPPED && ++ ctrl->state != SSAM_CONTROLLER_INITIALIZED); + + /* + * Note: New events could still have been received after the previous +-- +2.45.1 + +From 6b6f860bbef0ba3f10f8dc151ac4e27d0a34c223 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sun, 22 Oct 2023 14:57:11 +0200 +Subject: [PATCH] platform/surface: aggregator_registry: Add support for + Surface Laptop Go 3 + +Add SAM client device nodes for the Surface Laptop Go 3. It seems to use +the same SAM client devices as the Surface Laptop Go 1 and 2, so re-use +their node group. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/surface_aggregator_registry.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c +index 035d6b4105cd6..74688a2ed4b2e 100644 +--- a/drivers/platform/surface/surface_aggregator_registry.c ++++ b/drivers/platform/surface/surface_aggregator_registry.c +@@ -374,6 +374,9 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { + /* Surface Laptop Go 2 */ + { "MSHW0290", (unsigned long)ssam_node_group_slg1 }, + ++ /* Surface Laptop Go 3 */ ++ { "MSHW0440", (unsigned long)ssam_node_group_slg1 }, ++ + /* Surface Laptop Studio */ + { "MSHW0123", (unsigned long)ssam_node_group_sls }, + +-- +2.45.1 + +From 31b312c25822404e52a81de2525da5c7bae12864 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Mon, 20 Nov 2023 19:47:00 +0100 +Subject: [PATCH] platform/surface: aggregator_registry: Add support for + Surface Laptop Studio 2 + +Add SAM client device nodes for the Surface Laptop Studio 2 (SLS2). The +SLS2 is quite similar to the SLS1, but it does not provide the touchpad +as a SAM-HID device. Therefore, add a new node group for the SLS2 and +update the comments accordingly + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + .../surface/surface_aggregator_registry.c | 25 ++++++++++++++++--- + 1 file changed, 21 insertions(+), 4 deletions(-) + +diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c +index 74688a2ed4b2e..f02a933160ff2 100644 +--- a/drivers/platform/surface/surface_aggregator_registry.c ++++ b/drivers/platform/surface/surface_aggregator_registry.c +@@ -253,8 +253,8 @@ static const struct software_node *ssam_node_group_sl5[] = { + NULL, + }; + +-/* Devices for Surface Laptop Studio. */ +-static const struct software_node *ssam_node_group_sls[] = { ++/* Devices for Surface Laptop Studio 1. */ ++static const struct software_node *ssam_node_group_sls1[] = { + &ssam_node_root, + &ssam_node_bat_ac, + &ssam_node_bat_main, +@@ -269,6 +269,20 @@ static const struct software_node *ssam_node_group_sls[] = { + NULL, + }; + ++/* Devices for Surface Laptop Studio 2. */ ++static const struct software_node *ssam_node_group_sls2[] = { ++ &ssam_node_root, ++ &ssam_node_bat_ac, ++ &ssam_node_bat_main, ++ &ssam_node_tmp_pprof, ++ &ssam_node_pos_tablet_switch, ++ &ssam_node_hid_sam_keyboard, ++ &ssam_node_hid_sam_penstash, ++ &ssam_node_hid_sam_sensors, ++ &ssam_node_hid_sam_ucm_ucsi, ++ NULL, ++}; ++ + /* Devices for Surface Laptop Go. */ + static const struct software_node *ssam_node_group_slg1[] = { + &ssam_node_root, +@@ -377,8 +391,11 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { + /* Surface Laptop Go 3 */ + { "MSHW0440", (unsigned long)ssam_node_group_slg1 }, + +- /* Surface Laptop Studio */ +- { "MSHW0123", (unsigned long)ssam_node_group_sls }, ++ /* Surface Laptop Studio 1 */ ++ { "MSHW0123", (unsigned long)ssam_node_group_sls1 }, ++ ++ /* Surface Laptop Studio 2 */ ++ { "MSHW0360", (unsigned long)ssam_node_group_sls2 }, + + { }, + }; +-- +2.45.1 + +From 42f6d14bda5e69c2b5a8d27cfcbd063a5922f876 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sun, 9 Jun 2024 20:05:57 +0200 +Subject: [PATCH] platform/surface: aggregator_registry: Add support for + Surface Laptop 6 + +Add SAM client device nodes for the Surface Laptop Studio 6 (SL6). The +SL6 is similar to the SL5, with the typical battery/AC, platform +profile, and HID nodes. It also has support for the newly supported fan +interface. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + .../surface/surface_aggregator_registry.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c +index f02a933160ff2..34df1bdad83bd 100644 +--- a/drivers/platform/surface/surface_aggregator_registry.c ++++ b/drivers/platform/surface/surface_aggregator_registry.c +@@ -253,6 +253,22 @@ static const struct software_node *ssam_node_group_sl5[] = { + NULL, + }; + ++/* Devices for Surface Laptop 6. */ ++static const struct software_node *ssam_node_group_sl6[] = { ++ &ssam_node_root, ++ &ssam_node_bat_ac, ++ &ssam_node_bat_main, ++ &ssam_node_tmp_perf_profile_with_fan, ++ &ssam_node_tmp_sensors, ++ &ssam_node_fan_speed, ++ &ssam_node_hid_main_keyboard, ++ &ssam_node_hid_main_touchpad, ++ &ssam_node_hid_main_iid5, ++ &ssam_node_hid_sam_sensors, ++ &ssam_node_hid_sam_ucm_ucsi, ++ NULL, +}; -+MODULE_DEVICE_TABLE(ssam, ssam_fan_match); + -+static struct ssam_device_driver surface_fan = { -+ .probe = surface_fan_probe, -+ .match_table = ssam_fan_match, -+ .driver = { -+ .name = "surface_fan", -+ .probe_type = PROBE_PREFER_ASYNCHRONOUS, -+ }, -+}; -+module_ssam_device_driver(surface_fan); + /* Devices for Surface Laptop Studio 1. */ + static const struct software_node *ssam_node_group_sls1[] = { + &ssam_node_root, +@@ -382,6 +398,9 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { + /* Surface Laptop 5 */ + { "MSHW0350", (unsigned long)ssam_node_group_sl5 }, + ++ /* Surface Laptop 6 */ ++ { "MSHW0530", (unsigned long)ssam_node_group_sl5 }, + -+MODULE_AUTHOR("Ivor Wanders "); -+MODULE_DESCRIPTION("Fan Driver for Surface System Aggregator Module"); -+MODULE_LICENSE("GPL"); + /* Surface Laptop Go 1 */ + { "MSHW0118", (unsigned long)ssam_node_group_slg1 }, + -- -2.44.0 +2.45.1 -From 5c18bed9c7ad073b61e3c3686dc4bc1858f958dc Mon Sep 17 00:00:00 2001 +From 88fda328aea3bb7077cd39f854148276dcffcea3 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 30 Dec 2023 18:07:54 +0100 Subject: [PATCH] hwmon: Add thermal sensor driver for Surface Aggregator @@ -6071,10 +8742,10 @@ Patchset: surface-sam create mode 100644 drivers/hwmon/surface_temp.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index e762f6138970..41261b49f8be 100644 +index 83945397b6eb1..338ef73c96a3a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig -@@ -2007,6 +2007,16 @@ config SENSORS_SURFACE_FAN +@@ -2070,6 +2070,16 @@ config SENSORS_SURFACE_FAN Select M or Y here, if you want to be able to read the fan's speed. @@ -6092,10 +8763,10 @@ index e762f6138970..41261b49f8be 100644 tristate "Texas Instruments ADC128D818" depends on I2C diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile -index 30cc90f40844..6644fd4598a4 100644 +index 5c31808f6378d..de8bc99719e63 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile -@@ -202,6 +202,7 @@ obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o +@@ -208,6 +208,7 @@ obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o obj-$(CONFIG_SENSORS_SURFACE_FAN)+= surface_fan.o @@ -6105,7 +8776,7 @@ index 30cc90f40844..6644fd4598a4 100644 obj-$(CONFIG_SENSORS_TC74) += tc74.o diff --git a/drivers/hwmon/surface_temp.c b/drivers/hwmon/surface_temp.c new file mode 100644 -index 000000000000..48c3e826713f +index 0000000000000..48c3e826713f6 --- /dev/null +++ b/drivers/hwmon/surface_temp.c @@ -0,0 +1,165 @@ @@ -6275,9 +8946,9 @@ index 000000000000..48c3e826713f +MODULE_DESCRIPTION("Thermal sensor subsystem driver for Surface System Aggregator Module"); +MODULE_LICENSE("GPL"); -- -2.44.0 +2.45.1 -From 8b1e37ad9423a6fdf8a8b3bfb1e15aadefe136de Mon Sep 17 00:00:00 2001 +From 17f0ec6ef1bc95e152af3a9f2b05ea669c75d24a Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 30 Dec 2023 18:12:23 +0100 Subject: [PATCH] hwmon: surface_temp: Add support for sensor names @@ -6295,7 +8966,7 @@ Patchset: surface-sam 1 file changed, 96 insertions(+), 17 deletions(-) diff --git a/drivers/hwmon/surface_temp.c b/drivers/hwmon/surface_temp.c -index 48c3e826713f..4c08926139db 100644 +index 48c3e826713f6..4c08926139dbf 100644 --- a/drivers/hwmon/surface_temp.c +++ b/drivers/hwmon/surface_temp.c @@ -17,6 +17,27 @@ @@ -6470,9 +9141,9 @@ index 48c3e826713f..4c08926139db 100644 "surface_thermal", ssam_temp, &ssam_temp_hwmon_chip_info, NULL); -- -2.44.0 +2.45.1 -From 9b490a17f59518e59cf3c77c103bf5ddc52041a3 Mon Sep 17 00:00:00 2001 +From 54bfa02fe865b9f22d79b112a5244ce81e4961f1 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 30 Dec 2023 18:21:12 +0100 Subject: [PATCH] platform/surface: aggregator_registry: Add support for @@ -6488,7 +9159,7 @@ Patchset: surface-sam 1 file changed, 7 insertions(+) diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c -index f02a933160ff..67686042e009 100644 +index 34df1bdad83bd..c0bf0cadcd258 100644 --- a/drivers/platform/surface/surface_aggregator_registry.c +++ b/drivers/platform/surface/surface_aggregator_registry.c @@ -74,6 +74,12 @@ static const struct software_node ssam_node_tmp_pprof = { @@ -6504,7 +9175,7 @@ index f02a933160ff..67686042e009 100644 /* Fan speed function. */ static const struct software_node ssam_node_fan_speed = { .name = "ssam:01:05:01:01:01", -@@ -325,6 +331,7 @@ static const struct software_node *ssam_node_group_sp9[] = { +@@ -341,6 +347,7 @@ static const struct software_node *ssam_node_group_sp9[] = { &ssam_node_bat_ac, &ssam_node_bat_main, &ssam_node_tmp_pprof, @@ -6513,9 +9184,9 @@ index f02a933160ff..67686042e009 100644 &ssam_node_pos_tablet_switch, &ssam_node_hid_kip_keyboard, -- -2.44.0 +2.45.1 -From ec0b680c0ce36ef6bffd682e10589cf5d8d467ae Mon Sep 17 00:00:00 2001 +From 06c4b5ac6b6357227e45c53643729140d794b48d Mon Sep 17 00:00:00 2001 From: Ivor Wanders Date: Sat, 16 Dec 2023 15:56:39 -0500 Subject: [PATCH] platform/surface: platform_profile: add fan profile switching @@ -6532,7 +9203,7 @@ Patchset: surface-sam 2 files changed, 100 insertions(+), 24 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c -index 67686042e009..058b6654a91a 100644 +index c0bf0cadcd258..07a4c4e1120d3 100644 --- a/drivers/platform/surface/surface_aggregator_registry.c +++ b/drivers/platform/surface/surface_aggregator_registry.c @@ -68,8 +68,8 @@ static const struct software_node ssam_node_bat_sb3base = { @@ -6603,7 +9274,7 @@ index 67686042e009..058b6654a91a 100644 &ssam_node_hid_main_keyboard, &ssam_node_hid_main_touchpad, &ssam_node_hid_main_iid5, -@@ -264,7 +278,7 @@ static const struct software_node *ssam_node_group_sls1[] = { +@@ -280,7 +294,7 @@ static const struct software_node *ssam_node_group_sls1[] = { &ssam_node_root, &ssam_node_bat_ac, &ssam_node_bat_main, @@ -6612,7 +9283,7 @@ index 67686042e009..058b6654a91a 100644 &ssam_node_pos_tablet_switch, &ssam_node_hid_sam_keyboard, &ssam_node_hid_sam_penstash, -@@ -280,7 +294,7 @@ static const struct software_node *ssam_node_group_sls2[] = { +@@ -296,7 +310,7 @@ static const struct software_node *ssam_node_group_sls2[] = { &ssam_node_root, &ssam_node_bat_ac, &ssam_node_bat_main, @@ -6621,7 +9292,7 @@ index 67686042e009..058b6654a91a 100644 &ssam_node_pos_tablet_switch, &ssam_node_hid_sam_keyboard, &ssam_node_hid_sam_penstash, -@@ -294,7 +308,7 @@ static const struct software_node *ssam_node_group_slg1[] = { +@@ -310,7 +324,7 @@ static const struct software_node *ssam_node_group_slg1[] = { &ssam_node_root, &ssam_node_bat_ac, &ssam_node_bat_main, @@ -6630,7 +9301,7 @@ index 67686042e009..058b6654a91a 100644 NULL, }; -@@ -303,7 +317,7 @@ static const struct software_node *ssam_node_group_sp7[] = { +@@ -319,7 +333,7 @@ static const struct software_node *ssam_node_group_sp7[] = { &ssam_node_root, &ssam_node_bat_ac, &ssam_node_bat_main, @@ -6639,7 +9310,7 @@ index 67686042e009..058b6654a91a 100644 NULL, }; -@@ -313,7 +327,7 @@ static const struct software_node *ssam_node_group_sp8[] = { +@@ -329,7 +343,7 @@ static const struct software_node *ssam_node_group_sp8[] = { &ssam_node_hub_kip, &ssam_node_bat_ac, &ssam_node_bat_main, @@ -6648,7 +9319,7 @@ index 67686042e009..058b6654a91a 100644 &ssam_node_kip_tablet_switch, &ssam_node_hid_kip_keyboard, &ssam_node_hid_kip_penstash, -@@ -330,7 +344,7 @@ static const struct software_node *ssam_node_group_sp9[] = { +@@ -346,7 +360,7 @@ static const struct software_node *ssam_node_group_sp9[] = { &ssam_node_hub_kip, &ssam_node_bat_ac, &ssam_node_bat_main, @@ -6658,7 +9329,7 @@ index 67686042e009..058b6654a91a 100644 &ssam_node_fan_speed, &ssam_node_pos_tablet_switch, diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c -index a5a3941b3f43..e54d0a8f7daa 100644 +index a5a3941b3f43a..e54d0a8f7daa5 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -1,7 +1,7 @@ @@ -6840,9 +9511,9 @@ index a5a3941b3f43..e54d0a8f7daa 100644 set_bit(PLATFORM_PROFILE_BALANCED, tpd->handler.choices); set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices); -- -2.44.0 +2.45.1 -From 95b66fb97652988a7b4be5bb1deaa625e1bb3c3f Mon Sep 17 00:00:00 2001 +From bf55987e82f9ae913b51a6a269fc1a397930f049 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 25 Jul 2020 17:19:53 +0200 Subject: [PATCH] i2c: acpi: Implement RawBytes read access @@ -6899,7 +9570,7 @@ Patchset: surface-sam-over-hid 1 file changed, 35 insertions(+) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c -index d6037a328669..a290ebc77aea 100644 +index d6037a3286690..a290ebc77aea2 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -628,6 +628,28 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, @@ -6952,9 +9623,9 @@ index d6037a328669..a290ebc77aea 100644 dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n", accessor_type, client->addr); -- -2.44.0 +2.45.1 -From 2b86ac312b956799265cdd1411d305cd2dcaf6db Mon Sep 17 00:00:00 2001 +From ebfda7ad73dd90971be10e9d6f59c51c781accbb Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 13 Feb 2021 16:41:18 +0100 Subject: [PATCH] platform/surface: Add driver for Surface Book 1 dGPU switch @@ -6977,7 +9648,7 @@ Patchset: surface-sam-over-hid create mode 100644 drivers/platform/surface/surfacebook1_dgpu_switch.c diff --git a/drivers/platform/surface/Kconfig b/drivers/platform/surface/Kconfig -index b629e82af97c..68656e8f309e 100644 +index b629e82af97c0..68656e8f309ed 100644 --- a/drivers/platform/surface/Kconfig +++ b/drivers/platform/surface/Kconfig @@ -149,6 +149,13 @@ config SURFACE_AGGREGATOR_TABLET_SWITCH @@ -6995,7 +9666,7 @@ index b629e82af97c..68656e8f309e 100644 tristate "Surface DTX (Detachment System) Driver" depends on SURFACE_AGGREGATOR diff --git a/drivers/platform/surface/Makefile b/drivers/platform/surface/Makefile -index 53344330939b..7efcd0cdb532 100644 +index 53344330939bf..7efcd0cdb5329 100644 --- a/drivers/platform/surface/Makefile +++ b/drivers/platform/surface/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_SURFACE_AGGREGATOR_CDEV) += surface_aggregator_cdev.o @@ -7008,7 +9679,7 @@ index 53344330939b..7efcd0cdb532 100644 obj-$(CONFIG_SURFACE_HOTPLUG) += surface_hotplug.o diff --git a/drivers/platform/surface/surfacebook1_dgpu_switch.c b/drivers/platform/surface/surfacebook1_dgpu_switch.c new file mode 100644 -index 000000000000..8b816ed8f35c +index 0000000000000..8b816ed8f35c6 --- /dev/null +++ b/drivers/platform/surface/surfacebook1_dgpu_switch.c @@ -0,0 +1,162 @@ @@ -7175,9 +9846,9 @@ index 000000000000..8b816ed8f35c +MODULE_DESCRIPTION("Discrete GPU Power-Switch for Surface Book 1"); +MODULE_LICENSE("GPL"); -- -2.44.0 +2.45.1 -From 3584a6c1791dc9c9b9c3ee846621571cbfabe37e Mon Sep 17 00:00:00 2001 +From 1e315f586b0b2bc375b96bb538a3be4c0b09d1ea Mon Sep 17 00:00:00 2001 From: Sachi King Date: Tue, 5 Oct 2021 00:05:09 +1100 Subject: [PATCH] Input: soc_button_array - support AMD variant Surface devices @@ -7199,7 +9870,7 @@ Patchset: surface-button 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c -index f6d060377d18..b8603f74eb28 100644 +index f6d060377d189..b8603f74eb286 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -540,8 +540,8 @@ static const struct soc_device_data soc_device_MSHW0028 = { @@ -7217,689 +9888,116 @@ index f6d060377d18..b8603f74eb28 100644 static int soc_device_check_MSHW0040(struct device *dev) { acpi_handle handle = ACPI_HANDLE(dev); -- union acpi_object *result; -- u64 oem_platform_rev = 0; // valid revisions are nonzero -- -- // get OEM platform revision -- result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, -- MSHW0040_DSM_REVISION, -- MSHW0040_DSM_GET_OMPR, NULL, -- ACPI_TYPE_INTEGER); -- -- if (result) { -- oem_platform_rev = result->integer.value; -- ACPI_FREE(result); -- } -- -- /* -- * If the revision is zero here, the _DSM evaluation has failed. This -- * indicates that we have a Pro 4 or Book 1 and this driver should not -- * be used. -- */ -- if (oem_platform_rev == 0) -- return -ENODEV; -+ bool exists; - -- dev_dbg(dev, "OEM Platform Revision %llu\n", oem_platform_rev); -+ // check if OEM platform revision DSM call exists -+ exists = acpi_check_dsm(handle, &MSHW0040_DSM_UUID, -+ MSHW0040_DSM_REVISION, -+ BIT(MSHW0040_DSM_GET_OMPR)); - -- return 0; -+ return exists ? 0 : -ENODEV; - } - - /* --- -2.44.0 - -From c26bb1d0af0fe40be270d203d6aaeab28dd04a10 Mon Sep 17 00:00:00 2001 -From: Sachi King -Date: Tue, 5 Oct 2021 00:22:57 +1100 -Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd - variant - -The AMD variant of the Surface Laptop report 0 for their OEM platform -revision. The Surface devices that require the surfacepro3_button -driver do not have the _DSM that gets the OEM platform revision. If the -method does not exist, load surfacepro3_button. - -Fixes: 64dd243d7356 ("platform/x86: surfacepro3_button: Fix device check") -Co-developed-by: Maximilian Luz - -Signed-off-by: Sachi King -Patchset: surface-button ---- - drivers/platform/surface/surfacepro3_button.c | 30 ++++--------------- - 1 file changed, 6 insertions(+), 24 deletions(-) - -diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c -index 2755601f979c..4240c98ca226 100644 ---- a/drivers/platform/surface/surfacepro3_button.c -+++ b/drivers/platform/surface/surfacepro3_button.c -@@ -149,7 +149,8 @@ static int surface_button_resume(struct device *dev) - /* - * Surface Pro 4 and Surface Book 2 / Surface Pro 2017 use the same device - * ID (MSHW0040) for the power/volume buttons. Make sure this is the right -- * device by checking for the _DSM method and OEM Platform Revision. -+ * device by checking for the _DSM method and OEM Platform Revision DSM -+ * function. - * - * Returns true if the driver should bind to this device, i.e. the device is - * either MSWH0028 (Pro 3) or MSHW0040 on a Pro 4 or Book 1. -@@ -157,30 +158,11 @@ static int surface_button_resume(struct device *dev) - static bool surface_button_check_MSHW0040(struct acpi_device *dev) - { - acpi_handle handle = dev->handle; -- union acpi_object *result; -- u64 oem_platform_rev = 0; // valid revisions are nonzero -- -- // get OEM platform revision -- result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, -- MSHW0040_DSM_REVISION, -- MSHW0040_DSM_GET_OMPR, -- NULL, ACPI_TYPE_INTEGER); -- -- /* -- * If evaluating the _DSM fails, the method is not present. This means -- * that we have either MSHW0028 or MSHW0040 on Pro 4 or Book 1, so we -- * should use this driver. We use revision 0 indicating it is -- * unavailable. -- */ -- -- if (result) { -- oem_platform_rev = result->integer.value; -- ACPI_FREE(result); -- } -- -- dev_dbg(&dev->dev, "OEM Platform Revision %llu\n", oem_platform_rev); - -- return oem_platform_rev == 0; -+ // make sure that OEM platform revision DSM call does not exist -+ return !acpi_check_dsm(handle, &MSHW0040_DSM_UUID, -+ MSHW0040_DSM_REVISION, -+ BIT(MSHW0040_DSM_GET_OMPR)); - } - - --- -2.44.0 - -From b3fac417611f5bb4ae2a9bc9e828dacfe4418fbf Mon Sep 17 00:00:00 2001 -From: Maximilian Luz -Date: Sat, 18 Feb 2023 01:02:49 +0100 -Subject: [PATCH] USB: quirks: Add USB_QUIRK_DELAY_INIT for Surface Go 3 - Type-Cover - -The touchpad on the Type-Cover of the Surface Go 3 is sometimes not -being initialized properly. Apply USB_QUIRK_DELAY_INIT to fix this -issue. - -More specifically, the device in question is a fairly standard modern -touchpad with pointer and touchpad input modes. During setup, the device -needs to be switched from pointer- to touchpad-mode (which is done in -hid-multitouch) to fully utilize it as intended. Unfortunately, however, -this seems to occasionally fail silently, leaving the device in -pointer-mode. Applying USB_QUIRK_DELAY_INIT seems to fix this. - -Link: https://github.com/linux-surface/linux-surface/issues/1059 -Signed-off-by: Maximilian Luz -Patchset: surface-typecover ---- - drivers/usb/core/quirks.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index b4783574b8e6..360970620589 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -223,6 +223,9 @@ static const struct usb_device_id usb_quirk_list[] = { - /* Microsoft Surface Dock Ethernet (RTL8153 GigE) */ - { USB_DEVICE(0x045e, 0x07c6), .driver_info = USB_QUIRK_NO_LPM }, - -+ /* Microsoft Surface Go 3 Type-Cover */ -+ { USB_DEVICE(0x045e, 0x09b5), .driver_info = USB_QUIRK_DELAY_INIT }, -+ - /* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */ - { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, - --- -2.44.0 - -From bf5167d418b660e321368222505a97d9f1ed68b4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= -Date: Thu, 5 Nov 2020 13:09:45 +0100 -Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when - suspending - -The Type Cover for Microsoft Surface devices supports a special usb -control request to disable or enable the built-in keyboard backlight. -On Windows, this request happens when putting the device into suspend or -resuming it, without it the backlight of the Type Cover will remain -enabled for some time even though the computer is suspended, which looks -weird to the user. - -So add support for this special usb control request to hid-multitouch, -which is the driver that's handling the Type Cover. - -The reason we have to use a pm_notifier for this instead of the usual -suspend/resume methods is that those won't get called in case the usb -device is already autosuspended. - -Also, if the device is autosuspended, we have to briefly autoresume it -in order to send the request. Doing that should be fine, the usb-core -driver does something similar during suspend inside choose_wakeup(). - -To make sure we don't send that request to every device but only to -devices which support it, add a new quirk -MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER to hid-multitouch. For now this quirk -is only enabled for the usb id of the Surface Pro 2017 Type Cover, which -is where I confirmed that it's working. - -Patchset: surface-typecover ---- - drivers/hid/hid-multitouch.c | 100 ++++++++++++++++++++++++++++++++++- - 1 file changed, 98 insertions(+), 2 deletions(-) - -diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c -index 3e91e4d6ba6f..45b7884c97f0 100644 ---- a/drivers/hid/hid-multitouch.c -+++ b/drivers/hid/hid-multitouch.c -@@ -34,7 +34,10 @@ - #include - #include - #include -+#include - #include -+#include -+#include - #include - #include - #include -@@ -47,6 +50,7 @@ MODULE_DESCRIPTION("HID multitouch panels"); - MODULE_LICENSE("GPL"); - - #include "hid-ids.h" -+#include "usbhid/usbhid.h" - - /* quirks to control the device */ - #define MT_QUIRK_NOT_SEEN_MEANS_UP BIT(0) -@@ -72,12 +76,15 @@ MODULE_LICENSE("GPL"); - #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20) - #define MT_QUIRK_DISABLE_WAKEUP BIT(21) - #define MT_QUIRK_ORIENTATION_INVERT BIT(22) -+#define MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT BIT(23) - - #define MT_INPUTMODE_TOUCHSCREEN 0x02 - #define MT_INPUTMODE_TOUCHPAD 0x03 - - #define MT_BUTTONTYPE_CLICKPAD 0 - -+#define MS_TYPE_COVER_FEATURE_REPORT_USAGE 0xff050086 -+ - enum latency_mode { - HID_LATENCY_NORMAL = 0, - HID_LATENCY_HIGH = 1, -@@ -169,6 +176,8 @@ struct mt_device { - - struct list_head applications; - struct list_head reports; -+ -+ struct notifier_block pm_notifier; - }; - - static void mt_post_parse_default_settings(struct mt_device *td, -@@ -213,6 +222,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app); - #define MT_CLS_GOOGLE 0x0111 - #define MT_CLS_RAZER_BLADE_STEALTH 0x0112 - #define MT_CLS_SMART_TECH 0x0113 -+#define MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER 0x0114 - - #define MT_DEFAULT_MAXCONTACT 10 - #define MT_MAX_MAXCONTACT 250 -@@ -397,6 +407,16 @@ static const struct mt_class mt_classes[] = { - MT_QUIRK_CONTACT_CNT_ACCURATE | - MT_QUIRK_SEPARATE_APP_REPORT, - }, -+ { .name = MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER, -+ .quirks = MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT | -+ MT_QUIRK_ALWAYS_VALID | -+ MT_QUIRK_IGNORE_DUPLICATES | -+ MT_QUIRK_HOVERING | -+ MT_QUIRK_CONTACT_CNT_ACCURATE | -+ MT_QUIRK_STICKY_FINGERS | -+ MT_QUIRK_WIN8_PTP_BUTTONS, -+ .export_all_inputs = true -+ }, - { } - }; - -@@ -1721,6 +1741,69 @@ static void mt_expired_timeout(struct timer_list *t) - clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); - } - -+static void get_type_cover_backlight_field(struct hid_device *hdev, -+ struct hid_field **field) -+{ -+ struct hid_report_enum *rep_enum; -+ struct hid_report *rep; -+ struct hid_field *cur_field; -+ int i, j; -+ -+ rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; -+ list_for_each_entry(rep, &rep_enum->report_list, list) { -+ for (i = 0; i < rep->maxfield; i++) { -+ cur_field = rep->field[i]; -+ -+ for (j = 0; j < cur_field->maxusage; j++) { -+ if (cur_field->usage[j].hid -+ == MS_TYPE_COVER_FEATURE_REPORT_USAGE) { -+ *field = cur_field; -+ return; -+ } -+ } -+ } -+ } -+} -+ -+static void update_keyboard_backlight(struct hid_device *hdev, bool enabled) -+{ -+ struct usb_device *udev = hid_to_usb_dev(hdev); -+ struct hid_field *field = NULL; -+ -+ /* Wake up the device in case it's already suspended */ -+ pm_runtime_get_sync(&udev->dev); -+ -+ get_type_cover_backlight_field(hdev, &field); -+ if (!field) { -+ hid_err(hdev, "couldn't find backlight field\n"); -+ goto out; -+ } -+ -+ field->value[field->index] = enabled ? 0x01ff00ff : 0x00ff00ff; -+ hid_hw_request(hdev, field->report, HID_REQ_SET_REPORT); -+ -+out: -+ pm_runtime_put_sync(&udev->dev); -+} -+ -+static int mt_pm_notifier(struct notifier_block *notifier, -+ unsigned long pm_event, -+ void *unused) -+{ -+ struct mt_device *td = -+ container_of(notifier, struct mt_device, pm_notifier); -+ struct hid_device *hdev = td->hdev; -+ -+ if (td->mtclass.quirks & MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT) { -+ if (pm_event == PM_SUSPEND_PREPARE) -+ update_keyboard_backlight(hdev, 0); -+ else if (pm_event == PM_POST_SUSPEND) -+ update_keyboard_backlight(hdev, 1); -+ } -+ -+ return NOTIFY_DONE; -+} -+ - static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) - { - int ret, i; -@@ -1744,6 +1827,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) - td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN; - hid_set_drvdata(hdev, td); - -+ td->pm_notifier.notifier_call = mt_pm_notifier; -+ register_pm_notifier(&td->pm_notifier); -+ - INIT_LIST_HEAD(&td->applications); - INIT_LIST_HEAD(&td->reports); - -@@ -1782,15 +1868,19 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) - timer_setup(&td->release_timer, mt_expired_timeout, 0); - - ret = hid_parse(hdev); -- if (ret != 0) -+ if (ret != 0) { -+ unregister_pm_notifier(&td->pm_notifier); - return ret; -+ } - - if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) - mt_fix_const_fields(hdev, HID_DG_CONTACTID); - - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); -- if (ret) -+ if (ret) { -+ unregister_pm_notifier(&td->pm_notifier); - return ret; -+ } - - ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group); - if (ret) -@@ -1840,6 +1930,7 @@ static void mt_remove(struct hid_device *hdev) - { - struct mt_device *td = hid_get_drvdata(hdev); - -+ unregister_pm_notifier(&td->pm_notifier); - del_timer_sync(&td->release_timer); - - sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); -@@ -2230,6 +2321,11 @@ static const struct hid_device_id mt_devices[] = { - MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, - USB_DEVICE_ID_XIROKU_CSR2) }, - -+ /* Microsoft Surface type cover */ -+ { .driver_data = MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER, -+ HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, -+ USB_VENDOR_ID_MICROSOFT, 0x09c0) }, -+ - /* Google MT devices */ - { .driver_data = MT_CLS_GOOGLE, - HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE, --- -2.44.0 - -From dda4ca6e0248ae5acf3aaf78ee00e613f4e04bad Mon Sep 17 00:00:00 2001 -From: PJungkamp -Date: Fri, 25 Feb 2022 12:04:25 +0100 -Subject: [PATCH] hid/multitouch: Add support for surface pro type cover tablet - switch - -The Surface Pro Type Cover has several non standard HID usages in it's -hid report descriptor. -I noticed that, upon folding the typecover back, a vendor specific range -of 4 32 bit integer hid usages is transmitted. -Only the first byte of the message seems to convey reliable information -about the keyboard state. - -0x22 => Normal (keys enabled) -0x33 => Folded back (keys disabled) -0x53 => Rotated left/right side up (keys disabled) -0x13 => Cover closed (keys disabled) -0x43 => Folded back and Tablet upside down (keys disabled) -This list may not be exhaustive. - -The tablet mode switch will be disabled for a value of 0x22 and enabled -on any other value. - -Patchset: surface-typecover ---- - drivers/hid/hid-multitouch.c | 148 +++++++++++++++++++++++++++++------ - 1 file changed, 122 insertions(+), 26 deletions(-) - -diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c -index 45b7884c97f0..f8978b405aca 100644 ---- a/drivers/hid/hid-multitouch.c -+++ b/drivers/hid/hid-multitouch.c -@@ -77,6 +77,7 @@ MODULE_LICENSE("GPL"); - #define MT_QUIRK_DISABLE_WAKEUP BIT(21) - #define MT_QUIRK_ORIENTATION_INVERT BIT(22) - #define MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT BIT(23) -+#define MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH BIT(24) - - #define MT_INPUTMODE_TOUCHSCREEN 0x02 - #define MT_INPUTMODE_TOUCHPAD 0x03 -@@ -84,6 +85,8 @@ MODULE_LICENSE("GPL"); - #define MT_BUTTONTYPE_CLICKPAD 0 - - #define MS_TYPE_COVER_FEATURE_REPORT_USAGE 0xff050086 -+#define MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE 0xff050072 -+#define MS_TYPE_COVER_APPLICATION 0xff050050 - - enum latency_mode { - HID_LATENCY_NORMAL = 0, -@@ -409,6 +412,7 @@ static const struct mt_class mt_classes[] = { - }, - { .name = MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER, - .quirks = MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT | -+ MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH | - MT_QUIRK_ALWAYS_VALID | - MT_QUIRK_IGNORE_DUPLICATES | - MT_QUIRK_HOVERING | -@@ -1390,6 +1394,9 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, - field->application != HID_CP_CONSUMER_CONTROL && - field->application != HID_GD_WIRELESS_RADIO_CTLS && - field->application != HID_GD_SYSTEM_MULTIAXIS && -+ !(field->application == MS_TYPE_COVER_APPLICATION && -+ application->quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH && -+ usage->hid == MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE) && - !(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS && - application->quirks & MT_QUIRK_ASUS_CUSTOM_UP)) - return -1; -@@ -1417,6 +1424,21 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, - return 1; - } - -+ /* -+ * The Microsoft Surface Pro Typecover has a non-standard HID -+ * tablet mode switch on a vendor specific usage page with vendor -+ * specific usage. -+ */ -+ if (field->application == MS_TYPE_COVER_APPLICATION && -+ application->quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH && -+ usage->hid == MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE) { -+ usage->type = EV_SW; -+ usage->code = SW_TABLET_MODE; -+ *max = SW_MAX; -+ *bit = hi->input->swbit; -+ return 1; -+ } -+ - if (rdata->is_mt_collection) - return mt_touch_input_mapping(hdev, hi, field, usage, bit, max, - application); -@@ -1438,6 +1460,7 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, - { - struct mt_device *td = hid_get_drvdata(hdev); - struct mt_report_data *rdata; -+ struct input_dev *input; - - rdata = mt_find_report_data(td, field->report); - if (rdata && rdata->is_mt_collection) { -@@ -1445,6 +1468,19 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, - return -1; - } - -+ /* -+ * We own an input device which acts as a tablet mode switch for -+ * the Surface Pro Typecover. -+ */ -+ if (field->application == MS_TYPE_COVER_APPLICATION && -+ rdata->application->quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH && -+ usage->hid == MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE) { -+ input = hi->input; -+ input_set_capability(input, EV_SW, SW_TABLET_MODE); -+ input_report_switch(input, SW_TABLET_MODE, 0); -+ return -1; -+ } -+ - /* let hid-core decide for the others */ - return 0; - } -@@ -1454,11 +1490,21 @@ static int mt_event(struct hid_device *hid, struct hid_field *field, - { - struct mt_device *td = hid_get_drvdata(hid); - struct mt_report_data *rdata; -+ struct input_dev *input; - - rdata = mt_find_report_data(td, field->report); - if (rdata && rdata->is_mt_collection) - return mt_touch_event(hid, field, usage, value); - -+ if (field->application == MS_TYPE_COVER_APPLICATION && -+ rdata->application->quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH && -+ usage->hid == MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE) { -+ input = field->hidinput->input; -+ input_report_switch(input, SW_TABLET_MODE, (value & 0xFF) != 0x22); -+ input_sync(input); -+ return 1; -+ } -+ - return 0; - } - -@@ -1611,6 +1657,42 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app) - app->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; - } - -+static int get_type_cover_field(struct hid_report_enum *rep_enum, -+ struct hid_field **field, int usage) -+{ -+ struct hid_report *rep; -+ struct hid_field *cur_field; -+ int i, j; -+ -+ list_for_each_entry(rep, &rep_enum->report_list, list) { -+ for (i = 0; i < rep->maxfield; i++) { -+ cur_field = rep->field[i]; -+ if (cur_field->application != MS_TYPE_COVER_APPLICATION) -+ continue; -+ for (j = 0; j < cur_field->maxusage; j++) { -+ if (cur_field->usage[j].hid == usage) { -+ *field = cur_field; -+ return true; -+ } -+ } -+ } -+ } -+ return false; -+} -+ -+static void request_type_cover_tablet_mode_switch(struct hid_device *hdev) -+{ -+ struct hid_field *field; -+ -+ if (get_type_cover_field(&hdev->report_enum[HID_INPUT_REPORT], -+ &field, -+ MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE)) { -+ hid_hw_request(hdev, field->report, HID_REQ_GET_REPORT); -+ } else { -+ hid_err(hdev, "couldn't find tablet mode field\n"); -+ } -+} -+ - static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) - { - struct mt_device *td = hid_get_drvdata(hdev); -@@ -1659,6 +1741,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) - /* force BTN_STYLUS to allow tablet matching in udev */ - __set_bit(BTN_STYLUS, hi->input->keybit); - break; -+ case MS_TYPE_COVER_APPLICATION: -+ if (td->mtclass.quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH) { -+ suffix = "Tablet Mode Switch"; -+ request_type_cover_tablet_mode_switch(hdev); -+ break; -+ } -+ fallthrough; - default: - suffix = "UNKNOWN"; - break; -@@ -1741,30 +1830,6 @@ static void mt_expired_timeout(struct timer_list *t) - clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); - } - --static void get_type_cover_backlight_field(struct hid_device *hdev, -- struct hid_field **field) --{ -- struct hid_report_enum *rep_enum; -- struct hid_report *rep; -- struct hid_field *cur_field; -- int i, j; +- union acpi_object *result; +- u64 oem_platform_rev = 0; // valid revisions are nonzero - -- rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; -- list_for_each_entry(rep, &rep_enum->report_list, list) { -- for (i = 0; i < rep->maxfield; i++) { -- cur_field = rep->field[i]; +- // get OEM platform revision +- result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, +- MSHW0040_DSM_REVISION, +- MSHW0040_DSM_GET_OMPR, NULL, +- ACPI_TYPE_INTEGER); - -- for (j = 0; j < cur_field->maxusage; j++) { -- if (cur_field->usage[j].hid -- == MS_TYPE_COVER_FEATURE_REPORT_USAGE) { -- *field = cur_field; -- return; -- } -- } -- } +- if (result) { +- oem_platform_rev = result->integer.value; +- ACPI_FREE(result); - } --} - - static void update_keyboard_backlight(struct hid_device *hdev, bool enabled) - { - struct usb_device *udev = hid_to_usb_dev(hdev); -@@ -1773,8 +1838,9 @@ static void update_keyboard_backlight(struct hid_device *hdev, bool enabled) - /* Wake up the device in case it's already suspended */ - pm_runtime_get_sync(&udev->dev); - -- get_type_cover_backlight_field(hdev, &field); -- if (!field) { -+ if (!get_type_cover_field(&hdev->report_enum[HID_FEATURE_REPORT], -+ &field, -+ MS_TYPE_COVER_FEATURE_REPORT_USAGE)) { - hid_err(hdev, "couldn't find backlight field\n"); - goto out; - } -@@ -1908,13 +1974,24 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state) +- /* +- * If the revision is zero here, the _DSM evaluation has failed. This +- * indicates that we have a Pro 4 or Book 1 and this driver should not +- * be used. +- */ +- if (oem_platform_rev == 0) +- return -ENODEV; ++ bool exists; - static int mt_reset_resume(struct hid_device *hdev) - { -+ struct mt_device *td = hid_get_drvdata(hdev); -+ - mt_release_contacts(hdev); - mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true); -+ -+ /* Request an update on the typecover folding state on resume -+ * after reset. -+ */ -+ if (td->mtclass.quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH) -+ request_type_cover_tablet_mode_switch(hdev); -+ - return 0; +- dev_dbg(dev, "OEM Platform Revision %llu\n", oem_platform_rev); ++ // check if OEM platform revision DSM call exists ++ exists = acpi_check_dsm(handle, &MSHW0040_DSM_UUID, ++ MSHW0040_DSM_REVISION, ++ BIT(MSHW0040_DSM_GET_OMPR)); + +- return 0; ++ return exists ? 0 : -ENODEV; } - static int mt_resume(struct hid_device *hdev) + /* +-- +2.45.1 + +From ac551644781bce2145c901b16779114b273c4d49 Mon Sep 17 00:00:00 2001 +From: Sachi King +Date: Tue, 5 Oct 2021 00:22:57 +1100 +Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd + variant + +The AMD variant of the Surface Laptop report 0 for their OEM platform +revision. The Surface devices that require the surfacepro3_button +driver do not have the _DSM that gets the OEM platform revision. If the +method does not exist, load surfacepro3_button. + +Fixes: 64dd243d7356 ("platform/x86: surfacepro3_button: Fix device check") +Co-developed-by: Maximilian Luz + +Signed-off-by: Sachi King +Patchset: surface-button +--- + drivers/platform/surface/surfacepro3_button.c | 30 ++++--------------- + 1 file changed, 6 insertions(+), 24 deletions(-) + +diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c +index 2755601f979cd..4240c98ca2265 100644 +--- a/drivers/platform/surface/surfacepro3_button.c ++++ b/drivers/platform/surface/surfacepro3_button.c +@@ -149,7 +149,8 @@ static int surface_button_resume(struct device *dev) + /* + * Surface Pro 4 and Surface Book 2 / Surface Pro 2017 use the same device + * ID (MSHW0040) for the power/volume buttons. Make sure this is the right +- * device by checking for the _DSM method and OEM Platform Revision. ++ * device by checking for the _DSM method and OEM Platform Revision DSM ++ * function. + * + * Returns true if the driver should bind to this device, i.e. the device is + * either MSWH0028 (Pro 3) or MSHW0040 on a Pro 4 or Book 1. +@@ -157,30 +158,11 @@ static int surface_button_resume(struct device *dev) + static bool surface_button_check_MSHW0040(struct acpi_device *dev) { -+ struct mt_device *td = hid_get_drvdata(hdev); -+ - /* Some Elan legacy devices require SET_IDLE to be set on resume. - * It should be safe to send it to other devices too. - * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */ -@@ -1923,12 +2000,31 @@ static int mt_resume(struct hid_device *hdev) - - mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true); + acpi_handle handle = dev->handle; +- union acpi_object *result; +- u64 oem_platform_rev = 0; // valid revisions are nonzero +- +- // get OEM platform revision +- result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, +- MSHW0040_DSM_REVISION, +- MSHW0040_DSM_GET_OMPR, +- NULL, ACPI_TYPE_INTEGER); +- +- /* +- * If evaluating the _DSM fails, the method is not present. This means +- * that we have either MSHW0028 or MSHW0040 on Pro 4 or Book 1, so we +- * should use this driver. We use revision 0 indicating it is +- * unavailable. +- */ +- +- if (result) { +- oem_platform_rev = result->integer.value; +- ACPI_FREE(result); +- } +- +- dev_dbg(&dev->dev, "OEM Platform Revision %llu\n", oem_platform_rev); -+ /* Request an update on the typecover folding state on resume. */ -+ if (td->mtclass.quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH) -+ request_type_cover_tablet_mode_switch(hdev); -+ - return 0; +- return oem_platform_rev == 0; ++ // make sure that OEM platform revision DSM call does not exist ++ return !acpi_check_dsm(handle, &MSHW0040_DSM_UUID, ++ MSHW0040_DSM_REVISION, ++ BIT(MSHW0040_DSM_GET_OMPR)); } - static void mt_remove(struct hid_device *hdev) - { - struct mt_device *td = hid_get_drvdata(hdev); -+ struct hid_field *field; -+ struct input_dev *input; -+ -+ /* Reset tablet mode switch on disconnect. */ -+ if (td->mtclass.quirks & MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH) { -+ if (get_type_cover_field(&hdev->report_enum[HID_INPUT_REPORT], -+ &field, -+ MS_TYPE_COVER_TABLET_MODE_SWITCH_USAGE)) { -+ input = field->hidinput->input; -+ input_report_switch(input, SW_TABLET_MODE, 0); -+ input_sync(input); -+ } else { -+ hid_err(hdev, "couldn't find tablet mode field\n"); -+ } -+ } - unregister_pm_notifier(&td->pm_notifier); - del_timer_sync(&td->release_timer); -- -2.44.0 +2.45.1 -From aa49dc59b192cc038ca789ac70215d7492f043cb Mon Sep 17 00:00:00 2001 +From 9e0b83c9668c3d0e8e5ce9c254697056940a205d Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 19 Feb 2023 22:12:24 +0100 Subject: [PATCH] PCI: Add quirk to prevent calling shutdown mehtod @@ -7924,10 +10022,10 @@ Patchset: surface-shutdown 3 files changed, 40 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c -index 51ec9e7e784f..40554890d721 100644 +index af2996d0d17ff..3ce0fb61257dc 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c -@@ -507,6 +507,9 @@ static void pci_device_shutdown(struct device *dev) +@@ -505,6 +505,9 @@ static void pci_device_shutdown(struct device *dev) struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_driver *drv = pci_dev->driver; @@ -7938,10 +10036,10 @@ index 51ec9e7e784f..40554890d721 100644 if (drv && drv->shutdown) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index d797df6e5f3e..c674ee496a0b 100644 +index eff7f5df08e27..d1cb4ff3ebc57 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c -@@ -6250,3 +6250,39 @@ static void pci_fixup_d3cold_delay_1sec(struct pci_dev *pdev) +@@ -6253,3 +6253,39 @@ static void pci_fixup_d3cold_delay_1sec(struct pci_dev *pdev) pdev->d3cold_delay = 1000; } DECLARE_PCI_FIXUP_FINAL(0x5555, 0x0004, pci_fixup_d3cold_delay_1sec); @@ -7982,7 +10080,7 @@ index d797df6e5f3e..c674ee496a0b 100644 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x466d, quirk_no_shutdown); // Thunderbolt 4 NHI +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x46a8, quirk_no_shutdown); // GPU diff --git a/include/linux/pci.h b/include/linux/pci.h -index 7ab0d13672da..8d8d9225e0db 100644 +index 16493426a04ff..0eb821624056d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -465,6 +465,7 @@ struct pci_dev { @@ -7994,9 +10092,9 @@ index 7ab0d13672da..8d8d9225e0db 100644 atomic_t enable_cnt; /* pci_enable_device has been called */ -- -2.44.0 +2.45.1 -From 36cf5399fd0f16f10f97c21131d29ebda13607f5 Mon Sep 17 00:00:00 2001 +From 739ab84095d8ea8ec8fe05447706c6eb2ffa3f35 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 12 Mar 2023 01:41:57 +0100 Subject: [PATCH] platform/surface: gpe: Add support for Surface Pro 9 @@ -8010,7 +10108,7 @@ Patchset: surface-gpe 1 file changed, 17 insertions(+) diff --git a/drivers/platform/surface/surface_gpe.c b/drivers/platform/surface/surface_gpe.c -index 62fd4004db31..103fc4468262 100644 +index 62fd4004db31a..103fc4468262a 100644 --- a/drivers/platform/surface/surface_gpe.c +++ b/drivers/platform/surface/surface_gpe.c @@ -41,6 +41,11 @@ static const struct property_entry lid_device_props_l4F[] = { @@ -8045,9 +10143,9 @@ index 62fd4004db31..103fc4468262 100644 .ident = "Surface Book 1", .matches = { -- -2.44.0 +2.45.1 -From 526bea529e4befa282fcfd01bbadbed7325faf01 Mon Sep 17 00:00:00 2001 +From 44ed44fe421e484bcf2de223d7e8077302635772 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 10 Oct 2021 20:56:57 +0200 Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an @@ -8107,10 +10205,10 @@ Patchset: cameras 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index e6ed1ba91e5c..b367890b7438 100644 +index d1464324de951..5d865a34dd9db 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c -@@ -2138,6 +2138,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used, +@@ -2181,6 +2181,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used, static void acpi_default_enumeration(struct acpi_device *device) { @@ -8121,9 +10219,9 @@ index e6ed1ba91e5c..b367890b7438 100644 * Do not enumerate devices with enumeration_by_parent flag set as * they will be enumerated by their respective parents. -- -2.44.0 +2.45.1 -From d41ef92974135b1c22c2f46cbaba926701e0d4af Mon Sep 17 00:00:00 2001 +From d9d5afcea9880a957d6a8d975a122b4f54ec28c2 Mon Sep 17 00:00:00 2001 From: zouxiaoh Date: Fri, 25 Jun 2021 08:52:59 +0800 Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs @@ -8149,10 +10247,10 @@ Patchset: cameras 1 file changed, 30 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c -index 6c01b1aebf27..ceed043464b1 100644 +index 61bc54299a591..a61af0f4e9fce 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c -@@ -45,6 +45,13 @@ +@@ -44,6 +44,13 @@ ((pdev)->vendor == PCI_VENDOR_ID_INTEL && (pdev)->device == 0x34E4) \ ) @@ -8166,23 +10264,23 @@ index 6c01b1aebf27..ceed043464b1 100644 #define IOAPIC_RANGE_START (0xfee00000) #define IOAPIC_RANGE_END (0xfeefffff) #define IOVA_START_ADDR (0x1000) -@@ -154,12 +161,14 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled); +@@ -227,12 +234,14 @@ int intel_iommu_enabled = 0; + EXPORT_SYMBOL_GPL(intel_iommu_enabled); - static int dmar_map_gfx = 1; static int dmar_map_ipts = 1; +static int dmar_map_ipu = 1; static int intel_iommu_superpage = 1; static int iommu_identity_mapping; static int iommu_skip_te_disable; + static int disable_igfx_iommu; - #define IDENTMAP_GFX 2 #define IDENTMAP_AZALIA 4 +#define IDENTMAP_IPU 8 #define IDENTMAP_IPTS 16 const struct iommu_ops intel_iommu_ops; -@@ -2420,6 +2429,9 @@ static int device_def_domain_type(struct device *dev) - if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) +@@ -2409,6 +2418,9 @@ static int device_def_domain_type(struct device *dev) + if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) return IOMMU_DOMAIN_IDENTITY; + if ((iommu_identity_mapping & IDENTMAP_IPU) && IS_INTEL_IPU(pdev)) @@ -8191,9 +10289,9 @@ index 6c01b1aebf27..ceed043464b1 100644 if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev)) return IOMMU_DOMAIN_IDENTITY; } -@@ -2729,6 +2741,9 @@ static int __init init_dmars(void) - if (!dmar_map_gfx) - iommu_identity_mapping |= IDENTMAP_GFX; +@@ -2711,6 +2723,9 @@ static int __init init_dmars(void) + iommu_set_root_entry(iommu); + } + if (!dmar_map_ipu) + iommu_identity_mapping |= IDENTMAP_IPU; @@ -8201,8 +10299,8 @@ index 6c01b1aebf27..ceed043464b1 100644 if (!dmar_map_ipts) iommu_identity_mapping |= IDENTMAP_IPTS; -@@ -4909,6 +4924,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev) - dmar_map_gfx = 0; +@@ -4884,6 +4899,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev) + disable_igfx_iommu = 1; } +static void quirk_iommu_ipu(struct pci_dev *dev) @@ -8220,7 +10318,7 @@ index 6c01b1aebf27..ceed043464b1 100644 static void quirk_iommu_ipts(struct pci_dev *dev) { if (!IS_IPTS(dev)) -@@ -4956,6 +4983,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx); +@@ -4931,6 +4958,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163A, quirk_iommu_igfx); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx); @@ -8231,9 +10329,9 @@ index 6c01b1aebf27..ceed043464b1 100644 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9D3E, quirk_iommu_ipts); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x34E4, quirk_iommu_ipts); -- -2.44.0 +2.45.1 -From 214600c4c0c3039ba0d0a5e522a2eb162da3857b Mon Sep 17 00:00:00 2001 +From bbf2fb14fae6c6bda12e156ff9d027913ab7860f Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Sun, 10 Oct 2021 20:57:02 +0200 Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain @@ -8250,7 +10348,7 @@ Patchset: cameras 1 file changed, 7 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c -index 1e107fd49f82..e3e1696e7f0e 100644 +index 1e107fd49f828..e3e1696e7f0ee 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -46,6 +46,13 @@ static int tps68470_chip_init(struct device *dev, struct regmap *regmap) @@ -8268,9 +10366,9 @@ index 1e107fd49f82..e3e1696e7f0e 100644 return 0; -- -2.44.0 +2.45.1 -From f5c4f5e1de99e04416ddffca65246a7769a202e3 Mon Sep 17 00:00:00 2001 +From bc2732708fc2a71f7fe3808aa84cc6eabbdd1285 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Thu, 2 Mar 2023 12:59:39 +0000 Subject: [PATCH] platform/x86: int3472: Remap reset GPIO for INT347E @@ -8292,7 +10390,7 @@ Patchset: cameras 1 file changed, 14 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c -index 07b302e09340..1d3097bc7e48 100644 +index 07b302e093407..1d3097bc7e487 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -83,12 +83,26 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 @@ -8323,9 +10421,9 @@ index 07b302e09340..1d3097bc7e48 100644 agpio, func, polarity); if (ret) -- -2.44.0 +2.45.1 -From 216df183e0ad29051b42fcb856d0818a6094f16d Mon Sep 17 00:00:00 2001 +From 0180b848e145642574d2a91175f92050dcec1ec7 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Tue, 21 Mar 2023 13:45:26 +0000 Subject: [PATCH] media: i2c: Clarify that gain is Analogue gain in OV7251 @@ -8340,7 +10438,7 @@ Patchset: cameras 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c -index 30f61e04ecaf..9c1292ca8552 100644 +index 30f61e04ecaf5..9c1292ca85522 100644 --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c @@ -1051,7 +1051,7 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl) @@ -8362,9 +10460,9 @@ index 30f61e04ecaf..9c1292ca8552 100644 V4L2_CID_TEST_PATTERN, ARRAY_SIZE(ov7251_test_pattern_menu) - 1, -- -2.44.0 +2.45.1 -From 0573bb8c22ed0f0476a2ca6c5df2a7f09c6a1b66 Mon Sep 17 00:00:00 2001 +From 67553f37af4ea73f824108a08666b537c68972e5 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Wed, 22 Mar 2023 11:01:42 +0000 Subject: [PATCH] media: v4l2-core: Acquire privacy led in @@ -8383,7 +10481,7 @@ Patchset: cameras 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c -index 3ec323bd528b..b55570a0142c 100644 +index 3ec323bd528b1..b55570a0142cb 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -796,6 +796,10 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) @@ -8398,7 +10496,7 @@ index 3ec323bd528b..b55570a0142c 100644 * No reference taken. The reference is held by the device (struct * v4l2_subdev.dev), and async sub-device does not exist independently diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c -index 89c7192148df..44eca113e772 100644 +index 89c7192148dfb..44eca113e7727 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -1219,10 +1219,6 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd) @@ -8413,9 +10511,9 @@ index 89c7192148df..44eca113e772 100644 if (ret < 0) goto out_cleanup; -- -2.44.0 +2.45.1 -From 84d70102a7892f720a11a0b3d313f3932c859798 Mon Sep 17 00:00:00 2001 +From 82dff76b0fc0e6d8fec20339edcb52fcb3eb1fac Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Tue, 21 Mar 2023 23:37:16 +0800 Subject: [PATCH] platform: x86: int3472: Add MFD cell for tps68470 LED @@ -8431,7 +10529,7 @@ Patchset: cameras 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c -index e3e1696e7f0e..423dc555093f 100644 +index e3e1696e7f0ee..423dc555093f7 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -17,7 +17,7 @@ @@ -8454,9 +10552,9 @@ index e3e1696e7f0e..423dc555093f 100644 for (i = 0; i < board_data->n_gpiod_lookups; i++) gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); -- -2.44.0 +2.45.1 -From 183f7e4da9cacc2a0f9cb3549adad9a3c95f1b94 Mon Sep 17 00:00:00 2001 +From ac5b449b3e7da53dfff6ab59dc32d9714eb2f106 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Tue, 21 Mar 2023 23:37:17 +0800 Subject: [PATCH] include: mfd: tps68470: Add masks for LEDA and LEDB @@ -8474,7 +10572,7 @@ Patchset: cameras 1 file changed, 5 insertions(+) diff --git a/include/linux/mfd/tps68470.h b/include/linux/mfd/tps68470.h -index 7807fa329db0..2d2abb25b944 100644 +index 7807fa329db00..2d2abb25b944f 100644 --- a/include/linux/mfd/tps68470.h +++ b/include/linux/mfd/tps68470.h @@ -34,6 +34,7 @@ @@ -8495,9 +10593,9 @@ index 7807fa329db0..2d2abb25b944 100644 + #endif /* __LINUX_MFD_TPS68470_H */ -- -2.44.0 +2.45.1 -From 0f3811853f436eed853d7d226eb811f65137d03a Mon Sep 17 00:00:00 2001 +From 3bdaa0c3e0b7dfa3b441e7d19d3f08ff3708e354 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Tue, 21 Mar 2023 23:37:18 +0800 Subject: [PATCH] leds: tps68470: Add LED control for tps68470 @@ -8520,10 +10618,10 @@ Patchset: cameras create mode 100644 drivers/leds/leds-tps68470.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig -index d721b254e1e4..1717f94d1491 100644 +index 05e6af88b88cd..c120eb0b5aa8e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -899,6 +899,18 @@ config LEDS_TPS6105X +@@ -909,6 +909,18 @@ config LEDS_TPS6105X It is a single boost converter primarily for white LEDs and audio amplifiers. @@ -8543,7 +10641,7 @@ index d721b254e1e4..1717f94d1491 100644 tristate "LED support for SGI Octane machines" depends on LEDS_CLASS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile -index ce07dc295ff0..0ebf6a9f9f7f 100644 +index effdfc6f1e951..6ce609b2cdac6 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o @@ -8556,7 +10654,7 @@ index ce07dc295ff0..0ebf6a9f9f7f 100644 obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o diff --git a/drivers/leds/leds-tps68470.c b/drivers/leds/leds-tps68470.c new file mode 100644 -index 000000000000..35aeb5db89c8 +index 0000000000000..35aeb5db89c8f --- /dev/null +++ b/drivers/leds/leds-tps68470.c @@ -0,0 +1,185 @@ @@ -8746,431 +10844,9 @@ index 000000000000..35aeb5db89c8 +MODULE_DESCRIPTION("LED driver for TPS68470 PMIC"); +MODULE_LICENSE("GPL v2"); -- -2.44.0 - -From 87ebc160cb35a068acfaf59847c84656cb52b1b7 Mon Sep 17 00:00:00 2001 -From: Sakari Ailus -Date: Thu, 25 May 2023 14:12:04 +0300 -Subject: [PATCH] media: ipu3-cio2: Further clean up async subdev link creation - -Use v4l2_create_fwnode_links_to_pad() to create links from async -sub-devices to the CSI-2 receiver subdevs. - -Signed-off-by: Sakari Ailus -Reviewed-by: Laurent Pinchart -Signed-off-by: Hans Verkuil -Patchset: cameras ---- - drivers/media/pci/intel/ipu3/ipu3-cio2.c | 22 +++++----------------- - 1 file changed, 5 insertions(+), 17 deletions(-) - -diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c -index ed08bf4178f0..83e29c56fe33 100644 ---- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c -+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -1407,7 +1408,6 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier, - static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) - { - struct cio2_device *cio2 = to_cio2_device(notifier); -- struct device *dev = &cio2->pci_dev->dev; - struct sensor_async_subdev *s_asd; - struct v4l2_async_connection *asd; - struct cio2_queue *q; -@@ -1417,23 +1417,10 @@ static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) - s_asd = to_sensor_asd(asd); - q = &cio2->queue[s_asd->csi2.port]; - -- ret = media_entity_get_fwnode_pad(&q->sensor->entity, -- s_asd->asd.match.fwnode, -- MEDIA_PAD_FL_SOURCE); -- if (ret < 0) { -- dev_err(dev, "no pad for endpoint %pfw (%d)\n", -- s_asd->asd.match.fwnode, ret); -- return ret; -- } -- -- ret = media_create_pad_link(&q->sensor->entity, ret, -- &q->subdev.entity, CIO2_PAD_SINK, -- 0); -- if (ret) { -- dev_err(dev, "failed to create link for %s (endpoint %pfw, error %d)\n", -- q->sensor->name, s_asd->asd.match.fwnode, ret); -+ ret = v4l2_create_fwnode_links_to_pad(asd->sd, -+ &q->subdev_pads[CIO2_PAD_SINK], 0); -+ if (ret) - return ret; -- } - } - - return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev); -@@ -1572,6 +1559,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q) - v4l2_subdev_init(subdev, &cio2_subdev_ops); - subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; - subdev->owner = THIS_MODULE; -+ subdev->dev = dev; - snprintf(subdev->name, sizeof(subdev->name), - CIO2_ENTITY_NAME " %td", q - cio2->queue); - subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; --- -2.44.0 - -From a9681c29588d67321733877e11f9588ed9e54861 Mon Sep 17 00:00:00 2001 -From: mojyack -Date: Sat, 3 Feb 2024 12:53:33 +0900 -Subject: [PATCH] media: i2c: Revert DW9719 driver - -Patchset: cameras ---- - drivers/media/i2c/dw9719.c | 199 +++++++++++++++++++++++++------------ - 1 file changed, 137 insertions(+), 62 deletions(-) - -diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c -index c626ed845928..d5f585dabb60 100644 ---- a/drivers/media/i2c/dw9719.c -+++ b/drivers/media/i2c/dw9719.c -@@ -6,13 +6,14 @@ - * https://github.com/ZenfoneArea/android_kernel_asus_zenfone5 - */ - -+#include -+ - #include - #include - #include - #include - #include - --#include - #include - #include - #include -@@ -20,31 +21,29 @@ - #define DW9719_MAX_FOCUS_POS 1023 - #define DW9719_CTRL_STEPS 16 - #define DW9719_CTRL_DELAY_US 1000 -+#define DELAY_MAX_PER_STEP_NS (1000000 * 1023) - --#define DW9719_INFO CCI_REG8(0) -+#define DW9719_INFO 0 - #define DW9719_ID 0xF1 -+#define DW9719_CONTROL 2 -+#define DW9719_VCM_CURRENT 3 - --#define DW9719_CONTROL CCI_REG8(2) --#define DW9719_ENABLE_RINGING 0x02 -- --#define DW9719_VCM_CURRENT CCI_REG16(3) -- --#define DW9719_MODE CCI_REG8(6) --#define DW9719_MODE_SAC_SHIFT 4 --#define DW9719_MODE_SAC3 4 -+#define DW9719_MODE 6 -+#define DW9719_VCM_FREQ 7 - --#define DW9719_VCM_FREQ CCI_REG8(7) -+#define DW9719_MODE_SAC3 0x40 - #define DW9719_DEFAULT_VCM_FREQ 0x60 -+#define DW9719_ENABLE_RINGING 0x02 -+ -+#define NUM_REGULATORS 2 - - #define to_dw9719_device(x) container_of(x, struct dw9719_device, sd) - - struct dw9719_device { -- struct v4l2_subdev sd; - struct device *dev; -- struct regmap *regmap; -- struct regulator *regulator; -- u32 sac_mode; -- u32 vcm_freq; -+ struct i2c_client *client; -+ struct regulator_bulk_data regulators[NUM_REGULATORS]; -+ struct v4l2_subdev sd; - - struct dw9719_v4l2_ctrls { - struct v4l2_ctrl_handler handler; -@@ -52,18 +51,79 @@ struct dw9719_device { - } ctrls; - }; - -+static int dw9719_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) -+{ -+ struct i2c_msg msg[2]; -+ u8 buf[2] = { reg }; -+ int ret; -+ -+ msg[0].addr = client->addr; -+ msg[0].flags = 0; -+ msg[0].len = 1; -+ msg[0].buf = buf; -+ -+ msg[1].addr = client->addr; -+ msg[1].flags = I2C_M_RD; -+ msg[1].len = 1; -+ msg[1].buf = &buf[1]; -+ *val = 0; -+ -+ ret = i2c_transfer(client->adapter, msg, 2); -+ if (ret < 0) -+ return ret; -+ -+ *val = buf[1]; -+ -+ return 0; -+} -+ -+static int dw9719_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) -+{ -+ struct i2c_msg msg; -+ int ret; -+ -+ u8 buf[2] = { reg, val }; -+ -+ msg.addr = client->addr; -+ msg.flags = 0; -+ msg.len = sizeof(buf); -+ msg.buf = buf; -+ -+ ret = i2c_transfer(client->adapter, &msg, 1); -+ -+ return ret < 0 ? ret : 0; -+} -+ -+static int dw9719_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) -+{ -+ struct i2c_msg msg; -+ u8 buf[3] = { reg }; -+ int ret; -+ -+ put_unaligned_be16(val, buf + 1); -+ -+ msg.addr = client->addr; -+ msg.flags = 0; -+ msg.len = sizeof(buf); -+ msg.buf = buf; -+ -+ ret = i2c_transfer(client->adapter, &msg, 1); -+ -+ return ret < 0 ? ret : 0; -+} -+ - static int dw9719_detect(struct dw9719_device *dw9719) - { - int ret; -- u64 val; -+ u8 val; - -- ret = cci_read(dw9719->regmap, DW9719_INFO, &val, NULL); -+ ret = dw9719_i2c_rd8(dw9719->client, DW9719_INFO, &val); - if (ret < 0) - return ret; - - if (val != DW9719_ID) { - dev_err(dw9719->dev, "Failed to detect correct id\n"); -- return -ENXIO; -+ ret = -ENXIO; - } - - return 0; -@@ -71,37 +131,54 @@ static int dw9719_detect(struct dw9719_device *dw9719) - - static int dw9719_power_down(struct dw9719_device *dw9719) - { -- return regulator_disable(dw9719->regulator); -+ return regulator_bulk_disable(NUM_REGULATORS, dw9719->regulators); - } - - static int dw9719_power_up(struct dw9719_device *dw9719) - { - int ret; - -- ret = regulator_enable(dw9719->regulator); -+ ret = regulator_bulk_enable(NUM_REGULATORS, dw9719->regulators); - if (ret) - return ret; - - /* Jiggle SCL pin to wake up device */ -- cci_write(dw9719->regmap, DW9719_CONTROL, 1, &ret); -+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL, 1); - -- /* Need 100us to transit from SHUTDOWN to STANDBY */ -- fsleep(100); -+ /* Need 100us to transit from SHUTDOWN to STANDBY*/ -+ usleep_range(100, 1000); - -- cci_write(dw9719->regmap, DW9719_CONTROL, DW9719_ENABLE_RINGING, &ret); -- cci_write(dw9719->regmap, DW9719_MODE, -- dw9719->sac_mode << DW9719_MODE_SAC_SHIFT, &ret); -- cci_write(dw9719->regmap, DW9719_VCM_FREQ, dw9719->vcm_freq, &ret); -+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL, -+ DW9719_ENABLE_RINGING); -+ if (ret < 0) -+ goto fail_powerdown; - -- if (ret) -- dw9719_power_down(dw9719); -+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_MODE, DW9719_MODE_SAC3); -+ if (ret < 0) -+ goto fail_powerdown; -+ -+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_VCM_FREQ, -+ DW9719_DEFAULT_VCM_FREQ); -+ if (ret < 0) -+ goto fail_powerdown; -+ -+ return 0; - -+fail_powerdown: -+ dw9719_power_down(dw9719); - return ret; - } - - static int dw9719_t_focus_abs(struct dw9719_device *dw9719, s32 value) - { -- return cci_write(dw9719->regmap, DW9719_VCM_CURRENT, value, NULL); -+ int ret; -+ -+ value = clamp(value, 0, DW9719_MAX_FOCUS_POS); -+ ret = dw9719_i2c_wr16(dw9719->client, DW9719_VCM_CURRENT, value); -+ if (ret < 0) -+ return ret; -+ -+ return 0; - } - - static int dw9719_set_ctrl(struct v4l2_ctrl *ctrl) -@@ -132,7 +209,7 @@ static const struct v4l2_ctrl_ops dw9719_ctrl_ops = { - .s_ctrl = dw9719_set_ctrl, - }; - --static int dw9719_suspend(struct device *dev) -+static int __maybe_unused dw9719_suspend(struct device *dev) - { - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct dw9719_device *dw9719 = to_dw9719_device(sd); -@@ -151,7 +228,7 @@ static int dw9719_suspend(struct device *dev) - return dw9719_power_down(dw9719); - } - --static int dw9719_resume(struct device *dev) -+static int __maybe_unused dw9719_resume(struct device *dev) - { - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct dw9719_device *dw9719 = to_dw9719_device(sd); -@@ -201,7 +278,9 @@ static int dw9719_init_controls(struct dw9719_device *dw9719) - const struct v4l2_ctrl_ops *ops = &dw9719_ctrl_ops; - int ret; - -- v4l2_ctrl_handler_init(&dw9719->ctrls.handler, 1); -+ ret = v4l2_ctrl_handler_init(&dw9719->ctrls.handler, 1); -+ if (ret) -+ return ret; - - dw9719->ctrls.focus = v4l2_ctrl_new_std(&dw9719->ctrls.handler, ops, - V4L2_CID_FOCUS_ABSOLUTE, 0, -@@ -214,7 +293,8 @@ static int dw9719_init_controls(struct dw9719_device *dw9719) - } - - dw9719->sd.ctrl_handler = &dw9719->ctrls.handler; -- return 0; -+ -+ return ret; - - err_free_handler: - v4l2_ctrl_handler_free(&dw9719->ctrls.handler); -@@ -232,26 +312,24 @@ static int dw9719_probe(struct i2c_client *client) - if (!dw9719) - return -ENOMEM; - -- dw9719->regmap = devm_cci_regmap_init_i2c(client, 8); -- if (IS_ERR(dw9719->regmap)) -- return PTR_ERR(dw9719->regmap); -- -+ dw9719->client = client; - dw9719->dev = &client->dev; -- dw9719->sac_mode = DW9719_MODE_SAC3; -- dw9719->vcm_freq = DW9719_DEFAULT_VCM_FREQ; - -- /* Optional indication of SAC mode select */ -- device_property_read_u32(&client->dev, "dongwoon,sac-mode", -- &dw9719->sac_mode); -- -- /* Optional indication of VCM frequency */ -- device_property_read_u32(&client->dev, "dongwoon,vcm-freq", -- &dw9719->vcm_freq); -+ dw9719->regulators[0].supply = "vdd"; -+ /* -+ * The DW9719 has only the 1 VDD voltage input, but some PMICs such as -+ * the TPS68470 PMIC have I2C passthrough capability, to disconnect the -+ * sensor's I2C pins from the I2C bus when the sensors VSIO (Sensor-IO) -+ * is off, because some sensors then short these pins to ground; -+ * and the DW9719 might sit behind this passthrough, this it needs to -+ * enable VSIO as that will also enable the I2C passthrough. -+ */ -+ dw9719->regulators[1].supply = "vsio"; - -- dw9719->regulator = devm_regulator_get(&client->dev, "vdd"); -- if (IS_ERR(dw9719->regulator)) -- return dev_err_probe(&client->dev, PTR_ERR(dw9719->regulator), -- "getting regulator\n"); -+ ret = devm_regulator_bulk_get(&client->dev, NUM_REGULATORS, -+ dw9719->regulators); -+ if (ret) -+ return dev_err_probe(&client->dev, ret, "getting regulators\n"); - - v4l2_i2c_subdev_init(&dw9719->sd, client, &dw9719_ops); - dw9719->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; -@@ -312,17 +390,13 @@ static int dw9719_probe(struct i2c_client *client) - static void dw9719_remove(struct i2c_client *client) - { - struct v4l2_subdev *sd = i2c_get_clientdata(client); -- struct dw9719_device *dw9719 = -- container_of(sd, struct dw9719_device, sd); -+ struct dw9719_device *dw9719 = container_of(sd, struct dw9719_device, -+ sd); - -+ pm_runtime_disable(&client->dev); - v4l2_async_unregister_subdev(sd); - v4l2_ctrl_handler_free(&dw9719->ctrls.handler); - media_entity_cleanup(&dw9719->sd.entity); -- -- pm_runtime_disable(&client->dev); -- if (!pm_runtime_status_suspended(&client->dev)) -- dw9719_power_down(dw9719); -- pm_runtime_set_suspended(&client->dev); - } - - static const struct i2c_device_id dw9719_id_table[] = { -@@ -331,13 +405,14 @@ static const struct i2c_device_id dw9719_id_table[] = { - }; - MODULE_DEVICE_TABLE(i2c, dw9719_id_table); - --static DEFINE_RUNTIME_DEV_PM_OPS(dw9719_pm_ops, dw9719_suspend, dw9719_resume, -- NULL); -+static const struct dev_pm_ops dw9719_pm_ops = { -+ SET_RUNTIME_PM_OPS(dw9719_suspend, dw9719_resume, NULL) -+}; - - static struct i2c_driver dw9719_i2c_driver = { - .driver = { - .name = "dw9719", -- .pm = pm_sleep_ptr(&dw9719_pm_ops), -+ .pm = &dw9719_pm_ops, - }, - .probe = dw9719_probe, - .remove = dw9719_remove, --- -2.44.0 +2.45.1 -From c5d6c95fd5cefbd4ba9779fc965bce0a36bdbe5e Mon Sep 17 00:00:00 2001 +From 05501de0dab9bc531918dcf2b8aa7e679760fd7b Mon Sep 17 00:00:00 2001 From: mojyack Date: Sat, 3 Feb 2024 12:59:53 +0900 Subject: [PATCH] media: staging: ipu3-imgu: Fix multiple calls of s_stream on @@ -9184,7 +10860,7 @@ Patchset: cameras 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c -index 3df58eb3e882..81aff2d5d898 100644 +index 3df58eb3e8822..81aff2d5d8988 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -538,18 +538,18 @@ static void imgu_vb2_stop_streaming(struct vb2_queue *vq) @@ -9215,9 +10891,41 @@ index 3df58eb3e882..81aff2d5d898 100644 r = imgu_s_stream(imgu, false); if (!r) -- -2.44.0 +2.45.1 + +From c85328d7df3de31a574e42f66192c6a944f48bde Mon Sep 17 00:00:00 2001 +From: mojyack +Date: Tue, 26 Mar 2024 05:55:44 +0900 +Subject: [PATCH] media: i2c: dw9719: fix probe error on surface go 2 + +On surface go 2, sometimes probing dw9719 fails with "dw9719: probe of i2c-INT347A:00-VCM failed with error -121". +The -121(-EREMOTEIO) is came from drivers/i2c/busses/i2c-designware-common.c:575, and indicates the initialize occurs too early. +So just add some delay. +There is no exact reason for this 10000us, but 100us failed. + +Patchset: cameras +--- + drivers/media/i2c/dw9719.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c +index c626ed845928c..0094cfda57ea8 100644 +--- a/drivers/media/i2c/dw9719.c ++++ b/drivers/media/i2c/dw9719.c +@@ -82,6 +82,9 @@ static int dw9719_power_up(struct dw9719_device *dw9719) + if (ret) + return ret; + ++ /* Wait for device to be acknowledged */ ++ fsleep(10000); ++ + /* Jiggle SCL pin to wake up device */ + cci_write(dw9719->regmap, DW9719_CONTROL, 1, &ret); + +-- +2.45.1 -From 302d8dc26283bc10ba22bc549c41292d00125e60 Mon Sep 17 00:00:00 2001 +From e0b584d3054d7c69d2e1b4f2ca54e42b79ee5446 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Sat, 29 May 2021 17:47:38 +1000 Subject: [PATCH] ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7 @@ -9240,7 +10948,7 @@ Patchset: amd-gpio 1 file changed, 17 insertions(+) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c -index 85a3ce2a3666..2c0e04a3a697 100644 +index 4bf82dbd2a6b5..7a8cb090c6568 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -22,6 +22,7 @@ @@ -9251,7 +10959,7 @@ index 85a3ce2a3666..2c0e04a3a697 100644 #include #include -@@ -1251,6 +1252,17 @@ static void __init mp_config_acpi_legacy_irqs(void) +@@ -1216,6 +1217,17 @@ static void __init mp_config_acpi_legacy_irqs(void) } } @@ -9269,7 +10977,7 @@ index 85a3ce2a3666..2c0e04a3a697 100644 /* * Parse IOAPIC related entries in MADT * returns 0 on success, < 0 on error -@@ -1306,6 +1318,11 @@ static int __init acpi_parse_madt_ioapic_entries(void) +@@ -1271,6 +1283,11 @@ static int __init acpi_parse_madt_ioapic_entries(void) acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0, acpi_gbl_FADT.sci_interrupt); @@ -9282,9 +10990,9 @@ index 85a3ce2a3666..2c0e04a3a697 100644 mp_config_acpi_legacy_irqs(); -- -2.44.0 +2.45.1 -From d2a793e4fd47cd1cba2847915e7078671d9e9ea5 Mon Sep 17 00:00:00 2001 +From dafa7b45eecb1e02dc857158566d2fb3087fa71f Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Thu, 3 Jun 2021 14:04:26 +0200 Subject: [PATCH] ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override @@ -9299,10 +11007,10 @@ Patchset: amd-gpio 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c -index 2c0e04a3a697..b0e1dab3d2ec 100644 +index 7a8cb090c6568..0faafc323e673 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c -@@ -1254,12 +1254,19 @@ static void __init mp_config_acpi_legacy_irqs(void) +@@ -1219,12 +1219,19 @@ static void __init mp_config_acpi_legacy_irqs(void) static const struct dmi_system_id surface_quirk[] __initconst = { { @@ -9324,9 +11032,9 @@ index 2c0e04a3a697..b0e1dab3d2ec 100644 }; -- -2.44.0 +2.45.1 -From 34ad5b493b00c944ed68d2436cad96785fe37a33 Mon Sep 17 00:00:00 2001 +From e3e62473f885786f1b57421f5fed86ac5ba402ac Mon Sep 17 00:00:00 2001 From: "Bart Groeneveld | GPX Solutions B.V" Date: Mon, 5 Dec 2022 16:08:46 +0100 Subject: [PATCH] acpi: allow usage of acpi_tad on HW-reduced platforms @@ -9349,7 +11057,7 @@ Patchset: rtc 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c -index 33c3b16af556..900445d06623 100644 +index 1d670dbe4d1dd..71c9e375ca1ca 100644 --- a/drivers/acpi/acpi_tad.c +++ b/drivers/acpi/acpi_tad.c @@ -432,6 +432,14 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr, @@ -9386,7 +11094,7 @@ index 33c3b16af556..900445d06623 100644 }; static ssize_t dc_alarm_store(struct device *dev, struct device_attribute *attr, -@@ -564,13 +571,18 @@ static int acpi_tad_remove(struct platform_device *pdev) +@@ -564,13 +571,18 @@ static void acpi_tad_remove(struct platform_device *pdev) pm_runtime_get_sync(dev); @@ -9407,7 +11115,7 @@ index 33c3b16af556..900445d06623 100644 if (dd->capabilities & ACPI_TAD_DC_WAKE) { acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER); acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER); -@@ -613,12 +625,6 @@ static int acpi_tad_probe(struct platform_device *pdev) +@@ -612,12 +624,6 @@ static int acpi_tad_probe(struct platform_device *pdev) goto remove_handler; } @@ -9420,7 +11128,7 @@ index 33c3b16af556..900445d06623 100644 dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL); if (!dd) { ret = -ENOMEM; -@@ -649,6 +655,12 @@ static int acpi_tad_probe(struct platform_device *pdev) +@@ -648,6 +654,12 @@ static int acpi_tad_probe(struct platform_device *pdev) if (ret) goto fail; @@ -9434,5 +11142,5 @@ index 33c3b16af556..900445d06623 100644 ret = sysfs_create_group(&dev->kobj, &acpi_tad_dc_attr_group); if (ret) -- -2.44.0 +2.45.1 diff --git a/SOURCES/mod-blacklist.sh b/SOURCES/mod-blacklist.sh deleted file mode 100755 index 6127d14..0000000 --- a/SOURCES/mod-blacklist.sh +++ /dev/null @@ -1,164 +0,0 @@ -#! /bin/bash -# shellcheck disable=SC2164 - -RpmDir=$1 -ModDir=$2 -Dir="$1/$2" -# Note the list filename must have the format mod-[PACKAGE].list, for example, -# mod-internal.list or mod-extra.list. The PACKAGE is used to create a -# override directory for the modules. -List=$3 -Dest="$4" - -blacklist() -{ - cat > "$RpmDir/etc/modprobe.d/$1-blacklist.conf" <<-__EOF__ - # This kernel module can be automatically loaded by non-root users. To - # enhance system security, the module is blacklisted by default to ensure - # system administrators make the module available for use as needed. - # See https://access.redhat.com/articles/3760101 for more details. - # - # Remove the blacklist by adding a comment # at the start of the line. - blacklist $1 -__EOF__ -} - -check_blacklist() -{ - mod=$(find "$RpmDir/$ModDir" -name "$1") - [ ! "$mod" ] && return 0 - if modinfo "$mod" | grep -q '^alias:\s\+net-'; then - mod="${1##*/}" - mod="${mod%.ko*}" - echo "$mod has an alias that allows auto-loading. Blacklisting." - blacklist "$mod" - fi -} - -find_depends() -{ - dep=$1 - depends=$(modinfo "$dep" | sed -n -e "/^depends/ s/^depends:[ \t]*//p") - [ -z "$depends" ] && exit - for mod in ${depends//,/ } - do - match=$(grep "^$mod.ko" "$ListName") - [ -z "$match" ] && continue - # check if the module we are looking at is in mod-* too. - # if so we do not need to mark the dep as required. - mod2=${dep##*/} # same as $(basename $dep), but faster - match2=$(grep "^$mod2" "$ListName") - if [ -n "$match2" ] - then - #echo $mod2 >> notreq.list - continue - fi - echo "$mod".ko >> req.list - done -} - -foreachp() -{ - P=$(nproc) - bgcount=0 - while read -r mod; do - $1 "$mod" & - - bgcount=$((bgcount + 1)) - if [ $bgcount -eq "$P" ]; then - wait -n - bgcount=$((bgcount - 1)) - fi - done - - wait -} - -# Destination was specified on the command line -test -n "$4" && echo "$0: Override Destination $Dest has been specified." - -pushd "$Dir" - -OverrideDir=$(basename "$List") -OverrideDir=${OverrideDir%.*} -OverrideDir=${OverrideDir#*-} -mkdir -p "$OverrideDir" - -rm -rf modnames -find . -name "*.ko" -type f > modnames -# Look through all of the modules, and throw any that have a dependency in -# our list into the list as well. -rm -rf dep.list dep2.list -rm -rf req.list req2.list -touch dep.list req.list -cp "$List" . - -# This variable needs to be exported because it is used in sub-script -# executed by xargs -ListName=$(basename "$List") -export ListName - -foreachp find_depends < modnames - -sort -u req.list > req2.list -sort -u "$ListName" > modules2.list -join -v 1 modules2.list req2.list > modules3.list - -while IFS= read -r mod -do - # get the path for the module - modpath=$(grep /"$mod" modnames) - [ -z "$modpath" ] && continue - echo "$modpath" >> dep.list -done < modules3.list - -sort -u dep.list > dep2.list - -if [ -n "$Dest" ]; then - # now move the modules into the $Dest directory - while IFS= read -r mod - do - newpath=$(dirname "$mod" | sed -e "s/kernel\\//$Dest\//") - mkdir -p "$newpath" - mv "$mod" "$newpath" - echo "$mod" | sed -e "s/kernel\\//$Dest\//" | sed -e "s|^.|${ModDir}|g" >> "$RpmDir"/"$ListName" - done < dep2.list -fi - -popd - -# If we're signing modules, we can't leave the .mod files for the .ko files -# we've moved in .tmp_versions/. Remove them so the Kbuild 'modules_sign' -# target doesn't try to sign a non-existent file. This is kinda ugly, but -# so are the modules-* packages. - -while IFS= read -r mod -do - modfile=$(basename "$mod" | sed -e 's/.ko/.mod/') - rm .tmp_versions/"$modfile" -done < "$Dir"/dep2.list - -if [ -z "$Dest" ]; then - sed -e "s|^.|${ModDir}|g" "$Dir"/dep2.list > "$RpmDir/$ListName" - echo "./$RpmDir/$ListName created." - [ -d "$RpmDir/etc/modprobe.d/" ] || mkdir -p "$RpmDir/etc/modprobe.d/" - foreachp check_blacklist < "$List" -fi - -# Many BIOS-es export a PNP-id which causes the floppy driver to autoload -# even though most modern systems don't have a 3.5" floppy driver anymore -# this replaces the old die_floppy_die.patch which removed the PNP-id from -# the module - -floppylist=("$RpmDir"/"$ModDir"/kernel/drivers/block/floppy.ko*) -if [[ -n ${floppylist[0]} && -f ${floppylist[0]} ]]; then - blacklist "floppy" -fi - -# avoid an empty kernel-extra package -echo "$ModDir/$OverrideDir" >> "$RpmDir/$ListName" - -pushd "$Dir" -rm modnames dep.list dep2.list req.list req2.list -rm "$ListName" modules2.list modules3.list -popd diff --git a/SOURCES/mod-denylist.sh b/SOURCES/mod-denylist.sh index a143c15..e5e65a2 100755 --- a/SOURCES/mod-denylist.sh +++ b/SOURCES/mod-denylist.sh @@ -1,18 +1,16 @@ #! /bin/bash # shellcheck disable=SC2164 -RpmDir=$1 -ModDir=$2 -Dir="$1/$2" -# Note the list filename must have the format mod-[PACKAGE].list, for example, -# mod-internal.list or mod-extra.list. The PACKAGE is used to create a -# override directory for the modules. -List=$3 -Dest="$4" +rpm_buildroot="$1" +module_dir="$2" +module_list="$3" + +blacklist_conf_files="$(mktemp)" blacklist() { - cat > "$RpmDir/etc/modprobe.d/$1-blacklist.conf" <<-__EOF__ + mkdir -p "$rpm_buildroot/etc/modprobe.d/" + cat > "$rpm_buildroot/etc/modprobe.d/$1-blacklist.conf" <<-__EOF__ # This kernel module can be automatically loaded by non-root users. To # enhance system security, the module is blacklisted by default to ensure # system administrators make the module available for use as needed. @@ -21,11 +19,12 @@ blacklist() # Remove the blacklist by adding a comment # at the start of the line. blacklist $1 __EOF__ + echo "%config(noreplace) /etc/modprobe.d/$1-blacklist.conf" >> "$blacklist_conf_files" } check_blacklist() { - mod=$(find "$RpmDir/$ModDir" -name "$1") + mod="$rpm_buildroot/$1" [ ! "$mod" ] && return 0 if modinfo "$mod" | grep -q '^alias:\s\+net-'; then mod="${1##*/}" @@ -35,28 +34,6 @@ check_blacklist() fi } -find_depends() -{ - dep=$1 - depends=$(modinfo "$dep" | sed -n -e "/^depends/ s/^depends:[ \t]*//p") - [ -z "$depends" ] && exit - for mod in ${depends//,/ } - do - match=$(grep "^$mod.ko" "$ListName") - [ -z "$match" ] && continue - # check if the module we are looking at is in mod-* too. - # if so we do not need to mark the dep as required. - mod2=${dep##*/} # same as $(basename $dep), but faster - match2=$(grep "^$mod2" "$ListName") - if [ -n "$match2" ] - then - #echo $mod2 >> notreq.list - continue - fi - echo "$mod".ko >> req.list - done -} - foreachp() { P=$(nproc) @@ -74,80 +51,17 @@ foreachp() wait } -# Destination was specified on the command line -test -n "$4" && echo "$0: Override Destination $Dest has been specified." - -pushd "$Dir" - -OverrideDir=$(basename "$List") -OverrideDir=${OverrideDir%.*} -OverrideDir=${OverrideDir#*-} -mkdir -p "$OverrideDir" - -rm -rf modnames -find . -name "*.ko" -type f > modnames -# Look through all of the modules, and throw any that have a dependency in -# our list into the list as well. -rm -rf dep.list dep2.list -rm -rf req.list req2.list -touch dep.list req.list -cp "$List" . - -# This variable needs to be exported because it is used in sub-script -# executed by xargs -ListName=$(basename "$List") -export ListName - -foreachp find_depends < modnames - -sort -u req.list > req2.list -sort -u "$ListName" > modules2.list -join -v 1 modules2.list req2.list > modules3.list - -while IFS= read -r mod -do - # get the path for the module - modpath=$(grep /"$mod" modnames) - [ -z "$modpath" ] && continue - echo "$modpath" >> dep.list -done < modules3.list - -sort -u dep.list > dep2.list - -if [ -n "$Dest" ]; then - # now move the modules into the $Dest directory - while IFS= read -r mod - do - newpath=$(dirname "$mod" | sed -e "s/kernel\\//$Dest\//") - mkdir -p "$newpath" - mv "$mod" "$newpath" - echo "$mod" | sed -e "s/kernel\\//$Dest\//" | sed -e "s|^.|${ModDir}|g" >> "$RpmDir"/"$ListName" - done < dep2.list -fi - -popd - -if [ -z "$Dest" ]; then - sed -e "s|^.|${ModDir}|g" "$Dir"/dep2.list > "$RpmDir/$ListName" - echo "$RpmDir/$ListName created." - [ -d "$RpmDir/etc/modprobe.d/" ] || mkdir -p "$RpmDir/etc/modprobe.d/" - foreachp check_blacklist < "$List" -fi - # Many BIOS-es export a PNP-id which causes the floppy driver to autoload # even though most modern systems don't have a 3.5" floppy driver anymore # this replaces the old die_floppy_die.patch which removed the PNP-id from # the module -floppylist=("$RpmDir"/"$ModDir"/kernel/drivers/block/floppy.ko*) +floppylist=("$rpm_buildroot"/"$module_dir"/kernel/drivers/block/floppy.ko*) if [[ -n ${floppylist[0]} && -f ${floppylist[0]} ]]; then blacklist "floppy" fi -# avoid an empty kernel-extra package -echo "$ModDir/$OverrideDir" >> "$RpmDir/$ListName" +foreachp check_blacklist < "$module_list" -pushd "$Dir" -rm modnames dep.list dep2.list req.list req2.list -rm "$ListName" modules2.list modules3.list -popd +cat "$blacklist_conf_files" >> "$module_list" +rm -f "$blacklist_conf_files" diff --git a/SOURCES/mod-extra.list b/SOURCES/mod-extra.list deleted file mode 100644 index c83fc33..0000000 --- a/SOURCES/mod-extra.list +++ /dev/null @@ -1,195 +0,0 @@ -6pack.ko -a3d.ko -act200l-sir.ko -actisys-sir.ko -adi.ko -aer_inject.ko -af_802154.ko -affs.ko -ali-ircc.ko -analog.ko -appletalk.ko -atm.ko -avma1_cs.ko -avm_cs.ko -avmfritz.ko -ax25.ko -b1.ko -bas_gigaset.ko -batman-adv.ko -baycom_par.ko -baycom_ser_fdx.ko -baycom_ser_hdx.ko -befs.ko -bpqether.ko -br2684.ko -capi.ko -c_can.ko -c_can_platform.ko -clip.ko -cobra.ko -coda.ko -cuse.ko -db9.ko -dccp_diag.ko -dccp_ipv4.ko -dccp_ipv6.ko -dccp.ko -dccp_probe.ko -diva_idi.ko -divas.ko -dlm.ko -ds1wm.ko -ds2482.ko -ds2490.ko -dss1_divert.ko -elsa_cs.ko -ems_pci.ko -ems_usb.ko -esd_usb2.ko -esi-sir.ko -floppy.ko -gamecon.ko -gf2k.ko -gfs2.ko -gigaset.ko -girbil-sir.ko -grip.ko -grip_mp.ko -guillemot.ko -hdlcdrv.ko -hfc4s8s_l1.ko -hfcmulti.ko -hfcpci.ko -hisax.ko -hwa-rc.ko -hysdn.ko -i2400m.ko -i2400m-sdio.ko -i2400m-usb.ko -ieee802154.ko -iforce.ko -interact.ko -ipddp.ko -ipx.ko -isdn.ko -joydump.ko -kingsun-sir.ko -ks959-sir.ko -ksdazzle-sir.ko -kvaser_pci.ko -l2tp_core.ko -l2tp_debugfs.ko -l2tp_eth.ko -l2tp_ip.ko -l2tp_netlink.ko -l2tp_ppp.ko -lec.ko -ma600-sir.ko -magellan.ko -mcp2120-sir.ko -mISDN_core.ko -mISDN_dsp.ko -mkiss.ko -mptbase.ko -mptctl.ko -mptfc.ko -nci.ko -ncpfs.ko -netjet.ko -netrom.ko -nfc.ko -nilfs2.ko -ocfs2_dlmfs.ko -ocfs2_dlm.ko -ocfs2.ko -ocfs2_nodemanager.ko -ocfs2_stackglue.ko -ocfs2_stack_o2cb.ko -ocfs2_stack_user.ko -old_belkin-sir.ko -orinoco_cs.ko -orinoco.ko -orinoco_nortel.ko -orinoco_pci.ko -orinoco_plx.ko -orinoco_usb.ko -pcspkr.ko -plx_pci.ko -pn_pep.ko -pppoatm.ko -rds.ko -rds_rdma.ko -rds_tcp.ko -rose.ko -sch_atm.ko -sch_cbq.ko -sch_choke.ko -sch_drr.ko -sch_dsmark.ko -sch_etf.ko -sch_gred.ko -sch_mqprio.ko -sch_multiq.ko -sch_netem.ko -sch_qfq.ko -sch_red.ko -sch_sfb.ko -sch_teql.ko -sctp.ko -sctp_probe.ko -sidewinder.ko -sja1000.ko -sja1000_platform.ko -slcan.ko -slip.ko -softing_cs.ko -softing.ko -spaceball.ko -spaceorb.ko -stinger.ko -sysv.ko -tcp_bic.ko -tcp_highspeed.ko -tcp_htcp.ko -tcp_hybla.ko -tcp_illinois.ko -tcp_lp.ko -tcp_scalable.ko -tcp_vegas.ko -tcp_veno.ko -tcp_westwood.ko -tcp_yeah.ko -tekram-sir.ko -tmdc.ko -toim3232-sir.ko -trancevibrator.ko -turbografx.ko -twidjoy.ko -ubifs.ko -ufs.ko -umc.ko -usbip-core.ko -usbip-host.ko -uwb.ko -vcan.ko -vhci-hcd.ko -w1_bq27000.ko -w1_ds2408.ko -w1_ds2423.ko -w1_ds2431.ko -w1_ds2433.ko -w1_ds2760.ko -w1_ds2780.ko -w1_ds2781.ko -w1_ds28e04.ko -w1_smem.ko -w1_therm.ko -w6692.ko -walkera0701.ko -wanrouter.ko -warrior.ko -whci.ko -wire.ko -yam.ko -zhenhua.ko diff --git a/SOURCES/mod-extra.list.fedora b/SOURCES/mod-extra.list.fedora deleted file mode 100644 index 327c7fe..0000000 --- a/SOURCES/mod-extra.list.fedora +++ /dev/null @@ -1,200 +0,0 @@ -6pack.ko -a3d.ko -act200l-sir.ko -actisys-sir.ko -adi.ko -aer_inject.ko -af_802154.ko -affs.ko -ali-ircc.ko -analog.ko -appletalk.ko -atm.ko -avma1_cs.ko -avm_cs.ko -avmfritz.ko -ax25.ko -b1.ko -bas_gigaset.ko -batman-adv.ko -baycom_par.ko -baycom_ser_fdx.ko -baycom_ser_hdx.ko -befs.ko -bpqether.ko -br2684.ko -capi.ko -c_can.ko -c_can_platform.ko -clip.ko -cobra.ko -coda.ko -cuse.ko -db9.ko -dccp_diag.ko -dccp_ipv4.ko -dccp_ipv6.ko -dccp.ko -dccp_probe.ko -diva_idi.ko -divas.ko -dlm.ko -dln2-adc.ko -dln2.ko -ds1wm.ko -ds2482.ko -ds2490.ko -dss1_divert.ko -elsa_cs.ko -ems_pci.ko -ems_usb.ko -esd_usb2.ko -esi-sir.ko -floppy.ko -gamecon.ko -gf2k.ko -gfs2.ko -gigaset.ko -girbil-sir.ko -gpio-dln2.ko -grip.ko -grip_mp.ko -guillemot.ko -hdlcdrv.ko -hfc4s8s_l1.ko -hfcmulti.ko -hfcpci.ko -hisax.ko -hwa-rc.ko -hysdn.ko -i2400m.ko -i2400m-sdio.ko -i2400m-usb.ko -i2c-dln2.ko -ieee802154.ko -iforce.ko -interact.ko -ipddp.ko -ipx.ko -isdn.ko -joydump.ko -kingsun-sir.ko -ks959-sir.ko -ksdazzle-sir.ko -kvaser_pci.ko -l2tp_core.ko -l2tp_debugfs.ko -l2tp_eth.ko -l2tp_ip.ko -l2tp_netlink.ko -l2tp_ppp.ko -lec.ko -ma600-sir.ko -magellan.ko -mcp2120-sir.ko -mISDN_core.ko -mISDN_dsp.ko -mkiss.ko -mptbase.ko -mptctl.ko -mptfc.ko -nci.ko -ncpfs.ko -netjet.ko -netrom.ko -nfc.ko -nilfs2.ko -ocfs2_dlmfs.ko -ocfs2_dlm.ko -ocfs2.ko -ocfs2_nodemanager.ko -ocfs2_stackglue.ko -ocfs2_stack_o2cb.ko -ocfs2_stack_user.ko -old_belkin-sir.ko -orinoco_cs.ko -orinoco.ko -orinoco_nortel.ko -orinoco_pci.ko -orinoco_plx.ko -orinoco_usb.ko -pcspkr.ko -plx_pci.ko -pn_pep.ko -pppoatm.ko -rds.ko -rds_rdma.ko -rds_tcp.ko -rose.ko -sch_atm.ko -sch_cbq.ko -sch_choke.ko -sch_drr.ko -sch_dsmark.ko -sch_etf.ko -sch_gred.ko -sch_mqprio.ko -sch_multiq.ko -sch_netem.ko -sch_qfq.ko -sch_red.ko -sch_sfb.ko -sch_teql.ko -sctp.ko -sctp_probe.ko -sidewinder.ko -sja1000.ko -sja1000_platform.ko -slcan.ko -slip.ko -softing_cs.ko -softing.ko -spaceball.ko -spaceorb.ko -spi-dln2.ko -stinger.ko -sysv.ko -tcp_bic.ko -tcp_highspeed.ko -tcp_htcp.ko -tcp_hybla.ko -tcp_illinois.ko -tcp_lp.ko -tcp_scalable.ko -tcp_vegas.ko -tcp_veno.ko -tcp_westwood.ko -tcp_yeah.ko -tekram-sir.ko -tmdc.ko -toim3232-sir.ko -trancevibrator.ko -turbografx.ko -twidjoy.ko -ubifs.ko -ufs.ko -umc.ko -usbip-core.ko -usbip-host.ko -uwb.ko -vcan.ko -vhci-hcd.ko -w1_bq27000.ko -w1_ds2408.ko -w1_ds2423.ko -w1_ds2431.ko -w1_ds2433.ko -w1_ds2760.ko -w1_ds2780.ko -w1_ds2781.ko -w1_ds28e04.ko -w1_smem.ko -w1_therm.ko -w6692.ko -walkera0701.ko -wanrouter.ko -warrior.ko -whci.ko -wire.ko -yam.ko -zhenhua.ko diff --git a/SOURCES/mod-extra.list.rhel b/SOURCES/mod-extra.list.rhel deleted file mode 100644 index 27be547..0000000 --- a/SOURCES/mod-extra.list.rhel +++ /dev/null @@ -1,326 +0,0 @@ -6pack.ko -a3d.ko -act200l-sir.ko -actisys-sir.ko -adi.ko -aer_inject.ko -af_802154.ko -affs.ko -ali-ircc.ko -analog.ko -appletalk.ko -arptable_filter.ko -arp_tables.ko -arpt_mangle.ko -atm.ko -avma1_cs.ko -avm_cs.ko -avmfritz.ko -ax25.ko -b1.ko -bas_gigaset.ko -batman-adv.ko -baycom_par.ko -baycom_ser_fdx.ko -baycom_ser_hdx.ko -befs.ko -bpqether.ko -br2684.ko -br_netfilter.ko -capi.ko -c_can.ko -c_can_platform.ko -clip.ko -cobra.ko -coda.ko -cuse.ko -db9.ko -dccp_diag.ko -dccp_ipv4.ko -dccp_ipv6.ko -dccp.ko -dccp_probe.ko -diva_idi.ko -divas.ko -ds1wm.ko -ds2482.ko -ds2490.ko -dss1_divert.ko -ebt_802_3.ko -ebtable_broute.ko -ebtable_filter.ko -ebtable_nat.ko -ebtables.ko -ebt_among.ko -ebt_arp.ko -ebt_arpreply.ko -ebt_dnat.ko -ebt_ip6.ko -ebt_ip.ko -ebt_limit.ko -ebt_log.ko -ebt_mark.ko -ebt_mark_m.ko -ebt_nflog.ko -ebt_pkttype.ko -ebt_redirect.ko -ebt_snat.ko -ebt_stp.ko -ebt_vlan.ko -elsa_cs.ko -ems_pci.ko -ems_usb.ko -esd_usb2.ko -esi-sir.ko -gamecon.ko -gf2k.ko -gigaset.ko -girbil-sir.ko -grip.ko -grip_mp.ko -guillemot.ko -hdlcdrv.ko -hfc4s8s_l1.ko -hfcmulti.ko -hfcpci.ko -hisax.ko -hwa-rc.ko -hysdn.ko -i2400m.ko -i2400m-sdio.ko -i2400m-usb.ko -ieee802154.ko -iforce.ko -interact.ko -ip6table_filter.ko -ip6table_mangle.ko -ip6table_nat.ko -ip6table_raw.ko -ip6table_security.ko -ip6_tables.ko -ip6t_ah.ko -ip6t_eui64.ko -ip6t_frag.ko -ip6t_hbh.ko -ip6t_ipv6header.ko -ip6t_mh.ko -ip6t_NPT.ko -ip6t_REJECT.ko -ip6t_rpfilter.ko -ip6t_rt.ko -ipddp.ko -ip_set_bitmap_ip.ko -ip_set_bitmap_ipmac.ko -ip_set_bitmap_port.ko -ip_set_hash_ip.ko -ip_set_hash_ipmac.ko -ip_set_hash_ipmark.ko -ip_set_hash_ipportip.ko -ip_set_hash_ipport.ko -ip_set_hash_ipportnet.ko -ip_set_hash_mac.ko -ip_set_hash_netiface.ko -ip_set_hash_net.ko -ip_set_hash_netnet.ko -ip_set_hash_netport.ko -ip_set_hash_netportnet.ko -ip_set.ko -ip_set_list_set.ko -iptable_filter.ko -iptable_mangle.ko -iptable_nat.ko -iptable_raw.ko -iptable_security.ko -ip_tables.ko -ipt_ah.ko -ipt_ECN.ko -ipt_REJECT.ko -ipt_rpfilter.ko -ipx.ko -isdn.ko -joydump.ko -kingsun-sir.ko -ks959-sir.ko -ksdazzle-sir.ko -kvaser_pci.ko -l2tp_core.ko -l2tp_debugfs.ko -l2tp_eth.ko -l2tp_ip.ko -l2tp_ip6.ko -l2tp_netlink.ko -l2tp_ppp.ko -lec.ko -ma600-sir.ko -magellan.ko -mcp2120-sir.ko -mISDN_core.ko -mISDN_dsp.ko -mkiss.ko -mptbase.ko -mptctl.ko -mptfc.ko -nci.ko -ncpfs.ko -netjet.ko -netrom.ko -nfc.ko -nft_compat.ko -nilfs2.ko -ocfs2_dlmfs.ko -ocfs2_dlm.ko -ocfs2.ko -ocfs2_nodemanager.ko -ocfs2_stackglue.ko -ocfs2_stack_o2cb.ko -ocfs2_stack_user.ko -old_belkin-sir.ko -orinoco_cs.ko -orinoco.ko -orinoco_nortel.ko -orinoco_pci.ko -orinoco_plx.ko -orinoco_usb.ko -plx_pci.ko -pn_pep.ko -pppoatm.ko -rds.ko -rds_rdma.ko -rds_tcp.ko -rose.ko -sch_atm.ko -sch_cbq.ko -sch_choke.ko -sch_drr.ko -sch_dsmark.ko -sch_gred.ko -sch_mqprio.ko -sch_multiq.ko -sch_netem.ko -sch_qfq.ko -sch_red.ko -sch_sfb.ko -sch_teql.ko -sctp.ko -sctp_diag.ko -sctp_probe.ko -sidewinder.ko -sja1000.ko -sja1000_platform.ko -slcan.ko -slip.ko -softing_cs.ko -softing.ko -spaceball.ko -spaceorb.ko -stinger.ko -sysv.ko -tcp_bic.ko -tcp_highspeed.ko -tcp_htcp.ko -tcp_hybla.ko -tcp_illinois.ko -tcp_lp.ko -tcp_scalable.ko -tcp_vegas.ko -tcp_veno.ko -tcp_westwood.ko -tcp_yeah.ko -tekram-sir.ko -tmdc.ko -toim3232-sir.ko -trancevibrator.ko -turbografx.ko -twidjoy.ko -ubifs.ko -ufs.ko -umc.ko -usbip-core.ko -usbip-host.ko -uwb.ko -vcan.ko -vhci-hcd.ko -w1_bq27000.ko -w1_ds2408.ko -w1_ds2423.ko -w1_ds2431.ko -w1_ds2433.ko -w1_ds2760.ko -w1_ds2780.ko -w1_ds2781.ko -w1_ds28e04.ko -w1_smem.ko -w1_therm.ko -w6692.ko -walkera0701.ko -wanrouter.ko -warrior.ko -whci.ko -wire.ko -xt_addrtype.ko -xt_AUDIT.ko -xt_bpf.ko -xt_cgroup.ko -xt_CHECKSUM.ko -xt_CLASSIFY.ko -xt_cluster.ko -xt_comment.ko -xt_connbytes.ko -xt_connlabel.ko -xt_connlimit.ko -xt_connmark.ko -xt_CONNSECMARK.ko -xt_conntrack.ko -xt_cpu.ko -xt_CT.ko -xt_dccp.ko -xt_devgroup.ko -xt_dscp.ko -xt_DSCP.ko -xt_ecn.ko -xt_esp.ko -xt_hashlimit.ko -xt_helper.ko -xt_hl.ko -xt_HL.ko -xt_HMARK.ko -xt_IDLETIMER.ko -xt_iprange.ko -xt_ipvs.ko -xt_length.ko -xt_limit.ko -xt_LOG.ko -xt_mac.ko -xt_mark.ko -xt_MASQUERADE.ko -xt_multiport.ko -xt_nat.ko -xt_NETMAP.ko -xt_NFLOG.ko -xt_NFQUEUE.ko -xt_osf.ko -xt_owner.ko -xt_physdev.ko -xt_pkttype.ko -xt_policy.ko -xt_quota.ko -xt_rateest.ko -xt_RATEEST.ko -xt_realm.ko -xt_recent.ko -xt_REDIRECT.ko -xt_sctp.ko -xt_SECMARK.ko -xt_set.ko -xt_socket.ko -xt_state.ko -xt_statistic.ko -xt_string.ko -xt_tcpmss.ko -xt_TCPMSS.ko -xt_TCPOPTSTRIP.ko -xt_TEE.ko -xt_TPROXY.ko -xt_TRACE.ko -yam.ko -zhenhua.ko diff --git a/SOURCES/mod-internal.list b/SOURCES/mod-internal.list deleted file mode 100644 index 5a473b1..0000000 --- a/SOURCES/mod-internal.list +++ /dev/null @@ -1,99 +0,0 @@ -bitfield_kunit -checksum_kunit -cfg80211-tests -clk-fractional-divider_test -clk-gate_test -clk_test -cmdline_kunit -cpumask_kunit -cros_kunit -dev_addr_lists_test -dmatest -drm_buddy_test -drm_cmdline_parser_test -drm_connector_test -drm_damage_helper_test -drm_dp_mst_helper_test -drm_exec_test -drm_format_helper_test -drm_format_test -drm_framebuffer_test -drm_gem_shmem_test -drm_kunit_helpers -drm_managed_test -drm_mm_test -drm_modes_test -drm_plane_helper_test -drm_probe_helper_test -drm_exec_test -drm_rect_test -ext4-inode-test -fat_test -fortify_kunit -gso_test -gss_krb5_test -handshake-test -hashtable_test -hid-uclogic-test -iio-test-format -iio-test-rescale -input_test -is_signed_type_kunit -kasan_test -kfence_test -kunit -kunit-test -lib_test -list-test -locktorture -mac80211_hwsim -mac80211-tests -mean_and_variance_test -memcpy_kunit -mptcp_crypto_test -mptcp_token_test -mtty -netdevsim -overflow_kunit -pktgen -property-entry-test -rational-test -rcuscale -rcutorture -refscale -regmap-kunit -resource_kunit -rocker -scftorture -siphash_kunit -slub_kunit -snd-hda-cirrus-scodec-test -soc-topology-test -soc-utils-test -stackinit_kunit -strcat_kunit -strscpy_kunit -sysctl-test -test_bits -test_bpf -test_hash -test_hmm -test_kasan -test_klp_atomic_replace -test_klp_callbacks_busy -test_klp_callbacks_demo -test_klp_callbacks_demo2 -test_klp_callbacks_mod -test_klp_livepatch -test_klp_shadow_vars -test_klp_state -test_klp_state2 -test_klp_state3 -test_kprobes -test_linear_ranges -test_list_sort -test_sort -test_vmalloc -time_test -torture -wwan_hwsim diff --git a/SOURCES/mod-kvm.list b/SOURCES/mod-kvm.list deleted file mode 100644 index 38f5c49..0000000 --- a/SOURCES/mod-kvm.list +++ /dev/null @@ -1,5 +0,0 @@ -kvm-amd -kvm-intel -kvm -kvmgt -ptp_kvm diff --git a/SOURCES/mod-partner.list b/SOURCES/mod-partner.list deleted file mode 100644 index 9cd36e5..0000000 --- a/SOURCES/mod-partner.list +++ /dev/null @@ -1,2 +0,0 @@ -afs -rxrpc diff --git a/SOURCES/parallel_xz.sh b/SOURCES/parallel_xz.sh deleted file mode 100755 index f1b6cdd..0000000 --- a/SOURCES/parallel_xz.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# Reads filenames on stdin, xz-compresses each in place. -# Not optimal for "compress relatively few, large files" scenario! - -# How many xz's to run in parallel: -procgroup="" -while test "$#" != 0; do - # Get it from -jNUM - N="${1#-j}" - if test "$N" = "$1"; then - # Not -j - warn and ignore - echo "parallel_xz: warning: unrecognized argument: '$1'" - else - procgroup="$N" - fi - shift -done - -# If told to use only one cpu: -test "$procgroup" || exec xargs -r xz -test "$procgroup" = 1 && exec xargs -r xz - -# xz has some startup cost. If files are really small, -# this cost might be significant. To combat this, -# process several files (in sequence) by each xz process via -n 16: -exec xargs -r -n 16 -P "$procgroup" xz diff --git a/SOURCES/patch-6.9-redhat.patch b/SOURCES/patch-6.9-redhat.patch new file mode 100644 index 0000000..d0d5c3b --- /dev/null +++ b/SOURCES/patch-6.9-redhat.patch @@ -0,0 +1,1775 @@ + Kconfig | 2 + + Kconfig.redhat | 17 +++ + Makefile | 12 ++ + arch/s390/include/asm/ipl.h | 1 + + arch/s390/kernel/ipl.c | 5 + + arch/s390/kernel/setup.c | 4 + + arch/x86/kernel/setup.c | 22 ++- + crypto/drbg.c | 18 ++- + crypto/rng.c | 149 ++++++++++++++++++--- + drivers/acpi/apei/hest.c | 8 ++ + drivers/acpi/irq.c | 17 ++- + drivers/acpi/scan.c | 9 ++ + drivers/ata/libahci.c | 18 +++ + drivers/char/ipmi/ipmi_dmi.c | 15 +++ + drivers/char/ipmi/ipmi_msghandler.c | 16 ++- + drivers/char/random.c | 122 +++++++++++++++++ + drivers/firmware/efi/Makefile | 1 + + drivers/firmware/efi/efi.c | 124 ++++++++++++----- + drivers/firmware/efi/secureboot.c | 38 ++++++ + drivers/hid/hid-rmi.c | 66 --------- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 19 +++ + drivers/input/rmi4/rmi_driver.c | 124 ++++++++++------- + drivers/iommu/iommu.c | 22 +++ + drivers/pci/quirks.c | 24 ++++ + drivers/scsi/sd.c | 10 ++ + drivers/usb/core/hub.c | 7 + + include/linux/crypto.h | 1 + + include/linux/efi.h | 22 ++- + include/linux/lsm_hook_defs.h | 2 + + include/linux/random.h | 10 ++ + include/linux/rmi.h | 1 + + include/linux/security.h | 5 + + kernel/module/signing.c | 9 +- + scripts/tags.sh | 2 + + security/integrity/platform_certs/load_uefi.c | 6 +- + security/lockdown/Kconfig | 13 ++ + security/lockdown/lockdown.c | 1 + + security/security.c | 12 ++ + 38 files changed, 762 insertions(+), 192 deletions(-) + +diff --git a/Kconfig b/Kconfig +index 745bc773f567..f57ff40109d7 100644 +--- a/Kconfig ++++ b/Kconfig +@@ -30,3 +30,5 @@ source "lib/Kconfig" + source "lib/Kconfig.debug" + + source "Documentation/Kconfig" ++ ++source "Kconfig.redhat" +diff --git a/Kconfig.redhat b/Kconfig.redhat +new file mode 100644 +index 000000000000..733a26bd887a +--- /dev/null ++++ b/Kconfig.redhat +@@ -0,0 +1,17 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++# ++# Red Hat specific options ++# ++ ++menu "Red Hat options" ++ ++config RH_DISABLE_DEPRECATED ++ bool "Remove support for deprecated features" ++ help ++ Red Hat may choose to deprecate certain features in its kernels. ++ Enable this option to remove support for hardware that is no ++ longer supported. ++ ++ Unless you want a restricted kernel, say N here. ++ ++endmenu +diff --git a/Makefile b/Makefile +index 91f1d4d34e80..9f03c9efab0d 100644 +--- a/Makefile ++++ b/Makefile +@@ -22,6 +22,18 @@ $(if $(filter __%, $(MAKECMDGOALS)), \ + PHONY := __all + __all: + ++# Set RHEL variables ++# Note that this ifdef'ery is required to handle when building with ++# the O= mechanism (relocate the object file results) due to upstream ++# commit 67d7c302 which broke our RHEL include file ++ifneq ($(realpath source),) ++include $(realpath source)/Makefile.rhelver ++else ++ifneq ($(realpath Makefile.rhelver),) ++include Makefile.rhelver ++endif ++endif ++ + # We are using a recursive build, so we need to do a little thinking + # to get the ordering right. + # +diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h +index b0d00032479d..afb9544fb007 100644 +--- a/arch/s390/include/asm/ipl.h ++++ b/arch/s390/include/asm/ipl.h +@@ -139,6 +139,7 @@ int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf, + unsigned char flags, unsigned short cert); + int ipl_report_add_certificate(struct ipl_report *report, void *key, + unsigned long addr, unsigned long len); ++bool ipl_get_secureboot(void); + + /* + * DIAG 308 support +diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c +index 469e8d3fbfbf..3ce742cd61c3 100644 +--- a/arch/s390/kernel/ipl.c ++++ b/arch/s390/kernel/ipl.c +@@ -2519,3 +2519,8 @@ int ipl_report_free(struct ipl_report *report) + } + + #endif ++ ++bool ipl_get_secureboot(void) ++{ ++ return !!ipl_secure_flag; ++} +diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c +index 7ecd27c62d56..cad68dfba646 100644 +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -891,6 +892,9 @@ void __init setup_arch(char **cmdline_p) + + log_component_list(); + ++ if (ipl_get_secureboot()) ++ security_lock_kernel_down("Secure IPL mode", LOCKDOWN_INTEGRITY_MAX); ++ + /* Have one command line that is parsed and saved in /proc/cmdline */ + /* boot_command_line has been already set up in early.c */ + *cmdline_p = boot_command_line; +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c +index e125e059e2c4..9cfd28e580e0 100644 +--- a/arch/x86/kernel/setup.c ++++ b/arch/x86/kernel/setup.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -901,6 +902,13 @@ void __init setup_arch(char **cmdline_p) + if (efi_enabled(EFI_BOOT)) + efi_init(); + ++ efi_set_secure_boot(boot_params.secure_boot); ++ ++#ifdef CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT ++ if (efi_enabled(EFI_SECURE_BOOT)) ++ security_lock_kernel_down("EFI Secure Boot mode", LOCKDOWN_INTEGRITY_MAX); ++#endif ++ + reserve_ibft_region(); + x86_init.resources.dmi_setup(); + +@@ -1063,19 +1071,7 @@ void __init setup_arch(char **cmdline_p) + /* Allocate bigger log buffer */ + setup_log_buf(1); + +- if (efi_enabled(EFI_BOOT)) { +- switch (boot_params.secure_boot) { +- case efi_secureboot_mode_disabled: +- pr_info("Secure boot disabled\n"); +- break; +- case efi_secureboot_mode_enabled: +- pr_info("Secure boot enabled\n"); +- break; +- default: +- pr_info("Secure boot could not be determined\n"); +- break; +- } +- } ++ efi_set_secure_boot(boot_params.secure_boot); + + reserve_initrd(); + +diff --git a/crypto/drbg.c b/crypto/drbg.c +index 3addce90930c..730b03de596a 100644 +--- a/crypto/drbg.c ++++ b/crypto/drbg.c +@@ -1494,13 +1494,14 @@ static int drbg_generate(struct drbg_state *drbg, + * Wrapper around drbg_generate which can pull arbitrary long strings + * from the DRBG without hitting the maximum request limitation. + * +- * Parameters: see drbg_generate ++ * Parameters: see drbg_generate, except @reseed, which triggers reseeding + * Return codes: see drbg_generate -- if one drbg_generate request fails, + * the entire drbg_generate_long request fails + */ + static int drbg_generate_long(struct drbg_state *drbg, + unsigned char *buf, unsigned int buflen, +- struct drbg_string *addtl) ++ struct drbg_string *addtl, ++ bool reseed) + { + unsigned int len = 0; + unsigned int slice = 0; +@@ -1510,6 +1511,8 @@ static int drbg_generate_long(struct drbg_state *drbg, + slice = ((buflen - len) / drbg_max_request_bytes(drbg)); + chunk = slice ? drbg_max_request_bytes(drbg) : (buflen - len); + mutex_lock(&drbg->drbg_mutex); ++ if (reseed) ++ drbg->seeded = DRBG_SEED_STATE_UNSEEDED; + err = drbg_generate(drbg, buf + len, chunk, addtl); + mutex_unlock(&drbg->drbg_mutex); + if (0 > err) +@@ -1936,6 +1939,7 @@ static int drbg_kcapi_random(struct crypto_rng *tfm, + struct drbg_state *drbg = crypto_rng_ctx(tfm); + struct drbg_string *addtl = NULL; + struct drbg_string string; ++ int err; + + if (slen) { + /* linked list variable is now local to allow modification */ +@@ -1943,7 +1947,15 @@ static int drbg_kcapi_random(struct crypto_rng *tfm, + addtl = &string; + } + +- return drbg_generate_long(drbg, dst, dlen, addtl); ++ err = drbg_generate_long(drbg, dst, dlen, addtl, ++ (crypto_tfm_get_flags(crypto_rng_tfm(tfm)) & ++ CRYPTO_TFM_REQ_NEED_RESEED) == ++ CRYPTO_TFM_REQ_NEED_RESEED); ++ ++ crypto_tfm_clear_flags(crypto_rng_tfm(tfm), ++ CRYPTO_TFM_REQ_NEED_RESEED); ++ ++ return err; + } + + /* +diff --git a/crypto/rng.c b/crypto/rng.c +index 279dffdebf59..d24dd37205cd 100644 +--- a/crypto/rng.c ++++ b/crypto/rng.c +@@ -12,10 +12,13 @@ + #include + #include + #include ++#include + #include + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -23,7 +26,9 @@ + + #include "internal.h" + +-static DEFINE_MUTEX(crypto_default_rng_lock); ++static ____cacheline_aligned_in_smp DEFINE_MUTEX(crypto_reseed_rng_lock); ++static struct crypto_rng *crypto_reseed_rng; ++static ____cacheline_aligned_in_smp DEFINE_MUTEX(crypto_default_rng_lock); + struct crypto_rng *crypto_default_rng; + EXPORT_SYMBOL_GPL(crypto_default_rng); + static int crypto_default_rng_refcnt; +@@ -136,31 +141,37 @@ struct crypto_rng *crypto_alloc_rng(const char *alg_name, u32 type, u32 mask) + } + EXPORT_SYMBOL_GPL(crypto_alloc_rng); + +-int crypto_get_default_rng(void) ++static int crypto_get_rng(struct crypto_rng **rngp) + { + struct crypto_rng *rng; + int err; + +- mutex_lock(&crypto_default_rng_lock); +- if (!crypto_default_rng) { ++ if (!*rngp) { + rng = crypto_alloc_rng("stdrng", 0, 0); + err = PTR_ERR(rng); + if (IS_ERR(rng)) +- goto unlock; ++ return err; + + err = crypto_rng_reset(rng, NULL, crypto_rng_seedsize(rng)); + if (err) { + crypto_free_rng(rng); +- goto unlock; ++ return err; + } + +- crypto_default_rng = rng; ++ *rngp = rng; + } + +- crypto_default_rng_refcnt++; +- err = 0; ++ return 0; ++} ++ ++int crypto_get_default_rng(void) ++{ ++ int err; + +-unlock: ++ mutex_lock(&crypto_default_rng_lock); ++ err = crypto_get_rng(&crypto_default_rng); ++ if (!err) ++ crypto_default_rng_refcnt++; + mutex_unlock(&crypto_default_rng_lock); + + return err; +@@ -176,24 +187,33 @@ void crypto_put_default_rng(void) + EXPORT_SYMBOL_GPL(crypto_put_default_rng); + + #if defined(CONFIG_CRYPTO_RNG) || defined(CONFIG_CRYPTO_RNG_MODULE) +-int crypto_del_default_rng(void) ++static int crypto_del_rng(struct crypto_rng **rngp, int *refcntp, ++ struct mutex *lock) + { + int err = -EBUSY; + +- mutex_lock(&crypto_default_rng_lock); +- if (crypto_default_rng_refcnt) ++ mutex_lock(lock); ++ if (refcntp && *refcntp) + goto out; + +- crypto_free_rng(crypto_default_rng); +- crypto_default_rng = NULL; ++ crypto_free_rng(*rngp); ++ *rngp = NULL; + + err = 0; + + out: +- mutex_unlock(&crypto_default_rng_lock); ++ mutex_unlock(lock); + + return err; + } ++ ++int crypto_del_default_rng(void) ++{ ++ return crypto_del_rng(&crypto_default_rng, &crypto_default_rng_refcnt, ++ &crypto_default_rng_lock) ?: ++ crypto_del_rng(&crypto_reseed_rng, NULL, ++ &crypto_reseed_rng_lock); ++} + EXPORT_SYMBOL_GPL(crypto_del_default_rng); + #endif + +@@ -251,5 +271,102 @@ void crypto_unregister_rngs(struct rng_alg *algs, int count) + } + EXPORT_SYMBOL_GPL(crypto_unregister_rngs); + ++static ssize_t crypto_devrandom_read_iter(struct iov_iter *iter, bool reseed) ++{ ++ struct crypto_rng *rng; ++ u8 tmp[256]; ++ ssize_t ret; ++ ++ if (unlikely(!iov_iter_count(iter))) ++ return 0; ++ ++ if (reseed) { ++ u32 flags = 0; ++ ++ /* If reseeding is requested, acquire a lock on ++ * crypto_reseed_rng so it is not swapped out until ++ * the initial random bytes are generated. ++ * ++ * The algorithm implementation is also protected with ++ * a separate mutex (drbg->drbg_mutex) around the ++ * reseed-and-generate operation. ++ */ ++ mutex_lock(&crypto_reseed_rng_lock); ++ ++ /* If crypto_default_rng is not set, it will be seeded ++ * at creation in __crypto_get_default_rng and thus no ++ * reseeding is needed. ++ */ ++ if (crypto_reseed_rng) ++ flags |= CRYPTO_TFM_REQ_NEED_RESEED; ++ ++ ret = crypto_get_rng(&crypto_reseed_rng); ++ if (ret) { ++ mutex_unlock(&crypto_reseed_rng_lock); ++ return ret; ++ } ++ ++ rng = crypto_reseed_rng; ++ crypto_tfm_set_flags(crypto_rng_tfm(rng), flags); ++ } else { ++ ret = crypto_get_default_rng(); ++ if (ret) ++ return ret; ++ rng = crypto_default_rng; ++ } ++ ++ for (;;) { ++ size_t i, copied; ++ int err; ++ ++ i = min_t(size_t, iov_iter_count(iter), sizeof(tmp)); ++ err = crypto_rng_get_bytes(rng, tmp, i); ++ if (err) { ++ ret = err; ++ break; ++ } ++ ++ copied = copy_to_iter(tmp, i, iter); ++ ret += copied; ++ ++ if (!iov_iter_count(iter)) ++ break; ++ ++ if (need_resched()) { ++ if (signal_pending(current)) ++ break; ++ schedule(); ++ } ++ } ++ ++ if (reseed) ++ mutex_unlock(&crypto_reseed_rng_lock); ++ else ++ crypto_put_default_rng(); ++ memzero_explicit(tmp, sizeof(tmp)); ++ ++ return ret; ++} ++ ++static const struct random_extrng crypto_devrandom_rng = { ++ .extrng_read_iter = crypto_devrandom_read_iter, ++ .owner = THIS_MODULE, ++}; ++ ++static int __init crypto_rng_init(void) ++{ ++ if (fips_enabled) ++ random_register_extrng(&crypto_devrandom_rng); ++ return 0; ++} ++ ++static void __exit crypto_rng_exit(void) ++{ ++ random_unregister_extrng(); ++} ++ ++late_initcall(crypto_rng_init); ++module_exit(crypto_rng_exit); ++ + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("Random Number Generator"); +diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c +index 20d757687e3d..90a13f20f052 100644 +--- a/drivers/acpi/apei/hest.c ++++ b/drivers/acpi/apei/hest.c +@@ -142,6 +142,14 @@ static int apei_hest_parse(apei_hest_func_t func, void *data) + if (hest_disable || !hest_tab) + return -EINVAL; + ++#ifdef CONFIG_ARM64 ++ /* Ignore broken firmware */ ++ if (!strncmp(hest_tab->header.oem_id, "HPE ", 6) && ++ !strncmp(hest_tab->header.oem_table_id, "ProLiant", 8) && ++ MIDR_IMPLEMENTOR(read_cpuid_id()) == ARM_CPU_IMP_APM) ++ return -EINVAL; ++#endif ++ + hest_hdr = (struct acpi_hest_header *)(hest_tab + 1); + for (i = 0; i < hest_tab->error_source_count; i++) { + len = hest_esrc_len(hest_hdr); +diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c +index 1687483ff319..390b67f19181 100644 +--- a/drivers/acpi/irq.c ++++ b/drivers/acpi/irq.c +@@ -143,6 +143,7 @@ struct acpi_irq_parse_one_ctx { + unsigned int index; + unsigned long *res_flags; + struct irq_fwspec *fwspec; ++ bool skip_producer_check; + }; + + /** +@@ -216,7 +217,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares, + return AE_CTRL_TERMINATE; + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + eirq = &ares->data.extended_irq; +- if (eirq->producer_consumer == ACPI_PRODUCER) ++ if (!ctx->skip_producer_check && ++ eirq->producer_consumer == ACPI_PRODUCER) + return AE_OK; + if (ctx->index >= eirq->interrupt_count) { + ctx->index -= eirq->interrupt_count; +@@ -252,8 +254,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares, + static int acpi_irq_parse_one(acpi_handle handle, unsigned int index, + struct irq_fwspec *fwspec, unsigned long *flags) + { +- struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec }; ++ struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false }; + ++ /* ++ * Firmware on arm64-based HPE m400 platform incorrectly marks ++ * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER. ++ * Don't do the producer/consumer check for that device. ++ */ ++ if (IS_ENABLED(CONFIG_ARM64)) { ++ struct acpi_device *adev = acpi_get_acpi_dev(handle); ++ ++ if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08")) ++ ctx.skip_producer_check = true; ++ } + acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx); + return ctx.rc; + } +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c +index d1464324de95..a3b2f99a2d78 100644 +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -1798,6 +1798,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) + if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) + return false; + ++ /* ++ * Firmware on some arm64 X-Gene platforms will make the UART ++ * device appear as both a UART and a slave of that UART. Just ++ * bail out here for X-Gene UARTs. ++ */ ++ if (IS_ENABLED(CONFIG_ARM64) && ++ !strcmp(acpi_device_hid(device), "APMC0D08")) ++ return false; ++ + INIT_LIST_HEAD(&resource_list); + acpi_dev_get_resources(device, &resource_list, + acpi_check_serial_bus_slave, +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c +index 83431aae74d8..f2a9c0d644af 100644 +--- a/drivers/ata/libahci.c ++++ b/drivers/ata/libahci.c +@@ -729,6 +729,24 @@ int ahci_stop_engine(struct ata_port *ap) + tmp &= ~PORT_CMD_START; + writel(tmp, port_mmio + PORT_CMD); + ++#ifdef CONFIG_ARM64 ++ /* Rev Ax of Cavium CN99XX needs a hack for port stop */ ++ if (dev_is_pci(ap->host->dev) && ++ to_pci_dev(ap->host->dev)->vendor == 0x14e4 && ++ to_pci_dev(ap->host->dev)->device == 0x9027 && ++ midr_is_cpu_model_range(read_cpuid_id(), ++ MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN), ++ MIDR_CPU_VAR_REV(0, 0), ++ MIDR_CPU_VAR_REV(0, MIDR_REVISION_MASK))) { ++ tmp = readl(hpriv->mmio + 0x8000); ++ udelay(100); ++ writel(tmp | (1 << 26), hpriv->mmio + 0x8000); ++ udelay(100); ++ writel(tmp & ~(1 << 26), hpriv->mmio + 0x8000); ++ dev_warn(ap->host->dev, "CN99XX SATA reset workaround applied\n"); ++ } ++#endif ++ + /* wait for engine to stop. This could be as long as 500 msec */ + tmp = ata_wait_register(ap, port_mmio + PORT_CMD, + PORT_CMD_LIST_ON, PORT_CMD_LIST_ON, 1, 500); +diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c +index bbf7029e224b..cf7faa970dd6 100644 +--- a/drivers/char/ipmi/ipmi_dmi.c ++++ b/drivers/char/ipmi/ipmi_dmi.c +@@ -215,6 +215,21 @@ static int __init scan_for_dmi_ipmi(void) + { + const struct dmi_device *dev = NULL; + ++#ifdef CONFIG_ARM64 ++ /* RHEL-only ++ * If this is ARM-based HPE m400, return now, because that platform ++ * reports the host-side ipmi address as intel port-io space, which ++ * does not exist in the ARM architecture. ++ */ ++ const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME); ++ ++ if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) { ++ pr_debug("%s does not support host ipmi\n", dmistr); ++ return 0; ++ } ++ /* END RHEL-only */ ++#endif ++ + while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) + dmi_decode_ipmi((const struct dmi_header *) dev->device_data); + +diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c +index b0eedc4595b3..a9024c1dd68a 100644 +--- a/drivers/char/ipmi/ipmi_msghandler.c ++++ b/drivers/char/ipmi/ipmi_msghandler.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + + #define IPMI_DRIVER_VERSION "39.2" +@@ -5511,8 +5512,21 @@ static int __init ipmi_init_msghandler_mod(void) + { + int rv; + +- pr_info("version " IPMI_DRIVER_VERSION "\n"); ++#ifdef CONFIG_ARM64 ++ /* RHEL-only ++ * If this is ARM-based HPE m400, return now, because that platform ++ * reports the host-side ipmi address as intel port-io space, which ++ * does not exist in the ARM architecture. ++ */ ++ const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME); + ++ if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) { ++ pr_debug("%s does not support host ipmi\n", dmistr); ++ return -ENOSYS; ++ } ++ /* END RHEL-only */ ++#endif ++ pr_info("version " IPMI_DRIVER_VERSION "\n"); + mutex_lock(&ipmi_interfaces_mutex); + rv = ipmi_register_driver(); + mutex_unlock(&ipmi_interfaces_mutex); +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 2597cb43f438..d860f4f6ba2c 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -309,6 +310,11 @@ static void crng_fast_key_erasure(u8 key[CHACHA_KEY_SIZE], + memzero_explicit(first_block, sizeof(first_block)); + } + ++/* ++ * Hook for external RNG. ++ */ ++static const struct random_extrng __rcu *extrng; ++ + /* + * This function returns a ChaCha state that you may use for generating + * random data. It also returns up to 32 bytes on its own of random data +@@ -739,6 +745,9 @@ static void __cold _credit_init_bits(size_t bits) + } + + ++static const struct file_operations extrng_random_fops; ++static const struct file_operations extrng_urandom_fops; ++ + /********************************************************************** + * + * Entropy collection routines. +@@ -956,6 +965,19 @@ void __init add_bootloader_randomness(const void *buf, size_t len) + credit_init_bits(len * 8); + } + ++void random_register_extrng(const struct random_extrng *rng) ++{ ++ rcu_assign_pointer(extrng, rng); ++} ++EXPORT_SYMBOL_GPL(random_register_extrng); ++ ++void random_unregister_extrng(void) ++{ ++ RCU_INIT_POINTER(extrng, NULL); ++ synchronize_rcu(); ++} ++EXPORT_SYMBOL_GPL(random_unregister_extrng); ++ + #if IS_ENABLED(CONFIG_VMGENID) + static BLOCKING_NOTIFIER_HEAD(vmfork_chain); + +@@ -1365,6 +1387,7 @@ SYSCALL_DEFINE3(getrandom, char __user *, ubuf, size_t, len, unsigned int, flags + { + struct iov_iter iter; + int ret; ++ const struct random_extrng *rng; + + if (flags & ~(GRND_NONBLOCK | GRND_RANDOM | GRND_INSECURE)) + return -EINVAL; +@@ -1376,6 +1399,21 @@ SYSCALL_DEFINE3(getrandom, char __user *, ubuf, size_t, len, unsigned int, flags + if ((flags & (GRND_INSECURE | GRND_RANDOM)) == (GRND_INSECURE | GRND_RANDOM)) + return -EINVAL; + ++ rcu_read_lock(); ++ rng = rcu_dereference(extrng); ++ if (rng && !try_module_get(rng->owner)) ++ rng = NULL; ++ rcu_read_unlock(); ++ ++ if (rng) { ++ ret = import_ubuf(ITER_DEST, ubuf, len, &iter); ++ if (unlikely(ret)) ++ return ret; ++ ret = rng->extrng_read_iter(&iter, !!(flags & GRND_RANDOM)); ++ module_put(rng->owner); ++ return ret; ++ } ++ + if (!crng_ready() && !(flags & GRND_INSECURE)) { + if (flags & GRND_NONBLOCK) + return -EAGAIN; +@@ -1396,6 +1434,12 @@ static __poll_t random_poll(struct file *file, poll_table *wait) + return crng_ready() ? EPOLLIN | EPOLLRDNORM : EPOLLOUT | EPOLLWRNORM; + } + ++static __poll_t extrng_poll(struct file *file, poll_table * wait) ++{ ++ /* extrng pool is always full, always read, no writes */ ++ return EPOLLIN | EPOLLRDNORM; ++} ++ + static ssize_t write_pool_user(struct iov_iter *iter) + { + u8 block[BLAKE2S_BLOCK_SIZE]; +@@ -1536,7 +1580,58 @@ static int random_fasync(int fd, struct file *filp, int on) + return fasync_helper(fd, filp, on, &fasync); + } + ++static int random_open(struct inode *inode, struct file *filp) ++{ ++ const struct random_extrng *rng; ++ ++ rcu_read_lock(); ++ rng = rcu_dereference(extrng); ++ if (rng && !try_module_get(rng->owner)) ++ rng = NULL; ++ rcu_read_unlock(); ++ ++ if (!rng) ++ return 0; ++ ++ filp->f_op = &extrng_random_fops; ++ filp->private_data = rng->owner; ++ ++ return 0; ++} ++ ++static int urandom_open(struct inode *inode, struct file *filp) ++{ ++ const struct random_extrng *rng; ++ ++ rcu_read_lock(); ++ rng = rcu_dereference(extrng); ++ if (rng && !try_module_get(rng->owner)) ++ rng = NULL; ++ rcu_read_unlock(); ++ ++ if (!rng) ++ return 0; ++ ++ filp->f_op = &extrng_urandom_fops; ++ filp->private_data = rng->owner; ++ ++ return 0; ++} ++ ++static int extrng_release(struct inode *inode, struct file *filp) ++{ ++ module_put(filp->private_data); ++ return 0; ++} ++ ++static ssize_t ++extrng_read_iter(struct kiocb *kiocb, struct iov_iter *iter) ++{ ++ return rcu_dereference_raw(extrng)->extrng_read_iter(iter, false); ++} ++ + const struct file_operations random_fops = { ++ .open = random_open, + .read_iter = random_read_iter, + .write_iter = random_write_iter, + .poll = random_poll, +@@ -1549,6 +1644,7 @@ const struct file_operations random_fops = { + }; + + const struct file_operations urandom_fops = { ++ .open = urandom_open, + .read_iter = urandom_read_iter, + .write_iter = random_write_iter, + .unlocked_ioctl = random_ioctl, +@@ -1559,6 +1655,32 @@ const struct file_operations urandom_fops = { + .splice_write = iter_file_splice_write, + }; + ++static const struct file_operations extrng_random_fops = { ++ .open = random_open, ++ .read_iter = extrng_read_iter, ++ .write_iter = random_write_iter, ++ .poll = extrng_poll, ++ .unlocked_ioctl = random_ioctl, ++ .compat_ioctl = compat_ptr_ioctl, ++ .fasync = random_fasync, ++ .llseek = noop_llseek, ++ .release = extrng_release, ++ .splice_read = copy_splice_read, ++ .splice_write = iter_file_splice_write, ++}; ++ ++static const struct file_operations extrng_urandom_fops = { ++ .open = urandom_open, ++ .read_iter = extrng_read_iter, ++ .write_iter = random_write_iter, ++ .unlocked_ioctl = random_ioctl, ++ .compat_ioctl = compat_ptr_ioctl, ++ .fasync = random_fasync, ++ .llseek = noop_llseek, ++ .release = extrng_release, ++ .splice_read = copy_splice_read, ++ .splice_write = iter_file_splice_write, ++}; + + /******************************************************************** + * +diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile +index a2d0009560d0..4f3486e6a84b 100644 +--- a/drivers/firmware/efi/Makefile ++++ b/drivers/firmware/efi/Makefile +@@ -25,6 +25,7 @@ subdir-$(CONFIG_EFI_STUB) += libstub + obj-$(CONFIG_EFI_BOOTLOADER_CONTROL) += efibc.o + obj-$(CONFIG_EFI_TEST) += test/ + obj-$(CONFIG_EFI_DEV_PATH_PARSER) += dev-path-parser.o ++obj-$(CONFIG_EFI) += secureboot.o + obj-$(CONFIG_APPLE_PROPERTIES) += apple-properties.o + obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o + obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o +diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c +index fdf07dd6f459..cfd2b58a3494 100644 +--- a/drivers/firmware/efi/efi.c ++++ b/drivers/firmware/efi/efi.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + +@@ -993,40 +994,101 @@ int efi_mem_type(unsigned long phys_addr) + return -EINVAL; + } + ++struct efi_error_code { ++ efi_status_t status; ++ int errno; ++ const char *description; ++}; ++ ++static const struct efi_error_code efi_error_codes[] = { ++ { EFI_SUCCESS, 0, "Success"}, ++#if 0 ++ { EFI_LOAD_ERROR, -EPICK_AN_ERRNO, "Load Error"}, ++#endif ++ { EFI_INVALID_PARAMETER, -EINVAL, "Invalid Parameter"}, ++ { EFI_UNSUPPORTED, -ENOSYS, "Unsupported"}, ++ { EFI_BAD_BUFFER_SIZE, -ENOSPC, "Bad Buffer Size"}, ++ { EFI_BUFFER_TOO_SMALL, -ENOSPC, "Buffer Too Small"}, ++ { EFI_NOT_READY, -EAGAIN, "Not Ready"}, ++ { EFI_DEVICE_ERROR, -EIO, "Device Error"}, ++ { EFI_WRITE_PROTECTED, -EROFS, "Write Protected"}, ++ { EFI_OUT_OF_RESOURCES, -ENOMEM, "Out of Resources"}, ++#if 0 ++ { EFI_VOLUME_CORRUPTED, -EPICK_AN_ERRNO, "Volume Corrupt"}, ++ { EFI_VOLUME_FULL, -EPICK_AN_ERRNO, "Volume Full"}, ++ { EFI_NO_MEDIA, -EPICK_AN_ERRNO, "No Media"}, ++ { EFI_MEDIA_CHANGED, -EPICK_AN_ERRNO, "Media changed"}, ++#endif ++ { EFI_NOT_FOUND, -ENOENT, "Not Found"}, ++#if 0 ++ { EFI_ACCESS_DENIED, -EPICK_AN_ERRNO, "Access Denied"}, ++ { EFI_NO_RESPONSE, -EPICK_AN_ERRNO, "No Response"}, ++ { EFI_NO_MAPPING, -EPICK_AN_ERRNO, "No mapping"}, ++ { EFI_TIMEOUT, -EPICK_AN_ERRNO, "Time out"}, ++ { EFI_NOT_STARTED, -EPICK_AN_ERRNO, "Not started"}, ++ { EFI_ALREADY_STARTED, -EPICK_AN_ERRNO, "Already started"}, ++#endif ++ { EFI_ABORTED, -EINTR, "Aborted"}, ++#if 0 ++ { EFI_ICMP_ERROR, -EPICK_AN_ERRNO, "ICMP Error"}, ++ { EFI_TFTP_ERROR, -EPICK_AN_ERRNO, "TFTP Error"}, ++ { EFI_PROTOCOL_ERROR, -EPICK_AN_ERRNO, "Protocol Error"}, ++ { EFI_INCOMPATIBLE_VERSION, -EPICK_AN_ERRNO, "Incompatible Version"}, ++#endif ++ { EFI_SECURITY_VIOLATION, -EACCES, "Security Policy Violation"}, ++#if 0 ++ { EFI_CRC_ERROR, -EPICK_AN_ERRNO, "CRC Error"}, ++ { EFI_END_OF_MEDIA, -EPICK_AN_ERRNO, "End of Media"}, ++ { EFI_END_OF_FILE, -EPICK_AN_ERRNO, "End of File"}, ++ { EFI_INVALID_LANGUAGE, -EPICK_AN_ERRNO, "Invalid Languages"}, ++ { EFI_COMPROMISED_DATA, -EPICK_AN_ERRNO, "Compromised Data"}, ++ ++ // warnings ++ { EFI_WARN_UNKOWN_GLYPH, -EPICK_AN_ERRNO, "Warning Unknown Glyph"}, ++ { EFI_WARN_DELETE_FAILURE, -EPICK_AN_ERRNO, "Warning Delete Failure"}, ++ { EFI_WARN_WRITE_FAILURE, -EPICK_AN_ERRNO, "Warning Write Failure"}, ++ { EFI_WARN_BUFFER_TOO_SMALL, -EPICK_AN_ERRNO, "Warning Buffer Too Small"}, ++#endif ++}; ++ ++static int ++efi_status_cmp_bsearch(const void *key, const void *item) ++{ ++ u64 status = (u64)(uintptr_t)key; ++ struct efi_error_code *code = (struct efi_error_code *)item; ++ ++ if (status < code->status) ++ return -1; ++ if (status > code->status) ++ return 1; ++ return 0; ++} ++ + int efi_status_to_err(efi_status_t status) + { +- int err; +- +- switch (status) { +- case EFI_SUCCESS: +- err = 0; +- break; +- case EFI_INVALID_PARAMETER: +- err = -EINVAL; +- break; +- case EFI_OUT_OF_RESOURCES: +- err = -ENOSPC; +- break; +- case EFI_DEVICE_ERROR: +- err = -EIO; +- break; +- case EFI_WRITE_PROTECTED: +- err = -EROFS; +- break; +- case EFI_SECURITY_VIOLATION: +- err = -EACCES; +- break; +- case EFI_NOT_FOUND: +- err = -ENOENT; +- break; +- case EFI_ABORTED: +- err = -EINTR; +- break; +- default: +- err = -EINVAL; +- } ++ struct efi_error_code *found; ++ size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code); + +- return err; ++ found = bsearch((void *)(uintptr_t)status, efi_error_codes, ++ sizeof(struct efi_error_code), num, ++ efi_status_cmp_bsearch); ++ if (!found) ++ return -EINVAL; ++ return found->errno; ++} ++ ++const char * ++efi_status_to_str(efi_status_t status) ++{ ++ struct efi_error_code *found; ++ size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code); ++ ++ found = bsearch((void *)(uintptr_t)status, efi_error_codes, ++ sizeof(struct efi_error_code), num, ++ efi_status_cmp_bsearch); ++ if (!found) ++ return "Unknown error code"; ++ return found->description; + } + EXPORT_SYMBOL_GPL(efi_status_to_err); + +diff --git a/drivers/firmware/efi/secureboot.c b/drivers/firmware/efi/secureboot.c +new file mode 100644 +index 000000000000..de0a3714a5d4 +--- /dev/null ++++ b/drivers/firmware/efi/secureboot.c +@@ -0,0 +1,38 @@ ++/* Core kernel secure boot support. ++ * ++ * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved. ++ * Written by David Howells (dhowells@redhat.com) ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public Licence ++ * as published by the Free Software Foundation; either version ++ * 2 of the Licence, or (at your option) any later version. ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++ ++/* ++ * Decide what to do when UEFI secure boot mode is enabled. ++ */ ++void __init efi_set_secure_boot(enum efi_secureboot_mode mode) ++{ ++ if (efi_enabled(EFI_BOOT)) { ++ switch (mode) { ++ case efi_secureboot_mode_disabled: ++ pr_info("Secure boot disabled\n"); ++ break; ++ case efi_secureboot_mode_enabled: ++ set_bit(EFI_SECURE_BOOT, &efi.flags); ++ pr_info("Secure boot enabled\n"); ++ break; ++ default: ++ pr_warn("Secure boot could not be determined (mode %u)\n", ++ mode); ++ break; ++ } ++ } ++} +diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c +index d4af17fdba46..154f0403cbf4 100644 +--- a/drivers/hid/hid-rmi.c ++++ b/drivers/hid/hid-rmi.c +@@ -321,21 +321,12 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size) + { + struct rmi_data *hdata = hid_get_drvdata(hdev); + struct rmi_device *rmi_dev = hdata->xport.rmi_dev; +- unsigned long flags; + + if (!(test_bit(RMI_STARTED, &hdata->flags))) + return 0; + +- pm_wakeup_event(hdev->dev.parent, 0); +- +- local_irq_save(flags); +- + rmi_set_attn_data(rmi_dev, data[1], &data[2], size - 2); + +- generic_handle_irq(hdata->rmi_irq); +- +- local_irq_restore(flags); +- + return 1; + } + +@@ -589,56 +580,6 @@ static const struct rmi_transport_ops hid_rmi_ops = { + .reset = rmi_hid_reset, + }; + +-static void rmi_irq_teardown(void *data) +-{ +- struct rmi_data *hdata = data; +- struct irq_domain *domain = hdata->domain; +- +- if (!domain) +- return; +- +- irq_dispose_mapping(irq_find_mapping(domain, 0)); +- +- irq_domain_remove(domain); +- hdata->domain = NULL; +- hdata->rmi_irq = 0; +-} +- +-static int rmi_irq_map(struct irq_domain *h, unsigned int virq, +- irq_hw_number_t hw_irq_num) +-{ +- irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_simple_irq); +- +- return 0; +-} +- +-static const struct irq_domain_ops rmi_irq_ops = { +- .map = rmi_irq_map, +-}; +- +-static int rmi_setup_irq_domain(struct hid_device *hdev) +-{ +- struct rmi_data *hdata = hid_get_drvdata(hdev); +- int ret; +- +- hdata->domain = irq_domain_create_linear(hdev->dev.fwnode, 1, +- &rmi_irq_ops, hdata); +- if (!hdata->domain) +- return -ENOMEM; +- +- ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata); +- if (ret) +- return ret; +- +- hdata->rmi_irq = irq_create_mapping(hdata->domain, 0); +- if (hdata->rmi_irq <= 0) { +- hid_err(hdev, "Can't allocate an IRQ\n"); +- return hdata->rmi_irq < 0 ? hdata->rmi_irq : -ENXIO; +- } +- +- return 0; +-} +- + static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) + { + struct rmi_data *data = NULL; +@@ -711,18 +652,11 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) + + mutex_init(&data->page_mutex); + +- ret = rmi_setup_irq_domain(hdev); +- if (ret) { +- hid_err(hdev, "failed to allocate IRQ domain\n"); +- return ret; +- } +- + if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) + rmi_hid_pdata.gpio_data.disable = true; + + data->xport.dev = hdev->dev.parent; + data->xport.pdata = rmi_hid_pdata; +- data->xport.pdata.irq = data->rmi_irq; + data->xport.proto_name = "hid"; + data->xport.ops = &hid_rmi_ops; + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index a0bdfabddbc6..cd824ceebd0f 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2344,6 +2345,16 @@ static const struct amba_id etm4_ids[] = { + {}, + }; + ++static const struct dmi_system_id broken_coresight[] = { ++ { ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "HPE"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Apollo 70"), ++ }, ++ }, ++ { } /* terminating entry */ ++}; ++ + MODULE_DEVICE_TABLE(amba, etm4_ids); + + static struct amba_driver etm4x_amba_driver = { +@@ -2413,6 +2424,11 @@ static int __init etm4x_init(void) + { + int ret; + ++ if (dmi_check_system(broken_coresight)) { ++ pr_info("ETM4 disabled due to firmware bug\n"); ++ return 0; ++ } ++ + ret = etm4_pm_setup(); + + /* etm4_pm_setup() does its own cleanup - exit on error */ +@@ -2439,6 +2455,9 @@ static int __init etm4x_init(void) + + static void __exit etm4x_exit(void) + { ++ if (dmi_check_system(broken_coresight)) ++ return; ++ + amba_driver_unregister(&etm4x_amba_driver); + platform_driver_unregister(&etm4_platform_driver); + etm4_pm_clear(); +diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c +index ef9ea295f9e0..0103334e8f32 100644 +--- a/drivers/input/rmi4/rmi_driver.c ++++ b/drivers/input/rmi4/rmi_driver.c +@@ -182,34 +182,47 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status, + attn_data.data = fifo_data; + + kfifo_put(&drvdata->attn_fifo, attn_data); ++ ++ schedule_work(&drvdata->attn_work); + } + EXPORT_SYMBOL_GPL(rmi_set_attn_data); + +-static irqreturn_t rmi_irq_fn(int irq, void *dev_id) ++static void attn_callback(struct work_struct *work) + { +- struct rmi_device *rmi_dev = dev_id; +- struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); ++ struct rmi_driver_data *drvdata = container_of(work, ++ struct rmi_driver_data, ++ attn_work); + struct rmi4_attn_data attn_data = {0}; + int ret, count; + + count = kfifo_get(&drvdata->attn_fifo, &attn_data); +- if (count) { +- *(drvdata->irq_status) = attn_data.irq_status; +- drvdata->attn_data = attn_data; +- } ++ if (!count) ++ return; + +- ret = rmi_process_interrupt_requests(rmi_dev); ++ *(drvdata->irq_status) = attn_data.irq_status; ++ drvdata->attn_data = attn_data; ++ ++ ret = rmi_process_interrupt_requests(drvdata->rmi_dev); + if (ret) +- rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, ++ rmi_dbg(RMI_DEBUG_CORE, &drvdata->rmi_dev->dev, + "Failed to process interrupt request: %d\n", ret); + +- if (count) { +- kfree(attn_data.data); +- drvdata->attn_data.data = NULL; +- } ++ kfree(attn_data.data); ++ drvdata->attn_data.data = NULL; + + if (!kfifo_is_empty(&drvdata->attn_fifo)) +- return rmi_irq_fn(irq, dev_id); ++ schedule_work(&drvdata->attn_work); ++} ++ ++static irqreturn_t rmi_irq_fn(int irq, void *dev_id) ++{ ++ struct rmi_device *rmi_dev = dev_id; ++ int ret; ++ ++ ret = rmi_process_interrupt_requests(rmi_dev); ++ if (ret) ++ rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, ++ "Failed to process interrupt request: %d\n", ret); + + return IRQ_HANDLED; + } +@@ -217,7 +230,6 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id) + static int rmi_irq_init(struct rmi_device *rmi_dev) + { + struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); +- struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); + int irq_flags = irq_get_trigger_type(pdata->irq); + int ret; + +@@ -235,8 +247,6 @@ static int rmi_irq_init(struct rmi_device *rmi_dev) + return ret; + } + +- data->enabled = true; +- + return 0; + } + +@@ -886,23 +896,27 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake) + if (data->enabled) + goto out; + +- enable_irq(irq); +- data->enabled = true; +- if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) { +- retval = disable_irq_wake(irq); +- if (retval) +- dev_warn(&rmi_dev->dev, +- "Failed to disable irq for wake: %d\n", +- retval); +- } ++ if (irq) { ++ enable_irq(irq); ++ data->enabled = true; ++ if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) { ++ retval = disable_irq_wake(irq); ++ if (retval) ++ dev_warn(&rmi_dev->dev, ++ "Failed to disable irq for wake: %d\n", ++ retval); ++ } + +- /* +- * Call rmi_process_interrupt_requests() after enabling irq, +- * otherwise we may lose interrupt on edge-triggered systems. +- */ +- irq_flags = irq_get_trigger_type(pdata->irq); +- if (irq_flags & IRQ_TYPE_EDGE_BOTH) +- rmi_process_interrupt_requests(rmi_dev); ++ /* ++ * Call rmi_process_interrupt_requests() after enabling irq, ++ * otherwise we may lose interrupt on edge-triggered systems. ++ */ ++ irq_flags = irq_get_trigger_type(pdata->irq); ++ if (irq_flags & IRQ_TYPE_EDGE_BOTH) ++ rmi_process_interrupt_requests(rmi_dev); ++ } else { ++ data->enabled = true; ++ } + + out: + mutex_unlock(&data->enabled_mutex); +@@ -922,20 +936,22 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake) + goto out; + + data->enabled = false; +- disable_irq(irq); +- if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) { +- retval = enable_irq_wake(irq); +- if (retval) +- dev_warn(&rmi_dev->dev, +- "Failed to enable irq for wake: %d\n", +- retval); +- } +- +- /* make sure the fifo is clean */ +- while (!kfifo_is_empty(&data->attn_fifo)) { +- count = kfifo_get(&data->attn_fifo, &attn_data); +- if (count) +- kfree(attn_data.data); ++ if (irq) { ++ disable_irq(irq); ++ if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) { ++ retval = enable_irq_wake(irq); ++ if (retval) ++ dev_warn(&rmi_dev->dev, ++ "Failed to enable irq for wake: %d\n", ++ retval); ++ } ++ } else { ++ /* make sure the fifo is clean */ ++ while (!kfifo_is_empty(&data->attn_fifo)) { ++ count = kfifo_get(&data->attn_fifo, &attn_data); ++ if (count) ++ kfree(attn_data.data); ++ } + } + + out: +@@ -978,6 +994,8 @@ static int rmi_driver_remove(struct device *dev) + + rmi_disable_irq(rmi_dev, false); + ++ cancel_work_sync(&data->attn_work); ++ + rmi_f34_remove_sysfs(rmi_dev); + rmi_free_function_list(rmi_dev); + +@@ -1223,9 +1241,15 @@ static int rmi_driver_probe(struct device *dev) + } + } + +- retval = rmi_irq_init(rmi_dev); +- if (retval < 0) +- goto err_destroy_functions; ++ if (pdata->irq) { ++ retval = rmi_irq_init(rmi_dev); ++ if (retval < 0) ++ goto err_destroy_functions; ++ } ++ ++ data->enabled = true; ++ ++ INIT_WORK(&data->attn_work, attn_callback); + + if (data->f01_container->dev.driver) { + /* Driver already bound, so enable ATTN now. */ +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index 659a77f7bb83..e8dc1fd50e21 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -2913,6 +2914,27 @@ int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat) + } + EXPORT_SYMBOL_GPL(iommu_dev_disable_feature); + ++#ifdef CONFIG_ARM64 ++static int __init iommu_quirks(void) ++{ ++ const char *vendor, *name; ++ ++ vendor = dmi_get_system_info(DMI_SYS_VENDOR); ++ name = dmi_get_system_info(DMI_PRODUCT_NAME); ++ ++ if (vendor && ++ (strncmp(vendor, "GIGABYTE", 8) == 0 && name && ++ (strncmp(name, "R120", 4) == 0 || ++ strncmp(name, "R270", 4) == 0))) { ++ pr_warn("Gigabyte %s detected, force iommu passthrough mode", name); ++ iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY; ++ } ++ ++ return 0; ++} ++arch_initcall(iommu_quirks); ++#endif ++ + /** + * iommu_setup_default_domain - Set the default_domain for the group + * @group: Group to change +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index eff7f5df08e2..b58145ce7775 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -4433,6 +4433,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9000, + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9084, + quirk_bridge_cavm_thrx2_pcie_root); + ++/* ++ * PCI BAR 5 is not setup correctly for the on-board AHCI controller ++ * on Broadcom's Vulcan processor. Added a quirk to fix BAR 5 by ++ * using BAR 4's resources which are populated correctly and NOT ++ * actually used by the AHCI controller. ++ */ ++static void quirk_fix_vulcan_ahci_bars(struct pci_dev *dev) ++{ ++ struct resource *r = &dev->resource[4]; ++ ++ if (!(r->flags & IORESOURCE_MEM) || (r->start == 0)) ++ return; ++ ++ /* Set BAR5 resource to BAR4 */ ++ dev->resource[5] = *r; ++ ++ /* Update BAR5 in pci config space */ ++ pci_write_config_dword(dev, PCI_BASE_ADDRESS_5, r->start); ++ ++ /* Clear BAR4's resource */ ++ memset(r, 0, sizeof(*r)); ++} ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9027, quirk_fix_vulcan_ahci_bars); ++ + /* + * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero) + * class code. Fix it. +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index caac482fff2f..d3d59612ea93 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -119,6 +119,14 @@ static const char *sd_cache_types[] = { + "write back, no read (daft)" + }; + ++static const char *sd_probe_types[] = { "async", "sync" }; ++ ++static char sd_probe_type[6] = "async"; ++module_param_string(probe, sd_probe_type, sizeof(sd_probe_type), ++ S_IRUGO|S_IWUSR); ++MODULE_PARM_DESC(probe, "async or sync. Setting to 'sync' disables asynchronous " ++ "device number assignments (sda, sdb, ...)."); ++ + static void sd_set_flush_flag(struct scsi_disk *sdkp) + { + bool wc = false, fua = false; +@@ -4251,6 +4259,8 @@ static int __init init_sd(void) + goto err_out_class; + } + ++ if (!strcmp(sd_probe_type, "sync")) ++ sd_template.gendrv.probe_type = PROBE_FORCE_SYNCHRONOUS; + err = scsi_register_driver(&sd_template.gendrv); + if (err) + goto err_out_driver; +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 008053039875..f948a5c96006 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5845,6 +5845,13 @@ static void hub_event(struct work_struct *work) + (u16) hub->change_bits[0], + (u16) hub->event_bits[0]); + ++ /* Don't disconnect USB-SATA on TrimSlice */ ++ if (strcmp(dev_name(hdev->bus->controller), "tegra-ehci.0") == 0) { ++ if ((hdev->state == 7) && (hub->change_bits[0] == 0) && ++ (hub->event_bits[0] == 0x2)) ++ hub->event_bits[0] = 0; ++ } ++ + /* Lock the device, then check to see if we were + * disconnected while waiting for the lock to succeed. */ + usb_lock_device(hdev); +diff --git a/include/linux/crypto.h b/include/linux/crypto.h +index b164da5e129e..59021b8609a7 100644 +--- a/include/linux/crypto.h ++++ b/include/linux/crypto.h +@@ -133,6 +133,7 @@ + #define CRYPTO_TFM_REQ_FORBID_WEAK_KEYS 0x00000100 + #define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 + #define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400 ++#define CRYPTO_TFM_REQ_NEED_RESEED 0x00000800 + + /* + * Miscellaneous stuff. +diff --git a/include/linux/efi.h b/include/linux/efi.h +index d59b0947fba0..8b1e2e71d485 100644 +--- a/include/linux/efi.h ++++ b/include/linux/efi.h +@@ -45,6 +45,8 @@ struct screen_info; + #define EFI_ABORTED (21 | (1UL << (BITS_PER_LONG-1))) + #define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1))) + ++#define EFI_IS_ERROR(x) ((x) & (1UL << (BITS_PER_LONG-1))) ++ + typedef unsigned long efi_status_t; + typedef u8 efi_bool_t; + typedef u16 efi_char16_t; /* UNICODE character */ +@@ -872,6 +874,14 @@ static inline int efi_range_is_wc(unsigned long start, unsigned long len) + #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ + #define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */ + #define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */ ++#define EFI_SECURE_BOOT 13 /* Are we in Secure Boot mode? */ ++ ++enum efi_secureboot_mode { ++ efi_secureboot_mode_unset, ++ efi_secureboot_mode_unknown, ++ efi_secureboot_mode_disabled, ++ efi_secureboot_mode_enabled, ++}; + + #ifdef CONFIG_EFI + /* +@@ -883,6 +893,8 @@ static inline bool efi_enabled(int feature) + } + extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); + ++extern void __init efi_set_secure_boot(enum efi_secureboot_mode mode); ++ + bool __pure __efi_soft_reserve_enabled(void); + + static inline bool __pure efi_soft_reserve_enabled(void) +@@ -904,6 +916,8 @@ static inline bool efi_enabled(int feature) + static inline void + efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {} + ++static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {} ++ + static inline bool efi_soft_reserve_enabled(void) + { + return false; +@@ -918,6 +932,7 @@ static inline void efi_find_mirror(void) {} + #endif + + extern int efi_status_to_err(efi_status_t status); ++extern const char *efi_status_to_str(efi_status_t status); + + /* + * Variable Attributes +@@ -1134,13 +1149,6 @@ static inline bool efi_runtime_disabled(void) { return true; } + extern void efi_call_virt_check_flags(unsigned long flags, const void *caller); + extern unsigned long efi_call_virt_save_flags(void); + +-enum efi_secureboot_mode { +- efi_secureboot_mode_unset, +- efi_secureboot_mode_unknown, +- efi_secureboot_mode_disabled, +- efi_secureboot_mode_enabled, +-}; +- + static inline + enum efi_secureboot_mode efi_get_secureboot_mode(efi_get_variable_t *get_var) + { +diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h +index 334e00efbde4..5c962e31ffe5 100644 +--- a/include/linux/lsm_hook_defs.h ++++ b/include/linux/lsm_hook_defs.h +@@ -436,6 +436,8 @@ LSM_HOOK(int, 0, bpf_token_capable, const struct bpf_token *token, int cap) + #endif /* CONFIG_BPF_SYSCALL */ + + LSM_HOOK(int, 0, locked_down, enum lockdown_reason what) ++LSM_HOOK(int, 0, lock_kernel_down, const char *where, enum lockdown_reason level) ++ + + #ifdef CONFIG_PERF_EVENTS + LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type) +diff --git a/include/linux/random.h b/include/linux/random.h +index b0a940af4fff..8a52424fd0d5 100644 +--- a/include/linux/random.h ++++ b/include/linux/random.h +@@ -9,6 +9,13 @@ + + #include + ++struct iov_iter; ++ ++struct random_extrng { ++ ssize_t (*extrng_read_iter)(struct iov_iter *iter, bool reseed); ++ struct module *owner; ++}; ++ + struct notifier_block; + + void add_device_randomness(const void *buf, size_t len); +@@ -157,6 +164,9 @@ int random_prepare_cpu(unsigned int cpu); + int random_online_cpu(unsigned int cpu); + #endif + ++void random_register_extrng(const struct random_extrng *rng); ++void random_unregister_extrng(void); ++ + #ifndef MODULE + extern const struct file_operations random_fops, urandom_fops; + #endif +diff --git a/include/linux/rmi.h b/include/linux/rmi.h +index ab7eea01ab42..fff7c5f737fc 100644 +--- a/include/linux/rmi.h ++++ b/include/linux/rmi.h +@@ -364,6 +364,7 @@ struct rmi_driver_data { + + struct rmi4_attn_data attn_data; + DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16); ++ struct work_struct attn_work; + }; + + int rmi_register_transport_device(struct rmi_transport_dev *xport); +diff --git a/include/linux/security.h b/include/linux/security.h +index 41a8f667bdfa..e2aebf520337 100644 +--- a/include/linux/security.h ++++ b/include/linux/security.h +@@ -507,6 +507,7 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); + int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); + int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); + int security_locked_down(enum lockdown_reason what); ++int security_lock_kernel_down(const char *where, enum lockdown_reason level); + int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, u32 *uctx_len, + void *val, size_t val_len, u64 id, u64 flags); + #else /* CONFIG_SECURITY */ +@@ -1477,6 +1478,10 @@ static inline int security_locked_down(enum lockdown_reason what) + { + return 0; + } ++static inline int security_lock_kernel_down(const char *where, enum lockdown_reason level) ++{ ++ return 0; ++} + static inline int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, + u32 *uctx_len, void *val, size_t val_len, + u64 id, u64 flags) +diff --git a/kernel/module/signing.c b/kernel/module/signing.c +index a2ff4242e623..f0d2be1ee4f1 100644 +--- a/kernel/module/signing.c ++++ b/kernel/module/signing.c +@@ -61,10 +61,17 @@ int mod_verify_sig(const void *mod, struct load_info *info) + modlen -= sig_len + sizeof(ms); + info->len = modlen; + +- return verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len, ++ ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len, + VERIFY_USE_SECONDARY_KEYRING, + VERIFYING_MODULE_SIGNATURE, + NULL, NULL); ++ if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) { ++ ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len, ++ VERIFY_USE_PLATFORM_KEYRING, ++ VERIFYING_MODULE_SIGNATURE, ++ NULL, NULL); ++ } ++ return ret; + } + + int module_sig_check(struct load_info *info, int flags) +diff --git a/scripts/tags.sh b/scripts/tags.sh +index 191e0461d6d5..e6f418b3e948 100755 +--- a/scripts/tags.sh ++++ b/scripts/tags.sh +@@ -16,6 +16,8 @@ fi + ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )" + # tags and cscope files should also ignore MODVERSION *.mod.c files + ignore="$ignore ( -name *.mod.c ) -prune -o" ++# RHEL tags and cscope should also ignore redhat/rpm ++ignore="$ignore ( -path redhat/rpm ) -prune -o" + + # ignore arbitrary directories + if [ -n "${IGNORE_DIRS}" ]; then +diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c +index d1fdd113450a..182e8090cfe8 100644 +--- a/security/integrity/platform_certs/load_uefi.c ++++ b/security/integrity/platform_certs/load_uefi.c +@@ -74,7 +74,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, + return NULL; + + if (*status != EFI_BUFFER_TOO_SMALL) { +- pr_err("Couldn't get size: 0x%lx\n", *status); ++ pr_err("Couldn't get size: %s (0x%lx)\n", ++ efi_status_to_str(*status), *status); + return NULL; + } + +@@ -85,7 +86,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, + *status = efi.get_variable(name, guid, NULL, &lsize, db); + if (*status != EFI_SUCCESS) { + kfree(db); +- pr_err("Error reading db var: 0x%lx\n", *status); ++ pr_err("Error reading db var: %s (0x%lx)\n", ++ efi_status_to_str(*status), *status); + return NULL; + } + +diff --git a/security/lockdown/Kconfig b/security/lockdown/Kconfig +index e84ddf484010..d0501353a4b9 100644 +--- a/security/lockdown/Kconfig ++++ b/security/lockdown/Kconfig +@@ -16,6 +16,19 @@ config SECURITY_LOCKDOWN_LSM_EARLY + subsystem is fully initialised. If enabled, lockdown will + unconditionally be called before any other LSMs. + ++config LOCK_DOWN_IN_EFI_SECURE_BOOT ++ bool "Lock down the kernel in EFI Secure Boot mode" ++ default n ++ depends on EFI && SECURITY_LOCKDOWN_LSM_EARLY ++ help ++ UEFI Secure Boot provides a mechanism for ensuring that the firmware ++ will only load signed bootloaders and kernels. Secure boot mode may ++ be determined from EFI variables provided by the system firmware if ++ not indicated by the boot parameters. ++ ++ Enabling this option results in kernel lockdown being triggered if ++ EFI Secure Boot is set. ++ + choice + prompt "Kernel default lockdown mode" + default LOCK_DOWN_KERNEL_FORCE_NONE +diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c +index cd84d8ea1dfb..e4c70a0312bc 100644 +--- a/security/lockdown/lockdown.c ++++ b/security/lockdown/lockdown.c +@@ -74,6 +74,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what) + + static struct security_hook_list lockdown_hooks[] __ro_after_init = { + LSM_HOOK_INIT(locked_down, lockdown_is_locked_down), ++ LSM_HOOK_INIT(lock_kernel_down, lock_kernel_down), + }; + + const struct lsm_id lockdown_lsmid = { +diff --git a/security/security.c b/security/security.c +index 0a9a0ac3f266..a5cfc42f7c33 100644 +--- a/security/security.c ++++ b/security/security.c +@@ -5567,6 +5567,18 @@ int security_locked_down(enum lockdown_reason what) + } + EXPORT_SYMBOL(security_locked_down); + ++/** ++ * security_lock_kernel_down() - Put the kernel into lock-down mode. ++ * ++ * @where: Where the lock-down is originating from (e.g. command line option) ++ * @level: The lock-down level (can only increase) ++ */ ++int security_lock_kernel_down(const char *where, enum lockdown_reason level) ++{ ++ return call_int_hook(lock_kernel_down, where, level); ++} ++EXPORT_SYMBOL(security_lock_kernel_down); ++ + #ifdef CONFIG_PERF_EVENTS + /** + * security_perf_event_open() - Check if a perf event open is allowed diff --git a/SOURCES/redhatsecureboot301.cer b/SOURCES/redhatsecureboot301.cer deleted file mode 100644 index 20e6604..0000000 Binary files a/SOURCES/redhatsecureboot301.cer and /dev/null differ diff --git a/SOURCES/redhatsecurebootca1.cer b/SOURCES/redhatsecurebootca1.cer deleted file mode 100644 index b235400..0000000 Binary files a/SOURCES/redhatsecurebootca1.cer and /dev/null differ diff --git a/SOURCES/rhelima.x509 b/SOURCES/rhelima.x509 new file mode 100644 index 0000000..a286bfb Binary files /dev/null and b/SOURCES/rhelima.x509 differ diff --git a/SOURCES/rhelima_centos.x509 b/SOURCES/rhelima_centos.x509 new file mode 100644 index 0000000..691678f Binary files /dev/null and b/SOURCES/rhelima_centos.x509 differ diff --git a/SOURCES/rhelimaca1.x509 b/SOURCES/rhelimaca1.x509 new file mode 100644 index 0000000..b550150 Binary files /dev/null and b/SOURCES/rhelimaca1.x509 differ diff --git a/SOURCES/rog-ally-gyro-fix.patch b/SOURCES/rog-ally-gyro-fix.patch index 8416b43..bed6fc7 100644 --- a/SOURCES/rog-ally-gyro-fix.patch +++ b/SOURCES/rog-ally-gyro-fix.patch @@ -1,105 +1,4 @@ From: Jonathan LoBue - -Adds a description of the duplicate ACPI identifier issue -between devices using bmc150 and bmi323. - -Tested-by: Hans de Goede -Reviewed-by: Hans de Goede -Reviewed-by: Andy Shevchenko -Co-developed-by: Luke D. Jones -Signed-off-by: Luke D. Jones -Co-developed-by: Denis Benato -Signed-off-by: Denis Benato -Co-developed-by: Antheas Kapenekakis -Signed-off-by: Antheas Kapenekakis -Signed-off-by: Jonathan LoBue ---- - drivers/iio/accel/bmc150-accel-i2c.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c -index ee1ba134ad42..353271e23235 100644 ---- a/drivers/iio/accel/bmc150-accel-i2c.c -+++ b/drivers/iio/accel/bmc150-accel-i2c.c -@@ -224,6 +224,19 @@ static const struct acpi_device_id bmc150_accel_acpi_match[] = { - {"BMA250E"}, - {"BMC150A"}, - {"BMI055A"}, -+ /* -+ * The "BOSC0200" identifier used here is not unique to devices using -+ * bmc150. The same "BOSC0200" identifier is found in the ACPI tables of -+ * the ASUS ROG ALLY and Ayaneo AIR Plus which both use a Bosch BMI323 -+ * chip. This creates a conflict with duplicate ACPI identifiers which -+ * multiple drivers want to use. Fortunately, when the bmc150 driver -+ * starts to load on the ASUS ROG ALLY, the chip ID check portion fails -+ * (correctly) because the chip IDs received (via i2c) are unique between -+ * bmc150 and bmi323 and a dmesg output similar to this: -+ * "bmc150_accel_i2c i2c-BOSC0200:00: Invalid chip 0" can be seen. -+ * This allows the bmi323 driver to take over for ASUS ROG ALLY, and -+ * other devices using the bmi323 chip. -+ */ - {"BOSC0200"}, - {"BSBA0150"}, - {"DUAL250E"}, -From: Jonathan LoBue - -Adds the ACPI match table for ASUS ROG ALLY to load the bmi323 -driver with an ACPI match of "BOSC0200", and a comment about duplicate -ACPI identifiers between devices using the bmc150 and bmi323 chips. - -Tested-by: Hans de Goede -Reviewed-by: Hans de Goede -Reviewed-by: Andy Shevchenko -Co-developed-by: Luke D. Jones -Signed-off-by: Luke D. Jones -Co-developed-by: Denis Benato -Signed-off-by: Denis Benato -Co-developed-by: Antheas Kapenekakis -Signed-off-by: Antheas Kapenekakis -Signed-off-by: Jonathan LoBue ---- - drivers/iio/imu/bmi323/bmi323_i2c.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/drivers/iio/imu/bmi323/bmi323_i2c.c b/drivers/iio/imu/bmi323/bmi323_i2c.c -index 20a8001b9956..f7550503e47e 100644 ---- a/drivers/iio/imu/bmi323/bmi323_i2c.c -+++ b/drivers/iio/imu/bmi323/bmi323_i2c.c -@@ -93,6 +93,25 @@ static int bmi323_i2c_probe(struct i2c_client *i2c) - return bmi323_core_probe(dev); - } - -+static const struct acpi_device_id bmi323_acpi_match[] = { -+ /* -+ * The "BOSC0200" identifier used here is not unique to bmi323 devices. -+ * The same "BOSC0200" identifier is found in the ACPI tables of devices -+ * using the bmc150 chip. This creates a conflict with duplicate ACPI -+ * identifiers which multiple drivers want to use. If a non-bmi323 device -+ * starts to load with this "BOSC0200" ACPI match here, then the chip -+ * ID check portion should fail because the chip IDs received (via i2c) are -+ * unique between bmc150 and bmi323 and the driver should relinquish the -+ * device. If and when a different driver (such as bmc150) starts to load -+ * with the "BOSC0200" ACPI match, a short reset should ensure that the -+ * device is not in a bad state during that driver initialization. This -+ * device reset does occur in both the bmi323 and bmc150 init sequences. -+ */ -+ { "BOSC0200" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(acpi, bmi323_acpi_match); -+ - static const struct i2c_device_id bmi323_i2c_ids[] = { - { "bmi323" }, - { } -@@ -109,6 +128,7 @@ static struct i2c_driver bmi323_i2c_driver = { - .driver = { - .name = "bmi323", - .of_match_table = bmi323_of_i2c_match, -+ .acpi_match_table = bmi323_acpi_match, - }, - .probe = bmi323_i2c_probe, - .id_table = bmi323_i2c_ids, -From: Jonathan LoBue Date: Sun, 25 Feb 2024 14:43:01 -0800 Subject: [PATCH] iio: imu: bmi323: Implement ACPI method ROTM for mount matrix diff --git a/SOURCES/rpminspect.yaml b/SOURCES/rpminspect.yaml index cf00079..eac3a55 100644 --- a/SOURCES/rpminspect.yaml +++ b/SOURCES/rpminspect.yaml @@ -23,7 +23,7 @@ emptyrpm: patches: ignore_list: - linux-kernel-test.patch - - patch-6.8-redhat.patch + - patch-6.9-redhat.patch runpath: ignore: diff --git a/SOURCES/secureboot.cer b/SOURCES/secureboot.cer deleted file mode 100644 index 20e6604..0000000 Binary files a/SOURCES/secureboot.cer and /dev/null differ diff --git a/SOURCES/secureboot_ppc.cer b/SOURCES/secureboot_ppc.cer deleted file mode 100644 index 2c0087d..0000000 Binary files a/SOURCES/secureboot_ppc.cer and /dev/null differ diff --git a/SOURCES/secureboot_s390.cer b/SOURCES/secureboot_s390.cer deleted file mode 100644 index 137d385..0000000 Binary files a/SOURCES/secureboot_s390.cer and /dev/null differ diff --git a/SOURCES/securebootca.cer b/SOURCES/securebootca.cer deleted file mode 100644 index b235400..0000000 Binary files a/SOURCES/securebootca.cer and /dev/null differ diff --git a/SOURCES/steamdeck-oled-audio.patch b/SOURCES/steamdeck-oled-audio.patch index 8c14286..290ff9f 100644 --- a/SOURCES/steamdeck-oled-audio.patch +++ b/SOURCES/steamdeck-oled-audio.patch @@ -111,8 +111,8 @@ index 504d1b8c4..3411e8d9a 100644 #define PCO_PLAT_CLK 48000000 @@ -1282,6 +1283,78 @@ SND_SOC_DAILINK_DEF(nau8821, DAILINK_COMP_ARRAY(COMP_CODEC("i2c-NVTN2020:00", - "nau8821-hifi"))); - + NAU8821_CODEC_DAI))); + +static int acp_cs35l41_init(struct snd_soc_pcm_runtime *rtd) +{ + return 0; diff --git a/SOURCES/steamdeck-oled-refresh-rate.patch b/SOURCES/steamdeck-oled-refresh-rate.patch deleted file mode 100644 index 9f82ab9..0000000 --- a/SOURCES/steamdeck-oled-refresh-rate.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 74b669e1b1296dfb2987a29840ddae29c2b31353 Mon Sep 17 00:00:00 2001 -From: Matthew Schwartz -Date: Wed, 17 Apr 2024 21:31:14 -0700 -Subject: [PATCH 0/2] fix Galileo/OLED Deck refresh rate modesetting - -For some bizarre reason, these amdgpu_freesync_vid_mode parameters are the key to letting the Galileo/OLED Deck's 90hz display modeset properly within gamescope and gamescope-session. This adds the parameters back until a fix comes from upstream. - -Alex Deucher (2): - Reapply "Revert drm/amd/display: Enable Freesync Video Mode by - default" - Revert "drm/amd: Remove freesync video mode amdgpu parameter" - - drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + - drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 27 +++++++++++++++++++ - .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +++++---- - 3 files changed, 35 insertions(+), 5 deletions(-) - --- -2.44.0 - -From dbdedb7714422407d78a715031304e1be54680e1 Mon Sep 17 00:00:00 2001 -From: Alex Deucher -Date: Tue, 27 Feb 2024 13:08:12 -0500 -Subject: [PATCH 1/2] Reapply "Revert drm/amd/display: Enable Freesync Video - Mode by default" - -This reverts commit 11b92df8a2f7f4605ccc764ce6ae4a72760674df. - -This conflicts with how compositors want to handle VRR. Now -that compositors actually handle VRR, we probably don't need -freesync video. - -Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2985 -Acked-by: Hamza Mahfooz -Signed-off-by: Alex Deucher ---- - drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -index 46dd06e8fc7e..1010a89a17e6 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -6233,7 +6233,8 @@ create_stream_for_sink(struct drm_connector *connector, - */ - DRM_DEBUG_DRIVER("No preferred mode found\n"); - } else if (aconnector) { -- recalculate_timing = is_freesync_video_mode(&mode, aconnector); -+ recalculate_timing = amdgpu_freesync_vid_mode && -+ is_freesync_video_mode(&mode, aconnector); - if (recalculate_timing) { - freesync_mode = get_highest_refresh_rate_mode(aconnector, false); - drm_mode_copy(&saved_mode, &mode); -@@ -7544,7 +7545,7 @@ static void amdgpu_dm_connector_add_freesync_modes(struct drm_connector *connect - struct amdgpu_dm_connector *amdgpu_dm_connector = - to_amdgpu_dm_connector(connector); - -- if (!edid) -+ if (!(amdgpu_freesync_vid_mode && edid)) - return; - - if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10) -@@ -9838,7 +9839,8 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, - * TODO: Refactor this function to allow this check to work - * in all conditions. - */ -- if (dm_new_crtc_state->stream && -+ if (amdgpu_freesync_vid_mode && -+ dm_new_crtc_state->stream && - is_timing_unchanged_for_freesync(new_crtc_state, old_crtc_state)) - goto skip_modeset; - -@@ -9878,7 +9880,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, - } - - /* Now check if we should set freesync video mode */ -- if (dm_new_crtc_state->stream && -+ if (amdgpu_freesync_vid_mode && dm_new_crtc_state->stream && - dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) && - dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream) && - is_timing_unchanged_for_freesync(new_crtc_state, -@@ -9891,7 +9893,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, - set_freesync_fixed_config(dm_new_crtc_state); - - goto skip_modeset; -- } else if (aconnector && -+ } else if (amdgpu_freesync_vid_mode && aconnector && - is_freesync_video_mode(&new_crtc_state->mode, - aconnector)) { - struct drm_display_mode *high_mode; --- -2.44.0 - - -From 74b669e1b1296dfb2987a29840ddae29c2b31353 Mon Sep 17 00:00:00 2001 -From: Alex Deucher -Date: Tue, 27 Feb 2024 13:03:40 -0500 -Subject: [PATCH 2/2] Revert "drm/amd: Remove freesync video mode amdgpu - parameter" - -This reverts commit e94e787e37b99645e7c02d20d0a1ba0f8a18a82a. - -This conflicts with how compositors want to handle VRR. Now -that compositors actually handle VRR, we probably don't need -freesync video. - -Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2985 -Acked-by: Hamza Mahfooz -Signed-off-by: Alex Deucher ---- - drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + - drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 27 +++++++++++++++++++++++++ - 2 files changed, 28 insertions(+) - -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h -index 9246bca0a008..9c62552bec34 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h -@@ -196,6 +196,7 @@ - extern uint amdgpu_smu_memory_pool_size; - extern int amdgpu_smu_pptable_id; - extern uint amdgpu_dc_feature_mask; -+extern uint amdgpu_freesync_vid_mode; - extern uint amdgpu_dc_debug_mask; - extern uint amdgpu_dc_visual_confirm; - extern uint amdgpu_dm_abm_level; -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -index af7fae7907d7..8e1299fe2c54 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -@@ -199,6 +199,7 @@ int amdgpu_mes_kiq; - int amdgpu_noretry = -1; - int amdgpu_force_asic_type = -1; - int amdgpu_tmz = -1; /* auto */ -+uint amdgpu_freesync_vid_mode; - int amdgpu_reset_method = -1; /* auto */ - int amdgpu_num_kcq = -1; - int amdgpu_smartshift_bias; -@@ -883,6 +884,32 @@ module_param_named(damageclips, amdgpu_damage_clips, int, 0444); - MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto (default), 0 = off, 1 = on)"); - module_param_named(tmz, amdgpu_tmz, int, 0444); - -+/** -+ * DOC: freesync_video (uint) -+ * Enable the optimization to adjust front porch timing to achieve seamless -+ * mode change experience when setting a freesync supported mode for which full -+ * modeset is not needed. -+ * -+ * The Display Core will add a set of modes derived from the base FreeSync -+ * video mode into the corresponding connector's mode list based on commonly -+ * used refresh rates and VRR range of the connected display, when users enable -+ * this feature. From the userspace perspective, they can see a seamless mode -+ * change experience when the change between different refresh rates under the -+ * same resolution. Additionally, userspace applications such as Video playback -+ * can read this modeset list and change the refresh rate based on the video -+ * frame rate. Finally, the userspace can also derive an appropriate mode for a -+ * particular refresh rate based on the FreeSync Mode and add it to the -+ * connector's mode list. -+ * -+ * Note: This is an experimental feature. -+ * -+ * The default value: 0 (off). -+ */ -+MODULE_PARM_DESC( -+ freesync_video, -+ "Enable freesync modesetting optimization feature (0 = off (default), 1 = on)"); -+module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444); -+ - /** - * DOC: reset_method (int) - * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco) --- -2.44.0 - diff --git a/SOURCES/steamdeck-oled-wifi.patch b/SOURCES/steamdeck-oled-wifi.patch index 03db382..db7fe1b 100644 --- a/SOURCES/steamdeck-oled-wifi.patch +++ b/SOURCES/steamdeck-oled-wifi.patch @@ -4,8 +4,6 @@ Date: Thu, 4 Apr 2024 12:43:12 -0600 Subject: [PATCH] steamdeck-wifi --- - drivers/net/wireless/ath/ath11k/core.c | 88 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/hw.c | 1 + drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 86 +++++++++++++++++++------ @@ -16,166 +14,6 @@ Subject: [PATCH] steamdeck-wifi drivers/net/wireless/ath/ath11k/wmi.h | 87 +++++++++++++++++++++++++ 10 files changed, 322 insertions(+), 31 deletions(-) -diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c -index 0c6ecbb9a..203e33c22 100644 ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -17,6 +17,7 @@ - #include "hif.h" - #include "wow.h" - #include "fw.h" -+#include "wmi.h" - - unsigned int ath11k_debug_mask; - EXPORT_SYMBOL(ath11k_debug_mask); -@@ -122,6 +123,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .coex_isolation = false, - }, - { - .hw_rev = ATH11K_HW_IPQ6018_HW10, -@@ -205,6 +207,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .coex_isolation = false, - }, - { - .name = "qca6390 hw2.0", -@@ -372,6 +375,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .coex_isolation = false, - }, - { - .name = "wcn6855 hw2.0", -@@ -411,6 +415,68 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { - .fragment_160mhz = false, - }, - -+ .interface_modes = BIT(NL80211_IFTYPE_STATION) | -+ BIT(NL80211_IFTYPE_AP), -+ .supports_monitor = false, -+ .supports_shadow_regs = true, -+ .idle_ps = true, -+ .supports_sta_ps = true, -+ .coldboot_cal_mm = false, -+ .coldboot_cal_ftm = false, -+ .fw_mem_mode = 0, -+ .num_vdevs = 16 + 1, -+ .num_peers = 512, -+ .supports_suspend = true, -+ .hal_desc_sz = sizeof(struct hal_rx_desc_wcn6855), -+ .supports_regdb = true, -+ .fix_l1ss = false, -+ .credit_flow = true, -+ .max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390, -+ .hal_params = &ath11k_hw_hal_params_qca6390, -+ .supports_dynamic_smps_6ghz = false, -+ .alloc_cacheable_memory = false, -+ .supports_rssi_stats = true, -+ .fw_wmi_diag_event = true, -+ .current_cc_support = true, -+ .dbr_debug_support = false, -+ .coex_isolation = false, -+ }, -+ { -+ .name = "qca206x hw2.1", -+ .hw_rev = ATH11K_HW_QCA206X_HW21, -+ .fw = { -+ .dir = "QCA206X/hw2.1", -+ .board_size = 256 * 1024, -+ .cal_offset = 128 * 1024, -+ }, -+ .max_radios = 3, -+ .bdf_addr = 0x4B0C0000, -+ .hw_ops = &wcn6855_ops, -+ .ring_mask = &ath11k_hw_ring_mask_qca6390, -+ .internal_sleep_clock = true, -+ .regs = &wcn6855_regs, -+ .qmi_service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_QCA6390, -+ .host_ce_config = ath11k_host_ce_config_qca6390, -+ .ce_count = 9, -+ .target_ce_config = ath11k_target_ce_config_wlan_qca6390, -+ .target_ce_count = 9, -+ .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, -+ .svc_to_ce_map_len = 14, -+ .single_pdev_only = true, -+ .rxdma1_enable = false, -+ .num_rxmda_per_pdev = 2, -+ .rx_mac_buf_ring = true, -+ .vdev_start_delay = true, -+ .htt_peer_map_v2 = false, -+ -+ .spectral = { -+ .fft_sz = 0, -+ .fft_pad_sz = 0, -+ .summary_pad_sz = 0, -+ .fft_hdr_len = 0, -+ .max_fft_bins = 0, -+ }, -+ - .interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP), - .supports_monitor = false, -@@ -457,6 +523,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .coex_isolation = false, - }, - { - .name = "wcn6855 hw2.1", -@@ -1573,6 +1640,18 @@ static void ath11k_core_pdev_destroy(struct ath11k_base *ab) - ath11k_debugfs_pdev_destroy(ab); - } - -+static int ath11k_core_config_coex_isolation(struct ath11k_base *ab) -+{ -+ struct ath11k *ar = ath11k_ab_to_ar(ab, 0); -+ struct wmi_coex_config_params param; -+ -+ memset(¶m, 0, sizeof(struct wmi_coex_config_params)); -+ param.config_type = WMI_COEX_CONFIG_ANTENNA_ISOLATION; -+ param.config_arg1 = WMI_COEX_ISOLATION_ARG1_DEFAUT; -+ -+ return ath11k_wmi_send_coex_config(ar, ¶m); -+} -+ - static int ath11k_core_start(struct ath11k_base *ab) - { - int ret; -@@ -1670,6 +1749,15 @@ static int ath11k_core_start(struct ath11k_base *ab) - goto err_reo_cleanup; - } - -+ if (ab->hw_params.coex_isolation) { -+ ret = ath11k_core_config_coex_isolation(ab); -+ if (ret) { -+ ath11k_err(ab, "failed to set coex isolation: %d\n", -+ ret); -+ goto err_reo_cleanup; -+ } -+ } -+ - return 0; - - err_reo_cleanup: -diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h -index cd829ec70..ad0c86384 100644 ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -147,6 +147,7 @@ enum ath11k_hw_rev { - ATH11K_HW_WCN6855_HW21, - ATH11K_HW_WCN6750_HW10, - ATH11K_HW_IPQ5018_HW10, -+ ATH11K_HW_QCA206X_HW21, - }; - - enum ath11k_firmware_mode { diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/ath/ath11k/hw.c index 77d8f9237..409eb565d 100644 --- a/drivers/net/wireless/ath/ath11k/hw.c @@ -204,161 +42,27 @@ diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/at index cc8031008..c8409c00a 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2474,7 +2474,7 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, +@@ -2464,7 +2464,7 @@ he_mcs_mask[i]) max_nss = i + 1; } - arg->peer_nss = min(sta->deflink.rx_nss, max_nss); + arg->peer_nss = min(arg->peer_nss, (u32)max_nss); - + if (arg->peer_phymode == MODE_11AX_HE160 || arg->peer_phymode == MODE_11AX_HE80_80) { -@@ -4713,6 +4713,7 @@ static void ath11k_sta_rc_update_wk(struct work_struct *wk) - +@@ -4714,6 +4714,7 @@ + nss = max_t(u32, 1, nss); nss = min(nss, ath11k_mac_max_nss(ht_mcs_mask, vht_mcs_mask, he_mcs_mask)); + nss = min(nss, (u32)ar->num_tx_chains); - + if (changed & IEEE80211_RC_BW_CHANGED) { /* Get the peer phymode */ -@@ -9293,6 +9294,31 @@ static int ath11k_mac_setup_channels_rates(struct ath11k *ar, - return 0; - } - -+static void ath11k_mac_setup_mac_address_list(struct ath11k *ar) -+{ -+ struct mac_address *addresses; -+ u16 n_addresses; -+ int i; -+ -+ if (!ar->ab->hw_params.single_pdev_only || ar->ab->hw_params.num_rxmda_per_pdev < 2) -+ return; -+ -+ n_addresses = 3; -+ addresses = kcalloc(n_addresses, sizeof(*addresses), GFP_KERNEL); -+ if (!addresses) -+ return; -+ -+ memcpy(addresses[0].addr, ar->mac_addr, ETH_ALEN); -+ for (i = 1; i < n_addresses; i++) { -+ memcpy(addresses[i].addr, ar->mac_addr, ETH_ALEN); -+ addresses[i].addr[0] |= 0x2; -+ addresses[i].addr[0] += (i - 1) << 4; -+ } -+ -+ ar->hw->wiphy->addresses = addresses; -+ ar->hw->wiphy->n_addresses = n_addresses; -+} -+ - static int ath11k_mac_setup_iface_combinations(struct ath11k *ar) - { - struct ath11k_base *ab = ar->ab; -@@ -9312,28 +9338,43 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar) - return -ENOMEM; - } - -- limits[0].max = 1; -- limits[0].types |= BIT(NL80211_IFTYPE_STATION); -+ if (ab->hw_params.single_pdev_only && ar->ab->hw_params.num_rxmda_per_pdev > 1) { -+ limits[0].max = 2; -+ limits[0].types |= BIT(NL80211_IFTYPE_STATION); - -- limits[1].max = 16; -- limits[1].types |= BIT(NL80211_IFTYPE_AP); -+ limits[1].max = 1; -+ limits[1].types |= BIT(NL80211_IFTYPE_AP); - -- if (IS_ENABLED(CONFIG_MAC80211_MESH) && -- ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) -- limits[1].types |= BIT(NL80211_IFTYPE_MESH_POINT); -- -- combinations[0].limits = limits; -- combinations[0].n_limits = n_limits; -- combinations[0].max_interfaces = 16; -- combinations[0].num_different_channels = 1; -- combinations[0].beacon_int_infra_match = true; -- combinations[0].beacon_int_min_gcd = 100; -- combinations[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | -- BIT(NL80211_CHAN_WIDTH_20) | -- BIT(NL80211_CHAN_WIDTH_40) | -- BIT(NL80211_CHAN_WIDTH_80) | -- BIT(NL80211_CHAN_WIDTH_80P80) | -- BIT(NL80211_CHAN_WIDTH_160); -+ combinations[0].limits = limits; -+ combinations[0].n_limits = 2; -+ combinations[0].max_interfaces = 3; -+ combinations[0].num_different_channels = 2; -+ combinations[0].beacon_int_infra_match = true; -+ combinations[0].beacon_int_min_gcd = 100; -+ } else { -+ limits[0].max = 1; -+ limits[0].types |= BIT(NL80211_IFTYPE_STATION); -+ -+ limits[1].max = 16; -+ limits[1].types |= BIT(NL80211_IFTYPE_AP); -+ -+ if (IS_ENABLED(CONFIG_MAC80211_MESH) && -+ ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) -+ limits[1].types |= BIT(NL80211_IFTYPE_MESH_POINT); -+ -+ combinations[0].limits = limits; -+ combinations[0].n_limits = 2; -+ combinations[0].max_interfaces = 16; -+ combinations[0].num_different_channels = 1; -+ combinations[0].beacon_int_infra_match = true; -+ combinations[0].beacon_int_min_gcd = 100; -+ combinations[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | -+ BIT(NL80211_CHAN_WIDTH_20) | -+ BIT(NL80211_CHAN_WIDTH_40) | -+ BIT(NL80211_CHAN_WIDTH_80) | -+ BIT(NL80211_CHAN_WIDTH_80P80) | -+ BIT(NL80211_CHAN_WIDTH_160); -+ } - - ar->hw->wiphy->iface_combinations = combinations; - ar->hw->wiphy->n_iface_combinations = 1; -@@ -9398,6 +9439,8 @@ static void __ath11k_mac_unregister(struct ath11k *ar) - kfree(ar->hw->wiphy->iface_combinations[0].limits); - kfree(ar->hw->wiphy->iface_combinations); - -+ kfree(ar->hw->wiphy->addresses); -+ - SET_IEEE80211_DEV(ar->hw, NULL); - } - -@@ -9440,6 +9483,7 @@ static int __ath11k_mac_register(struct ath11k *ar) - ath11k_pdev_caps_update(ar); - - SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); -+ ath11k_mac_setup_mac_address_list(ar); - - SET_IEEE80211_DEV(ar->hw, ab->dev); - -diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c -index 6835c14b8..49082cf1f 100644 ---- a/drivers/net/wireless/ath/ath11k/mhi.c -+++ b/drivers/net/wireless/ath/ath11k/mhi.c -@@ -443,6 +443,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) - case ATH11K_HW_QCA6390_HW20: - case ATH11K_HW_WCN6855_HW20: - case ATH11K_HW_WCN6855_HW21: -+ case ATH11K_HW_QCA206X_HW21: - ath11k_mhi_config = &ath11k_mhi_config_qca6390; - break; - default: diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 09e65c5e5..88f11f6e4 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -28,6 +28,8 @@ - #define QCN9074_DEVICE_ID 0x1104 - #define WCN6855_DEVICE_ID 0x1103 - -+#define SUB_VERSION 0x1910010 -+ - static const struct pci_device_id ath11k_pci_id_table[] = { - { PCI_VDEVICE(QCOM, QCA6390_DEVICE_ID) }, - { PCI_VDEVICE(QCOM, WCN6855_DEVICE_ID) }, @@ -108,7 +110,12 @@ static u32 ath11k_pci_window_read32(struct ath11k_base *ab, u32 offset) struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); u32 window_start, val; @@ -373,118 +77,6 @@ index 09e65c5e5..88f11f6e4 100644 if (window_start == ATH11K_PCI_WINDOW_START) { spin_lock_bh(&ab_pci->window_lock); -@@ -733,6 +740,8 @@ static int ath11k_pci_probe(struct pci_dev *pdev, - u32 soc_hw_version_major, soc_hw_version_minor, addr; - const struct ath11k_pci_ops *pci_ops; - int ret; -+ u32 sub_version; -+ int ops_init = 0; - - ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI); - -@@ -779,8 +788,8 @@ static int ath11k_pci_probe(struct pci_dev *pdev, - case QCA6390_DEVICE_ID: - ath11k_pci_read_hw_version(ab, &soc_hw_version_major, - &soc_hw_version_minor); -- switch (soc_hw_version_major) { -- case 2: -+ switch (soc_hw_version_major) { -+ case 2: - ab->hw_rev = ATH11K_HW_QCA6390_HW20; - break; - default: -@@ -800,6 +809,13 @@ static int ath11k_pci_probe(struct pci_dev *pdev, - ab->id.bdf_search = ATH11K_BDF_SEARCH_BUS_AND_BOARD; - ath11k_pci_read_hw_version(ab, &soc_hw_version_major, - &soc_hw_version_minor); -+ pci_ops = &ath11k_pci_ops_qca6390; -+ ret = ath11k_pcic_register_pci_ops(ab, pci_ops); -+ if (ret) { -+ ath11k_err(ab, "failed to register PCI ops: %d\n", ret); -+ goto err_pci_free_region; -+ } -+ ops_init = 1; - switch (soc_hw_version_major) { - case 2: - switch (soc_hw_version_minor) { -@@ -809,7 +825,19 @@ static int ath11k_pci_probe(struct pci_dev *pdev, - break; - case 0x10: - case 0x11: -- ab->hw_rev = ATH11K_HW_WCN6855_HW21; -+ //ab->hw_rev = ATH11K_HW_WCN6855_HW21; -+ sub_version = ath11k_pcic_read32(ab, SUB_VERSION); -+ ath11k_dbg(ab, ATH11K_DBG_PCI, "sub_version 0x%x\n", sub_version); -+ switch (sub_version) { -+ case 0x1019A0E1: -+ case 0x1019B0E1: -+ case 0x1019C0E1: -+ case 0x1019D0E1: -+ ab->hw_rev = ATH11K_HW_QCA206X_HW21; -+ break; -+ default: -+ ab->hw_rev = ATH11K_HW_WCN6855_HW21; -+ } - break; - default: - goto unsupported_wcn6855_soc; -@@ -823,7 +851,6 @@ static int ath11k_pci_probe(struct pci_dev *pdev, - goto err_pci_free_region; - } - -- pci_ops = &ath11k_pci_ops_qca6390; - break; - default: - dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", -@@ -832,11 +859,13 @@ static int ath11k_pci_probe(struct pci_dev *pdev, - goto err_pci_free_region; - } - -- ret = ath11k_pcic_register_pci_ops(ab, pci_ops); -- if (ret) { -- ath11k_err(ab, "failed to register PCI ops: %d\n", ret); -- goto err_pci_free_region; -- } -+ if(ops_init == 1){ -+ ret = ath11k_pcic_register_pci_ops(ab, pci_ops); -+ if (ret) { -+ ath11k_err(ab, "failed to register PCI ops: %d\n", ret); -+ goto err_pci_free_region; -+ } -+ } - - ret = ath11k_pcic_init_msi_config(ab); - if (ret) { -@@ -1021,6 +1050,7 @@ static struct pci_driver ath11k_pci_driver = { - static int ath11k_pci_init(void) - { - int ret; -+ u32 sub_version; - - ret = pci_register_driver(&ath11k_pci_driver); - if (ret) -diff --git a/drivers/net/wireless/ath/ath11k/pcic.c b/drivers/net/wireless/ath/ath11k/pcic.c -index 15e2ceb22..c7b4b897d 100644 ---- a/drivers/net/wireless/ath/ath11k/pcic.c -+++ b/drivers/net/wireless/ath/ath11k/pcic.c -@@ -115,6 +115,17 @@ static const struct ath11k_msi_config ath11k_msi_config[] = { - }, - .hw_rev = ATH11K_HW_WCN6750_HW10, - }, -+ { -+ .total_vectors = 32, -+ .total_users = 4, -+ .users = (struct ath11k_msi_user[]) { -+ { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, -+ { .name = "CE", .num_vectors = 10, .base_vector = 3 }, -+ { .name = "WAKE", .num_vectors = 1, .base_vector = 13 }, -+ { .name = "DP", .num_vectors = 18, .base_vector = 14 }, -+ }, -+ .hw_rev = ATH11K_HW_QCA206X_HW21, -+ }, - }; - - int ath11k_pcic_init_msi_config(struct ath11k_base *ab) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 442afda7e..2abf307a7 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c @@ -497,9 +89,9 @@ index 442afda7e..2abf307a7 100644 wmi_cfg->host_service_flags &= ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported << -@@ -9688,3 +9689,29 @@ int ath11k_wmi_sta_keepalive(struct ath11k *ar, - - return ath11k_wmi_cmd_send(wmi, skb, WMI_STA_KEEPALIVE_CMDID); +@@ -9758,3 +9759,29 @@ + return test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT, + ar->ab->wmi_ab.svc_map) && ar->supports_6ghz; } + +int ath11k_wmi_send_coex_config(struct ath11k *ar, @@ -555,10 +147,10 @@ index cd2098d78..7cfe0c0f5 100644 }; enum wmi_debug_log_param { -@@ -6298,6 +6308,82 @@ enum wmi_sta_keepalive_method { - - const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, - size_t len, gfp_t gfp); +@@ -6344,6 +6344,82 @@ + + const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, + struct sk_buff *skb, gfp_t gfp); +enum wmi_coex_config_type { + WMI_COEX_CONFIG_PAGE_P2P_TDM = 1, + WMI_COEX_CONFIG_PAGE_STA_TDM = 2, @@ -638,7 +230,7 @@ index cd2098d78..7cfe0c0f5 100644 int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb, u32 cmd_id); struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len); -@@ -6459,6 +6545,7 @@ int ath11k_wmi_scan_prob_req_oui(struct ath11k *ar, +@@ -6505,6 +6581,7 @@ const u8 mac_addr[ETH_ALEN]); int ath11k_wmi_fw_dbglog_cfg(struct ath11k *ar, u32 *module_id_bitmap, struct ath11k_fw_dbglog *dbglog); diff --git a/SOURCES/t2linux.patch b/SOURCES/t2linux.patch index dc2e561..9fbe2e2 100644 --- a/SOURCES/t2linux.patch +++ b/SOURCES/t2linux.patch @@ -6076,7 +6076,6 @@ This driver is based on previous work done by Ronald Tschalär Signed-off-by: Kerem Karabay --- - MAINTAINERS | 6 ++ drivers/hid/Kconfig | 10 ++ drivers/hid/Makefile | 1 + drivers/hid/hid-appletb-bl.c | 193 +++++++++++++++++++++++++++++++++++ @@ -6084,23 +6083,6 @@ Signed-off-by: Kerem Karabay 5 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 drivers/hid/hid-appletb-bl.c -diff --git a/MAINTAINERS b/MAINTAINERS -index 4cc6bf79f..519b3b736 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -9157,6 +9157,12 @@ F: include/linux/pm.h - F: include/linux/suspend.h - F: kernel/power/ - -+HID APPLE TOUCH BAR DRIVERS -+M: Kerem Karabay -+L: linux-input@vger.kernel.org -+S: Maintained -+F: drivers/hid/hid-appletb-* -+ - HID CORE LAYER - M: Jiri Kosina - M: Benjamin Tissoires diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index e11c1c803..cf19a3b33 100644 --- a/drivers/hid/Kconfig @@ -6822,10 +6804,10 @@ diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 902a59928..dd5509eeb 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c -@@ -78,6 +78,7 @@ +@@ -72,6 +72,7 @@ + #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20) + #define MT_QUIRK_DISABLE_WAKEUP BIT(21) #define MT_QUIRK_ORIENTATION_INVERT BIT(22) - #define MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT BIT(23) - #define MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH BIT(24) +#define MT_QUIRK_TOUCH_IS_TIPSTATE BIT(25) #define MT_INPUTMODE_TOUCHSCREEN 0x02 @@ -6989,17 +6971,17 @@ diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index f98fb36ff..f881b19db 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c -@@ -226,6 +226,7 @@ +@@ -212,6 +212,7 @@ + #define MT_CLS_GOOGLE 0x0111 #define MT_CLS_RAZER_BLADE_STEALTH 0x0112 #define MT_CLS_SMART_TECH 0x0113 - #define MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER 0x0114 +#define MT_CLS_APPLE_TOUCHBAR 0x0115 #define MT_DEFAULT_MAXCONTACT 10 #define MT_MAX_MAXCONTACT 250 -@@ -421,6 +421,13 @@ - MT_QUIRK_WIN8_PTP_BUTTONS, - .export_all_inputs = true +@@ -396,6 +396,13 @@ + MT_QUIRK_CONTACT_CNT_ACCURATE | + MT_QUIRK_SEPARATE_APP_REPORT, }, + { .name = MT_CLS_APPLE_TOUCHBAR, + .quirks = MT_QUIRK_HOVERING | @@ -7010,7 +6992,7 @@ index f98fb36ff..f881b19db 100644 + }, { } }; - + @@ -1755,6 +1763,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) } } @@ -7027,31 +7009,29 @@ index f98fb36ff..f881b19db 100644 td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); if (!td) { dev_err(&hdev->dev, "cannot allocate multitouch data\n"); -@@ -1933,12 +1933,6 @@ +@@ -1780,10 +1780,6 @@ timer_setup(&td->release_timer, mt_expired_timeout, 0); - ret = hid_parse(hdev); -- if (ret != 0) { -- unregister_pm_notifier(&td->pm_notifier); +- if (ret != 0) - return ret; -- } - if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) mt_fix_const_fields(hdev, HID_DG_CONTACTID); -@@ -2417,6 +2417,11 @@ +@@ -2229,6 +2229,11 @@ MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, + /* Apple Touch Bars */ + { .driver_data = MT_CLS_APPLE_TOUCHBAR, + HID_USB_DEVICE(USB_VENDOR_ID_APPLE, -+ USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY) }, ++ USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY) }, + - /* Microsoft Surface type cover */ - { .driver_data = MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER, - HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, + /* Google MT devices */ + { .driver_data = MT_CLS_GOOGLE, + HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE, -- 2.42.0 @@ -7551,30 +7531,12 @@ protocol. Signed-off-by: Kerem Karabay --- - MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 12 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/appletbdrm.c | 624 ++++++++++++++++++++++++++++++ 4 files changed, 643 insertions(+) create mode 100644 drivers/gpu/drm/tiny/appletbdrm.c -diff --git a/MAINTAINERS b/MAINTAINERS -index 519b3b736..dfc63d257 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -6545,6 +6545,12 @@ - T: git git://anongit.freedesktop.org/drm/drm-misc - F: drivers/gpu/drm/sun4i/sun8i* - -+DRM DRIVER FOR APPLE TOUCH BARS -+M: Kerem Karabay -+L: dri-devel@lists.freedesktop.org -+S: Maintained -+F: drivers/gpu/drm/tiny/appletbdrm.c -+ - DRM DRIVER FOR ARM PL111 CLCD - S: Orphan - T: git git://anongit.freedesktop.org/drm/drm-misc diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig index f6889f649..559a97bce 100644 --- a/drivers/gpu/drm/tiny/Kconfig @@ -8297,30 +8259,12 @@ Signed-off-by: Orlando Chamberlain Reviewed-by: Andy Shevchenko Reviewed-by: Thomas Weißschuh --- - MAINTAINERS | 6 ++ drivers/hid/Kconfig | 13 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-apple-magic-backlight.c | 120 ++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 drivers/hid/hid-apple-magic-backlight.c -diff --git a/MAINTAINERS b/MAINTAINERS -index dfc63d257..9148bda0a 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -9169,6 +9169,12 @@ L: linux-input@vger.kernel.org - S: Maintained - F: drivers/hid/hid-appletb-* - -+HID APPLE MAGIC BACKLIGHT DRIVER -+M: Orlando Chamberlain -+L: linux-input@vger.kernel.org -+S: Maintained -+F: drivers/hid/apple-magic-backlight.c -+ - HID CORE LAYER - M: Jiri Kosina - M: Benjamin Tissoires diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 4e238df87..83fbab6d4 100644 --- a/drivers/hid/Kconfig @@ -8804,14 +8748,14 @@ diff --git a/include/linux/efi.h b/include/linux/efi.h index 80b21d1c6..f1e58e027 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h -@@ -387,6 +387,7 @@ void efi_native_runtime_setup(void); +@@ -387,6 +387,7 @@ #define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20) #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0) +#define APPLE_SET_OS_PROTOCOL_GUID EFI_GUID(0xc5c5da95, 0x7d5c, 0x45e6, 0xb2, 0xf1, 0x3f, 0xd5, 0x2b, 0xb1, 0x00, 0x77) #define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f) + #define EFI_TCG2_FINAL_EVENTS_TABLE_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25) #define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) - #define EFI_LOAD_FILE2_PROTOCOL_GUID EFI_GUID(0x4006c0c1, 0xfcb3, 0x403e, 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d) -- 2.34.1 diff --git a/SOURCES/tkg-unprivileged-CLONE_NEWUSER.patch b/SOURCES/tkg-unprivileged-CLONE_NEWUSER.patch index dc18c8e..4d8146c 100644 --- a/SOURCES/tkg-unprivileged-CLONE_NEWUSER.patch +++ b/SOURCES/tkg-unprivileged-CLONE_NEWUSER.patch @@ -66,9 +66,9 @@ diff --git a/kernel/fork.c b/kernel/fork.c index 08969f5aa38d59..ff601cb7a1fae0 100644 --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -102,6 +102,10 @@ - #include - #include +@@ -104,6 +104,10 @@ + #include + #include +#ifdef CONFIG_USER_NS +#include diff --git a/SOURCES/update_scripts.sh b/SOURCES/update_scripts.sh deleted file mode 100755 index 5dce4fa..0000000 --- a/SOURCES/update_scripts.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -if [ -z "$1" ]; then - exit 1 -fi - -TARGET="$1" - -for i in "$RPM_SOURCE_DIR"/*."$TARGET"; do - NEW=${i%."$TARGET"} - cp "$i" "$(basename "$NEW")" -done diff --git a/SOURCES/valve-gamescope-framerate-control-fixups.patch b/SOURCES/valve-gamescope-framerate-control-fixups.patch index 40053c3..05a789e 100644 --- a/SOURCES/valve-gamescope-framerate-control-fixups.patch +++ b/SOURCES/valve-gamescope-framerate-control-fixups.patch @@ -32,6 +32,183 @@ index 7dab01803..81672738a 100644 -- 2.43.0 +From 9d923e79d060d8c7218c8229c65c964b7f04e864 Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Tue, 30 Aug 2022 17:29:26 +0000 +Subject: [PATCH] drm: introduce + drm_mode_config.atomic_async_page_flip_not_supported +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This new field indicates whether the driver has the necessary logic +to support async page-flips via the atomic uAPI. This is leveraged by +the next commit to allow user-space to use this functionality. + +All atomic drivers setting drm_mode_config.async_page_flip are updated +to also set drm_mode_config.atomic_async_page_flip_not_supported. We +will gradually check and update these drivers to properly handle +drm_crtc_state.async_flip in their atomic logic. + +The goal of this negative flag is the same as +fb_modifiers_not_supported: we want to eventually get rid of all +drivers missing atomic support for async flips. New drivers should not +set this flag, instead they should support atomic async flips (if +they support async flips at all). IOW, we don't want more drivers +with async flip support for legacy but not atomic. + +v2: only set the flag on atomic drivers (remove it on amdgpu DCE and +on radeon) + +Signed-off-by: Simon Ser +Cc: Daniel Vetter +Cc: Joshua Ashton +Cc: Melissa Wen +Cc: Alex Deucher +Cc: Harry Wentland +Cc: Nicholas Kazlauskas +Cc: André Almeida +Cc: Ville Syrjälä +Signed-off-by: Cristian Ciocaltea +Link: https://lore.kernel.org/r/20220830172851.269402-4-contact@emersion.fr +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + + drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 + + drivers/gpu/drm/i915/display/intel_display_driver.c | 1 + + drivers/gpu/drm/nouveau/nouveau_display.c | 1 + + drivers/gpu/drm/vc4/vc4_kms.c | 1 + + include/drm/drm_mode_config.h | 11 +++++++++++ + 6 files changed, 16 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 81672738a..05c404fcc 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -3998,6 +3998,7 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) + adev_to_drm(adev)->mode_config.prefer_shadow = 1; + /* indicates support for immediate flip */ + adev_to_drm(adev)->mode_config.async_page_flip = true; ++ adev_to_drm(adev)->mode_config.atomic_async_page_flip_not_supported = true; + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (!state) +diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +index fa0f9a93d..301b222c4 100644 +--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c ++++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +@@ -639,6 +639,7 @@ static int atmel_hlcdc_dc_modeset_init(struct drm_device *dev) + dev->mode_config.max_height = dc->desc->max_height; + dev->mode_config.funcs = &mode_config_funcs; + dev->mode_config.async_page_flip = true; ++ dev->mode_config.atomic_async_page_flip_not_supported = true; + + return 0; + } +diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c +index 8f144d4d3..f290c5c2e 100644 +--- a/drivers/gpu/drm/i915/display/intel_display_driver.c ++++ b/drivers/gpu/drm/i915/display/intel_display_driver.c +@@ -128,6 +128,7 @@ + mode_config->helper_private = &intel_mode_config_funcs; + + mode_config->async_page_flip = HAS_ASYNC_FLIPS(i915) && !i915->params.disable_async_page_flip; ++ mode_config->atomic_async_page_flip_not_supported = true; + + /* + * Maximum framebuffer dimensions, chosen to match +diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c +index 99977e5fe..540895dab 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_display.c ++++ b/drivers/gpu/drm/nouveau/nouveau_display.c +@@ -720,6 +720,7 @@ nouveau_display_create(struct drm_device *dev) + dev->mode_config.async_page_flip = false; + else + dev->mode_config.async_page_flip = true; ++ dev->mode_config.atomic_async_page_flip_not_supported = true; + + drm_kms_helper_poll_init(dev); + drm_kms_helper_poll_disable(dev); +diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c +index 5495f2a94..5b6b311e7 100644 +--- a/drivers/gpu/drm/vc4/vc4_kms.c ++++ b/drivers/gpu/drm/vc4/vc4_kms.c +@@ -1068,6 +1068,7 @@ int vc4_kms_load(struct drm_device *dev) + dev->mode_config.helper_private = &vc4_mode_config_helpers; + dev->mode_config.preferred_depth = 24; + dev->mode_config.async_page_flip = true; ++ dev->mode_config.atomic_async_page_flip_not_supported = true; + dev->mode_config.normalize_zpos = true; + + ret = vc4_ctm_obj_init(vc4); +diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h +index 973119a91..47b005671 100644 +--- a/include/drm/drm_mode_config.h ++++ b/include/drm/drm_mode_config.h +@@ -918,6 +918,17 @@ struct drm_mode_config { + */ + bool async_page_flip; + ++ /** ++ * @atomic_async_page_flip_not_supported: ++ * ++ * If true, the driver does not support async page-flips with the ++ * atomic uAPI. This is only used by old drivers which haven't yet ++ * accomodated for &drm_crtc_state.async_flip in their atomic logic, ++ * even if they have &drm_mode_config.async_page_flip set to true. ++ * New drivers shall not set this flag. ++ */ ++ bool atomic_async_page_flip_not_supported; ++ + /** + * @fb_modifiers_not_supported: + * +-- +2.43.0 + +From 24ac301d6208f1135644fe32514994799e79a6a0 Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Tue, 30 Aug 2022 17:29:52 +0000 +Subject: [PATCH] amd/display: indicate support for atomic async page-flips on + DC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +amdgpu_dm_commit_planes() already sets the flip_immediate flag for +async page-flips. This flag is used to set the UNP_FLIP_CONTROL +register. Thus, no additional change is required to handle async +page-flips with the atomic uAPI. + +v2: make it clear this commit is about DC and not only DCN + +Signed-off-by: Simon Ser +Cc: Joshua Ashton +Cc: Melissa Wen +Cc: Alex Deucher +Cc: Harry Wentland +Cc: Nicholas Kazlauskas +Cc: André Almeida +Signed-off-by: Cristian Ciocaltea +Link: https://lore.kernel.org/r/20220830172851.269402-7-contact@emersion.fr +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 27a1e3a0046c9..a003e796aa183 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -3980,7 +3980,6 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) + adev_to_drm(adev)->mode_config.prefer_shadow = 1; + /* indicates support for immediate flip */ + adev_to_drm(adev)->mode_config.async_page_flip = true; +- adev_to_drm(adev)->mode_config.atomic_async_page_flip_not_supported = true; + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (!state) +-- +GitLab + From 32993fef83542e3bea66ed3ceec4944b3ae9d4f1 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 14 Nov 2022 19:52:30 +0000 diff --git a/SOURCES/x509.genkey b/SOURCES/x509.genkey deleted file mode 100644 index 2f90e1b..0000000 --- a/SOURCES/x509.genkey +++ /dev/null @@ -1,16 +0,0 @@ -[ req ] -default_bits = 4096 -distinguished_name = req_distinguished_name -prompt = no -x509_extensions = myexts - -[ req_distinguished_name ] -O = Fedora -CN = Fedora kernel signing key -emailAddress = kernel-team@fedoraproject.org - -[ myexts ] -basicConstraints=critical,CA:FALSE -keyUsage=digitalSignature -subjectKeyIdentifier=hash -authorityKeyIdentifier=keyid diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec index 6c97545..59703c4 100644 --- a/SPECS/kernel.spec +++ b/SPECS/kernel.spec @@ -160,18 +160,18 @@ Summary: The Linux kernel # the --with-release option overrides this setting.) %define debugbuildsenabled 1 %define buildid .fsync -%define specrpmversion 6.8.12 -%define specversion 6.8.12 -%define patchversion 6.8 -%define pkgrelease 300 +%define specrpmversion 6.9.4 +%define specversion 6.9.4 +%define patchversion 6.9 +%define pkgrelease 200 %define kversion 6 -%define tarfile_release 6.8.12 +%define tarfile_release 6.9.4 # This is needed to do merge window version magic -%define patchlevel 8 +%define patchlevel 9 # This allows pkg_release to have configurable %%{?dist} tag -%define specrelease 301%{?buildid}%{?dist} +%define specrelease 201%{?buildid}%{?dist} # This defines the kabi tarball version -%define kabiversion 6.8.12 +%define kabiversion 6.9.4 # If this variable is set to 1, a bpf selftests build failure will cause a # fatal kernel package build error @@ -320,7 +320,8 @@ Summary: The Linux kernel %endif %global clang_make_opts HOSTCC=clang CC=clang LLVM_IAS=%{llvm_ias} %if %{with clang_lto} -%global clang_make_opts %{clang_make_opts} LD=ld.lld HOSTLD=ld.lld AR=llvm-ar NM=llvm-nm HOSTAR=llvm-ar HOSTNM=llvm-nm +# LLVM=1 enables use of all LLVM tools. +%global clang_make_opts %{clang_make_opts} LLVM=1 %endif %global make_opts %{make_opts} %{clang_make_opts} # clang does not support the -fdump-ipa-clones option @@ -584,6 +585,9 @@ Summary: The Linux kernel %define cpupowerarchs i686 x86_64 ppc64le aarch64 %endif +# Architectures we build kernel livepatching selftests on +%define klptestarches x86_64 ppc64le + %if 0%{?use_vdso} %define _use_vdso 1 %else @@ -632,7 +636,7 @@ Summary: The Linux kernel Name: %{package_name} -License: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-2-Clause) AND ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) AND ((GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0) AND ((GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB) AND ((GPL-2.0-only WITH Linux-syscall-note) OR MIT) AND ((GPL-2.0-or-later WITH Linux-syscall-note) OR BSD-3-Clause) AND ((GPL-2.0-or-later WITH Linux-syscall-note) OR MIT) AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause-Clear AND GFDL-1.1-no-invariants-or-later AND GPL-1.0-or-later AND (GPL-1.0-or-later OR BSD-3-Clause) AND (GPL-1.0-or-later WITH Linux-syscall-note) AND GPL-2.0-only AND (GPL-2.0-only OR Apache-2.0) AND (GPL-2.0-only OR BSD-2-Clause) AND (GPL-2.0-only OR BSD-3-Clause) AND (GPL-2.0-only OR CDDL-1.0) AND (GPL-2.0-only OR GFDL-1.1-no-invariants-or-later) AND (GPL-2.0-only OR GFDL-1.2-no-invariants-only) AND (GPL-2.0-only WITH Linux-syscall-note) AND GPL-2.0-or-later AND (GPL-2.0-or-later OR BSD-2-Clause) AND (GPL-2.0-or-later OR BSD-3-Clause) AND (GPL-2.0-or-later OR CC-BY-4.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH Linux-syscall-note) AND ISC AND LGPL-2.0-or-later AND (LGPL-2.0-or-later OR BSD-2-Clause) AND (LGPL-2.0-or-later WITH Linux-syscall-note) AND LGPL-2.1-only AND (LGPL-2.1-only OR BSD-2-Clause) AND (LGPL-2.1-only WITH Linux-syscall-note) AND LGPL-2.1-or-later AND (LGPL-2.1-or-later WITH Linux-syscall-note) AND (Linux-OpenIB OR GPL-2.0-only) AND (Linux-OpenIB OR GPL-2.0-only OR BSD-2-Clause) AND Linux-man-pages-copyleft AND MIT AND (MIT OR Apache-2.0) AND (MIT OR GPL-2.0-only) AND (MIT OR GPL-2.0-or-later) AND (MIT OR LGPL-2.1-only) AND (MPL-1.1 OR GPL-2.0-only) AND (X11 OR GPL-2.0-only) AND (X11 OR GPL-2.0-or-later) AND Zlib AND (copyleft-next-0.3.1 OR GPL-2.0-or-later) +License: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-2-Clause) AND ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) AND ((GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0) AND ((GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB) AND ((GPL-2.0-only WITH Linux-syscall-note) OR MIT) AND ((GPL-2.0-or-later WITH Linux-syscall-note) OR BSD-3-Clause) AND ((GPL-2.0-or-later WITH Linux-syscall-note) OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0) AND BSD-3-Clause AND BSD-3-Clause-Clear AND GFDL-1.1-no-invariants-or-later AND GPL-1.0-or-later AND (GPL-1.0-or-later OR BSD-3-Clause) AND (GPL-1.0-or-later WITH Linux-syscall-note) AND GPL-2.0-only AND (GPL-2.0-only OR Apache-2.0) AND (GPL-2.0-only OR BSD-2-Clause) AND (GPL-2.0-only OR BSD-3-Clause) AND (GPL-2.0-only OR CDDL-1.0) AND (GPL-2.0-only OR GFDL-1.1-no-invariants-or-later) AND (GPL-2.0-only OR GFDL-1.2-no-invariants-only) AND (GPL-2.0-only WITH Linux-syscall-note) AND GPL-2.0-or-later AND (GPL-2.0-or-later OR BSD-2-Clause) AND (GPL-2.0-or-later OR BSD-3-Clause) AND (GPL-2.0-or-later OR CC-BY-4.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH Linux-syscall-note) AND ISC AND LGPL-2.0-or-later AND (LGPL-2.0-or-later OR BSD-2-Clause) AND (LGPL-2.0-or-later WITH Linux-syscall-note) AND LGPL-2.1-only AND (LGPL-2.1-only OR BSD-2-Clause) AND (LGPL-2.1-only WITH Linux-syscall-note) AND LGPL-2.1-or-later AND (LGPL-2.1-or-later WITH Linux-syscall-note) AND (Linux-OpenIB OR GPL-2.0-only) AND (Linux-OpenIB OR GPL-2.0-only OR BSD-2-Clause) AND Linux-man-pages-copyleft AND MIT AND (MIT OR Apache-2.0) AND (MIT OR GPL-2.0-only) AND (MIT OR GPL-2.0-or-later) AND (MIT OR LGPL-2.1-only) AND (MPL-1.1 OR GPL-2.0-only) AND (X11 OR GPL-2.0-only) AND (X11 OR GPL-2.0-or-later) AND Zlib AND (copyleft-next-0.3.1 OR GPL-2.0-or-later) URL: https://www.kernel.org/ Version: %{specrpmversion} Release: %{pkg_release} @@ -660,16 +664,18 @@ BuildRequires: bzip2, xz, findutils, m4, perl-interpreter, perl-Carp, perl-devel BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, bison, flex, gcc-c++ BuildRequires: net-tools, hostname, bc, elfutils-devel BuildRequires: dwarves +BuildRequires: python3 BuildRequires: python3-devel +BuildRequires: python3-pyyaml BuildRequires: kernel-rpm-macros # glibc-static is required for a consistent build environment (specifically # CONFIG_CC_CAN_LINK_STATIC=y). BuildRequires: glibc-static -%if %{with_headers} +%if %{with_headers} || %{with_cross_headers} BuildRequires: rsync %endif %if %{with_doc} -BuildRequires: xmlto, asciidoc, python3-sphinx, python3-sphinx_rtd_theme, python3-pyyaml +BuildRequires: xmlto, asciidoc, python3-sphinx, python3-sphinx_rtd_theme %endif %if %{with_sparse} BuildRequires: sparse @@ -804,6 +810,10 @@ Source0: linux-%{tarfile_release}.tar.xz Source1: Makefile.rhelver Source2: kernel.changelog +Source10: redhatsecurebootca5.cer +Source13: redhatsecureboot501.cer + +%if %{signkernel} # Name of the packaged file containing signing key %ifarch ppc64le %define signing_key_filename kernel-signing-ppc.cer @@ -812,52 +822,41 @@ Source2: kernel.changelog %define signing_key_filename kernel-signing-s390.cer %endif -%if %{?released_kernel} +# Fedora/ELN pesign macro expects to see these cert file names, see: +# https://github.com/rhboot/pesign/blob/main/src/pesign-rpmbuild-helper.in#L216 +%if 0%{?fedora}%{?eln} +%define pesign_name_0 redhatsecureboot501 +%define secureboot_ca_0 %{SOURCE10} +%define secureboot_key_0 %{SOURCE13} +%endif -Source10: redhatsecurebootca5.cer -Source11: redhatsecurebootca1.cer -Source12: redhatsecureboot501.cer -Source13: redhatsecureboot301.cer -Source14: secureboot_s390.cer -Source15: secureboot_ppc.cer +# RHEL/centos certs come from system-sb-certs +%if 0%{?rhel} && !0%{?eln} +%define secureboot_ca_0 %{_datadir}/pki/sb-certs/secureboot-ca-%{_arch}.cer +%define secureboot_key_0 %{_datadir}/pki/sb-certs/secureboot-kernel-%{_arch}.cer -%define secureboot_ca_0 %{SOURCE10} -%define secureboot_ca_1 %{SOURCE11} +%if 0%{?centos} +%define pesign_name_0 centossecureboot201 +%else %ifarch x86_64 aarch64 -%define secureboot_key_0 %{SOURCE12} %define pesign_name_0 redhatsecureboot501 -%define secureboot_key_1 %{SOURCE13} -%define pesign_name_1 redhatsecureboot301 %endif %ifarch s390x -%define secureboot_key_0 %{SOURCE14} %define pesign_name_0 redhatsecureboot302 %endif %ifarch ppc64le -%define secureboot_key_0 %{SOURCE15} -%define pesign_name_0 redhatsecureboot303 +%define pesign_name_0 redhatsecureboot701 +%endif +%endif +# rhel && !eln %endif -# released_kernel -%else - -Source10: redhatsecurebootca4.cer -Source11: redhatsecurebootca2.cer -Source12: redhatsecureboot401.cer -Source13: redhatsecureboot003.cer - -%define secureboot_ca_0 %{SOURCE10} -%define secureboot_ca_1 %{SOURCE11} -%define secureboot_key_0 %{SOURCE12} -%define pesign_name_0 redhatsecureboot401 -%define secureboot_key_1 %{SOURCE13} -%define pesign_name_1 redhatsecureboot003 - -# released_kernel +# signkernel %endif Source20: mod-denylist.sh Source21: mod-sign.sh +Source22: filtermods.py %define modsign_cmd %{SOURCE21} @@ -866,7 +865,6 @@ Source23: x509.genkey.rhel Source24: %{name}-aarch64-rhel.config Source25: %{name}-aarch64-debug-rhel.config -Source26: mod-extra.list.rhel Source27: %{name}-ppc64le-rhel.config Source28: %{name}-ppc64le-debug-rhel.config @@ -876,11 +874,7 @@ Source31: %{name}-s390x-zfcpdump-rhel.config Source32: %{name}-x86_64-rhel.config Source33: %{name}-x86_64-debug-rhel.config -Source34: filter-x86_64.sh.rhel -Source35: filter-aarch64.sh.rhel -Source36: filter-ppc64le.sh.rhel -Source37: filter-s390x.sh.rhel -Source38: filter-modules.sh.rhel +Source34: def_variants.yaml.rhel Source41: x509.genkey.centos # ARM64 64K page-size kernel config @@ -891,7 +885,6 @@ Source43: %{name}-aarch64-64k-debug-rhel.config %if 0%{?include_fedora} Source50: x509.genkey.fedora -Source51: mod-extra.list.fedora Source52: %{name}-aarch64-fedora.config Source53: %{name}-aarch64-debug-fedora.config @@ -904,11 +897,7 @@ Source59: %{name}-s390x-debug-fedora.config Source60: %{name}-x86_64-fedora.config Source61: %{name}-x86_64-debug-fedora.config -Source62: filter-x86_64.sh.fedora -Source63: filter-aarch64.sh.fedora -Source64: filter-ppc64le.sh.fedora -Source65: filter-s390x.sh.fedora -Source66: filter-modules.sh.fedora +Source62: def_variants.yaml.fedora %endif Source70: partial-kgcov-snip.config @@ -922,9 +911,6 @@ Source77: partial-clang_lto-aarch64-debug-snip.config Source80: generate_all_configs.sh Source81: process_configs.sh -Source84: mod-internal.list -Source85: mod-partner.list - Source86: dracut-virt.conf Source87: flavors @@ -932,6 +918,17 @@ Source87: flavors Source100: rheldup3.x509 Source101: rhelkpatch1.x509 Source102: nvidiagpuoot001.x509 +Source103: rhelimaca1.x509 +Source104: rhelima.x509 +Source105: rhelima_centos.x509 + +%if 0%{?centos} +%define ima_signing_cert %{SOURCE105} +%else +%define ima_signing_cert %{SOURCE104} +%endif + +%define ima_cert_name ima.cer Source200: check-kabi @@ -948,9 +945,6 @@ Source213: Module.kabi_dup_x86_64 Source300: kernel-abi-stablelists-%{kabiversion}.tar.xz Source301: kernel-kabi-dw-%{kabiversion}.tar.xz -# RT specific virt module -Source400: mod-kvm.list - %if %{include_rt} # realtime config files Source474: %{name}-aarch64-rt-rhel.config @@ -1025,7 +1019,6 @@ Patch301: steam-deck.patch Patch310: steamdeck-oled-wifi.patch Patch312: steamdeck-oled-audio.patch Patch313: steamdeck-oled-hw-quirks.patch -Patch314: steamdeck-oled-refresh-rate.patch Patch315: steamdeck-oled-legion-go-bluetooth-hang.patch # t2 macbook patches @@ -1576,7 +1569,8 @@ The meta-package for the %{1} kernel\ %package %{?1:%{1}-}kvm\ Summary: KVM modules for package kernel%{?1:-%{1}}\ Group: System Environment/Kernel\ -Requires: kernel%{?1:-%{1}} = %{version}-%{release}\ +Requires: kernel-uname-r = %{KVERREL}%{uname_suffix %{?1:%{1}}}\ +Requires: kernel%{?1:-%{1}}-modules-core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\ Provides: installonlypkg(kernel-module)\ Provides: kernel%{?1:-%{1}}-kvm-%{_target_cpu} = %{version}-%{release}\ AutoReq: no\ @@ -1625,7 +1619,7 @@ Provides: installonlypkg(kernel)\ Provides: kernel-%{?1:%{1}-}uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\ Requires: kernel%{?1:-%{1}}-modules-core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\ Requires(pre): %{kernel_prereq}\ -Requires(pre): systemd\ +Requires(pre): systemd >= 254-1\ %endif\ %endif\ %if %{with_gcov}\ @@ -1898,7 +1892,7 @@ ApplyOptionalPatch ROG-ALLY-NCT6775-PLATFORM.patch ApplyOptionalPatch v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch ApplyOptionalPatch rog-ally-gyro-fix.patch -# hdr: https://github.com/CachyOS/kernel-patches +# https://github.com/CachyOS/kernel-patches ApplyOptionalPatch 0001-ntsync.patch ApplyOptionalPatch 0001-amd-pstate.patch ApplyOptionalPatch 0001-amd-hdr.patch @@ -1918,7 +1912,6 @@ ApplyOptionalPatch steam-deck.patch ApplyOptionalPatch steamdeck-oled-wifi.patch ApplyOptionalPatch steamdeck-oled-audio.patch ApplyOptionalPatch steamdeck-oled-hw-quirks.patch -ApplyOptionalPatch steamdeck-oled-refresh-rate.patch ApplyOptionalPatch steamdeck-oled-legion-go-bluetooth-hang.patch # t2 macbook patches @@ -2060,25 +2053,20 @@ done openssl x509 -inform der -in %{SOURCE100} -out rheldup3.pem openssl x509 -inform der -in %{SOURCE101} -out rhelkpatch1.pem openssl x509 -inform der -in %{SOURCE102} -out nvidiagpuoot001.pem -cat rheldup3.pem rhelkpatch1.pem nvidiagpuoot001.pem > ../certs/rhel.pem +openssl x509 -inform der -in %{SOURCE103} -out rhelimaca1.pem +cat rheldup3.pem rhelkpatch1.pem nvidiagpuoot001.pem rhelimaca1.pem > ../certs/rhel.pem +%if %{signkernel} %ifarch s390x ppc64le openssl x509 -inform der -in %{secureboot_ca_0} -out secureboot.pem cat secureboot.pem >> ../certs/rhel.pem %endif +%endif for i in *.config; do sed -i 's@CONFIG_SYSTEM_TRUSTED_KEYS=""@CONFIG_SYSTEM_TRUSTED_KEYS="certs/rhel.pem"@' $i done %endif %endif -# Adjust FIPS module name for RHEL -%if 0%{?rhel} -%{log_msg "Adjust FIPS module name for RHEL"} -for i in *.config; do - sed -i 's/CONFIG_CRYPTO_FIPS_NAME=.*/CONFIG_CRYPTO_FIPS_NAME="Red Hat Enterprise Linux %{rhel} - Kernel Cryptographic API"/' $i -done -%endif - %{log_msg "Set process_configs.sh $OPTS"} cp %{SOURCE81} . OPTS="" @@ -2308,14 +2296,12 @@ BuildKernel() { %ifarch x86_64 aarch64 %{log_msg "Sign kernel image"} - %pesign -s -i $SignImage -o vmlinuz.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} - %pesign -s -i vmlinuz.tmp -o vmlinuz.signed -a %{secureboot_ca_1} -c %{secureboot_key_1} -n %{pesign_name_1} - rm vmlinuz.tmp + %pesign -s -i $SignImage -o vmlinuz.signed -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} %endif %ifarch s390x ppc64le if [ -x /usr/bin/rpm-sign ]; then rpm-sign --key "%{pesign_name_0}" --lkmsign $SignImage --output vmlinuz.signed - elif [ $DoModules -eq 1 ]; then + elif [ "$DoModules" == "1" -a "%{signmodules}" == "1" ]; then chmod +x scripts/sign-file ./scripts/sign-file -p sha256 certs/signing_key.pem certs/signing_key.x509 $SignImage vmlinuz.signed else @@ -2673,97 +2659,30 @@ BuildKernel() { ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \ grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1 - remove_depmod_files() - { - # remove files that will be auto generated by depmod at rpm -i time - pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ - # in case below list needs to be extended, remember to add a - # matching ghost entry in the files section as well - rm -f modules.{alias,alias.bin,builtin.alias.bin,builtin.bin} \ - modules.{dep,dep.bin,devname,softdep,symbols,symbols.bin} - popd - } - - %{log_msg "Remove depmod files"} - remove_depmod_files - %{log_msg "Identify modules in kenrel-modules-* packages"} - # Identify modules in the kernel-modules-extras package - %{SOURCE20} $RPM_BUILD_ROOT lib/modules/$KernelVer $(realpath configs/mod-extra.list) - # Identify modules in the kernel-modules-internal package - %{SOURCE20} $RPM_BUILD_ROOT lib/modules/$KernelVer %{SOURCE84} internal -%if 0%{!?fedora:1} - # Identify modules in the kernel-modules-partner package - %{SOURCE20} $RPM_BUILD_ROOT lib/modules/$KernelVer %{SOURCE85} partner -%endif - if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then - # Identify modules in the kernel-rt-kvm package - %{SOURCE20} $RPM_BUILD_ROOT lib/modules/$KernelVer %{SOURCE400} kvm + if [ $DoModules -eq 0 ]; then + %{log_msg "Create empty files for RPM packaging"} + # Ensure important files/directories exist to let the packaging succeed + echo '%%defattr(-,-,-)' > ../kernel${Variant:+-${Variant}}-modules-core.list + echo '%%defattr(-,-,-)' > ../kernel${Variant:+-${Variant}}-modules.list + echo '%%defattr(-,-,-)' > ../kernel${Variant:+-${Variant}}-modules-extra.list + echo '%%defattr(-,-,-)' > ../kernel${Variant:+-${Variant}}-modules-internal.list + echo '%%defattr(-,-,-)' > ../kernel${Variant:+-${Variant}}-modules-partner.list + mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel + # Add files usually created by make modules, needed to prevent errors + # thrown by depmod during package installation + touch $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.order + touch $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.builtin fi - # - # Generate the kernel-core and kernel-modules files lists - # - %{log_msg "Gemerate the kernel-core and kernel-modules files lists"} - - # Copy the System.map file for depmod to use, and create a backup of the - # full module tree so we can restore it after we're done filtering + # Copy the System.map file for depmod to use cp System.map $RPM_BUILD_ROOT/. - cp configs/filter-*.sh $RPM_BUILD_ROOT/. - pushd $RPM_BUILD_ROOT - mkdir restore - cp -r lib/modules/$KernelVer/* restore/. - - %{log_msg "Remove files in the kernel-modules-* file lists"} - # don't include anything going into kernel-modules-extra in the file lists - xargs rm -rf < mod-extra.list - # don't include anything going into kernel-modules-internal in the file lists - xargs rm -rf < mod-internal.list -%if 0%{!?fedora:1} - # don't include anything going into kernel-modules-partner in the file lists - xargs rm -rf < mod-partner.list -%endif - if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then - # don't include anything going into kernel-rt-kvm in the file lists - xargs rm -rf < mod-kvm.list - fi - - if [ $DoModules -eq 1 ]; then - %{log_msg "Filter files into core and modules lists"} - # Find all the module files and filter them out into the core and - # modules lists. This actually removes anything going into -modules - # from the dir. - find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list - ./filter-modules.sh modules.list %{_target_cpu} - rm filter-*.sh - - # Run depmod on the resulting module tree and make sure it isn't broken - depmod -b . -aeF ./System.map $KernelVer &> depmod.out - if [ -s depmod.out ]; then - %{log_msg "Depmod failure"} - cat depmod.out - exit 1 - else - rm depmod.out - fi - else - %{log_msg "Create empty files for RPM packaging"} - # Ensure important files/directories exist to let the packaging succeed - echo '%%defattr(-,-,-)' > modules.list - echo '%%defattr(-,-,-)' > k-d.list - mkdir -p lib/modules/$KernelVer/kernel - # Add files usually created by make modules, needed to prevent errors - # thrown by depmod during package installation - touch lib/modules/$KernelVer/modules.order - touch lib/modules/$KernelVer/modules.builtin - fi if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then %{log_msg "Skipping efiuki build"} else %if %{with_efiuki} - %{log_msg "Setup the EFI UKI kernel"} - popd + %{log_msg "Setup the EFI UKI kernel"} KernelUnifiedImageDir="$RPM_BUILD_ROOT/lib/modules/$KernelVer" KernelUnifiedImage="$KernelUnifiedImageDir/$InstallName-virt.efi" @@ -2783,9 +2702,7 @@ BuildKernel() { %if %{signkernel} %{log_msg "Sign the EFI UKI kernel"} - %pesign -s -i $KernelUnifiedImage -o $KernelUnifiedImage.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} - %pesign -s -i $KernelUnifiedImage.tmp -o $KernelUnifiedImage.signed -a %{secureboot_ca_1} -c %{secureboot_key_1} -n %{pesign_name_1} - rm -f $KernelUnifiedImage.tmp + %pesign -s -i $KernelUnifiedImage -o $KernelUnifiedImage.signed -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} if [ ! -s $KernelUnifiedImage.signed ]; then %{log_msg "pesigning failed"} @@ -2796,66 +2713,120 @@ BuildKernel() { # signkernel %endif - pushd $RPM_BUILD_ROOT # with_efiuki %endif : # in case of empty block fi # "$Variant" == "rt" || "$Variant" == "rt-debug" - remove_depmod_files - # Go back and find all of the various directories in the tree. We use this - # for the dir lists in kernel-core - find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n > module-dirs.list + # + # Generate the modules files lists + # + move_kmod_list() + { + local module_list="$1" + local subdir_name="$2" + + mkdir -p "$RPM_BUILD_ROOT/lib/modules/$KernelVer/$subdir_name" + + set +x + while read -r kmod; do + local target_file="$RPM_BUILD_ROOT/lib/modules/$KernelVer/$subdir_name/$kmod" + local target_dir="${target_file%/*}" + mkdir -p "$target_dir" + mv "$RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel/$kmod" "$target_dir" + done < <(sed -e 's|^kernel/||' "$module_list") + set -x + } - # Cleanup - %{log_msg "Cleanup build files"} - rm System.map - # Just "cp -r" can be very slow: here, it rewrites _existing files_ - # with open(O_TRUNC). Many filesystems synchronously wait for metadata - # update for such file rewrites (seen in strace as final close syscall - # taking a long time). On a rotational disk, cp was observed to take - # more than 5 minutes on ext4 and more than 15 minutes (!) on xfs. - # With --remove-destination, we avoid this, and copying - # (with enough RAM to cache it) takes 5 seconds: - cp -r --remove-destination restore/* lib/modules/$KernelVer/. - rm -rf restore - popd + create_module_file_list() + { + # subdirectory within /lib/modules/$KernelVer where kmods should go + local module_subdir="$1" + # kmod list with relative paths produced by filtermods.py + local relative_kmod_list="$2" + # list with absolute paths to kmods and other files to be included + local absolute_file_list="$3" + # if 1, this adds also all kmod directories to absolute_file_list + local add_all_dirs="$4" + + if [ "$module_subdir" == "kernel" ]; then + # make kmod paths absolute + sed -e 's|^kernel/|/lib/modules/'$KernelVer'/kernel/|' %{?zipsed} $relative_kmod_list > $absolute_file_list + else + # move kmods into subdirs if needed (internal, partner, extra,..) + move_kmod_list $relative_kmod_list $module_subdir + # make kmod paths absolute + sed -e 's|^kernel/|/lib/modules/'$KernelVer'/'$module_subdir'/|' $relative_kmod_list > $absolute_file_list + # run deny-mod script, this adds blacklist-* files to absolute_file_list + %{SOURCE20} "$RPM_BUILD_ROOT" lib/modules/$KernelVer $absolute_file_list +%if %{zipmodules} + # deny-mod script works with kmods as they are now (not compressed), + # but if they will be we need to add compext to all + sed -i %{?zipsed} $absolute_file_list +%endif + # add also dir for the case when there are no kmods + echo "%dir /lib/modules/$KernelVer/$module_subdir" >> $absolute_file_list + fi - # Make sure the files lists start with absolute paths or rpmbuild fails. - # Also add in the dir entries - %{log_msg "Create module list files for all kernel variants"} - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/k-d.list > ../kernel${Variant:+-${Variant}}-modules.list - sed -e 's/^lib*/%dir \/lib/' %{?zipsed} $RPM_BUILD_ROOT/module-dirs.list > ../kernel${Variant:+-${Variant}}-modules-core.list - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/modules.list >> ../kernel${Variant:+-${Variant}}-modules-core.list - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/mod-extra.list >> ../kernel${Variant:+-${Variant}}-modules-extra.list - if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/mod-kvm.list >> ../kernel${Variant:+-${Variant}}-kvm.list - fi + if [ "$add_all_dirs" -eq 1 ]; then + (cd $RPM_BUILD_ROOT; find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n) > ../module-dirs.list + sed -e 's|^lib|%dir /lib|' ../module-dirs.list >> $absolute_file_list + fi + } + + if [ $DoModules -eq 1 ]; then + # save modules.dep for debugging + cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.dep ../ + + %{log_msg "Create module list files for all kernel variants"} + variants_param="" + if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then + variants_param="-r rt" + fi + # this creates ../modules-*.list output, where each kmod path is as it + # appears in modules.dep (relative to lib/modules/$KernelVer) + %{SOURCE22} -l "../filtermods-$KernelVer.log" sort -d $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.dep -c configs/def_variants.yaml $variants_param -o .. + if [ $? -ne 0 ]; then + echo "8< --- filtermods-$KernelVer.log ---" + cat "../filtermods-$KernelVer.log" + echo "--- filtermods-$KernelVer.log --- >8" + + echo "8< --- modules.dep ---" + cat $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.dep + echo "--- modules.dep --- >8" + exit 1 + fi - # Cleanup kernel variant module lists - %{log_msg "Clean up kernel variant module lists"} - rm -f $RPM_BUILD_ROOT/k-d.list - rm -f $RPM_BUILD_ROOT/modules.list - rm -f $RPM_BUILD_ROOT/module-dirs.list - rm -f $RPM_BUILD_ROOT/mod-extra.list - rm -f $RPM_BUILD_ROOT/mod-internal.list + create_module_file_list "kernel" ../modules-core.list ../kernel${Variant:+-${Variant}}-modules-core.list 1 + create_module_file_list "kernel" ../modules.list ../kernel${Variant:+-${Variant}}-modules.list 0 + create_module_file_list "internal" ../modules-internal.list ../kernel${Variant:+-${Variant}}-modules-internal.list 0 + create_module_file_list "extra" ../modules-extra.list ../kernel${Variant:+-${Variant}}-modules-extra.list 0 + if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then + create_module_file_list "kvm" ../modules-rt-kvm.list ../kernel${Variant:+-${Variant}}-modules-rt-kvm.list 0 + fi %if 0%{!?fedora:1} - rm -f $RPM_BUILD_ROOT/mod-partner.list + create_module_file_list "partner" ../modules-partner.list ../kernel${Variant:+-${Variant}}-modules-partner.list 1 0 %endif - if [[ "$Variant" == "rt" || "$Variant" == "rt-debug" ]]; then - rm -f $RPM_BUILD_ROOT/mod-kvm.list - fi + fi # $DoModules -eq 1 -%if %{signmodules} - if [ $DoModules -eq 1 ]; then - %{log_msg "Save the signing keys for modules"} - # Save the signing keys so we can sign the modules in __modsign_install_post - cp certs/signing_key.pem certs/signing_key.pem.sign${Variant:++${Variant}} - cp certs/signing_key.x509 certs/signing_key.x509.sign${Variant:++${Variant}} - fi -%endif + remove_depmod_files() + { + # remove files that will be auto generated by depmod at rpm -i time + pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ + # in case below list needs to be extended, remember to add a + # matching ghost entry in the files section as well + rm -f modules.{alias,alias.bin,builtin.alias.bin,builtin.bin} \ + modules.{dep,dep.bin,devname,softdep,symbols,symbols.bin} + popd + } + + # Cleanup + %{log_msg "Cleanup build files"} + rm -f $RPM_BUILD_ROOT/System.map + %{log_msg "Remove depmod files"} + remove_depmod_files # Move the devel headers out of the root file system %{log_msg "Move the devel headers to RPM_BUILD_ROOT"} @@ -2889,24 +2860,34 @@ BuildKernel() { # Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel %{log_msg "Install certs"} mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer - %ifarch x86_64 aarch64 - install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20200609.cer - install -m 0644 %{secureboot_ca_1} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20140212.cer - ln -s kernel-signing-ca-20200609.cer $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - %else - install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - %endif +%if %{signkernel} + install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer %ifarch s390x ppc64le - if [ $DoModules -eq 1 ]; then - if [ -x /usr/bin/rpm-sign ]; then - install -m 0644 %{secureboot_key_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - else - install -m 0644 certs/signing_key.x509.sign${Variant:++${Variant}} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - openssl x509 -in certs/signing_key.pem.sign${Variant:++${Variant}} -outform der -out $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - chmod 0644 $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - fi + if [ -x /usr/bin/rpm-sign ]; then + install -m 0644 %{secureboot_key_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} fi %endif +%endif + +%if 0%{?rhel} + # Red Hat IMA code-signing cert, which is used to authenticate package files + install -m 0644 %{ima_signing_cert} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{ima_cert_name} +%endif + +%if %{signmodules} + if [ $DoModules -eq 1 ]; then + # Save the signing keys so we can sign the modules in __modsign_install_post + cp certs/signing_key.pem certs/signing_key.pem.sign${Variant:++${Variant}} + cp certs/signing_key.x509 certs/signing_key.x509.sign${Variant:++${Variant}} + %ifarch s390x ppc64le + if [ ! -x /usr/bin/rpm-sign ]; then + install -m 0644 certs/signing_key.x509.sign${Variant:++${Variant}} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer + openssl x509 -in certs/signing_key.pem.sign${Variant:++${Variant}} -outform der -out $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} + chmod 0644 $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} + fi + %endif + fi +%endif %if %{with_ipaclones} %{log_msg "install IPA clones"} @@ -2980,15 +2961,19 @@ BuildKernel %make_target %kernel_image %{_use_vdso} # and some variables so that the various userspace tools can be built. %{log_msg "Initialize userspace tools build environment"} InitBuildVars +# Some tests build also modules, and need Module.symvers +if ! [[ -e Module.symvers ]] && [[ -f $DevelDir/Module.symvers ]]; then + %{log_msg "Found Module.symvers in DevelDir, copying to ."} + cp "$DevelDir/Module.symvers" . +fi %endif %endif %ifarch aarch64 %global perf_build_extra_opts CORESIGHT=1 %endif -# LIBBPF_DYNAMIC=1 temporarily removed from the next command, it breaks the build on f39 and 38 %global perf_make \ - %{__make} %{?make_opts} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags} -Wl,-E" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBTRACEEVENT_DYNAMIC=1 %{?perf_build_extra_opts} prefix=%{_prefix} PYTHON=%{__python3} + %{__make} %{?make_opts} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags} -Wl,-E" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBBPF_DYNAMIC=1 LIBTRACEEVENT_DYNAMIC=1 %{?perf_build_extra_opts} prefix=%{_prefix} PYTHON=%{__python3} %if %{with_perf} %{log_msg "Build perf"} # perf @@ -3005,7 +2990,7 @@ chmod +x tools/perf/check-headers.sh %endif %global tools_make \ - CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{make} %{?make_opts} + CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" EXTRA_CFLAGS="${RPM_OPT_FLAGS}" %{make} %{?make_opts} %if %{with_tools} %ifarch %{cpupowerarchs} @@ -3113,7 +3098,14 @@ pushd tools/testing/selftests %endif %{log_msg "main selftests compile"} -%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf mm livepatch net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install +%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf mm net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install + +%ifarch %{klptestarches} + # kernel livepatching selftest test_modules will build against + # /lib/modules/$(shell uname -r)/build tree unless KDIR is set + export KDIR=$(realpath $(pwd)/../../..) + %{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="livepatch" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install || true +%endif # 'make install' for bpf is broken and upstream refuses to fix it. # Install the needed files manually. @@ -3616,7 +3608,7 @@ fi\ rm -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{KVERREL}%{?-v:+%{-v*}}\ /bin/kernel-install add %{KVERREL}%{?-v:+%{-v*}} /lib/modules/%{KVERREL}%{?-v:+%{-v*}}/vmlinuz%{?-u:-%{-u*}.efi} || exit $?\ if [[ ! -e "/boot/symvers-%{KVERREL}%{?-v:+%{-v*}}.%compext" ]]; then\ - ln -s "/lib/modules/%{KVERREL}%{?-v:+%{-v*}}/symvers.%compext" "/boot/symvers-%{KVERREL}%{?-v:+%{-v*}}.%compext"\ + cp "/lib/modules/%{KVERREL}%{?-v:+%{-v*}}/symvers.%compext" "/boot/symvers-%{KVERREL}%{?-v:+%{-v*}}.%compext"\ if command -v restorecon &>/dev/null; then\ restorecon "/boot/symvers-%{KVERREL}%{?-v:+%{-v*}}.%compext"\ fi\ @@ -4012,12 +4004,9 @@ fi\ /usr/src/kernels/%{KVERREL}%{?3:+%{3}}\ %{expand:%%files %{?3:%{3}-}devel-matched}\ %{expand:%%files -f kernel-%{?3:%{3}-}modules-extra.list %{?3:%{3}-}modules-extra}\ -%config(noreplace) /etc/modprobe.d/*-blacklist.conf\ -%{expand:%%files %{?3:%{3}-}modules-internal}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/internal\ +%{expand:%%files -f kernel-%{?3:%{3}-}modules-internal.list %{?3:%{3}-}modules-internal}\ %if 0%{!?fedora:1}\ -%{expand:%%files %{?3:%{3}-}modules-partner}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/partner\ +%{expand:%%files -f kernel-%{?3:%{3}-}modules-partner.list %{?3:%{3}-}modules-partner}\ %endif\ %if %{with_debuginfo}\ %ifnarch noarch\ @@ -4025,8 +4014,7 @@ fi\ %endif\ %endif\ %if "%{3}" == "rt" || "%{3}" == "rt-debug"\ -%{expand:%%files %{?3:%{3}-}kvm}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/kvm\ +%{expand:%%files -f kernel-%{?3:%{3}-}modules-rt-kvm.list %{?3:%{3}-}kvm}\ %else\ %if %{with_efiuki}\ %{expand:%%files %{?3:%{3}-}uki-virt}\ @@ -4110,98 +4098,292 @@ fi\ # # %changelog -* Fri Jun 07 2024 Jan200101 - 6.8.12-301.fsync -- kernel-fsync v6.8.12 +* Wed Jun 12 2024 Jan200101 - 6.9.4-201.fsync +- kernel-fsync v6.9.4 -* Thu May 30 2024 Justin M. Forbes [6.8.12-0] -- sunrpc: use the struct net as the svc proc private (Josef Bacik) -- Linux v6.8.12 +* Wed Jun 12 2024 Justin M. Forbes [6.9.4-0] +- Add libbpf workaround for F39 to patches (Justin M. Forbes) +- Linux v6.9.4 -* Sun May 26 2024 Justin M. Forbes [6.8.11-0] -- redhat/configs: fedora: aarch64: Re-enable CUSE (Neal Gompa) -- Remove f38 from release_targets (Justin M. Forbes) -- Add more Bugs addressed by 6.8.10 to BugsFixed (Justin M. Forbes) -- Linux v6.8.11 +* Thu May 30 2024 Justin M. Forbes [6.9.3-0] +- Linux v6.9.3 -* Fri May 17 2024 Augusto Caringi [6.8.10-0] -- redhat/configs: Enable CONFIG_DEBUG_INFO_BTF_MODULES (Augusto Caringi) -- Add bugs to BugsFixed for 6.8.10 (Justin M. Forbes) +* Sun May 26 2024 Justin M. Forbes [6.9.2-0] +- redhat/configs: fedora: aarch64: Re-enable CUSE (Neal Gompa) +- Linux v6.9.2 + +* Tue May 21 2024 Justin M. Forbes [6.9.1-0] +- Fix mismatch in IO_URING since we dropped the RHEL patch (Justin M. Forbes) +- Set up for stable Fedora (Justin M. Forbes) +- Linux v6.9.1 + +* Mon May 13 2024 Justin M. Forbes [6.9.0-1] +- Reset RHEL_RELEASE to 0 for 6.10 (Justin M. Forbes) +- configs: move CONFIG_BLK_DEV_UBLK into rhel/configs/generic (Ming Lei) +- configs: move CONFIG_BLK_SED_OPAL into redhat/configs/common/generic (Ming Lei) +- RHEL-21097: rhel: aarch64 stop blocking a number of HW sensors (Peter Robinson) +- redhat/configs: enable RTL8822BU for rhel (Jose Ignacio Tornos Martinez) +- redhat/configs: remove CONFIG_DMA_PERNUMA_CMA and switch CONFIG_DMA_NUMA_CMA off (Jerry Snitselaar) +- redhat: add IMA certificates (Jan Stancek) +- redhat/kernel.spec: fix typo in move_kmod_list() variable (Jan Stancek) + +* Mon May 13 2024 Fedora Kernel Team [6.9.0-64] +- Linux v6.9.0 + +* Sat May 11 2024 Fedora Kernel Team [6.9.0-0.rc7.cf87f46fd34d.63] +- Linux v6.9.0-0.rc7.cf87f46fd34d + +* Fri May 10 2024 Fedora Kernel Team [6.9.0-0.rc7.448b3fe5a0ea.62] +- redhat: make filtermods.py less verbose by default (Jan Stancek) +- Linux v6.9.0-0.rc7.448b3fe5a0ea + +* Thu May 09 2024 Fedora Kernel Team [6.9.0-0.rc7.45db3ab70092.61] +- scsi: sd: condition probe_type under RHEL_DIFFERENCES (Eric Chanudet) +- scsi: sd: remove unused sd_probe_types (Eric Chanudet) - Turn on INIT_ON_ALLOC_DEFAULT_ON for Fedora (Justin M. Forbes) -- Reapply "drm/qxl: simplify qxl_fence_wait" (Linus Torvalds) -- BugsFixed updates for 6.8.10 (Justin M. Forbes) -- e1000e: change usleep_range to udelay in PHY mdic access (Vitaly Lifshits) -- Linux v6.8.10 - -* Thu May 02 2024 Augusto Caringi [6.8.9-0] -- redhat/configs: Enable CONFIG_CPU_MITIGATIONS (Augusto Caringi) +- Linux v6.9.0-0.rc7.45db3ab70092 + +* Wed May 08 2024 Fedora Kernel Team [6.9.0-0.rc7.dccb07f2914c.60] +- Consolidate configs to common for 6.9 (Justin M. Forbes) + +* Tue May 07 2024 Fedora Kernel Team [6.9.0-0.rc7.dccb07f2914c.59] +- redhat/rhel_files: move tipc.ko and tipc_diag.ko to modules-extra (Xin Long) [RHEL-23931] +- redhat: move amd-pstate-ut.ko to modules-internal (Jan Stancek) +- redhat/configs: enable CONFIG_LEDS_TRIGGER_NETDEV also for RHEL (Michal Schmidt) [RHEL-32110] +- redhat/configs: Remove CONFIG_AMD_IOMMU_V2 (Jerry Snitselaar) +- Linux v6.9.0-0.rc7.dccb07f2914c + +* Mon May 06 2024 Fedora Kernel Team [6.9.0-0.rc7.58] +- Linux v6.9.0-0.rc7 + +* Sat May 04 2024 Fedora Kernel Team [6.9.0-0.rc6.7367539ad4b0.57] +- Set DEBUG_INFO_BTF_MODULES for Fedora (Justin M. Forbes) +- Linux v6.9.0-0.rc6.7367539ad4b0 + +* Fri May 03 2024 Fedora Kernel Team [6.9.0-0.rc6.f03359bca01b.56] +- Linux v6.9.0-0.rc6.f03359bca01b + +* Thu May 02 2024 Fedora Kernel Team [6.9.0-0.rc6.0106679839f7.55] +- redhat: Use redhatsecureboot701 for ppc64le (Jan Stancek) +- redhat: switch the kernel package to use certs from system-sb-certs (Jan Stancek) +- redhat: replace redhatsecureboot303 signing key with redhatsecureboot601 (Jan Stancek) +- redhat: drop certificates that were deprecated after GRUB's BootHole flaw (Jan Stancek) +- redhat: correct file name of redhatsecurebootca1 (Jan Stancek) +- redhat: align file names with names of signing keys for ppc and s390 (Jan Stancek) + +* Thu May 02 2024 Fedora Kernel Team [6.9.0-0.rc6.0106679839f7.54] +- Linux v6.9.0-0.rc6.0106679839f7 + +* Wed May 01 2024 Fedora Kernel Team [6.9.0-0.rc6.18daea77cca6.53] +- redhat/configs: Enable CONFIG_DM_VDO in RHEL (Benjamin Marzinski) +- redhat/configs: Enable DRM_NOUVEAU_GSP_DEFAULT everywhere (Neal Gompa) +- Linux v6.9.0-0.rc6.18daea77cca6 + +* Tue Apr 30 2024 Fedora Kernel Team [6.9.0-0.rc6.52] +- kernel.spec: adjust for livepatching kselftests (Joe Lawrence) +- redhat/configs: remove CONFIG_TEST_LIVEPATCH (Joe Lawrence) - Turn on CONFIG_RANDOM_KMALLOC_CACHES for Fedora (Justin M. Forbes) -- drm/nouveau/dp: Don't probe eDP ports twice harder (Lyude Paul) -- drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports (Lyude Paul) -- drm/dp: Don't attempt AUX transfers when eDP panels are not powered (Douglas Anderson) -- Linux v6.8.9 +- Set Fedora configs for 6.9 (Justin M. Forbes) + +* Mon Apr 29 2024 Fedora Kernel Team [6.9.0-0.rc6.51] +- gitlab-ci: enable pipelines with c10s buildroot (Michael Hofmann) +- Linux v6.9.0-0.rc6 + +* Sun Apr 28 2024 Fedora Kernel Team [6.9.0-0.rc5.2c8159388952.50] +- Linux v6.9.0-0.rc5.2c8159388952 -* Sat Apr 27 2024 Justin M. Forbes [6.8.8-0] -- Update BugsFixed for 6.8.8 (Justin M. Forbes) +* Sat Apr 27 2024 Fedora Kernel Team [6.9.0-0.rc5.5eb4573ea63d.49] +- Linux v6.9.0-0.rc5.5eb4573ea63d + +* Fri Apr 26 2024 Fedora Kernel Team [6.9.0-0.rc5.c942a0cd3603.48] - Turn on ISM for Fedora (Justin M. Forbes) +- Linux v6.9.0-0.rc5.c942a0cd3603 + +* Thu Apr 25 2024 Fedora Kernel Team [6.9.0-0.rc5.e88c4cfcb7b8.47] +- Linux v6.9.0-0.rc5.e88c4cfcb7b8 + +* Wed Apr 24 2024 Fedora Kernel Team [6.9.0-0.rc5.9d1ddab261f3.46] +- redhat/configs: enable CONFIG_TEST_LOCKUP for non-debug kernels (Čestmír Kalina) +- redhat/rhel_files: add test_lockup.ko to modules-extra (Čestmír Kalina) - Turn off some Fedora UBSAN options to avoid false positives (Justin M. Forbes) +- Linux v6.9.0-0.rc5.9d1ddab261f3 + +* Tue Apr 23 2024 Fedora Kernel Team [6.9.0-0.rc5.71b1543c83d6.45] +- Linux v6.9.0-0.rc5.71b1543c83d6 + +* Mon Apr 22 2024 Fedora Kernel Team [6.9.0-0.rc5.44] - fedora: aarch64: Enable a QCom Robotics platforms requirements (Peter Robinson) +- fedora: updates for 6.9 merge window (Peter Robinson) +- gitlab-ci: rename GitLab jobs ark -> rawhide (Michael Hofmann) +- Linux v6.9.0-0.rc5 + +* Sun Apr 21 2024 Fedora Kernel Team [6.9.0-0.rc4.977b1ef51866.43] +- Linux v6.9.0-0.rc4.977b1ef51866 + +* Sat Apr 20 2024 Fedora Kernel Team [6.9.0-0.rc4.13a2e429f644.42] +- Linux v6.9.0-0.rc4.13a2e429f644 + +* Fri Apr 19 2024 Fedora Kernel Team [6.9.0-0.rc4.2668e3ae2ef3.41] +- gitlab-ci: harmonize DataWarehouse tree names (Michael Hofmann) +- redhat/configs: Enable CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON for rhel (Jerry Snitselaar) +- spec: make sure posttrans script doesn't fail if /boot is non-POSIX (glb) +- Linux v6.9.0-0.rc4.2668e3ae2ef3 + +* Thu Apr 18 2024 Fedora Kernel Team [6.9.0-0.rc4.8cd26fd90c1a.40] - Turn on UBSAN for Fedora (Justin M. Forbes) -- Linux v6.8.8 +- Linux v6.9.0-0.rc4.8cd26fd90c1a -* Wed Apr 17 2024 Augusto Caringi [6.8.7-0] -- redhat/configs: Enable CONFIG_MITIGATION_SPECTRE_BHI (Augusto Caringi) +* Wed Apr 17 2024 Fedora Kernel Team [6.9.0-0.rc4.96fca68c4fbf.39] - Turn on XEN_BALLOON_MEMORY_HOTPLUG for Fedora (Justin M. Forbes) -- Linux v6.8.7 -* Sat Apr 13 2024 Justin M. Forbes [6.8.6-0] -- nouveau: fix devinit paths to only handle display on GSP. (Dave Airlie) -- Add bluetooth bug to Bugsfixed for 6.8.6 (Justin M. Forbes) -- Bluetooth: l2cap: Don't double set the HCI_CONN_MGMT_CONNECTED bit (Archie Pusaka) -- Linux v6.8.6 +* Tue Apr 16 2024 Fedora Kernel Team [6.9.0-0.rc4.96fca68c4fbf.38] +- Linux v6.9.0-0.rc4.96fca68c4fbf + +* Mon Apr 15 2024 Fedora Kernel Team [6.9.0-0.rc4.37] +- Linux v6.9.0-0.rc4 + +* Sun Apr 14 2024 Fedora Kernel Team [6.9.0-0.rc3.7efd0a74039f.36] +- Linux v6.9.0-0.rc3.7efd0a74039f + +* Sat Apr 13 2024 Fedora Kernel Team [6.9.0-0.rc3.8f2c057754b2.35] +- docs: point out that python3-pyyaml is now required (Thorsten Leemhuis) +- Linux v6.9.0-0.rc3.8f2c057754b2 + +* Fri Apr 12 2024 Fedora Kernel Team [6.9.0-0.rc3.586b5dfb51b9.34] +- Use LLVM=1 for clang_lto build (Nikita Popov) +- redhat: fix def_variants.yaml check (Jan Stancek) +- Linux v6.9.0-0.rc3.586b5dfb51b9 + +* Thu Apr 11 2024 Fedora Kernel Team [6.9.0-0.rc3.e8c39d0f57f3.33] +- redhat: sanity check yaml files (Jan Stancek) +- spec: rework filter-mods and mod-denylist (Jan Stancek) +- Linux v6.9.0-0.rc3.e8c39d0f57f3 + +* Wed Apr 10 2024 Fedora Kernel Team [6.9.0-0.rc3.2c71fdf02a95.32] +- Linux v6.9.0-0.rc3.2c71fdf02a95 + +* Tue Apr 09 2024 Fedora Kernel Team [6.9.0-0.rc3.20cb38a7af88.31] +- Linux v6.9.0-0.rc3.20cb38a7af88 -* Wed Apr 10 2024 Justin M. Forbes [6.8.5-0] -- Set configs for SPECTRE_BHI (Justin M. Forbes) -- Add AMD PMF bug (Justin M. Forbes) +* Mon Apr 08 2024 Fedora Kernel Team [6.9.0-0.rc3.30] +- Linux v6.9.0-0.rc3 + +* Sun Apr 07 2024 Fedora Kernel Team [6.9.0-0.rc2.f2f80ac80987.29] +- Linux v6.9.0-0.rc2.f2f80ac80987 + +* Sat Apr 06 2024 Fedora Kernel Team [6.9.0-0.rc2.6c6e47d69d82.28] +- redhat/configs: remove CONFIG_INTEL_MENLOW as it is obsolete. (David Arcari) +- Linux v6.9.0-0.rc2.6c6e47d69d82 + +* Fri Apr 05 2024 Fedora Kernel Team [6.9.0-0.rc2.8cb4a9a82b21.27] +- Linux v6.9.0-0.rc2.8cb4a9a82b21 + +* Thu Apr 04 2024 Fedora Kernel Team [6.9.0-0.rc2.c85af715cac0.26] +- Linux v6.9.0-0.rc2.c85af715cac0 + +* Wed Apr 03 2024 Fedora Kernel Team [6.9.0-0.rc2.026e680b0a08.25] +- arch/x86: Fix XSAVE check for x86_64-v2 check (Prarit Bhargava) +- redhat/Makefile.variables: unquote a variable (Thorsten Leemhuis) + +* Tue Apr 02 2024 Fedora Kernel Team [6.9.0-0.rc2.026e680b0a08.24] +- redhat/configs: build in Tegra210 SPI driver (Mark Salter) +- redhat/configs: aarch64: Enable ARM_FFA driver (Mark Salter) +- Base automotive-devel on rt-devel (Don Zickus) +- Linux v6.9.0-0.rc2.026e680b0a08 + +* Mon Apr 01 2024 Fedora Kernel Team [6.9.0-0.rc2.23] +- Linux v6.9.0-0.rc2 + +* Sun Mar 31 2024 Fedora Kernel Team [6.9.0-0.rc1.712e14250dd2.22] +- Linux v6.9.0-0.rc1.712e14250dd2 + +* Sat Mar 30 2024 Fedora Kernel Team [6.9.0-0.rc1.486291a0e624.21] - redhat/configs: Enable CONFIG_AMDTEE for x86 (David Arcari) -- Add CVE fix for 6.8.5 (Justin M. Forbes) -- Linux v6.8.5 - -* Thu Apr 04 2024 Justin M. Forbes [6.8.4-0] -- Linux v6.8.4 - -* Wed Apr 03 2024 Justin M. Forbes [6.8.3-0] -- Fix up redhat directory for stable reabses (Justin M. Forbes) -- Add some CVE fixes for 6.8.3 (Justin M. Forbes) -- Add bug to BugsFixed (Justin M. Forbes) -- Revert "Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT" (Johan Hovold) -- Config updates for stable (Justin M. Forbes) -- Linux v6.8.3 - -* Tue Mar 26 2024 Justin M. Forbes [6.8.2-0] -- xfs: fix SEEK_HOLE/DATA for regions with active COW extents (Dave Chinner) +- redhat/configs: enable CONFIG_TEST_LOCKUP for debug kernel (Čestmír Kalina) +- Linux v6.9.0-0.rc1.486291a0e624 + +* Fri Mar 29 2024 Fedora Kernel Team [6.9.0-0.rc1.317c7bc0ef03.20] +- Linux v6.9.0-0.rc1.317c7bc0ef03 + +* Thu Mar 28 2024 Fedora Kernel Team [6.9.0-0.rc1.8d025e2092e2.19] +- Linux v6.9.0-0.rc1.8d025e2092e2 + +* Wed Mar 27 2024 Fedora Kernel Team [6.9.0-0.rc1.7033999ecd7b.18] +- kernel.spec: fix libperf-debuginfo content (Jan Stancek) +- Turn on DM_VDO for Fedora (Justin M. Forbes) - redhat: make libperf-devel require libperf %%{version}-%%{release} (Jan Stancek) - kernel.spec: drop custom mode also for System.map ghost entry (Jan Stancek) -- kernel.spec: fix libperf-debuginfo content (Jan Stancek) -- redhat/kernel.spec.template: enable cross for base/RT (Peter Robinson) -- redhat/kernel.spec.template: Fix cross compiling (Peter Robinson) -- Add more bugs to BugsFixed (Justin M. Forbes) -- Add bug to BugsFixed (Justin M. Forbes) +- Octopus merges are too conservative, serialize instead (Don Zickus) +- Add tracking branches for rt-devel (Don Zickus) +- Linux v6.9.0-0.rc1.7033999ecd7b + +* Tue Mar 26 2024 Fedora Kernel Team [6.9.0-0.rc1.928a87efa423.17] +- all: clean-up i915 (Peter Robinson) - Turn on CONFIG_READ_ONLY_THP_FOR_FS for Fedora (Justin M. Forbes) -- Change fedora-stable-release.sh to use git am (Justin M. Forbes) -- drivers/firmware: skip simpledrm if nvidia-drm.modeset=1 is set (Javier Martinez Canillas) -- Revert libcpupower soname bump for F38/39 (Justin M. Forbes) -- Fix up requires for UKI (Justin M. Forbes) -- drm/amd: Flush GFXOFF requests in prepare stage (Mario Limonciello) -- Linux v6.8.2 - -* Wed Mar 20 2024 Augusto Caringi [6.8.1-0] -- redhat/configs: Enable CONFIG_MITIGATION_RFDS (Augusto Caringi) +- redhat/kernel.spec.template: fix rtonly build (Jan Stancek) +- redhat/kernel.spec.template: add extra flags for tools build (Scott Weaver) +- Add iio-test-gts to mod-internal.list (Thorsten Leemhuis) +- Linux v6.9.0-0.rc1.928a87efa423 + +* Mon Mar 25 2024 Fedora Kernel Team [6.9.0-0.rc1.16] +- redhat/kernel.spec.template: update license (Scott Weaver) +- Fix typo in maintaining.rst file (Augusto Caringi) +- Linux v6.9.0-0.rc1 + +* Sun Mar 24 2024 Fedora Kernel Team [6.9.0-0.rc0.70293240c5ce.15] +- Linux v6.9.0-0.rc0.70293240c5ce + +* Sat Mar 23 2024 Fedora Kernel Team [6.9.0-0.rc0.bfa8f18691ed.14] +- Enable DRM_CDNS_DSI_J721E for fedora (Andrew Halaney) +- Linux v6.9.0-0.rc0.bfa8f18691ed + +* Fri Mar 22 2024 Fedora Kernel Team [6.9.0-0.rc0.8e938e398669.13] +- Linux v6.9.0-0.rc0.8e938e398669 + +* Thu Mar 21 2024 Fedora Kernel Team [6.9.0-0.rc0.23956900041d.12] +- Linux v6.9.0-0.rc0.23956900041d + +* Wed Mar 20 2024 Fedora Kernel Team [6.9.0-0.rc0.a4145ce1e7bc.11] +- gitlab-ci: do not merge ark-latest for gating pipelines (Michael Hofmann) - fedora: Enable MCP9600 (Peter Robinson) -- temporarily remove LIBBPF_DYNAMIC=1 from perf build (Thorsten Leemhuis) -- Added required files for rebase (Augusto Caringi) -- Linux v6.8.1 +- redhat/configs: Enable & consolidate BF-3 drivers config (Luiz Capitulino) +- redhat: Fix RT kernel kvm subpackage requires (Juri Lelli) +- Add new of_test module to mod-internal.list (Thorsten Leemhuis) +- Add new string kunit modules to mod-internal.list (Thorsten Leemhuis) +- Linux v6.9.0-0.rc0.a4145ce1e7bc + +* Tue Mar 19 2024 Fedora Kernel Team [6.9.0-0.rc0.b3603fcb79b1.10] +- redhat/kernel.spec.template: enable cross for base/RT (Peter Robinson) +- redhat/kernel.spec.template: Fix cross compiling (Peter Robinson) +- arch/x86/kernel/setup.c: fixup rh_check_supported (Scott Weaver) +- Linux v6.9.0-0.rc0.b3603fcb79b1 + +* Mon Mar 18 2024 Fedora Kernel Team [6.9.0-0.rc0.f6cef5f8c37f.9] +- Linux v6.9.0-0.rc0.f6cef5f8c37f + +* Sun Mar 17 2024 Fedora Kernel Team [6.9.0-0.rc0.741e9d668aa5.8] +- Linux v6.9.0-0.rc0.741e9d668aa5 + +* Sat Mar 16 2024 Fedora Kernel Team [6.9.0-0.rc0.66a27abac311.7] +- Enable CONFIG_USB_ONBOARD_HUB for RHEL (Charles Mirabile) +- redhat/Makefile.cross: Add CROSS_BASEONLY (Prarit Bhargava) +- gitlab-ci: fix ark-latest merging for parent pipelines running in forks (Michael Hofmann) +- Linux v6.9.0-0.rc0.66a27abac311 + +* Fri Mar 15 2024 Fedora Kernel Team [6.9.0-0.rc0.e5eb28f6d1af.6] +- Linux v6.9.0-0.rc0.e5eb28f6d1af + +* Fri Mar 15 2024 Fedora Kernel Team [6.9.0-0.rc0.480e035fc4c7.5] +- lsm: update security_lock_kernel_down (Scott Weaver) + +* Thu Mar 14 2024 Fedora Kernel Team [6.9.0-0.rc0.480e035fc4c7.4] +- Linux v6.9.0-0.rc0.480e035fc4c7 + +* Wed Mar 13 2024 Fedora Kernel Team [6.9.0-0.rc0.b0546776ad3f.3] +- Fix changelog after rebase (Augusto Caringi) +- Linux v6.9.0-0.rc0.b0546776ad3f -* Tue Mar 12 2024 Fedora Kernel Team [6.8.0-1] +* Tue Mar 12 2024 Fedora Kernel Team [6.9.0-0.rc0.855684c7d938.2] - redhat: remove "END OF CHANGELOG" marker from kernel.changelog (Herton R. Krzesinski) - gitlab-ci: enable all variants for rawhide/eln builder image gating (Michael Hofmann) - Fedora: enable Microchip and their useful drivers (Peter Robinson) @@ -6469,7 +6651,7 @@ fi\ - [initial commit] Add scripts (Laura Abbott) - [initial commit] Add configs (Laura Abbott) - [initial commit] Add Makefiles (Laura Abbott) -- Linux v6.8.0 +- Linux v6.9.0-0.rc0.855684c7d938 ### diff --git a/TOOLS/patch_configs.py b/TOOLS/patch_configs.py index f020fa3..8afca3d 100755 --- a/TOOLS/patch_configs.py +++ b/TOOLS/patch_configs.py @@ -24,7 +24,6 @@ GENERIC_PATCHES = [ # scheduler stuff ["SCHED_BORE", None, ENABLE], - # device specific config # Microsoft Surface ["HID_IPTS", None, MODULE], @@ -53,6 +52,9 @@ GENERIC_PATCHES = [ ARCH_PATCHES = { "x86_64": [ + # Temporary Fedora fix + ["CONFIG_IO_URING", None, ENABLE, "fedora"], + # Lenovo Legion ["LEGION_LAPTOP", None, MODULE], ["ACPI_CALL", None, MODULE], -- cgit v1.2.3