From 391fe055c943e33e9c191dbeeb21995c0d54ccd9 Mon Sep 17 00:00:00 2001 From: Sentry Date: Tue, 14 Jul 2020 15:58:43 +0200 Subject: kernel 5.7.8 --- ...rm64-Ignore-broken-HPE-moonshot-APEI-supp.patch | 71 + ...rkaround-firmware-issue-on-X-Gene-based-m.patch | 75 + ...et_user_check-in-case-uaccess_-calls-are-.patch | 86 + SOURCES/0001-ARM-tegra-usb-no-reset.patch | 32 + ...tatus_to_str-and-rework-efi_status_to_err.patch | 185 + ...-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch | 32 + SOURCES/0001-Drop-that-for-now.patch | 25 + ...remove-the-need-for-artificial-IRQ-in-cas.patch | 330 + ...se-of-platform-keyring-for-module-signatu.patch | 44 + ...rt_list-use-efi_status_to_str-to-print-er.patch | 40 + ...MCFG-quirks-for-Tegra194-host-controllers.patch | 209 + ...-Wait-for-Raspberry-Pi-s-firmware-when-pr.patch | 57 + ...1-USB-pci-quirks-Add-Raspberry-Pi-4-quirk.patch | 72 + ...-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch | 75 + ...i-scan-Fix-regression-related-to-X-Gene-U.patch | 52 + ...Use-kmemdup-instead-of-kmalloc-and-memcpy.patch | 55 + ...rx2-Fix-for-errata-that-affects-stop-engi.patch | 89 + ...-Drop-the-EXPERT-setting-from-ARM64_FORCE.patch | 38 + ...NFIG_HIGHPTE-optional-without-CONFIG_EXPE.patch | 31 + ...-remove-redundant-assignments-to-variable.patch | 32 + ...vice-detect-if-changing-endianness-failed.patch | 62 + SOURCES/0001-device-detect-vGPUs.patch | 59 + ...rk-mmio-mapping-code-to-get-rid-of-second.patch | 84 + ...regular-PRI-accessors-in-chipset-detectio.patch | 113 + ...0001-disp-gv100-expose-capabilities-class.patch | 149 + ...119-add-HAL-for-programming-device-entry-.patch | 146 + ...119-select-HDA-device-entry-based-on-boun.patch | 49 + ...p-hda-gt215-pass-head-to-nvkm_ior.hda.eld.patch | 83 + ...100-NV_PDISP_SF_AUDIO_CNTRL0-register-mov.patch | 105 + ...ncrease-timeout-on-pio-channel-free-polli.patch | 26 + ...Use-generic-helper-to-check-_PR3-presence.patch | 96 + ...t-bindings-vendor-prefixes-Add-Xingbangda.patch | 33 + ...-up-timeout-to-wait-when-ME-un-configure-.patch | 35 + ...EFI_SECURE_BOOT-flag-to-indicate-secure-b.patch | 161 + ...wn-the-kernel-if-booted-in-secure-boot-mo.patch | 72 + ...-raspberrypi-Introduce-vl805-init-routine.patch | 110 + ...iommu-arm-smmu-workaround-DMA-mode-issues.patch | 98 + ...1-ipmi-do-not-configure-ipmi-for-HPE-m400.patch | 123 + ...01-kdump-add-support-for-crashkernel-auto.patch | 189 + ...p-fix-a-grammar-issue-in-a-kernel-message.patch | 43 + ...-up-the-total-memory-size-to-128M-for-cra.patch | 93 + ...ms-gv100-Add-support-for-interlaced-modes.patch | 64 + ...itialize-core-channel-in-nouveau_display_.patch | 47 + ...ve-8BPC-limit-for-MST-into-nv50_mstc_get_.patch | 65 + ...obe-SOR-and-PIOR-caps-for-DP-interlacing-.patch | 439 ++ ...Share-DP-SST-mode_valid-handling-with-MST.patch | 209 + ...emleak-skip-late_init-if-not-skip-disable.patch | 71 + SOURCES/0001-mmu-Remove-unneeded-semicolon.patch | 47 + ...-perf-cs-etm-Move-defined-of-traceid_list.patch | 58 + ...6-thinkpad_acpi-Add-support-for-dual-fan-.patch | 136 + ...own-the-kernel-when-the-IPL-secure-flag-i.patch | 67 + ...01-scsi-smartpqi-add-inspur-advantech-ids.patch | 70 + ...ckdown-expose-a-hook-to-lock-the-kernel-d.patch | 103 + ...-Sync-xHCI-reset-firmware-property-with-d.patch | 32 + ...b-fusb302-Convert-to-use-GPIO-descriptors.patch | 162 + ...dd-a-few-new-vmmdev-request-types-to-the-.patch | 58 + ...dd-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch | 320 + ...dd-vbg_set_host_capabilities-helper-funct.patch | 130 + ...ix-VBGL_IOCTL_VMMDEV_REQUEST_BIG-and-_LOG.patch | 123 + ...rt-vbox-Fix-guest-capabilities-mask-check.patch | 47 + ...-vbox-Log-unknown-ioctl-requests-as-error.patch | 30 + ...ename-guest_caps-struct-members-to-set_gu.patch | 103 + ...-panel-Convert-rocktech-jh057n00900-to-ya.patch | 120 + ...-panel-Add-compatible-for-Xingbangda-XBD5.patch | 37 + SOURCES/0003-glitched-base.patch | 447 ++ ...ocktech-jh057n00900-Rename-the-driver-to-.patch | 91 + ...t7703-Rename-functions-from-jh057n-prefix.patch | 265 + ...t7703-Prepare-for-supporting-multiple-pan.patch | 129 + ...t7703-Move-code-specific-to-jh057n-closer.patch | 84 + SOURCES/0007-v5.7-fsync.patch | 908 +++ ...t7703-Move-generic-part-of-init-sequence-.patch | 84 + ...-st7703-Add-support-for-Xingbangda-XBD599.patch | 251 + ...anel-st7703-Enter-sleep-after-display-off.patch | 41 + ...t7703-Assert-reset-prior-to-powering-down.patch | 29 + ...un50i-a64-pinephone-Enable-LCD-support-on.patch | 112 + ...un50i-a64-pinephone-Add-touchscreen-suppo.patch | 47 + SOURCES/Module.kabi_aarch64 | 0 SOURCES/Module.kabi_dup_aarch64 | 0 SOURCES/Module.kabi_dup_ppc64le | 0 SOURCES/Module.kabi_dup_s390x | 0 SOURCES/Module.kabi_dup_x86_64 | 0 SOURCES/Module.kabi_ppc64le | 0 SOURCES/Module.kabi_s390x | 0 SOURCES/Module.kabi_x86_64 | 0 SOURCES/check-kabi | 0 SOURCES/cpupower.config | 0 SOURCES/cpupower.service | 0 SOURCES/filter-aarch64.sh.fedora | 18 + SOURCES/filter-aarch64.sh.rhel | 18 + SOURCES/filter-armv7hl.sh.fedora | 18 + SOURCES/filter-armv7hl.sh.rhel | 0 SOURCES/filter-i686.sh.fedora | 14 + SOURCES/filter-i686.sh.rhel | 0 SOURCES/filter-modules.sh.fedora | 170 + SOURCES/filter-modules.sh.rhel | 168 + SOURCES/filter-ppc64le.sh.fedora | 14 + SOURCES/filter-ppc64le.sh.rhel | 14 + SOURCES/filter-s390x.sh.fedora | 12 + SOURCES/filter-s390x.sh.rhel | 12 + SOURCES/filter-x86_64.sh.fedora | 12 + SOURCES/filter-x86_64.sh.rhel | 12 + SOURCES/generate_all_configs.sh | 36 + SOURCES/generate_bls_conf.sh | 30 + SOURCES/kernel-aarch64-debug-fedora.config | 7683 +++++++++++++++++++ SOURCES/kernel-aarch64-debug-rhel.config | 4 + SOURCES/kernel-aarch64-fedora.config | 7660 +++++++++++++++++++ SOURCES/kernel-aarch64-rhel.config | 4 + SOURCES/kernel-armv7hl-debug-fedora.config | 7957 ++++++++++++++++++++ SOURCES/kernel-armv7hl-fedora.config | 7935 +++++++++++++++++++ SOURCES/kernel-armv7hl-lpae-debug-fedora.config | 7683 +++++++++++++++++++ SOURCES/kernel-armv7hl-lpae-fedora.config | 7661 +++++++++++++++++++ SOURCES/kernel-i686-debug-fedora.config | 7001 +++++++++++++++++ SOURCES/kernel-i686-fedora.config | 6979 +++++++++++++++++ SOURCES/kernel-local | 2 + SOURCES/kernel-ppc64le-debug-fedora.config | 6489 ++++++++++++++++ SOURCES/kernel-ppc64le-debug-rhel.config | 4 + SOURCES/kernel-ppc64le-fedora.config | 6465 ++++++++++++++++ SOURCES/kernel-ppc64le-rhel.config | 4 + SOURCES/kernel-s390x-debug-fedora.config | 6427 ++++++++++++++++ SOURCES/kernel-s390x-debug-rhel.config | 4 + SOURCES/kernel-s390x-fedora.config | 6403 ++++++++++++++++ SOURCES/kernel-s390x-rhel.config | 4 + SOURCES/kernel-s390x-zfcpdump-rhel.config | 4 + SOURCES/kernel-x86_64-debug-fedora.config | 7055 +++++++++++++++++ SOURCES/kernel-x86_64-debug-rhel.config | 4 + SOURCES/kernel-x86_64-fedora.config | 7033 +++++++++++++++++ SOURCES/kernel-x86_64-rhel.config | 4 + SOURCES/merge.pl | 66 + SOURCES/mod-extra-blacklist.sh | 56 + SOURCES/mod-extra.list.fedora | 196 + SOURCES/mod-extra.list.rhel | 0 SOURCES/mod-extra.sh | 86 + SOURCES/mod-internal.list | 4 + SOURCES/mod-sign.sh | 37 + SOURCES/parallel_xz.sh | 26 + SOURCES/process_configs.sh | 198 + SOURCES/secureboot.cer | Bin 0 -> 899 bytes SOURCES/secureboot_ppc.cer | Bin 0 -> 899 bytes SOURCES/secureboot_s390.cer | Bin 0 -> 899 bytes SOURCES/securebootca.cer | Bin 0 -> 977 bytes SOURCES/update_scripts.sh | 12 + SOURCES/x509.genkey.fedora | 16 + SOURCES/x509.genkey.rhel | 16 + SPECS/kernel.spec | 3560 +++++++++ 144 files changed, 113875 insertions(+) create mode 100644 SOURCES/0001-ACPI-APEI-arm64-Ignore-broken-HPE-moonshot-APEI-supp.patch create mode 100644 SOURCES/0001-ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m.patch create mode 100644 SOURCES/0001-ARM-fix-__get_user_check-in-case-uaccess_-calls-are-.patch create mode 100644 SOURCES/0001-ARM-tegra-usb-no-reset.patch create mode 100644 SOURCES/0001-Add-efi_status_to_str-and-rework-efi_status_to_err.patch create mode 100644 SOURCES/0001-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch create mode 100644 SOURCES/0001-Drop-that-for-now.patch create mode 100644 SOURCES/0001-Input-rmi4-remove-the-need-for-artificial-IRQ-in-cas.patch create mode 100644 SOURCES/0001-KEYS-Make-use-of-platform-keyring-for-module-signatu.patch create mode 100644 SOURCES/0001-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch create mode 100644 SOURCES/0001-PCI-Add-MCFG-quirks-for-Tegra194-host-controllers.patch create mode 100644 SOURCES/0001-PCI-brcmstb-Wait-for-Raspberry-Pi-s-firmware-when-pr.patch create mode 100644 SOURCES/0001-USB-pci-quirks-Add-Raspberry-Pi-4-quirk.patch create mode 100644 SOURCES/0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch create mode 100644 SOURCES/0001-aarch64-acpi-scan-Fix-regression-related-to-X-Gene-U.patch create mode 100644 SOURCES/0001-acr-Use-kmemdup-instead-of-kmalloc-and-memcpy.patch create mode 100644 SOURCES/0001-ahci-thunderx2-Fix-for-errata-that-affects-stop-engi.patch create mode 100644 SOURCES/0001-arm-aarch64-Drop-the-EXPERT-setting-from-ARM64_FORCE.patch create mode 100644 SOURCES/0001-arm-make-CONFIG_HIGHPTE-optional-without-CONFIG_EXPE.patch create mode 100644 SOURCES/0001-core-memory-remove-redundant-assignments-to-variable.patch create mode 100644 SOURCES/0001-device-detect-if-changing-endianness-failed.patch create mode 100644 SOURCES/0001-device-detect-vGPUs.patch create mode 100644 SOURCES/0001-device-rework-mmio-mapping-code-to-get-rid-of-second.patch create mode 100644 SOURCES/0001-device-use-regular-PRI-accessors-in-chipset-detectio.patch create mode 100644 SOURCES/0001-disp-gv100-expose-capabilities-class.patch create mode 100644 SOURCES/0001-disp-hda-gf119-add-HAL-for-programming-device-entry-.patch create mode 100644 SOURCES/0001-disp-hda-gf119-select-HDA-device-entry-based-on-boun.patch create mode 100644 SOURCES/0001-disp-hda-gt215-pass-head-to-nvkm_ior.hda.eld.patch create mode 100644 SOURCES/0001-disp-hda-gv100-NV_PDISP_SF_AUDIO_CNTRL0-register-mov.patch create mode 100644 SOURCES/0001-disp-nv50-increase-timeout-on-pio-channel-free-polli.patch create mode 100644 SOURCES/0001-drm-Use-generic-helper-to-check-_PR3-presence.patch create mode 100644 SOURCES/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch create mode 100644 SOURCES/0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch create mode 100644 SOURCES/0001-efi-Add-an-EFI_SECURE_BOOT-flag-to-indicate-secure-b.patch create mode 100644 SOURCES/0001-efi-Lock-down-the-kernel-if-booted-in-secure-boot-mo.patch create mode 100644 SOURCES/0001-firmware-raspberrypi-Introduce-vl805-init-routine.patch create mode 100644 SOURCES/0001-iommu-arm-smmu-workaround-DMA-mode-issues.patch create mode 100644 SOURCES/0001-ipmi-do-not-configure-ipmi-for-HPE-m400.patch create mode 100644 SOURCES/0001-kdump-add-support-for-crashkernel-auto.patch create mode 100644 SOURCES/0001-kdump-fix-a-grammar-issue-in-a-kernel-message.patch create mode 100644 SOURCES/0001-kdump-round-up-the-total-memory-size-to-128M-for-cra.patch create mode 100644 SOURCES/0001-kms-gv100-Add-support-for-interlaced-modes.patch create mode 100644 SOURCES/0001-kms-nv50-Initialize-core-channel-in-nouveau_display_.patch create mode 100644 SOURCES/0001-kms-nv50-Move-8BPC-limit-for-MST-into-nv50_mstc_get_.patch create mode 100644 SOURCES/0001-kms-nv50-Probe-SOR-and-PIOR-caps-for-DP-interlacing-.patch create mode 100644 SOURCES/0001-kms-nv50-Share-DP-SST-mode_valid-handling-with-MST.patch create mode 100644 SOURCES/0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch create mode 100644 SOURCES/0001-mmu-Remove-unneeded-semicolon.patch create mode 100644 SOURCES/0001-perf-cs-etm-Move-defined-of-traceid_list.patch create mode 100644 SOURCES/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch create mode 100644 SOURCES/0001-s390-Lock-down-the-kernel-when-the-IPL-secure-flag-i.patch create mode 100644 SOURCES/0001-scsi-smartpqi-add-inspur-advantech-ids.patch create mode 100644 SOURCES/0001-security-lockdown-expose-a-hook-to-lock-the-kernel-d.patch create mode 100644 SOURCES/0001-soc-bcm2835-Sync-xHCI-reset-firmware-property-with-d.patch create mode 100644 SOURCES/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch create mode 100644 SOURCES/0001-virt-vbox-Add-a-few-new-vmmdev-request-types-to-the-.patch create mode 100644 SOURCES/0001-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch create mode 100644 SOURCES/0001-virt-vbox-Add-vbg_set_host_capabilities-helper-funct.patch create mode 100644 SOURCES/0001-virt-vbox-Fix-VBGL_IOCTL_VMMDEV_REQUEST_BIG-and-_LOG.patch create mode 100644 SOURCES/0001-virt-vbox-Fix-guest-capabilities-mask-check.patch create mode 100644 SOURCES/0001-virt-vbox-Log-unknown-ioctl-requests-as-error.patch create mode 100644 SOURCES/0001-virt-vbox-Rename-guest_caps-struct-members-to-set_gu.patch create mode 100644 SOURCES/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch create mode 100644 SOURCES/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch create mode 100644 SOURCES/0003-glitched-base.patch create mode 100644 SOURCES/0004-drm-panel-rocktech-jh057n00900-Rename-the-driver-to-.patch create mode 100644 SOURCES/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch create mode 100644 SOURCES/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch create mode 100644 SOURCES/0007-drm-panel-st7703-Move-code-specific-to-jh057n-closer.patch create mode 100644 SOURCES/0007-v5.7-fsync.patch create mode 100644 SOURCES/0008-drm-panel-st7703-Move-generic-part-of-init-sequence-.patch create mode 100644 SOURCES/0009-drm-panel-st7703-Add-support-for-Xingbangda-XBD599.patch create mode 100644 SOURCES/0010-drm-panel-st7703-Enter-sleep-after-display-off.patch create mode 100644 SOURCES/0011-drm-panel-st7703-Assert-reset-prior-to-powering-down.patch create mode 100644 SOURCES/0012-arm64-dts-sun50i-a64-pinephone-Enable-LCD-support-on.patch create mode 100644 SOURCES/0013-arm64-dts-sun50i-a64-pinephone-Add-touchscreen-suppo.patch create mode 100644 SOURCES/Module.kabi_aarch64 create mode 100644 SOURCES/Module.kabi_dup_aarch64 create mode 100644 SOURCES/Module.kabi_dup_ppc64le create mode 100644 SOURCES/Module.kabi_dup_s390x create mode 100644 SOURCES/Module.kabi_dup_x86_64 create mode 100644 SOURCES/Module.kabi_ppc64le create mode 100644 SOURCES/Module.kabi_s390x create mode 100644 SOURCES/Module.kabi_x86_64 create mode 100644 SOURCES/check-kabi create mode 100644 SOURCES/cpupower.config create mode 100644 SOURCES/cpupower.service create mode 100644 SOURCES/filter-aarch64.sh.fedora create mode 100644 SOURCES/filter-aarch64.sh.rhel create mode 100644 SOURCES/filter-armv7hl.sh.fedora create mode 100644 SOURCES/filter-armv7hl.sh.rhel create mode 100644 SOURCES/filter-i686.sh.fedora create mode 100644 SOURCES/filter-i686.sh.rhel create mode 100755 SOURCES/filter-modules.sh.fedora create mode 100644 SOURCES/filter-modules.sh.rhel create mode 100644 SOURCES/filter-ppc64le.sh.fedora create mode 100644 SOURCES/filter-ppc64le.sh.rhel create mode 100644 SOURCES/filter-s390x.sh.fedora create mode 100644 SOURCES/filter-s390x.sh.rhel create mode 100644 SOURCES/filter-x86_64.sh.fedora create mode 100644 SOURCES/filter-x86_64.sh.rhel create mode 100755 SOURCES/generate_all_configs.sh create mode 100755 SOURCES/generate_bls_conf.sh create mode 100644 SOURCES/kernel-aarch64-debug-fedora.config create mode 100644 SOURCES/kernel-aarch64-debug-rhel.config create mode 100644 SOURCES/kernel-aarch64-fedora.config create mode 100644 SOURCES/kernel-aarch64-rhel.config create mode 100644 SOURCES/kernel-armv7hl-debug-fedora.config create mode 100644 SOURCES/kernel-armv7hl-fedora.config create mode 100644 SOURCES/kernel-armv7hl-lpae-debug-fedora.config create mode 100644 SOURCES/kernel-armv7hl-lpae-fedora.config create mode 100644 SOURCES/kernel-i686-debug-fedora.config create mode 100644 SOURCES/kernel-i686-fedora.config create mode 100644 SOURCES/kernel-local create mode 100644 SOURCES/kernel-ppc64le-debug-fedora.config create mode 100644 SOURCES/kernel-ppc64le-debug-rhel.config create mode 100644 SOURCES/kernel-ppc64le-fedora.config create mode 100644 SOURCES/kernel-ppc64le-rhel.config create mode 100644 SOURCES/kernel-s390x-debug-fedora.config create mode 100644 SOURCES/kernel-s390x-debug-rhel.config create mode 100644 SOURCES/kernel-s390x-fedora.config create mode 100644 SOURCES/kernel-s390x-rhel.config create mode 100644 SOURCES/kernel-s390x-zfcpdump-rhel.config create mode 100644 SOURCES/kernel-x86_64-debug-fedora.config create mode 100644 SOURCES/kernel-x86_64-debug-rhel.config create mode 100644 SOURCES/kernel-x86_64-fedora.config create mode 100644 SOURCES/kernel-x86_64-rhel.config create mode 100755 SOURCES/merge.pl create mode 100755 SOURCES/mod-extra-blacklist.sh create mode 100644 SOURCES/mod-extra.list.fedora create mode 100644 SOURCES/mod-extra.list.rhel create mode 100755 SOURCES/mod-extra.sh create mode 100644 SOURCES/mod-internal.list create mode 100755 SOURCES/mod-sign.sh create mode 100755 SOURCES/parallel_xz.sh create mode 100755 SOURCES/process_configs.sh create mode 100644 SOURCES/secureboot.cer create mode 100644 SOURCES/secureboot_ppc.cer create mode 100644 SOURCES/secureboot_s390.cer create mode 100644 SOURCES/securebootca.cer create mode 100755 SOURCES/update_scripts.sh create mode 100644 SOURCES/x509.genkey.fedora create mode 100644 SOURCES/x509.genkey.rhel create mode 100644 SPECS/kernel.spec diff --git a/SOURCES/0001-ACPI-APEI-arm64-Ignore-broken-HPE-moonshot-APEI-supp.patch b/SOURCES/0001-ACPI-APEI-arm64-Ignore-broken-HPE-moonshot-APEI-supp.patch new file mode 100644 index 0000000..ec362d9 --- /dev/null +++ b/SOURCES/0001-ACPI-APEI-arm64-Ignore-broken-HPE-moonshot-APEI-supp.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Tue, 27 Feb 2018 00:21:23 -0500 +Subject: [PATCH] ACPI: APEI: arm64: Ignore broken HPE moonshot APEI support + +Message-id: <20180227002123.21608-1-ahs3@redhat.com> +Patchwork-id: 206052 +O-Subject: [RHEL8 BZ1518076 PATCH] ACPI: APEI: arm64: Ignore broken HPE moonshot APEI support +Bugzilla: 1518076 +RH-Acked-by: Mark Salter +RH-Acked-by: Jeremy McNicoll + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1518076 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15417197 +Tested: compile-only; several other patches are required for full booting + QE has tested limited boot (see comment#12 of BZ) + +This is a re-post of a RHEL-ALT-7.5 patch specific to aarch64 moonshots +that we use in beaker. It is required for these machines to boot. + + commit 8a663a264863efedf8bb4a9d76ac603920fdd739 + Author: Robert Richter + Date: Wed Aug 16 19:49:30 2017 -0400 + + [acpi] APEI: arm64: Ignore broken HPE moonshot APEI support + + From: Mark Salter + Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1344237 + Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=13768971 + Tested: Booted on moonshot with patched 4.11.0-20 kernel + Upstream: RHEL-only + + The aarch64 HP moonshot platforms we have in beaker and elsewhere have + a firmware bug which causes a spurious fatal memory error via APEI at + boot time. This platform is no longer supported and no further firmware + updates are expected. This is a downstream-only hack to avoid the problem + by bailing out of HEST table probing if we detect a moonshot HEST table. + + Signed-off-by: Mark Salter + Signed-off-by: Robert Richter + Signed-off-by: Herton R. Krzesinski + +Upstream Status: RHEL only +Signed-off-by: Al Stone +Signed-off-by: Herton R. Krzesinski +--- + drivers/acpi/apei/hest.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c +index 822402480f7d..3f87d8602560 100644 +--- a/drivers/acpi/apei/hest.c ++++ b/drivers/acpi/apei/hest.c +@@ -88,6 +88,14 @@ 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); +-- +2.26.2 + diff --git a/SOURCES/0001-ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m.patch b/SOURCES/0001-ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m.patch new file mode 100644 index 0000000..1cc560e --- /dev/null +++ b/SOURCES/0001-ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Salter +Date: Thu, 10 May 2018 17:38:43 -0400 +Subject: [PATCH] ACPI / irq: Workaround firmware issue on X-Gene based m400 + +Message-id: <20180510173844.29580-3-msalter@redhat.com> +Patchwork-id: 214383 +O-Subject: [RHEL-8 BZ1519554 2/3] ACPI / irq: Workaround firmware issue on X-Gene based m400 +Bugzilla: 1519554 +RH-Acked-by: Al Stone +RH-Acked-by: Tony Camuso + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1519554 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16144520 + +The ACPI firmware on the xgene-based m400 platorms erroneously +describes its UART interrupt as ACPI_PRODUCER rather than +ACPI_CONSUMER. This leads to the UART driver being unable to +find its interrupt and the kernel unable find a console. +Work around this by avoiding the producer/consumer check +for X-Gene UARTs. + +Upstream Status: RHEL only +Signed-off-by: Mark Salter +Signed-off-by: Herton R. Krzesinski +--- + drivers/acpi/irq.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c +index e209081d644b..7484bcf59a1b 100644 +--- a/drivers/acpi/irq.c ++++ b/drivers/acpi/irq.c +@@ -126,6 +126,7 @@ struct acpi_irq_parse_one_ctx { + unsigned int index; + unsigned long *res_flags; + struct irq_fwspec *fwspec; ++ bool skip_producer_check; + }; + + /** +@@ -197,7 +198,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; +@@ -232,8 +234,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_bus_get_acpi_device(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; + } +-- +2.26.2 + diff --git a/SOURCES/0001-ARM-fix-__get_user_check-in-case-uaccess_-calls-are-.patch b/SOURCES/0001-ARM-fix-__get_user_check-in-case-uaccess_-calls-are-.patch new file mode 100644 index 0000000..c5a4360 --- /dev/null +++ b/SOURCES/0001-ARM-fix-__get_user_check-in-case-uaccess_-calls-are-.patch @@ -0,0 +1,86 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Mon, 30 Sep 2019 14:59:25 +0900 +Subject: [PATCH] ARM: fix __get_user_check() in case uaccess_* calls are not + inlined + +KernelCI reports that bcm2835_defconfig is no longer booting since +commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING +forcibly"): + + https://lkml.org/lkml/2019/9/26/825 + +I also received a regression report from Nicolas Saenz Julienne: + + https://lkml.org/lkml/2019/9/27/263 + +This problem has cropped up on arch/arm/config/bcm2835_defconfig +because it enables CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler tends +to prefer not inlining functions with -Os. I was able to reproduce +it with other boards and defconfig files by manually enabling +CONFIG_CC_OPTIMIZE_FOR_SIZE. + +The __get_user_check() specifically uses r0, r1, r2 registers. +So, uaccess_save_and_enable() and uaccess_restore() must be inlined +in order to avoid those registers being overwritten in the callees. + +Prior to commit 9012d011660e ("compiler: allow all arches to enable +CONFIG_OPTIMIZE_INLINING"), the 'inline' marker was always enough for +inlining functions, except on x86. + +Since that commit, all architectures can enable CONFIG_OPTIMIZE_INLINING. +So, __always_inline is now the only guaranteed way of forcible inlining. + +I want to keep as much compiler's freedom as possible about the inlining +decision. So, I changed the function call order instead of adding +__always_inline around. + +Call uaccess_save_and_enable() before assigning the __p ("r0"), and +uaccess_restore() after evacuating the __e ("r0"). + +Fixes: 9012d011660e ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING") +Reported-by: "kernelci.org bot" +Reported-by: Nicolas Saenz Julienne +Signed-off-by: Masahiro Yamada +Acked-by: Arnd Bergmann +Tested-by: Nicolas Saenz Julienne +Tested-by: Fabrizio Castro +Tested-by: Geert Uytterhoeven +--- + arch/arm/include/asm/uaccess.h | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 98c6b91be4a8..60055827dddc 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -191,11 +191,12 @@ extern int __get_user_64t_4(void *); + #define __get_user_check(x, p) \ + ({ \ + unsigned long __limit = current_thread_info()->addr_limit - 1; \ ++ unsigned int __ua_flags = uaccess_save_and_enable(); \ + register typeof(*(p)) __user *__p asm("r0") = (p); \ + register __inttype(x) __r2 asm("r2"); \ + register unsigned long __l asm("r1") = __limit; \ + register int __e asm("r0"); \ +- unsigned int __ua_flags = uaccess_save_and_enable(); \ ++ unsigned int __err; \ + switch (sizeof(*(__p))) { \ + case 1: \ + if (sizeof((x)) >= 8) \ +@@ -223,9 +224,10 @@ extern int __get_user_64t_4(void *); + break; \ + default: __e = __get_user_bad(); break; \ + } \ +- uaccess_restore(__ua_flags); \ ++ __err = __e; \ + x = (typeof(*(p))) __r2; \ +- __e; \ ++ uaccess_restore(__ua_flags); \ ++ __err; \ + }) + + #define get_user(x, p) \ +-- +2.26.2 + diff --git a/SOURCES/0001-ARM-tegra-usb-no-reset.patch b/SOURCES/0001-ARM-tegra-usb-no-reset.patch new file mode 100644 index 0000000..f91c6b8 --- /dev/null +++ b/SOURCES/0001-ARM-tegra-usb-no-reset.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Thu, 3 May 2012 20:27:11 +0100 +Subject: [PATCH] ARM: tegra: usb no reset + +Patch for disconnect issues with storage attached to a + tegra-ehci controller +--- + drivers/usb/core/hub.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index fc748c731832..7d35e12de70f 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5517,6 +5517,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); +-- +2.26.2 + diff --git a/SOURCES/0001-Add-efi_status_to_str-and-rework-efi_status_to_err.patch b/SOURCES/0001-Add-efi_status_to_str-and-rework-efi_status_to_err.patch new file mode 100644 index 0000000..ee11a24 --- /dev/null +++ b/SOURCES/0001-Add-efi_status_to_str-and-rework-efi_status_to_err.patch @@ -0,0 +1,185 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 2 Oct 2017 18:22:13 -0400 +Subject: [PATCH] Add efi_status_to_str() and rework efi_status_to_err(). + +This adds efi_status_to_str() for use when printing efi_status_t +messages, and reworks efi_status_to_err() so that the two use a common +list of errors. + +Upstream Status: RHEL only +Signed-off-by: Peter Jones +--- + drivers/firmware/efi/efi.c | 124 +++++++++++++++++++++++++++---------- + include/linux/efi.h | 3 + + 2 files changed, 96 insertions(+), 31 deletions(-) + +diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c +index 4e3055238f31..36ca9e2943ce 100644 +--- a/drivers/firmware/efi/efi.c ++++ b/drivers/firmware/efi/efi.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + #include + +@@ -828,40 +829,101 @@ int efi_mem_type(unsigned long phys_addr) + } + #endif + ++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; + } + + static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock); +diff --git a/include/linux/efi.h b/include/linux/efi.h +index 9430d01c0c3d..51503bf118ab 100644 +--- a/include/linux/efi.h ++++ b/include/linux/efi.h +@@ -42,6 +42,8 @@ + #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 */ +@@ -825,6 +827,7 @@ static inline bool efi_rt_services_supported(unsigned int mask) + #endif + + extern int efi_status_to_err(efi_status_t status); ++extern const char *efi_status_to_str(efi_status_t status); + + /* + * Variable Attributes +-- +2.26.2 + diff --git a/SOURCES/0001-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch b/SOURCES/0001-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch new file mode 100644 index 0000000..970824d --- /dev/null +++ b/SOURCES/0001-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Wed, 26 Feb 2020 13:38:40 -0500 +Subject: [PATCH] Add option of 13 for FORCE_MAX_ZONEORDER + +This is a hack, but it's what the other distros currently use +for aarch64 with 4K pages so we'll do the same while upstream +decides what the best outcome is (which isn't this). + +Upstream Status: RHEL only +Signed-off-by: Peter Robinson +[Add a dependency on RHEL_DIFFERENCES] +Signed-off-by: Jeremy Cline +--- + arch/arm64/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index 7f37a6d0658a..c88ee0e8ce6e 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -1126,6 +1126,7 @@ config XEN + config FORCE_MAX_ZONEORDER + int + default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE) ++ default "13" if (ARCH_THUNDER && !ARM64_64K_PAGES && !RHEL_DIFFERENCES) + default "12" if (ARM64_16K_PAGES && TRANSPARENT_HUGEPAGE) + default "11" + help +-- +2.26.2 + diff --git a/SOURCES/0001-Drop-that-for-now.patch b/SOURCES/0001-Drop-that-for-now.patch new file mode 100644 index 0000000..bc898b6 --- /dev/null +++ b/SOURCES/0001-Drop-that-for-now.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Laura Abbott +Date: Wed, 23 Jan 2019 14:36:37 +0100 +Subject: [PATCH] Drop that for now + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 3d65d1153aac..0e2fb7fe2675 100644 +--- a/Makefile ++++ b/Makefile +@@ -479,7 +479,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE + KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ + -Werror=implicit-function-declaration -Werror=implicit-int \ +- -Wno-format-security \ ++ -Wno-format-security -Wno-address-of-packed-member \ + -std=gnu89 + KBUILD_CPPFLAGS := -D__KERNEL__ + KBUILD_AFLAGS_KERNEL := +-- +2.26.2 + diff --git a/SOURCES/0001-Input-rmi4-remove-the-need-for-artificial-IRQ-in-cas.patch b/SOURCES/0001-Input-rmi4-remove-the-need-for-artificial-IRQ-in-cas.patch new file mode 100644 index 0000000..4d7bef5 --- /dev/null +++ b/SOURCES/0001-Input-rmi4-remove-the-need-for-artificial-IRQ-in-cas.patch @@ -0,0 +1,330 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Tissoires +Date: Mon, 3 Apr 2017 18:18:21 +0200 +Subject: [PATCH] Input: rmi4 - remove the need for artificial IRQ in case of + HID + +The IRQ from rmi4 may interfere with the one we currently use on i2c-hid. +Given that there is already a need for an external API from rmi4 to +forward the attention data, we can, in this particular case rely on a +separate workqueue to prevent cursor jumps. + +Reported-by: Cameron Gutman +Reported-by: Thorsten Leemhuis +Reported-by: Jason Ekstrand +Tested-by: Andrew Duggan +Signed-off-by: Benjamin Tissoires +Signed-off-by: Lyude +--- + drivers/hid/hid-rmi.c | 64 ----------------- + drivers/input/rmi4/rmi_driver.c | 124 +++++++++++++++++++------------- + include/linux/rmi.h | 1 + + 3 files changed, 75 insertions(+), 114 deletions(-) + +diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c +index 8cffa84c9650..6c4e3675601a 100644 +--- a/drivers/hid/hid-rmi.c ++++ b/drivers/hid/hid-rmi.c +@@ -322,19 +322,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; + +- 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; + } + +@@ -592,56 +585,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; +@@ -714,18 +657,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.f30_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/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c +index 258d5fe3d395..f7298e3dc8f3 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: +@@ -981,6 +997,8 @@ static int rmi_driver_remove(struct device *dev) + irq_domain_remove(data->irqdomain); + data->irqdomain = NULL; + ++ cancel_work_sync(&data->attn_work); ++ + rmi_f34_remove_sysfs(rmi_dev); + rmi_free_function_list(rmi_dev); + +@@ -1219,9 +1237,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/include/linux/rmi.h b/include/linux/rmi.h +index 7b22366d0065..307a651b2755 100644 +--- a/include/linux/rmi.h ++++ b/include/linux/rmi.h +@@ -363,6 +363,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); +-- +2.26.2 + diff --git a/SOURCES/0001-KEYS-Make-use-of-platform-keyring-for-module-signatu.patch b/SOURCES/0001-KEYS-Make-use-of-platform-keyring-for-module-signatu.patch new file mode 100644 index 0000000..b53addb --- /dev/null +++ b/SOURCES/0001-KEYS-Make-use-of-platform-keyring-for-module-signatu.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robert Holmes +Date: Tue, 23 Apr 2019 07:39:29 +0000 +Subject: [PATCH] KEYS: Make use of platform keyring for module signature + verify + +This patch completes commit 278311e417be ("kexec, KEYS: Make use of +platform keyring for signature verify") which, while adding the +platform keyring for bzImage verification, neglected to also add +this keyring for module verification. + +As such, kernel modules signed with keys from the MokList variable +were not successfully verified. + +Signed-off-by: Robert Holmes +Signed-off-by: Jeremy Cline +--- + kernel/module_signing.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/kernel/module_signing.c b/kernel/module_signing.c +index 9d9fc678c91d..84ad75a53c83 100644 +--- a/kernel/module_signing.c ++++ b/kernel/module_signing.c +@@ -38,8 +38,15 @@ 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; + } +-- +2.26.2 + diff --git a/SOURCES/0001-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch b/SOURCES/0001-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch new file mode 100644 index 0000000..671b740 --- /dev/null +++ b/SOURCES/0001-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 2 Oct 2017 18:18:30 -0400 +Subject: [PATCH] Make get_cert_list() use efi_status_to_str() to print error + messages. + +Upstream Status: RHEL only +Signed-off-by: Peter Jones +Signed-off-by: Jeremy Cline +--- + security/integrity/platform_certs/load_uefi.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c +index 253fb9a7fc98..8c95b68d86d4 100644 +--- a/security/integrity/platform_certs/load_uefi.c ++++ b/security/integrity/platform_certs/load_uefi.c +@@ -46,7 +46,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; + } + +@@ -57,7 +58,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; + } + +-- +2.26.2 + diff --git a/SOURCES/0001-PCI-Add-MCFG-quirks-for-Tegra194-host-controllers.patch b/SOURCES/0001-PCI-Add-MCFG-quirks-for-Tegra194-host-controllers.patch new file mode 100644 index 0000000..6fc81f8 --- /dev/null +++ b/SOURCES/0001-PCI-Add-MCFG-quirks-for-Tegra194-host-controllers.patch @@ -0,0 +1,209 @@ +From 92c547f35f4852908f40c2861d9b9d10e0c5099b Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sun, 28 Jun 2020 16:48:50 +0100 +Subject: [PATCH] PCI: Add MCFG quirks for Tegra194 host controllers + +The PCIe controller in Tegra194 SoC is not completely ECAM-compliant. +With the current hardware design limitations in place, ECAM can be enabled +only for one controller (C5 controller to be precise) with bus numbers +starting from 160 instead of 0. A different approach is taken to avoid this +abnormal way of enabling ECAM for just one controller but to enable +configuration space access for all the other controllers. In this approach, +ops are added through MCFG quirk mechanism which access the configuration +spaces by dynamically programming iATU (internal AddressTranslation Unit) +to generate respective configuration accesses just like the way it is +done in DesignWare core sub-system. + +Signed-off-by: Vidya Sagar +Reported-by: kbuild test robot +Signed-off-by: Peter Robinson +--- +V3: +* Removed MCFG address hardcoding in pci_mcfg.c file +* Started using 'dbi_base' for accessing root port's own config space +* and using 'config_base' for accessing config space of downstream hierarchy + +V2: +* Fixed build issues reported by kbuild test bot +--- + drivers/acpi/pci_mcfg.c | 7 ++ + drivers/pci/controller/dwc/Makefile | 2 +- + drivers/pci/controller/dwc/pcie-tegra194.c | 102 +++++++++++++++++++++ + include/linux/pci-ecam.h | 1 + + 4 files changed, 111 insertions(+), 1 deletion(-) + +diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c +index 6b347d9920cc2..7071814081736 100644 +--- a/drivers/acpi/pci_mcfg.c ++++ b/drivers/acpi/pci_mcfg.c +@@ -116,6 +116,13 @@ static struct mcfg_fixup mcfg_quirks[] = { + THUNDER_ECAM_QUIRK(2, 12), + THUNDER_ECAM_QUIRK(2, 13), + ++ { "NVIDIA", "TEGRA194", 1, 0, MCFG_BUS_ANY, &tegra194_pcie_ops}, ++ { "NVIDIA", "TEGRA194", 1, 1, MCFG_BUS_ANY, &tegra194_pcie_ops}, ++ { "NVIDIA", "TEGRA194", 1, 2, MCFG_BUS_ANY, &tegra194_pcie_ops}, ++ { "NVIDIA", "TEGRA194", 1, 3, MCFG_BUS_ANY, &tegra194_pcie_ops}, ++ { "NVIDIA", "TEGRA194", 1, 4, MCFG_BUS_ANY, &tegra194_pcie_ops}, ++ { "NVIDIA", "TEGRA194", 1, 5, MCFG_BUS_ANY, &tegra194_pcie_ops}, ++ + #define XGENE_V1_ECAM_MCFG(rev, seg) \ + {"APM ", "XGENE ", rev, seg, MCFG_BUS_ANY, \ + &xgene_v1_pcie_ecam_ops } +diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile +index 8a637cfcf6e99..76a6c52b8500e 100644 +--- a/drivers/pci/controller/dwc/Makefile ++++ b/drivers/pci/controller/dwc/Makefile +@@ -17,7 +17,6 @@ obj-$(CONFIG_PCIE_INTEL_GW) += pcie-intel-gw.o + obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o + obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o + obj-$(CONFIG_PCI_MESON) += pci-meson.o +-obj-$(CONFIG_PCIE_TEGRA194) += pcie-tegra194.o + obj-$(CONFIG_PCIE_UNIPHIER) += pcie-uniphier.o + + # The following drivers are for devices that use the generic ACPI +@@ -33,4 +32,5 @@ obj-$(CONFIG_PCIE_UNIPHIER) += pcie-uniphier.o + ifdef CONFIG_PCI + obj-$(CONFIG_ARM64) += pcie-al.o + obj-$(CONFIG_ARM64) += pcie-hisi.o ++obj-$(CONFIG_ARM64) += pcie-tegra194.o + endif +diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c +index ae30a2fd3716a..571b39c5cac63 100644 +--- a/drivers/pci/controller/dwc/pcie-tegra194.c ++++ b/drivers/pci/controller/dwc/pcie-tegra194.c +@@ -22,6 +22,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -324,6 +326,103 @@ struct tegra_pcie_dw_of_data { + enum dw_pcie_device_mode mode; + }; + ++#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) ++struct tegra194_pcie_acpi { ++ void __iomem *config_base; ++ void __iomem *iatu_base; ++ void __iomem *dbi_base; ++}; ++ ++static int tegra194_acpi_init(struct pci_config_window *cfg) ++{ ++ struct device *dev = cfg->parent; ++ struct tegra194_pcie_acpi *pcie; ++ ++ pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); ++ if (!pcie) ++ return -ENOMEM; ++ ++ pcie->config_base = cfg->win; ++ pcie->iatu_base = cfg->win + SZ_256K; ++ pcie->dbi_base = cfg->win + SZ_512K; ++ cfg->priv = pcie; ++ ++ return 0; ++} ++ ++static inline void atu_reg_write(struct tegra194_pcie_acpi *pcie, int index, ++ u32 val, u32 reg) ++{ ++ u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index); ++ ++ writel(val, pcie->iatu_base + offset + reg); ++} ++ ++static void program_outbound_atu(struct tegra194_pcie_acpi *pcie, int index, ++ int type, u64 cpu_addr, u64 pci_addr, u64 size) ++{ ++ atu_reg_write(pcie, index, lower_32_bits(cpu_addr), ++ PCIE_ATU_LOWER_BASE); ++ atu_reg_write(pcie, index, upper_32_bits(cpu_addr), ++ PCIE_ATU_UPPER_BASE); ++ atu_reg_write(pcie, index, lower_32_bits(pci_addr), ++ PCIE_ATU_LOWER_TARGET); ++ atu_reg_write(pcie, index, lower_32_bits(cpu_addr + size - 1), ++ PCIE_ATU_LIMIT); ++ atu_reg_write(pcie, index, upper_32_bits(pci_addr), ++ PCIE_ATU_UPPER_TARGET); ++ atu_reg_write(pcie, index, type, PCIE_ATU_CR1); ++ atu_reg_write(pcie, index, PCIE_ATU_ENABLE, PCIE_ATU_CR2); ++} ++ ++static void __iomem *tegra194_map_bus(struct pci_bus *bus, ++ unsigned int devfn, int where) ++{ ++ struct pci_config_window *cfg = bus->sysdata; ++ struct tegra194_pcie_acpi *pcie = cfg->priv; ++ u32 busdev; ++ int type; ++ ++ if (bus->number < cfg->busr.start || bus->number > cfg->busr.end) ++ return NULL; ++ ++ if (bus->number == cfg->busr.start) { ++ if (PCI_SLOT(devfn) == 0) ++ return pcie->dbi_base + where; ++ else ++ return NULL; ++ } ++ ++ busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | ++ PCIE_ATU_FUNC(PCI_FUNC(devfn)); ++ ++ if (bus->parent->number == cfg->busr.start) { ++ if (PCI_SLOT(devfn) == 0) ++ type = PCIE_ATU_TYPE_CFG0; ++ else ++ return NULL; ++ } else { ++ type = PCIE_ATU_TYPE_CFG1; ++ } ++ ++ program_outbound_atu(pcie, PCIE_ATU_REGION_INDEX0, type, ++ cfg->res.start, busdev, SZ_256K); ++ return (void __iomem *)(pcie->config_base + where); ++} ++ ++struct pci_ecam_ops tegra194_pcie_ops = { ++ .bus_shift = 20, ++ .init = tegra194_acpi_init, ++ .pci_ops = { ++ .map_bus = tegra194_map_bus, ++ .read = pci_generic_config_read, ++ .write = pci_generic_config_write, ++ } ++}; ++#endif /* defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) */ ++ ++#ifdef CONFIG_PCIE_TEGRA194 ++ + static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci) + { + return container_of(pci, struct tegra_pcie_dw, pci); +@@ -2406,3 +2505,6 @@ MODULE_DEVICE_TABLE(of, tegra_pcie_dw_of_match); + MODULE_AUTHOR("Vidya Sagar "); + MODULE_DESCRIPTION("NVIDIA PCIe host controller driver"); + MODULE_LICENSE("GPL v2"); ++ ++#endif /* CONFIG_PCIE_TEGRA194 */ ++ +diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h +index a73164c85e78b..6156140dcbb65 100644 +--- a/include/linux/pci-ecam.h ++++ b/include/linux/pci-ecam.h +@@ -57,6 +57,7 @@ extern struct pci_ecam_ops pci_thunder_ecam_ops; /* Cavium ThunderX 1.x */ + extern struct pci_ecam_ops xgene_v1_pcie_ecam_ops; /* APM X-Gene PCIe v1 */ + extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */ + extern struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */ ++extern struct pci_ecam_ops tegra194_pcie_ops; /* Tegra194 PCIe */ + #endif + + #ifdef CONFIG_PCI_HOST_COMMON +-- +2.26.2 + diff --git a/SOURCES/0001-PCI-brcmstb-Wait-for-Raspberry-Pi-s-firmware-when-pr.patch b/SOURCES/0001-PCI-brcmstb-Wait-for-Raspberry-Pi-s-firmware-when-pr.patch new file mode 100644 index 0000000..07f8b4e --- /dev/null +++ b/SOURCES/0001-PCI-brcmstb-Wait-for-Raspberry-Pi-s-firmware-when-pr.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Tue, 10 Mar 2020 13:52:41 +0100 +Subject: [PATCH] PCI: brcmstb: Wait for Raspberry Pi's firmware when present + +xHCI's PCI fixup, run at the end of pcie-brcmstb's probe, depends on +RPi4's VideoCore firmware interface to be up and running. It's possible +for both initializations to race, so make sure it's available prior to +starting. + +Signed-off-by: Nicolas Saenz Julienne +Reviewed-by: Florian Fainelli +--- + drivers/pci/controller/pcie-brcmstb.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c +index 6d79d14527a6..aee84679a997 100644 +--- a/drivers/pci/controller/pcie-brcmstb.c ++++ b/drivers/pci/controller/pcie-brcmstb.c +@@ -28,6 +28,8 @@ + #include + #include + ++#include ++ + #include "../pci.h" + + /* BRCM_PCIE_CAP_REGS - Offset for the mandatory capability config regs */ +@@ -917,11 +919,24 @@ static int brcm_pcie_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node, *msi_np; + struct pci_host_bridge *bridge; ++ struct device_node *fw_np; + struct brcm_pcie *pcie; + struct pci_bus *child; + struct resource *res; + int ret; + ++ /* ++ * We have to wait for the Raspberry Pi's firmware interface to be up ++ * as some PCI fixups depend on it. ++ */ ++ fw_np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++ if (fw_np && !rpi_firmware_get(fw_np)) { ++ of_node_put(fw_np); ++ return -EPROBE_DEFER; ++ } ++ of_node_put(fw_np); ++ + bridge = devm_pci_alloc_host_bridge(&pdev->dev, sizeof(*pcie)); + if (!bridge) + return -ENOMEM; +-- +2.26.2 + diff --git a/SOURCES/0001-USB-pci-quirks-Add-Raspberry-Pi-4-quirk.patch b/SOURCES/0001-USB-pci-quirks-Add-Raspberry-Pi-4-quirk.patch new file mode 100644 index 0000000..7f13ec1 --- /dev/null +++ b/SOURCES/0001-USB-pci-quirks-Add-Raspberry-Pi-4-quirk.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Tue, 10 Mar 2020 13:52:42 +0100 +Subject: [PATCH] USB: pci-quirks: Add Raspberry Pi 4 quirk + +On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be +loaded directly from an EEPROM or, if not present, by the SoC's +VideCore. Inform VideCore that VL805 was just reset. + +Also, as this creates a dependency between XHCI_PCI and VideoCore's +firmware interface, reflect that on the firmware interface Kconfg. + +Signed-off-by: Nicolas Saenz Julienne +--- + drivers/firmware/Kconfig | 1 + + drivers/usb/host/pci-quirks.c | 16 ++++++++++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig +index 8007d4aa76dc..7ca346d3d337 100644 +--- a/drivers/firmware/Kconfig ++++ b/drivers/firmware/Kconfig +@@ -180,6 +180,7 @@ config ISCSI_IBFT + config RASPBERRYPI_FIRMWARE + tristate "Raspberry Pi Firmware Driver" + depends on BCM2835_MBOX ++ default XHCI_PCI + help + This option enables support for communicating with the firmware on the + Raspberry Pi. +diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c +index beb2efa71341..0dc34668bb2a 100644 +--- a/drivers/usb/host/pci-quirks.c ++++ b/drivers/usb/host/pci-quirks.c +@@ -16,6 +16,9 @@ + #include + #include + #include ++ ++#include ++ + #include "pci-quirks.h" + #include "xhci-ext-caps.h" + +@@ -1243,11 +1246,24 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) + + static void quirk_usb_early_handoff(struct pci_dev *pdev) + { ++ int ret; ++ + /* Skip Netlogic mips SoC's internal PCI USB controller. + * This device does not need/support EHCI/OHCI handoff + */ + if (pdev->vendor == 0x184e) /* vendor Netlogic */ + return; ++ ++ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { ++ ret = rpi_firmware_init_vl805(pdev); ++ if (ret) { ++ /* Firmware might be outdated, or something failed */ ++ dev_warn(&pdev->dev, ++ "Failed to load VL805's firmware: %d. Will continue to attempt to work, but bad things might happen. You should fix this...\n", ++ ret); ++ } ++ } ++ + if (pdev->class != PCI_CLASS_SERIAL_USB_UHCI && + pdev->class != PCI_CLASS_SERIAL_USB_OHCI && + pdev->class != PCI_CLASS_SERIAL_USB_EHCI && +-- +2.26.2 + diff --git a/SOURCES/0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch b/SOURCES/0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch new file mode 100644 index 0000000..828ed5d --- /dev/null +++ b/SOURCES/0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robert Richter +Date: Thu, 7 Jun 2018 22:59:32 -0400 +Subject: [PATCH] Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon + +Message-id: <1528412373-19128-2-git-send-email-rrichter@redhat.com> +Patchwork-id: 220950 +O-Subject: [RHEL-8.0 BZ 1563590 v2 1/2] PCI: Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon +Bugzilla: 1563590 +RH-Acked-by: Dean Nelson +RH-Acked-by: Mark Langsdorf +RH-Acked-by: Mark Salter + +From: Ashok Kumar Sekar + +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 but NOT used +by the AHCI controller actually. + +RHEL-only: + +Both patches are in RHEL-7.6 also. Inclusion of the patches into RHEL-8 +was discussed. Since there are partners with Ax system configurations it +was decided to carry them in RHEL8 too. See: + + https://bugzilla.redhat.com/show_bug.cgi?id=1563590#c1 + +Upstream Status: RHEL only +Signed-off-by: Ashok Kumar Sekar +Signed-off-by: Jayachandran C +Signed-off-by: Robert Richter +Signed-off-by: Herton R. Krzesinski +--- + drivers/pci/quirks.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index ca9ed5774eb1..bd0cee4236b0 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -4183,6 +4183,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. +-- +2.26.2 + diff --git a/SOURCES/0001-aarch64-acpi-scan-Fix-regression-related-to-X-Gene-U.patch b/SOURCES/0001-aarch64-acpi-scan-Fix-regression-related-to-X-Gene-U.patch new file mode 100644 index 0000000..86cbf5d --- /dev/null +++ b/SOURCES/0001-aarch64-acpi-scan-Fix-regression-related-to-X-Gene-U.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Salter +Date: Thu, 10 May 2018 17:38:44 -0400 +Subject: [PATCH] aarch64: acpi scan: Fix regression related to X-Gene UARTs + +Message-id: <20180510173844.29580-4-msalter@redhat.com> +Patchwork-id: 214381 +O-Subject: [RHEL-8 BZ1519554 3/3] aarch64: acpi scan: Fix regression related to X-Gene UARTs +Bugzilla: 1519554 +RH-Acked-by: Al Stone +RH-Acked-by: Tony Camuso + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1519554 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16144520 + +Commit e361d1f85855 ("ACPI / scan: Fix enumeration for special UART +devices") caused a regression with some X-Gene based platforms (Mustang +and M400) with invalid DSDT. The DSDT makes it appear that the UART +device is also a slave device attached to itself. With the above commit +the UART won't be enumerated by ACPI scan (slave serial devices shouldn't +be). So check for X-Gene UART device and skip slace device check on it. + +Upstream Status: RHEL only +Signed-off-by: Mark Salter +Signed-off-by: Herton R. Krzesinski +--- + drivers/acpi/scan.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c +index 6d3448895382..221255007dc8 100644 +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -1563,6 +1563,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) + if (!acpi_match_device_ids(device, i2c_multi_instantiate_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, +-- +2.26.2 + diff --git a/SOURCES/0001-acr-Use-kmemdup-instead-of-kmalloc-and-memcpy.patch b/SOURCES/0001-acr-Use-kmemdup-instead-of-kmalloc-and-memcpy.patch new file mode 100644 index 0000000..9470c46 --- /dev/null +++ b/SOURCES/0001-acr-Use-kmemdup-instead-of-kmalloc-and-memcpy.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zou Wei +Date: Tue, 21 Apr 2020 20:37:31 +0800 +Subject: [PATCH] acr: Use kmemdup instead of kmalloc and memcpy + +Fixes coccicheck warning: + +drivers/gpu/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c:103:23-30: WARNING opportunity for kmemdup +drivers/gpu/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c:113:22-29: WARNING opportunity for kmemdup + +Fixes: 22dcda45a3d1 ("drivers/gpu/drm/nouveau/acr: implement new subdev to replace "secure boot"") +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c +index aecce2dac558..667fa016496e 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c +@@ -100,25 +100,21 @@ nvkm_acr_hsfw_load_image(struct nvkm_acr *acr, const char *name, int ver, + hsfw->data_size = lhdr->data_size; + + hsfw->sig.prod.size = fwhdr->sig_prod_size; +- hsfw->sig.prod.data = kmalloc(hsfw->sig.prod.size, GFP_KERNEL); ++ hsfw->sig.prod.data = kmemdup(fw->data + fwhdr->sig_prod_offset + sig, ++ hsfw->sig.prod.size, GFP_KERNEL); + if (!hsfw->sig.prod.data) { + ret = -ENOMEM; + goto done; + } + +- memcpy(hsfw->sig.prod.data, fw->data + fwhdr->sig_prod_offset + sig, +- hsfw->sig.prod.size); +- + hsfw->sig.dbg.size = fwhdr->sig_dbg_size; +- hsfw->sig.dbg.data = kmalloc(hsfw->sig.dbg.size, GFP_KERNEL); ++ hsfw->sig.dbg.data = kmemdup(fw->data + fwhdr->sig_dbg_offset + sig, ++ hsfw->sig.dbg.size, GFP_KERNEL); + if (!hsfw->sig.dbg.data) { + ret = -ENOMEM; + goto done; + } + +- memcpy(hsfw->sig.dbg.data, fw->data + fwhdr->sig_dbg_offset + sig, +- hsfw->sig.dbg.size); +- + hsfw->sig.patch_loc = loc; + done: + nvkm_firmware_put(fw); +-- +2.26.2 + diff --git a/SOURCES/0001-ahci-thunderx2-Fix-for-errata-that-affects-stop-engi.patch b/SOURCES/0001-ahci-thunderx2-Fix-for-errata-that-affects-stop-engi.patch new file mode 100644 index 0000000..0299e96 --- /dev/null +++ b/SOURCES/0001-ahci-thunderx2-Fix-for-errata-that-affects-stop-engi.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robert Richter +Date: Thu, 7 Jun 2018 22:59:33 -0400 +Subject: [PATCH] ahci: thunderx2: Fix for errata that affects stop engine + +Message-id: <1528412373-19128-3-git-send-email-rrichter@redhat.com> +Patchwork-id: 220952 +O-Subject: [RHEL-8.0 BZ 1563590 v2 2/2] ahci: thunderx2: Fix for errata that affects stop engine +Bugzilla: 1563590 +RH-Acked-by: Dean Nelson +RH-Acked-by: Mark Langsdorf +RH-Acked-by: Mark Salter + +From: Jayachandran C + +Apply workaround for this errata: + Synopsis: Resetting PxCMD.ST may hang the SATA device + + Description: An internal ping-pong buffer state is not reset + correctly for an PxCMD.ST=0 command for a SATA channel. This + may cause the SATA interface to hang when a PxCMD.ST=0 command + is received. + + Workaround: A SATA_BIU_CORE_ENABLE.sw_init_bsi must be asserted + by the driver whenever the PxCMD.ST needs to be de-asserted. This + will reset both the ports. So, it may not always work in a 2 + channel SATA system. + + Resolution: Fix in B0. + +Add the code to ahci_stop_engine() to do this. It is not easy to +stop the other "port" since it is associated with a different AHCI +interface. Please note that with this fix, SATA reset does not +hang any more, but it can cause failures on the other interface +if that is in active use. + +Unfortunately, we have nothing other the the CPU ID to check if the +SATA block has this issue. + +RHEL-only: + +Both patches are in RHEL-7.6 also. Inclusion of the patches into RHEL-8 +was discussed. Since there are partners with Ax system configurations it +was decided to carry them in RHEL8 too. See: + + https://bugzilla.redhat.com/show_bug.cgi?id=1563590#c1 + +[v3 with new delays] +Signed-off-by: Jayachandran C + +Upstream Status: RHEL only +Signed-off-by: Robert Richter +Signed-off-by: Herton R. Krzesinski +--- + drivers/ata/libahci.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c +index ea5bf5f4cbed..71c55cae27ac 100644 +--- a/drivers/ata/libahci.c ++++ b/drivers/ata/libahci.c +@@ -666,6 +666,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); +-- +2.26.2 + diff --git a/SOURCES/0001-arm-aarch64-Drop-the-EXPERT-setting-from-ARM64_FORCE.patch b/SOURCES/0001-arm-aarch64-Drop-the-EXPERT-setting-from-ARM64_FORCE.patch new file mode 100644 index 0000000..286c898 --- /dev/null +++ b/SOURCES/0001-arm-aarch64-Drop-the-EXPERT-setting-from-ARM64_FORCE.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Tue, 1 Oct 2019 15:51:23 +0000 +Subject: [PATCH] arm: aarch64: Drop the EXPERT setting from ARM64_FORCE_52BIT + +Message-id: <20191001181256.22935-1-jcline@redhat.com> +Patchwork-id: 275498 +O-Subject: [ARK INTERNAL PATCH] [ARK INTERNAL PATCH] [redhat] Add patch + to drop the EXPERT setting from ARM64_FORCE_52BIT +Bugzilla: +RH-Acked-by: Laura Abbott + +We don't turn on EXPERT as there are few settings we actually want to +mess with. Remove the dependency for ARM64_FORCE_52BIT as we do want +that on in debug builds to help find 52-bit bugs. + +Upstream Status: RHEL only +Signed-off-by: Jeremy Cline +--- + arch/arm64/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index 5d513f461957..7f37a6d0658a 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -858,7 +858,7 @@ endchoice + + config ARM64_FORCE_52BIT + bool "Force 52-bit virtual addresses for userspace" +- depends on ARM64_VA_BITS_52 && EXPERT ++ depends on ARM64_VA_BITS_52 + help + For systems with 52-bit userspace VAs enabled, the kernel will attempt + to maintain compatibility with older software by providing 48-bit VAs +-- +2.26.2 + diff --git a/SOURCES/0001-arm-make-CONFIG_HIGHPTE-optional-without-CONFIG_EXPE.patch b/SOURCES/0001-arm-make-CONFIG_HIGHPTE-optional-without-CONFIG_EXPE.patch new file mode 100644 index 0000000..040f33c --- /dev/null +++ b/SOURCES/0001-arm-make-CONFIG_HIGHPTE-optional-without-CONFIG_EXPE.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jon Masters +Date: Thu, 18 Jul 2019 15:47:26 -0400 +Subject: [PATCH] arm: make CONFIG_HIGHPTE optional without CONFIG_EXPERT + +We will use this to force CONFIG_HIGHPTE off on LPAE for now + +Signed-off-by: Jon Masters +--- + arch/arm/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index c77c93c485a0..f808c4e0727f 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1543,9 +1543,9 @@ config HIGHMEM + If unsure, say n. + + config HIGHPTE +- bool "Allocate 2nd-level pagetables from highmem" if EXPERT ++ bool "Allocate 2nd-level pagetables from highmem" + depends on HIGHMEM +- default y ++ default n + help + 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 +-- +2.26.2 + diff --git a/SOURCES/0001-core-memory-remove-redundant-assignments-to-variable.patch b/SOURCES/0001-core-memory-remove-redundant-assignments-to-variable.patch new file mode 100644 index 0000000..d490d68 --- /dev/null +++ b/SOURCES/0001-core-memory-remove-redundant-assignments-to-variable.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Sat, 29 Feb 2020 00:53:07 +0000 +Subject: [PATCH] core/memory: remove redundant assignments to variable ret + +The variable ret is being initialized with a value that is never +read and it is being updated later with a new value. The initialization +is redundant and can be removed. + +Addresses-Coverity: ("Unused value") +Signed-off-by: Colin Ian King +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/core/memory.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/core/memory.c b/drivers/gpu/drm/nouveau/nvkm/core/memory.c +index 4cc186262d34..38130ef272d6 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/core/memory.c ++++ b/drivers/gpu/drm/nouveau/nvkm/core/memory.c +@@ -140,7 +140,7 @@ nvkm_memory_new(struct nvkm_device *device, enum nvkm_memory_target target, + { + struct nvkm_instmem *imem = device->imem; + struct nvkm_memory *memory; +- int ret = -ENOSYS; ++ int ret; + + if (unlikely(target != NVKM_MEM_TARGET_INST || !imem)) + return -ENOSYS; +-- +2.26.2 + diff --git a/SOURCES/0001-device-detect-if-changing-endianness-failed.patch b/SOURCES/0001-device-detect-if-changing-endianness-failed.patch new file mode 100644 index 0000000..1089b7e --- /dev/null +++ b/SOURCES/0001-device-detect-if-changing-endianness-failed.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Karol Herbst +Date: Tue, 28 Apr 2020 18:54:03 +0200 +Subject: [PATCH] device: detect if changing endianness failed + +v2: relax the checks a little + +Signed-off-by: Karol Herbst +Signed-off-by: Ben Skeggs +--- + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 26 +++++++++++++++---- + 1 file changed, 21 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +index 37589f36546d..c732074bf790 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +@@ -2924,6 +2924,20 @@ nvkm_device_del(struct nvkm_device **pdevice) + } + } + ++static inline bool ++nvkm_device_endianness(void __iomem *pri) ++{ ++ u32 boot1 = ioread32_native(pri + 0x000004) & 0x01000001; ++#ifdef __BIG_ENDIAN ++ if (!boot1) ++ return false; ++#else ++ if (boot1) ++ return false; ++#endif ++ return true; ++} ++ + int + nvkm_device_ctor(const struct nvkm_device_func *func, + const struct nvkm_device_quirk *quirk, +@@ -2973,13 +2987,15 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + /* identify the chipset, and determine classes of subdev/engines */ + if (detect) { + /* switch mmio to cpu's native endianness */ +-#ifndef __BIG_ENDIAN +- if (ioread32_native(map + 0x000004) != 0x00000000) { +-#else +- if (ioread32_native(map + 0x000004) == 0x00000000) { +-#endif ++ if (!nvkm_device_endianness(map)) { + iowrite32_native(0x01000001, map + 0x000004); + ioread32_native(map); ++ if (!nvkm_device_endianness(map)) { ++ nvdev_error(device, ++ "GPU not supported on big-endian\n"); ++ ret = -ENOSYS; ++ goto done; ++ } + } + + /* read boot0 and strapping information */ +-- +2.26.2 + diff --git a/SOURCES/0001-device-detect-vGPUs.patch b/SOURCES/0001-device-detect-vGPUs.patch new file mode 100644 index 0000000..08f591f --- /dev/null +++ b/SOURCES/0001-device-detect-vGPUs.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Karol Herbst +Date: Tue, 28 Apr 2020 18:54:04 +0200 +Subject: [PATCH] device: detect vGPUs + +Using ENODEV as this prevents probe failed errors in dmesg. + +v2: move check further down + +Signed-off-by: Karol Herbst +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +index c732074bf790..f977dddcd809 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +@@ -2948,7 +2948,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + { + struct nvkm_subdev *subdev; + u64 mmio_base, mmio_size; +- u32 boot0, strap; ++ u32 boot0, boot1, strap; + void __iomem *map = NULL; + int ret = -EEXIST, i; + unsigned chipset; +@@ -2998,9 +2998,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + } + } + +- /* read boot0 and strapping information */ + boot0 = ioread32_native(map + 0x000000); +- strap = ioread32_native(map + 0x101000); + + /* chipset can be overridden for devel/testing purposes */ + chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0); +@@ -3158,6 +3156,17 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + nvdev_info(device, "NVIDIA %s (%08x)\n", + device->chip->name, boot0); + ++ /* vGPU detection */ ++ boot1 = ioread32_native(map + 0x000004); ++ if (device->card_type >= TU100 && (boot1 & 0x00030000)) { ++ nvdev_info(device, "vGPUs are not supported\n"); ++ ret = -ENODEV; ++ goto done; ++ } ++ ++ /* read strapping information */ ++ strap = ioread32_native(map + 0x101000); ++ + /* determine frequency of timing crystal */ + if ( device->card_type <= NV_10 || device->chipset < 0x17 || + (device->chipset >= 0x20 && device->chipset < 0x25)) +-- +2.26.2 + diff --git a/SOURCES/0001-device-rework-mmio-mapping-code-to-get-rid-of-second.patch b/SOURCES/0001-device-rework-mmio-mapping-code-to-get-rid-of-second.patch new file mode 100644 index 0000000..bde820b --- /dev/null +++ b/SOURCES/0001-device-rework-mmio-mapping-code-to-get-rid-of-second.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Karol Herbst +Date: Tue, 28 Apr 2020 18:54:02 +0200 +Subject: [PATCH] device: rework mmio mapping code to get rid of second map + +Fixes warnings on GPUs with smaller a smaller mmio region like vGPUs. + +Signed-off-by: Karol Herbst +Signed-off-by: Ben Skeggs +--- + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 27 ++++++++++--------- + 1 file changed, 15 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +index 8ebbe1656008..37589f36546d 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +@@ -2935,7 +2935,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + struct nvkm_subdev *subdev; + u64 mmio_base, mmio_size; + u32 boot0, strap; +- void __iomem *map; ++ void __iomem *map = NULL; + int ret = -EEXIST, i; + unsigned chipset; + +@@ -2961,12 +2961,17 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + mmio_base = device->func->resource_addr(device, 0); + mmio_size = device->func->resource_size(device, 0); + +- /* identify the chipset, and determine classes of subdev/engines */ +- if (detect) { +- map = ioremap(mmio_base, 0x102000); +- if (ret = -ENOMEM, map == NULL) ++ if (detect || mmio) { ++ map = ioremap(mmio_base, mmio_size); ++ if (map == NULL) { ++ nvdev_error(device, "unable to map PRI\n"); ++ ret = -ENOMEM; + goto done; ++ } ++ } + ++ /* identify the chipset, and determine classes of subdev/engines */ ++ if (detect) { + /* switch mmio to cpu's native endianness */ + #ifndef __BIG_ENDIAN + if (ioread32_native(map + 0x000004) != 0x00000000) { +@@ -2980,7 +2985,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + /* read boot0 and strapping information */ + boot0 = ioread32_native(map + 0x000000); + strap = ioread32_native(map + 0x101000); +- iounmap(map); + + /* chipset can be overridden for devel/testing purposes */ + chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0); +@@ -3159,12 +3163,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + device->name = device->chip->name; + + if (mmio) { +- device->pri = ioremap(mmio_base, mmio_size); +- if (!device->pri) { +- nvdev_error(device, "unable to map PRI\n"); +- ret = -ENOMEM; +- goto done; +- } ++ device->pri = map; + } + + mutex_init(&device->mutex); +@@ -3254,6 +3253,10 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + + ret = 0; + done: ++ if (map && (!mmio || ret)) { ++ device->pri = NULL; ++ iounmap(map); ++ } + mutex_unlock(&nv_devices_mutex); + return ret; + } +-- +2.26.2 + diff --git a/SOURCES/0001-device-use-regular-PRI-accessors-in-chipset-detectio.patch b/SOURCES/0001-device-use-regular-PRI-accessors-in-chipset-detectio.patch new file mode 100644 index 0000000..ec43451 --- /dev/null +++ b/SOURCES/0001-device-use-regular-PRI-accessors-in-chipset-detectio.patch @@ -0,0 +1,113 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Thu, 30 Apr 2020 14:08:53 +1000 +Subject: [PATCH] device: use regular PRI accessors in chipset detection + +Signed-off-by: Ben Skeggs +--- + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 31 ++++++++----------- + 1 file changed, 13 insertions(+), 18 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +index f977dddcd809..5b90c2a1bf3d 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +@@ -2925,9 +2925,9 @@ nvkm_device_del(struct nvkm_device **pdevice) + } + + static inline bool +-nvkm_device_endianness(void __iomem *pri) ++nvkm_device_endianness(struct nvkm_device *device) + { +- u32 boot1 = ioread32_native(pri + 0x000004) & 0x01000001; ++ u32 boot1 = nvkm_rd32(device, 0x000004) & 0x01000001; + #ifdef __BIG_ENDIAN + if (!boot1) + return false; +@@ -2949,7 +2949,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + struct nvkm_subdev *subdev; + u64 mmio_base, mmio_size; + u32 boot0, boot1, strap; +- void __iomem *map = NULL; + int ret = -EEXIST, i; + unsigned chipset; + +@@ -2976,8 +2975,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + mmio_size = device->func->resource_size(device, 0); + + if (detect || mmio) { +- map = ioremap(mmio_base, mmio_size); +- if (map == NULL) { ++ device->pri = ioremap(mmio_base, mmio_size); ++ if (device->pri == NULL) { + nvdev_error(device, "unable to map PRI\n"); + ret = -ENOMEM; + goto done; +@@ -2987,10 +2986,10 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + /* identify the chipset, and determine classes of subdev/engines */ + if (detect) { + /* switch mmio to cpu's native endianness */ +- if (!nvkm_device_endianness(map)) { +- iowrite32_native(0x01000001, map + 0x000004); +- ioread32_native(map); +- if (!nvkm_device_endianness(map)) { ++ if (!nvkm_device_endianness(device)) { ++ nvkm_wr32(device, 0x000004, 0x01000001); ++ nvkm_rd32(device, 0x000000); ++ if (!nvkm_device_endianness(device)) { + nvdev_error(device, + "GPU not supported on big-endian\n"); + ret = -ENOSYS; +@@ -2998,7 +2997,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + } + } + +- boot0 = ioread32_native(map + 0x000000); ++ boot0 = nvkm_rd32(device, 0x000000); + + /* chipset can be overridden for devel/testing purposes */ + chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0); +@@ -3157,7 +3156,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + device->chip->name, boot0); + + /* vGPU detection */ +- boot1 = ioread32_native(map + 0x000004); ++ boot1 = nvkm_rd32(device, 0x0000004); + if (device->card_type >= TU100 && (boot1 & 0x00030000)) { + nvdev_info(device, "vGPUs are not supported\n"); + ret = -ENODEV; +@@ -3165,7 +3164,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + } + + /* read strapping information */ +- strap = ioread32_native(map + 0x101000); ++ strap = nvkm_rd32(device, 0x101000); + + /* determine frequency of timing crystal */ + if ( device->card_type <= NV_10 || device->chipset < 0x17 || +@@ -3187,10 +3186,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + if (!device->name) + device->name = device->chip->name; + +- if (mmio) { +- device->pri = map; +- } +- + mutex_init(&device->mutex); + + for (i = 0; i < NVKM_SUBDEV_NR; i++) { +@@ -3278,9 +3273,9 @@ nvkm_device_ctor(const struct nvkm_device_func *func, + + ret = 0; + done: +- if (map && (!mmio || ret)) { ++ if (device->pri && (!mmio || ret)) { ++ iounmap(device->pri); + device->pri = NULL; +- iounmap(map); + } + mutex_unlock(&nv_devices_mutex); + return ret; +-- +2.26.2 + diff --git a/SOURCES/0001-disp-gv100-expose-capabilities-class.patch b/SOURCES/0001-disp-gv100-expose-capabilities-class.patch new file mode 100644 index 0000000..6029379 --- /dev/null +++ b/SOURCES/0001-disp-gv100-expose-capabilities-class.patch @@ -0,0 +1,149 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Thu, 13 Feb 2020 09:39:34 +1000 +Subject: [PATCH] disp/gv100-: expose capabilities class + +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/include/nvif/class.h | 2 + + .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild | 2 + + .../drm/nouveau/nvkm/engine/disp/capsgv100.c | 60 +++++++++++++++++++ + .../drm/nouveau/nvkm/engine/disp/rootgv100.c | 1 + + .../drm/nouveau/nvkm/engine/disp/rootnv50.h | 3 + + .../drm/nouveau/nvkm/engine/disp/roottu102.c | 1 + + 6 files changed, 69 insertions(+) + create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/capsgv100.c + +diff --git a/drivers/gpu/drm/nouveau/include/nvif/class.h b/drivers/gpu/drm/nouveau/include/nvif/class.h +index 30659747ffe8..2c79beb41126 100644 +--- a/drivers/gpu/drm/nouveau/include/nvif/class.h ++++ b/drivers/gpu/drm/nouveau/include/nvif/class.h +@@ -89,6 +89,8 @@ + #define GV100_DISP /* cl5070.h */ 0x0000c370 + #define TU102_DISP /* cl5070.h */ 0x0000c570 + ++#define GV100_DISP_CAPS 0x0000c373 ++ + #define NV31_MPEG 0x00003174 + #define G82_MPEG 0x00008274 + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +index 0d584d0da59c..f7af648e0c17 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +@@ -74,6 +74,8 @@ nvkm-y += nvkm/engine/disp/rootgp102.o + nvkm-y += nvkm/engine/disp/rootgv100.o + nvkm-y += nvkm/engine/disp/roottu102.o + ++nvkm-y += nvkm/engine/disp/capsgv100.o ++ + nvkm-y += nvkm/engine/disp/channv50.o + nvkm-y += nvkm/engine/disp/changf119.o + nvkm-y += nvkm/engine/disp/changv100.o +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/capsgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/capsgv100.c +new file mode 100644 +index 000000000000..5026e530f4bb +--- /dev/null ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/capsgv100.c +@@ -0,0 +1,60 @@ ++/* ++ * Copyright 2020 Red Hat Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++#define gv100_disp_caps(p) container_of((p), struct gv100_disp_caps, object) ++#include "rootnv50.h" ++ ++struct gv100_disp_caps { ++ struct nvkm_object object; ++ struct nv50_disp *disp; ++}; ++ ++static int ++gv100_disp_caps_map(struct nvkm_object *object, void *argv, u32 argc, ++ enum nvkm_object_map *type, u64 *addr, u64 *size) ++{ ++ struct gv100_disp_caps *caps = gv100_disp_caps(object); ++ struct nvkm_device *device = caps->disp->base.engine.subdev.device; ++ *type = NVKM_OBJECT_MAP_IO; ++ *addr = 0x640000 + device->func->resource_addr(device, 0); ++ *size = 0x1000; ++ return 0; ++} ++ ++static const struct nvkm_object_func ++gv100_disp_caps = { ++ .map = gv100_disp_caps_map, ++}; ++ ++int ++gv100_disp_caps_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, ++ struct nv50_disp *disp, struct nvkm_object **pobject) ++{ ++ struct gv100_disp_caps *caps; ++ ++ if (!(caps = kzalloc(sizeof(*caps), GFP_KERNEL))) ++ return -ENOMEM; ++ *pobject = &caps->object; ++ ++ nvkm_object_ctor(&gv100_disp_caps, oclass, &caps->object); ++ caps->disp = disp; ++ return 0; ++} +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgv100.c +index 9c658d632d37..47efb48d769a 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgv100.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgv100.c +@@ -27,6 +27,7 @@ + static const struct nv50_disp_root_func + gv100_disp_root = { + .user = { ++ {{-1,-1,GV100_DISP_CAPS }, gv100_disp_caps_new }, + {{0,0,GV100_DISP_CURSOR }, gv100_disp_curs_new }, + {{0,0,GV100_DISP_WINDOW_IMM_CHANNEL_DMA}, gv100_disp_wimm_new }, + {{0,0,GV100_DISP_CORE_CHANNEL_DMA }, gv100_disp_core_new }, +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h +index a1f942793f98..7070f5408d92 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h +@@ -24,6 +24,9 @@ int nv50_disp_root_new_(const struct nv50_disp_root_func *, struct nvkm_disp *, + const struct nvkm_oclass *, void *data, u32 size, + struct nvkm_object **); + ++int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32, ++ struct nv50_disp *, struct nvkm_object **); ++ + extern const struct nvkm_disp_oclass nv50_disp_root_oclass; + extern const struct nvkm_disp_oclass g84_disp_root_oclass; + extern const struct nvkm_disp_oclass g94_disp_root_oclass; +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/roottu102.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/roottu102.c +index 579a5d02308a..d8719d38b98a 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/roottu102.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/roottu102.c +@@ -27,6 +27,7 @@ + static const struct nv50_disp_root_func + tu102_disp_root = { + .user = { ++ {{-1,-1,GV100_DISP_CAPS }, gv100_disp_caps_new }, + {{0,0,TU102_DISP_CURSOR }, gv100_disp_curs_new }, + {{0,0,TU102_DISP_WINDOW_IMM_CHANNEL_DMA}, gv100_disp_wimm_new }, + {{0,0,TU102_DISP_CORE_CHANNEL_DMA }, gv100_disp_core_new }, +-- +2.26.2 + diff --git a/SOURCES/0001-disp-hda-gf119-add-HAL-for-programming-device-entry-.patch b/SOURCES/0001-disp-hda-gf119-add-HAL-for-programming-device-entry-.patch new file mode 100644 index 0000000..cba6699 --- /dev/null +++ b/SOURCES/0001-disp-hda-gf119-add-HAL-for-programming-device-entry-.patch @@ -0,0 +1,146 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Wed, 6 May 2020 14:40:56 +1000 +Subject: [PATCH] disp/hda/gf119-: add HAL for programming device entry in SF + +Register has moved on GV100. + +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c | 11 +++++++++-- + drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h | 2 ++ + drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c | 1 + + drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c | 1 + + drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c | 1 + + drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c | 1 + + drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c | 1 + + drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c | 1 + + 8 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +index 1080ba6ecd64..8a0ec7db5145 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +@@ -23,6 +23,14 @@ + */ + #include "ior.h" + ++void ++gf119_hda_device_entry(struct nvkm_ior *ior, int head) ++{ ++ struct nvkm_device *device = ior->disp->engine.subdev.device; ++ const u32 hoff = 0x800 * head; ++ nvkm_mask(device, 0x616548 + hoff, 0x00000070, 0x00000000); ++} ++ + void + gf119_hda_eld(struct nvkm_ior *ior, int head, u8 *data, u8 size) + { +@@ -41,11 +49,10 @@ void + gf119_hda_hpd(struct nvkm_ior *ior, int head, bool present) + { + struct nvkm_device *device = ior->disp->engine.subdev.device; +- const u32 hoff = 0x800 * head; + u32 data = 0x80000000; + u32 mask = 0x80000001; + if (present) { +- nvkm_mask(device, 0x616548 + hoff, 0x00000070, 0x00000000); ++ ior->func->hda.device_entry(ior, head); + data |= 0x00000001; + } else { + mask |= 0x00000002; +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +index c60acf71831e..eb1155e47ecd 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +@@ -88,6 +88,7 @@ struct nvkm_ior_func { + struct { + void (*hpd)(struct nvkm_ior *, int head, bool present); + void (*eld)(struct nvkm_ior *, int head, u8 *data, u8 size); ++ void (*device_entry)(struct nvkm_ior *, int head); + } hda; + }; + +@@ -162,6 +163,7 @@ void gt215_hda_eld(struct nvkm_ior *, int, u8 *, u8); + + void gf119_hda_hpd(struct nvkm_ior *, int, bool); + void gf119_hda_eld(struct nvkm_ior *, int, u8 *, u8); ++void gf119_hda_device_entry(struct nvkm_ior *, int); + + #define IOR_MSG(i,l,f,a...) do { \ + struct nvkm_ior *_ior = (i); \ +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c +index 456a5a143522..3b3643fb1019 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c +@@ -177,6 +177,7 @@ gf119_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, ++ .device_entry = gf119_hda_device_entry, + }, + }; + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c +index b94090edaebf..0c0925680790 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c +@@ -43,6 +43,7 @@ gk104_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, ++ .device_entry = gf119_hda_device_entry, + }, + }; + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c +index e6965dec09c9..38045c92197f 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c +@@ -57,6 +57,7 @@ gm107_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, ++ .device_entry = gf119_hda_device_entry, + }, + }; + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c +index 384f82652bec..cf2075db742a 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c +@@ -115,6 +115,7 @@ gm200_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, ++ .device_entry = gf119_hda_device_entry, + }, + }; + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c +index b0597ff9a714..565cfbc65550 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c +@@ -103,6 +103,7 @@ gv100_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, ++ .device_entry = gf119_hda_device_entry, + }, + }; + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c +index 4d5f3791ea7b..b16ecea098c7 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c +@@ -88,6 +88,7 @@ tu102_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, ++ .device_entry = gf119_hda_device_entry, + }, + }; + +-- +2.26.2 + diff --git a/SOURCES/0001-disp-hda-gf119-select-HDA-device-entry-based-on-boun.patch b/SOURCES/0001-disp-hda-gf119-select-HDA-device-entry-based-on-boun.patch new file mode 100644 index 0000000..714d1a0 --- /dev/null +++ b/SOURCES/0001-disp-hda-gf119-select-HDA-device-entry-based-on-boun.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Wed, 6 May 2020 14:40:58 +1000 +Subject: [PATCH] disp/hda/gf119-: select HDA device entry based on bound head + +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +index 8a0ec7db5145..19d2d58344e4 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +@@ -28,14 +28,14 @@ gf119_hda_device_entry(struct nvkm_ior *ior, int head) + { + struct nvkm_device *device = ior->disp->engine.subdev.device; + const u32 hoff = 0x800 * head; +- nvkm_mask(device, 0x616548 + hoff, 0x00000070, 0x00000000); ++ nvkm_mask(device, 0x616548 + hoff, 0x00000070, head << 4); + } + + void + gf119_hda_eld(struct nvkm_ior *ior, int head, u8 *data, u8 size) + { + struct nvkm_device *device = ior->disp->engine.subdev.device; +- const u32 soff = 0x030 * ior->id; ++ const u32 soff = 0x030 * ior->id + (head * 0x04); + int i; + + for (i = 0; i < size; i++) +@@ -49,6 +49,7 @@ void + gf119_hda_hpd(struct nvkm_ior *ior, int head, bool present) + { + struct nvkm_device *device = ior->disp->engine.subdev.device; ++ const u32 soff = 0x030 * ior->id + (head * 0x04); + u32 data = 0x80000000; + u32 mask = 0x80000001; + if (present) { +@@ -57,5 +58,5 @@ gf119_hda_hpd(struct nvkm_ior *ior, int head, bool present) + } else { + mask |= 0x00000002; + } +- nvkm_mask(device, 0x10ec10 + ior->id * 0x030, mask, data); ++ nvkm_mask(device, 0x10ec10 + soff, mask, data); + } +-- +2.26.2 + diff --git a/SOURCES/0001-disp-hda-gt215-pass-head-to-nvkm_ior.hda.eld.patch b/SOURCES/0001-disp-hda-gt215-pass-head-to-nvkm_ior.hda.eld.patch new file mode 100644 index 0000000..0011e60 --- /dev/null +++ b/SOURCES/0001-disp-hda-gt215-pass-head-to-nvkm_ior.hda.eld.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Wed, 6 May 2020 14:40:52 +1000 +Subject: [PATCH] disp/hda/gt215-: pass head to nvkm_ior.hda.eld() + +We're going to use the bound head to select HDA device entry. + +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c | 2 +- + drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c | 2 +- + drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h | 6 +++--- + drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c | 2 +- + 4 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +index 0fa0ec0a1de0..1080ba6ecd64 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +@@ -24,7 +24,7 @@ + #include "ior.h" + + void +-gf119_hda_eld(struct nvkm_ior *ior, u8 *data, u8 size) ++gf119_hda_eld(struct nvkm_ior *ior, int head, u8 *data, u8 size) + { + struct nvkm_device *device = ior->disp->engine.subdev.device; + const u32 soff = 0x030 * ior->id; +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c +index 4509d2ba880e..0d1b81fe1093 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c +@@ -24,7 +24,7 @@ + #include "ior.h" + + void +-gt215_hda_eld(struct nvkm_ior *ior, u8 *data, u8 size) ++gt215_hda_eld(struct nvkm_ior *ior, int head, u8 *data, u8 size) + { + struct nvkm_device *device = ior->disp->engine.subdev.device; + const u32 soff = ior->id * 0x800; +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +index 009d3a8b7a50..c60acf71831e 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +@@ -87,7 +87,7 @@ struct nvkm_ior_func { + + struct { + void (*hpd)(struct nvkm_ior *, int head, bool present); +- void (*eld)(struct nvkm_ior *, u8 *data, u8 size); ++ void (*eld)(struct nvkm_ior *, int head, u8 *data, u8 size); + } hda; + }; + +@@ -158,10 +158,10 @@ void gv100_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8); + void gm200_hdmi_scdc(struct nvkm_ior *, int, u8); + + void gt215_hda_hpd(struct nvkm_ior *, int, bool); +-void gt215_hda_eld(struct nvkm_ior *, u8 *, u8); ++void gt215_hda_eld(struct nvkm_ior *, int, u8 *, u8); + + void gf119_hda_hpd(struct nvkm_ior *, int, bool); +-void gf119_hda_eld(struct nvkm_ior *, u8 *, u8); ++void gf119_hda_eld(struct nvkm_ior *, int, u8 *, u8); + + #define IOR_MSG(i,l,f,a...) do { \ + struct nvkm_ior *_ior = (i); \ +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c +index 5f758948d6e1..a7672ef17d3b 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c +@@ -155,7 +155,7 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) + if (outp->info.type == DCB_OUTPUT_DP) + ior->func->dp.audio(ior, hidx, true); + ior->func->hda.hpd(ior, hidx, true); +- ior->func->hda.eld(ior, data, size); ++ ior->func->hda.eld(ior, hidx, data, size); + } else { + if (outp->info.type == DCB_OUTPUT_DP) + ior->func->dp.audio(ior, hidx, false); +-- +2.26.2 + diff --git a/SOURCES/0001-disp-hda-gv100-NV_PDISP_SF_AUDIO_CNTRL0-register-mov.patch b/SOURCES/0001-disp-hda-gv100-NV_PDISP_SF_AUDIO_CNTRL0-register-mov.patch new file mode 100644 index 0000000..b93c9f1 --- /dev/null +++ b/SOURCES/0001-disp-hda-gv100-NV_PDISP_SF_AUDIO_CNTRL0-register-mov.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Wed, 6 May 2020 14:41:01 +1000 +Subject: [PATCH] disp/hda/gv100-: NV_PDISP_SF_AUDIO_CNTRL0 register moved + +Signed-off-by: Ben Skeggs +--- + .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild | 1 + + .../drm/nouveau/nvkm/engine/disp/hdagv100.c | 30 +++++++++++++++++++ + .../gpu/drm/nouveau/nvkm/engine/disp/ior.h | 2 ++ + .../drm/nouveau/nvkm/engine/disp/sorgv100.c | 2 +- + .../drm/nouveau/nvkm/engine/disp/sortu102.c | 2 +- + 5 files changed, 35 insertions(+), 2 deletions(-) + create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagv100.c + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +index f7af648e0c17..571687ba85b8 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +@@ -47,6 +47,7 @@ nvkm-y += nvkm/engine/disp/dp.o + + nvkm-y += nvkm/engine/disp/hdagt215.o + nvkm-y += nvkm/engine/disp/hdagf119.o ++nvkm-y += nvkm/engine/disp/hdagv100.o + + nvkm-y += nvkm/engine/disp/hdmi.o + nvkm-y += nvkm/engine/disp/hdmig84.o +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagv100.c +new file mode 100644 +index 000000000000..57d374ecfeef +--- /dev/null ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagv100.c +@@ -0,0 +1,30 @@ ++/* ++ * Copyright 2020 Red Hat Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++#include "ior.h" ++ ++void ++gv100_hda_device_entry(struct nvkm_ior *ior, int head) ++{ ++ struct nvkm_device *device = ior->disp->engine.subdev.device; ++ const u32 hoff = 0x800 * head; ++ nvkm_mask(device, 0x616528 + hoff, 0x00000070, head << 4); ++} +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +index eb1155e47ecd..c1d7a36e4d3c 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +@@ -165,6 +165,8 @@ void gf119_hda_hpd(struct nvkm_ior *, int, bool); + void gf119_hda_eld(struct nvkm_ior *, int, u8 *, u8); + void gf119_hda_device_entry(struct nvkm_ior *, int); + ++void gv100_hda_device_entry(struct nvkm_ior *, int); ++ + #define IOR_MSG(i,l,f,a...) do { \ + struct nvkm_ior *_ior = (i); \ + nvkm_##l(&_ior->disp->engine.subdev, "%s: "f"\n", _ior->name, ##a); \ +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c +index 565cfbc65550..d11a0dff10c6 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c +@@ -103,7 +103,7 @@ gv100_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, +- .device_entry = gf119_hda_device_entry, ++ .device_entry = gv100_hda_device_entry, + }, + }; + +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c +index b16ecea098c7..fa6d74251237 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sortu102.c +@@ -88,7 +88,7 @@ tu102_sor = { + .hda = { + .hpd = gf119_hda_hpd, + .eld = gf119_hda_eld, +- .device_entry = gf119_hda_device_entry, ++ .device_entry = gv100_hda_device_entry, + }, + }; + +-- +2.26.2 + diff --git a/SOURCES/0001-disp-nv50-increase-timeout-on-pio-channel-free-polli.patch b/SOURCES/0001-disp-nv50-increase-timeout-on-pio-channel-free-polli.patch new file mode 100644 index 0000000..d8c1a93 --- /dev/null +++ b/SOURCES/0001-disp-nv50-increase-timeout-on-pio-channel-free-polli.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Wed, 6 May 2020 14:40:45 +1000 +Subject: [PATCH] disp/nv50-: increase timeout on pio channel free() polling + +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c +index 8c5cf096f69b..658a200ab616 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c +@@ -32,7 +32,7 @@ + bool + curs507a_space(struct nv50_wndw *wndw) + { +- nvif_msec(&nouveau_drm(wndw->plane.dev)->client.device, 2, ++ nvif_msec(&nouveau_drm(wndw->plane.dev)->client.device, 100, + if (nvif_rd32(&wndw->wimm.base.user, 0x0008) >= 4) + return true; + ); +-- +2.26.2 + diff --git a/SOURCES/0001-drm-Use-generic-helper-to-check-_PR3-presence.patch b/SOURCES/0001-drm-Use-generic-helper-to-check-_PR3-presence.patch new file mode 100644 index 0000000..f0f9e0d --- /dev/null +++ b/SOURCES/0001-drm-Use-generic-helper-to-check-_PR3-presence.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Thu, 23 Apr 2020 14:23:58 +0800 +Subject: [PATCH] drm: Use generic helper to check _PR3 presence + +Replace nouveau_pr3_present() in favor of a more generic one, +pci_pr3_present(). + +Also the presence of upstream bridge _PR3 doesn't need to go hand in +hand with device's _DSM, so check _PR3 before _DSM. + +Signed-off-by: Kai-Heng Feng +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nouveau_acpi.c | 44 ++++++-------------------- + 1 file changed, 10 insertions(+), 34 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c +index fe3a10255c36..b84dff1b0f28 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c ++++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c +@@ -212,37 +212,6 @@ static const struct vga_switcheroo_handler nouveau_dsm_handler = { + .get_client_id = nouveau_dsm_get_client_id, + }; + +-/* +- * Firmware supporting Windows 8 or later do not use _DSM to put the device into +- * D3cold, they instead rely on disabling power resources on the parent. +- */ +-static bool nouveau_pr3_present(struct pci_dev *pdev) +-{ +- struct pci_dev *parent_pdev = pci_upstream_bridge(pdev); +- struct acpi_device *parent_adev; +- +- if (!parent_pdev) +- return false; +- +- if (!parent_pdev->bridge_d3) { +- /* +- * Parent PCI bridge is currently not power managed. +- * Since userspace can change these afterwards to be on +- * the safe side we stick with _DSM and prevent usage of +- * _PR3 from the bridge. +- */ +- pci_d3cold_disable(pdev); +- return false; +- } +- +- parent_adev = ACPI_COMPANION(&parent_pdev->dev); +- if (!parent_adev) +- return false; +- +- return parent_adev->power.flags.power_resources && +- acpi_has_method(parent_adev->handle, "_PR3"); +-} +- + static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out, + bool *has_mux, bool *has_opt, + bool *has_opt_flags, bool *has_pr3) +@@ -250,6 +219,16 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out + acpi_handle dhandle; + bool supports_mux; + int optimus_funcs; ++ struct pci_dev *parent_pdev; ++ ++ *has_pr3 = false; ++ parent_pdev = pci_upstream_bridge(pdev); ++ if (parent_pdev) { ++ if (parent_pdev->bridge_d3) ++ *has_pr3 = pci_pr3_present(parent_pdev); ++ else ++ pci_d3cold_disable(pdev); ++ } + + dhandle = ACPI_HANDLE(&pdev->dev); + if (!dhandle) +@@ -270,7 +249,6 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out + *has_mux = supports_mux; + *has_opt = !!optimus_funcs; + *has_opt_flags = optimus_funcs & (1 << NOUVEAU_DSM_OPTIMUS_FLAGS); +- *has_pr3 = false; + + if (optimus_funcs) { + uint32_t result; +@@ -280,8 +258,6 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out + (result & OPTIMUS_ENABLED) ? "enabled" : "disabled", + (result & OPTIMUS_DYNAMIC_PWR_CAP) ? "dynamic power, " : "", + (result & OPTIMUS_HDA_CODEC_MASK) ? "hda bios codec supported" : ""); +- +- *has_pr3 = nouveau_pr3_present(pdev); + } + } + +-- +2.26.2 + diff --git a/SOURCES/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch b/SOURCES/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch new file mode 100644 index 0000000..eef72a2 --- /dev/null +++ b/SOURCES/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch @@ -0,0 +1,33 @@ +From 025eb2eb927d2c3020882ea0ed3af28d65321763 Mon Sep 17 00:00:00 2001 +From: Icenowy Zheng +Date: Fri, 26 Jun 2020 02:55:49 +0200 +Subject: [PATCH 01/13] dt-bindings: vendor-prefixes: Add Xingbangda + +Shenzhen Xingbangda Display Technology Co., Ltd is a company which +produces LCD modules. It supplies the LCD panels for the PinePhone. + +Add the vendor prefix of it. + +Signed-off-by: Icenowy Zheng +Signed-off-by: Ondrej Jirman +Acked-by: Rob Herring +--- + Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml +index d3891386d6710..a558ef87ee5b0 100644 +--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml ++++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml +@@ -1121,6 +1121,8 @@ patternProperties: + description: Xiaomi Technology Co., Ltd. + "^xillybus,.*": + description: Xillybus Ltd. ++ "^xingbangda,.*": ++ description: Shenzhen Xingbangda Display Technology Co., Ltd + "^xinpeng,.*": + description: Shenzhen Xinpeng Technology Co., Ltd + "^xlnx,.*": +-- +2.26.2 + diff --git a/SOURCES/0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch b/SOURCES/0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch new file mode 100644 index 0000000..8e740ce --- /dev/null +++ b/SOURCES/0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aaron Ma +Date: Tue, 24 Mar 2020 03:16:39 +0800 +Subject: [PATCH] e1000e: bump up timeout to wait when ME un-configure ULP mode + +ME takes 2+ seconds to un-configure ULP mode done after resume +from s2idle on some ThinkPad laptops. +Without enough wait, reset and re-init will fail with error. + +Fixes: f15bb6dde738cc8fa0 ("e1000e: Add support for S0ix") +BugLink: https://bugs.launchpad.net/bugs/1865570 +Signed-off-by: Aaron Ma +--- + drivers/net/ethernet/intel/e1000e/ich8lan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c +index 735bf25952fc..15f6c0a4dc63 100644 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c +@@ -1243,9 +1243,9 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) + ew32(H2ME, mac_reg); + } + +- /* Poll up to 300msec for ME to clear ULP_CFG_DONE. */ ++ /* Poll up to 2.5sec for ME to clear ULP_CFG_DONE. */ + while (er32(FWSM) & E1000_FWSM_ULP_CFG_DONE) { +- if (i++ == 30) { ++ if (i++ == 250) { + ret_val = -E1000_ERR_PHY; + goto out; + } +-- +2.26.2 + diff --git a/SOURCES/0001-efi-Add-an-EFI_SECURE_BOOT-flag-to-indicate-secure-b.patch b/SOURCES/0001-efi-Add-an-EFI_SECURE_BOOT-flag-to-indicate-secure-b.patch new file mode 100644 index 0000000..acd11a2 --- /dev/null +++ b/SOURCES/0001-efi-Add-an-EFI_SECURE_BOOT-flag-to-indicate-secure-b.patch @@ -0,0 +1,161 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Tue, 27 Feb 2018 10:04:55 +0000 +Subject: [PATCH] efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode + +UEFI machines can be booted in Secure Boot mode. Add an EFI_SECURE_BOOT +flag that can be passed to efi_enabled() to find out whether secure boot is +enabled. + +Move the switch-statement in x86's setup_arch() that inteprets the +secure_boot boot parameter to generic code and set the bit there. + +Upstream Status: RHEL only +Suggested-by: Ard Biesheuvel +Signed-off-by: David Howells +Reviewed-by: Ard Biesheuvel +cc: linux-efi@vger.kernel.org +[Rebased for context; efi_is_table_address was moved to arch/x86] +Signed-off-by: Jeremy Cline +--- + arch/x86/kernel/setup.c | 14 +----------- + drivers/firmware/efi/Makefile | 1 + + drivers/firmware/efi/secureboot.c | 38 +++++++++++++++++++++++++++++++ + include/linux/efi.h | 18 ++++++++++----- + 4 files changed, 52 insertions(+), 19 deletions(-) + create mode 100644 drivers/firmware/efi/secureboot.c + +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c +index e39ec0f88d28..08e9f5fc26a8 100644 +--- a/arch/x86/kernel/setup.c ++++ b/arch/x86/kernel/setup.c +@@ -1250,19 +1250,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/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile +index 7a216984552b..f0ef02d733af 100644 +--- a/drivers/firmware/efi/Makefile ++++ b/drivers/firmware/efi/Makefile +@@ -25,6 +25,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 ++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/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/include/linux/efi.h b/include/linux/efi.h +index 51503bf118ab..b35e693f20f3 100644 +--- a/include/linux/efi.h ++++ b/include/linux/efi.h +@@ -778,6 +778,14 @@ extern int __init efi_setup_pcdp_console(char *); + #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 + /* +@@ -789,6 +797,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) +@@ -815,6 +825,8 @@ efi_capsule_pending(int *reset_type) + return false; + } + ++static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {} ++ + static inline bool efi_soft_reserve_enabled(void) + { + return false; +@@ -1086,12 +1098,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); + +-enum efi_secureboot_mode { +- efi_secureboot_mode_unset, +- efi_secureboot_mode_unknown, +- efi_secureboot_mode_disabled, +- efi_secureboot_mode_enabled, +-}; + enum efi_secureboot_mode efi_get_secureboot(void); + + #ifdef CONFIG_RESET_ATTACK_MITIGATION +-- +2.26.2 + diff --git a/SOURCES/0001-efi-Lock-down-the-kernel-if-booted-in-secure-boot-mo.patch b/SOURCES/0001-efi-Lock-down-the-kernel-if-booted-in-secure-boot-mo.patch new file mode 100644 index 0000000..97096ad --- /dev/null +++ b/SOURCES/0001-efi-Lock-down-the-kernel-if-booted-in-secure-boot-mo.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Mon, 30 Sep 2019 21:28:16 +0000 +Subject: [PATCH] efi: Lock down the kernel if booted in secure boot mode + +UEFI Secure Boot provides a mechanism for ensuring that the firmware +will only load signed bootloaders and kernels. Certain use cases may +also require that all kernel modules also be signed. Add a +configuration option that to lock down the kernel - which includes +requiring validly signed modules - if the kernel is secure-booted. + +Upstream Status: RHEL only +Signed-off-by: David Howells +Signed-off-by: Jeremy Cline +--- + arch/x86/kernel/setup.c | 8 ++++++++ + security/lockdown/Kconfig | 13 +++++++++++++ + 2 files changed, 21 insertions(+) + +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c +index 08e9f5fc26a8..b6f5510f3d91 100644 +--- a/arch/x86/kernel/setup.c ++++ b/arch/x86/kernel/setup.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -1099,6 +1100,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 ++ + dmi_setup(); + + /* +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 +-- +2.26.2 + diff --git a/SOURCES/0001-firmware-raspberrypi-Introduce-vl805-init-routine.patch b/SOURCES/0001-firmware-raspberrypi-Introduce-vl805-init-routine.patch new file mode 100644 index 0000000..db8a4a1 --- /dev/null +++ b/SOURCES/0001-firmware-raspberrypi-Introduce-vl805-init-routine.patch @@ -0,0 +1,110 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Tue, 10 Mar 2020 13:52:40 +0100 +Subject: [PATCH] firmware: raspberrypi: Introduce vl805 init routine + +On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be +loaded directly from an EEPROM or, if not present, by the SoC's +VideCore. The function informs VideCore that VL805 was just reset, or +requests for a probe defer. + +Based on Tim Gover's downstream implementation. + +Signed-off-by: Nicolas Saenz Julienne +Reviewed-by: Florian Fainelli +--- + drivers/firmware/raspberrypi.c | 38 ++++++++++++++++++++++ + include/soc/bcm2835/raspberrypi-firmware.h | 7 ++++ + 2 files changed, 45 insertions(+) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index da26a584dca0..cbb495aff6a0 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +@@ -286,6 +287,43 @@ struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + } + EXPORT_SYMBOL_GPL(rpi_firmware_get); + ++/* ++ * On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be ++ * loaded directly from an EEPROM or, if not present, by the SoC's VideCore. ++ * Inform VideCore that VL805 was just reset, or defer xhci's probe if not yet ++ * joinable trough the mailbox interface. ++ */ ++int rpi_firmware_init_vl805(struct pci_dev *pdev) ++{ ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ u32 dev_addr; ++ int ret; ++ ++ fw_np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++ if (!fw_np) ++ return 0; ++ ++ fw = rpi_firmware_get(fw_np); ++ of_node_put(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ dev_addr = pdev->bus->number << 20 | PCI_SLOT(pdev->devfn) << 15 | ++ PCI_FUNC(pdev->devfn) << 12; ++ ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_NOTIFY_XHCI_RESET, ++ &dev_addr, sizeof(dev_addr)); ++ if (ret) ++ return ret; ++ ++ dev_dbg(&pdev->dev, "loaded Raspberry Pi's VL805 firmware\n"); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(rpi_firmware_init_vl805); ++ + static const struct of_device_id rpi_firmware_of_match[] = { + { .compatible = "raspberrypi,bcm2835-firmware", }, + {}, +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index cc9cdbc66403..3025aca3c358 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -10,6 +10,7 @@ + #include + + struct rpi_firmware; ++struct pci_dev; + + enum rpi_firmware_property_status { + RPI_FIRMWARE_STATUS_REQUEST = 0, +@@ -141,6 +142,7 @@ int rpi_firmware_property(struct rpi_firmware *fw, + int rpi_firmware_property_list(struct rpi_firmware *fw, + void *data, size_t tag_size); + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); ++int rpi_firmware_init_vl805(struct pci_dev *pdev); + #else + static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, + void *data, size_t len) +@@ -158,6 +160,11 @@ static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware + { + return NULL; + } ++ ++static inline int rpi_firmware_init_vl805(struct pci_dev *pdev) ++{ ++ return 0; ++} + #endif + + #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ +-- +2.26.2 + diff --git a/SOURCES/0001-iommu-arm-smmu-workaround-DMA-mode-issues.patch b/SOURCES/0001-iommu-arm-smmu-workaround-DMA-mode-issues.patch new file mode 100644 index 0000000..e6eef22 --- /dev/null +++ b/SOURCES/0001-iommu-arm-smmu-workaround-DMA-mode-issues.patch @@ -0,0 +1,98 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Laura Abbott +Date: Mon, 20 May 2019 22:21:02 -0400 +Subject: [PATCH] iommu/arm-smmu: workaround DMA mode issues + +Message-id: <20190520222102.19488-1-labbott@redhat.com> +Patchwork-id: 259215 +O-Subject: [ARK INTERNAL PATCH] iommu/arm-smmu: workaround DMA mode issues +Bugzilla: +RH-Acked-by: Mark Langsdorf +RH-Acked-by: Mark Salter + +From: Mark Salter + +Rebased for v5.2-rc1 + + Bugzilla: 1652259 + Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19244562 + Upstream status: RHEL only. + + rhel8 commit 65feb1ed0ec9a088a63a90d46c0f7563ac96ad0f + Author: Mark Salter + Date: Wed Nov 21 17:15:59 2018 +0100 + + [iommu] iommu/arm-smmu: workaround DMA mode issues + + Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1624077 + Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18112820 + Testing: Verified iommu.passthrough=1 no longer needed on gigabyte platforms. + Upstream Status: RHEL-only + + In RHEL_ALT 7.5 we carried a RHEL-only patch which forced the arm smmuv2 + into bypass mode due to performance issues on CN88xx. This was intended + to be a temporary hack until the issues were resolved. Another vendor + had issues with the iommu in bypass mode so we reverted the RHEL-only + patch so that iommu is in DMA mode by default (upstream default). + + It turns on that there are remaining SMMU DMA mode issues on Gigabyte + platformws with CN88xx cpus. The problem manifests itself by pcie + card drivers failing to initialize the cards when SMMU is in DMA mode. + The root cause has not been determined yet, but looks likely to be + a hw or firmware issue. This patch forces bypass mode for Gigabyte + platforms. CN88xx isn't officially supported in RHEL but we have a + lot of them being used internally for testing, so I think we want + this to support that use case in RHEL8. + + Signed-off-by: Mark Salter + Signed-off-by: Herton R. Krzesinski + + Acked-by: Mark Salter + Acked-by: Donald Dutile + +Upstream Status: RHEL only +Signed-off-by: Laura Abbott +--- + drivers/iommu/iommu.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index 03d6a26687bc..86981f228c90 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -7,6 +7,7 @@ + #define pr_fmt(fmt) "iommu: " fmt + + #include ++#include + #include + #include + #include +@@ -2664,3 +2665,24 @@ int iommu_sva_get_pasid(struct iommu_sva *handle) + return ops->sva_get_pasid(handle); + } + EXPORT_SYMBOL_GPL(iommu_sva_get_pasid); ++ ++#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 +-- +2.26.2 + diff --git a/SOURCES/0001-ipmi-do-not-configure-ipmi-for-HPE-m400.patch b/SOURCES/0001-ipmi-do-not-configure-ipmi-for-HPE-m400.patch new file mode 100644 index 0000000..aad7ef0 --- /dev/null +++ b/SOURCES/0001-ipmi-do-not-configure-ipmi-for-HPE-m400.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Laura Abbott +Date: Sun, 10 Feb 2019 01:27:54 +0000 +Subject: [PATCH] ipmi: do not configure ipmi for HPE m400 + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1670017 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=20147017 + +Commit 913a89f009d9 ("ipmi: Don't initialize anything in the core until +something uses it") added new locking which broke context. + + Message-id: <20180713142210.15700-1-tcamuso@redhat.com> + Patchwork-id: 224899 + O-Subject: [RHEL8 BZ 1583537 1/1] ipmi: do not configure ipmi for HPE m400 + Bugzilla: 1583537 + RH-Acked-by: Dean Nelson + RH-Acked-by: Al Stone + RH-Acked-by: Mark Salter + + bugzilla:https://bugzilla.redhat.com/show_bug.cgi?id=1583537 + brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=17150528 + + RHEL-only + + The ARM-based HPE m400 reports host-side ipmi as residing in intel + port-io space, which does not exist in ARM processors. Therefore, when + running on an m400, host-side ipmi configuration code must simply return + zero without trying to configure the host-side ipmi. + + This patch prevents panic on boot by averting attempts to configure + host-side ipmi on this platform. + + Though HPE m400 is not certified with RHEL, and HPE has relegated it to + EOL status, the platform is still used extensively in ARM development + and test for RHEL. + + Testing: + Boot without blacklisting ipmi and check to see that no ipmi modules + are loaded. + + Signed-off-by: Tony Camuso + + cc: Prarit Bhargava + cc: Brendan Conoboy + cc: Jeff Bastian + cc: Scott Herold + Signed-off-by: Herton R. Krzesinski + +Upstream Status: RHEL only +Signed-off-by: Laura Abbott +Acked-by: Tony Camuso +Acked-by: Dean Nelson +Acked-by: Jarod Wilson +Acked-by: Mark Salter +--- + drivers/char/ipmi/ipmi_dmi.c | 15 +++++++++++++++ + drivers/char/ipmi/ipmi_msghandler.c | 16 +++++++++++++++- + 2 files changed, 30 insertions(+), 1 deletion(-) + +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 c48d8f086382..0fc980a87ed0 100644 +--- a/drivers/char/ipmi/ipmi_msghandler.c ++++ b/drivers/char/ipmi/ipmi_msghandler.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #define IPMI_DRIVER_VERSION "39.2" + +@@ -5154,8 +5155,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); +-- +2.26.2 + diff --git a/SOURCES/0001-kdump-add-support-for-crashkernel-auto.patch b/SOURCES/0001-kdump-add-support-for-crashkernel-auto.patch new file mode 100644 index 0000000..83eb38e --- /dev/null +++ b/SOURCES/0001-kdump-add-support-for-crashkernel-auto.patch @@ -0,0 +1,189 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Tue, 23 Jul 2019 15:24:30 +0000 +Subject: [PATCH] kdump: add support for crashkernel=auto + +Rebased for v5.3-rc1 because the documentation has moved. + + Message-id: <20180604013831.574215750@redhat.com> + Patchwork-id: 8166 + O-Subject: [kernel team] [PATCH RHEL8.0 V2 2/2] kdump: add support for crashkernel=auto + Bugzilla: 1507353 + RH-Acked-by: Don Zickus + RH-Acked-by: Baoquan He + RH-Acked-by: Pingfan Liu + + Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1507353 + Build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16534135 + Tested: ppc64le, x86_64 with several memory sizes. + kdump qe tested 160M on various x86 machines in lab. + + We continue to provide crashkernel=auto like we did in RHEL6 + and RHEL7, this will simplify the kdump deployment for common + use cases that kdump just works with the auto reserved values. + But this is still a best effort estimation, we can not know the + exact memory requirement because it depends on a lot of different + factors. + + The implementation of crashkernel=auto is simplified as a wrapper + to use below kernel cmdline: + x86_64: crashkernel=1G-64G:160M,64G-1T:256M,1T-:512M + s390x: crashkernel=4G-64G:160M,64G-1T:256M,1T-:512M + arm64: crashkernel=2G-:512M + ppc64: crashkernel=2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G + + The difference between this way and the old implementation in + RHEL6/7 is we do not scale the crash reserved memory size according + to system memory size anymore. + + Latest effort to move upstream is below thread: + https://lkml.org/lkml/2018/5/20/262 + But unfortunately it is still unlikely to be accepted, thus we + will still use a RHEL only patch in RHEL8. + + Copied old patch description about the history reason see below: + ''' + Non-upstream explanations: + Besides "crashkenrel=X@Y" format, upstream also has advanced + "crashkernel=range1:size1[,range2:size2,...][@offset]", and + "crashkernel=X,high{low}" formats, but they need more careful + manual configuration, and have different values for different + architectures. + + Most of the distributions use the standard "crashkernel=X@Y" + upstream format, and use crashkernel range format for advanced + scenarios, heavily relying on the user's involvement. + + While "crashkernel=auto" is redhat's special feature, it exists + and has been used as the default boot cmdline since 2008 rhel6. + It does not require users to figure out how many crash memory + size for their systems, also has been proved to be able to work + pretty well for common scenarios. + + "crashkernel=auto" was tested/based on rhel-related products, as + we have stable kernel configurations which means more or less + stable memory consumption. In 2014 we tried to post them again to + upstream but NACKed by people because they think it's not general + and unnecessary, users can specify their own values or do that by + scripts. However our customers insist on having it added to rhel. + + Also see one previous discussion related to this backport to Pegas: + On 10/17/2016 at 10:15 PM, Don Zickus wrote: + > On Fri, Oct 14, 2016 at 10:57:41AM +0800, Dave Young wrote: + >> Don, agree with you we should evaluate them instead of just inherit + >> them blindly. Below is what I think about kdump auto memory: + >> There are two issues for crashkernel=auto in upstream: + >> 1) It will be seen as a policy which should not go to kernel + >> 2) It is hard to get a good number for the crash reserved size, + >> considering various different kernel config options one can setups. + >> In RHEL we are easier because our supported Kconfig is limited. + >> I digged the upstream mail archive, but I'm not sure I got all the + >> information, at least Michael Ellerman was objecting the series for + >> 1). + > Yes, I know. Vivek and I have argued about this for years. :-) + > + > I had hoped all the changes internally to the makedumpfile would allow + > the memory configuration to stabilize at a number like 192M or 128M and + > only in the rare cases extend beyond that. + > + > So I always treated that as a temporary hack until things were better. + > With the hope of every new RHEL release we get smarter and better. :-) + > Ideally it would be great if we could get the number down to 64M for most + > cases and just turn it on in Fedora. Maybe someday.... ;-) + > + > We can have this conversation when the patch gets reposted/refreshed + > for upstream on rhkl? + > + > Cheers, + > Don + + We had proposed to drop the historic crashkernel=auto code and move + to use crashkernel=range:size format and pass them in anaconda. + + The initial reason is crashkernel=range:size works just fine because + we do not need complex algorithm to scale crashkernel reserved size + any more. The old linear scaling is mainly for old makedumpfile + requirements, now it is not necessary. + + But With the new approach, backward compatibility is potentially at risk. + For e.g. let's consider the following cases: + 1) When we upgrade from an older distribution like rhel-alt-7.4(which + uses crashkernel=auto) to rhel-alt-7.5 (which uses the crashkernel=xY + format) + In this case we can use anaconda scripts for checking + 'crashkernel=auto' in kernel spec and update to the new + 'crashkernel=range:size' format. + 2) When we upgrade from rhel-alt-7.5(which uses crashkernel=xY format) + to rhel-alt-7.6(which uses crashkernel=xY format), but the x and/or Y + values are changed in rhel-alt-7.6. + For example from crashkernel=2G-:160M to crashkernel=2G-:192M, then we have + no way to determine if the X and/or Y values were distribution + provided or user specified ones. + Since it is recommended to give precedence to user-specified values, + so we cannot do an upgrade in such a case." + + Thus turn back to resolve it in kernel, and add a simpler version + which just hacks to use the range:size style in code, and make + rhel-only code easily to maintain. + ''' + + Signed-off-by: Dave Young + Signed-off-by: Herton R. Krzesinski + +Upstream Status: RHEL only +Signed-off-by: Jeremy Cline +--- + Documentation/admin-guide/kdump/kdump.rst | 11 +++++++++++ + kernel/crash_core.c | 14 ++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst +index ac7e131d2935..3b3bf30e537d 100644 +--- a/Documentation/admin-guide/kdump/kdump.rst ++++ b/Documentation/admin-guide/kdump/kdump.rst +@@ -285,6 +285,17 @@ This would mean: + 2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M + 3) if the RAM size is larger than 2G, then reserve 128M + ++Or you can use crashkernel=auto if you have enough memory. The threshold ++is 2G on x86_64, arm64, ppc64 and ppc64le. The threshold is 4G for s390x. ++If your system memory is less than the threshold crashkernel=auto will not ++reserve memory. ++ ++The automatically reserved memory size varies based on architecture. ++The size changes according to system memory size like below: ++ x86_64: 1G-64G:160M,64G-1T:256M,1T-:512M ++ s390x: 4G-64G:160M,64G-1T:256M,1T-:512M ++ arm64: 2G-:512M ++ ppc64: 2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G + + + Boot into System Kernel +diff --git a/kernel/crash_core.c b/kernel/crash_core.c +index d631d22089ba..c252221b2f4b 100644 +--- a/kernel/crash_core.c ++++ b/kernel/crash_core.c +@@ -258,6 +258,20 @@ static int __init __parse_crashkernel(char *cmdline, + if (suffix) + return parse_crashkernel_suffix(ck_cmdline, crash_size, + suffix); ++ ++ if (strncmp(ck_cmdline, "auto", 4) == 0) { ++#ifdef CONFIG_X86_64 ++ ck_cmdline = "1G-64G:160M,64G-1T:256M,1T-:512M"; ++#elif defined(CONFIG_S390) ++ ck_cmdline = "4G-64G:160M,64G-1T:256M,1T-:512M"; ++#elif defined(CONFIG_ARM64) ++ ck_cmdline = "2G-:512M"; ++#elif defined(CONFIG_PPC64) ++ ck_cmdline = "2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"; ++#endif ++ pr_info("Using crashkernel=auto, the size choosed is a best effort estimation.\n"); ++ } ++ + /* + * if the commandline contains a ':', then that's the extended + * syntax -- if not, it must be the classic syntax +-- +2.26.2 + diff --git a/SOURCES/0001-kdump-fix-a-grammar-issue-in-a-kernel-message.patch b/SOURCES/0001-kdump-fix-a-grammar-issue-in-a-kernel-message.patch new file mode 100644 index 0000000..5444af2 --- /dev/null +++ b/SOURCES/0001-kdump-fix-a-grammar-issue-in-a-kernel-message.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dave Young +Date: Tue, 12 Jun 2018 00:54:22 -0400 +Subject: [PATCH] kdump: fix a grammar issue in a kernel message + +Message-id: <20180612005422.GA2568@dhcp-128-65.nay.redhat.com> +Patchwork-id: 8201 +O-Subject: [kernel team] [RHEL8.0 PATCH V2] kdump: fix a grammar issue in a kernel message +Bugzilla: 1507353 +RH-Acked-by: Myron Stowe +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Jiri Benc + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1507353 +Upstream Status: RHEL-only as crashkernel=auto is not accepted in upstream +Build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16661950 +Test: verified on a kvm guest + +s/choosed/chosen + +Upstream Status: RHEL only +Signed-off-by: Dave Young +Signed-off-by: Herton R. Krzesinski +--- + kernel/crash_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/crash_core.c b/kernel/crash_core.c +index c252221b2f4b..df551fc9034c 100644 +--- a/kernel/crash_core.c ++++ b/kernel/crash_core.c +@@ -269,7 +269,7 @@ static int __init __parse_crashkernel(char *cmdline, + #elif defined(CONFIG_PPC64) + ck_cmdline = "2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"; + #endif +- pr_info("Using crashkernel=auto, the size choosed is a best effort estimation.\n"); ++ pr_info("Using crashkernel=auto, the size chosen is a best effort estimation.\n"); + } + + /* +-- +2.26.2 + diff --git a/SOURCES/0001-kdump-round-up-the-total-memory-size-to-128M-for-cra.patch b/SOURCES/0001-kdump-round-up-the-total-memory-size-to-128M-for-cra.patch new file mode 100644 index 0000000..26576a0 --- /dev/null +++ b/SOURCES/0001-kdump-round-up-the-total-memory-size-to-128M-for-cra.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dave Young +Date: Mon, 4 Jun 2018 01:38:25 -0400 +Subject: [PATCH] kdump: round up the total memory size to 128M for crashkernel + reservation + +Message-id: <20180604013831.523644967@redhat.com> +Patchwork-id: 8165 +O-Subject: [kernel team] [PATCH RHEL8.0 V2 1/2] kdump: round up the total memory size to 128M for crashkernel reservation +Bugzilla: 1507353 +RH-Acked-by: Don Zickus +RH-Acked-by: Baoquan He +RH-Acked-by: Pingfan Liu + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1507353 +Build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16534135 +Tested: ppc64le, x86_64 with several memory sizes. + +The total memory size we get in kernel is usually slightly less than 2G with +2G memory module machine. The main reason is bios/firmware reserve some area +it will not export all memory as usable to Linux. + +2G memory X86 kvm guest test result of the total_mem value: +UEFI boot with ovmf: 0x7ef10000 +Legacy boot kvm guest: 0x7ff7cc00 +This is also a problem on arm64 UEFI booted system according to my test. + +Thus for example crashkernel=1G-2G:128M, if we have a 1G memory +machine, we get total size 1023M from firmware then it will not fall +into 1G-2G thus no memory reserved. User will never know that, it is +hard to let user to know the exact total value we get in kernel + +An option is to use dmi/smbios to get physical memory size, but it's not +reliable as well. According to Prarit hardware vendors sometimes screw this up. +Thus round up total size to 128M to workaround this problem. + +Posted below patch in upstream, but no response yet: +http://lists.infradead.org/pipermail/kexec/2018-April/020568.html + +Upstream Status: RHEL only +Signed-off-by: Dave Young +Signed-off-by: Herton R. Krzesinski +--- + kernel/crash_core.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/kernel/crash_core.c b/kernel/crash_core.c +index 9f1557b98468..d631d22089ba 100644 +--- a/kernel/crash_core.c ++++ b/kernel/crash_core.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -39,6 +40,15 @@ static int __init parse_crashkernel_mem(char *cmdline, + unsigned long long *crash_base) + { + char *cur = cmdline, *tmp; ++ unsigned long long total_mem = system_ram; ++ ++ /* ++ * Firmware sometimes reserves some memory regions for it's own use. ++ * so we get less than actual system memory size. ++ * Workaround this by round up the total size to 128M which is ++ * enough for most test cases. ++ */ ++ total_mem = roundup(total_mem, SZ_128M); + + /* for each entry of the comma-separated list */ + do { +@@ -83,13 +93,13 @@ static int __init parse_crashkernel_mem(char *cmdline, + return -EINVAL; + } + cur = tmp; +- if (size >= system_ram) { ++ if (size >= total_mem) { + pr_warn("crashkernel: invalid size\n"); + return -EINVAL; + } + + /* match ? */ +- if (system_ram >= start && system_ram < end) { ++ if (total_mem >= start && total_mem < end) { + *crash_size = size; + break; + } +-- +2.26.2 + diff --git a/SOURCES/0001-kms-gv100-Add-support-for-interlaced-modes.patch b/SOURCES/0001-kms-gv100-Add-support-for-interlaced-modes.patch new file mode 100644 index 0000000..c50c826 --- /dev/null +++ b/SOURCES/0001-kms-gv100-Add-support-for-interlaced-modes.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Mon, 11 May 2020 18:41:25 -0400 +Subject: [PATCH] kms/gv100-: Add support for interlaced modes + +We advertise being able to set interlaced modes, so let's actually make +sure to do that. Otherwise, we'll end up hanging the display engine due +to trying to set a mode with timings adjusted for interlacing without +telling the hardware it's actually an interlaced mode. + +Signed-off-by: Lyude Paul +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/dispnv50/headc37d.c | 5 +++-- + drivers/gpu/drm/nouveau/dispnv50/headc57d.c | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/dispnv50/headc37d.c b/drivers/gpu/drm/nouveau/dispnv50/headc37d.c +index 00011ce109a6..4a9a32b89f74 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/headc37d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/headc37d.c +@@ -168,14 +168,15 @@ headc37d_mode(struct nv50_head *head, struct nv50_head_atom *asyh) + struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; + struct nv50_head_mode *m = &asyh->mode; + u32 *push; +- if ((push = evo_wait(core, 12))) { ++ if ((push = evo_wait(core, 13))) { + evo_mthd(push, 0x2064 + (head->base.index * 0x400), 5); + evo_data(push, (m->v.active << 16) | m->h.active ); + evo_data(push, (m->v.synce << 16) | m->h.synce ); + evo_data(push, (m->v.blanke << 16) | m->h.blanke ); + evo_data(push, (m->v.blanks << 16) | m->h.blanks ); + evo_data(push, (m->v.blank2e << 16) | m->v.blank2s); +- evo_mthd(push, 0x200c + (head->base.index * 0x400), 1); ++ evo_mthd(push, 0x2008 + (head->base.index * 0x400), 2); ++ evo_data(push, m->interlace); + evo_data(push, m->clock * 1000); + evo_mthd(push, 0x2028 + (head->base.index * 0x400), 1); + evo_data(push, m->clock * 1000); +diff --git a/drivers/gpu/drm/nouveau/dispnv50/headc57d.c b/drivers/gpu/drm/nouveau/dispnv50/headc57d.c +index 938d910a1b1e..859131a8bc3c 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/headc57d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/headc57d.c +@@ -173,14 +173,15 @@ headc57d_mode(struct nv50_head *head, struct nv50_head_atom *asyh) + struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; + struct nv50_head_mode *m = &asyh->mode; + u32 *push; +- if ((push = evo_wait(core, 12))) { ++ if ((push = evo_wait(core, 13))) { + evo_mthd(push, 0x2064 + (head->base.index * 0x400), 5); + evo_data(push, (m->v.active << 16) | m->h.active ); + evo_data(push, (m->v.synce << 16) | m->h.synce ); + evo_data(push, (m->v.blanke << 16) | m->h.blanke ); + evo_data(push, (m->v.blanks << 16) | m->h.blanks ); + evo_data(push, (m->v.blank2e << 16) | m->v.blank2s); +- evo_mthd(push, 0x200c + (head->base.index * 0x400), 1); ++ evo_mthd(push, 0x2008 + (head->base.index * 0x400), 2); ++ evo_data(push, m->interlace); + evo_data(push, m->clock * 1000); + evo_mthd(push, 0x2028 + (head->base.index * 0x400), 1); + evo_data(push, m->clock * 1000); +-- +2.26.2 + diff --git a/SOURCES/0001-kms-nv50-Initialize-core-channel-in-nouveau_display_.patch b/SOURCES/0001-kms-nv50-Initialize-core-channel-in-nouveau_display_.patch new file mode 100644 index 0000000..b590bb0 --- /dev/null +++ b/SOURCES/0001-kms-nv50-Initialize-core-channel-in-nouveau_display_.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Mon, 11 May 2020 18:41:23 -0400 +Subject: [PATCH] kms/nv50-: Initialize core channel in + nouveau_display_create() + +We'll need the core channel initialized and ready by the time that we +start creating modesetting objects, so that we can call the +NV507D_GET_CAPABILITIES method to make the hardware expose it's +modesetting capabilities for later probing. + +So, when loading the driver prepare the core channel from within +nouveau_display_create(). Everywhere else, we initialize the core +channel during resume. + +Signed-off-by: Lyude Paul +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/dispnv50/disp.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c +index 2625ed84fc44..2afd56b9887d 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c +@@ -2373,7 +2373,8 @@ nv50_display_init(struct drm_device *dev, bool resume, bool runtime) + struct drm_encoder *encoder; + struct drm_plane *plane; + +- core->func->init(core); ++ if (resume || runtime) ++ core->func->init(core); + + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { + if (encoder->encoder_type != DRM_MODE_ENCODER_DPMST) { +@@ -2460,6 +2461,8 @@ nv50_display_create(struct drm_device *dev) + if (ret) + goto out; + ++ disp->core->func->init(disp->core); ++ + /* create crtc objects to represent the hw heads */ + if (disp->disp->object.oclass >= GV100_DISP) + crtcs = nvif_rd32(&device->object, 0x610060) & 0xff; +-- +2.26.2 + diff --git a/SOURCES/0001-kms-nv50-Move-8BPC-limit-for-MST-into-nv50_mstc_get_.patch b/SOURCES/0001-kms-nv50-Move-8BPC-limit-for-MST-into-nv50_mstc_get_.patch new file mode 100644 index 0000000..0a6a4cf --- /dev/null +++ b/SOURCES/0001-kms-nv50-Move-8BPC-limit-for-MST-into-nv50_mstc_get_.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Mon, 11 May 2020 18:41:26 -0400 +Subject: [PATCH] kms/nv50-: Move 8BPC limit for MST into nv50_mstc_get_modes() + +This just limits the BPC for MST connectors to a maximum of 8 from +nv50_mstc_get_modes(), instead of doing so during +nv50_msto_atomic_check(). This doesn't introduce any functional changes +yet (other then userspace now lying about the max bpc, but we can't +support that yet anyway so meh). But, we'll need this in a moment so +that we can share mode validation between SST and MST which will fix +some real world issues. + +Signed-off-by: Lyude Paul +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/dispnv50/disp.c | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c +index 1db4f20b8697..e92e7bf49780 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c +@@ -908,15 +908,9 @@ nv50_msto_atomic_check(struct drm_encoder *encoder, + if (!state->duplicated) { + const int clock = crtc_state->adjusted_mode.clock; + +- /* +- * XXX: Since we don't use HDR in userspace quite yet, limit +- * the bpc to 8 to save bandwidth on the topology. In the +- * future, we'll want to properly fix this by dynamically +- * selecting the highest possible bpc that would fit in the +- * topology +- */ +- asyh->or.bpc = min(connector->display_info.bpc, 8U); +- asyh->dp.pbn = drm_dp_calc_pbn_mode(clock, asyh->or.bpc * 3, false); ++ asyh->or.bpc = connector->display_info.bpc; ++ asyh->dp.pbn = drm_dp_calc_pbn_mode(clock, asyh->or.bpc * 3, ++ false); + } + + slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, mstc->port, +@@ -1076,8 +1070,17 @@ nv50_mstc_get_modes(struct drm_connector *connector) + if (mstc->edid) + ret = drm_add_edid_modes(&mstc->connector, mstc->edid); + +- if (!mstc->connector.display_info.bpc) +- mstc->connector.display_info.bpc = 8; ++ /* ++ * XXX: Since we don't use HDR in userspace quite yet, limit the bpc ++ * to 8 to save bandwidth on the topology. In the future, we'll want ++ * to properly fix this by dynamically selecting the highest possible ++ * bpc that would fit in the topology ++ */ ++ if (connector->display_info.bpc) ++ connector->display_info.bpc = ++ clamp(connector->display_info.bpc, 6U, 8U); ++ else ++ connector->display_info.bpc = 8; + + if (mstc->native) + drm_mode_destroy(mstc->connector.dev, mstc->native); +-- +2.26.2 + diff --git a/SOURCES/0001-kms-nv50-Probe-SOR-and-PIOR-caps-for-DP-interlacing-.patch b/SOURCES/0001-kms-nv50-Probe-SOR-and-PIOR-caps-for-DP-interlacing-.patch new file mode 100644 index 0000000..e74501b --- /dev/null +++ b/SOURCES/0001-kms-nv50-Probe-SOR-and-PIOR-caps-for-DP-interlacing-.patch @@ -0,0 +1,439 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Mon, 11 May 2020 18:41:24 -0400 +Subject: [PATCH] kms/nv50-: Probe SOR and PIOR caps for DP interlacing support + +Right now, we make the mistake of allowing interlacing on all +connectors. Nvidia hardware does not always support interlacing with DP +though, so we need to make sure that we don't allow interlaced modes to +be set in such situations as otherwise we'll end up accidentally hanging +the display HW. + +This fixes some hangs with Turing, which would be caused by attempting +to set an interlaced mode on hardware that doesn't support it. This +patch likely fixes other hardware hanging in the same way as well. + +Note that we say we probe PIOR caps, but they don't actually have any +interlacing caps. So, the get_caps() function for PIORs just sets +interlacing support to true. + +Changes since v1: +* Actually probe caps correctly this time, both on EVO and NVDisplay. +Changes since v2: +* Fix probing for < GF119 +* Use vfunc table, in prep for adding more caps in the future. + +Signed-off-by: Lyude Paul +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/dispnv50/core.h | 7 ++++++ + drivers/gpu/drm/nouveau/dispnv50/core507d.c | 15 ++++++++++++ + drivers/gpu/drm/nouveau/dispnv50/core827d.c | 1 + + drivers/gpu/drm/nouveau/dispnv50/core907d.c | 1 + + drivers/gpu/drm/nouveau/dispnv50/core917d.c | 1 + + drivers/gpu/drm/nouveau/dispnv50/corec37d.c | 26 +++++++++++++++++++++ + drivers/gpu/drm/nouveau/dispnv50/corec57d.c | 1 + + drivers/gpu/drm/nouveau/dispnv50/disp.c | 19 +++++++++++++-- + drivers/gpu/drm/nouveau/dispnv50/disp.h | 1 + + drivers/gpu/drm/nouveau/dispnv50/pior507d.c | 8 +++++++ + drivers/gpu/drm/nouveau/dispnv50/sor507d.c | 7 ++++++ + drivers/gpu/drm/nouveau/dispnv50/sor907d.c | 11 +++++++++ + drivers/gpu/drm/nouveau/dispnv50/sorc37d.c | 9 +++++++ + drivers/gpu/drm/nouveau/nouveau_connector.c | 10 +++++++- + drivers/gpu/drm/nouveau/nouveau_encoder.h | 4 ++++ + 15 files changed, 118 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/dispnv50/core.h b/drivers/gpu/drm/nouveau/dispnv50/core.h +index ff94f3f6f264..99157dc94d23 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/core.h ++++ b/drivers/gpu/drm/nouveau/dispnv50/core.h +@@ -2,6 +2,7 @@ + #define __NV50_KMS_CORE_H__ + #include "disp.h" + #include "atom.h" ++#include + + struct nv50_core { + const struct nv50_core_func *func; +@@ -15,6 +16,7 @@ void nv50_core_del(struct nv50_core **); + struct nv50_core_func { + void (*init)(struct nv50_core *); + void (*ntfy_init)(struct nouveau_bo *, u32 offset); ++ int (*caps_init)(struct nouveau_drm *, struct nv50_disp *); + int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset, + struct nvif_device *); + void (*update)(struct nv50_core *, u32 *interlock, bool ntfy); +@@ -27,6 +29,9 @@ struct nv50_core_func { + const struct nv50_outp_func { + void (*ctrl)(struct nv50_core *, int or, u32 ctrl, + struct nv50_head_atom *); ++ /* XXX: Only used by SORs and PIORs for now */ ++ void (*get_caps)(struct nv50_disp *, ++ struct nouveau_encoder *, int or); + } *dac, *pior, *sor; + }; + +@@ -35,6 +40,7 @@ int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32, + struct nv50_core **); + void core507d_init(struct nv50_core *); + void core507d_ntfy_init(struct nouveau_bo *, u32); ++int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *); + int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *); + void core507d_update(struct nv50_core *, u32 *, bool); + +@@ -51,6 +57,7 @@ extern const struct nv50_outp_func sor907d; + int core917d_new(struct nouveau_drm *, s32, struct nv50_core **); + + int corec37d_new(struct nouveau_drm *, s32, struct nv50_core **); ++int corec37d_caps_init(struct nouveau_drm *, struct nv50_disp *); + int corec37d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *); + void corec37d_update(struct nv50_core *, u32 *, bool); + void corec37d_wndw_owner(struct nv50_core *); +diff --git a/drivers/gpu/drm/nouveau/dispnv50/core507d.c b/drivers/gpu/drm/nouveau/dispnv50/core507d.c +index c5152c39c684..e341f572c269 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/core507d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/core507d.c +@@ -62,6 +62,20 @@ core507d_ntfy_init(struct nouveau_bo *bo, u32 offset) + nouveau_bo_wr32(bo, offset / 4, 0x00000000); + } + ++int ++core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp) ++{ ++ u32 *push = evo_wait(&disp->core->chan, 2); ++ ++ if (push) { ++ evo_mthd(push, 0x008c, 1); ++ evo_data(push, 0x0); ++ evo_kick(push, &disp->core->chan); ++ } ++ ++ return 0; ++} ++ + void + core507d_init(struct nv50_core *core) + { +@@ -77,6 +91,7 @@ static const struct nv50_core_func + core507d = { + .init = core507d_init, + .ntfy_init = core507d_ntfy_init, ++ .caps_init = core507d_caps_init, + .ntfy_wait_done = core507d_ntfy_wait_done, + .update = core507d_update, + .head = &head507d, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/core827d.c b/drivers/gpu/drm/nouveau/dispnv50/core827d.c +index 6123a068f836..2e0c1c536afe 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/core827d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/core827d.c +@@ -26,6 +26,7 @@ static const struct nv50_core_func + core827d = { + .init = core507d_init, + .ntfy_init = core507d_ntfy_init, ++ .caps_init = core507d_caps_init, + .ntfy_wait_done = core507d_ntfy_wait_done, + .update = core507d_update, + .head = &head827d, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/core907d.c b/drivers/gpu/drm/nouveau/dispnv50/core907d.c +index ef822f813435..271629832629 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/core907d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/core907d.c +@@ -26,6 +26,7 @@ static const struct nv50_core_func + core907d = { + .init = core507d_init, + .ntfy_init = core507d_ntfy_init, ++ .caps_init = core507d_caps_init, + .ntfy_wait_done = core507d_ntfy_wait_done, + .update = core507d_update, + .head = &head907d, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/core917d.c b/drivers/gpu/drm/nouveau/dispnv50/core917d.c +index 392338df5bfd..5cc072d4c30f 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/core917d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/core917d.c +@@ -26,6 +26,7 @@ static const struct nv50_core_func + core917d = { + .init = core507d_init, + .ntfy_init = core507d_ntfy_init, ++ .caps_init = core507d_caps_init, + .ntfy_wait_done = core507d_ntfy_wait_done, + .update = core507d_update, + .head = &head917d, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/corec37d.c b/drivers/gpu/drm/nouveau/dispnv50/corec37d.c +index c03cb987856b..e0c8811fb8e4 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/corec37d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/corec37d.c +@@ -22,6 +22,7 @@ + #include "core.h" + #include "head.h" + ++#include + #include + + #include +@@ -87,6 +88,30 @@ corec37d_ntfy_init(struct nouveau_bo *bo, u32 offset) + nouveau_bo_wr32(bo, offset / 4 + 3, 0x00000000); + } + ++int corec37d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp) ++{ ++ int ret; ++ ++ ret = nvif_object_init(&disp->disp->object, 0, GV100_DISP_CAPS, ++ NULL, 0, &disp->caps); ++ if (ret) { ++ NV_ERROR(drm, ++ "Failed to init notifier caps region: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = nvif_object_map(&disp->caps, NULL, 0); ++ if (ret) { ++ NV_ERROR(drm, ++ "Failed to map notifier caps region: %d\n", ++ ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ + static void + corec37d_init(struct nv50_core *core) + { +@@ -111,6 +136,7 @@ static const struct nv50_core_func + corec37d = { + .init = corec37d_init, + .ntfy_init = corec37d_ntfy_init, ++ .caps_init = corec37d_caps_init, + .ntfy_wait_done = corec37d_ntfy_wait_done, + .update = corec37d_update, + .wndw.owner = corec37d_wndw_owner, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/corec57d.c b/drivers/gpu/drm/nouveau/dispnv50/corec57d.c +index 147adcd60937..10ba9e9e4ae6 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/corec57d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/corec57d.c +@@ -46,6 +46,7 @@ static const struct nv50_core_func + corec57d = { + .init = corec57d_init, + .ntfy_init = corec37d_ntfy_init, ++ .caps_init = corec37d_caps_init, + .ntfy_wait_done = corec37d_ntfy_wait_done, + .update = corec37d_update, + .wndw.owner = corec37d_wndw_owner, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c +index 2afd56b9887d..1db4f20b8697 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c +@@ -1663,6 +1663,7 @@ nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe) + struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device); + struct nouveau_encoder *nv_encoder; + struct drm_encoder *encoder; ++ struct nv50_disp *disp = nv50_disp(connector->dev); + int type, ret; + + switch (dcbe->type) { +@@ -1689,10 +1690,12 @@ nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe) + + drm_connector_attach_encoder(connector, encoder); + ++ disp->core->func->sor->get_caps(disp, nv_encoder, ffs(dcbe->or) - 1); ++ + if (dcbe->type == DCB_OUTPUT_DP) { +- struct nv50_disp *disp = nv50_disp(encoder->dev); + struct nvkm_i2c_aux *aux = + nvkm_i2c_aux_find(i2c, dcbe->i2c_index); ++ + if (aux) { + if (disp->disp->object.oclass < GF110_DISP) { + /* HW has no support for address-only +@@ -1805,7 +1808,9 @@ nv50_pior_func = { + static int + nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe) + { +- struct nouveau_drm *drm = nouveau_drm(connector->dev); ++ struct drm_device *dev = connector->dev; ++ struct nouveau_drm *drm = nouveau_drm(dev); ++ struct nv50_disp *disp = nv50_disp(dev); + struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device); + struct nvkm_i2c_bus *bus = NULL; + struct nvkm_i2c_aux *aux = NULL; +@@ -1844,6 +1849,9 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe) + drm_encoder_helper_add(encoder, &nv50_pior_help); + + drm_connector_attach_encoder(connector, encoder); ++ ++ disp->core->func->pior->get_caps(disp, nv_encoder, ffs(dcbe->or) - 1); ++ + return 0; + } + +@@ -2401,6 +2409,8 @@ nv50_display_destroy(struct drm_device *dev) + + nv50_audio_component_fini(nouveau_drm(dev)); + ++ nvif_object_unmap(&disp->caps); ++ nvif_object_fini(&disp->caps); + nv50_core_del(&disp->core); + + nouveau_bo_unmap(disp->sync); +@@ -2462,6 +2472,11 @@ nv50_display_create(struct drm_device *dev) + goto out; + + disp->core->func->init(disp->core); ++ if (disp->core->func->caps_init) { ++ ret = disp->core->func->caps_init(drm, disp); ++ if (ret) ++ goto out; ++ } + + /* create crtc objects to represent the hw heads */ + if (disp->disp->object.oclass >= GV100_DISP) +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.h b/drivers/gpu/drm/nouveau/dispnv50/disp.h +index d54fe00ac3a3..89c3b38c32a5 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.h ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.h +@@ -9,6 +9,7 @@ struct nv50_msto; + struct nv50_disp { + struct nvif_disp *disp; + struct nv50_core *core; ++ struct nvif_object caps; + + #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o)) + #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00) +diff --git a/drivers/gpu/drm/nouveau/dispnv50/pior507d.c b/drivers/gpu/drm/nouveau/dispnv50/pior507d.c +index d2bac6a341dc..45d8ce7d2c28 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/pior507d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/pior507d.c +@@ -38,7 +38,15 @@ pior507d_ctrl(struct nv50_core *core, int or, u32 ctrl, + } + } + ++static void ++pior507d_get_caps(struct nv50_disp *disp, struct nouveau_encoder *outp, ++ int or) ++{ ++ outp->caps.dp_interlace = true; ++} ++ + const struct nv50_outp_func + pior507d = { + .ctrl = pior507d_ctrl, ++ .get_caps = pior507d_get_caps, + }; +diff --git a/drivers/gpu/drm/nouveau/dispnv50/sor507d.c b/drivers/gpu/drm/nouveau/dispnv50/sor507d.c +index 5222fe6a9b21..9a59fa7da00d 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/sor507d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/sor507d.c +@@ -38,7 +38,14 @@ sor507d_ctrl(struct nv50_core *core, int or, u32 ctrl, + } + } + ++static void ++sor507d_get_caps(struct nv50_disp *core, struct nouveau_encoder *outp, int or) ++{ ++ outp->caps.dp_interlace = true; ++} ++ + const struct nv50_outp_func + sor507d = { + .ctrl = sor507d_ctrl, ++ .get_caps = sor507d_get_caps, + }; +diff --git a/drivers/gpu/drm/nouveau/dispnv50/sor907d.c b/drivers/gpu/drm/nouveau/dispnv50/sor907d.c +index b0314ec11fb3..9577ccf1c809 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/sor907d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/sor907d.c +@@ -21,6 +21,7 @@ + */ + #include "core.h" + ++#include + #include + + static void +@@ -35,7 +36,17 @@ sor907d_ctrl(struct nv50_core *core, int or, u32 ctrl, + } + } + ++static void ++sor907d_get_caps(struct nv50_disp *disp, struct nouveau_encoder *outp, int or) ++{ ++ const int off = or * 2; ++ u32 tmp = nouveau_bo_rd32(disp->sync, 0x000014 + off); ++ ++ outp->caps.dp_interlace = !!(tmp & 0x04000000); ++} ++ + const struct nv50_outp_func + sor907d = { + .ctrl = sor907d_ctrl, ++ .get_caps = sor907d_get_caps, + }; +diff --git a/drivers/gpu/drm/nouveau/dispnv50/sorc37d.c b/drivers/gpu/drm/nouveau/dispnv50/sorc37d.c +index dff059241c5d..c86ca955fdcd 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/sorc37d.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/sorc37d.c +@@ -33,7 +33,16 @@ sorc37d_ctrl(struct nv50_core *core, int or, u32 ctrl, + } + } + ++static void ++sorc37d_get_caps(struct nv50_disp *disp, struct nouveau_encoder *outp, int or) ++{ ++ u32 tmp = nvif_rd32(&disp->caps, 0x000144 + (or * 8)); ++ ++ outp->caps.dp_interlace = !!(tmp & 0x04000000); ++} ++ + const struct nv50_outp_func + sorc37d = { + .ctrl = sorc37d_ctrl, ++ .get_caps = sorc37d_get_caps, + }; +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index 9a9a7f5003d3..6dae00da5d7e 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -509,7 +509,11 @@ nouveau_connector_set_encoder(struct drm_connector *connector, + nv_connector->detected_encoder = nv_encoder; + + if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { +- connector->interlace_allowed = true; ++ if (nv_encoder->dcb->type == DCB_OUTPUT_DP) ++ connector->interlace_allowed = ++ nv_encoder->caps.dp_interlace; ++ else ++ connector->interlace_allowed = true; + connector->doublescan_allowed = true; + } else + if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || +@@ -1060,6 +1064,10 @@ nouveau_connector_mode_valid(struct drm_connector *connector, + case DCB_OUTPUT_TV: + return get_slave_funcs(encoder)->mode_valid(encoder, mode); + case DCB_OUTPUT_DP: ++ if (mode->flags & DRM_MODE_FLAG_INTERLACE && ++ !nv_encoder->caps.dp_interlace) ++ return MODE_NO_INTERLACE; ++ + max_clock = nv_encoder->dp.link_nr; + max_clock *= nv_encoder->dp.link_bw; + clock = clock * (connector->display_info.bpc * 3) / 10; +diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/nouveau/nouveau_encoder.h +index 3517f920bf89..3217f587eceb 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_encoder.h ++++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h +@@ -66,6 +66,10 @@ struct nouveau_encoder { + } dp; + }; + ++ struct { ++ bool dp_interlace : 1; ++ } caps; ++ + void (*enc_save)(struct drm_encoder *encoder); + void (*enc_restore)(struct drm_encoder *encoder); + void (*update)(struct nouveau_encoder *, u8 head, +-- +2.26.2 + diff --git a/SOURCES/0001-kms-nv50-Share-DP-SST-mode_valid-handling-with-MST.patch b/SOURCES/0001-kms-nv50-Share-DP-SST-mode_valid-handling-with-MST.patch new file mode 100644 index 0000000..c14aed7 --- /dev/null +++ b/SOURCES/0001-kms-nv50-Share-DP-SST-mode_valid-handling-with-MST.patch @@ -0,0 +1,209 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Mon, 11 May 2020 18:41:27 -0400 +Subject: [PATCH] kms/nv50-: Share DP SST mode_valid() handling with MST + +Currently, the nv50_mstc_mode_valid() function is happy to take any and +all modes, even the ones we can't actually support sometimes like +interlaced modes. + +Luckily, the only difference between the mode validation that needs to +be performed for MST vs. SST is that eventually we'll need to check the +minimum PBN against the MSTB's full PBN capabilities (remember-we don't +care about the current bw state here). Otherwise, all of the other code +can be shared. + +So, we move all of the common mode validation in +nouveau_connector_mode_valid() into a separate helper, +nv50_dp_mode_valid(), and use that from both nv50_mstc_mode_valid() and +nouveau_connector_mode_valid(). Note that we allow for returning the +calculated clock that nv50_dp_mode_valid() came up with, since we'll +eventually want to use that for PBN calculation in +nv50_mstc_mode_valid(). + +Signed-off-by: Lyude Paul +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/dispnv50/disp.c | 9 +++- + drivers/gpu/drm/nouveau/nouveau_connector.c | 46 ++++++++++++--------- + drivers/gpu/drm/nouveau/nouveau_connector.h | 5 +++ + drivers/gpu/drm/nouveau/nouveau_dp.c | 31 ++++++++++++++ + drivers/gpu/drm/nouveau/nouveau_encoder.h | 4 ++ + 5 files changed, 75 insertions(+), 20 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c +index e92e7bf49780..d5d69532f3c5 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c +@@ -1056,7 +1056,14 @@ static enum drm_mode_status + nv50_mstc_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) + { +- return MODE_OK; ++ struct nv50_mstc *mstc = nv50_mstc(connector); ++ struct nouveau_encoder *outp = mstc->mstm->outp; ++ ++ /* TODO: calculate the PBN from the dotclock and validate against the ++ * MSTB's max possible PBN ++ */ ++ ++ return nv50_dp_mode_valid(connector, outp, mode, NULL); + } + + static int +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index 6dae00da5d7e..1b383ae0248f 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -38,6 +38,7 @@ + #include "nouveau_reg.h" + #include "nouveau_drv.h" + #include "dispnv04/hw.h" ++#include "dispnv50/disp.h" + #include "nouveau_acpi.h" + + #include "nouveau_display.h" +@@ -1033,6 +1034,29 @@ get_tmds_link_bandwidth(struct drm_connector *connector) + return 112000 * duallink_scale; + } + ++enum drm_mode_status ++nouveau_conn_mode_clock_valid(const struct drm_display_mode *mode, ++ const unsigned min_clock, ++ const unsigned max_clock, ++ unsigned int *clock_out) ++{ ++ unsigned int clock = mode->clock; ++ ++ if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == ++ DRM_MODE_FLAG_3D_FRAME_PACKING) ++ clock *= 2; ++ ++ if (clock < min_clock) ++ return MODE_CLOCK_LOW; ++ if (clock > max_clock) ++ return MODE_CLOCK_HIGH; ++ ++ if (clock_out) ++ *clock_out = clock; ++ ++ return MODE_OK; ++} ++ + static enum drm_mode_status + nouveau_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +@@ -1041,7 +1065,6 @@ nouveau_connector_mode_valid(struct drm_connector *connector, + struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; + struct drm_encoder *encoder = to_drm_encoder(nv_encoder); + unsigned min_clock = 25000, max_clock = min_clock; +- unsigned clock = mode->clock; + + switch (nv_encoder->dcb->type) { + case DCB_OUTPUT_LVDS: +@@ -1064,29 +1087,14 @@ nouveau_connector_mode_valid(struct drm_connector *connector, + case DCB_OUTPUT_TV: + return get_slave_funcs(encoder)->mode_valid(encoder, mode); + case DCB_OUTPUT_DP: +- if (mode->flags & DRM_MODE_FLAG_INTERLACE && +- !nv_encoder->caps.dp_interlace) +- return MODE_NO_INTERLACE; +- +- max_clock = nv_encoder->dp.link_nr; +- max_clock *= nv_encoder->dp.link_bw; +- clock = clock * (connector->display_info.bpc * 3) / 10; +- break; ++ return nv50_dp_mode_valid(connector, nv_encoder, mode, NULL); + default: + BUG(); + return MODE_BAD; + } + +- if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) +- clock *= 2; +- +- if (clock < min_clock) +- return MODE_CLOCK_LOW; +- +- if (clock > max_clock) +- return MODE_CLOCK_HIGH; +- +- return MODE_OK; ++ return nouveau_conn_mode_clock_valid(mode, min_clock, max_clock, ++ NULL); + } + + static struct drm_encoder * +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h +index de84fb4708c7..9e062c7adec8 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.h ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.h +@@ -195,6 +195,11 @@ int nouveau_conn_atomic_get_property(struct drm_connector *, + const struct drm_connector_state *, + struct drm_property *, u64 *); + struct drm_display_mode *nouveau_conn_native_mode(struct drm_connector *); ++enum drm_mode_status ++nouveau_conn_mode_clock_valid(const struct drm_display_mode *, ++ const unsigned min_clock, ++ const unsigned max_clock, ++ unsigned *clock); + + #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT + extern int nouveau_backlight_init(struct drm_connector *); +diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c +index 2674f1587457..8a0f7994e1ae 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_dp.c ++++ b/drivers/gpu/drm/nouveau/nouveau_dp.c +@@ -98,3 +98,34 @@ nouveau_dp_detect(struct nouveau_encoder *nv_encoder) + return NOUVEAU_DP_SST; + return ret; + } ++ ++/* TODO: ++ * - Use the minimum possible BPC here, once we add support for the max bpc ++ * property. ++ * - Validate the mode against downstream port caps (see ++ * drm_dp_downstream_max_clock()) ++ * - Validate against the DP caps advertised by the GPU (we don't check these ++ * yet) ++ */ ++enum drm_mode_status ++nv50_dp_mode_valid(struct drm_connector *connector, ++ struct nouveau_encoder *outp, ++ const struct drm_display_mode *mode, ++ unsigned *out_clock) ++{ ++ const unsigned min_clock = 25000; ++ unsigned max_clock, clock; ++ enum drm_mode_status ret; ++ ++ if (mode->flags & DRM_MODE_FLAG_INTERLACE && !outp->caps.dp_interlace) ++ return MODE_NO_INTERLACE; ++ ++ max_clock = outp->dp.link_nr * outp->dp.link_bw; ++ clock = mode->clock * (connector->display_info.bpc * 3) / 10; ++ ++ ret = nouveau_conn_mode_clock_valid(mode, min_clock, max_clock, ++ &clock); ++ if (out_clock) ++ *out_clock = clock; ++ return ret; ++} +diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/nouveau/nouveau_encoder.h +index 3217f587eceb..de51733b0476 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_encoder.h ++++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h +@@ -104,6 +104,10 @@ enum nouveau_dp_status { + }; + + int nouveau_dp_detect(struct nouveau_encoder *); ++enum drm_mode_status nv50_dp_mode_valid(struct drm_connector *, ++ struct nouveau_encoder *, ++ const struct drm_display_mode *, ++ unsigned *clock); + + struct nouveau_connector * + nouveau_encoder_connector_get(struct nouveau_encoder *encoder); +-- +2.26.2 + diff --git a/SOURCES/0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch b/SOURCES/0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch new file mode 100644 index 0000000..2e05512 --- /dev/null +++ b/SOURCES/0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Murphy Zhou +Date: Sun, 29 Sep 2019 17:56:59 +0800 +Subject: [PATCH] mm/kmemleak: skip late_init if not skip disable + +Now if DEFAULT_OFF set to y, kmemleak_init will start the cleanup_work +workqueue. Then late_init call will set kmemleak_initialized to 1, the +cleaup workqueue will try to do cleanup, triggering: + +[24.738773] ================================================================== +[24.742784] BUG: KASAN: global-out-of-bounds in __kmemleak_do_cleanup+0x166/0x180 +[24.744144] Key type ._fscrypt registered +[24.745680] Read of size 8 at addr ffffffff88746c90 by task kworker/3:1/171 +[24.745687] +[24.745697] CPU: 3 PID: 171 Comm: kworker/3:1 Not tainted 5.3.0-v5.3-12475-gcbafe18 #1 +[24.745701] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 +[24.745710] Workqueue: events kmemleak_do_cleanup +[24.745717] Call Trace: +[24.745736] dump_stack+0x7c/0xc0 +[24.745755] print_address_description.constprop.4+0x1f/0x300 +[24.751562] Key type .fscrypt registered +[24.754370] __kasan_report.cold.8+0x76/0xb2 +[24.754388] ? __kmemleak_do_cleanup+0x166/0x180 +[24.754407] kasan_report+0xe/0x20 +[24.778543] __kmemleak_do_cleanup+0x166/0x180 +[24.780795] process_one_work+0x919/0x17d0 +[24.782929] ? pwq_dec_nr_in_flight+0x320/0x320 +[24.785092] worker_thread+0x87/0xb40 +[24.786948] ? __kthread_parkme+0xc3/0x190 +[24.789217] ? process_one_work+0x17d0/0x17d0 +[24.791414] kthread+0x333/0x3f0 +[24.793031] ? kthread_create_worker_on_cpu+0xc0/0xc0 +[24.795473] ret_from_fork+0x3a/0x50 +[24.797303] +[24.798091] The buggy address belongs to the variable: +[24.800634] mem_pool_free_count+0x10/0x40 +[24.802656] +[24.803434] Memory state around the buggy address: +[24.805793] ffffffff88746b80: 04 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 +[24.809177] ffffffff88746c00: 00 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa +[24.812407] >ffffffff88746c80: 04 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa +[24.815638] ^ +[24.817372] ffffffff88746d00: 00 00 fa fa fa fa fa fa 00 00 00 00 00 00 00 00 +[24.820740] ffffffff88746d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[24.824021] ================================================================== + +Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations") +Signed-off-by: Murphy Zhou +--- + mm/kmemleak.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/mm/kmemleak.c b/mm/kmemleak.c +index e362dc3d2028..0c3dfb8eef67 100644 +--- a/mm/kmemleak.c ++++ b/mm/kmemleak.c +@@ -1958,6 +1958,11 @@ void __init kmemleak_init(void) + */ + static int __init kmemleak_late_init(void) + { ++ if (!kmemleak_skip_disable) { ++ kmemleak_disable(); ++ return 0; ++ } ++ + kmemleak_initialized = 1; + + debugfs_create_file("kmemleak", 0644, NULL, NULL, &kmemleak_fops); +-- +2.26.2 + diff --git a/SOURCES/0001-mmu-Remove-unneeded-semicolon.patch b/SOURCES/0001-mmu-Remove-unneeded-semicolon.patch new file mode 100644 index 0000000..3931ff5 --- /dev/null +++ b/SOURCES/0001-mmu-Remove-unneeded-semicolon.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zheng Bin +Date: Fri, 24 Apr 2020 15:36:01 +0800 +Subject: [PATCH] mmu: Remove unneeded semicolon + +Fixes coccicheck warning: + +drivers/gpu/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h:307:2-3: Unneeded semicolon +drivers/gpu/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:583:2-3: Unneeded semicolon + +Reported-by: Hulk Robot +Signed-off-by: Zheng Bin +Signed-off-by: Ben Skeggs +--- + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 2 +- + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +index 41640e0584ac..199f94e15c5f 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +@@ -580,7 +580,7 @@ nvkm_vmm_iter(struct nvkm_vmm *vmm, const struct nvkm_vmm_page *page, + it.pte[it.lvl]++; + } + } +- }; ++ } + + nvkm_vmm_flush(&it); + return ~0ULL; +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h +index 5e55ecbd8005..d3f8f916d0db 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h +@@ -304,7 +304,7 @@ int tu102_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32, + FILL(VMM, PT, PTEI, _ptes, MAP, _addr); \ + PTEI += _ptes; \ + PTEN -= _ptes; \ +- }; \ ++ } \ + nvkm_done((PT)->memory); \ + } while(0) + +-- +2.26.2 + diff --git a/SOURCES/0001-perf-cs-etm-Move-defined-of-traceid_list.patch b/SOURCES/0001-perf-cs-etm-Move-defined-of-traceid_list.patch new file mode 100644 index 0000000..63cbefa --- /dev/null +++ b/SOURCES/0001-perf-cs-etm-Move-defined-of-traceid_list.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Yan +Date: Tue, 5 May 2020 21:36:42 +0800 +Subject: [PATCH] perf cs-etm: Move defined of traceid_list + +The variable 'traceid_list' is defined in the header file cs-etm.h, +if multiple C files include cs-etm.h the compiler might complaint for +multiple definition of 'traceid_list'. + +To fix multiple definition error, move the definition of 'traceid_list' +into cs-etm.c. + +Fixes: cd8bfd8c973e ("perf tools: Add processing of coresight metadata") +Reported-by: Thomas Backlund +Signed-off-by: Leo Yan +Tested-by: Thomas Backlund +Tested-by: Mike Leach +Tested-by: Justin M. Forbes +Reviewed-by: Mike Leach +Reviewed-by: Mathieu Poirier + +Upstream Status: https://lore.kernel.org/lkml/20200505133642.4756-1-leo.yan@linaro.org/ +--- + tools/perf/util/cs-etm.c | 3 +++ + tools/perf/util/cs-etm.h | 3 --- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c +index 62d2f9b9ce1b..381d9708e9bd 100644 +--- a/tools/perf/util/cs-etm.c ++++ b/tools/perf/util/cs-etm.c +@@ -94,6 +94,9 @@ struct cs_etm_queue { + struct cs_etm_traceid_queue **traceid_queues; + }; + ++/* RB tree for quick conversion between traceID and metadata pointers */ ++static struct intlist *traceid_list; ++ + static int cs_etm__update_queues(struct cs_etm_auxtrace *etm); + static int cs_etm__process_queues(struct cs_etm_auxtrace *etm); + static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm, +diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h +index 650ecc2a6349..4ad925d6d799 100644 +--- a/tools/perf/util/cs-etm.h ++++ b/tools/perf/util/cs-etm.h +@@ -114,9 +114,6 @@ enum cs_etm_isa { + CS_ETM_ISA_T32, + }; + +-/* RB tree for quick conversion between traceID and metadata pointers */ +-struct intlist *traceid_list; +- + struct cs_etm_queue; + + struct cs_etm_packet { +-- +2.26.2 + diff --git a/SOURCES/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch b/SOURCES/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch new file mode 100644 index 0000000..4ba0393 --- /dev/null +++ b/SOURCES/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch @@ -0,0 +1,136 @@ +From 14232c6e788cb1f7b96dbd08b077f90923324b24 Mon Sep 17 00:00:00 2001 +From: Lars Hofhansl +Date: Thu, 23 Apr 2020 14:57:09 -0700 +Subject: [PATCH] platform/x86: thinkpad_acpi: Add support for dual fan control + +This adds dual fan control for the following models: +P50, P51, P52, P70, P71, P72, P1 gen1, P2 gen2, X1E gen1 and X1E gen2. + +Both fans are controlled together as if they were a single fan. + +Tested on an X1 Extreme Gen1, an X1 Extreme Gen2, and a P50. + +The patch is defensive, it adds only specific supported machines, and falls +back to the old behavior if both fans cannot be controlled. + +Background: +I tested the BIOS default behavior on my X1E gen2 and both fans are always +changed together. So rather than adding controls for each fan, this controls +both fans together as the BIOS would do. + +This was inspired by a discussion on dual fan support for the thinkfan tool +(see link below). All BIOS IDs are taken from there. The X1E gen2 ID is +verified on my machine. + +Thanks to GitHub users voidworker and civic9 for the earlier patches and +BIOS IDs, and to users peter-stoll and sassman for testing the patch on +their machines. + +BugLink: https://github.com/vmatare/thinkfan/issues/58 +Signed-off-by: Lars Hofhansl +[andy: massaged commit message to capitalize ID and convert to BugLink] +Signed-off-by: Andy Shevchenko +--- + drivers/platform/x86/thinkpad_acpi.c | 43 ++++++++++++++++++++++++---- + 1 file changed, 37 insertions(+), 6 deletions(-) + +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index 8eaadbaf8ffa..83b4a83da967 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -318,6 +318,7 @@ static struct { + u32 uwb:1; + u32 fan_ctrl_status_undef:1; + u32 second_fan:1; ++ u32 second_fan_ctl:1; + u32 beep_needs_two_args:1; + u32 mixer_no_level_control:1; + u32 battery_force_primary:1; +@@ -8324,11 +8325,19 @@ static int fan_set_level(int level) + + switch (fan_control_access_mode) { + case TPACPI_FAN_WR_ACPI_SFAN: +- if (level >= 0 && level <= 7) { +- if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level)) +- return -EIO; +- } else ++ if ((level < 0) || (level > 7)) + return -EINVAL; ++ ++ if (tp_features.second_fan_ctl) { ++ if (!fan_select_fan2() || ++ !acpi_evalf(sfan_handle, NULL, NULL, "vd", level)) { ++ pr_warn("Couldn't set 2nd fan level, disabling support\n"); ++ tp_features.second_fan_ctl = 0; ++ } ++ fan_select_fan1(); ++ } ++ if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level)) ++ return -EIO; + break; + + case TPACPI_FAN_WR_ACPI_FANS: +@@ -8345,6 +8354,15 @@ static int fan_set_level(int level) + else if (level & TP_EC_FAN_AUTO) + level |= 4; /* safety min speed 4 */ + ++ if (tp_features.second_fan_ctl) { ++ if (!fan_select_fan2() || ++ !acpi_ec_write(fan_status_offset, level)) { ++ pr_warn("Couldn't set 2nd fan level, disabling support\n"); ++ tp_features.second_fan_ctl = 0; ++ } ++ fan_select_fan1(); ++ ++ } + if (!acpi_ec_write(fan_status_offset, level)) + return -EIO; + else +@@ -8763,6 +8781,7 @@ static const struct attribute_group fan_attr_group = { + + #define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */ + #define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */ ++#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */ + + static const struct tpacpi_quirk fan_quirk_table[] __initconst = { + TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1), +@@ -8771,6 +8790,13 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { + TPACPI_QEC_IBM('7', '0', TPACPI_FAN_Q1), + TPACPI_QEC_LNV('7', 'M', TPACPI_FAN_2FAN), + TPACPI_Q_LNV('N', '1', TPACPI_FAN_2FAN), ++ TPACPI_Q_LNV3('N', '1', 'D', TPACPI_FAN_2CTL), /* P70 */ ++ TPACPI_Q_LNV3('N', '1', 'E', TPACPI_FAN_2CTL), /* P50 */ ++ TPACPI_Q_LNV3('N', '1', 'T', TPACPI_FAN_2CTL), /* P71 */ ++ TPACPI_Q_LNV3('N', '1', 'U', TPACPI_FAN_2CTL), /* P51 */ ++ TPACPI_Q_LNV3('N', '2', 'C', TPACPI_FAN_2CTL), /* P52 / P72 */ ++ TPACPI_Q_LNV3('N', '2', 'E', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (1st gen) */ ++ TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */ + }; + + static int __init fan_init(struct ibm_init_struct *iibm) +@@ -8788,6 +8814,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) + fan_watchdog_maxinterval = 0; + tp_features.fan_ctrl_status_undef = 0; + tp_features.second_fan = 0; ++ tp_features.second_fan_ctl = 0; + fan_control_desired_level = 7; + + if (tpacpi_is_ibm()) { +@@ -8812,8 +8839,12 @@ static int __init fan_init(struct ibm_init_struct *iibm) + fan_quirk1_setup(); + if (quirks & TPACPI_FAN_2FAN) { + tp_features.second_fan = 1; +- dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN, +- "secondary fan support enabled\n"); ++ pr_info("secondary fan support enabled\n"); ++ } ++ if (quirks & TPACPI_FAN_2CTL) { ++ tp_features.second_fan = 1; ++ tp_features.second_fan_ctl = 1; ++ pr_info("secondary fan control enabled\n"); + } + } else { + pr_err("ThinkPad ACPI EC access misbehaving, fan status and control unavailable\n"); +-- +2.26.2 + diff --git a/SOURCES/0001-s390-Lock-down-the-kernel-when-the-IPL-secure-flag-i.patch b/SOURCES/0001-s390-Lock-down-the-kernel-when-the-IPL-secure-flag-i.patch new file mode 100644 index 0000000..4332472 --- /dev/null +++ b/SOURCES/0001-s390-Lock-down-the-kernel-when-the-IPL-secure-flag-i.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Wed, 30 Oct 2019 14:37:49 +0000 +Subject: [PATCH] s390: Lock down the kernel when the IPL secure flag is set + +Automatically lock down the kernel to LOCKDOWN_CONFIDENTIALITY_MAX if +the IPL secure flag is set. + +Upstream Status: RHEL only +Suggested-by: Philipp Rudo +Signed-off-by: Jeremy Cline +--- + arch/s390/include/asm/ipl.h | 1 + + arch/s390/kernel/ipl.c | 5 +++++ + arch/s390/kernel/setup.c | 4 ++++ + 3 files changed, 10 insertions(+) + +diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h +index b63bd66404b8..3482d9602e68 100644 +--- a/arch/s390/include/asm/ipl.h ++++ b/arch/s390/include/asm/ipl.h +@@ -109,6 +109,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 4a71061974fd..9baf0b570c3d 100644 +--- a/arch/s390/kernel/ipl.c ++++ b/arch/s390/kernel/ipl.c +@@ -1901,3 +1901,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 36445dd40fdb..b338a050c5aa 100644 +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1093,6 +1094,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; +-- +2.26.2 + diff --git a/SOURCES/0001-scsi-smartpqi-add-inspur-advantech-ids.patch b/SOURCES/0001-scsi-smartpqi-add-inspur-advantech-ids.patch new file mode 100644 index 0000000..4e2bbb7 --- /dev/null +++ b/SOURCES/0001-scsi-smartpqi-add-inspur-advantech-ids.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Don Brace +Date: Mon, 16 Jul 2018 19:20:41 -0400 +Subject: [PATCH] scsi: smartpqi: add inspur advantech ids + +Message-id: <1531768843-2544-4-git-send-email-dbrace@redhat.com> +Patchwork-id: 224988 +O-Subject: [RHEL 8.0 e-stor V2 PATCH 3/5] scsi: smartpqi: add inspur advantech ids +Bugzilla: 1503736 +RH-Acked-by: Ewan Milne +RH-Acked-by: Tomas Henzl + +From: Kevin Barnett + +Add support for these new device IDs: + + Advantech MIC-8312BridgeB + INSPUR PM8204-2GB + INSPUR PM8204-4GB + INSPUR PM8222-SHBA + +Upstream Status: RHEL only +Reviewed-by: Scott Benesh +Signed-off-by: Kevin Barnett +Signed-off-by: Don Brace +Signed-off-by: Martin K. Petersen +(cherry picked from commit 9f8d05fa98442de78d1ab30235b0cc656ed7aff0) +Signed-off-by: Don Brace +Signed-off-by: Herton R. Krzesinski +--- + drivers/scsi/smartpqi/smartpqi_init.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c +index cd157f11eb22..c5dc6cf57a71 100644 +--- a/drivers/scsi/smartpqi/smartpqi_init.c ++++ b/drivers/scsi/smartpqi/smartpqi_init.c +@@ -8247,6 +8247,18 @@ static const struct pci_device_id pqi_pci_id_table[] = { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x19e5, 0xd22c) + }, ++ { ++ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, ++ 0x1bd4, 0x004a) ++ }, ++ { ++ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, ++ 0x1bd4, 0x004b) ++ }, ++ { ++ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, ++ 0x1bd4, 0x004c) ++ }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x0110) +@@ -8383,6 +8395,10 @@ static const struct pci_device_id pqi_pci_id_table[] = { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADVANTECH, 0x8312) + }, ++ { ++ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, ++ PCI_VENDOR_ID_ADVANTECH, 0x8312) ++ }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_DELL, 0x1fe0) +-- +2.26.2 + diff --git a/SOURCES/0001-security-lockdown-expose-a-hook-to-lock-the-kernel-d.patch b/SOURCES/0001-security-lockdown-expose-a-hook-to-lock-the-kernel-d.patch new file mode 100644 index 0000000..fc6b78a --- /dev/null +++ b/SOURCES/0001-security-lockdown-expose-a-hook-to-lock-the-kernel-d.patch @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Mon, 30 Sep 2019 21:22:47 +0000 +Subject: [PATCH] security: lockdown: expose a hook to lock the kernel down + +In order to automatically lock down kernels running on UEFI machines +booted in Secure Boot mode, expose the lock_kernel_down() hook. + +Upstream Status: RHEL only +Signed-off-by: Jeremy Cline +--- + include/linux/lsm_hook_defs.h | 2 ++ + include/linux/lsm_hooks.h | 6 ++++++ + include/linux/security.h | 5 +++++ + security/lockdown/lockdown.c | 1 + + security/security.c | 6 ++++++ + 5 files changed, 20 insertions(+) + +diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h +index 5616b2567aa7..bc5caab1413b 100644 +--- a/include/linux/lsm_hook_defs.h ++++ b/include/linux/lsm_hook_defs.h +@@ -371,6 +371,8 @@ LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux) + #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/lsm_hooks.h b/include/linux/lsm_hooks.h +index 988ca0df7824..4ed37b95417c 100644 +--- a/include/linux/lsm_hooks.h ++++ b/include/linux/lsm_hooks.h +@@ -1476,6 +1476,12 @@ + * + * @what: kernel feature being accessed + * ++ * @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) ++ * + * Security hooks for perf events + * + * @perf_event_open: +diff --git a/include/linux/security.h b/include/linux/security.h +index a8d9310472df..381305889d89 100644 +--- a/include/linux/security.h ++++ b/include/linux/security.h +@@ -446,6 +446,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); + #else /* CONFIG_SECURITY */ + + static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data) +@@ -1273,6 +1274,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; ++} + #endif /* CONFIG_SECURITY */ + + #ifdef CONFIG_SECURITY_NETWORK +diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c +index 5a952617a0eb..61cc3cdc4d25 100644 +--- a/security/lockdown/lockdown.c ++++ b/security/lockdown/lockdown.c +@@ -73,6 +73,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what) + + static struct security_hook_list lockdown_hooks[] __lsm_ro_after_init = { + LSM_HOOK_INIT(locked_down, lockdown_is_locked_down), ++ LSM_HOOK_INIT(lock_kernel_down, lock_kernel_down), + }; + + static int __init lockdown_lsm_init(void) +diff --git a/security/security.c b/security/security.c +index 51de970fbb1e..48d05f8067f2 100644 +--- a/security/security.c ++++ b/security/security.c +@@ -2468,6 +2468,12 @@ int security_locked_down(enum lockdown_reason what) + } + EXPORT_SYMBOL(security_locked_down); + ++int security_lock_kernel_down(const char *where, enum lockdown_reason level) ++{ ++ return call_int_hook(lock_kernel_down, 0, where, level); ++} ++EXPORT_SYMBOL(security_lock_kernel_down); ++ + #ifdef CONFIG_PERF_EVENTS + int security_perf_event_open(struct perf_event_attr *attr, int type) + { +-- +2.26.2 + diff --git a/SOURCES/0001-soc-bcm2835-Sync-xHCI-reset-firmware-property-with-d.patch b/SOURCES/0001-soc-bcm2835-Sync-xHCI-reset-firmware-property-with-d.patch new file mode 100644 index 0000000..3dd66b1 --- /dev/null +++ b/SOURCES/0001-soc-bcm2835-Sync-xHCI-reset-firmware-property-with-d.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Tue, 10 Mar 2020 13:52:39 +0100 +Subject: [PATCH] soc: bcm2835: Sync xHCI reset firmware property with + downstream + +The property is needed in order to trigger VL805's firmware load. Note +that there is a gap between the property introduced and the previous +one. This is also the case downstream. + +Signed-off-by: Nicolas Saenz Julienne +Reviewed-by: Florian Fainelli +--- + include/soc/bcm2835/raspberrypi-firmware.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 7800e12ee042..cc9cdbc66403 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -90,7 +90,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_PERIPH_REG = 0x00038045, + RPI_FIRMWARE_GET_POE_HAT_VAL = 0x00030049, + RPI_FIRMWARE_SET_POE_HAT_VAL = 0x00030050, +- ++ RPI_FIRMWARE_NOTIFY_XHCI_RESET = 0x00030058, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +-- +2.26.2 + diff --git a/SOURCES/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch b/SOURCES/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch new file mode 100644 index 0000000..4073234 --- /dev/null +++ b/SOURCES/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch @@ -0,0 +1,162 @@ +From 2c36867719d93db8d7f365310587578ab980762c Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Wed, 15 Apr 2020 21:24:48 +0200 +Subject: [PATCH] usb: fusb302: Convert to use GPIO descriptors + +This converts the FUSB302 driver to use GPIO descriptors. +The conversion to descriptors per se is pretty straight-forward. + +In the process I discovered that: + +1. The driver uses a completely undocumented device tree binding + for the interrupt GPIO line, "fcs,int_n". Ooops. + +2. The undocumented binding, presumably since it has not seen + review, is just "fcs,int_n", lacking the compulsory "-gpios" + suffix and also something that is not a good name because + the "_n" implies the line is inverted which is something we + handle with flags in the device tree. Ooops. + +3. Possibly the driver should not be requesting the line as a + GPIO and request the corresponding interrupt line by open + coding, the GPIO chip is very likely doubleing as an IRQ + controller and can probably provide an interrupt directly + for this line with interrupts-extended = <&gpio0 ...>; + +4. Possibly the IRQ should just be tagged on the I2C client node + in the device tree like apparently ACPI does, as it overrides + this IRQ with client->irq if that exists. + +But now it is too late to do much about that and as I can see +this is used like this in the Pinebook which is a shipping product +so let'a just contain the mess and move on. + +The property currently appears in: +arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts + +Create a quirk in the GPIO OF library to allow this property +specifically to be specified without the "-gpios" suffix, we have +other such bindings already. + +Cc: Tobias Schramm +Cc: Heikki Krogerus +Cc: Yueyao Zhu +Cc: Guenter Roeck +Cc: devicetree@vger.kernel.org +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20200415192448.305257-1-linus.walleij@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpio/gpiolib-of.c | 21 +++++++++++++++++++++ + drivers/usb/typec/tcpm/fusb302.c | 32 +++++++++----------------------- + 2 files changed, 30 insertions(+), 23 deletions(-) + +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c +index ccc449df3792a..20c2c428168e4 100644 +--- a/drivers/gpio/gpiolib-of.c ++++ b/drivers/gpio/gpiolib-of.c +@@ -460,6 +460,24 @@ static struct gpio_desc *of_find_arizona_gpio(struct device *dev, + return of_get_named_gpiod_flags(dev->of_node, con_id, 0, of_flags); + } + ++static struct gpio_desc *of_find_usb_gpio(struct device *dev, ++ const char *con_id, ++ enum of_gpio_flags *of_flags) ++{ ++ /* ++ * Currently this USB quirk is only for the Fairchild FUSB302 host which is using ++ * an undocumented DT GPIO line named "fcs,int_n" without the compulsory "-gpios" ++ * suffix. ++ */ ++ if (!IS_ENABLED(CONFIG_TYPEC_FUSB302)) ++ return ERR_PTR(-ENOENT); ++ ++ if (!con_id || strcmp(con_id, "fcs,int_n")) ++ return ERR_PTR(-ENOENT); ++ ++ return of_get_named_gpiod_flags(dev->of_node, con_id, 0, of_flags); ++} ++ + struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, + unsigned int idx, unsigned long *flags) + { +@@ -504,6 +522,9 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, + if (PTR_ERR(desc) == -ENOENT) + desc = of_find_arizona_gpio(dev, con_id, &of_flags); + ++ if (PTR_ERR(desc) == -ENOENT) ++ desc = of_find_usb_gpio(dev, con_id, &of_flags); ++ + if (IS_ERR(desc)) + return desc; + +diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c +index b498960ff72b5..b28facece43c4 100644 +--- a/drivers/usb/typec/tcpm/fusb302.c ++++ b/drivers/usb/typec/tcpm/fusb302.c +@@ -9,14 +9,13 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include + #include + #include + #include +-#include + #include + #include + #include +@@ -83,7 +82,7 @@ struct fusb302_chip { + struct work_struct irq_work; + bool irq_suspended; + bool irq_while_suspended; +- int gpio_int_n; ++ struct gpio_desc *gpio_int_n; + int gpio_int_n_irq; + struct extcon_dev *extcon; + +@@ -1618,30 +1617,17 @@ static void fusb302_irq_work(struct work_struct *work) + + static int init_gpio(struct fusb302_chip *chip) + { +- struct device_node *node; ++ struct device *dev = chip->dev; + int ret = 0; + +- node = chip->dev->of_node; +- chip->gpio_int_n = of_get_named_gpio(node, "fcs,int_n", 0); +- if (!gpio_is_valid(chip->gpio_int_n)) { +- ret = chip->gpio_int_n; +- dev_err(chip->dev, "cannot get named GPIO Int_N, ret=%d", ret); +- return ret; +- } +- ret = devm_gpio_request(chip->dev, chip->gpio_int_n, "fcs,int_n"); +- if (ret < 0) { +- dev_err(chip->dev, "cannot request GPIO Int_N, ret=%d", ret); +- return ret; +- } +- ret = gpio_direction_input(chip->gpio_int_n); +- if (ret < 0) { +- dev_err(chip->dev, +- "cannot set GPIO Int_N to input, ret=%d", ret); +- return ret; ++ chip->gpio_int_n = devm_gpiod_get(dev, "fcs,int_n", GPIOD_IN); ++ if (IS_ERR(chip->gpio_int_n)) { ++ dev_err(dev, "failed to request gpio_int_n\n"); ++ return PTR_ERR(chip->gpio_int_n); + } +- ret = gpio_to_irq(chip->gpio_int_n); ++ ret = gpiod_to_irq(chip->gpio_int_n); + if (ret < 0) { +- dev_err(chip->dev, ++ dev_err(dev, + "cannot request IRQ for GPIO Int_N, ret=%d", ret); + return ret; + } +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Add-a-few-new-vmmdev-request-types-to-the-.patch b/SOURCES/0001-virt-vbox-Add-a-few-new-vmmdev-request-types-to-the-.patch new file mode 100644 index 0000000..92c93e8 --- /dev/null +++ b/SOURCES/0001-virt-vbox-Add-a-few-new-vmmdev-request-types-to-the-.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 11:05:40 +0200 +Subject: [PATCH] virt: vbox: Add a few new vmmdev request types to the + userspace whitelist + +Upstream VirtualBox has defined and is using a few new request types for +vmmdev requests passed through /dev/vboxguest to the hypervisor. + +Add the defines for these to vbox_vmmdev_types.h and add add them to the +whitelists of vmmdev requests which userspace is allowed to make. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1789545 +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 2 ++ + include/uapi/linux/vbox_vmmdev_types.h | 3 +++ + 2 files changed, 5 insertions(+) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index 4f1addaa3f6f..ffd76b949276 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -1299,7 +1299,9 @@ static int vbg_req_allowed(struct vbg_dev *gdev, struct vbg_session *session, + case VMMDEVREQ_VIDEO_ACCEL_ENABLE: + case VMMDEVREQ_VIDEO_ACCEL_FLUSH: + case VMMDEVREQ_VIDEO_SET_VISIBLE_REGION: ++ case VMMDEVREQ_VIDEO_UPDATE_MONITOR_POSITIONS: + case VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX: ++ case VMMDEVREQ_GET_DISPLAY_CHANGE_REQ_MULTI: + case VMMDEVREQ_GET_SEAMLESS_CHANGE_REQ: + case VMMDEVREQ_GET_VRDPCHANGE_REQ: + case VMMDEVREQ_LOG_STRING: +diff --git a/include/uapi/linux/vbox_vmmdev_types.h b/include/uapi/linux/vbox_vmmdev_types.h +index c27289fd619a..f8a8d6b3c521 100644 +--- a/include/uapi/linux/vbox_vmmdev_types.h ++++ b/include/uapi/linux/vbox_vmmdev_types.h +@@ -63,6 +63,7 @@ enum vmmdev_request_type { + VMMDEVREQ_SET_GUEST_CAPABILITIES = 56, + VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57, /* since version 3.2.0 */ + VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80, /* since version 4.2.4 */ ++ VMMDEVREQ_GET_DISPLAY_CHANGE_REQ_MULTI = 81, + VMMDEVREQ_HGCM_CONNECT = 60, + VMMDEVREQ_HGCM_DISCONNECT = 61, + VMMDEVREQ_HGCM_CALL32 = 62, +@@ -92,6 +93,8 @@ enum vmmdev_request_type { + VMMDEVREQ_WRITE_COREDUMP = 218, + VMMDEVREQ_GUEST_HEARTBEAT = 219, + VMMDEVREQ_HEARTBEAT_CONFIGURE = 220, ++ VMMDEVREQ_NT_BUG_CHECK = 221, ++ VMMDEVREQ_VIDEO_UPDATE_MONITOR_POSITIONS = 222, + /* Ensure the enum is a 32 bit data-type */ + VMMDEVREQ_SIZEHACK = 0x7fffffff + }; +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch b/SOURCES/0001-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch new file mode 100644 index 0000000..c001fe5 --- /dev/null +++ b/SOURCES/0001-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch @@ -0,0 +1,320 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 18:04:30 +0200 +Subject: [PATCH] virt: vbox: Add support for the new + VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES ioctl + +Add support for the new VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES ioctl, this +is necessary for automatic resizing of the guest resolution to match the +VM-window size to work with the new VMSVGA virtual GPU which is now the +new default in VirtualBox. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1789545 +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 163 +++++++++++++++++++++++- + drivers/virt/vboxguest/vboxguest_core.h | 14 ++ + include/uapi/linux/vboxguest.h | 24 ++++ + 3 files changed, 200 insertions(+), 1 deletion(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index 15b3cb618c6e..4f1addaa3f6f 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -679,7 +679,7 @@ static int vbg_set_host_capabilities(struct vbg_dev *gdev, + + WARN_ON(!mutex_is_locked(&gdev->session_mutex)); + +- caps = gdev->set_guest_caps_tracker.mask; ++ caps = gdev->acquired_guest_caps | gdev->set_guest_caps_tracker.mask; + + if (gdev->guest_caps_host == caps) + return 0; +@@ -703,6 +703,113 @@ static int vbg_set_host_capabilities(struct vbg_dev *gdev, + return vbg_status_code_to_errno(rc); + } + ++/** ++ * Acquire (get exclusive access) guest capabilities for a session. ++ * Takes the session mutex. ++ * Return: 0 or negative errno value. ++ * @gdev: The Guest extension device. ++ * @session: The session. ++ * @flags: Flags (VBGL_IOC_AGC_FLAGS_XXX). ++ * @or_mask: The capabilities to add. ++ * @not_mask: The capabilities to remove. ++ * @session_termination: Set if we're called by the session cleanup code. ++ * This tweaks the error handling so we perform ++ * proper session cleanup even if the host ++ * misbehaves. ++ */ ++static int vbg_acquire_session_capabilities(struct vbg_dev *gdev, ++ struct vbg_session *session, ++ u32 or_mask, u32 not_mask, ++ u32 flags, bool session_termination) ++{ ++ unsigned long irqflags; ++ bool wakeup = false; ++ int ret = 0; ++ ++ mutex_lock(&gdev->session_mutex); ++ ++ if (gdev->set_guest_caps_tracker.mask & or_mask) { ++ vbg_err("%s error: cannot acquire caps which are currently set\n", ++ __func__); ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ /* ++ * Mark any caps in the or_mask as now being in acquire-mode. Note ++ * once caps are in acquire_mode they always stay in this mode. ++ * This impacts event handling, so we take the event-lock. ++ */ ++ spin_lock_irqsave(&gdev->event_spinlock, irqflags); ++ gdev->acquire_mode_guest_caps |= or_mask; ++ spin_unlock_irqrestore(&gdev->event_spinlock, irqflags); ++ ++ /* If we only have to switch the caps to acquire mode, we're done. */ ++ if (flags & VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE) ++ goto out; ++ ++ not_mask &= ~or_mask; /* or_mask takes priority over not_mask */ ++ not_mask &= session->acquired_guest_caps; ++ or_mask &= ~session->acquired_guest_caps; ++ ++ if (or_mask == 0 && not_mask == 0) ++ goto out; ++ ++ if (gdev->acquired_guest_caps & or_mask) { ++ ret = -EBUSY; ++ goto out; ++ } ++ ++ gdev->acquired_guest_caps |= or_mask; ++ gdev->acquired_guest_caps &= ~not_mask; ++ /* session->acquired_guest_caps impacts event handling, take the lock */ ++ spin_lock_irqsave(&gdev->event_spinlock, irqflags); ++ session->acquired_guest_caps |= or_mask; ++ session->acquired_guest_caps &= ~not_mask; ++ spin_unlock_irqrestore(&gdev->event_spinlock, irqflags); ++ ++ ret = vbg_set_host_capabilities(gdev, session, session_termination); ++ /* Roll back on failure, unless it's session termination time. */ ++ if (ret < 0 && !session_termination) { ++ gdev->acquired_guest_caps &= ~or_mask; ++ gdev->acquired_guest_caps |= not_mask; ++ spin_lock_irqsave(&gdev->event_spinlock, irqflags); ++ session->acquired_guest_caps &= ~or_mask; ++ session->acquired_guest_caps |= not_mask; ++ spin_unlock_irqrestore(&gdev->event_spinlock, irqflags); ++ } ++ ++ /* ++ * If we added a capability, check if that means some other thread in ++ * our session should be unblocked because there are events pending ++ * (the result of vbg_get_allowed_event_mask_for_session() may change). ++ * ++ * HACK ALERT! When the seamless support capability is added we generate ++ * a seamless change event so that the ring-3 client can sync with ++ * the seamless state. ++ */ ++ if (ret == 0 && or_mask != 0) { ++ spin_lock_irqsave(&gdev->event_spinlock, irqflags); ++ ++ if (or_mask & VMMDEV_GUEST_SUPPORTS_SEAMLESS) ++ gdev->pending_events |= ++ VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST; ++ ++ if (gdev->pending_events) ++ wakeup = true; ++ ++ spin_unlock_irqrestore(&gdev->event_spinlock, irqflags); ++ ++ if (wakeup) ++ wake_up(&gdev->event_wq); ++ } ++ ++out: ++ mutex_unlock(&gdev->session_mutex); ++ ++ return ret; ++} ++ + /** + * Sets the guest capabilities for a session. Takes the session spinlock. + * Return: 0 or negative errno value. +@@ -725,6 +832,13 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, + + mutex_lock(&gdev->session_mutex); + ++ if (gdev->acquire_mode_guest_caps & or_mask) { ++ vbg_err("%s error: cannot set caps which are in acquire_mode\n", ++ __func__); ++ ret = -EBUSY; ++ goto out; ++ } ++ + /* Apply the changes to the session mask. */ + previous = session->set_guest_caps; + session->set_guest_caps |= or_mask; +@@ -962,6 +1076,7 @@ void vbg_core_close_session(struct vbg_session *session) + struct vbg_dev *gdev = session->gdev; + int i, rc; + ++ vbg_acquire_session_capabilities(gdev, session, 0, U32_MAX, 0, true); + vbg_set_session_capabilities(gdev, session, 0, U32_MAX, true); + vbg_set_session_event_filter(gdev, session, 0, U32_MAX, true); + +@@ -1019,6 +1134,25 @@ static int vbg_ioctl_driver_version_info( + return 0; + } + ++/* Must be called with the event_lock held */ ++static u32 vbg_get_allowed_event_mask_for_session(struct vbg_dev *gdev, ++ struct vbg_session *session) ++{ ++ u32 acquire_mode_caps = gdev->acquire_mode_guest_caps; ++ u32 session_acquired_caps = session->acquired_guest_caps; ++ u32 allowed_events = VMMDEV_EVENT_VALID_EVENT_MASK; ++ ++ if ((acquire_mode_caps & VMMDEV_GUEST_SUPPORTS_GRAPHICS) && ++ !(session_acquired_caps & VMMDEV_GUEST_SUPPORTS_GRAPHICS)) ++ allowed_events &= ~VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST; ++ ++ if ((acquire_mode_caps & VMMDEV_GUEST_SUPPORTS_SEAMLESS) && ++ !(session_acquired_caps & VMMDEV_GUEST_SUPPORTS_SEAMLESS)) ++ allowed_events &= ~VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST; ++ ++ return allowed_events; ++} ++ + static bool vbg_wait_event_cond(struct vbg_dev *gdev, + struct vbg_session *session, + u32 event_mask) +@@ -1030,6 +1164,7 @@ static bool vbg_wait_event_cond(struct vbg_dev *gdev, + spin_lock_irqsave(&gdev->event_spinlock, flags); + + events = gdev->pending_events & event_mask; ++ events &= vbg_get_allowed_event_mask_for_session(gdev, session); + wakeup = events || session->cancel_waiters; + + spin_unlock_irqrestore(&gdev->event_spinlock, flags); +@@ -1044,6 +1179,7 @@ static u32 vbg_consume_events_locked(struct vbg_dev *gdev, + { + u32 events = gdev->pending_events & event_mask; + ++ events &= vbg_get_allowed_event_mask_for_session(gdev, session); + gdev->pending_events &= ~events; + return events; + } +@@ -1445,6 +1581,29 @@ static int vbg_ioctl_change_filter_mask(struct vbg_dev *gdev, + false); + } + ++static int vbg_ioctl_acquire_guest_capabilities(struct vbg_dev *gdev, ++ struct vbg_session *session, ++ struct vbg_ioctl_acquire_guest_caps *caps) ++{ ++ u32 flags, or_mask, not_mask; ++ ++ if (vbg_ioctl_chk(&caps->hdr, sizeof(caps->u.in), 0)) ++ return -EINVAL; ++ ++ flags = caps->u.in.flags; ++ or_mask = caps->u.in.or_mask; ++ not_mask = caps->u.in.not_mask; ++ ++ if (flags & ~VBGL_IOC_AGC_FLAGS_VALID_MASK) ++ return -EINVAL; ++ ++ if ((or_mask | not_mask) & ~VMMDEV_GUEST_CAPABILITIES_MASK) ++ return -EINVAL; ++ ++ return vbg_acquire_session_capabilities(gdev, session, or_mask, ++ not_mask, flags, false); ++} ++ + static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev, + struct vbg_session *session, struct vbg_ioctl_set_guest_caps *caps) + { +@@ -1554,6 +1713,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) + return vbg_ioctl_interrupt_all_wait_events(gdev, session, data); + case VBG_IOCTL_CHANGE_FILTER_MASK: + return vbg_ioctl_change_filter_mask(gdev, session, data); ++ case VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES: ++ return vbg_ioctl_acquire_guest_capabilities(gdev, session, data); + case VBG_IOCTL_CHANGE_GUEST_CAPABILITIES: + return vbg_ioctl_change_guest_capabilities(gdev, session, data); + case VBG_IOCTL_CHECK_BALLOON: +diff --git a/drivers/virt/vboxguest/vboxguest_core.h b/drivers/virt/vboxguest/vboxguest_core.h +index dc745a033164..ab4bf64e2cec 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.h ++++ b/drivers/virt/vboxguest/vboxguest_core.h +@@ -117,6 +117,15 @@ struct vbg_dev { + */ + u32 event_filter_host; + ++ /** ++ * Guest capabilities which have been switched to acquire_mode. ++ */ ++ u32 acquire_mode_guest_caps; ++ /** ++ * Guest capabilities acquired by vbg_acquire_session_capabilities(). ++ * Only one session can acquire a capability at a time. ++ */ ++ u32 acquired_guest_caps; + /** + * Usage counters for guest capabilities requested through + * vbg_set_session_capabilities(). Indexed by capability bit +@@ -164,6 +173,11 @@ struct vbg_session { + * host filter. Protected by vbg_gdev.session_mutex. + */ + u32 event_filter; ++ /** ++ * Guest capabilities acquired by vbg_acquire_session_capabilities(). ++ * Only one session can acquire a capability at a time. ++ */ ++ u32 acquired_guest_caps; + /** + * Guest capabilities set through vbg_set_session_capabilities(). + * A capability claimed by any guest session will be reported to the +diff --git a/include/uapi/linux/vboxguest.h b/include/uapi/linux/vboxguest.h +index f79d7abe27db..15125f6ec60d 100644 +--- a/include/uapi/linux/vboxguest.h ++++ b/include/uapi/linux/vboxguest.h +@@ -257,6 +257,30 @@ VMMDEV_ASSERT_SIZE(vbg_ioctl_change_filter, 24 + 8); + _IOWR('V', 12, struct vbg_ioctl_change_filter) + + ++/** VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES data structure. */ ++struct vbg_ioctl_acquire_guest_caps { ++ /** The header. */ ++ struct vbg_ioctl_hdr hdr; ++ union { ++ struct { ++ /** Flags (VBGL_IOC_AGC_FLAGS_XXX). */ ++ __u32 flags; ++ /** Capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */ ++ __u32 or_mask; ++ /** Capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */ ++ __u32 not_mask; ++ } in; ++ } u; ++}; ++VMMDEV_ASSERT_SIZE(vbg_ioctl_acquire_guest_caps, 24 + 12); ++ ++#define VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE 0x00000001 ++#define VBGL_IOC_AGC_FLAGS_VALID_MASK 0x00000001 ++ ++#define VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES \ ++ _IOWR('V', 13, struct vbg_ioctl_acquire_guest_caps) ++ ++ + /** VBG_IOCTL_CHANGE_GUEST_CAPABILITIES data structure. */ + struct vbg_ioctl_set_guest_caps { + /** The header. */ +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Add-vbg_set_host_capabilities-helper-funct.patch b/SOURCES/0001-virt-vbox-Add-vbg_set_host_capabilities-helper-funct.patch new file mode 100644 index 0000000..3362ead --- /dev/null +++ b/SOURCES/0001-virt-vbox-Add-vbg_set_host_capabilities-helper-funct.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 15:30:29 +0200 +Subject: [PATCH] virt: vbox: Add vbg_set_host_capabilities() helper function + +Add vbg_set_host_capabilities() helper function, this is a preparation +patch for adding support for the VBGL_IOCTL_GUEST_CAPS_ACQUIRE ioctl. + +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 79 ++++++++++++++----------- + 1 file changed, 46 insertions(+), 33 deletions(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index aee5eff229f2..15b3cb618c6e 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -661,6 +661,48 @@ static int vbg_reset_host_capabilities(struct vbg_dev *gdev) + return vbg_status_code_to_errno(rc); + } + ++/** ++ * Set guest capabilities on the host. ++ * Must be called with gdev->session_mutex hold. ++ * Return: 0 or negative errno value. ++ * @gdev: The Guest extension device. ++ * @session: The session. ++ * @session_termination: Set if we're called by the session cleanup code. ++ */ ++static int vbg_set_host_capabilities(struct vbg_dev *gdev, ++ struct vbg_session *session, ++ bool session_termination) ++{ ++ struct vmmdev_mask *req; ++ u32 caps; ++ int rc; ++ ++ WARN_ON(!mutex_is_locked(&gdev->session_mutex)); ++ ++ caps = gdev->set_guest_caps_tracker.mask; ++ ++ if (gdev->guest_caps_host == caps) ++ return 0; ++ ++ /* On termination the requestor is the kernel, as we're cleaning up. */ ++ req = vbg_req_alloc(sizeof(*req), VMMDEVREQ_SET_GUEST_CAPABILITIES, ++ session_termination ? VBG_KERNEL_REQUEST : ++ session->requestor); ++ if (!req) { ++ gdev->guest_caps_host = U32_MAX; ++ return -ENOMEM; ++ } ++ ++ req->or_mask = caps; ++ req->not_mask = ~caps; ++ rc = vbg_req_perform(gdev, req); ++ vbg_req_free(req, sizeof(*req)); ++ ++ gdev->guest_caps_host = (rc >= 0) ? caps : U32_MAX; ++ ++ return vbg_status_code_to_errno(rc); ++} ++ + /** + * Sets the guest capabilities for a session. Takes the session spinlock. + * Return: 0 or negative errno value. +@@ -678,23 +720,8 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, + u32 or_mask, u32 not_mask, + bool session_termination) + { +- struct vmmdev_mask *req; + u32 changed, previous; +- int rc, ret = 0; +- +- /* +- * Allocate a request buffer before taking the spinlock, when +- * the session is being terminated the requestor is the kernel, +- * as we're cleaning up. +- */ +- req = vbg_req_alloc(sizeof(*req), VMMDEVREQ_SET_GUEST_CAPABILITIES, +- session_termination ? VBG_KERNEL_REQUEST : +- session->requestor); +- if (!req) { +- if (!session_termination) +- return -ENOMEM; +- /* Ignore allocation failure, we must do session cleanup. */ +- } ++ int ret = 0; + + mutex_lock(&gdev->session_mutex); + +@@ -709,23 +736,10 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, + goto out; + + vbg_track_bit_usage(&gdev->set_guest_caps_tracker, changed, previous); +- or_mask = gdev->set_guest_caps_tracker.mask; +- +- if (gdev->guest_caps_host == or_mask || !req) +- goto out; +- +- gdev->guest_caps_host = or_mask; +- req->or_mask = or_mask; +- req->not_mask = ~or_mask; +- rc = vbg_req_perform(gdev, req); +- if (rc < 0) { +- ret = vbg_status_code_to_errno(rc); +- +- /* Failed, roll back (unless it's session termination time). */ +- gdev->guest_caps_host = U32_MAX; +- if (session_termination) +- goto out; + ++ ret = vbg_set_host_capabilities(gdev, session, session_termination); ++ /* Roll back on failure, unless it's session termination time. */ ++ if (ret < 0 && !session_termination) { + vbg_track_bit_usage(&gdev->set_guest_caps_tracker, changed, + session->set_guest_caps); + session->set_guest_caps = previous; +@@ -733,7 +747,6 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, + + out: + mutex_unlock(&gdev->session_mutex); +- vbg_req_free(req, sizeof(*req)); + + return ret; + } +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Fix-VBGL_IOCTL_VMMDEV_REQUEST_BIG-and-_LOG.patch b/SOURCES/0001-virt-vbox-Fix-VBGL_IOCTL_VMMDEV_REQUEST_BIG-and-_LOG.patch new file mode 100644 index 0000000..daf372e --- /dev/null +++ b/SOURCES/0001-virt-vbox-Fix-VBGL_IOCTL_VMMDEV_REQUEST_BIG-and-_LOG.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 12:21:30 +0200 +Subject: [PATCH] virt: vbox: Fix VBGL_IOCTL_VMMDEV_REQUEST_BIG and _LOG req + numbers to match upstream + +Until this commit the mainline kernel version (this version) of the +vboxguest module contained a bug where it defined +VBGL_IOCTL_VMMDEV_REQUEST_BIG and VBGL_IOCTL_LOG using +_IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead of +_IO(V, ...) as the out of tree VirtualBox upstream version does. + +Since the VirtualBox userspace bits are always built against VirtualBox +upstream's headers, this means that so far the mainline kernel version +of the vboxguest module has been failing these 2 ioctls with -ENOTTY. +I guess that VBGL_IOCTL_VMMDEV_REQUEST_BIG is never used causing us to +not hit that one and sofar the vboxguest driver has failed to actually +log any log messages passed it through VBGL_IOCTL_LOG. + +This commit changes the VBGL_IOCTL_VMMDEV_REQUEST_BIG and VBGL_IOCTL_LOG +defines to match the out of tree VirtualBox upstream vboxguest version, +while keeping compatibility with the old wrong request defines so as +to not break the kernel ABI in case someone has been using the old +request defines. + +Fixes: f6ddd094f579 ("virt: Add vboxguest driver for Virtual Box Guest integration UAPI") +Cc: stable@vger.kernel.org +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 4 +++- + drivers/virt/vboxguest/vboxguest_core.h | 15 +++++++++++++++ + drivers/virt/vboxguest/vboxguest_linux.c | 3 ++- + include/uapi/linux/vboxguest.h | 4 ++-- + 4 files changed, 22 insertions(+), 4 deletions(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index b690a8a4bf9e..8fab04e76c14 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -1520,7 +1520,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) + + /* For VMMDEV_REQUEST hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT */ + if (req_no_size == VBG_IOCTL_VMMDEV_REQUEST(0) || +- req == VBG_IOCTL_VMMDEV_REQUEST_BIG) ++ req == VBG_IOCTL_VMMDEV_REQUEST_BIG || ++ req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT) + return vbg_ioctl_vmmrequest(gdev, session, data); + + if (hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT) +@@ -1558,6 +1559,7 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) + case VBG_IOCTL_HGCM_CALL(0): + return vbg_ioctl_hgcm_call(gdev, session, f32bit, data); + case VBG_IOCTL_LOG(0): ++ case VBG_IOCTL_LOG_ALT(0): + return vbg_ioctl_log(data); + } + +diff --git a/drivers/virt/vboxguest/vboxguest_core.h b/drivers/virt/vboxguest/vboxguest_core.h +index 4188c12b839f..77c3a9c8255d 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.h ++++ b/drivers/virt/vboxguest/vboxguest_core.h +@@ -15,6 +15,21 @@ + #include + #include "vmmdev.h" + ++/* ++ * The mainline kernel version (this version) of the vboxguest module ++ * contained a bug where it defined VBGL_IOCTL_VMMDEV_REQUEST_BIG and ++ * VBGL_IOCTL_LOG using _IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead ++ * of _IO(V, ...) as the out of tree VirtualBox upstream version does. ++ * ++ * These _ALT definitions keep compatibility with the wrong defines the ++ * mainline kernel version used for a while. ++ * Note the VirtualBox userspace bits have always been built against ++ * VirtualBox upstream's headers, so this is likely not necessary. But ++ * we must never break our ABI so we keep these around to be 100% sure. ++ */ ++#define VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) ++#define VBG_IOCTL_LOG_ALT(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) ++ + struct vbg_session; + + /** VBox guest memory balloon. */ +diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c +index 6e8c0f1c1056..32c2c52f7e84 100644 +--- a/drivers/virt/vboxguest/vboxguest_linux.c ++++ b/drivers/virt/vboxguest/vboxguest_linux.c +@@ -131,7 +131,8 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, + * the need for a bounce-buffer and another copy later on. + */ + is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) || +- req == VBG_IOCTL_VMMDEV_REQUEST_BIG; ++ req == VBG_IOCTL_VMMDEV_REQUEST_BIG || ++ req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT; + + if (is_vmmdev_req) + buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT, +diff --git a/include/uapi/linux/vboxguest.h b/include/uapi/linux/vboxguest.h +index 9cec58a6a5ea..f79d7abe27db 100644 +--- a/include/uapi/linux/vboxguest.h ++++ b/include/uapi/linux/vboxguest.h +@@ -103,7 +103,7 @@ VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); + + + /* IOCTL to perform a VMM Device request larger then 1KB. */ +-#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) ++#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V', 3) + + + /** VBG_IOCTL_HGCM_CONNECT data structure. */ +@@ -198,7 +198,7 @@ struct vbg_ioctl_log { + } u; + }; + +-#define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) ++#define VBG_IOCTL_LOG(s) _IO('V', 9) + + + /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Fix-guest-capabilities-mask-check.patch b/SOURCES/0001-virt-vbox-Fix-guest-capabilities-mask-check.patch new file mode 100644 index 0000000..77dbde8 --- /dev/null +++ b/SOURCES/0001-virt-vbox-Fix-guest-capabilities-mask-check.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 13:23:06 +0200 +Subject: [PATCH] virt: vbox: Fix guest capabilities mask check + +Check the passed in capabilities against VMMDEV_GUEST_CAPABILITIES_MASK +instead of against VMMDEV_EVENT_VALID_EVENT_MASK. +This tightens the allowed mask from 0x7ff to 0x7. + +Fixes: 0ba002bc4393 ("virt: Add vboxguest driver for Virtual Box Guest integration") +Cc: stable@vger.kernel.org +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 2 +- + drivers/virt/vboxguest/vmmdev.h | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index 8fab04e76c14..18ebd7a6af98 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -1444,7 +1444,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev, + or_mask = caps->u.in.or_mask; + not_mask = caps->u.in.not_mask; + +- if ((or_mask | not_mask) & ~VMMDEV_EVENT_VALID_EVENT_MASK) ++ if ((or_mask | not_mask) & ~VMMDEV_GUEST_CAPABILITIES_MASK) + return -EINVAL; + + ret = vbg_set_session_capabilities(gdev, session, or_mask, not_mask, +diff --git a/drivers/virt/vboxguest/vmmdev.h b/drivers/virt/vboxguest/vmmdev.h +index 6337b8d75d96..21f408120e3f 100644 +--- a/drivers/virt/vboxguest/vmmdev.h ++++ b/drivers/virt/vboxguest/vmmdev.h +@@ -206,6 +206,8 @@ VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8); + * not. + */ + #define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2) ++/* The mask of valid capabilities, for sanity checking. */ ++#define VMMDEV_GUEST_CAPABILITIES_MASK 0x00000007U + + /** struct vmmdev_hypervisorinfo - Hypervisor info structure. */ + struct vmmdev_hypervisorinfo { +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Log-unknown-ioctl-requests-as-error.patch b/SOURCES/0001-virt-vbox-Log-unknown-ioctl-requests-as-error.patch new file mode 100644 index 0000000..b9a90c4 --- /dev/null +++ b/SOURCES/0001-virt-vbox-Log-unknown-ioctl-requests-as-error.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 11:24:43 +0200 +Subject: [PATCH] virt: vbox: Log unknown ioctl requests as error + +Every now and then upstream adds new ioctls without notifying us, +log unknown ioctl requests as an error to catch these. + +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index ffd76b949276..e0e343d0ba93 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -1739,7 +1739,7 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) + return vbg_ioctl_log(data); + } + +- vbg_debug("VGDrvCommonIoCtl: Unknown req %#08x\n", req); ++ vbg_err("Userspace made an unknown ioctl req %#08x\n", req); + return -ENOTTY; + } + +-- +2.26.2 + diff --git a/SOURCES/0001-virt-vbox-Rename-guest_caps-struct-members-to-set_gu.patch b/SOURCES/0001-virt-vbox-Rename-guest_caps-struct-members-to-set_gu.patch new file mode 100644 index 0000000..e92eac0 --- /dev/null +++ b/SOURCES/0001-virt-vbox-Rename-guest_caps-struct-members-to-set_gu.patch @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 19 May 2020 14:33:13 +0200 +Subject: [PATCH] virt: vbox: Rename guest_caps struct members to + set_guest_caps + +Rename guest_caps[_tracker] struct members to set_guest_caps[_tracker] +this is a preparation patch for adding support for the +VBGL_IOCTL_GUEST_CAPS_ACQUIRE ioctl. + +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/lkml/20200520195440.38759-1-hdegoede@redhat.com/ +--- + drivers/virt/vboxguest/vboxguest_core.c | 20 ++++++++++---------- + drivers/virt/vboxguest/vboxguest_core.h | 9 +++++---- + 2 files changed, 15 insertions(+), 14 deletions(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c +index 18ebd7a6af98..aee5eff229f2 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.c ++++ b/drivers/virt/vboxguest/vboxguest_core.c +@@ -699,17 +699,17 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, + mutex_lock(&gdev->session_mutex); + + /* Apply the changes to the session mask. */ +- previous = session->guest_caps; +- session->guest_caps |= or_mask; +- session->guest_caps &= ~not_mask; ++ previous = session->set_guest_caps; ++ session->set_guest_caps |= or_mask; ++ session->set_guest_caps &= ~not_mask; + + /* If anything actually changed, update the global usage counters. */ +- changed = previous ^ session->guest_caps; ++ changed = previous ^ session->set_guest_caps; + if (!changed) + goto out; + +- vbg_track_bit_usage(&gdev->guest_caps_tracker, changed, previous); +- or_mask = gdev->guest_caps_tracker.mask; ++ vbg_track_bit_usage(&gdev->set_guest_caps_tracker, changed, previous); ++ or_mask = gdev->set_guest_caps_tracker.mask; + + if (gdev->guest_caps_host == or_mask || !req) + goto out; +@@ -726,9 +726,9 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, + if (session_termination) + goto out; + +- vbg_track_bit_usage(&gdev->guest_caps_tracker, changed, +- session->guest_caps); +- session->guest_caps = previous; ++ vbg_track_bit_usage(&gdev->set_guest_caps_tracker, changed, ++ session->set_guest_caps); ++ session->set_guest_caps = previous; + } + + out: +@@ -1452,7 +1452,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev, + if (ret) + return ret; + +- caps->u.out.session_caps = session->guest_caps; ++ caps->u.out.session_caps = session->set_guest_caps; + caps->u.out.global_caps = gdev->guest_caps_host; + + return 0; +diff --git a/drivers/virt/vboxguest/vboxguest_core.h b/drivers/virt/vboxguest/vboxguest_core.h +index 77c3a9c8255d..dc745a033164 100644 +--- a/drivers/virt/vboxguest/vboxguest_core.h ++++ b/drivers/virt/vboxguest/vboxguest_core.h +@@ -118,11 +118,12 @@ struct vbg_dev { + u32 event_filter_host; + + /** +- * Usage counters for guest capabilities. Indexed by capability bit ++ * Usage counters for guest capabilities requested through ++ * vbg_set_session_capabilities(). Indexed by capability bit + * number, one count per session using a capability. + * Protected by session_mutex. + */ +- struct vbg_bit_usage_tracker guest_caps_tracker; ++ struct vbg_bit_usage_tracker set_guest_caps_tracker; + /** + * The guest capabilities last reported to the host (or UINT32_MAX). + * Protected by session_mutex. +@@ -164,11 +165,11 @@ struct vbg_session { + */ + u32 event_filter; + /** +- * Guest capabilities for this session. ++ * Guest capabilities set through vbg_set_session_capabilities(). + * A capability claimed by any guest session will be reported to the + * host. Protected by vbg_gdev.session_mutex. + */ +- u32 guest_caps; ++ u32 set_guest_caps; + /** VMMDEV_REQUESTOR_* flags */ + u32 requestor; + /** Set on CANCEL_ALL_WAITEVENTS, protected by vbg_devevent_spinlock. */ +-- +2.26.2 + diff --git a/SOURCES/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch b/SOURCES/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch new file mode 100644 index 0000000..0d05e02 --- /dev/null +++ b/SOURCES/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch @@ -0,0 +1,120 @@ +From 789d3f52a1cf675ba68c3578fe2b259bc44caba2 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:50 +0200 +Subject: [PATCH 02/13] dt-bindings: panel: Convert rocktech, jh057n00900 to + yaml + +Convert Rocktech MIPI DSI panel driver from txt to yaml bindings. + +Signed-off-by: Ondrej Jirman +--- + .../display/panel/rocktech,jh057n00900.txt | 23 ------- + .../display/panel/rocktech,jh057n00900.yaml | 66 +++++++++++++++++++ + 2 files changed, 66 insertions(+), 23 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt + create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml + +diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt +deleted file mode 100644 +index a372c5d846956..0000000000000 +--- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt ++++ /dev/null +@@ -1,23 +0,0 @@ +-Rocktech jh057n00900 5.5" 720x1440 TFT LCD panel +- +-Required properties: +-- compatible: should be "rocktech,jh057n00900" +-- reg: DSI virtual channel of the peripheral +-- reset-gpios: panel reset gpio +-- backlight: phandle of the backlight device attached to the panel +-- vcc-supply: phandle of the regulator that provides the vcc supply voltage. +-- iovcc-supply: phandle of the regulator that provides the iovcc supply +- voltage. +- +-Example: +- +- &mipi_dsi { +- panel@0 { +- compatible = "rocktech,jh057n00900"; +- reg = <0>; +- backlight = <&backlight>; +- reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; +- vcc-supply = <®_2v8_p>; +- iovcc-supply = <®_1v8_p>; +- }; +- }; +diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +new file mode 100644 +index 0000000000000..f97c48550741c +--- /dev/null ++++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +@@ -0,0 +1,66 @@ ++# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/display/panel/rocktech,jh057n00900.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Rocktech JH057N00900 5.5" 720x1440 TFT LCD panel ++ ++maintainers: ++ - Ondrej Jirman ++ ++description: | ++ Rocktech JH057N00900 is a 720x1440 TFT LCD panel ++ connected using a MIPI-DSI video interface. ++ ++allOf: ++ - $ref: panel-common.yaml# ++ ++properties: ++ compatible: ++ const: rocktech,jh057n00900 ++ ++ reg: ++ maxItems: 1 ++ description: DSI virtual channel ++ ++ vcc-supply: ++ description: Panel power supply ++ ++ vccio-supply: ++ description: I/O voltage supply ++ ++ reset-gpios: ++ description: GPIO used for the reset pin ++ maxItems: 1 ++ ++ backlight: ++ description: Backlight used by the panel ++ $ref: "/schemas/types.yaml#/definitions/phandle" ++ ++required: ++ - compatible ++ - reg ++ - vcc-supply ++ - vccio-supply ++ - reset-gpios ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ ++ dsi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ panel@0 { ++ compatible = "rocktech,jh057n00900"; ++ reg = <0>; ++ vcc-supply = <®_2v8_p>; ++ iovcc-supply = <®_1v8_p>; ++ reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; ++ backlight = <&backlight>; ++ }; ++ }; ++... +-- +2.26.2 + diff --git a/SOURCES/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch b/SOURCES/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch new file mode 100644 index 0000000..a7099de --- /dev/null +++ b/SOURCES/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch @@ -0,0 +1,37 @@ +From 12146093602e0dedb7ee431224fc4a58d40697f8 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:51 +0200 +Subject: [PATCH 03/13] dt-bindings: panel: Add compatible for Xingbangda + XBD599 panel + +Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI LCD panel. It is based on +Sitronix ST7703 LCD controller just like rocktech,jh057n00900. It is +used in PinePhone. + +Add a compatible for it. + +Signed-off-by: Ondrej Jirman +--- + .../bindings/display/panel/rocktech,jh057n00900.yaml | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +index f97c48550741c..4d43a1b36d7c7 100644 +--- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml ++++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +@@ -18,7 +18,11 @@ allOf: + + properties: + compatible: +- const: rocktech,jh057n00900 ++ enum: ++ # Rocktech JH057N00900 5.5" 720x1440 TFT LCD panel ++ - rocktech,jh057n00900 ++ # Xingbangda XBD599 5.99" 720x1440 TFT LCD panel ++ - xingbangda,xbd599 + + reg: + maxItems: 1 +-- +2.26.2 + diff --git a/SOURCES/0003-glitched-base.patch b/SOURCES/0003-glitched-base.patch new file mode 100644 index 0000000..60e1d44 --- /dev/null +++ b/SOURCES/0003-glitched-base.patch @@ -0,0 +1,447 @@ +From 43e519023ea4a79fc6a771bb9ebbb0cfe5fa39bc Mon Sep 17 00:00:00 2001 +From: Sentry +Date: Sun, 12 Jul 2020 20:43:50 +0200 +Subject: [PATCH] glitched base + +--- + .../admin-guide/kernel-parameters.txt | 3 ++ + block/elevator.c | 6 ++-- + drivers/cpufreq/intel_pstate.c | 2 ++ + drivers/infiniband/core/addr.c | 1 + + drivers/tty/Kconfig | 13 ++++++++ + fs/dcache.c | 2 +- + include/linux/blkdev.h | 7 +++- + include/linux/compiler_types.h | 4 +++ + include/linux/mm.h | 5 ++- + include/uapi/linux/vt.h | 15 ++++++++- + init/Kconfig | 33 ++++++++++++++++++- + kernel/sched/core.c | 6 ++-- + kernel/sched/fair.c | 25 ++++++++++++++ + mm/huge_memory.c | 4 +++ + mm/page-writeback.c | 8 +++++ + mm/page_alloc.c | 2 +- + net/ipv4/Kconfig | 4 +++ + net/sched/Kconfig | 4 +++ + scripts/mkcompile_h | 4 +-- + scripts/setlocalversion | 2 +- + 20 files changed, 133 insertions(+), 17 deletions(-) + +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 7bc83f3d9..d31f0323c 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -1826,6 +1826,9 @@ + disable + Do not enable intel_pstate as the default + scaling driver for the supported processors ++ enable ++ Enable intel_pstate in-case "disable" was passed ++ previously in the kernel boot parameters + passive + Use intel_pstate as a scaling driver, but configure it + to work with generic cpufreq governors (instead of +diff --git a/block/elevator.c b/block/elevator.c +index 4eab3d70e..79669aa39 100644 +--- a/block/elevator.c ++++ b/block/elevator.c +@@ -623,15 +623,15 @@ static inline bool elv_support_iosched(struct request_queue *q) + } + + /* +- * For single queue devices, default to using mq-deadline. If we have multiple +- * queues or mq-deadline is not available, default to "none". ++ * For single queue devices, default to using bfq. If we have multiple ++ * queues or bfq is not available, default to "none". + */ + static struct elevator_type *elevator_get_default(struct request_queue *q) + { + if (q->nr_hw_queues != 1) + return NULL; + +- return elevator_get(q, "mq-deadline", false); ++ return elevator_get(q, "bfq", false); + } + + /* +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 4d3429b20..8bf9e0adf 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -2824,6 +2824,8 @@ static int __init intel_pstate_setup(char *str) + pr_info("HWP disabled\n"); + no_hwp = 1; + } ++ if (!strcmp(str, "enable")) ++ no_load = 0; + if (!strcmp(str, "force")) + force_load = 1; + if (!strcmp(str, "hwp_only")) +diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c +index 1753a9801..184b30282 100644 +--- a/drivers/infiniband/core/addr.c ++++ b/drivers/infiniband/core/addr.c +@@ -816,6 +816,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, + union { + struct sockaddr_in _sockaddr_in; + struct sockaddr_in6 _sockaddr_in6; ++ struct sockaddr_ib _sockaddr_ib; + } sgid_addr, dgid_addr; + int ret; + +diff --git a/fs/dcache.c b/fs/dcache.c +index b280e07e1..74e90f940 100644 +--- a/fs/dcache.c ++++ b/fs/dcache.c +@@ -71,7 +71,7 @@ + * If no ancestor relationship: + * arbitrary, since it's serialized on rename_lock + */ +-int sysctl_vfs_cache_pressure __read_mostly = 100; ++int sysctl_vfs_cache_pressure __read_mostly = 50; + EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); + + __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock); +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index 32868fbed..f028c8070 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -45,7 +45,11 @@ struct blk_queue_stats; + struct blk_stat_callback; + + #define BLKDEV_MIN_RQ 4 ++#ifdef CONFIG_ZENIFY ++#define BLKDEV_MAX_RQ 512 ++#else + #define BLKDEV_MAX_RQ 128 /* Default maximum */ ++#endif + + /* Must be consistent with blk_mq_poll_stats_bkt() */ + #define BLK_MQ_POLL_STATS_BKTS 16 +@@ -614,7 +618,8 @@ struct request_queue { + #define QUEUE_FLAG_RQ_ALLOC_TIME 27 /* record rq->alloc_time_ns */ + + #define QUEUE_FLAG_MQ_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ +- (1 << QUEUE_FLAG_SAME_COMP)) ++ (1 << QUEUE_FLAG_SAME_COMP) | \ ++ (1 << QUEUE_FLAG_SAME_FORCE)) + + void blk_queue_flag_set(unsigned int flag, struct request_queue *q); + void blk_queue_flag_clear(unsigned int flag, struct request_queue *q); +diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h +index e970f97a7..f3aa9e6c4 100644 +--- a/include/linux/compiler_types.h ++++ b/include/linux/compiler_types.h +@@ -207,6 +207,10 @@ struct ftrace_likely_data { + # define __no_fgcse + #endif + ++#ifndef asm_volatile_goto ++#define asm_volatile_goto(x...) asm goto(x) ++#endif ++ + /* Are two types/vars the same type (ignoring qualifiers)? */ + #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) + +diff --git a/include/linux/mm.h b/include/linux/mm.h +index f3fe73718..8fb564dbb 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -189,8 +189,7 @@ static inline void __mm_zero_struct_page(struct page *page) + * not a hard limit any more. Although some userspace tools can be surprised by + * that. + */ +-#define MAPCOUNT_ELF_CORE_MARGIN (5) +-#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN) ++#define DEFAULT_MAX_MAP_COUNT (262144) + + extern int sysctl_max_map_count; + +@@ -2613,7 +2612,7 @@ int __must_check write_one_page(struct page *page); + void task_dirty_inc(struct task_struct *tsk); + + /* readahead.c */ +-#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE) ++#define VM_READAHEAD_PAGES (SZ_2M / PAGE_SIZE) + + int force_page_cache_readahead(struct address_space *mapping, struct file *filp, + pgoff_t offset, unsigned long nr_to_read); +diff --git a/init/Kconfig b/init/Kconfig +index 74a5ac656..bc63ba750 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -61,6 +61,38 @@ config THREAD_INFO_IN_TASK + + menu "General setup" + ++config ZENIFY ++ bool "A selection of patches from Zen/Liquorix kernel and additional tweaks for a better gaming experience" ++ default y ++ help ++ Tunes the kernel for responsiveness at the cost of throughput and power usage. ++ ++ --- Virtual Memory Subsystem --------------------------- ++ ++ Mem dirty before bg writeback..: 10 % -> 20 % ++ Mem dirty before sync writeback: 20 % -> 50 % ++ ++ --- Block Layer ---------------------------------------- ++ ++ Queue depth...............: 128 -> 512 ++ Default MQ scheduler......: mq-deadline -> bfq ++ ++ --- CFS CPU Scheduler ---------------------------------- ++ ++ Scheduling latency.............: 6 -> 3 ms ++ Minimal granularity............: 0.75 -> 0.3 ms ++ Wakeup granularity.............: 1 -> 0.5 ms ++ CPU migration cost.............: 0.5 -> 0.25 ms ++ Bandwidth slice size...........: 5 -> 3 ms ++ Ondemand fine upscaling limit..: 95 % -> 85 % ++ ++ --- MuQSS CPU Scheduler -------------------------------- ++ ++ Scheduling interval............: 6 -> 3 ms ++ ISO task max realtime use......: 70 % -> 25 % ++ Ondemand coarse upscaling limit: 80 % -> 45 % ++ Ondemand fine upscaling limit..: 95 % -> 45 % ++ + config BROKEN + bool + +@@ -1240,7 +1272,6 @@ config CC_OPTIMIZE_FOR_PERFORMANCE + + config CC_OPTIMIZE_FOR_PERFORMANCE_O3 + bool "Optimize more for performance (-O3)" +- depends on ARC + help + Choosing this option will pass "-O3" to your compiler to optimize + the kernel yet more for performance. +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 9a2fbf98f..630c93d66 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -57,7 +57,7 @@ const_debug unsigned int sysctl_sched_features = + * Number of tasks to iterate in a single balance run. + * Limited because this is done with IRQs disabled. + */ +-const_debug unsigned int sysctl_sched_nr_migrate = 32; ++const_debug unsigned int sysctl_sched_nr_migrate = 128; + + /* + * period over which we measure -rt task CPU usage in us. +@@ -69,9 +69,9 @@ __read_mostly int scheduler_running; + + /* + * part of the period that we allow rt tasks to run in us. +- * default: 0.95s ++ * XanMod default: 0.98s + */ +-int sysctl_sched_rt_runtime = 950000; ++int sysctl_sched_rt_runtime = 980000; + + /* + * __task_rq_lock - lock the rq @p resides on. +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index da3e5b547..0a8dc0e64 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -37,8 +37,13 @@ + * + * (default: 6ms * (1 + ilog(ncpus)), units: nanoseconds) + */ ++#ifdef CONFIG_ZENIFY ++unsigned int sysctl_sched_latency = 3000000ULL; ++static unsigned int normalized_sysctl_sched_latency = 3000000ULL; ++#else + unsigned int sysctl_sched_latency = 6000000ULL; + static unsigned int normalized_sysctl_sched_latency = 6000000ULL; ++#endif + + /* + * The initial- and re-scaling of tunables is configurable +@@ -58,13 +63,22 @@ enum sched_tunable_scaling sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_L + * + * (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds) + */ ++#ifdef CONFIG_ZENIFY ++unsigned int sysctl_sched_min_granularity = 300000ULL; ++static unsigned int normalized_sysctl_sched_min_granularity = 300000ULL; ++#else + unsigned int sysctl_sched_min_granularity = 750000ULL; + static unsigned int normalized_sysctl_sched_min_granularity = 750000ULL; ++#endif + + /* + * This value is kept at sysctl_sched_latency/sysctl_sched_min_granularity + */ ++#ifdef CONFIG_ZENIFY ++static unsigned int sched_nr_latency = 10; ++#else + static unsigned int sched_nr_latency = 8; ++#endif + + /* + * After fork, child runs first. If set to 0 (default) then +@@ -81,10 +95,17 @@ unsigned int sysctl_sched_child_runs_first __read_mostly; + * + * (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds) + */ ++#ifdef CONFIG_ZENIFY ++unsigned int sysctl_sched_wakeup_granularity = 500000UL; ++static unsigned int normalized_sysctl_sched_wakeup_granularity = 500000UL; ++ ++const_debug unsigned int sysctl_sched_migration_cost = 50000UL; ++#else + unsigned int sysctl_sched_wakeup_granularity = 1000000UL; + static unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL; + + const_debug unsigned int sysctl_sched_migration_cost = 500000UL; ++#endif + + int sched_thermal_decay_shift; + static int __init setup_sched_thermal_decay_shift(char *str) +@@ -128,8 +149,12 @@ int __weak arch_asym_cpu_priority(int cpu) + * + * (default: 5 msec, units: microseconds) + */ ++#ifdef CONFIG_ZENIFY ++unsigned int sysctl_sched_cfs_bandwidth_slice = 3000UL; ++#else + unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; + #endif ++#endif + + static inline void update_load_add(struct load_weight *lw, unsigned long inc) + { +diff --git a/mm/huge_memory.c b/mm/huge_memory.c +index 6ecd10451..8a3bdff2c 100644 +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -53,7 +53,11 @@ unsigned long transparent_hugepage_flags __read_mostly = + #ifdef CONFIG_TRANSPARENT_HUGEPAGE_MADVISE + (1< +Date: Fri, 26 Jun 2020 02:55:52 +0200 +Subject: [PATCH 04/13] drm/panel: rocktech-jh057n00900: Rename the driver to + st7703 + +This rename is done so that the driver matches the name of the +display controller and in preparation for adding support for more +panels to the driver. + +This is just a basic file rename, with no code changes. + +Signed-off-by: Ondrej Jirman +--- + drivers/gpu/drm/panel/Kconfig | 26 +++++++++---------- + drivers/gpu/drm/panel/Makefile | 2 +- + ...-jh057n00900.c => panel-sitronix-st7703.c} | 0 + 3 files changed, 14 insertions(+), 14 deletions(-) + rename drivers/gpu/drm/panel/{panel-rocktech-jh057n00900.c => panel-sitronix-st7703.c} (100%) + +diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig +index a1723c1b5fbf8..7cf1f160fdd51 100644 +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -262,19 +262,6 @@ config DRM_PANEL_RAYDIUM_RM68200 + Say Y here if you want to enable support for Raydium RM68200 + 720x1280 DSI video mode panel. + +-config DRM_PANEL_ROCKTECH_JH057N00900 +- tristate "Rocktech JH057N00900 MIPI touchscreen panel" +- depends on OF +- depends on DRM_MIPI_DSI +- depends on BACKLIGHT_CLASS_DEVICE +- help +- Say Y here if you want to enable support for Rocktech JH057N00900 +- MIPI DSI panel as e.g. used in the Librem 5 devkit. It has a +- resolution of 720x1440 pixels, a built in backlight and touch +- controller. +- Touch input support is provided by the goodix driver and needs to be +- selected separately. +- + config DRM_PANEL_RONBO_RB070D30 + tristate "Ronbo Electronics RB070D30 panel" + depends on OF +@@ -374,6 +361,19 @@ config DRM_PANEL_SITRONIX_ST7701 + ST7701 controller for 480X864 LCD panels with MIPI/RGB/SPI + system interfaces. + ++config DRM_PANEL_SITRONIX_ST7703 ++ tristate "Sitronix ST7703 based MIPI touchscreen panels" ++ depends on OF ++ depends on DRM_MIPI_DSI ++ depends on BACKLIGHT_CLASS_DEVICE ++ help ++ Say Y here if you want to enable support for Sitronix ST7703 based ++ panels, souch as Rocktech JH057N00900 MIPI DSI panel as e.g. used in ++ the Librem 5 devkit. It has a resolution of 720x1440 pixels, a built ++ in backlight and touch controller. ++ Touch input support is provided by the goodix driver and needs to be ++ selected separately. ++ + config DRM_PANEL_SITRONIX_ST7789V + tristate "Sitronix ST7789V panel" + depends on OF && SPI +diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile +index 96a883cd66305..0519fdf0710d5 100644 +--- a/drivers/gpu/drm/panel/Makefile ++++ b/drivers/gpu/drm/panel/Makefile +@@ -25,7 +25,6 @@ obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o + obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o + obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o + obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o +-obj-$(CONFIG_DRM_PANEL_ROCKTECH_JH057N00900) += panel-rocktech-jh057n00900.o + obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o + obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o + obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o +@@ -39,6 +38,7 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o + obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o + obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o + obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o ++obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o + obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o + obj-$(CONFIG_DRM_PANEL_SONY_ACX424AKP) += panel-sony-acx424akp.o + obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o +diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +similarity index 100% +rename from drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +rename to drivers/gpu/drm/panel/panel-sitronix-st7703.c +-- +2.26.2 + diff --git a/SOURCES/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch b/SOURCES/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch new file mode 100644 index 0000000..5432e1b --- /dev/null +++ b/SOURCES/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch @@ -0,0 +1,265 @@ +From 6fad8493b27ade51f37d88acc7ce6fd7dbc9da69 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:53 +0200 +Subject: [PATCH 05/13] drm/panel: st7703: Rename functions from jh057n prefix + to st7703 + +This is done so that code that's not specific to a particular +jh057n panel is named after the controller. Functions specific +to the panel are kept named after the panel. + +Signed-off-by: Ondrej Jirman +--- + drivers/gpu/drm/panel/panel-sitronix-st7703.c | 90 ++++++++++--------- + 1 file changed, 46 insertions(+), 44 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +index 38ff742bc1209..511af659f273b 100644 +--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c ++++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +@@ -1,6 +1,8 @@ + // SPDX-License-Identifier: GPL-2.0 + /* +- * Rockteck jh057n00900 5.5" MIPI-DSI panel driver ++ * Driver for panels based on Sitronix ST7703 controller, souch as: ++ * ++ * - Rocktech jh057n00900 5.5" MIPI-DSI panel + * + * Copyright (C) Purism SPC 2019 + */ +@@ -21,7 +23,7 @@ + #include + #include + +-#define DRV_NAME "panel-rocktech-jh057n00900" ++#define DRV_NAME "panel-sitronix-st7703" + + /* Manufacturer specific Commands send via DSI */ + #define ST7703_CMD_ALL_PIXEL_OFF 0x22 +@@ -45,7 +47,7 @@ + #define ST7703_CMD_SETGIP1 0xE9 + #define ST7703_CMD_SETGIP2 0xEA + +-struct jh057n { ++struct st7703 { + struct device *dev; + struct drm_panel panel; + struct gpio_desc *reset_gpio; +@@ -56,9 +58,9 @@ struct jh057n { + struct dentry *debugfs; + }; + +-static inline struct jh057n *panel_to_jh057n(struct drm_panel *panel) ++static inline struct st7703 *panel_to_st7703(struct drm_panel *panel) + { +- return container_of(panel, struct jh057n, panel); ++ return container_of(panel, struct st7703, panel); + } + + #define dsi_generic_write_seq(dsi, seq...) do { \ +@@ -69,7 +71,7 @@ static inline struct jh057n *panel_to_jh057n(struct drm_panel *panel) + return ret; \ + } while (0) + +-static int jh057n_init_sequence(struct jh057n *ctx) ++static int jh057n_init_sequence(struct st7703 *ctx) + { + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); + struct device *dev = ctx->dev; +@@ -141,9 +143,9 @@ static int jh057n_init_sequence(struct jh057n *ctx) + return 0; + } + +-static int jh057n_enable(struct drm_panel *panel) ++static int st7703_enable(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + int ret; + + ret = jh057n_init_sequence(ctx); +@@ -156,17 +158,17 @@ static int jh057n_enable(struct drm_panel *panel) + return 0; + } + +-static int jh057n_disable(struct drm_panel *panel) ++static int st7703_disable(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); + + return mipi_dsi_dcs_set_display_off(dsi); + } + +-static int jh057n_unprepare(struct drm_panel *panel) ++static int st7703_unprepare(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + + if (!ctx->prepared) + return 0; +@@ -178,9 +180,9 @@ static int jh057n_unprepare(struct drm_panel *panel) + return 0; + } + +-static int jh057n_prepare(struct drm_panel *panel) ++static int st7703_prepare(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + int ret; + + if (ctx->prepared) +@@ -230,10 +232,10 @@ static const struct drm_display_mode default_mode = { + .height_mm = 130, + }; + +-static int jh057n_get_modes(struct drm_panel *panel, ++static int st7703_get_modes(struct drm_panel *panel, + struct drm_connector *connector) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(connector->dev, &default_mode); +@@ -254,17 +256,17 @@ static int jh057n_get_modes(struct drm_panel *panel, + return 1; + } + +-static const struct drm_panel_funcs jh057n_drm_funcs = { +- .disable = jh057n_disable, +- .unprepare = jh057n_unprepare, +- .prepare = jh057n_prepare, +- .enable = jh057n_enable, +- .get_modes = jh057n_get_modes, ++static const struct drm_panel_funcs st7703_drm_funcs = { ++ .disable = st7703_disable, ++ .unprepare = st7703_unprepare, ++ .prepare = st7703_prepare, ++ .enable = st7703_enable, ++ .get_modes = st7703_get_modes, + }; + + static int allpixelson_set(void *data, u64 val) + { +- struct jh057n *ctx = data; ++ struct st7703 *ctx = data; + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); + + DRM_DEV_DEBUG_DRIVER(ctx->dev, "Setting all pixels on\n"); +@@ -282,7 +284,7 @@ static int allpixelson_set(void *data, u64 val) + DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL, + allpixelson_set, "%llu\n"); + +-static void jh057n_debugfs_init(struct jh057n *ctx) ++static void st7703_debugfs_init(struct st7703 *ctx) + { + ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL); + +@@ -290,16 +292,16 @@ static void jh057n_debugfs_init(struct jh057n *ctx) + &allpixelson_fops); + } + +-static void jh057n_debugfs_remove(struct jh057n *ctx) ++static void st7703_debugfs_remove(struct st7703 *ctx) + { + debugfs_remove_recursive(ctx->debugfs); + ctx->debugfs = NULL; + } + +-static int jh057n_probe(struct mipi_dsi_device *dsi) ++static int st7703_probe(struct mipi_dsi_device *dsi) + { + struct device *dev = &dsi->dev; +- struct jh057n *ctx; ++ struct st7703 *ctx; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); +@@ -340,7 +342,7 @@ static int jh057n_probe(struct mipi_dsi_device *dsi) + return ret; + } + +- drm_panel_init(&ctx->panel, dev, &jh057n_drm_funcs, ++ drm_panel_init(&ctx->panel, dev, &st7703_drm_funcs, + DRM_MODE_CONNECTOR_DSI); + + ret = drm_panel_of_backlight(&ctx->panel); +@@ -363,13 +365,13 @@ static int jh057n_probe(struct mipi_dsi_device *dsi) + default_mode.vrefresh, + mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); + +- jh057n_debugfs_init(ctx); ++ st7703_debugfs_init(ctx); + return 0; + } + +-static void jh057n_shutdown(struct mipi_dsi_device *dsi) ++static void st7703_shutdown(struct mipi_dsi_device *dsi) + { +- struct jh057n *ctx = mipi_dsi_get_drvdata(dsi); ++ struct st7703 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + + ret = drm_panel_unprepare(&ctx->panel); +@@ -383,12 +385,12 @@ static void jh057n_shutdown(struct mipi_dsi_device *dsi) + ret); + } + +-static int jh057n_remove(struct mipi_dsi_device *dsi) ++static int st7703_remove(struct mipi_dsi_device *dsi) + { +- struct jh057n *ctx = mipi_dsi_get_drvdata(dsi); ++ struct st7703 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + +- jh057n_shutdown(dsi); ++ st7703_shutdown(dsi); + + ret = mipi_dsi_detach(dsi); + if (ret < 0) +@@ -397,28 +399,28 @@ static int jh057n_remove(struct mipi_dsi_device *dsi) + + drm_panel_remove(&ctx->panel); + +- jh057n_debugfs_remove(ctx); ++ st7703_debugfs_remove(ctx); + + return 0; + } + +-static const struct of_device_id jh057n_of_match[] = { ++static const struct of_device_id st7703_of_match[] = { + { .compatible = "rocktech,jh057n00900" }, + { /* sentinel */ } + }; +-MODULE_DEVICE_TABLE(of, jh057n_of_match); ++MODULE_DEVICE_TABLE(of, st7703_of_match); + +-static struct mipi_dsi_driver jh057n_driver = { +- .probe = jh057n_probe, +- .remove = jh057n_remove, +- .shutdown = jh057n_shutdown, ++static struct mipi_dsi_driver st7703_driver = { ++ .probe = st7703_probe, ++ .remove = st7703_remove, ++ .shutdown = st7703_shutdown, + .driver = { + .name = DRV_NAME, +- .of_match_table = jh057n_of_match, ++ .of_match_table = st7703_of_match, + }, + }; +-module_mipi_dsi_driver(jh057n_driver); ++module_mipi_dsi_driver(st7703_driver); + + MODULE_AUTHOR("Guido GĂĽnther "); +-MODULE_DESCRIPTION("DRM driver for Rocktech JH057N00900 MIPI DSI panel"); ++MODULE_DESCRIPTION("DRM driver for Sitronix ST7703 based MIPI DSI panels"); + MODULE_LICENSE("GPL v2"); +-- +2.26.2 + diff --git a/SOURCES/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch b/SOURCES/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch new file mode 100644 index 0000000..8436ea3 --- /dev/null +++ b/SOURCES/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch @@ -0,0 +1,129 @@ +From 19802e031428f7cf967259fdf8794a971164a44a Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:54 +0200 +Subject: [PATCH 06/13] drm/panel: st7703: Prepare for supporting multiple + panels + +Parametrize the driver so that it can support more panels based +on st7703 controller. + +Signed-off-by: Ondrej Jirman +--- + drivers/gpu/drm/panel/panel-sitronix-st7703.c | 43 +++++++++++++------ + 1 file changed, 31 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +index 511af659f273b..08cbc316266c1 100644 +--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c ++++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + + #include