diff options
Diffstat (limited to 'patch-5.20-redhat.patch')
-rw-r--r-- | patch-5.20-redhat.patch | 1470 |
1 files changed, 84 insertions, 1386 deletions
diff --git a/patch-5.20-redhat.patch b/patch-5.20-redhat.patch index eb71e021f..f5713c242 100644 --- a/patch-5.20-redhat.patch +++ b/patch-5.20-redhat.patch @@ -1,5 +1,4 @@ Documentation/admin-guide/kernel-parameters.txt | 9 + - .../devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 + Kconfig | 2 + Kconfig.redhat | 17 + Makefile | 12 +- @@ -10,7 +9,7 @@ arch/s390/kernel/ipl.c | 5 + arch/s390/kernel/setup.c | 4 + arch/x86/kernel/cpu/common.c | 1 + - arch/x86/kernel/setup.c | 68 +- + arch/x86/kernel/setup.c | 68 ++- drivers/acpi/apei/hest.c | 8 + drivers/acpi/irq.c | 17 +- drivers/acpi/scan.c | 9 + @@ -18,34 +17,25 @@ drivers/char/ipmi/ipmi_dmi.c | 15 + drivers/char/ipmi/ipmi_msghandler.c | 16 +- drivers/firmware/efi/Makefile | 1 + - drivers/firmware/efi/efi.c | 124 ++- - drivers/firmware/efi/secureboot.c | 38 + + drivers/firmware/efi/efi.c | 124 +++-- + drivers/firmware/efi/secureboot.c | 38 ++ drivers/gpu/drm/drm_ioctl.c | 8 +- - drivers/gpu/drm/v3d/Kconfig | 5 +- - drivers/gpu/drm/v3d/v3d_debugfs.c | 18 +- - drivers/gpu/drm/v3d/v3d_drv.c | 12 +- - drivers/gpu/drm/v3d/v3d_gem.c | 12 +- - drivers/hid/hid-rmi.c | 64 -- + drivers/hid/hid-rmi.c | 64 --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 19 + - drivers/input/rmi4/rmi_driver.c | 124 +-- + drivers/input/rmi4/rmi_driver.c | 124 +++-- drivers/iommu/iommu.c | 22 + drivers/message/fusion/mptsas.c | 10 + drivers/message/fusion/mptspi.c | 11 + - drivers/net/phy/Kconfig | 5 + - drivers/net/phy/Makefile | 1 + - drivers/net/phy/bcm-phy-lib.h | 19 + - drivers/net/phy/bcm-phy-ptp.c | 944 +++++++++++++++++++++ - drivers/net/phy/broadcom.c | 33 +- drivers/net/wireguard/main.c | 6 + drivers/nvme/host/core.c | 22 +- drivers/nvme/host/multipath.c | 19 +- drivers/nvme/host/nvme.h | 4 + - drivers/pci/pci-driver.c | 78 ++ + drivers/pci/pci-driver.c | 78 ++++ drivers/pci/quirks.c | 24 + drivers/scsi/aacraid/linit.c | 2 + drivers/scsi/be2iscsi/be_main.c | 2 + drivers/scsi/hpsa.c | 4 + - drivers/scsi/lpfc/lpfc_ids.h | 14 + + drivers/scsi/lpfc/lpfc_ids.h | 12 + drivers/scsi/megaraid/megaraid_sas_base.c | 4 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 + drivers/scsi/qla2xxx/qla_os.c | 6 + @@ -59,7 +49,7 @@ include/linux/module.h | 1 + include/linux/panic.h | 18 +- include/linux/pci.h | 16 + - include/linux/rh_kabi.h | 515 +++++++++++ + include/linux/rh_kabi.h | 515 +++++++++++++++++++++ include/linux/rmi.h | 1 + include/linux/security.h | 5 + init/Kconfig | 2 +- @@ -67,21 +57,21 @@ kernel/bpf/syscall.c | 23 + kernel/module/main.c | 2 + kernel/module/signing.c | 9 +- - kernel/panic.c | 14 + - kernel/rh_messages.c | 209 +++++ + kernel/panic.c | 13 + + kernel/rh_messages.c | 209 +++++++++ scripts/mod/modpost.c | 8 + scripts/tags.sh | 2 + security/integrity/platform_certs/load_uefi.c | 6 +- security/lockdown/Kconfig | 13 + security/lockdown/lockdown.c | 1 + security/security.c | 6 + - 77 files changed, 2555 insertions(+), 233 deletions(-) + 67 files changed, 1547 insertions(+), 188 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index 0e990f7c2aa3..9d28feed61de 100644 +index bab2b0bf5988..5b8e4ea0d0af 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -6352,6 +6352,15 @@ +@@ -6377,6 +6377,15 @@ unknown_nmi_panic [X86] Cause panic on unknown NMI. @@ -97,18 +87,6 @@ index 0e990f7c2aa3..9d28feed61de 100644 usbcore.authorized_default= [USB] Default USB device authorization: (default -1 = authorized except for wireless USB, -diff --git a/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml b/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml -index e6485f7b046f..217c42874f41 100644 ---- a/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml -+++ b/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml -@@ -16,6 +16,7 @@ properties: - - compatible: - enum: -+ - brcm,2711-v3d - - brcm,7268-v3d - - brcm,7278-v3d - diff --git a/Kconfig b/Kconfig index 745bc773f567..f57ff40109d7 100644 --- a/Kconfig @@ -173,7 +151,7 @@ index dc6295f91263..c2c9bac44473 100644 $(version_h): PATCHLEVEL := $(or $(PATCHLEVEL), 0) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 4294c0123857..19324224065a 100644 +index 87badeae3181..2ec7919034d8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1387,9 +1387,9 @@ config HIGHMEM @@ -189,7 +167,7 @@ index 4294c0123857..19324224065a 100644 The VM uses one page of physical memory for each page table. For systems with a lot of processes, this can use a lot of diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index e05fc9743767..fccef2e70781 100644 +index 571cc234d0b3..2e07c933e97e 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1165,7 +1165,7 @@ endchoice @@ -251,7 +229,7 @@ index 1cc85b8ff42e..b7ee128c67ce 100644 + return !!ipl_secure_flag; +} diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c -index ebad41afe355..22a425157a02 100644 +index ed4fbbbdd1b0..fbc9fcf681c2 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -49,6 +49,7 @@ @@ -262,7 +240,7 @@ index ebad41afe355..22a425157a02 100644 #include <linux/hugetlb.h> #include <linux/kmemleak.h> -@@ -968,6 +969,9 @@ void __init setup_arch(char **cmdline_p) +@@ -967,6 +968,9 @@ void __init setup_arch(char **cmdline_p) log_component_list(); @@ -461,10 +439,10 @@ index dabe45eba055..82cf1ddf25d6 100644 return ctx.rc; } diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index b100e6ca9bb4..93d4fe0e5e16 100644 +index 42cec8120f18..c6dc77dba6b6 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c -@@ -1751,6 +1751,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) +@@ -1752,6 +1752,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) return false; @@ -571,10 +549,10 @@ index 703433493c85..6b1b102b9b7d 100644 rv = ipmi_register_driver(); mutex_unlock(&ipmi_interfaces_mutex); diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile -index c02ff25dd477..d860f8eb9a81 100644 +index 8d151e332584..bd29fe4ddbf3 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile -@@ -28,6 +28,7 @@ obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_map.o +@@ -27,6 +27,7 @@ obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_map.o obj-$(CONFIG_EFI_BOOTLOADER_CONTROL) += efibc.o obj-$(CONFIG_EFI_TEST) += test/ obj-$(CONFIG_EFI_DEV_PATH_PARSER) += dev-path-parser.o @@ -583,7 +561,7 @@ index c02ff25dd477..d860f8eb9a81 100644 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 860534bcfdac..96548e72f5df 100644 +index e4080ad96089..e050d2f8dbe5 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -31,6 +31,7 @@ @@ -594,7 +572,7 @@ index 860534bcfdac..96548e72f5df 100644 #include <asm/early_ioremap.h> -@@ -862,40 +863,101 @@ int efi_mem_type(unsigned long phys_addr) +@@ -864,40 +865,101 @@ int efi_mem_type(unsigned long phys_addr) } #endif @@ -725,8 +703,8 @@ index 860534bcfdac..96548e72f5df 100644 + return "Unknown error code"; + return found->description; } + EXPORT_SYMBOL_GPL(efi_status_to_err); - static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock); diff --git a/drivers/firmware/efi/secureboot.c b/drivers/firmware/efi/secureboot.c new file mode 100644 index 000000000000..de0a3714a5d4 @@ -772,7 +750,7 @@ index 000000000000..de0a3714a5d4 + } +} diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c -index 51fcf1298023..7f1097947731 100644 +index 8faad23dc1d8..ca2a6e6101dc 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -472,7 +472,13 @@ EXPORT_SYMBOL(drm_invalid_op); @@ -790,187 +768,6 @@ index 51fcf1298023..7f1097947731 100644 /* don't overflow userbuf */ len = strlen(value); -diff --git a/drivers/gpu/drm/v3d/Kconfig b/drivers/gpu/drm/v3d/Kconfig -index e973ec487484..ce62c5908e1d 100644 ---- a/drivers/gpu/drm/v3d/Kconfig -+++ b/drivers/gpu/drm/v3d/Kconfig -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0-only - config DRM_V3D - tristate "Broadcom V3D 3.x and newer" -- depends on ARCH_BCM || ARCH_BRCMSTB || COMPILE_TEST -+ depends on ARCH_BCM || ARCH_BRCMSTB || ARCH_BCM2835 || COMPILE_TEST - depends on DRM - depends on COMMON_CLK - depends on MMU -@@ -9,4 +9,5 @@ config DRM_V3D - select DRM_GEM_SHMEM_HELPER - help - Choose this option if you have a system that has a Broadcom -- V3D 3.x or newer GPU, such as BCM7268. -+ V3D 3.x or newer GPUs. SoCs supported include the BCM2711, -+ BCM7268 and BCM7278. -diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c -index 29fd13109e43..efbde124c296 100644 ---- a/drivers/gpu/drm/v3d/v3d_debugfs.c -+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c -@@ -4,7 +4,6 @@ - #include <linux/circ_buf.h> - #include <linux/ctype.h> - #include <linux/debugfs.h> --#include <linux/pm_runtime.h> - #include <linux/seq_file.h> - #include <linux/string_helpers.h> - -@@ -131,11 +130,7 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused) - struct drm_device *dev = node->minor->dev; - struct v3d_dev *v3d = to_v3d_dev(dev); - u32 ident0, ident1, ident2, ident3, cores; -- int ret, core; -- -- ret = pm_runtime_get_sync(v3d->drm.dev); -- if (ret < 0) -- return ret; -+ int core; - - ident0 = V3D_READ(V3D_HUB_IDENT0); - ident1 = V3D_READ(V3D_HUB_IDENT1); -@@ -188,9 +183,6 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused) - (misccfg & V3D_MISCCFG_OVRTMUOUT) != 0); - } - -- pm_runtime_mark_last_busy(v3d->drm.dev); -- pm_runtime_put_autosuspend(v3d->drm.dev); -- - return 0; - } - -@@ -218,11 +210,6 @@ static int v3d_measure_clock(struct seq_file *m, void *unused) - uint32_t cycles; - int core = 0; - int measure_ms = 1000; -- int ret; -- -- ret = pm_runtime_get_sync(v3d->drm.dev); -- if (ret < 0) -- return ret; - - if (v3d->ver >= 40) { - V3D_CORE_WRITE(core, V3D_V4_PCTR_0_SRC_0_3, -@@ -246,9 +233,6 @@ static int v3d_measure_clock(struct seq_file *m, void *unused) - cycles / (measure_ms * 1000), - (cycles / (measure_ms * 100)) % 10); - -- pm_runtime_mark_last_busy(v3d->drm.dev); -- pm_runtime_put_autosuspend(v3d->drm.dev); -- - return 0; - } - -diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c -index 1afcd54fbbd5..8c7f910daa28 100644 ---- a/drivers/gpu/drm/v3d/v3d_drv.c -+++ b/drivers/gpu/drm/v3d/v3d_drv.c -@@ -19,7 +19,6 @@ - #include <linux/module.h> - #include <linux/of_platform.h> - #include <linux/platform_device.h> --#include <linux/pm_runtime.h> - #include <linux/reset.h> - - #include <drm/drm_drv.h> -@@ -43,7 +42,6 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data, - { - struct v3d_dev *v3d = to_v3d_dev(dev); - struct drm_v3d_get_param *args = data; -- int ret; - static const u32 reg_map[] = { - [DRM_V3D_PARAM_V3D_UIFCFG] = V3D_HUB_UIFCFG, - [DRM_V3D_PARAM_V3D_HUB_IDENT1] = V3D_HUB_IDENT1, -@@ -69,17 +67,12 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data, - if (args->value != 0) - return -EINVAL; - -- ret = pm_runtime_get_sync(v3d->drm.dev); -- if (ret < 0) -- return ret; - if (args->param >= DRM_V3D_PARAM_V3D_CORE0_IDENT0 && - args->param <= DRM_V3D_PARAM_V3D_CORE0_IDENT2) { - args->value = V3D_CORE_READ(0, offset); - } else { - args->value = V3D_READ(offset); - } -- pm_runtime_mark_last_busy(v3d->drm.dev); -- pm_runtime_put_autosuspend(v3d->drm.dev); - return 0; - } - -@@ -198,6 +191,7 @@ static const struct drm_driver v3d_drm_driver = { - }; - - static const struct of_device_id v3d_of_match[] = { -+ { .compatible = "brcm,2711-v3d" }, - { .compatible = "brcm,7268-v3d" }, - { .compatible = "brcm,7278-v3d" }, - {}, -@@ -280,10 +274,6 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) - return -ENOMEM; - } - -- pm_runtime_use_autosuspend(dev); -- pm_runtime_set_autosuspend_delay(dev, 50); -- pm_runtime_enable(dev); -- - ret = v3d_gem_init(drm); - if (ret) - goto dma_free; -diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c -index 2352e9640922..725a252e837b 100644 ---- a/drivers/gpu/drm/v3d/v3d_gem.c -+++ b/drivers/gpu/drm/v3d/v3d_gem.c -@@ -6,7 +6,6 @@ - #include <linux/io.h> - #include <linux/module.h> - #include <linux/platform_device.h> --#include <linux/pm_runtime.h> - #include <linux/reset.h> - #include <linux/sched/signal.h> - #include <linux/uaccess.h> -@@ -372,9 +371,6 @@ v3d_job_free(struct kref *ref) - dma_fence_put(job->irq_fence); - dma_fence_put(job->done_fence); - -- pm_runtime_mark_last_busy(job->v3d->drm.dev); -- pm_runtime_put_autosuspend(job->v3d->drm.dev); -- - if (job->perfmon) - v3d_perfmon_put(job->perfmon); - -@@ -476,14 +472,10 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv, - job->v3d = v3d; - job->free = free; - -- ret = pm_runtime_get_sync(v3d->drm.dev); -- if (ret < 0) -- goto fail; -- - ret = drm_sched_job_init(&job->base, &v3d_priv->sched_entity[queue], - v3d_priv); - if (ret) -- goto fail_job; -+ goto fail; - - if (has_multisync) { - if (se->in_sync_count && se->wait_stage == queue) { -@@ -514,8 +506,6 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv, - - fail_deps: - drm_sched_job_cleanup(&job->base); --fail_job: -- pm_runtime_put_autosuspend(v3d->drm.dev); - fail: - kfree(*container); - *container = NULL; diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 311eee599ce9..2460c6bd46f8 100644 --- a/drivers/hid/hid-rmi.c @@ -1072,7 +869,7 @@ index 311eee599ce9..2460c6bd46f8 100644 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 87299e99dabb..d37b689ad1bf 100644 +index d39660a3e50c..8e5ffb4325a3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -9,6 +9,7 @@ @@ -1083,7 +880,7 @@ index 87299e99dabb..d37b689ad1bf 100644 #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h> -@@ -2123,6 +2124,16 @@ static const struct amba_id etm4_ids[] = { +@@ -2137,6 +2138,16 @@ static const struct amba_id etm4_ids[] = { {}, }; @@ -1100,7 +897,7 @@ index 87299e99dabb..d37b689ad1bf 100644 MODULE_DEVICE_TABLE(amba, etm4_ids); static struct amba_driver etm4x_amba_driver = { -@@ -2156,6 +2167,11 @@ static int __init etm4x_init(void) +@@ -2170,6 +2181,11 @@ static int __init etm4x_init(void) { int ret; @@ -1112,7 +909,7 @@ index 87299e99dabb..d37b689ad1bf 100644 ret = etm4_pm_setup(); /* etm4_pm_setup() does its own cleanup - exit on error */ -@@ -2182,6 +2198,9 @@ static int __init etm4x_init(void) +@@ -2196,6 +2212,9 @@ static int __init etm4x_init(void) static void __exit etm4x_exit(void) { @@ -1315,7 +1112,7 @@ index 258d5fe3d395..f7298e3dc8f3 100644 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 847ad47a2dfd..e5e545c80de7 100644 +index 780fb7071577..b5eb4f837b44 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -7,6 +7,7 @@ @@ -1326,7 +1123,7 @@ index 847ad47a2dfd..e5e545c80de7 100644 #include <linux/dma-iommu.h> #include <linux/kernel.h> #include <linux/bits.h> -@@ -2856,6 +2857,27 @@ u32 iommu_sva_get_pasid(struct iommu_sva *handle) +@@ -2843,6 +2844,27 @@ u32 iommu_sva_get_pasid(struct iommu_sva *handle) } EXPORT_SYMBOL_GPL(iommu_sva_get_pasid); @@ -1390,7 +1187,7 @@ index 34901bcd1ce8..24194dbc2784 100644 }; MODULE_DEVICE_TABLE(pci, mptsas_pci_table); diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c -index 388675cc1765..8c7d0740efb6 100644 +index 62089a8caa2f..2606c7cafcf7 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c @@ -1238,12 +1238,17 @@ static struct spi_function_template mptspi_transport_functions = { @@ -1424,1098 +1221,6 @@ index 388675cc1765..8c7d0740efb6 100644 return 0; out_mptspi_probe: -diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig -index 9fee639ee5c8..4bb231013009 100644 ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -104,6 +104,8 @@ config AX88796B_PHY - config BROADCOM_PHY - tristate "Broadcom 54XX PHYs" - select BCM_NET_PHYLIB -+ select BCM_NET_PHYPTP if NETWORK_PHY_TIMESTAMPING -+ depends on PTP_1588_CLOCK_OPTIONAL - help - Currently supports the BCM5411, BCM5421, BCM5461, BCM54616S, BCM5464, - BCM5481, BCM54810 and BCM5482 PHYs. -@@ -160,6 +162,9 @@ config BCM_CYGNUS_PHY - config BCM_NET_PHYLIB - tristate - -+config BCM_NET_PHYPTP -+ tristate -+ - config CICADA_PHY - tristate "Cicada PHYs" - help -diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile -index b12b1d86fc99..f7138d3c896b 100644 ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -47,6 +47,7 @@ obj-$(CONFIG_BCM84881_PHY) += bcm84881.o - obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygnus.o - obj-$(CONFIG_BCM_NET_PHYLIB) += bcm-phy-lib.o -+obj-$(CONFIG_BCM_NET_PHYPTP) += bcm-phy-ptp.o - obj-$(CONFIG_BROADCOM_PHY) += broadcom.o - obj-$(CONFIG_CICADA_PHY) += cicada.o - obj-$(CONFIG_CORTINA_PHY) += cortina.o -diff --git a/drivers/net/phy/bcm-phy-lib.h b/drivers/net/phy/bcm-phy-lib.h -index c3842f87c33b..9902fb182099 100644 ---- a/drivers/net/phy/bcm-phy-lib.h -+++ b/drivers/net/phy/bcm-phy-lib.h -@@ -87,4 +87,23 @@ int bcm_phy_cable_test_start_rdb(struct phy_device *phydev); - int bcm_phy_cable_test_start(struct phy_device *phydev); - int bcm_phy_cable_test_get_status(struct phy_device *phydev, bool *finished); - -+#if IS_ENABLED(CONFIG_BCM_NET_PHYPTP) -+struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev); -+void bcm_ptp_config_init(struct phy_device *phydev); -+void bcm_ptp_stop(struct bcm_ptp_private *priv); -+#else -+static inline struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev) -+{ -+ return NULL; -+} -+ -+static inline void bcm_ptp_config_init(struct phy_device *phydev) -+{ -+} -+ -+static inline void bcm_ptp_stop(struct bcm_ptp_private *priv) -+{ -+} -+#endif -+ - #endif /* _LINUX_BCM_PHY_LIB_H */ -diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c -new file mode 100644 -index 000000000000..ef00d6163061 ---- /dev/null -+++ b/drivers/net/phy/bcm-phy-ptp.c -@@ -0,0 +1,944 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (C) 2022 Meta Platforms Inc. -+ * Copyright (C) 2022 Jonathan Lemon <jonathan.lemon@gmail.com> -+ */ -+ -+#include <asm/unaligned.h> -+#include <linux/mii.h> -+#include <linux/phy.h> -+#include <linux/ptp_classify.h> -+#include <linux/ptp_clock_kernel.h> -+#include <linux/net_tstamp.h> -+#include <linux/netdevice.h> -+#include <linux/workqueue.h> -+ -+#include "bcm-phy-lib.h" -+ -+/* IEEE 1588 Expansion registers */ -+#define SLICE_CTRL 0x0810 -+#define SLICE_TX_EN BIT(0) -+#define SLICE_RX_EN BIT(8) -+#define TX_EVENT_MODE 0x0811 -+#define MODE_TX_UPDATE_CF BIT(0) -+#define MODE_TX_REPLACE_TS_CF BIT(1) -+#define MODE_TX_REPLACE_TS GENMASK(1, 0) -+#define RX_EVENT_MODE 0x0819 -+#define MODE_RX_UPDATE_CF BIT(0) -+#define MODE_RX_INSERT_TS_48 BIT(1) -+#define MODE_RX_INSERT_TS_64 GENMASK(1, 0) -+ -+#define MODE_EVT_SHIFT_SYNC 0 -+#define MODE_EVT_SHIFT_DELAY_REQ 2 -+#define MODE_EVT_SHIFT_PDELAY_REQ 4 -+#define MODE_EVT_SHIFT_PDELAY_RESP 6 -+ -+#define MODE_SEL_SHIFT_PORT 0 -+#define MODE_SEL_SHIFT_CPU 8 -+ -+#define RX_MODE_SEL(sel, evt, act) \ -+ (((MODE_RX_##act) << (MODE_EVT_SHIFT_##evt)) << (MODE_SEL_SHIFT_##sel)) -+ -+#define TX_MODE_SEL(sel, evt, act) \ -+ (((MODE_TX_##act) << (MODE_EVT_SHIFT_##evt)) << (MODE_SEL_SHIFT_##sel)) -+ -+/* needs global TS capture first */ -+#define TX_TS_CAPTURE 0x0821 -+#define TX_TS_CAP_EN BIT(0) -+#define RX_TS_CAPTURE 0x0822 -+#define RX_TS_CAP_EN BIT(0) -+ -+#define TIME_CODE_0 0x0854 -+#define TIME_CODE_1 0x0855 -+#define TIME_CODE_2 0x0856 -+#define TIME_CODE_3 0x0857 -+#define TIME_CODE_4 0x0858 -+ -+#define DPLL_SELECT 0x085b -+#define DPLL_HB_MODE2 BIT(6) -+ -+#define SHADOW_CTRL 0x085c -+#define SHADOW_LOAD 0x085d -+#define TIME_CODE_LOAD BIT(10) -+#define SYNC_OUT_LOAD BIT(9) -+#define NCO_TIME_LOAD BIT(7) -+#define FREQ_LOAD BIT(6) -+#define INTR_MASK 0x085e -+#define INTR_STATUS 0x085f -+#define INTC_FSYNC BIT(0) -+#define INTC_SOP BIT(1) -+ -+#define NCO_FREQ_LSB 0x0873 -+#define NCO_FREQ_MSB 0x0874 -+ -+#define NCO_TIME_0 0x0875 -+#define NCO_TIME_1 0x0876 -+#define NCO_TIME_2_CTRL 0x0877 -+#define FREQ_MDIO_SEL BIT(14) -+ -+#define SYNC_OUT_0 0x0878 -+#define SYNC_OUT_1 0x0879 -+#define SYNC_OUT_2 0x087a -+ -+#define SYNC_IN_DIVIDER 0x087b -+ -+#define SYNOUT_TS_0 0x087c -+#define SYNOUT_TS_1 0x087d -+#define SYNOUT_TS_2 0x087e -+ -+#define NSE_CTRL 0x087f -+#define NSE_GMODE_EN GENMASK(15, 14) -+#define NSE_CAPTURE_EN BIT(13) -+#define NSE_INIT BIT(12) -+#define NSE_CPU_FRAMESYNC BIT(5) -+#define NSE_SYNC1_FRAMESYNC BIT(3) -+#define NSE_FRAMESYNC_MASK GENMASK(5, 2) -+#define NSE_PEROUT_EN BIT(1) -+#define NSE_ONESHOT_EN BIT(0) -+#define NSE_SYNC_OUT_MASK GENMASK(1, 0) -+ -+#define TS_READ_CTRL 0x0885 -+#define TS_READ_START BIT(0) -+#define TS_READ_END BIT(1) -+ -+#define HB_REG_0 0x0886 -+#define HB_REG_1 0x0887 -+#define HB_REG_2 0x0888 -+#define HB_REG_3 0x08ec -+#define HB_REG_4 0x08ed -+#define HB_STAT_CTRL 0x088e -+#define HB_READ_START BIT(10) -+#define HB_READ_END BIT(11) -+#define HB_READ_MASK GENMASK(11, 10) -+ -+#define TS_REG_0 0x0889 -+#define TS_REG_1 0x088a -+#define TS_REG_2 0x088b -+#define TS_REG_3 0x08c4 -+ -+#define TS_INFO_0 0x088c -+#define TS_INFO_1 0x088d -+ -+#define TIMECODE_CTRL 0x08c3 -+#define TX_TIMECODE_SEL GENMASK(7, 0) -+#define RX_TIMECODE_SEL GENMASK(15, 8) -+ -+#define TIME_SYNC 0x0ff5 -+#define TIME_SYNC_EN BIT(0) -+ -+struct bcm_ptp_private { -+ struct phy_device *phydev; -+ struct mii_timestamper mii_ts; -+ struct ptp_clock *ptp_clock; -+ struct ptp_clock_info ptp_info; -+ struct ptp_pin_desc pin; -+ struct mutex mutex; -+ struct sk_buff_head tx_queue; -+ int tx_type; -+ bool hwts_rx; -+ u16 nse_ctrl; -+ bool pin_active; -+ struct delayed_work pin_work; -+}; -+ -+struct bcm_ptp_skb_cb { -+ unsigned long timeout; -+ u16 seq_id; -+ u8 msgtype; -+ bool discard; -+}; -+ -+struct bcm_ptp_capture { -+ ktime_t hwtstamp; -+ u16 seq_id; -+ u8 msgtype; -+ bool tx_dir; -+}; -+ -+#define BCM_SKB_CB(skb) ((struct bcm_ptp_skb_cb *)(skb)->cb) -+#define SKB_TS_TIMEOUT 10 /* jiffies */ -+ -+#define BCM_MAX_PULSE_8NS ((1U << 9) - 1) -+#define BCM_MAX_PERIOD_8NS ((1U << 30) - 1) -+ -+#define BRCM_PHY_MODEL(phydev) \ -+ ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) -+ -+static struct bcm_ptp_private *mii2priv(struct mii_timestamper *mii_ts) -+{ -+ return container_of(mii_ts, struct bcm_ptp_private, mii_ts); -+} -+ -+static struct bcm_ptp_private *ptp2priv(struct ptp_clock_info *info) -+{ -+ return container_of(info, struct bcm_ptp_private, ptp_info); -+} -+ -+static void bcm_ptp_get_framesync_ts(struct phy_device *phydev, -+ struct timespec64 *ts) -+{ -+ u16 hb[4]; -+ -+ bcm_phy_write_exp(phydev, HB_STAT_CTRL, HB_READ_START); -+ -+ hb[0] = bcm_phy_read_exp(phydev, HB_REG_0); -+ hb[1] = bcm_phy_read_exp(phydev, HB_REG_1); -+ hb[2] = bcm_phy_read_exp(phydev, HB_REG_2); -+ hb[3] = bcm_phy_read_exp(phydev, HB_REG_3); -+ -+ bcm_phy_write_exp(phydev, HB_STAT_CTRL, HB_READ_END); -+ bcm_phy_write_exp(phydev, HB_STAT_CTRL, 0); -+ -+ ts->tv_sec = (hb[3] << 16) | hb[2]; -+ ts->tv_nsec = (hb[1] << 16) | hb[0]; -+} -+ -+static u16 bcm_ptp_framesync_disable(struct phy_device *phydev, u16 orig_ctrl) -+{ -+ u16 ctrl = orig_ctrl & ~(NSE_FRAMESYNC_MASK | NSE_CAPTURE_EN); -+ -+ bcm_phy_write_exp(phydev, NSE_CTRL, ctrl); -+ -+ return ctrl; -+} -+ -+static void bcm_ptp_framesync_restore(struct phy_device *phydev, u16 orig_ctrl) -+{ -+ if (orig_ctrl & NSE_FRAMESYNC_MASK) -+ bcm_phy_write_exp(phydev, NSE_CTRL, orig_ctrl); -+} -+ -+static void bcm_ptp_framesync(struct phy_device *phydev, u16 ctrl) -+{ -+ /* trigger framesync - must have 0->1 transition. */ -+ bcm_phy_write_exp(phydev, NSE_CTRL, ctrl | NSE_CPU_FRAMESYNC); -+} -+ -+static int bcm_ptp_framesync_ts(struct phy_device *phydev, -+ struct ptp_system_timestamp *sts, -+ struct timespec64 *ts, -+ u16 orig_ctrl) -+{ -+ u16 ctrl, reg; -+ int i; -+ -+ ctrl = bcm_ptp_framesync_disable(phydev, orig_ctrl); -+ -+ ptp_read_system_prets(sts); -+ -+ /* trigger framesync + capture */ -+ bcm_ptp_framesync(phydev, ctrl | NSE_CAPTURE_EN); -+ -+ ptp_read_system_postts(sts); -+ -+ /* poll for FSYNC interrupt from TS capture */ -+ for (i = 0; i < 10; i++) { -+ reg = bcm_phy_read_exp(phydev, INTR_STATUS); -+ if (reg & INTC_FSYNC) { -+ bcm_ptp_get_framesync_ts(phydev, ts); -+ break; -+ } -+ } -+ -+ bcm_ptp_framesync_restore(phydev, orig_ctrl); -+ -+ return reg & INTC_FSYNC ? 0 : -ETIMEDOUT; -+} -+ -+static int bcm_ptp_gettimex(struct ptp_clock_info *info, -+ struct timespec64 *ts, -+ struct ptp_system_timestamp *sts) -+{ -+ struct bcm_ptp_private *priv = ptp2priv(info); -+ int err; -+ -+ mutex_lock(&priv->mutex); -+ err = bcm_ptp_framesync_ts(priv->phydev, sts, ts, priv->nse_ctrl); -+ mutex_unlock(&priv->mutex); -+ -+ return err; -+} -+ -+static int bcm_ptp_settime_locked(struct bcm_ptp_private *priv, -+ const struct timespec64 *ts) -+{ -+ struct phy_device *phydev = priv->phydev; -+ u16 ctrl; -+ u64 ns; -+ -+ ctrl = bcm_ptp_framesync_disable(phydev, priv->nse_ctrl); -+ -+ /* set up time code */ -+ bcm_phy_write_exp(phydev, TIME_CODE_0, ts->tv_nsec); -+ bcm_phy_write_exp(phydev, TIME_CODE_1, ts->tv_nsec >> 16); -+ bcm_phy_write_exp(phydev, TIME_CODE_2, ts->tv_sec); -+ bcm_phy_write_exp(phydev, TIME_CODE_3, ts->tv_sec >> 16); -+ bcm_phy_write_exp(phydev, TIME_CODE_4, ts->tv_sec >> 32); -+ -+ /* set NCO counter to match */ -+ ns = timespec64_to_ns(ts); -+ bcm_phy_write_exp(phydev, NCO_TIME_0, ns >> 4); -+ bcm_phy_write_exp(phydev, NCO_TIME_1, ns >> 20); -+ bcm_phy_write_exp(phydev, NCO_TIME_2_CTRL, (ns >> 36) & 0xfff); -+ -+ /* set up load on next frame sync (auto-clears due to NSE_INIT) */ -+ bcm_phy_write_exp(phydev, SHADOW_LOAD, TIME_CODE_LOAD | NCO_TIME_LOAD); -+ -+ /* must have NSE_INIT in order to write time code */ -+ bcm_ptp_framesync(phydev, ctrl | NSE_INIT); -+ -+ bcm_ptp_framesync_restore(phydev, priv->nse_ctrl); -+ -+ return 0; -+} -+ -+static int bcm_ptp_settime(struct ptp_clock_info *info, -+ const struct timespec64 *ts) -+{ -+ struct bcm_ptp_private *priv = ptp2priv(info); -+ int err; -+ -+ mutex_lock(&priv->mutex); -+ err = bcm_ptp_settime_locked(priv, ts); -+ mutex_unlock(&priv->mutex); -+ -+ return err; -+} -+ -+static int bcm_ptp_adjtime_locked(struct bcm_ptp_private *priv, -+ s64 delta_ns) -+{ -+ struct timespec64 ts; -+ int err; -+ s64 ns; -+ -+ err = bcm_ptp_framesync_ts(priv->phydev, NULL, &ts, priv->nse_ctrl); -+ if (!err) { -+ ns = timespec64_to_ns(&ts) + delta_ns; -+ ts = ns_to_timespec64(ns); -+ err = bcm_ptp_settime_locked(priv, &ts); -+ } -+ return err; -+} -+ -+static int bcm_ptp_adjtime(struct ptp_clock_info *info, s64 delta_ns) -+{ -+ struct bcm_ptp_private *priv = ptp2priv(info); -+ int err; -+ -+ mutex_lock(&priv->mutex); -+ err = bcm_ptp_adjtime_locked(priv, delta_ns); -+ mutex_unlock(&priv->mutex); -+ -+ return err; -+} -+ -+/* A 125Mhz clock should adjust 8ns per pulse. -+ * The frequency adjustment base is 0x8000 0000, or 8*2^28. -+ * -+ * Frequency adjustment is -+ * adj = scaled_ppm * 8*2^28 / (10^6 * 2^16) -+ * which simplifies to: -+ * adj = scaled_ppm * 2^9 / 5^6 -+ */ -+static int bcm_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm) -+{ -+ struct bcm_ptp_private *priv = ptp2priv(info); -+ int neg_adj = 0; -+ u32 diff, freq; -+ u16 ctrl; -+ u64 adj; -+ -+ if (scaled_ppm < 0) { -+ neg_adj = 1; -+ scaled_ppm = -scaled_ppm; -+ } -+ -+ adj = scaled_ppm << 9; -+ diff = div_u64(adj, 15625); -+ freq = (8 << 28) + (neg_adj ? -diff : diff); -+ -+ mutex_lock(&priv->mutex); -+ -+ ctrl = bcm_ptp_framesync_disable(priv->phydev, priv->nse_ctrl); -+ -+ bcm_phy_write_exp(priv->phydev, NCO_FREQ_LSB, freq); -+ bcm_phy_write_exp(priv->phydev, NCO_FREQ_MSB, freq >> 16); -+ -+ bcm_phy_write_exp(priv->phydev, NCO_TIME_2_CTRL, FREQ_MDIO_SEL); -+ -+ /* load on next framesync */ -+ bcm_phy_write_exp(priv->phydev, SHADOW_LOAD, FREQ_LOAD); -+ -+ bcm_ptp_framesync(priv->phydev, ctrl); -+ -+ /* clear load */ -+ bcm_phy_write_exp(priv->phydev, SHADOW_LOAD, 0); -+ -+ bcm_ptp_framesync_restore(priv->phydev, priv->nse_ctrl); -+ -+ mutex_unlock(&priv->mutex); -+ -+ return 0; -+} -+ -+static bool bcm_ptp_rxtstamp(struct mii_timestamper *mii_ts, -+ struct sk_buff *skb, int type) -+{ -+ struct bcm_ptp_private *priv = mii2priv(mii_ts); -+ struct skb_shared_hwtstamps *hwts; -+ struct ptp_header *header; -+ u32 sec, nsec; -+ u8 *data; -+ int off; -+ -+ if (!priv->hwts_rx) -+ return false; -+ -+ header = ptp_parse_header(skb, type); -+ if (!header) -+ return false; -+ -+ data = (u8 *)(header + 1); -+ sec = get_unaligned_be32(data); -+ nsec = get_unaligned_be32(data + 4); -+ -+ hwts = skb_hwtstamps(skb); -+ hwts->hwtstamp = ktime_set(sec, nsec); -+ -+ off = data - skb->data + 8; -+ if (off < skb->len) { -+ memmove(data, data + 8, skb->len - off); -+ __pskb_trim(skb, skb->len - 8); -+ } -+ -+ return false; -+} -+ -+static bool bcm_ptp_get_tstamp(struct bcm_ptp_private *priv, -+ struct bcm_ptp_capture *capts) -+{ -+ struct phy_device *phydev = priv->phydev; -+ u16 ts[4], reg; -+ u32 sec, nsec; -+ -+ mutex_lock(&priv->mutex); -+ -+ reg = bcm_phy_read_exp(phydev, INTR_STATUS); -+ if ((reg & INTC_SOP) == 0) { -+ mutex_unlock(&priv->mutex); -+ return false; -+ } -+ -+ bcm_phy_write_exp(phydev, TS_READ_CTRL, TS_READ_START); -+ -+ ts[0] = bcm_phy_read_exp(phydev, TS_REG_0); -+ ts[1] = bcm_phy_read_exp(phydev, TS_REG_1); -+ ts[2] = bcm_phy_read_exp(phydev, TS_REG_2); -+ ts[3] = bcm_phy_read_exp(phydev, TS_REG_3); -+ -+ /* not in be32 format for some reason */ -+ capts->seq_id = bcm_phy_read_exp(priv->phydev, TS_INFO_0); -+ -+ reg = bcm_phy_read_exp(phydev, TS_INFO_1); -+ capts->msgtype = reg >> 12; -+ capts->tx_dir = !!(reg & BIT(11)); -+ -+ bcm_phy_write_exp(phydev, TS_READ_CTRL, TS_READ_END); -+ bcm_phy_write_exp(phydev, TS_READ_CTRL, 0); -+ -+ mutex_unlock(&priv->mutex); -+ -+ sec = (ts[3] << 16) | ts[2]; -+ nsec = (ts[1] << 16) | ts[0]; -+ capts->hwtstamp = ktime_set(sec, nsec); -+ -+ return true; -+} -+ -+static void bcm_ptp_match_tstamp(struct bcm_ptp_private *priv, -+ struct bcm_ptp_capture *capts) -+{ -+ struct skb_shared_hwtstamps hwts; -+ struct sk_buff *skb, *ts_skb; -+ unsigned long flags; -+ bool first = false; -+ -+ ts_skb = NULL; -+ spin_lock_irqsave(&priv->tx_queue.lock, flags); -+ skb_queue_walk(&priv->tx_queue, skb) { -+ if (BCM_SKB_CB(skb)->seq_id == capts->seq_id && -+ BCM_SKB_CB(skb)->msgtype == capts->msgtype) { -+ first = skb_queue_is_first(&priv->tx_queue, skb); -+ __skb_unlink(skb, &priv->tx_queue); -+ ts_skb = skb; -+ break; -+ } -+ } -+ spin_unlock_irqrestore(&priv->tx_queue.lock, flags); -+ -+ /* TX captures one-step packets, discard them if needed. */ -+ if (ts_skb) { -+ if (BCM_SKB_CB(ts_skb)->discard) { -+ kfree_skb(ts_skb); -+ } else { -+ memset(&hwts, 0, sizeof(hwts)); -+ hwts.hwtstamp = capts->hwtstamp; -+ skb_complete_tx_timestamp(ts_skb, &hwts); -+ } -+ } -+ -+ /* not first match, try and expire entries */ -+ if (!first) { -+ while ((skb = skb_dequeue(&priv->tx_queue))) { -+ if (!time_after(jiffies, BCM_SKB_CB(skb)->timeout)) { -+ skb_queue_head(&priv->tx_queue, skb); -+ break; -+ } -+ kfree_skb(skb); -+ } -+ } -+} -+ -+static long bcm_ptp_do_aux_work(struct ptp_clock_info *info) -+{ -+ struct bcm_ptp_private *priv = ptp2priv(info); -+ struct bcm_ptp_capture capts; -+ bool reschedule = false; -+ -+ while (!skb_queue_empty_lockless(&priv->tx_queue)) { -+ if (!bcm_ptp_get_tstamp(priv, &capts)) { -+ reschedule = true; -+ break; -+ } -+ bcm_ptp_match_tstamp(priv, &capts); -+ } -+ -+ return reschedule ? 1 : -1; -+} -+ -+static int bcm_ptp_cancel_func(struct bcm_ptp_private *priv) -+{ -+ if (!priv->pin_active) -+ return 0; -+ -+ priv->pin_active = false; -+ -+ priv->nse_ctrl &= ~(NSE_SYNC_OUT_MASK | NSE_SYNC1_FRAMESYNC | -+ NSE_CAPTURE_EN); -+ bcm_phy_write_exp(priv->phydev, NSE_CTRL, priv->nse_ctrl); -+ -+ cancel_delayed_work_sync(&priv->pin_work); -+ -+ return 0; -+} -+ -+static void bcm_ptp_perout_work(struct work_struct *pin_work) -+{ -+ struct bcm_ptp_private *priv = -+ container_of(pin_work, struct bcm_ptp_private, pin_work.work); -+ struct phy_device *phydev = priv->phydev; -+ struct timespec64 ts; -+ u64 ns, next; -+ u16 ctrl; -+ -+ mutex_lock(&priv->mutex); -+ -+ /* no longer running */ -+ if (!priv->pin_active) { -+ mutex_unlock(&priv->mutex); -+ return; -+ } -+ -+ bcm_ptp_framesync_ts(phydev, NULL, &ts, priv->nse_ctrl); -+ -+ /* this is 1PPS only */ -+ next = NSEC_PER_SEC - ts.tv_nsec; -+ ts.tv_sec += next < NSEC_PER_MSEC ? 2 : 1; -+ ts.tv_nsec = 0; -+ -+ ns = timespec64_to_ns(&ts); -+ -+ /* force 0->1 transition for ONESHOT */ -+ ctrl = bcm_ptp_framesync_disable(phydev, -+ priv->nse_ctrl & ~NSE_ONESHOT_EN); -+ -+ bcm_phy_write_exp(phydev, SYNOUT_TS_0, ns & 0xfff0); -+ bcm_phy_write_exp(phydev, SYNOUT_TS_1, ns >> 16); -+ bcm_phy_write_exp(phydev, SYNOUT_TS_2, ns >> 32); -+ -+ /* load values on next framesync */ -+ bcm_phy_write_exp(phydev, SHADOW_LOAD, SYNC_OUT_LOAD); -+ -+ bcm_ptp_framesync(phydev, ctrl | NSE_ONESHOT_EN | NSE_INIT); -+ -+ priv->nse_ctrl |= NSE_ONESHOT_EN; -+ bcm_ptp_framesync_restore(phydev, priv->nse_ctrl); -+ -+ mutex_unlock(&priv->mutex); -+ -+ next = next + NSEC_PER_MSEC; -+ schedule_delayed_work(&priv->pin_work, nsecs_to_jiffies(next)); -+} -+ -+static int bcm_ptp_perout_locked(struct bcm_ptp_private *priv, -+ struct ptp_perout_request *req, int on) -+{ -+ struct phy_device *phydev = priv->phydev; -+ u64 period, pulse; -+ u16 val; -+ -+ if (!on) -+ return bcm_ptp_cancel_func(priv); -+ -+ /* 1PPS */ -+ if (req->period.sec != 1 || req->period.nsec != 0) -+ return -EINVAL; -+ -+ period = BCM_MAX_PERIOD_8NS; /* write nonzero value */ -+ -+ if (req->flags & PTP_PEROUT_PHASE) -+ return -EOPNOTSUPP; -+ -+ if (req->flags & PTP_PEROUT_DUTY_CYCLE) -+ pulse = ktime_to_ns(ktime_set(req->on.sec, req->on.nsec)); -+ else -+ pulse = (u64)BCM_MAX_PULSE_8NS << 3; -+ -+ /* convert to 8ns units */ -+ pulse >>= 3; -+ -+ if (!pulse || pulse > period || pulse > BCM_MAX_PULSE_8NS) -+ return -EINVAL; -+ -+ bcm_phy_write_exp(phydev, SYNC_OUT_0, period); -+ -+ val = ((pulse & 0x3) << 14) | ((period >> 16) & 0x3fff); -+ bcm_phy_write_exp(phydev, SYNC_OUT_1, val); -+ -+ val = ((pulse >> 2) & 0x7f) | (pulse << 7); -+ bcm_phy_write_exp(phydev, SYNC_OUT_2, val); -+ -+ if (priv->pin_active) -+ cancel_delayed_work_sync(&priv->pin_work); -+ -+ priv->pin_active = true; -+ INIT_DELAYED_WORK(&priv->pin_work, bcm_ptp_perout_work); -+ schedule_delayed_work(&priv->pin_work, 0); -+ -+ return 0; -+} -+ -+static void bcm_ptp_extts_work(struct work_struct *pin_work) -+{ -+ struct bcm_ptp_private *priv = -+ container_of(pin_work, struct bcm_ptp_private, pin_work.work); -+ struct phy_device *phydev = priv->phydev; -+ struct ptp_clock_event event; -+ struct timespec64 ts; -+ u16 reg; -+ -+ mutex_lock(&priv->mutex); -+ -+ /* no longer running */ -+ if (!priv->pin_active) { -+ mutex_unlock(&priv->mutex); -+ return; -+ } -+ -+ reg = bcm_phy_read_exp(phydev, INTR_STATUS); -+ if ((reg & INTC_FSYNC) == 0) -+ goto out; -+ -+ bcm_ptp_get_framesync_ts(phydev, &ts); -+ -+ event.index = 0; -+ event.type = PTP_CLOCK_EXTTS; -+ event.timestamp = timespec64_to_ns(&ts); -+ ptp_clock_event(priv->ptp_clock, &event); -+ -+out: -+ mutex_unlock(&priv->mutex); -+ schedule_delayed_work(&priv->pin_work, HZ / 4); -+} -+ -+static int bcm_ptp_extts_locked(struct bcm_ptp_private *priv, int on) -+{ -+ struct phy_device *phydev = priv->phydev; -+ -+ if (!on) -+ return bcm_ptp_cancel_func(priv); -+ -+ if (priv->pin_active) -+ cancel_delayed_work_sync(&priv->pin_work); -+ -+ bcm_ptp_framesync_disable(phydev, priv->nse_ctrl); -+ -+ priv->nse_ctrl |= NSE_SYNC1_FRAMESYNC | NSE_CAPTURE_EN; -+ -+ bcm_ptp_framesync_restore(phydev, priv->nse_ctrl); -+ -+ priv->pin_active = true; -+ INIT_DELAYED_WORK(&priv->pin_work, bcm_ptp_extts_work); -+ schedule_delayed_work(&priv->pin_work, 0); -+ -+ return 0; -+} -+ -+static int bcm_ptp_enable(struct ptp_clock_info *info, -+ struct ptp_clock_request *rq, int on) -+{ -+ struct bcm_ptp_private *priv = ptp2priv(info); -+ int err = -EBUSY; -+ -+ mutex_lock(&priv->mutex); -+ -+ switch (rq->type) { -+ case PTP_CLK_REQ_PEROUT: -+ if (priv->pin.func == PTP_PF_PEROUT) -+ err = bcm_ptp_perout_locked(priv, &rq->perout, on); -+ break; -+ case PTP_CLK_REQ_EXTTS: -+ if (priv->pin.func == PTP_PF_EXTTS) -+ err = bcm_ptp_extts_locked(priv, on); -+ break; -+ default: -+ err = -EOPNOTSUPP; -+ break; -+ } -+ -+ mutex_unlock(&priv->mutex); -+ -+ return err; -+} -+ -+static int bcm_ptp_verify(struct ptp_clock_info *info, unsigned int pin, -+ enum ptp_pin_function func, unsigned int chan) -+{ -+ switch (func) { -+ case PTP_PF_NONE: -+ case PTP_PF_EXTTS: -+ case PTP_PF_PEROUT: -+ break; -+ default: -+ return -EOPNOTSUPP; -+ } -+ return 0; -+} -+ -+static const struct ptp_clock_info bcm_ptp_clock_info = { -+ .owner = THIS_MODULE, -+ .name = KBUILD_MODNAME, -+ .max_adj = 100000000, -+ .gettimex64 = bcm_ptp_gettimex, -+ .settime64 = bcm_ptp_settime, -+ .adjtime = bcm_ptp_adjtime, -+ .adjfine = bcm_ptp_adjfine, -+ .enable = bcm_ptp_enable, -+ .verify = bcm_ptp_verify, -+ .do_aux_work = bcm_ptp_do_aux_work, -+ .n_pins = 1, -+ .n_per_out = 1, -+ .n_ext_ts = 1, -+}; -+ -+static void bcm_ptp_txtstamp(struct mii_timestamper *mii_ts, -+ struct sk_buff *skb, int type) -+{ -+ struct bcm_ptp_private *priv = mii2priv(mii_ts); -+ struct ptp_header *hdr; -+ bool discard = false; -+ int msgtype; -+ -+ hdr = ptp_parse_header(skb, type); -+ if (!hdr) -+ goto out; -+ msgtype = ptp_get_msgtype(hdr, type); -+ -+ switch (priv->tx_type) { -+ case HWTSTAMP_TX_ONESTEP_P2P: -+ if (msgtype == PTP_MSGTYPE_PDELAY_RESP) -+ discard = true; -+ fallthrough; -+ case HWTSTAMP_TX_ONESTEP_SYNC: -+ if (msgtype == PTP_MSGTYPE_SYNC) -+ discard = true; -+ fallthrough; -+ case HWTSTAMP_TX_ON: -+ BCM_SKB_CB(skb)->timeout = jiffies + SKB_TS_TIMEOUT; -+ BCM_SKB_CB(skb)->seq_id = be16_to_cpu(hdr->sequence_id); -+ BCM_SKB_CB(skb)->msgtype = msgtype; -+ BCM_SKB_CB(skb)->discard = discard; -+ skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; -+ skb_queue_tail(&priv->tx_queue, skb); -+ ptp_schedule_worker(priv->ptp_clock, 0); -+ return; -+ default: -+ break; -+ } -+ -+out: -+ kfree_skb(skb); -+} -+ -+static int bcm_ptp_hwtstamp(struct mii_timestamper *mii_ts, -+ struct ifreq *ifr) -+{ -+ struct bcm_ptp_private *priv = mii2priv(mii_ts); -+ struct hwtstamp_config cfg; -+ u16 mode, ctrl; -+ -+ if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) -+ return -EFAULT; -+ -+ switch (cfg.rx_filter) { -+ case HWTSTAMP_FILTER_NONE: -+ priv->hwts_rx = false; -+ break; -+ case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: -+ case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: -+ case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: -+ case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: -+ case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: -+ case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: -+ case HWTSTAMP_FILTER_PTP_V2_EVENT: -+ case HWTSTAMP_FILTER_PTP_V2_SYNC: -+ case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: -+ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; -+ priv->hwts_rx = true; -+ break; -+ default: -+ return -ERANGE; -+ } -+ -+ priv->tx_type = cfg.tx_type; -+ -+ ctrl = priv->hwts_rx ? SLICE_RX_EN : 0; -+ ctrl |= priv->tx_type != HWTSTAMP_TX_OFF ? SLICE_TX_EN : 0; -+ -+ mode = TX_MODE_SEL(PORT, SYNC, REPLACE_TS) | -+ TX_MODE_SEL(PORT, DELAY_REQ, REPLACE_TS) | -+ TX_MODE_SEL(PORT, PDELAY_REQ, REPLACE_TS) | -+ TX_MODE_SEL(PORT, PDELAY_RESP, REPLACE_TS); -+ -+ bcm_phy_write_exp(priv->phydev, TX_EVENT_MODE, mode); -+ -+ mode = RX_MODE_SEL(PORT, SYNC, INSERT_TS_64) | -+ RX_MODE_SEL(PORT, DELAY_REQ, INSERT_TS_64) | -+ RX_MODE_SEL(PORT, PDELAY_REQ, INSERT_TS_64) | -+ RX_MODE_SEL(PORT, PDELAY_RESP, INSERT_TS_64); -+ -+ bcm_phy_write_exp(priv->phydev, RX_EVENT_MODE, mode); -+ -+ bcm_phy_write_exp(priv->phydev, SLICE_CTRL, ctrl); -+ -+ if (ctrl & SLICE_TX_EN) -+ bcm_phy_write_exp(priv->phydev, TX_TS_CAPTURE, TX_TS_CAP_EN); -+ else -+ ptp_cancel_worker_sync(priv->ptp_clock); -+ -+ /* purge existing data */ -+ skb_queue_purge(&priv->tx_queue); -+ -+ return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; -+} -+ -+static int bcm_ptp_ts_info(struct mii_timestamper *mii_ts, -+ struct ethtool_ts_info *ts_info) -+{ -+ struct bcm_ptp_private *priv = mii2priv(mii_ts); -+ -+ ts_info->phc_index = ptp_clock_index(priv->ptp_clock); -+ ts_info->so_timestamping = -+ SOF_TIMESTAMPING_TX_HARDWARE | -+ SOF_TIMESTAMPING_RX_HARDWARE | -+ SOF_TIMESTAMPING_RAW_HARDWARE; -+ ts_info->tx_types = -+ BIT(HWTSTAMP_TX_ON) | -+ BIT(HWTSTAMP_TX_OFF) | -+ BIT(HWTSTAMP_TX_ONESTEP_SYNC) | -+ BIT(HWTSTAMP_TX_ONESTEP_P2P); -+ ts_info->rx_filters = -+ BIT(HWTSTAMP_FILTER_NONE) | -+ BIT(HWTSTAMP_FILTER_PTP_V2_EVENT); -+ -+ return 0; -+} -+ -+void bcm_ptp_stop(struct bcm_ptp_private *priv) -+{ -+ ptp_cancel_worker_sync(priv->ptp_clock); -+ bcm_ptp_cancel_func(priv); -+} -+EXPORT_SYMBOL_GPL(bcm_ptp_stop); -+ -+void bcm_ptp_config_init(struct phy_device *phydev) -+{ -+ /* init network sync engine */ -+ bcm_phy_write_exp(phydev, NSE_CTRL, NSE_GMODE_EN | NSE_INIT); -+ -+ /* enable time sync (TX/RX SOP capture) */ -+ bcm_phy_write_exp(phydev, TIME_SYNC, TIME_SYNC_EN); -+ -+ /* use sec.nsec heartbeat capture */ -+ bcm_phy_write_exp(phydev, DPLL_SELECT, DPLL_HB_MODE2); -+ -+ /* use 64 bit timecode for TX */ -+ bcm_phy_write_exp(phydev, TIMECODE_CTRL, TX_TIMECODE_SEL); -+ -+ /* always allow FREQ_LOAD on framesync */ -+ bcm_phy_write_exp(phydev, SHADOW_CTRL, FREQ_LOAD); -+ -+ bcm_phy_write_exp(phydev, SYNC_IN_DIVIDER, 1); -+} -+EXPORT_SYMBOL_GPL(bcm_ptp_config_init); -+ -+static void bcm_ptp_init(struct bcm_ptp_private *priv) -+{ -+ priv->nse_ctrl = NSE_GMODE_EN; -+ -+ mutex_init(&priv->mutex); -+ skb_queue_head_init(&priv->tx_queue); -+ -+ priv->mii_ts.rxtstamp = bcm_ptp_rxtstamp; -+ priv->mii_ts.txtstamp = bcm_ptp_txtstamp; -+ priv->mii_ts.hwtstamp = bcm_ptp_hwtstamp; -+ priv->mii_ts.ts_info = bcm_ptp_ts_info; -+ -+ priv->phydev->mii_ts = &priv->mii_ts; -+} -+ -+struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev) -+{ -+ struct bcm_ptp_private *priv; -+ struct ptp_clock *clock; -+ -+ switch (BRCM_PHY_MODEL(phydev)) { -+ case PHY_ID_BCM54210E: -+ break; -+ default: -+ return NULL; -+ } -+ -+ priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return ERR_PTR(-ENOMEM); -+ -+ priv->ptp_info = bcm_ptp_clock_info; -+ -+ snprintf(priv->pin.name, sizeof(priv->pin.name), "SYNC_OUT"); -+ priv->ptp_info.pin_config = &priv->pin; -+ -+ clock = ptp_clock_register(&priv->ptp_info, &phydev->mdio.dev); -+ if (IS_ERR(clock)) -+ return ERR_CAST(clock); -+ priv->ptp_clock = clock; -+ -+ priv->phydev = phydev; -+ bcm_ptp_init(priv); -+ -+ return priv; -+} -+EXPORT_SYMBOL_GPL(bcm_ptp_probe); -+ -+MODULE_LICENSE("GPL"); -diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c -index e36809aa6d30..876bc45ede60 100644 ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -27,6 +27,11 @@ MODULE_DESCRIPTION("Broadcom PHY driver"); - MODULE_AUTHOR("Maciej W. Rozycki"); - MODULE_LICENSE("GPL"); - -+struct bcm54xx_phy_priv { -+ u64 *stats; -+ struct bcm_ptp_private *ptp; -+}; -+ - static int bcm54xx_config_clock_delay(struct phy_device *phydev) - { - int rc, val; -@@ -313,6 +318,22 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) - bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val); - } - -+static void bcm54xx_ptp_stop(struct phy_device *phydev) -+{ -+ struct bcm54xx_phy_priv *priv = phydev->priv; -+ -+ if (priv->ptp) -+ bcm_ptp_stop(priv->ptp); -+} -+ -+static void bcm54xx_ptp_config_init(struct phy_device *phydev) -+{ -+ struct bcm54xx_phy_priv *priv = phydev->priv; -+ -+ if (priv->ptp) -+ bcm_ptp_config_init(phydev); -+} -+ - static int bcm54xx_config_init(struct phy_device *phydev) - { - int reg, err, val; -@@ -390,6 +411,8 @@ static int bcm54xx_config_init(struct phy_device *phydev) - bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val); - } - -+ bcm54xx_ptp_config_init(phydev); -+ - return 0; - } - -@@ -418,6 +441,8 @@ static int bcm54xx_suspend(struct phy_device *phydev) - { - int ret; - -+ bcm54xx_ptp_stop(phydev); -+ - /* We cannot use a read/modify/write here otherwise the PHY gets into - * a bad state where its LEDs keep flashing, thus defeating the purpose - * of low power mode. -@@ -741,10 +766,6 @@ static irqreturn_t brcm_fet_handle_interrupt(struct phy_device *phydev) - return IRQ_HANDLED; - } - --struct bcm54xx_phy_priv { -- u64 *stats; --}; -- - static int bcm54xx_phy_probe(struct phy_device *phydev) - { - struct bcm54xx_phy_priv *priv; -@@ -761,6 +782,10 @@ static int bcm54xx_phy_probe(struct phy_device *phydev) - if (!priv->stats) - return -ENOMEM; - -+ priv->ptp = bcm_ptp_probe(phydev); -+ if (IS_ERR(priv->ptp)) -+ return PTR_ERR(priv->ptp); -+ - return 0; - } - diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c index ee4da9ab8013..d395d11eadc4 100644 --- a/drivers/net/wireguard/main.c @@ -2541,10 +1246,10 @@ index ee4da9ab8013..d395d11eadc4 100644 if (ret < 0) goto err_allowedips; diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index 2533b88e66d5..e8cb38d82c2e 100644 +index af367b22871b..3c5b7917b7b2 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c -@@ -240,6 +240,9 @@ static void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl) +@@ -250,6 +250,9 @@ static void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl) static blk_status_t nvme_error_status(u16 status) { @@ -2554,17 +1259,17 @@ index 2533b88e66d5..e8cb38d82c2e 100644 switch (status & 0x7ff) { case NVME_SC_SUCCESS: return BLK_STS_OK; -@@ -330,6 +333,7 @@ enum nvme_disposition { +@@ -340,6 +343,7 @@ enum nvme_disposition { COMPLETE, RETRY, FAILOVER, + FAILUP, + AUTHENTICATE, }; - static inline enum nvme_disposition nvme_decide_disposition(struct request *req) -@@ -337,15 +341,16 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req) - if (likely(nvme_req(req)->status == 0)) - return COMPLETE; +@@ -351,15 +355,16 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req) + if ((nvme_req(req)->status & 0x7ff) == NVME_SC_AUTH_REQUIRED) + return AUTHENTICATE; - if (blk_noretry_request(req) || + if ((req->cmd_flags & (REQ_FAILFAST_DEV | REQ_FAILFAST_DRIVER)) || @@ -2582,7 +1287,7 @@ index 2533b88e66d5..e8cb38d82c2e 100644 } else { if (blk_queue_dying(req->q)) return COMPLETE; -@@ -373,6 +378,14 @@ static inline void nvme_end_req(struct request *req) +@@ -387,6 +392,14 @@ static inline void nvme_end_req(struct request *req) blk_mq_end_request(req, status); } @@ -2596,19 +1301,19 @@ index 2533b88e66d5..e8cb38d82c2e 100644 + void nvme_complete_rq(struct request *req) { - trace_nvme_complete_rq(req); -@@ -391,6 +404,9 @@ void nvme_complete_rq(struct request *req) + struct nvme_ctrl *ctrl = nvme_req(req)->ctrl; +@@ -407,6 +420,9 @@ void nvme_complete_rq(struct request *req) case FAILOVER: nvme_failover_req(req); return; + case FAILUP: + nvme_failup_req(req); + return; - } - } - EXPORT_SYMBOL_GPL(nvme_complete_rq); + case AUTHENTICATE: + #ifdef CONFIG_NVME_AUTH + queue_work(nvme_wq, &ctrl->dhchap_auth_work); diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c -index f26640ccb955..a827793c8ea3 100644 +index 6ef497c75a16..c019294e1058 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -80,14 +80,10 @@ void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) @@ -2644,7 +1349,7 @@ index f26640ccb955..a827793c8ea3 100644 spin_lock_irqsave(&ns->head->requeue_lock, flags); for (bio = req->bio; bio; bio = bio->bi_next) { -@@ -870,8 +876,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) +@@ -871,8 +877,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) int error = 0; /* check if multipath is enabled and we have the capability */ @@ -2655,18 +1360,18 @@ index f26640ccb955..a827793c8ea3 100644 if (!ctrl->max_namespaces || diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index 7e0a925bf3be..9b866a07d142 100644 +index 1bdf714dcd9e..10e45b82466c 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h -@@ -835,6 +835,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys); +@@ -844,6 +844,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys); void nvme_mpath_start_freeze(struct nvme_subsystem *subsys); void nvme_mpath_default_iopolicy(struct nvme_subsystem *subsys); void nvme_failover_req(struct request *req); +void nvme_update_ana(struct request *req); void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head); - void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id); -@@ -871,6 +872,9 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) + void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid); +@@ -880,6 +881,9 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) static inline void nvme_failover_req(struct request *req) { } @@ -2773,10 +1478,10 @@ index 49238ddd39ee..7c32d338542f 100644 struct pci_driver *drv; struct pci_dev *dev; diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index 41aeaa235132..e8137d31cc93 100644 +index 4944798e75b5..079a29ef1bf2 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c -@@ -4285,6 +4285,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9000, +@@ -4296,6 +4296,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); @@ -2828,10 +1533,10 @@ index 5ba5c18b77b4..87f58b189772 100644 { 0x9005, 0x028c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 63 }, /* Adaptec PMC Series 7 (Denali) */ { 0x9005, 0x028d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 64 }, /* Adaptec PMC Series 8 */ diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index 3bb0adefbe06..b5408ba70ecb 100644 +index 50a577ac3bb4..6f862b855ccf 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c -@@ -372,11 +372,13 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) +@@ -387,11 +387,13 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) /*------------------- PCI Driver operations and data ----------------- */ static const struct pci_device_id beiscsi_pci_id_table[] = { @@ -2873,7 +1578,7 @@ index a47bcce3c9c7..094944a52866 100644 }; diff --git a/drivers/scsi/lpfc/lpfc_ids.h b/drivers/scsi/lpfc/lpfc_ids.h -index a1b9be245560..aa8c493241c6 100644 +index 0b1616e93cf4..85fc52038a82 100644 --- a/drivers/scsi/lpfc/lpfc_ids.h +++ b/drivers/scsi/lpfc/lpfc_ids.h @@ -24,6 +24,7 @@ @@ -2884,7 +1589,7 @@ index a1b9be245560..aa8c493241c6 100644 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_FIREFLY, -@@ -54,14 +55,19 @@ const struct pci_device_id lpfc_id_table[] = { +@@ -54,10 +55,13 @@ const struct pci_device_id lpfc_id_table[] = { PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_DCSP, PCI_ANY_ID, PCI_ANY_ID, }, @@ -2897,14 +1602,8 @@ index a1b9be245560..aa8c493241c6 100644 +#endif {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR, PCI_ANY_ID, PCI_ANY_ID, }, -+#ifndef CONFIG_RHEL_DIFFERENCES - {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HORNET, - PCI_ANY_ID, PCI_ANY_ID, }, -+#endif {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_SCSP, - PCI_ANY_ID, PCI_ANY_ID, }, - {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_DCSP, -@@ -70,6 +76,7 @@ const struct pci_device_id lpfc_id_table[] = { +@@ -68,6 +72,7 @@ const struct pci_device_id lpfc_id_table[] = { PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB, PCI_ANY_ID, PCI_ANY_ID, }, @@ -2912,7 +1611,7 @@ index a1b9be245560..aa8c493241c6 100644 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_TFLY, PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP101, -@@ -80,6 +87,7 @@ const struct pci_device_id lpfc_id_table[] = { +@@ -78,6 +83,7 @@ const struct pci_device_id lpfc_id_table[] = { PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S, PCI_ANY_ID, PCI_ANY_ID, }, @@ -2920,7 +1619,7 @@ index a1b9be245560..aa8c493241c6 100644 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT, PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_MID, -@@ -92,6 +100,7 @@ const struct pci_device_id lpfc_id_table[] = { +@@ -90,6 +96,7 @@ const struct pci_device_id lpfc_id_table[] = { PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_S, PCI_ANY_ID, PCI_ANY_ID, }, @@ -2928,7 +1627,7 @@ index a1b9be245560..aa8c493241c6 100644 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PROTEUS_VF, PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PROTEUS_PF, -@@ -102,18 +111,23 @@ const struct pci_device_id lpfc_id_table[] = { +@@ -100,18 +107,23 @@ const struct pci_device_id lpfc_id_table[] = { PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_SERVERENGINE, PCI_DEVICE_ID_TOMCAT, PCI_ANY_ID, PCI_ANY_ID, }, @@ -2953,7 +1652,7 @@ index a1b9be245560..aa8c493241c6 100644 PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G7_FC, diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c -index 0917b05059b4..38cef4e394fb 100644 +index a3e117a4b8e7..e0035211cae6 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -149,6 +149,7 @@ megasas_set_ld_removed_by_fw(struct megasas_instance *instance); @@ -2985,10 +1684,10 @@ index 0917b05059b4..38cef4e394fb 100644 /* Fusion */ {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_PLASMA)}, diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c -index 5e8887fa02c8..e4a33a1d641d 100644 +index def37a7e5980..5d8de7690b82 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c -@@ -12607,6 +12607,7 @@ bool scsih_ncq_prio_supp(struct scsi_device *sdev) +@@ -12606,6 +12606,7 @@ bool scsih_ncq_prio_supp(struct scsi_device *sdev) * The pci device ids are defined in mpi/mpi2_cnfg.h. */ static const struct pci_device_id mpt3sas_pci_table[] = { @@ -2996,7 +1695,7 @@ index 5e8887fa02c8..e4a33a1d641d 100644 /* Spitfire ~ 2004 */ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2004, PCI_ANY_ID, PCI_ANY_ID }, -@@ -12625,6 +12626,7 @@ static const struct pci_device_id mpt3sas_pci_table[] = { +@@ -12624,6 +12625,7 @@ static const struct pci_device_id mpt3sas_pci_table[] = { PCI_ANY_ID, PCI_ANY_ID }, { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_2, PCI_ANY_ID, PCI_ANY_ID }, @@ -3004,7 +1703,7 @@ index 5e8887fa02c8..e4a33a1d641d 100644 /* Thunderbolt ~ 2208 */ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_1, PCI_ANY_ID, PCI_ANY_ID }, -@@ -12649,9 +12651,11 @@ static const struct pci_device_id mpt3sas_pci_table[] = { +@@ -12648,9 +12650,11 @@ static const struct pci_device_id mpt3sas_pci_table[] = { PCI_ANY_ID, PCI_ANY_ID }, { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP_1, PCI_ANY_ID, PCI_ANY_ID }, @@ -3017,10 +1716,10 @@ index 5e8887fa02c8..e4a33a1d641d 100644 { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3004, PCI_ANY_ID, PCI_ANY_ID }, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c -index 73073fb08369..3e4612bcf8fc 100644 +index 0bd0fd1042df..821503d07999 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -7973,6 +7973,7 @@ static const struct pci_error_handlers qla2xxx_err_handler = { +@@ -8050,6 +8050,7 @@ static const struct pci_error_handlers qla2xxx_err_handler = { }; static struct pci_device_id qla2xxx_pci_tbl[] = { @@ -3028,7 +1727,7 @@ index 73073fb08369..3e4612bcf8fc 100644 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2100) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2200) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2300) }, -@@ -7985,13 +7986,18 @@ static struct pci_device_id qla2xxx_pci_tbl[] = { +@@ -8062,13 +8063,18 @@ static struct pci_device_id qla2xxx_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP8432) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5422) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5432) }, @@ -3068,10 +1767,10 @@ index 9e849f6b0d0f..00f9a1303b93 100644 }; MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl); diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 68e9121c1878..ccd7566adb4b 100644 +index 2633acde7ac1..665b8a441b0a 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5686,6 +5686,13 @@ static void hub_event(struct work_struct *work) +@@ -5676,6 +5676,13 @@ static void hub_event(struct work_struct *work) (u16) hub->change_bits[0], (u16) hub->event_bits[0]); @@ -3100,7 +1799,7 @@ index eae288c8d40a..8b8bf447cedc 100644 error_proc: diff --git a/include/linux/efi.h b/include/linux/efi.h -index 7d9b0bb47eb3..221776a5377a 100644 +index d2b84c2fec39..3498d72b62ec 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -43,6 +43,8 @@ @@ -3136,7 +1835,7 @@ index 7d9b0bb47eb3..221776a5377a 100644 bool __pure __efi_soft_reserve_enabled(void); static inline bool __pure efi_soft_reserve_enabled(void) -@@ -880,6 +892,8 @@ static inline bool efi_enabled(int feature) +@@ -881,6 +893,8 @@ static inline bool efi_enabled(int feature) static inline void efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {} @@ -3145,7 +1844,7 @@ index 7d9b0bb47eb3..221776a5377a 100644 static inline bool efi_soft_reserve_enabled(void) { return false; -@@ -892,6 +906,7 @@ static inline bool efi_rt_services_supported(unsigned int mask) +@@ -895,6 +909,7 @@ static inline void efi_find_mirror(void) {} #endif extern int efi_status_to_err(efi_status_t status); @@ -3153,7 +1852,7 @@ index 7d9b0bb47eb3..221776a5377a 100644 /* * Variable Attributes -@@ -1144,13 +1159,6 @@ static inline bool efi_runtime_disabled(void) { return true; } +@@ -1107,13 +1122,6 @@ static inline bool efi_runtime_disabled(void) { return true; } extern void efi_call_virt_check_flags(unsigned long flags, const char *call); extern unsigned long efi_call_virt_save_flags(void); @@ -3269,7 +1968,7 @@ index c7759b3f2045..f6a368b1b04c 100644 struct taint_flag { diff --git a/include/linux/pci.h b/include/linux/pci.h -index 81a57b498f22..220e81965971 100644 +index 060af91bafcd..107f2290058a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1499,6 +1499,22 @@ int pci_add_dynid(struct pci_driver *drv, @@ -3852,10 +2551,10 @@ index 1bc362cb413f..961600d0572d 100644 #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE) diff --git a/init/Kconfig b/init/Kconfig -index 26a544112732..433a61698041 100644 +index 8c9ad53b45dc..64f0c68e1cfb 100644 --- a/init/Kconfig +++ b/init/Kconfig -@@ -1679,7 +1679,7 @@ config AIO +@@ -1689,7 +1689,7 @@ config AIO this option saves about 7k. config IO_URING @@ -3865,7 +2564,7 @@ index 26a544112732..433a61698041 100644 default y help diff --git a/kernel/Makefile b/kernel/Makefile -index a7e1f49ab2b3..4a9172cf1728 100644 +index 318789c728d3..148911cf65da 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -12,6 +12,7 @@ obj-y = fork.o exec_domain.o panic.o \ @@ -3877,7 +2576,7 @@ index a7e1f49ab2b3..4a9172cf1728 100644 obj-$(CONFIG_MODULES) += kmod.o obj-$(CONFIG_MULTIUSER) += groups.o diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c -index 2b69306d3c6e..8f60e3254ce1 100644 +index 83c7136c5788..dfb60d30d794 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -26,6 +26,7 @@ @@ -3912,7 +2611,7 @@ index 2b69306d3c6e..8f60e3254ce1 100644 int sysctl_unprivileged_bpf_disabled __read_mostly = IS_BUILTIN(CONFIG_BPF_UNPRIV_DEFAULT_OFF) ? 2 : 0; -@@ -5217,6 +5235,11 @@ static int bpf_unpriv_handler(struct ctl_table *table, int write, +@@ -5254,6 +5272,11 @@ static int bpf_unpriv_handler(struct ctl_table *table, int write, if (write && !ret) { if (locked_state && unpriv_enable != 1) return -EPERM; @@ -3968,14 +2667,13 @@ index a2ff4242e623..f0d2be1ee4f1 100644 int module_sig_check(struct load_info *info, int flags) diff --git a/kernel/panic.c b/kernel/panic.c -index c6eb8f8db0c0..eef592767c11 100644 +index c6eb8f8db0c0..da82fb0fbb1b 100644 --- a/kernel/panic.c +++ b/kernel/panic.c -@@ -429,6 +429,20 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { +@@ -429,6 +429,19 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { [ TAINT_AUX ] = { 'X', ' ', true }, [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, [ TAINT_TEST ] = { 'N', ' ', true }, -+ [ TAINT_18 ] = { '?', '-', false }, + [ TAINT_19 ] = { '?', '-', false }, + [ TAINT_20 ] = { '?', '-', false }, + [ TAINT_21 ] = { '?', '-', false }, @@ -4241,7 +2939,7 @@ index 29474cee10b1..8ecabc1b1686 100644 ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name); if (ret >= sizeof(fname)) { diff --git a/scripts/tags.sh b/scripts/tags.sh -index 01fab3d4f90b..2ae5dfc904f9 100755 +index e137cf15aae9..2ed2341f7967 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -16,6 +16,8 @@ fi |