From db0e69132445d99098c15eaaf60844744514bb48 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 1 Feb 2024 11:55:36 -0500 Subject: [PATCH] Fixes for 6.6 Signed-off-by: Sasha Levin --- ...initialisation-of-netfs_inode-for-9p.patch | 98 ++ ...alabs-add-support-for-gaudi2c-device.patch | 112 ++ ...mory-failure-flags-as-mf_action_requ.patch | 144 +++ ...g-fix-null-pointer-dereference-check.patch | 59 + ...e-logic-of-getting-the-fake_pxm-valu.patch | 49 + ...uirk-for-the-colorful-x15-at-23-lapt.patch | 51 + ...e-of-read_seqbegin_or_lock-in-afs_fi.patch | 89 ++ ...e-of-read_seqbegin_or_lock-in-afs_lo.patch | 54 + ...t-fix-headset-auto-detect-fail-in-cx.patch | 200 +++ ...hda-intel-add-hda_arl-pci-id-support.patch | 41 + ...dspcfg-add-filters-for-arl-s-and-arl.patch | 49 + ...fer-to-correct-stream-index-at-loops.patch | 70 + ...idate-arch_irq_work_raise-prototypes.patch | 130 ++ .../arm-dts-imx-use-flash-0-0-pattern.patch | 81 ++ queue-6.6/arm-dts-imx1-fix-sram-node.patch | 53 + ...-28-fix-the-dma-controller-node-name.patch | 53 + ...nsa-use-preferred-i2c-gpios-properti.patch | 61 + ...ts-imx25-27-eukrea-fix-rtc-node-name.patch | 52 + queue-6.6/arm-dts-imx25-27-pass-timing0.patch | 138 ++ ...-imx25-fix-the-iim-compatible-string.patch | 40 + .../arm-dts-imx27-apf27dev-fix-led-name.patch | 39 + queue-6.6/arm-dts-imx27-fix-sram-node.patch | 37 + ...dts-imx7d-fix-coresight-funnel-ports.patch | 60 + .../arm-dts-imx7s-fix-lcdif-compatible.patch | 39 + ...imx7s-fix-nand-controller-size-cells.patch | 38 + ...vell-fix-some-common-switch-mistakes.patch | 725 +++++++++++ ...ts-qcom-mdm9615-fix-pmic-node-labels.patch | 96 ++ ...ts-qcom-msm8660-fix-pmic-node-labels.patch | 81 ++ ...ts-qcom-msm8960-fix-pmic-node-labels.patch | 64 + ...ts-qcom-strip-prefix-from-pmic-files.patch | 302 +++++ ...-rockchip-fix-rk3036-hdmi-ports-node.patch | 51 + ...exynos4-fix-camera-unit-addresses-ra.patch | 171 +++ ...s5pv210-fix-camera-unit-addresses-ra.patch | 89 ++ ...-amlogic-fix-format-for-s4-uart-node.patch | 66 + ...vell-fix-some-common-switch-mistakes.patch | 783 ++++++++++++ ...ix-coresight-warnings-in-in-ports-an.patch | 126 ++ ...sm8996-fix-in-ports-is-a-required-pr.patch | 63 + ...sm8998-fix-out-ports-is-a-required-p.patch | 88 ++ ...sm8350-fix-remoteproc-interrupt-type.patch | 66 + ...m8450-fix-soundwire-controllers-node.patch | 65 + ...m8550-fix-soundwire-controllers-node.patch | 65 + ...dd-clock-reference-for-pll2-on-ums51.patch | 35 + ...hange-ums512-idle-state-nodename-to-.patch | 36 + ...-set-the-correct-node-for-vmap-stack.patch | 100 ++ ...p-fix-clock-node-name-in-kv260-cards.patch | 117 ++ ...zynqmp-move-fixed-clock-to-for-kv260.patch | 117 ++ ...-sparse-happy-with-odd-sized-put_una.patch | 86 ++ ...d-new-dmi-entries-for-acp5x-platform.patch | 55 + ...undefined-snd_soc_dapm_nopm-argument.patch | 37 + ...nk-ack-before-setting-connection-in-.patch | 117 ++ ...fix-io-hang-from-sbitmap-wakeup-race.patch | 72 ++ ...-integer-overflow-in-bvec_try_merge_.patch | 36 + ...v-check-for-unlikely-string-overflow.patch | 88 ++ ...tooth-hci_sync-fix-br-edr-wakeup-bug.patch | 47 + ...oid-creating-child-socket-if-pa-sync.patch | 138 ++ ...ap-fix-possible-multiple-reject-send.patch | 42 + ...t-both-wideband_speech-and-le_states.patch | 35 + ...nomem-instead-of-bug-in-alb_upper_de.patch | 69 + ...ad_lock_trace_held-before-calling-bp.patch | 95 ++ ...lftest-failures-due-to-llvm18-change.patch | 99 ++ ...er-as-false-when-clearing-fd-array-d.patch | 127 ++ ...tch.count-as-zero-before-batched-upd.patch | 51 + ...-fix-enum-typo-in-br_cc_ccm_tx_parse.patch | 46 + ...eadlock-or-deadcode-of-misusing-dget.patch | 63 + ...-pointer-access-if-get_quota_realm-r.patch | 138 ++ ...e-mds-feature-bit-even-when-session-.patch | 45 + queue-6.6/cfi-add-cfi_noseal.patch | 58 + ...x-memory-leak-in-hi3620_mmc_clk_init.patch | 41 + ...qxp-fix-lvds-bypass-pixel-and-phy-cl.patch | 77 ++ ...8-fix-memory-leak-in-pxa168_clk_init.patch | 51 + ...util-use-a-fixed-reference-frequency.patch | 80 ++ ...fixed-and-coherent-frequency-for-sca.patch | 68 + ...o-octeontx2-fix-cptvf-driver-cleanup.patch | 71 + ...cm-avoid-wstringop-overflow-warnings.patch | 58 + ...rfive-fix-dev_err_probe-return-error.patch | 35 + ...32-crc32-fix-parsing-list-of-devices.patch | 46 + ...p-accessing-objects-after-releasing-.patch | 407 ++++++ ...v3-don-t-expose-sw_incr-event-in-sys.patch | 55 + ...fix-minor-issues-in-bw-allocation-ph.patch | 461 +++++++ ...y-fix-mst-pbn-x.y-value-calculations.patch | 57 + ...splay-fix-tiled-display-misalignment.patch | 43 + ...-fixing-stream-allocation-regression.patch | 42 + ...for-prefetch-mode-0-extend-prefetch-.patch | 124 ++ ...force-p-state-disallow-if-leaving-no.patch | 76 ++ ...make-flip_timestamp_in_us-a-64-bit-v.patch | 43 + ...-only-clear-symclk-otg-flag-for-hdmi.patch | 94 ++ ...y-fix-kzalloc-parameter-atom_tonga_p.patch | 47 + ...-the-rv2-system-aperture-fix-to-rn-c.patch | 97 ++ ...fence-check-in-to_amdgpu_amdkfd_fenc.patch | 45 + ...avg-vs-input-power-reporting-on-smu7.patch | 57 + ...-fix-ecc-irq-enable-disable-unpaired.patch | 124 ++ ...trace-event-amdgpu_bo_move-always-mo.patch | 114 ++ ...w-from-request_firmware-not-released.patch | 50 + ...ith-right-return-code-eio-in-amdgpu_.patch | 79 ++ ...m-amdgpu-let-kfd-sync-with-vm-fences.patch | 42 + ...se-adev-pm.fw-before-return-in-amdgp.patch | 48 + ...terator-used-outside-loop-in-kfd_add.patch | 64 + ...ix-lock-dependency-warning-with-srcu.patch | 103 ++ ...m-amdkfd-fix-lock-dependency-warning.patch | 145 +++ ...es-set-shader-debugger-process-manag.patch | 157 +++ ...ode-null-check-in-svm_range_get_rang.patch | 67 + ...flush-mes-process-context-if-mes-sup.patch | 39 + ...25-fix-set-hpd-irq-detect-window-to-.patch | 119 ++ ...le-fix-use-of-uninitialized-variable.patch | 43 + ...drm_atomic_helper_shutdown-at-shutdo.patch | 86 ++ queue-6.6/drm-fix-color-lut-rounding.patch | 100 ++ ...er-fix-use-of-uninitialized-variable.patch | 42 + ...i-dsi-fix-detach-call-without-attach.patch | 138 ++ ...dd-displayport-controller-for-sm8650.patch | 50 + ...m-msm-dpu-enable-writeback-on-sm8350.patch | 66 + ...m-msm-dpu-enable-writeback-on-sm8450.patch | 66 + ...-writeback-programming-for-yuv-cases.patch | 44 + ...dpu-ratelimit-framedone-timeout-msgs.patch | 62 + ...d-override_edid_mode-quirk-for-gener.patch | 112 ++ ...-mul_u32_u32-requires-linux-math64.h.patch | 45 + ...tfs-reject-casefold-directory-inodes.patch | 46 + ...odel-use-a-fixed-reference-frequency.patch | 63 + ...ompacted-indexes-for-block-size-4096.patch | 147 +++ ...acking-for-subpage-compressed-blocks.patch | 44 + ...e-resizing-failures-due-to-oversized.patch | 133 ++ ...stent-between-segment-fstrim-and-ful.patch | 66 + ...unnecessary-check-from-alloc_flex_gd.patch | 44 + ...f-range-as-exclusive-in-ext4_zero_ra.patch | 48 + ...-type-of-flexbg_size-to-unsigned-int.patch | 89 ++ ...ble-name-leak-in-extcon_dev_register.patch | 45 + ...k-return-value-of-f2fs_reserve_new_b.patch | 69 + ...gcing-flag-on-page-during-block-migr.patch | 64 + ...ointers-on-zoned-device-after-roll-f.patch | 37 + ...st_dput-handle-underflows-gracefully.patch | 78 ++ ...ray-index-out-of-bounds-in-dbadjtree.patch | 99 ++ queue-6.6/fs-kernfs-dir-obey-s_isgid.patch | 58 + ...n-make-pfn-accessors-statics-inlines.patch | 68 + ...sors-fix-failure-to-load-on-elitedes.patch | 272 ++++ ...x-fan-speed-set-failure-in-automatic.patch | 42 + ...pc87360-bounds-check-data-innr-usage.patch | 60 + ...rfive-fix-dev_err_probe-return-error.patch | 38 + ...mask-value-offset-for-i2c2-on-rv1126.patch | 46 + ...update-maximum-prescaler-value-for-i.patch | 59 + ...isable-behavior-to-block-all-traffic.patch | 120 ++ .../ib-ipoib-fix-mcast-list-locking.patch | 94 ++ ...ce_aq_vsi_q_opt_rss_-register-values.patch | 101 ++ queue-6.6/ice-fix-pre-shifted-bit-usage.patch | 121 ++ ...ss-firmware-cmds-when-stuck-in-reset.patch | 100 ++ .../ionic-pass-opcode-to-devcmd_wait.patch | 63 + ...ray-index-out-of-bounds-in-dbadjtree.patch | 239 ++++ ...rray-index-out-of-bounds-in-dinewext.patch | 78 ++ ...-slab-out-of-bounds-read-in-dtsearch.patch | 45 + .../jfs-fix-uaf-in-jfs_evict_inode.patch | 50 + ...-tool-fix-parsing-of-test-attributes.patch | 57 + ...kvm-s390-fix-setting-of-fpc-register.patch | 70 + ...ic-don-t-register-panic-notifier-if-.patch | 43 + ...pointer-dereference-in-bpf_object__c.patch | 73 ++ ...tial-uninitialized-tail-padding-with.patch | 207 +++ .../libsubcmd-fix-memory-leak-in-uniq.patch | 62 + ...2-fix-a-bug-for-mhuv2_sender_interru.patch | 60 + ...the-array-consult-the-superblock-of-.patch | 155 +++ ...move-mutext-lock-in-condition-of-wai.patch | 160 +++ ...ix-an-error-code-problem-in-ddb_prob.patch | 34 + ...i2c-imx335-fix-hblank-min-max-values.patch | 41 + ...as-vsp1-fix-references-to-pad-config.patch | 1137 +++++++++++++++++ queue-6.6/media-rkisp1-drop-irqf_shared.patch | 44 + ...ia-rkisp1-fix-irq-disable-race-issue.patch | 99 ++ ...rkisp1-fix-irq-handler-return-values.patch | 64 + ...izer-stop-manual-allocation-of-v4l2_.patch | 99 ++ queue-6.6/media-rkisp1-store-irq-lines.patch | 126 ++ ...ip-rga-fix-swizzling-for-rgb-formats.patch | 74 ++ ...xed-high-volume-of-stk1160_dbg-messa.patch | 47 + ...ix-power-line-control-for-a-chicony-.patch | 47 + ...ix-power-line-control-for-sunplusit-.patch | 64 + ...m335x_tscadc-fix-ti-soc-dependencies.patch | 35 + ...2c-add-missing-setting-of-the-reg_ct.patch | 60 + ...minate-double-free-in-error-handling.patch | 288 +++++ ...x-fix-mv88e6352_serdes_get_stats-err.patch | 102 ++ ...t-mdio-bus-of-node-on-qca8k_mdio_reg.patch | 96 ++ .../net-kcm-fix-direct-access-to-bv_len.patch | 37 + ...void-excessive-sleeps-in-polled-mode.patch | 139 ++ ...ix-passing-the-wrong-reference-for-c.patch | 54 + ...-fix-ts_info-value-in-case-of-no-phc.patch | 41 + ...seid-on-non-s390-archs-where-virtual.patch | 91 ++ ...178a-avoid-two-consecutive-device-re.patch | 43 + ...-max-npc-mcam-entry-check-while-vali.patch | 54 + .../pci-add-intel_hda_arl-to-pci_ids.h.patch | 41 + ...set-quirk-for-nvidia-spectrum-device.patch | 62 + ...equester-id-when-no-error-info-found.patch | 69 + ...gt-s-effective-data-rate-calculation.patch | 40 + ...rride-amd-usb-controller-if-required.patch | 55 + ...x-stdev_release-crash-after-surprise.patch | 104 ++ ...rrow-startup-race-when-creating-the-.patch | 82 ++ ...-minimum-opencsd-version-to-ensure-a.patch | 59 + .../perf-fix-the-nr_addr_filters-fix.patch | 50 + ...-fix-types-of-config-value-in-byt_pi.patch | 42 + ...chronize-devfreq_monitor_-start-stop.patch | 167 +++ queue-6.6/pnp-acpi-fix-fortify-warning.patch | 83 ++ ...config_numa-n-build-due-to-create_se.patch | 65 + ...-build-error-due-to-is_valid_bugaddr.patch | 48 + ...-validate-size-for-vector-operations.patch | 71 + ...uild-failures-due-to-arch_reserved_k.patch | 68 + ...ull-pointer-dereference-in-pgtable_c.patch | 49 + ..._must_withdraw-is-only-needed-for-co.patch | 56 + ...rash-when-setting-number-of-cpus-to-.patch | 47 + ...rror-code-return-in-ipoib_mcast_join.patch | 34 + ...d-display-enable-replay-for-static-s.patch | 141 ++ ...nly-increment-use_count-when-enable_.patch | 113 ++ ...ouching-renamed-directory-if-parent-.patch | 143 +++ .../riscv-fix-build-error-on-rv32-xip.patch | 50 + queue-6.6/riscv-make-xip-bootable-again.patch | 79 ++ ...ce_conn_rcu-fix-the-usage-of-read_se.patch | 46 + ...-align-vmalloc-area-on-segment-bound.patch | 63 + ...le-setting-of-fpc-register-correctly.patch | 71 + ...-sysfs-status-attribute-for-ap-queue.patch | 95 ++ ...add-a-new-arch_scale_freq_ref-method.patch | 215 ++++ ...ort-new-pci-device-ids-1883-and-1886.patch | 70 + ...t-.phy_attached-before-notifing-phyu.patch | 57 + ...csi-libfc-don-t-schedule-abort-twice.patch | 68 + ...up-timeout-error-in-fc_fcp_rec_error.patch | 37 + ...ssible-file-string-name-overflow-whe.patch | 64 + ...etermination-of-vmid_flag-after-vmid.patch | 62 + ...ialize-an-npiv-s-vmid-data-structure.patch | 45 + ...pci-checks-where-sas5116-diverges-fr.patch | 54 + ...i3mr-add-support-for-sas5116-pci-ids.patch | 41 + ...x-compiler-warnings-in-release-1-mod.patch | 52 + ...x-issues-in-setup_classid_environmen.patch | 85 ++ ...x-pyperf180-compilation-failure-with.patch | 83 ++ ...-bpf-fix-release-1-build-for-tc_opts.patch | 50 + ...tisfy-compiler-by-having-explicit-re.patch | 35 + ...nolibc-fix-testcase-status-alignment.patch | 63 + ...ftests-sgx-fix-linker-script-asserts.patch | 39 + queue-6.6/series | 267 ++++ ...nt-fix-hardlinking-of-reparse-points.patch | 184 +++ ...lient-fix-renaming-of-reparse-points.patch | 215 ++++ ...or-call-trace-due-to-the-usage-of-sm.patch | 70 + ...nx-fix-unhandled-sgi-warning-message.patch | 39 + ...mi-mediatek-fix-uaf-on-device-remove.patch | 78 ++ ...c-fix-a-suspicious-rcu-usage-warning.patch | 121 ++ ...f-bounds-access-for-empty-sysctl-reg.patch | 67 + ...-thermal-zone-suspend-resume-synchro.patch | 132 ++ ...cktrmios-with-cap_checkpoint_restore.patch | 63 + ...y-index-out-of-bounds-in-dtsplitroot.patch | 77 ++ .../um-don-t-use-vfprintf-for-os_info.patch | 72 ++ ...ming-clash-between-uml-and-scheduler.patch | 82 ++ ...ix-return-type-of-uml_net_start_xmit.patch | 53 + .../um-time-travel-fix-time-corruption.patch | 93 ++ ...k-to-decrease-in-ep-poll-interval-fo.patch | 98 ++ ...hardcoded-quirk-value-with-bit-macro.patch | 39 + ...at-fix-usb-disconnect-issue-after-s4.patch | 89 ++ ...-directive-writing-between-1-and-11-.patch | 84 ++ ...t-keep-wdtctrl-bit-3-unmodified-for-.patch | 71 + ...e-add-lock-annotations-to-fix-contex.patch | 48 + ...race-due-to-setting-ath11k_flag_ext_.patch | 75 ++ ...k-fix-and-enable-ap-mode-for-wcn7850.patch | 74 ++ ...the-issue-that-the-multicast-broadca.patch | 44 + ...otential-array-index-out-of-bounds-r.patch | 61 + ...x-rcu-dereference-in-__cfg80211_bss_.patch | 38 + ...ee-beacon_ies-when-overridden-from-h.patch | 44 + ...i-mt76-connac-fix-eht-phy-mode-check.patch | 37 + ...i-mt76-mt7996-add-pci-ids-for-mt7992.patch | 60 + ...ect-wrong-bbp-register-in-rxdcoc-cal.patch | 39 + ...art-beacon-queue-when-hardware-reset.patch | 79 ++ ...d-additional-usb-ids-for-rtl8192eu-d.patch | 48 + ...8723-be-ae-using-calculate_bit_shift.patch | 77 ++ ...fix-wrong-wi-fi-role-info-and-fddt-p.patch | 79 ++ ...isbehavior-of-tx-beacon-in-concurren.patch | 172 +++ ...timeout-calculation-in-rtw89_roc_end.patch | 41 + ...sible-null-pointer-dereference-in-wf.patch | 98 ++ ...t-ignore-nmis-during-very-early-boot.patch | 94 ++ ...al-mce-s-page-as-poison-to-avoid-pan.patch | 83 ++ ...he-abuse-of-underlying-struct-page-i.patch | 151 +++ ...e-null-pointer-deref-during-xhci-urb.patch | 98 ++ 268 files changed, 24143 insertions(+) create mode 100644 queue-6.6/9p-fix-initialisation-of-netfs_inode-for-9p.patch create mode 100644 queue-6.6/accel-habanalabs-add-support-for-gaudi2c-device.patch create mode 100644 queue-6.6/acpi-apei-set-memory-failure-flags-as-mf_action_requ.patch create mode 100644 queue-6.6/acpi-extlog-fix-null-pointer-dereference-check.patch create mode 100644 queue-6.6/acpi-numa-fix-the-logic-of-getting-the-fake_pxm-valu.patch create mode 100644 queue-6.6/acpi-video-add-quirk-for-the-colorful-x15-at-23-lapt.patch create mode 100644 queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_fi.patch create mode 100644 queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_lo.patch create mode 100644 queue-6.6/alsa-hda-conexant-fix-headset-auto-detect-fail-in-cx.patch create mode 100644 queue-6.6/alsa-hda-intel-add-hda_arl-pci-id-support.patch create mode 100644 queue-6.6/alsa-hda-intel-dspcfg-add-filters-for-arl-s-and-arl.patch create mode 100644 queue-6.6/alsa-hda-refer-to-correct-stream-index-at-loops.patch create mode 100644 queue-6.6/arch-consolidate-arch_irq_work_raise-prototypes.patch create mode 100644 queue-6.6/arm-dts-imx-use-flash-0-0-pattern.patch create mode 100644 queue-6.6/arm-dts-imx1-fix-sram-node.patch create mode 100644 queue-6.6/arm-dts-imx23-28-fix-the-dma-controller-node-name.patch create mode 100644 queue-6.6/arm-dts-imx23-sansa-use-preferred-i2c-gpios-properti.patch create mode 100644 queue-6.6/arm-dts-imx25-27-eukrea-fix-rtc-node-name.patch create mode 100644 queue-6.6/arm-dts-imx25-27-pass-timing0.patch create mode 100644 queue-6.6/arm-dts-imx25-fix-the-iim-compatible-string.patch create mode 100644 queue-6.6/arm-dts-imx27-apf27dev-fix-led-name.patch create mode 100644 queue-6.6/arm-dts-imx27-fix-sram-node.patch create mode 100644 queue-6.6/arm-dts-imx7d-fix-coresight-funnel-ports.patch create mode 100644 queue-6.6/arm-dts-imx7s-fix-lcdif-compatible.patch create mode 100644 queue-6.6/arm-dts-imx7s-fix-nand-controller-size-cells.patch create mode 100644 queue-6.6/arm-dts-marvell-fix-some-common-switch-mistakes.patch create mode 100644 queue-6.6/arm-dts-qcom-mdm9615-fix-pmic-node-labels.patch create mode 100644 queue-6.6/arm-dts-qcom-msm8660-fix-pmic-node-labels.patch create mode 100644 queue-6.6/arm-dts-qcom-msm8960-fix-pmic-node-labels.patch create mode 100644 queue-6.6/arm-dts-qcom-strip-prefix-from-pmic-files.patch create mode 100644 queue-6.6/arm-dts-rockchip-fix-rk3036-hdmi-ports-node.patch create mode 100644 queue-6.6/arm-dts-samsung-exynos4-fix-camera-unit-addresses-ra.patch create mode 100644 queue-6.6/arm-dts-samsung-s5pv210-fix-camera-unit-addresses-ra.patch create mode 100644 queue-6.6/arm64-dts-amlogic-fix-format-for-s4-uart-node.patch create mode 100644 queue-6.6/arm64-dts-marvell-fix-some-common-switch-mistakes.patch create mode 100644 queue-6.6/arm64-dts-qcom-fix-coresight-warnings-in-in-ports-an.patch create mode 100644 queue-6.6/arm64-dts-qcom-msm8996-fix-in-ports-is-a-required-pr.patch create mode 100644 queue-6.6/arm64-dts-qcom-msm8998-fix-out-ports-is-a-required-p.patch create mode 100644 queue-6.6/arm64-dts-qcom-sm8350-fix-remoteproc-interrupt-type.patch create mode 100644 queue-6.6/arm64-dts-qcom-sm8450-fix-soundwire-controllers-node.patch create mode 100644 queue-6.6/arm64-dts-qcom-sm8550-fix-soundwire-controllers-node.patch create mode 100644 queue-6.6/arm64-dts-sprd-add-clock-reference-for-pll2-on-ums51.patch create mode 100644 queue-6.6/arm64-dts-sprd-change-ums512-idle-state-nodename-to-.patch create mode 100644 queue-6.6/arm64-irq-set-the-correct-node-for-vmap-stack.patch create mode 100644 queue-6.6/arm64-zynqmp-fix-clock-node-name-in-kv260-cards.patch create mode 100644 queue-6.6/arm64-zynqmp-move-fixed-clock-to-for-kv260.patch create mode 100644 queue-6.6/asm-generic-make-sparse-happy-with-odd-sized-put_una.patch create mode 100644 queue-6.6/asoc-amd-add-new-dmi-entries-for-acp5x-platform.patch create mode 100644 queue-6.6/asoc-doc-fix-undefined-snd_soc_dapm_nopm-argument.patch create mode 100644 queue-6.6/audit-send-netlink-ack-before-setting-connection-in-.patch create mode 100644 queue-6.6/blk-mq-fix-io-hang-from-sbitmap-wakeup-race.patch create mode 100644 queue-6.6/block-prevent-an-integer-overflow-in-bvec_try_merge_.patch create mode 100644 queue-6.6/block-rnbd-srv-check-for-unlikely-string-overflow.patch create mode 100644 queue-6.6/bluetooth-hci_sync-fix-br-edr-wakeup-bug.patch create mode 100644 queue-6.6/bluetooth-iso-avoid-creating-child-socket-if-pa-sync.patch create mode 100644 queue-6.6/bluetooth-l2cap-fix-possible-multiple-reject-send.patch create mode 100644 queue-6.6/bluetooth-qca-set-both-wideband_speech-and-le_states.patch create mode 100644 queue-6.6/bonding-return-enomem-instead-of-bug-in-alb_upper_de.patch create mode 100644 queue-6.6/bpf-check-rcu_read_lock_trace_held-before-calling-bp.patch create mode 100644 queue-6.6/bpf-fix-a-few-selftest-failures-due-to-llvm18-change.patch create mode 100644 queue-6.6/bpf-set-need_defer-as-false-when-clearing-fd-array-d.patch create mode 100644 queue-6.6/bpf-set-uattr-batch.count-as-zero-before-batched-upd.patch create mode 100644 queue-6.6/bridge-cfm-fix-enum-typo-in-br_cc_ccm_tx_parse.patch create mode 100644 queue-6.6/ceph-fix-deadlock-or-deadcode-of-misusing-dget.patch create mode 100644 queue-6.6/ceph-fix-invalid-pointer-access-if-get_quota_realm-r.patch create mode 100644 queue-6.6/ceph-reinitialize-mds-feature-bit-even-when-session-.patch create mode 100644 queue-6.6/cfi-add-cfi_noseal.patch create mode 100644 queue-6.6/clk-hi3620-fix-memory-leak-in-hi3620_mmc_clk_init.patch create mode 100644 queue-6.6/clk-imx-clk-imx8qxp-fix-lvds-bypass-pixel-and-phy-cl.patch create mode 100644 queue-6.6/clk-mmp-pxa168-fix-memory-leak-in-pxa168_clk_init.patch create mode 100644 queue-6.6/cpufreq-schedutil-use-a-fixed-reference-frequency.patch create mode 100644 queue-6.6/cpufreq-use-the-fixed-and-coherent-frequency-for-sca.patch create mode 100644 queue-6.6/crypto-octeontx2-fix-cptvf-driver-cleanup.patch create mode 100644 queue-6.6/crypto-p10-aes-gcm-avoid-wstringop-overflow-warnings.patch create mode 100644 queue-6.6/crypto-starfive-fix-dev_err_probe-return-error.patch create mode 100644 queue-6.6/crypto-stm32-crc32-fix-parsing-list-of-devices.patch create mode 100644 queue-6.6/debugobjects-stop-accessing-objects-after-releasing-.patch create mode 100644 queue-6.6/drivers-perf-pmuv3-don-t-expose-sw_incr-event-in-sys.patch create mode 100644 queue-6.6/drm-amd-display-fix-minor-issues-in-bw-allocation-ph.patch create mode 100644 queue-6.6/drm-amd-display-fix-mst-pbn-x.y-value-calculations.patch create mode 100644 queue-6.6/drm-amd-display-fix-tiled-display-misalignment.patch create mode 100644 queue-6.6/drm-amd-display-fixing-stream-allocation-regression.patch create mode 100644 queue-6.6/drm-amd-display-for-prefetch-mode-0-extend-prefetch-.patch create mode 100644 queue-6.6/drm-amd-display-force-p-state-disallow-if-leaving-no.patch create mode 100644 queue-6.6/drm-amd-display-make-flip_timestamp_in_us-a-64-bit-v.patch create mode 100644 queue-6.6/drm-amd-display-only-clear-symclk-otg-flag-for-hdmi.patch create mode 100644 queue-6.6/drm-amd-powerplay-fix-kzalloc-parameter-atom_tonga_p.patch create mode 100644 queue-6.6/drm-amdgpu-apply-the-rv2-system-aperture-fix-to-rn-c.patch create mode 100644 queue-6.6/drm-amdgpu-drop-fence-check-in-to_amdgpu_amdkfd_fenc.patch create mode 100644 queue-6.6/drm-amdgpu-fix-avg-vs-input-power-reporting-on-smu7.patch create mode 100644 queue-6.6/drm-amdgpu-fix-ecc-irq-enable-disable-unpaired.patch create mode 100644 queue-6.6/drm-amdgpu-fix-ftrace-event-amdgpu_bo_move-always-mo.patch create mode 100644 queue-6.6/drm-amdgpu-fix-fw-from-request_firmware-not-released.patch create mode 100644 queue-6.6/drm-amdgpu-fix-with-right-return-code-eio-in-amdgpu_.patch create mode 100644 queue-6.6/drm-amdgpu-let-kfd-sync-with-vm-fences.patch create mode 100644 queue-6.6/drm-amdgpu-release-adev-pm.fw-before-return-in-amdgp.patch create mode 100644 queue-6.6/drm-amdkfd-fix-iterator-used-outside-loop-in-kfd_add.patch create mode 100644 queue-6.6/drm-amdkfd-fix-lock-dependency-warning-with-srcu.patch create mode 100644 queue-6.6/drm-amdkfd-fix-lock-dependency-warning.patch create mode 100644 queue-6.6/drm-amdkfd-fix-mes-set-shader-debugger-process-manag.patch create mode 100644 queue-6.6/drm-amdkfd-fix-node-null-check-in-svm_range_get_rang.patch create mode 100644 queue-6.6/drm-amdkfd-only-flush-mes-process-context-if-mes-sup.patch create mode 100644 queue-6.6/drm-bridge-anx7625-fix-set-hpd-irq-detect-window-to-.patch create mode 100644 queue-6.6/drm-drm_file-fix-use-of-uninitialized-variable.patch create mode 100644 queue-6.6/drm-exynos-call-drm_atomic_helper_shutdown-at-shutdo.patch create mode 100644 queue-6.6/drm-fix-color-lut-rounding.patch create mode 100644 queue-6.6/drm-framebuffer-fix-use-of-uninitialized-variable.patch create mode 100644 queue-6.6/drm-mipi-dsi-fix-detach-call-without-attach.patch create mode 100644 queue-6.6/drm-msm-dp-add-displayport-controller-for-sm8650.patch create mode 100644 queue-6.6/drm-msm-dpu-enable-writeback-on-sm8350.patch create mode 100644 queue-6.6/drm-msm-dpu-enable-writeback-on-sm8450.patch create mode 100644 queue-6.6/drm-msm-dpu-fix-writeback-programming-for-yuv-cases.patch create mode 100644 queue-6.6/drm-msm-dpu-ratelimit-framedone-timeout-msgs.patch create mode 100644 queue-6.6/drm-panel-edp-add-override_edid_mode-quirk-for-gener.patch create mode 100644 queue-6.6/drm-using-mul_u32_u32-requires-linux-math64.h.patch create mode 100644 queue-6.6/ecryptfs-reject-casefold-directory-inodes.patch create mode 100644 queue-6.6/energy_model-use-a-fixed-reference-frequency.patch create mode 100644 queue-6.6/erofs-fix-up-compacted-indexes-for-block-size-4096.patch create mode 100644 queue-6.6/erofs-fix-ztailpacking-for-subpage-compressed-blocks.patch create mode 100644 queue-6.6/ext4-avoid-online-resizing-failures-due-to-oversized.patch create mode 100644 queue-6.6/ext4-fix-inconsistent-between-segment-fstrim-and-ful.patch create mode 100644 queue-6.6/ext4-remove-unnecessary-check-from-alloc_flex_gd.patch create mode 100644 queue-6.6/ext4-treat-end-of-range-as-exclusive-in-ext4_zero_ra.patch create mode 100644 queue-6.6/ext4-unify-the-type-of-flexbg_size-to-unsigned-int.patch create mode 100644 queue-6.6/extcon-fix-possible-name-leak-in-extcon_dev_register.patch create mode 100644 queue-6.6/f2fs-fix-to-check-return-value-of-f2fs_reserve_new_b.patch create mode 100644 queue-6.6/f2fs-fix-to-tag-gcing-flag-on-page-during-block-migr.patch create mode 100644 queue-6.6/f2fs-fix-write-pointers-on-zoned-device-after-roll-f.patch create mode 100644 queue-6.6/fast_dput-handle-underflows-gracefully.patch create mode 100644 queue-6.6/fs-jfs-ubsan-array-index-out-of-bounds-in-dbadjtree.patch create mode 100644 queue-6.6/fs-kernfs-dir-obey-s_isgid.patch create mode 100644 queue-6.6/hexagon-make-pfn-accessors-statics-inlines.patch create mode 100644 queue-6.6/hwmon-hp-wmi-sensors-fix-failure-to-load-on-elitedes.patch create mode 100644 queue-6.6/hwmon-nct6775-fix-fan-speed-set-failure-in-automatic.patch create mode 100644 queue-6.6/hwmon-pc87360-bounds-check-data-innr-usage.patch create mode 100644 queue-6.6/hwrng-starfive-fix-dev_err_probe-return-error.patch create mode 100644 queue-6.6/i2c-rk3x-adjust-mask-value-offset-for-i2c2-on-rv1126.patch create mode 100644 queue-6.6/i3c-master-cdns-update-maximum-prescaler-value-for-i.patch create mode 100644 queue-6.6/i40e-fix-vf-disable-behavior-to-block-all-traffic.patch create mode 100644 queue-6.6/ib-ipoib-fix-mcast-list-locking.patch create mode 100644 queue-6.6/ice-fix-ice_aq_vsi_q_opt_rss_-register-values.patch create mode 100644 queue-6.6/ice-fix-pre-shifted-bit-usage.patch create mode 100644 queue-6.6/ionic-bypass-firmware-cmds-when-stuck-in-reset.patch create mode 100644 queue-6.6/ionic-pass-opcode-to-devcmd_wait.patch create mode 100644 queue-6.6/jfs-fix-array-index-out-of-bounds-in-dbadjtree.patch create mode 100644 queue-6.6/jfs-fix-array-index-out-of-bounds-in-dinewext.patch create mode 100644 queue-6.6/jfs-fix-slab-out-of-bounds-read-in-dtsearch.patch create mode 100644 queue-6.6/jfs-fix-uaf-in-jfs_evict_inode.patch create mode 100644 queue-6.6/kunit-tool-fix-parsing-of-test-attributes.patch create mode 100644 queue-6.6/kvm-s390-fix-setting-of-fpc-register.patch create mode 100644 queue-6.6/leds-trigger-panic-don-t-register-panic-notifier-if-.patch create mode 100644 queue-6.6/libbpf-fix-null-pointer-dereference-in-bpf_object__c.patch create mode 100644 queue-6.6/libbpf-fix-potential-uninitialized-tail-padding-with.patch create mode 100644 queue-6.6/libsubcmd-fix-memory-leak-in-uniq.patch create mode 100644 queue-6.6/mailbox-arm_mhuv2-fix-a-bug-for-mhuv2_sender_interru.patch create mode 100644 queue-6.6/md-whenassemble-the-array-consult-the-superblock-of-.patch create mode 100644 queue-6.6/media-amphion-remove-mutext-lock-in-condition-of-wai.patch create mode 100644 queue-6.6/media-ddbridge-fix-an-error-code-problem-in-ddb_prob.patch create mode 100644 queue-6.6/media-i2c-imx335-fix-hblank-min-max-values.patch create mode 100644 queue-6.6/media-renesas-vsp1-fix-references-to-pad-config.patch create mode 100644 queue-6.6/media-rkisp1-drop-irqf_shared.patch create mode 100644 queue-6.6/media-rkisp1-fix-irq-disable-race-issue.patch create mode 100644 queue-6.6/media-rkisp1-fix-irq-handler-return-values.patch create mode 100644 queue-6.6/media-rkisp1-resizer-stop-manual-allocation-of-v4l2_.patch create mode 100644 queue-6.6/media-rkisp1-store-irq-lines.patch create mode 100644 queue-6.6/media-rockchip-rga-fix-swizzling-for-rgb-formats.patch create mode 100644 queue-6.6/media-stk1160-fixed-high-volume-of-stk1160_dbg-messa.patch create mode 100644 queue-6.6/media-uvcvideo-fix-power-line-control-for-a-chicony-.patch create mode 100644 queue-6.6/media-uvcvideo-fix-power-line-control-for-sunplusit-.patch create mode 100644 queue-6.6/mfd-ti_am335x_tscadc-fix-ti-soc-dependencies.patch create mode 100644 queue-6.6/misc-lis3lv02d_i2c-add-missing-setting-of-the-reg_ct.patch create mode 100644 queue-6.6/net-atlantic-eliminate-double-free-in-error-handling.patch create mode 100644 queue-6.6/net-dsa-mv88e6xxx-fix-mv88e6352_serdes_get_stats-err.patch create mode 100644 queue-6.6/net-dsa-qca8k-put-mdio-bus-of-node-on-qca8k_mdio_reg.patch create mode 100644 queue-6.6/net-kcm-fix-direct-access-to-bv_len.patch create mode 100644 queue-6.6/net-mvmdio-avoid-excessive-sleeps-in-polled-mode.patch create mode 100644 queue-6.6/net-phy-at803x-fix-passing-the-wrong-reference-for-c.patch create mode 100644 queue-6.6/net-phy-micrel-fix-ts_info-value-in-case-of-no-phc.patch create mode 100644 queue-6.6/net-smc-disable-seid-on-non-s390-archs-where-virtual.patch create mode 100644 queue-6.6/net-usb-ax88179_178a-avoid-two-consecutive-device-re.patch create mode 100644 queue-6.6/octeontx2-af-fix-max-npc-mcam-entry-check-while-vali.patch create mode 100644 queue-6.6/pci-add-intel_hda_arl-to-pci_ids.h.patch create mode 100644 queue-6.6/pci-add-no-pm-reset-quirk-for-nvidia-spectrum-device.patch create mode 100644 queue-6.6/pci-aer-decode-requester-id-when-no-error-info-found.patch create mode 100644 queue-6.6/pci-fix-64gt-s-effective-data-rate-calculation.patch create mode 100644 queue-6.6/pci-only-override-amd-usb-controller-if-required.patch create mode 100644 queue-6.6/pci-switchtec-fix-stdev_release-crash-after-surprise.patch create mode 100644 queue-6.6/perf-core-fix-narrow-startup-race-when-creating-the-.patch create mode 100644 queue-6.6/perf-cs-etm-bump-minimum-opencsd-version-to-ensure-a.patch create mode 100644 queue-6.6/perf-fix-the-nr_addr_filters-fix.patch create mode 100644 queue-6.6/pinctrl-baytrail-fix-types-of-config-value-in-byt_pi.patch create mode 100644 queue-6.6/pm-devfreq-synchronize-devfreq_monitor_-start-stop.patch create mode 100644 queue-6.6/pnp-acpi-fix-fortify-warning.patch create mode 100644 queue-6.6/powerpc-64s-fix-config_numa-n-build-due-to-create_se.patch create mode 100644 queue-6.6/powerpc-fix-build-error-due-to-is_valid_bugaddr.patch create mode 100644 queue-6.6/powerpc-lib-validate-size-for-vector-operations.patch create mode 100644 queue-6.6/powerpc-mm-fix-build-failures-due-to-arch_reserved_k.patch create mode 100644 queue-6.6/powerpc-mm-fix-null-pointer-dereference-in-pgtable_c.patch create mode 100644 queue-6.6/powerpc-pmd_move_must_withdraw-is-only-needed-for-co.patch create mode 100644 queue-6.6/pstore-ram-fix-crash-when-setting-number-of-cpus-to-.patch create mode 100644 queue-6.6/rdma-ipoib-fix-error-code-return-in-ipoib_mcast_join.patch create mode 100644 queue-6.6/re-revert-drm-amd-display-enable-replay-for-static-s.patch create mode 100644 queue-6.6/regulator-core-only-increment-use_count-when-enable_.patch create mode 100644 queue-6.6/reiserfs-avoid-touching-renamed-directory-if-parent-.patch create mode 100644 queue-6.6/riscv-fix-build-error-on-rv32-xip.patch create mode 100644 queue-6.6/riscv-make-xip-bootable-again.patch create mode 100644 queue-6.6/rxrpc_find_service_conn_rcu-fix-the-usage-of-read_se.patch create mode 100644 queue-6.6/s390-boot-always-align-vmalloc-area-on-segment-bound.patch create mode 100644 queue-6.6/s390-ptrace-handle-setting-of-fpc-register-correctly.patch create mode 100644 queue-6.6/s390-vfio-ap-fix-sysfs-status-attribute-for-ap-queue.patch create mode 100644 queue-6.6/sched-topology-add-a-new-arch_scale_freq_ref-method.patch create mode 100644 queue-6.6/scsi-arcmsr-support-new-pci-device-ids-1883-and-1886.patch create mode 100644 queue-6.6/scsi-hisi_sas-set-.phy_attached-before-notifing-phyu.patch create mode 100644 queue-6.6/scsi-libfc-don-t-schedule-abort-twice.patch create mode 100644 queue-6.6/scsi-libfc-fix-up-timeout-error-in-fc_fcp_rec_error.patch create mode 100644 queue-6.6/scsi-lpfc-fix-possible-file-string-name-overflow-whe.patch create mode 100644 queue-6.6/scsi-lpfc-move-determination-of-vmid_flag-after-vmid.patch create mode 100644 queue-6.6/scsi-lpfc-reinitialize-an-npiv-s-vmid-data-structure.patch create mode 100644 queue-6.6/scsi-mpi3mr-add-pci-checks-where-sas5116-diverges-fr.patch create mode 100644 queue-6.6/scsi-mpi3mr-add-support-for-sas5116-pci-ids.patch create mode 100644 queue-6.6/selftests-bpf-fix-compiler-warnings-in-release-1-mod.patch create mode 100644 queue-6.6/selftests-bpf-fix-issues-in-setup_classid_environmen.patch create mode 100644 queue-6.6/selftests-bpf-fix-pyperf180-compilation-failure-with.patch create mode 100644 queue-6.6/selftests-bpf-fix-release-1-build-for-tc_opts.patch create mode 100644 queue-6.6/selftests-bpf-satisfy-compiler-by-having-explicit-re.patch create mode 100644 queue-6.6/selftests-nolibc-fix-testcase-status-alignment.patch create mode 100644 queue-6.6/selftests-sgx-fix-linker-script-asserts.patch create mode 100644 queue-6.6/smb-client-fix-hardlinking-of-reparse-points.patch create mode 100644 queue-6.6/smb-client-fix-renaming-of-reparse-points.patch create mode 100644 queue-6.6/soc-xilinx-fix-for-call-trace-due-to-the-usage-of-sm.patch create mode 100644 queue-6.6/soc-xilinx-fix-unhandled-sgi-warning-message.patch create mode 100644 queue-6.6/spmi-mediatek-fix-uaf-on-device-remove.patch create mode 100644 queue-6.6/sunrpc-fix-a-suspicious-rcu-usage-warning.patch create mode 100644 queue-6.6/sysctl-fix-out-of-bounds-access-for-empty-sysctl-reg.patch create mode 100644 queue-6.6/thermal-core-fix-thermal-zone-suspend-resume-synchro.patch create mode 100644 queue-6.6/tty-allow-tiocslcktrmios-with-cap_checkpoint_restore.patch create mode 100644 queue-6.6/ubsan-array-index-out-of-bounds-in-dtsplitroot.patch create mode 100644 queue-6.6/um-don-t-use-vfprintf-for-os_info.patch create mode 100644 queue-6.6/um-fix-naming-clash-between-uml-and-scheduler.patch create mode 100644 queue-6.6/um-net-fix-return-type-of-uml_net_start_xmit.patch create mode 100644 queue-6.6/um-time-travel-fix-time-corruption.patch create mode 100644 queue-6.6/usb-hub-add-quirk-to-decrease-in-ep-poll-interval-fo.patch create mode 100644 queue-6.6/usb-hub-replace-hardcoded-quirk-value-with-bit-macro.patch create mode 100644 queue-6.6/usb-xhci-plat-fix-usb-disconnect-issue-after-s4.patch create mode 100644 queue-6.6/virtio_net-fix-d-directive-writing-between-1-and-11-.patch create mode 100644 queue-6.6/watchdog-it87_wdt-keep-wdtctrl-bit-3-unmodified-for-.patch create mode 100644 queue-6.6/watchdog-starfive-add-lock-annotations-to-fix-contex.patch create mode 100644 queue-6.6/wifi-ath11k-fix-race-due-to-setting-ath11k_flag_ext_.patch create mode 100644 queue-6.6/wifi-ath12k-fix-and-enable-ap-mode-for-wcn7850.patch create mode 100644 queue-6.6/wifi-ath12k-fix-the-issue-that-the-multicast-broadca.patch create mode 100644 queue-6.6/wifi-ath9k-fix-potential-array-index-out-of-bounds-r.patch create mode 100644 queue-6.6/wifi-cfg80211-fix-rcu-dereference-in-__cfg80211_bss_.patch create mode 100644 queue-6.6/wifi-cfg80211-free-beacon_ies-when-overridden-from-h.patch create mode 100644 queue-6.6/wifi-mt76-connac-fix-eht-phy-mode-check.patch create mode 100644 queue-6.6/wifi-mt76-mt7996-add-pci-ids-for-mt7992.patch create mode 100644 queue-6.6/wifi-rt2x00-correct-wrong-bbp-register-in-rxdcoc-cal.patch create mode 100644 queue-6.6/wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch create mode 100644 queue-6.6/wifi-rtl8xxxu-add-additional-usb-ids-for-rtl8192eu-d.patch create mode 100644 queue-6.6/wifi-rtlwifi-rtl8723-be-ae-using-calculate_bit_shift.patch create mode 100644 queue-6.6/wifi-rtw89-coex-fix-wrong-wi-fi-role-info-and-fddt-p.patch create mode 100644 queue-6.6/wifi-rtw89-fix-misbehavior-of-tx-beacon-in-concurren.patch create mode 100644 queue-6.6/wifi-rtw89-fix-timeout-calculation-in-rtw89_roc_end.patch create mode 100644 queue-6.6/wifi-wfx-fix-possible-null-pointer-dereference-in-wf.patch create mode 100644 queue-6.6/x86-boot-ignore-nmis-during-very-early-boot.patch create mode 100644 queue-6.6/x86-mce-mark-fatal-mce-s-page-as-poison-to-avoid-pan.patch create mode 100644 queue-6.6/xen-gntdev-fix-the-abuse-of-underlying-struct-page-i.patch create mode 100644 queue-6.6/xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch diff --git a/queue-6.6/9p-fix-initialisation-of-netfs_inode-for-9p.patch b/queue-6.6/9p-fix-initialisation-of-netfs_inode-for-9p.patch new file mode 100644 index 00000000000..1f07cb8346a --- /dev/null +++ b/queue-6.6/9p-fix-initialisation-of-netfs_inode-for-9p.patch @@ -0,0 +1,98 @@ +From 34e1c00336c8d59fce1a6f0c716ef9eda0d19583 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jan 2024 20:33:17 +0000 +Subject: 9p: Fix initialisation of netfs_inode for 9p + +From: David Howells + +[ Upstream commit 9546ac78b232bac56ff975072b1965e0e755ebd4 ] + +The 9p filesystem is calling netfs_inode_init() in v9fs_init_inode() - +before the struct inode fields have been initialised from the obtained file +stats (ie. after v9fs_stat2inode*() has been called), but netfslib wants to +set a couple of its fields from i_size. + +Reported-by: Marc Dionne +Signed-off-by: David Howells +Tested-by: Marc Dionne +Tested-by: Dominique Martinet +Acked-by: Dominique Martinet +cc: Eric Van Hensbergen +cc: Latchesar Ionkov +cc: Dominique Martinet +cc: Christian Schoenebeck +cc: v9fs@lists.linux.dev +cc: linux-cachefs@redhat.com +cc: linux-fsdevel@vger.kernel.org +Signed-off-by: Sasha Levin +--- + fs/9p/v9fs_vfs.h | 1 + + fs/9p/vfs_inode.c | 6 +++--- + fs/9p/vfs_inode_dotl.c | 1 + + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h +index cdf441f22e07..dcce42d55d68 100644 +--- a/fs/9p/v9fs_vfs.h ++++ b/fs/9p/v9fs_vfs.h +@@ -42,6 +42,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb); + void v9fs_free_inode(struct inode *inode); + struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, + dev_t rdev); ++void v9fs_set_netfs_context(struct inode *inode); + int v9fs_init_inode(struct v9fs_session_info *v9ses, + struct inode *inode, umode_t mode, dev_t rdev); + void v9fs_evict_inode(struct inode *inode); +diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c +index 0d28ecf668d0..ea695c4a7a3f 100644 +--- a/fs/9p/vfs_inode.c ++++ b/fs/9p/vfs_inode.c +@@ -246,7 +246,7 @@ void v9fs_free_inode(struct inode *inode) + /* + * Set parameters for the netfs library + */ +-static void v9fs_set_netfs_context(struct inode *inode) ++void v9fs_set_netfs_context(struct inode *inode) + { + struct v9fs_inode *v9inode = V9FS_I(inode); + netfs_inode_init(&v9inode->netfs, &v9fs_req_ops); +@@ -326,8 +326,6 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, + err = -EINVAL; + goto error; + } +- +- v9fs_set_netfs_context(inode); + error: + return err; + +@@ -359,6 +357,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev) + iput(inode); + return ERR_PTR(err); + } ++ v9fs_set_netfs_context(inode); + return inode; + } + +@@ -464,6 +463,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, + goto error; + + v9fs_stat2inode(st, inode, sb, 0); ++ v9fs_set_netfs_context(inode); + v9fs_cache_inode_get_cookie(inode); + unlock_new_inode(inode); + return inode; +diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c +index 1312f68965ac..91bcee2ab3c4 100644 +--- a/fs/9p/vfs_inode_dotl.c ++++ b/fs/9p/vfs_inode_dotl.c +@@ -128,6 +128,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, + goto error; + + v9fs_stat2inode_dotl(st, inode, 0); ++ v9fs_set_netfs_context(inode); + v9fs_cache_inode_get_cookie(inode); + retval = v9fs_get_acl(inode, fid); + if (retval) +-- +2.43.0 + diff --git a/queue-6.6/accel-habanalabs-add-support-for-gaudi2c-device.patch b/queue-6.6/accel-habanalabs-add-support-for-gaudi2c-device.patch new file mode 100644 index 00000000000..13822b3d33c --- /dev/null +++ b/queue-6.6/accel-habanalabs-add-support-for-gaudi2c-device.patch @@ -0,0 +1,112 @@ +From 71b32114f6126059cf6f04c91375c686f683fe20 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Oct 2023 12:23:57 +0200 +Subject: accel/habanalabs: add support for Gaudi2C device + +From: Oded Gabbay + +[ Upstream commit 42422993cf28d456778ee9168d73758ec037cd51 ] + +Gaudi2 with PCI revision ID with the value of '3' represents Gaudi2C +device and should be detected and initialized as Gaudi2. + +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/accel/habanalabs/common/device.c | 3 +++ + drivers/accel/habanalabs/common/habanalabs.h | 2 ++ + drivers/accel/habanalabs/common/habanalabs_drv.c | 3 +++ + drivers/accel/habanalabs/common/mmu/mmu.c | 1 + + drivers/accel/habanalabs/common/sysfs.c | 3 +++ + drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h | 1 + + 6 files changed, 13 insertions(+) + +diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c +index b97339d1f7c6..ebef56478e18 100644 +--- a/drivers/accel/habanalabs/common/device.c ++++ b/drivers/accel/habanalabs/common/device.c +@@ -808,6 +808,9 @@ static int device_early_init(struct hl_device *hdev) + gaudi2_set_asic_funcs(hdev); + strscpy(hdev->asic_name, "GAUDI2B", sizeof(hdev->asic_name)); + break; ++ case ASIC_GAUDI2C: ++ gaudi2_set_asic_funcs(hdev); ++ strscpy(hdev->asic_name, "GAUDI2C", sizeof(hdev->asic_name)); + break; + default: + dev_err(hdev->dev, "Unrecognized ASIC type %d\n", +diff --git a/drivers/accel/habanalabs/common/habanalabs.h b/drivers/accel/habanalabs/common/habanalabs.h +index 2f027d5a8206..05febd5b14e9 100644 +--- a/drivers/accel/habanalabs/common/habanalabs.h ++++ b/drivers/accel/habanalabs/common/habanalabs.h +@@ -1220,6 +1220,7 @@ struct hl_dec { + * @ASIC_GAUDI_SEC: Gaudi secured device (HL-2000). + * @ASIC_GAUDI2: Gaudi2 device. + * @ASIC_GAUDI2B: Gaudi2B device. ++ * @ASIC_GAUDI2C: Gaudi2C device. + */ + enum hl_asic_type { + ASIC_INVALID, +@@ -1228,6 +1229,7 @@ enum hl_asic_type { + ASIC_GAUDI_SEC, + ASIC_GAUDI2, + ASIC_GAUDI2B, ++ ASIC_GAUDI2C, + }; + + struct hl_cs_parser; +diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c +index 7263e84c1a4d..010bf63fcca3 100644 +--- a/drivers/accel/habanalabs/common/habanalabs_drv.c ++++ b/drivers/accel/habanalabs/common/habanalabs_drv.c +@@ -101,6 +101,9 @@ static enum hl_asic_type get_asic_type(struct hl_device *hdev) + case REV_ID_B: + asic_type = ASIC_GAUDI2B; + break; ++ case REV_ID_C: ++ asic_type = ASIC_GAUDI2C; ++ break; + default: + break; + } +diff --git a/drivers/accel/habanalabs/common/mmu/mmu.c b/drivers/accel/habanalabs/common/mmu/mmu.c +index b2145716c605..b654302a68fc 100644 +--- a/drivers/accel/habanalabs/common/mmu/mmu.c ++++ b/drivers/accel/habanalabs/common/mmu/mmu.c +@@ -596,6 +596,7 @@ int hl_mmu_if_set_funcs(struct hl_device *hdev) + break; + case ASIC_GAUDI2: + case ASIC_GAUDI2B: ++ case ASIC_GAUDI2C: + /* MMUs in Gaudi2 are always host resident */ + hl_mmu_v2_hr_set_funcs(hdev, &hdev->mmu_func[MMU_HR_PGT]); + break; +diff --git a/drivers/accel/habanalabs/common/sysfs.c b/drivers/accel/habanalabs/common/sysfs.c +index 01f89f029355..278606373055 100644 +--- a/drivers/accel/habanalabs/common/sysfs.c ++++ b/drivers/accel/habanalabs/common/sysfs.c +@@ -251,6 +251,9 @@ static ssize_t device_type_show(struct device *dev, + case ASIC_GAUDI2B: + str = "GAUDI2B"; + break; ++ case ASIC_GAUDI2C: ++ str = "GAUDI2C"; ++ break; + default: + dev_err(hdev->dev, "Unrecognized ASIC type %d\n", + hdev->asic_type); +diff --git a/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h b/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h +index f5d497dc9bdc..4f951cada077 100644 +--- a/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h ++++ b/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h +@@ -25,6 +25,7 @@ enum hl_revision_id { + REV_ID_INVALID = 0x00, + REV_ID_A = 0x01, + REV_ID_B = 0x02, ++ REV_ID_C = 0x03 + }; + + #endif /* INCLUDE_PCI_GENERAL_H_ */ +-- +2.43.0 + diff --git a/queue-6.6/acpi-apei-set-memory-failure-flags-as-mf_action_requ.patch b/queue-6.6/acpi-apei-set-memory-failure-flags-as-mf_action_requ.patch new file mode 100644 index 00000000000..7ac60678748 --- /dev/null +++ b/queue-6.6/acpi-apei-set-memory-failure-flags-as-mf_action_requ.patch @@ -0,0 +1,144 @@ +From 1955b01c7452b0843fedac2b0bdf447a336f6090 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Dec 2023 14:45:18 +0800 +Subject: ACPI: APEI: set memory failure flags as MF_ACTION_REQUIRED on + synchronous events + +From: Shuai Xue + +[ Upstream commit a70297d2213253853e95f5b49651f924990c6d3b ] + +There are two major types of uncorrected recoverable (UCR) errors : + + - Synchronous error: The error is detected and raised at the point of + the consumption in the execution flow, e.g. when a CPU tries to + access a poisoned cache line. The CPU will take a synchronous error + exception such as Synchronous External Abort (SEA) on Arm64 and + Machine Check Exception (MCE) on X86. OS requires to take action (for + example, offline failure page/kill failure thread) to recover this + uncorrectable error. + + - Asynchronous error: The error is detected out of processor execution + context, e.g. when an error is detected by a background scrubber. + Some data in the memory are corrupted. But the data have not been + consumed. OS is optional to take action to recover this uncorrectable + error. + +When APEI firmware first is enabled, a platform may describe one error +source for the handling of synchronous errors (e.g. MCE or SEA notification +), or for handling asynchronous errors (e.g. SCI or External Interrupt +notification). In other words, we can distinguish synchronous errors by +APEI notification. For synchronous errors, kernel will kill the current +process which accessing the poisoned page by sending SIGBUS with +BUS_MCEERR_AR. In addition, for asynchronous errors, kernel will notify the +process who owns the poisoned page by sending SIGBUS with BUS_MCEERR_AO in +early kill mode. However, the GHES driver always sets mf_flags to 0 so that +all synchronous errors are handled as asynchronous errors in memory failure. + +To this end, set memory failure flags as MF_ACTION_REQUIRED on synchronous +events. + +Signed-off-by: Shuai Xue +Tested-by: Ma Wupeng +Reviewed-by: Kefeng Wang +Reviewed-by: Xiaofei Tan +Reviewed-by: Baolin Wang +Reviewed-by: James Morse +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/apei/ghes.c | 29 +++++++++++++++++++++++------ + 1 file changed, 23 insertions(+), 6 deletions(-) + +diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c +index 63ad0541db38..ab2a82cb1b0b 100644 +--- a/drivers/acpi/apei/ghes.c ++++ b/drivers/acpi/apei/ghes.c +@@ -101,6 +101,20 @@ static inline bool is_hest_type_generic_v2(struct ghes *ghes) + return ghes->generic->header.type == ACPI_HEST_TYPE_GENERIC_ERROR_V2; + } + ++/* ++ * A platform may describe one error source for the handling of synchronous ++ * errors (e.g. MCE or SEA), or for handling asynchronous errors (e.g. SCI ++ * or External Interrupt). On x86, the HEST notifications are always ++ * asynchronous, so only SEA on ARM is delivered as a synchronous ++ * notification. ++ */ ++static inline bool is_hest_sync_notify(struct ghes *ghes) ++{ ++ u8 notify_type = ghes->generic->notify.type; ++ ++ return notify_type == ACPI_HEST_NOTIFY_SEA; ++} ++ + /* + * This driver isn't really modular, however for the time being, + * continuing to use module_param is the easiest way to remain +@@ -489,7 +503,7 @@ static bool ghes_do_memory_failure(u64 physical_addr, int flags) + } + + static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, +- int sev) ++ int sev, bool sync) + { + int flags = -1; + int sec_sev = ghes_severity(gdata->error_severity); +@@ -503,7 +517,7 @@ static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, + (gdata->flags & CPER_SEC_ERROR_THRESHOLD_EXCEEDED)) + flags = MF_SOFT_OFFLINE; + if (sev == GHES_SEV_RECOVERABLE && sec_sev == GHES_SEV_RECOVERABLE) +- flags = 0; ++ flags = sync ? MF_ACTION_REQUIRED : 0; + + if (flags != -1) + return ghes_do_memory_failure(mem_err->physical_addr, flags); +@@ -511,9 +525,11 @@ static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, + return false; + } + +-static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata, int sev) ++static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata, ++ int sev, bool sync) + { + struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); ++ int flags = sync ? MF_ACTION_REQUIRED : 0; + bool queued = false; + int sec_sev, i; + char *p; +@@ -538,7 +554,7 @@ static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata, int s + * and don't filter out 'corrected' error here. + */ + if (is_cache && has_pa) { +- queued = ghes_do_memory_failure(err_info->physical_fault_addr, 0); ++ queued = ghes_do_memory_failure(err_info->physical_fault_addr, flags); + p += err_info->length; + continue; + } +@@ -666,6 +682,7 @@ static bool ghes_do_proc(struct ghes *ghes, + const guid_t *fru_id = &guid_null; + char *fru_text = ""; + bool queued = false; ++ bool sync = is_hest_sync_notify(ghes); + + sev = ghes_severity(estatus->error_severity); + apei_estatus_for_each_section(estatus, gdata) { +@@ -683,13 +700,13 @@ static bool ghes_do_proc(struct ghes *ghes, + atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err); + + arch_apei_report_mem_error(sev, mem_err); +- queued = ghes_handle_memory_failure(gdata, sev); ++ queued = ghes_handle_memory_failure(gdata, sev, sync); + } + else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { + ghes_handle_aer(gdata); + } + else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { +- queued = ghes_handle_arm_hw_error(gdata, sev); ++ queued = ghes_handle_arm_hw_error(gdata, sev, sync); + } else { + void *err = acpi_hest_get_payload(gdata); + +-- +2.43.0 + diff --git a/queue-6.6/acpi-extlog-fix-null-pointer-dereference-check.patch b/queue-6.6/acpi-extlog-fix-null-pointer-dereference-check.patch new file mode 100644 index 00000000000..1609948835a --- /dev/null +++ b/queue-6.6/acpi-extlog-fix-null-pointer-dereference-check.patch @@ -0,0 +1,59 @@ +From 92090bc22df322dbf131afe80e795ba85b16ff31 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 13:00:37 -0500 +Subject: ACPI: extlog: fix NULL pointer dereference check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Prarit Bhargava + +[ Upstream commit 72d9b9747e78979510e9aafdd32eb99c7aa30dd1 ] + +The gcc plugin -fanalyzer [1] tries to detect various +patterns of incorrect behaviour. The tool reports: + +drivers/acpi/acpi_extlog.c: In function ‘extlog_exit’: +drivers/acpi/acpi_extlog.c:307:12: warning: check of ‘extlog_l1_addr’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check] + | + | 306 | ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN; + | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ + | | | + | | (1) pointer ‘extlog_l1_addr’ is dereferenced here + | 307 | if (extlog_l1_addr) + | | ~ + | | | + | | (2) pointer ‘extlog_l1_addr’ is checked for NULL here but it was already dereferenced at (1) + | + +Fix the NULL pointer dereference check in extlog_exit(). + +Link: https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Static-Analyzer-Options.html # [1] + +Signed-off-by: Prarit Bhargava +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/acpi_extlog.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c +index 71e8d4e7a36c..ca87a0939135 100644 +--- a/drivers/acpi/acpi_extlog.c ++++ b/drivers/acpi/acpi_extlog.c +@@ -308,9 +308,10 @@ static int __init extlog_init(void) + static void __exit extlog_exit(void) + { + mce_unregister_decode_chain(&extlog_mce_dec); +- ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN; +- if (extlog_l1_addr) ++ if (extlog_l1_addr) { ++ ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN; + acpi_os_unmap_iomem(extlog_l1_addr, l1_size); ++ } + if (elog_addr) + acpi_os_unmap_iomem(elog_addr, elog_size); + release_mem_region(elog_base, elog_size); +-- +2.43.0 + diff --git a/queue-6.6/acpi-numa-fix-the-logic-of-getting-the-fake_pxm-valu.patch b/queue-6.6/acpi-numa-fix-the-logic-of-getting-the-fake_pxm-valu.patch new file mode 100644 index 00000000000..1301bd19bd3 --- /dev/null +++ b/queue-6.6/acpi-numa-fix-the-logic-of-getting-the-fake_pxm-valu.patch @@ -0,0 +1,49 @@ +From dc667998670c1b839fba4685fdc3d465943c5249 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 18:43:18 +0800 +Subject: ACPI: NUMA: Fix the logic of getting the fake_pxm value + +From: Yuntao Wang + +[ Upstream commit e3f577830ce216b0ca21d4750cbbd64cfc21efff ] + +The for loop does not iterate over the last element of the node_to_pxm_map +array. This could lead to a conflict between the final fake_pxm value and +the existing pxm values. That is, the final fake_pxm value can not be +guaranteed to be an unused pxm value. + +While at it, fix up white space in slit_valid(). + +Signed-off-by: Yuntao Wang +[ rjw: Changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/numa/srat.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c +index 12f330b0eac0..b57de78fbf14 100644 +--- a/drivers/acpi/numa/srat.c ++++ b/drivers/acpi/numa/srat.c +@@ -183,7 +183,7 @@ static int __init slit_valid(struct acpi_table_slit *slit) + int i, j; + int d = slit->locality_count; + for (i = 0; i < d; i++) { +- for (j = 0; j < d; j++) { ++ for (j = 0; j < d; j++) { + u8 val = slit->entry[d*i + j]; + if (i == j) { + if (val != LOCAL_DISTANCE) +@@ -532,7 +532,7 @@ int __init acpi_numa_init(void) + */ + + /* fake_pxm is the next unused PXM value after SRAT parsing */ +- for (i = 0, fake_pxm = -1; i < MAX_NUMNODES - 1; i++) { ++ for (i = 0, fake_pxm = -1; i < MAX_NUMNODES; i++) { + if (node_to_pxm_map[i] > fake_pxm) + fake_pxm = node_to_pxm_map[i]; + } +-- +2.43.0 + diff --git a/queue-6.6/acpi-video-add-quirk-for-the-colorful-x15-at-23-lapt.patch b/queue-6.6/acpi-video-add-quirk-for-the-colorful-x15-at-23-lapt.patch new file mode 100644 index 00000000000..21904f7189a --- /dev/null +++ b/queue-6.6/acpi-video-add-quirk-for-the-colorful-x15-at-23-lapt.patch @@ -0,0 +1,51 @@ +From c186dccd61e782d66ddea253a305b93bb261bc8d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Nov 2023 21:59:13 +0800 +Subject: ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop + +From: Yuluo Qiu + +[ Upstream commit 143176a46bdd3bfbe9ba2462bf94458e80d65ebf ] + +The Colorful X15 AT 23 ACPI video-bus device report spurious +ACPI_VIDEO_NOTIFY_CYCLE events resulting in spurious KEY_SWITCHVIDEOMODE +events being reported to userspace (and causing trouble there) when +an external screen plugged in. + +Add a quirk setting the report_key_events mask to +REPORT_BRIGHTNESS_KEY_EVENTS so that the ACPI_VIDEO_NOTIFY_CYCLE +events will be ignored, while still reporting brightness up/down +hotkey-presses to userspace normally. + +Signed-off-by: Yuluo Qiu +Co-developed-by: Celeste Liu +Signed-off-by: Celeste Liu +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/acpi_video.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c +index 27a6ae89f13a..a971770e24ff 100644 +--- a/drivers/acpi/acpi_video.c ++++ b/drivers/acpi/acpi_video.c +@@ -500,6 +500,15 @@ static const struct dmi_system_id video_dmi_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3350"), + }, + }, ++ { ++ .callback = video_set_report_key_events, ++ .driver_data = (void *)((uintptr_t)REPORT_BRIGHTNESS_KEY_EVENTS), ++ .ident = "COLORFUL X15 AT 23", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "COLORFUL"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "X15 AT 23"), ++ }, ++ }, + /* + * Some machines change the brightness themselves when a brightness + * hotkey gets pressed, despite us telling them not to. In this case +-- +2.43.0 + diff --git a/queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_fi.patch b/queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_fi.patch new file mode 100644 index 00000000000..597a5c25578 --- /dev/null +++ b/queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_fi.patch @@ -0,0 +1,89 @@ +From 6f888afc055ada1fa2fa66b8adc9353e72bebcc4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 12:56:14 +0100 +Subject: afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*() + +From: Oleg Nesterov + +[ Upstream commit 1702e0654ca9a7bcd7c7619c8a5004db58945b71 ] + +David Howells says: + + (5) afs_find_server(). + + There could be a lot of servers in the list and each server can have + multiple addresses, so I think this would be better with an exclusive + second pass. + + The server list isn't likely to change all that often, but when it does + change, there's a good chance several servers are going to be + added/removed one after the other. Further, this is only going to be + used for incoming cache management/callback requests from the server, + which hopefully aren't going to happen too often - but it is remotely + drivable. + + (6) afs_find_server_by_uuid(). + + Similarly to (5), there could be a lot of servers to search through, but + they are in a tree not a flat list, so it should be faster to process. + Again, it's not likely to change that often and, again, when it does + change it's likely to involve multiple changes. This can be driven + remotely by an incoming cache management request but is mostly going to + be driven by setting up or reconfiguring a volume's server list - + something that also isn't likely to happen often. + +Make the "seq" counter odd on the 2nd pass, otherwise read_seqbegin_or_lock() +never takes the lock. + +Signed-off-by: Oleg Nesterov +Signed-off-by: David Howells +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Link: https://lore.kernel.org/r/20231130115614.GA21581@redhat.com/ +Signed-off-by: Sasha Levin +--- + fs/afs/server.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/fs/afs/server.c b/fs/afs/server.c +index b5237206eac3..0bd2f5ba6900 100644 +--- a/fs/afs/server.c ++++ b/fs/afs/server.c +@@ -27,7 +27,7 @@ struct afs_server *afs_find_server(struct afs_net *net, + const struct afs_addr_list *alist; + struct afs_server *server = NULL; + unsigned int i; +- int seq = 0, diff; ++ int seq = 1, diff; + + rcu_read_lock(); + +@@ -35,6 +35,7 @@ struct afs_server *afs_find_server(struct afs_net *net, + if (server) + afs_unuse_server_notime(net, server, afs_server_trace_put_find_rsq); + server = NULL; ++ seq++; /* 2 on the 1st/lockless path, otherwise odd */ + read_seqbegin_or_lock(&net->fs_addr_lock, &seq); + + if (srx->transport.family == AF_INET6) { +@@ -90,7 +91,7 @@ struct afs_server *afs_find_server_by_uuid(struct afs_net *net, const uuid_t *uu + { + struct afs_server *server = NULL; + struct rb_node *p; +- int diff, seq = 0; ++ int diff, seq = 1; + + _enter("%pU", uuid); + +@@ -102,7 +103,7 @@ struct afs_server *afs_find_server_by_uuid(struct afs_net *net, const uuid_t *uu + if (server) + afs_unuse_server(net, server, afs_server_trace_put_uuid_rsq); + server = NULL; +- ++ seq++; /* 2 on the 1st/lockless path, otherwise odd */ + read_seqbegin_or_lock(&net->fs_lock, &seq); + + p = net->fs_servers.rb_node; +-- +2.43.0 + diff --git a/queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_lo.patch b/queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_lo.patch new file mode 100644 index 00000000000..cf74d0c33ed --- /dev/null +++ b/queue-6.6/afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_lo.patch @@ -0,0 +1,54 @@ +From 481f8eaa0bbbd9d495dd6ac1b5ed5c7278cab859 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 12:56:06 +0100 +Subject: afs: fix the usage of read_seqbegin_or_lock() in + afs_lookup_volume_rcu() + +From: Oleg Nesterov + +[ Upstream commit 4121b4337146b64560d1e46ebec77196d9287802 ] + +David Howells says: + + (2) afs_lookup_volume_rcu(). + + There can be a lot of volumes known by a system. A thousand would + require a 10-step walk and this is drivable by remote operation, so I + think this should probably take a lock on the second pass too. + +Make the "seq" counter odd on the 2nd pass, otherwise read_seqbegin_or_lock() +never takes the lock. + +Signed-off-by: Oleg Nesterov +Signed-off-by: David Howells +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Link: https://lore.kernel.org/r/20231130115606.GA21571@redhat.com/ +Signed-off-by: Sasha Levin +--- + fs/afs/callback.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/afs/callback.c b/fs/afs/callback.c +index a484fa642808..90f9b2a46ff4 100644 +--- a/fs/afs/callback.c ++++ b/fs/afs/callback.c +@@ -110,13 +110,14 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell, + { + struct afs_volume *volume = NULL; + struct rb_node *p; +- int seq = 0; ++ int seq = 1; + + do { + /* Unfortunately, rbtree walking doesn't give reliable results + * under just the RCU read lock, so we have to check for + * changes. + */ ++ seq++; /* 2 on the 1st/lockless path, otherwise odd */ + read_seqbegin_or_lock(&cell->volume_lock, &seq); + + p = rcu_dereference_raw(cell->volumes.rb_node); +-- +2.43.0 + diff --git a/queue-6.6/alsa-hda-conexant-fix-headset-auto-detect-fail-in-cx.patch b/queue-6.6/alsa-hda-conexant-fix-headset-auto-detect-fail-in-cx.patch new file mode 100644 index 00000000000..2dfcdc3ef68 --- /dev/null +++ b/queue-6.6/alsa-hda-conexant-fix-headset-auto-detect-fail-in-cx.patch @@ -0,0 +1,200 @@ +From 1cd6216aa4a83edf90aeb31c666ff3648fcc649f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Jan 2024 19:02:35 +0800 +Subject: ALSA: hda/conexant: Fix headset auto detect fail in cx8070 and SN6140 + +From: bo liu + +[ Upstream commit 7aeb259086487417f0fecf66e325bee133e8813a ] + +When OMTP headset plugin the headset jack of CX8070 and SN6160 sound cards, +the headset type detection circuit will recognize the headset type as CTIA. +At this point, plugout and plugin the headset will get the correct headset +type as OMTP. +The reason for the failure of headset type recognition is that the sound +card creation will enable the VREF voltage of the headset mic, which +interferes with the headset type automatic detection circuit. Plugout and +plugin the headset will restart the headset detection and get the correct +headset type. +The patch is disable the VREF voltage when the headset is not present, and +will enable the VREF voltage when the headset is present. + +Signed-off-by: bo liu +Link: https://lore.kernel.org/r/20240108110235.3867-1-bo.liu@senarytech.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_conexant.c | 115 ++++++++++++++++++++++++++++++++- + 1 file changed, 113 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c +index a889cccdd607..e8819e8a9876 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -21,6 +21,12 @@ + #include "hda_jack.h" + #include "hda_generic.h" + ++enum { ++ CX_HEADSET_NOPRESENT = 0, ++ CX_HEADSET_PARTPRESENT, ++ CX_HEADSET_ALLPRESENT, ++}; ++ + struct conexant_spec { + struct hda_gen_spec gen; + +@@ -42,7 +48,8 @@ struct conexant_spec { + unsigned int gpio_led; + unsigned int gpio_mute_led_mask; + unsigned int gpio_mic_led_mask; +- ++ unsigned int headset_present_flag; ++ bool is_cx8070_sn6140; + }; + + +@@ -164,6 +171,27 @@ static void cxt_init_gpio_led(struct hda_codec *codec) + } + } + ++static void cx_fixup_headset_recog(struct hda_codec *codec) ++{ ++ unsigned int mic_persent; ++ ++ /* fix some headset type recognize fail issue, such as EDIFIER headset */ ++ /* set micbiasd output current comparator threshold from 66% to 55%. */ ++ snd_hda_codec_write(codec, 0x1c, 0, 0x320, 0x010); ++ /* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias registor ++ * value adjustment trim from 2.2K ohms to 2.0K ohms. ++ */ ++ snd_hda_codec_write(codec, 0x1c, 0, 0x3b0, 0xe10); ++ /* fix reboot headset type recognize fail issue */ ++ mic_persent = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); ++ if (mic_persent & AC_PINSENSE_PRESENCE) ++ /* enable headset mic VREF */ ++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); ++ else ++ /* disable headset mic VREF */ ++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); ++} ++ + static int cx_auto_init(struct hda_codec *codec) + { + struct conexant_spec *spec = codec->spec; +@@ -174,6 +202,9 @@ static int cx_auto_init(struct hda_codec *codec) + cxt_init_gpio_led(codec); + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); + ++ if (spec->is_cx8070_sn6140) ++ cx_fixup_headset_recog(codec); ++ + return 0; + } + +@@ -192,6 +223,77 @@ static void cx_auto_free(struct hda_codec *codec) + snd_hda_gen_free(codec); + } + ++static void cx_process_headset_plugin(struct hda_codec *codec) ++{ ++ unsigned int val; ++ unsigned int count = 0; ++ ++ /* Wait headset detect done. */ ++ do { ++ val = snd_hda_codec_read(codec, 0x1c, 0, 0xca0, 0x0); ++ if (val & 0x080) { ++ codec_dbg(codec, "headset type detect done!\n"); ++ break; ++ } ++ msleep(20); ++ count++; ++ } while (count < 3); ++ val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0); ++ if (val & 0x800) { ++ codec_dbg(codec, "headset plugin, type is CTIA\n"); ++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); ++ } else if (val & 0x400) { ++ codec_dbg(codec, "headset plugin, type is OMTP\n"); ++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); ++ } else { ++ codec_dbg(codec, "headphone plugin\n"); ++ } ++} ++ ++static void cx_update_headset_mic_vref(struct hda_codec *codec, unsigned int res) ++{ ++ unsigned int phone_present, mic_persent, phone_tag, mic_tag; ++ struct conexant_spec *spec = codec->spec; ++ ++ /* In cx8070 and sn6140, the node 16 can only be config to headphone or disabled, ++ * the node 19 can only be config to microphone or disabled. ++ * Check hp&mic tag to process headset pulgin&plugout. ++ */ ++ phone_tag = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); ++ mic_tag = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); ++ if ((phone_tag & (res >> AC_UNSOL_RES_TAG_SHIFT)) || ++ (mic_tag & (res >> AC_UNSOL_RES_TAG_SHIFT))) { ++ phone_present = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_PIN_SENSE, 0x0); ++ if (!(phone_present & AC_PINSENSE_PRESENCE)) {/* headphone plugout */ ++ spec->headset_present_flag = CX_HEADSET_NOPRESENT; ++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); ++ return; ++ } ++ if (spec->headset_present_flag == CX_HEADSET_NOPRESENT) { ++ spec->headset_present_flag = CX_HEADSET_PARTPRESENT; ++ } else if (spec->headset_present_flag == CX_HEADSET_PARTPRESENT) { ++ mic_persent = snd_hda_codec_read(codec, 0x19, 0, ++ AC_VERB_GET_PIN_SENSE, 0x0); ++ /* headset is present */ ++ if ((phone_present & AC_PINSENSE_PRESENCE) && ++ (mic_persent & AC_PINSENSE_PRESENCE)) { ++ cx_process_headset_plugin(codec); ++ spec->headset_present_flag = CX_HEADSET_ALLPRESENT; ++ } ++ } ++ } ++} ++ ++static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res) ++{ ++ struct conexant_spec *spec = codec->spec; ++ ++ if (spec->is_cx8070_sn6140) ++ cx_update_headset_mic_vref(codec, res); ++ ++ snd_hda_jack_unsol_event(codec, res); ++} ++ + #ifdef CONFIG_PM + static int cx_auto_suspend(struct hda_codec *codec) + { +@@ -205,7 +307,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = { + .build_pcms = snd_hda_gen_build_pcms, + .init = cx_auto_init, + .free = cx_auto_free, +- .unsol_event = snd_hda_jack_unsol_event, ++ .unsol_event = cx_jack_unsol_event, + #ifdef CONFIG_PM + .suspend = cx_auto_suspend, + .check_power_status = snd_hda_gen_check_power_status, +@@ -1042,6 +1144,15 @@ static int patch_conexant_auto(struct hda_codec *codec) + codec->spec = spec; + codec->patch_ops = cx_auto_patch_ops; + ++ /* init cx8070/sn6140 flag and reset headset_present_flag */ ++ switch (codec->core.vendor_id) { ++ case 0x14f11f86: ++ case 0x14f11f87: ++ spec->is_cx8070_sn6140 = true; ++ spec->headset_present_flag = CX_HEADSET_NOPRESENT; ++ break; ++ } ++ + cx_auto_parse_eapd(codec); + spec->gen.own_eapd_ctl = 1; + +-- +2.43.0 + diff --git a/queue-6.6/alsa-hda-intel-add-hda_arl-pci-id-support.patch b/queue-6.6/alsa-hda-intel-add-hda_arl-pci-id-support.patch new file mode 100644 index 00000000000..b46e1adaf02 --- /dev/null +++ b/queue-6.6/alsa-hda-intel-add-hda_arl-pci-id-support.patch @@ -0,0 +1,41 @@ +From e3a85e8755a5d612b01677d256f5339b9fe552b2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 15:27:07 -0600 +Subject: ALSA: hda: Intel: add HDA_ARL PCI ID support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Louis Bossart + +[ Upstream commit a31014ebad617868c246d3985ff80d891f03711e ] + +Yet another PCI ID. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Péter Ujfalusi +Reviewed-by: Kai Vehmanen +Acked-by: Mark Brown +Link: https://lore.kernel.org/r/20231204212710.185976-3-pierre-louis.bossart@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_intel.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index 75148485b755..55d3a78112e0 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2504,6 +2504,8 @@ static const struct pci_device_id azx_ids[] = { + { PCI_DEVICE_DATA(INTEL, HDA_LNL_P, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) }, + /* Arrow Lake-S */ + { PCI_DEVICE_DATA(INTEL, HDA_ARL_S, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) }, ++ /* Arrow Lake */ ++ { PCI_DEVICE_DATA(INTEL, HDA_ARL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) }, + /* Apollolake (Broxton-P) */ + { PCI_DEVICE_DATA(INTEL, HDA_APL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON) }, + /* Gemini-Lake */ +-- +2.43.0 + diff --git a/queue-6.6/alsa-hda-intel-dspcfg-add-filters-for-arl-s-and-arl.patch b/queue-6.6/alsa-hda-intel-dspcfg-add-filters-for-arl-s-and-arl.patch new file mode 100644 index 00000000000..1c993d60e55 --- /dev/null +++ b/queue-6.6/alsa-hda-intel-dspcfg-add-filters-for-arl-s-and-arl.patch @@ -0,0 +1,49 @@ +From 562d426f62da68d83e6e5351a86384bb2afaf69e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 15:27:08 -0600 +Subject: ALSA: hda: intel-dspcfg: add filters for ARL-S and ARL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Louis Bossart + +[ Upstream commit 7a9d6bbe8a663c817080be55d9fecf19a4a8fd8f ] + +Same usual filters, SOF is required for DMIC and/or SoundWire support. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Péter Ujfalusi +Reviewed-by: Kai Vehmanen +Acked-by: Mark Brown +Link: https://lore.kernel.org/r/20231204212710.185976-4-pierre-louis.bossart@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/hda/intel-dsp-config.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c +index 756fa0aa69bb..6a384b922e4f 100644 +--- a/sound/hda/intel-dsp-config.c ++++ b/sound/hda/intel-dsp-config.c +@@ -521,6 +521,16 @@ static const struct config_entry config_table[] = { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .device = PCI_DEVICE_ID_INTEL_HDA_MTL, + }, ++ /* ArrowLake-S */ ++ { ++ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, ++ .device = PCI_DEVICE_ID_INTEL_HDA_ARL_S, ++ }, ++ /* ArrowLake */ ++ { ++ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, ++ .device = PCI_DEVICE_ID_INTEL_HDA_ARL, ++ }, + #endif + + /* Lunar Lake */ +-- +2.43.0 + diff --git a/queue-6.6/alsa-hda-refer-to-correct-stream-index-at-loops.patch b/queue-6.6/alsa-hda-refer-to-correct-stream-index-at-loops.patch new file mode 100644 index 00000000000..d2fbefef139 --- /dev/null +++ b/queue-6.6/alsa-hda-refer-to-correct-stream-index-at-loops.patch @@ -0,0 +1,70 @@ +From 641df41ff5c7667254d1f8ca824695d61ded47e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 16:41:25 +0100 +Subject: ALSA: hda: Refer to correct stream index at loops + +From: Takashi Iwai + +[ Upstream commit 26257869672fd4a06a60c2da841e15fb2cb47bbe ] + +In a couple of loops over the all streams, we check the bitmap against +the loop counter. A more correct reference would be, however, the +index of each stream, instead. + +This patch corrects the check of bitmaps to the stream index. + +Note that this change doesn't fix anything for now; all existing +drivers set up the stream indices properly, hence the loop count is +always equal with the stream index. That said, this change is only +for consistency. + +Link: https://lore.kernel.org/r/20231121154125.4888-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/hda/hdac_stream.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c +index 214a0680524b..fe0958f9969c 100644 +--- a/sound/hda/hdac_stream.c ++++ b/sound/hda/hdac_stream.c +@@ -660,17 +660,15 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev, + struct hdac_stream *s; + bool inited = false; + u64 cycle_last = 0; +- int i = 0; + + list_for_each_entry(s, &bus->stream_list, list) { +- if (streams & (1 << i)) { ++ if ((streams & (1 << s->index))) { + azx_timecounter_init(s, inited, cycle_last); + if (!inited) { + inited = true; + cycle_last = s->tc.cycle_last; + } + } +- i++; + } + + snd_pcm_gettime(runtime, &runtime->trigger_tstamp); +@@ -715,14 +713,13 @@ void snd_hdac_stream_sync(struct hdac_stream *azx_dev, bool start, + unsigned int streams) + { + struct hdac_bus *bus = azx_dev->bus; +- int i, nwait, timeout; ++ int nwait, timeout; + struct hdac_stream *s; + + for (timeout = 5000; timeout; timeout--) { + nwait = 0; +- i = 0; + list_for_each_entry(s, &bus->stream_list, list) { +- if (!(streams & (1 << i++))) ++ if (!(streams & (1 << s->index))) + continue; + + if (start) { +-- +2.43.0 + diff --git a/queue-6.6/arch-consolidate-arch_irq_work_raise-prototypes.patch b/queue-6.6/arch-consolidate-arch_irq_work_raise-prototypes.patch new file mode 100644 index 00000000000..667bf0d818b --- /dev/null +++ b/queue-6.6/arch-consolidate-arch_irq_work_raise-prototypes.patch @@ -0,0 +1,130 @@ +From f341f817f3348970bc7abb091f819289a424f2ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Nov 2023 13:58:29 +0100 +Subject: arch: consolidate arch_irq_work_raise prototypes + +From: Arnd Bergmann + +[ Upstream commit 64bac5ea17d527872121adddfee869c7a0618f8f ] + +The prototype was hidden in an #ifdef on x86, which causes a warning: + +kernel/irq_work.c:72:13: error: no previous prototype for 'arch_irq_work_raise' [-Werror=missing-prototypes] + +Some architectures have a working prototype, while others don't. +Fix this by providing it in only one place that is always visible. + +Reviewed-by: Alexander Gordeev +Acked-by: Catalin Marinas +Acked-by: Palmer Dabbelt +Acked-by: Guo Ren +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/arm/include/asm/irq_work.h | 2 -- + arch/arm64/include/asm/irq_work.h | 2 -- + arch/csky/include/asm/irq_work.h | 2 +- + arch/powerpc/include/asm/irq_work.h | 1 - + arch/riscv/include/asm/irq_work.h | 2 +- + arch/s390/include/asm/irq_work.h | 2 -- + arch/x86/include/asm/irq_work.h | 1 - + include/linux/irq_work.h | 3 +++ + 8 files changed, 5 insertions(+), 10 deletions(-) + +diff --git a/arch/arm/include/asm/irq_work.h b/arch/arm/include/asm/irq_work.h +index 3149e4dc1b54..8895999834cc 100644 +--- a/arch/arm/include/asm/irq_work.h ++++ b/arch/arm/include/asm/irq_work.h +@@ -9,6 +9,4 @@ static inline bool arch_irq_work_has_interrupt(void) + return is_smp(); + } + +-extern void arch_irq_work_raise(void); +- + #endif /* _ASM_ARM_IRQ_WORK_H */ +diff --git a/arch/arm64/include/asm/irq_work.h b/arch/arm64/include/asm/irq_work.h +index 81bbfa3a035b..a1020285ea75 100644 +--- a/arch/arm64/include/asm/irq_work.h ++++ b/arch/arm64/include/asm/irq_work.h +@@ -2,8 +2,6 @@ + #ifndef __ASM_IRQ_WORK_H + #define __ASM_IRQ_WORK_H + +-extern void arch_irq_work_raise(void); +- + static inline bool arch_irq_work_has_interrupt(void) + { + return true; +diff --git a/arch/csky/include/asm/irq_work.h b/arch/csky/include/asm/irq_work.h +index 33aaf39d6f94..d39fcc1f5395 100644 +--- a/arch/csky/include/asm/irq_work.h ++++ b/arch/csky/include/asm/irq_work.h +@@ -7,5 +7,5 @@ static inline bool arch_irq_work_has_interrupt(void) + { + return true; + } +-extern void arch_irq_work_raise(void); ++ + #endif /* __ASM_CSKY_IRQ_WORK_H */ +diff --git a/arch/powerpc/include/asm/irq_work.h b/arch/powerpc/include/asm/irq_work.h +index b8b0be8f1a07..c6d3078bd8c3 100644 +--- a/arch/powerpc/include/asm/irq_work.h ++++ b/arch/powerpc/include/asm/irq_work.h +@@ -6,6 +6,5 @@ static inline bool arch_irq_work_has_interrupt(void) + { + return true; + } +-extern void arch_irq_work_raise(void); + + #endif /* _ASM_POWERPC_IRQ_WORK_H */ +diff --git a/arch/riscv/include/asm/irq_work.h b/arch/riscv/include/asm/irq_work.h +index b53891964ae0..b27a4d64fc6a 100644 +--- a/arch/riscv/include/asm/irq_work.h ++++ b/arch/riscv/include/asm/irq_work.h +@@ -6,5 +6,5 @@ static inline bool arch_irq_work_has_interrupt(void) + { + return IS_ENABLED(CONFIG_SMP); + } +-extern void arch_irq_work_raise(void); ++ + #endif /* _ASM_RISCV_IRQ_WORK_H */ +diff --git a/arch/s390/include/asm/irq_work.h b/arch/s390/include/asm/irq_work.h +index 603783766d0a..f00c9f610d5a 100644 +--- a/arch/s390/include/asm/irq_work.h ++++ b/arch/s390/include/asm/irq_work.h +@@ -7,6 +7,4 @@ static inline bool arch_irq_work_has_interrupt(void) + return true; + } + +-void arch_irq_work_raise(void); +- + #endif /* _ASM_S390_IRQ_WORK_H */ +diff --git a/arch/x86/include/asm/irq_work.h b/arch/x86/include/asm/irq_work.h +index 800ffce0db29..6b4d36c95165 100644 +--- a/arch/x86/include/asm/irq_work.h ++++ b/arch/x86/include/asm/irq_work.h +@@ -9,7 +9,6 @@ static inline bool arch_irq_work_has_interrupt(void) + { + return boot_cpu_has(X86_FEATURE_APIC); + } +-extern void arch_irq_work_raise(void); + #else + static inline bool arch_irq_work_has_interrupt(void) + { +diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h +index 8cd11a223260..136f2980cba3 100644 +--- a/include/linux/irq_work.h ++++ b/include/linux/irq_work.h +@@ -66,6 +66,9 @@ void irq_work_sync(struct irq_work *work); + void irq_work_run(void); + bool irq_work_needs_cpu(void); + void irq_work_single(void *arg); ++ ++void arch_irq_work_raise(void); ++ + #else + static inline bool irq_work_needs_cpu(void) { return false; } + static inline void irq_work_run(void) { } +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx-use-flash-0-0-pattern.patch b/queue-6.6/arm-dts-imx-use-flash-0-0-pattern.patch new file mode 100644 index 00000000000..308aab12bb8 --- /dev/null +++ b/queue-6.6/arm-dts-imx-use-flash-0-0-pattern.patch @@ -0,0 +1,81 @@ +From e848b320e74726a16840358bf39ddcde9fb5bed3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 09:36:05 -0300 +Subject: ARM: dts: imx: Use flash@0,0 pattern + +From: Fabio Estevam + +[ Upstream commit 1e1d7cc478fb16816de09740e3c323c0c188d58f ] + +Per mtd-physmap.yaml, 'nor@0,0' is not a valid node pattern. + +Change it to 'flash@0,0' to fix the following dt-schema warning: + +imx1-ads.dtb: nor@0,0: $nodename:0: 'nor@0,0' does not match '^(flash|.*sram|nand)(@.*)?$' + from schema $id: http://devicetree.org/schemas/mtd/mtd-physmap.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx1-ads.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx1-apf9328.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx1-ads.dts b/arch/arm/boot/dts/nxp/imx/imx1-ads.dts +index 5833fb6f15d8..2c817c4a4c68 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx1-ads.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx1-ads.dts +@@ -65,7 +65,7 @@ + pinctrl-0 = <&pinctrl_weim>; + status = "okay"; + +- nor: nor@0,0 { ++ nor: flash@0,0 { + compatible = "cfi-flash"; + reg = <0 0x00000000 0x02000000>; + bank-width = <4>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx1-apf9328.dts b/arch/arm/boot/dts/nxp/imx/imx1-apf9328.dts +index 1f11e9542a72..e66eef87a7a4 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx1-apf9328.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx1-apf9328.dts +@@ -45,7 +45,7 @@ + pinctrl-0 = <&pinctrl_weim>; + status = "okay"; + +- nor: nor@0,0 { ++ nor: flash@0,0 { + compatible = "cfi-flash"; + reg = <0 0x00000000 0x02000000>; + bank-width = <2>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi b/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi +index 4b83e2918b55..c7e923584878 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi +@@ -90,7 +90,7 @@ + &weim { + status = "okay"; + +- nor: nor@0,0 { ++ nor: flash@0,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi +index 7191e10712b9..efce284b5796 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi +@@ -314,7 +314,7 @@ + &weim { + status = "okay"; + +- nor: nor@0,0 { ++ nor: flash@0,0 { + compatible = "cfi-flash"; + reg = <0 0x00000000 0x02000000>; + bank-width = <2>; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx1-fix-sram-node.patch b/queue-6.6/arm-dts-imx1-fix-sram-node.patch new file mode 100644 index 00000000000..a6ef2ce9796 --- /dev/null +++ b/queue-6.6/arm-dts-imx1-fix-sram-node.patch @@ -0,0 +1,53 @@ +From 7f56a7e696f4ffd232b28806550016cf9f5f8fc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 09:39:21 -0300 +Subject: ARM: dts: imx1: Fix sram node + +From: Fabio Estevam + +[ Upstream commit c248e535973088ba7071ff6f26ab7951143450af ] + +Per sram.yaml, address-cells, size-cells and ranges are mandatory. + +The node name should be sram. + +Change the node name and pass the required properties to fix the +following dt-schema warnings: + +imx1-apf9328.dtb: esram@300000: $nodename:0: 'esram@300000' does not match '^sram(@.*)?' + from schema $id: http://devicetree.org/schemas/sram/sram.yaml# +imx1-apf9328.dtb: esram@300000: '#address-cells' is a required property + from schema $id: http://devicetree.org/schemas/sram/sram.yaml# +imx1-apf9328.dtb: esram@300000: '#size-cells' is a required property + from schema $id: http://devicetree.org/schemas/sram/sram.yaml# +imx1-apf9328.dtb: esram@300000: 'ranges' is a required property + from schema $id: http://devicetree.org/schemas/sram/sram.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx1.dtsi | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx1.dtsi b/arch/arm/boot/dts/nxp/imx/imx1.dtsi +index e312f1e74e2f..4aeb74479f44 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx1.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx1.dtsi +@@ -268,9 +268,12 @@ + status = "disabled"; + }; + +- esram: esram@300000 { ++ esram: sram@300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x20000>; ++ ranges = <0 0x00300000 0x20000>; ++ #address-cells = <1>; ++ #size-cells = <1>; + }; + }; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx23-28-fix-the-dma-controller-node-name.patch b/queue-6.6/arm-dts-imx23-28-fix-the-dma-controller-node-name.patch new file mode 100644 index 00000000000..c42f72649be --- /dev/null +++ b/queue-6.6/arm-dts-imx23-28-fix-the-dma-controller-node-name.patch @@ -0,0 +1,53 @@ +From 9ba4f7f5d4b50aba7c217a5e47c2eac329038b9e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 07:26:31 -0300 +Subject: ARM: dts: imx23/28: Fix the DMA controller node name + +From: Fabio Estevam + +[ Upstream commit 858d83ca4b50bbc8693d95cc94310e6d791fb2e6 ] + +Per fsl,mxs-dma.yaml, the node name should be 'dma-controller'. + +Change it to fix the following dt-schema warning. + +imx28-apf28.dtb: dma-apbx@80024000: $nodename:0: 'dma-apbx@80024000' does not match '^dma-controller(@.*)?$' + from schema $id: http://devicetree.org/schemas/dma/fsl,mxs-dma.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/mxs/imx23.dtsi | 2 +- + arch/arm/boot/dts/nxp/mxs/imx28.dtsi | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/nxp/mxs/imx23.dtsi b/arch/arm/boot/dts/nxp/mxs/imx23.dtsi +index 5eca942a52fd..14c07b585f82 100644 +--- a/arch/arm/boot/dts/nxp/mxs/imx23.dtsi ++++ b/arch/arm/boot/dts/nxp/mxs/imx23.dtsi +@@ -412,7 +412,7 @@ + status = "disabled"; + }; + +- dma_apbx: dma-apbx@80024000 { ++ dma_apbx: dma-controller@80024000 { + compatible = "fsl,imx23-dma-apbx"; + reg = <0x80024000 0x2000>; + interrupts = <7>, <5>, <9>, <26>, +diff --git a/arch/arm/boot/dts/nxp/mxs/imx28.dtsi b/arch/arm/boot/dts/nxp/mxs/imx28.dtsi +index 763adeb995ee..9b73130887ea 100644 +--- a/arch/arm/boot/dts/nxp/mxs/imx28.dtsi ++++ b/arch/arm/boot/dts/nxp/mxs/imx28.dtsi +@@ -990,7 +990,7 @@ + status = "disabled"; + }; + +- dma_apbx: dma-apbx@80024000 { ++ dma_apbx: dma-controller@80024000 { + compatible = "fsl,imx28-dma-apbx"; + reg = <0x80024000 0x2000>; + interrupts = <78>, <79>, <66>, <0>, +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx23-sansa-use-preferred-i2c-gpios-properti.patch b/queue-6.6/arm-dts-imx23-sansa-use-preferred-i2c-gpios-properti.patch new file mode 100644 index 00000000000..c0fbf424ccc --- /dev/null +++ b/queue-6.6/arm-dts-imx23-sansa-use-preferred-i2c-gpios-properti.patch @@ -0,0 +1,61 @@ +From 923ec16be64db6ba5879ffd57653a5d3cb021fdd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 07:12:12 -0300 +Subject: ARM: dts: imx23-sansa: Use preferred i2c-gpios properties + +From: Fabio Estevam + +[ Upstream commit e3aa1a82fb20ee97597022f6528823a8ab82bde6 ] + +The 'gpios' property to describe the SDA and SCL GPIOs is considered +deprecated according to i2c-gpio.yaml. + +Switch to the preferred 'sda-gpios' and 'scl-gpios' properties. + +This fixes the following schema warnings: + +imx23-sansa.dtb: i2c-0: 'sda-gpios' is a required property + from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml# +imx23-sansa.dtb: i2c-0: 'scl-gpios' is a required property + from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/mxs/imx23-sansa.dts | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/nxp/mxs/imx23-sansa.dts b/arch/arm/boot/dts/nxp/mxs/imx23-sansa.dts +index 46057d9bf555..c2efcc20ae80 100644 +--- a/arch/arm/boot/dts/nxp/mxs/imx23-sansa.dts ++++ b/arch/arm/boot/dts/nxp/mxs/imx23-sansa.dts +@@ -175,10 +175,8 @@ + #address-cells = <1>; + #size-cells = <0>; + compatible = "i2c-gpio"; +- gpios = < +- &gpio1 24 0 /* SDA */ +- &gpio1 22 0 /* SCL */ +- >; ++ sda-gpios = <&gpio1 24 0>; ++ scl-gpios = <&gpio1 22 0>; + i2c-gpio,delay-us = <2>; /* ~100 kHz */ + }; + +@@ -186,10 +184,8 @@ + #address-cells = <1>; + #size-cells = <0>; + compatible = "i2c-gpio"; +- gpios = < +- &gpio0 31 0 /* SDA */ +- &gpio0 30 0 /* SCL */ +- >; ++ sda-gpios = <&gpio0 31 0>; ++ scl-gpios = <&gpio0 30 0>; + i2c-gpio,delay-us = <2>; /* ~100 kHz */ + + touch: touch@20 { +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx25-27-eukrea-fix-rtc-node-name.patch b/queue-6.6/arm-dts-imx25-27-eukrea-fix-rtc-node-name.patch new file mode 100644 index 00000000000..0c0c384d189 --- /dev/null +++ b/queue-6.6/arm-dts-imx25-27-eukrea-fix-rtc-node-name.patch @@ -0,0 +1,52 @@ +From d0cc8db93efd1ea14dae32dcd2ffb4bde3551704 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 08:58:26 -0300 +Subject: ARM: dts: imx25/27-eukrea: Fix RTC node name + +From: Fabio Estevam + +[ Upstream commit 68c711b882c262e36895547cddea2c2d56ce611d ] + +Node names should be generic. Use 'rtc' as node name to fix +the following dt-schema warning: + +imx25-eukrea-mbimxsd25-baseboard.dtb: pcf8563@51: $nodename:0: 'pcf8563@51' does not match '^rtc(@.*|-([0-9]|[1-9][0-9]+))?$' + from schema $id: http://devicetree.org/schemas/rtc/nxp,pcf8563.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx25-eukrea-cpuimx25.dtsi | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-cpuimx25.dtsi b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-cpuimx25.dtsi +index 0703f62d10d1..93a6e4e680b4 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-cpuimx25.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-cpuimx25.dtsi +@@ -27,7 +27,7 @@ + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + +- pcf8563@51 { ++ rtc@51 { + compatible = "nxp,pcf8563"; + reg = <0x51>; + }; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi b/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi +index 74110bbcd9d4..4b83e2918b55 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx27-eukrea-cpuimx27.dtsi +@@ -33,7 +33,7 @@ + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + +- pcf8563@51 { ++ rtc@51 { + compatible = "nxp,pcf8563"; + reg = <0x51>; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx25-27-pass-timing0.patch b/queue-6.6/arm-dts-imx25-27-pass-timing0.patch new file mode 100644 index 00000000000..41aba6c3e9a --- /dev/null +++ b/queue-6.6/arm-dts-imx25-27-pass-timing0.patch @@ -0,0 +1,138 @@ +From 22d2505b2c855b2848ca37ce199d3d40e43501a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 17:14:05 -0300 +Subject: ARM: dts: imx25/27: Pass timing0 + +From: Fabio Estevam + +[ Upstream commit 11ab7ad6f795ae23c398a4a5c56505d3dab27c4c ] + +Per display-timings.yaml, the 'timing' pattern should be used to +describe the display timings. + +Change it accordingly to fix the following dt-schema warning: + +imx27-apf27dev.dtb: display-timings: '800x480' does not match any of the regexes: '^timing', 'pinctrl-[0-9]+' + from schema $id: http://devicetree.org/schemas/display/panel/display-timings.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + .../dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts | 2 +- + .../dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts | 2 +- + .../dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx25-pdk.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-phytec-phycard-s-rdk.dts | 2 +- + arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-rdk.dts | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts +index fc8a502fc957..6cddb2cc36fe 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts +@@ -16,7 +16,7 @@ + bus-width = <18>; + display-timings { + native-mode = <&qvga_timings>; +- qvga_timings: 320x240 { ++ qvga_timings: timing0 { + clock-frequency = <6500000>; + hactive = <320>; + vactive = <240>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts +index 80a7f96de4c6..64b2ffac463b 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts +@@ -16,7 +16,7 @@ + bus-width = <18>; + display-timings { + native-mode = <&dvi_svga_timings>; +- dvi_svga_timings: 800x600 { ++ dvi_svga_timings: timing0 { + clock-frequency = <40000000>; + hactive = <800>; + vactive = <600>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts +index 24027a1fb46d..fb074bfdaa8d 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts +@@ -16,7 +16,7 @@ + bus-width = <18>; + display-timings { + native-mode = <&dvi_vga_timings>; +- dvi_vga_timings: 640x480 { ++ dvi_vga_timings: timing0 { + clock-frequency = <31250000>; + hactive = <640>; + vactive = <480>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx25-pdk.dts b/arch/arm/boot/dts/nxp/imx/imx25-pdk.dts +index 04f4b127a172..e93bf3b7115f 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx25-pdk.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx25-pdk.dts +@@ -68,7 +68,7 @@ + bus-width = <18>; + display-timings { + native-mode = <&wvga_timings>; +- wvga_timings: 640x480 { ++ wvga_timings: timing0 { + hactive = <640>; + vactive = <480>; + hback-porch = <45>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts b/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts +index a21f1f7c24b8..f047a8487073 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts +@@ -16,7 +16,7 @@ + fsl,pcr = <0xfae80083>; /* non-standard but required */ + display-timings { + native-mode = <&timing0>; +- timing0: 800x480 { ++ timing0: timing0 { + clock-frequency = <33000033>; + hactive = <800>; + vactive = <480>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts b/arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts +index 145e459625b3..d78793601306 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts +@@ -16,7 +16,7 @@ + + display-timings { + native-mode = <&timing0>; +- timing0: 320x240 { ++ timing0: timing0 { + clock-frequency = <6500000>; + hactive = <320>; + vactive = <240>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycard-s-rdk.dts b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycard-s-rdk.dts +index 25442eba21c1..27c93b9fe049 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycard-s-rdk.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycard-s-rdk.dts +@@ -19,7 +19,7 @@ + fsl,pcr = <0xf0c88080>; /* non-standard but required */ + display-timings { + native-mode = <&timing0>; +- timing0: 640x480 { ++ timing0: timing0 { + hactive = <640>; + vactive = <480>; + hback-porch = <112>; +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-rdk.dts b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-rdk.dts +index 7f0cd4d3ec2d..67b235044b70 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-rdk.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-rdk.dts +@@ -19,7 +19,7 @@ + + display-timings { + native-mode = <&timing0>; +- timing0: 240x320 { ++ timing0: timing0 { + clock-frequency = <5500000>; + hactive = <240>; + vactive = <320>; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx25-fix-the-iim-compatible-string.patch b/queue-6.6/arm-dts-imx25-fix-the-iim-compatible-string.patch new file mode 100644 index 00000000000..4abd37c7562 --- /dev/null +++ b/queue-6.6/arm-dts-imx25-fix-the-iim-compatible-string.patch @@ -0,0 +1,40 @@ +From 102f0475510b7a1540b57ecb33fcb98698e11ef5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 17:00:33 -0300 +Subject: ARM: dts: imx25: Fix the iim compatible string + +From: Fabio Estevam + +[ Upstream commit f0b929f58719fc57a4926ab4fc972f185453d6a5 ] + +Per imx-iim.yaml, the compatible string should only contain a single +entry. + +Use it as "fsl,imx25-iim" to fix the following dt-schema warning: + +imx25-karo-tx25.dtb: efuse@53ff0000: compatible: ['fsl,imx25-iim', 'fsl,imx27-iim'] is too long + from schema $id: http://devicetree.org/schemas/nvmem/imx-iim.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx25.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx25.dtsi b/arch/arm/boot/dts/nxp/imx/imx25.dtsi +index 5f90d72b840b..5ac4549286bd 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx25.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx25.dtsi +@@ -543,7 +543,7 @@ + }; + + iim: efuse@53ff0000 { +- compatible = "fsl,imx25-iim", "fsl,imx27-iim"; ++ compatible = "fsl,imx25-iim"; + reg = <0x53ff0000 0x4000>; + interrupts = <19>; + clocks = <&clks 99>; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx27-apf27dev-fix-led-name.patch b/queue-6.6/arm-dts-imx27-apf27dev-fix-led-name.patch new file mode 100644 index 00000000000..42de3e8794d --- /dev/null +++ b/queue-6.6/arm-dts-imx27-apf27dev-fix-led-name.patch @@ -0,0 +1,39 @@ +From 8879864f6fdc7b2e1cee872beda56b72ecd79ee1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 17:19:05 -0300 +Subject: ARM: dts: imx27-apf27dev: Fix LED name + +From: Fabio Estevam + +[ Upstream commit dc35e253d032b959d92e12f081db5b00db26ae64 ] + +Per leds-gpio.yaml, the led names should start with 'led'. + +Change it to fix the following dt-schema warning: + +imx27-apf27dev.dtb: leds: 'user' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' + from schema $id: http://devicetree.org/schemas/leds/leds-gpio.yaml# + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts b/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts +index f047a8487073..849306cb4532 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts ++++ b/arch/arm/boot/dts/nxp/imx/imx27-apf27dev.dts +@@ -47,7 +47,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpio_leds>; + +- user { ++ led-user { + label = "Heartbeat"; + gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx27-fix-sram-node.patch b/queue-6.6/arm-dts-imx27-fix-sram-node.patch new file mode 100644 index 00000000000..30e4a06610c --- /dev/null +++ b/queue-6.6/arm-dts-imx27-fix-sram-node.patch @@ -0,0 +1,37 @@ +From 0d17a51a16e91927fc6541f80f1c9a10fd4af116 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 09:39:20 -0300 +Subject: ARM: dts: imx27: Fix sram node + +From: Fabio Estevam + +[ Upstream commit 2fb7b2a2f06bb3f8321cf26c33e4e820c5b238b6 ] + +Per sram.yaml, address-cells, size-cells and ranges are mandatory. + +Pass them to fix the following dt-schema warnings: + +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx27.dtsi | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx27.dtsi b/arch/arm/boot/dts/nxp/imx/imx27.dtsi +index faba12ee7465..cac4b3d68986 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx27.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx27.dtsi +@@ -588,6 +588,9 @@ + iram: sram@ffff4c00 { + compatible = "mmio-sram"; + reg = <0xffff4c00 0xb400>; ++ ranges = <0 0xffff4c00 0xb400>; ++ #address-cells = <1>; ++ #size-cells = <1>; + }; + }; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx7d-fix-coresight-funnel-ports.patch b/queue-6.6/arm-dts-imx7d-fix-coresight-funnel-ports.patch new file mode 100644 index 00000000000..9fc05dd14b2 --- /dev/null +++ b/queue-6.6/arm-dts-imx7d-fix-coresight-funnel-ports.patch @@ -0,0 +1,60 @@ +From b9add6c4aebb707c0ef0a324d23f8671ec80d8ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 10:15:53 +0200 +Subject: ARM: dts: imx7d: Fix coresight funnel ports + +From: Alexander Stein + +[ Upstream commit 0d4ac04fa7c3f6dc263dba6f575a2ec7a2d4eca8 ] + +imx7d uses two ports for 'in-ports', so the syntax port@ has to +be used. imx7d has both port and port@1 nodes present, raising these +error: +funnel@30041000: in-ports: More than one condition true in oneOf schema +funnel@30041000: Unevaluated properties are not allowed +('in-ports' was unexpected) + +Fix this by also using port@0 for imx7s as well. + +Signed-off-by: Alexander Stein +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx7d.dtsi | 3 --- + arch/arm/boot/dts/nxp/imx/imx7s.dtsi | 6 +++++- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx7d.dtsi b/arch/arm/boot/dts/nxp/imx/imx7d.dtsi +index 4b94b8afb55d..0484e349e064 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx7d.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx7d.dtsi +@@ -217,9 +217,6 @@ + }; + + &ca_funnel_in_ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@1 { + reg = <1>; + ca_funnel_in_port1: endpoint { +diff --git a/arch/arm/boot/dts/nxp/imx/imx7s.dtsi b/arch/arm/boot/dts/nxp/imx/imx7s.dtsi +index bc79163c49b5..2e3513b7111e 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx7s.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx7s.dtsi +@@ -190,7 +190,11 @@ + clock-names = "apb_pclk"; + + ca_funnel_in_ports: in-ports { +- port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; + ca_funnel_in_port0: endpoint { + remote-endpoint = <&etm0_out_port>; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx7s-fix-lcdif-compatible.patch b/queue-6.6/arm-dts-imx7s-fix-lcdif-compatible.patch new file mode 100644 index 00000000000..1ac4d00cd0d --- /dev/null +++ b/queue-6.6/arm-dts-imx7s-fix-lcdif-compatible.patch @@ -0,0 +1,39 @@ +From 865116fb431f4200480fd443204a1eaabac36361 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 10:15:54 +0200 +Subject: ARM: dts: imx7s: Fix lcdif compatible + +From: Alexander Stein + +[ Upstream commit 5f55da4cc37051cda600ea870ce8cf29f1297715 ] + +imx7d-lcdif is compatible to imx6sx-lcdif. MXSFB_V6 supports overlay +by using LCDC_AS_CTRL register. This registers used by overlay plane: +* LCDC_AS_CTRL +* LCDC_AS_BUF +* LCDC_AS_NEXT_BUF +are listed in i.MX7D RM as well. + +Signed-off-by: Alexander Stein +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx7s.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx7s.dtsi b/arch/arm/boot/dts/nxp/imx/imx7s.dtsi +index 2e3513b7111e..b6d03794d8d9 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx7s.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx7s.dtsi +@@ -818,7 +818,7 @@ + }; + + lcdif: lcdif@30730000 { +- compatible = "fsl,imx7d-lcdif", "fsl,imx28-lcdif"; ++ compatible = "fsl,imx7d-lcdif", "fsl,imx6sx-lcdif"; + reg = <0x30730000 0x10000>; + interrupts = ; + clocks = <&clks IMX7D_LCDIF_PIXEL_ROOT_CLK>, +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-imx7s-fix-nand-controller-size-cells.patch b/queue-6.6/arm-dts-imx7s-fix-nand-controller-size-cells.patch new file mode 100644 index 00000000000..a5e3eb19ac3 --- /dev/null +++ b/queue-6.6/arm-dts-imx7s-fix-nand-controller-size-cells.patch @@ -0,0 +1,38 @@ +From ec56cf81d7d4c242bc717467b5ee4f4c117d27bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 10:15:55 +0200 +Subject: ARM: dts: imx7s: Fix nand-controller #size-cells + +From: Alexander Stein + +[ Upstream commit 4aadb841ed49bada1415c48c44d21f5b69e01299 ] + +nand-controller.yaml bindings says #size-cells shall be set to 0. +Fixes the dtbs_check warning: +arch/arm/boot/dts/nxp/imx/imx7s-mba7.dtb: nand-controller@33002000: + #size-cells:0:0: 0 was expected + from schema $id: http://devicetree.org/schemas/mtd/gpmi-nand.yaml# + +Signed-off-by: Alexander Stein +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/nxp/imx/imx7s.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/nxp/imx/imx7s.dtsi b/arch/arm/boot/dts/nxp/imx/imx7s.dtsi +index b6d03794d8d9..39e9f1411ebb 100644 +--- a/arch/arm/boot/dts/nxp/imx/imx7s.dtsi ++++ b/arch/arm/boot/dts/nxp/imx/imx7s.dtsi +@@ -1282,7 +1282,7 @@ + gpmi: nand-controller@33002000 { + compatible = "fsl,imx7d-gpmi-nand"; + #address-cells = <1>; +- #size-cells = <1>; ++ #size-cells = <0>; + reg = <0x33002000 0x2000>, <0x33004000 0x4000>; + reg-names = "gpmi-nand", "bch"; + interrupts = ; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-marvell-fix-some-common-switch-mistakes.patch b/queue-6.6/arm-dts-marvell-fix-some-common-switch-mistakes.patch new file mode 100644 index 00000000000..d7eeadb44a5 --- /dev/null +++ b/queue-6.6/arm-dts-marvell-fix-some-common-switch-mistakes.patch @@ -0,0 +1,725 @@ +From 8d2027a1670f1eed5c120122b7cb8d2b91483fa1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 16:51:00 +0100 +Subject: ARM: dts: marvell: Fix some common switch mistakes + +From: Linus Walleij + +[ Upstream commit 2b83557a588f739fd0a63efe1c3bc851cdf3d5f6 ] + +Fix some errors in the Marvell MV88E6xxx switch descriptions: +- The top node had no address size or cells. +- switch0@0 is not OK, should be ethernet-switch@0. +- The ports node should be named ethernet-ports +- The ethernet-ports node should have port@0 etc children, no + plural "ports" in the children. +- Ports should be named ethernet-port@0 etc +- PHYs should be named ethernet-phy@0 etc + +This serves as an example of fixes needed for introducing a +schema for the bindings, but the patch can simply be applied. + +Reviewed-by: Andrew Lunn +Signed-off-by: Linus Walleij +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/marvell/armada-370-rd.dts | 24 +++++----- + .../marvell/armada-381-netgear-gs110emx.dts | 44 +++++++++---------- + .../marvell/armada-385-clearfog-gtr-l8.dts | 38 ++++++++-------- + .../marvell/armada-385-clearfog-gtr-s4.dts | 22 +++++----- + .../boot/dts/marvell/armada-385-linksys.dtsi | 18 ++++---- + .../dts/marvell/armada-385-turris-omnia.dts | 20 ++++----- + .../boot/dts/marvell/armada-388-clearfog.dts | 20 ++++----- + .../dts/marvell/armada-xp-linksys-mamba.dts | 18 ++++---- + 8 files changed, 96 insertions(+), 108 deletions(-) + +diff --git a/arch/arm/boot/dts/marvell/armada-370-rd.dts b/arch/arm/boot/dts/marvell/armada-370-rd.dts +index b459a670f615..1b241da11e94 100644 +--- a/arch/arm/boot/dts/marvell/armada-370-rd.dts ++++ b/arch/arm/boot/dts/marvell/armada-370-rd.dts +@@ -149,39 +149,37 @@ + }; + }; + +- switch: switch@10 { ++ switch: ethernet-switch@10 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <0x10>; + interrupt-controller; + #interrupt-cells = <2>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ ethernet-port@0 { + reg = <0>; + label = "lan0"; + }; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan1"; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan2"; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan3"; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + ethernet = <ð1>; + phy-mode = "rgmii-id"; +@@ -196,25 +194,25 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switchphy0: switchphy@0 { ++ switchphy0: ethernet-phy@0 { + reg = <0>; + interrupt-parent = <&switch>; + interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + }; + +- switchphy1: switchphy@1 { ++ switchphy1: ethernet-phy@1 { + reg = <1>; + interrupt-parent = <&switch>; + interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; + }; + +- switchphy2: switchphy@2 { ++ switchphy2: ethernet-phy@2 { + reg = <2>; + interrupt-parent = <&switch>; + interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + }; + +- switchphy3: switchphy@3 { ++ switchphy3: ethernet-phy@3 { + reg = <3>; + interrupt-parent = <&switch>; + interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm/boot/dts/marvell/armada-381-netgear-gs110emx.dts b/arch/arm/boot/dts/marvell/armada-381-netgear-gs110emx.dts +index f4c4b213ef4e..5baf83e5253d 100644 +--- a/arch/arm/boot/dts/marvell/armada-381-netgear-gs110emx.dts ++++ b/arch/arm/boot/dts/marvell/armada-381-netgear-gs110emx.dts +@@ -77,51 +77,49 @@ + pinctrl-0 = <&mdio_pins>; + status = "okay"; + +- switch@0 { ++ ethernet-switch@0 { + compatible = "marvell,mv88e6190"; +- #address-cells = <1>; + #interrupt-cells = <2>; + interrupt-controller; + interrupt-parent = <&gpio1>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + pinctrl-0 = <&switch_interrupt_pins>; + pinctrl-names = "default"; +- #size-cells = <0>; + reg = <0>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy1: switch0phy1@1 { ++ switch0phy1: ethernet-phy@1 { + reg = <0x1>; + }; + +- switch0phy2: switch0phy2@2 { ++ switch0phy2: ethernet-phy@2 { + reg = <0x2>; + }; + +- switch0phy3: switch0phy3@3 { ++ switch0phy3: ethernet-phy@3 { + reg = <0x3>; + }; + +- switch0phy4: switch0phy4@4 { ++ switch0phy4: ethernet-phy@4 { + reg = <0x4>; + }; + +- switch0phy5: switch0phy5@5 { ++ switch0phy5: ethernet-phy@5 { + reg = <0x5>; + }; + +- switch0phy6: switch0phy6@6 { ++ switch0phy6: ethernet-phy@6 { + reg = <0x6>; + }; + +- switch0phy7: switch0phy7@7 { ++ switch0phy7: ethernet-phy@7 { + reg = <0x7>; + }; + +- switch0phy8: switch0phy8@8 { ++ switch0phy8: ethernet-phy@8 { + reg = <0x8>; + }; + }; +@@ -142,11 +140,11 @@ + }; + }; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ ethernet-port@0 { + ethernet = <ð0>; + phy-mode = "rgmii"; + reg = <0>; +@@ -158,55 +156,55 @@ + }; + }; + +- port@1 { ++ ethernet-port@1 { + label = "lan1"; + phy-handle = <&switch0phy1>; + reg = <1>; + }; + +- port@2 { ++ ethernet-port@2 { + label = "lan2"; + phy-handle = <&switch0phy2>; + reg = <2>; + }; + +- port@3 { ++ ethernet-port@3 { + label = "lan3"; + phy-handle = <&switch0phy3>; + reg = <3>; + }; + +- port@4 { ++ ethernet-port@4 { + label = "lan4"; + phy-handle = <&switch0phy4>; + reg = <4>; + }; + +- port@5 { ++ ethernet-port@5 { + label = "lan5"; + phy-handle = <&switch0phy5>; + reg = <5>; + }; + +- port@6 { ++ ethernet-port@6 { + label = "lan6"; + phy-handle = <&switch0phy6>; + reg = <6>; + }; + +- port@7 { ++ ethernet-port@7 { + label = "lan7"; + phy-handle = <&switch0phy7>; + reg = <7>; + }; + +- port@8 { ++ ethernet-port@8 { + label = "lan8"; + phy-handle = <&switch0phy8>; + reg = <8>; + }; + +- port@9 { ++ ethernet-port@9 { + /* 88X3310P external phy */ + label = "lan9"; + phy-handle = <&phy1>; +@@ -214,7 +212,7 @@ + reg = <9>; + }; + +- port@a { ++ ethernet-port@a { + /* 88X3310P external phy */ + label = "lan10"; + phy-handle = <&phy2>; +diff --git a/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-l8.dts b/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-l8.dts +index 1990f7d0cc79..1707d1b01545 100644 +--- a/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-l8.dts ++++ b/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-l8.dts +@@ -7,66 +7,66 @@ + }; + + &mdio { +- switch0: switch0@4 { ++ switch0: ethernet-switch@4 { + compatible = "marvell,mv88e6190"; + reg = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&cf_gtr_switch_reset_pins>; + reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan8"; + phy-handle = <&switch0phy0>; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan7"; + phy-handle = <&switch0phy1>; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan6"; + phy-handle = <&switch0phy2>; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "lan5"; + phy-handle = <&switch0phy3>; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + label = "lan4"; + phy-handle = <&switch0phy4>; + }; + +- port@6 { ++ ethernet-port@6 { + reg = <6>; + label = "lan3"; + phy-handle = <&switch0phy5>; + }; + +- port@7 { ++ ethernet-port@7 { + reg = <7>; + label = "lan2"; + phy-handle = <&switch0phy6>; + }; + +- port@8 { ++ ethernet-port@8 { + reg = <8>; + label = "lan1"; + phy-handle = <&switch0phy7>; + }; + +- port@10 { ++ ethernet-port@10 { + reg = <10>; + phy-mode = "2500base-x"; + +@@ -83,35 +83,35 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy0: switch0phy0@1 { ++ switch0phy0: ethernet-phy@1 { + reg = <0x1>; + }; + +- switch0phy1: switch0phy1@2 { ++ switch0phy1: ethernet-phy@2 { + reg = <0x2>; + }; + +- switch0phy2: switch0phy2@3 { ++ switch0phy2: ethernet-phy@3 { + reg = <0x3>; + }; + +- switch0phy3: switch0phy3@4 { ++ switch0phy3: ethernet-phy@4 { + reg = <0x4>; + }; + +- switch0phy4: switch0phy4@5 { ++ switch0phy4: ethernet-phy@5 { + reg = <0x5>; + }; + +- switch0phy5: switch0phy5@6 { ++ switch0phy5: ethernet-phy@6 { + reg = <0x6>; + }; + +- switch0phy6: switch0phy6@7 { ++ switch0phy6: ethernet-phy@7 { + reg = <0x7>; + }; + +- switch0phy7: switch0phy7@8 { ++ switch0phy7: ethernet-phy@8 { + reg = <0x8>; + }; + }; +diff --git a/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-s4.dts b/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-s4.dts +index b795ad573891..a7678a784c18 100644 +--- a/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-s4.dts ++++ b/arch/arm/boot/dts/marvell/armada-385-clearfog-gtr-s4.dts +@@ -11,42 +11,42 @@ + }; + + &mdio { +- switch0: switch0@4 { ++ switch0: ethernet-switch@4 { + compatible = "marvell,mv88e6085"; + reg = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&cf_gtr_switch_reset_pins>; + reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan2"; + phy-handle = <&switch0phy0>; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan1"; + phy-handle = <&switch0phy1>; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan4"; + phy-handle = <&switch0phy2>; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "lan3"; + phy-handle = <&switch0phy3>; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + phy-mode = "2500base-x"; + ethernet = <ð1>; +@@ -63,19 +63,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy0: switch0phy0@11 { ++ switch0phy0: ethernet-phy@11 { + reg = <0x11>; + }; + +- switch0phy1: switch0phy1@12 { ++ switch0phy1: ethernet-phy@12 { + reg = <0x12>; + }; + +- switch0phy2: switch0phy2@13 { ++ switch0phy2: ethernet-phy@13 { + reg = <0x13>; + }; + +- switch0phy3: switch0phy3@14 { ++ switch0phy3: ethernet-phy@14 { + reg = <0x14>; + }; + }; +diff --git a/arch/arm/boot/dts/marvell/armada-385-linksys.dtsi b/arch/arm/boot/dts/marvell/armada-385-linksys.dtsi +index fc8216fd9f60..4116ed60f709 100644 +--- a/arch/arm/boot/dts/marvell/armada-385-linksys.dtsi ++++ b/arch/arm/boot/dts/marvell/armada-385-linksys.dtsi +@@ -158,42 +158,40 @@ + &mdio { + status = "okay"; + +- switch@0 { ++ ethernet-switch@0 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <0>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ ethernet-port@0 { + reg = <0>; + label = "lan4"; + }; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan3"; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan2"; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan1"; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "wan"; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + phy-mode = "sgmii"; + ethernet = <ð2>; +diff --git a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts +index 2d8d319bec83..7b755bb4e4e7 100644 +--- a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts ++++ b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts +@@ -435,12 +435,10 @@ + }; + + /* Switch MV88E6176 at address 0x10 */ +- switch@10 { ++ ethernet-switch@10 { + pinctrl-names = "default"; + pinctrl-0 = <&swint_pins>; + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + + dsa,member = <0 0>; + reg = <0x10>; +@@ -448,36 +446,36 @@ + interrupt-parent = <&gpio1>; + interrupts = <13 IRQ_TYPE_LEVEL_LOW>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- ports@0 { ++ ethernet-port@0 { + reg = <0>; + label = "lan0"; + }; + +- ports@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan1"; + }; + +- ports@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan2"; + }; + +- ports@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan3"; + }; + +- ports@4 { ++ ethernet-port@4 { + reg = <4>; + label = "lan4"; + }; + +- ports@5 { ++ ethernet-port@5 { + reg = <5>; + ethernet = <ð1>; + phy-mode = "rgmii-id"; +@@ -488,7 +486,7 @@ + }; + }; + +- ports@6 { ++ ethernet-port@6 { + reg = <6>; + ethernet = <ð0>; + phy-mode = "rgmii-id"; +diff --git a/arch/arm/boot/dts/marvell/armada-388-clearfog.dts b/arch/arm/boot/dts/marvell/armada-388-clearfog.dts +index 32c569df142f..3290ccad2374 100644 +--- a/arch/arm/boot/dts/marvell/armada-388-clearfog.dts ++++ b/arch/arm/boot/dts/marvell/armada-388-clearfog.dts +@@ -92,44 +92,42 @@ + &mdio { + status = "okay"; + +- switch@4 { ++ ethernet-switch@4 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <4>; + pinctrl-0 = <&clearfog_dsa0_clk_pins &clearfog_dsa0_pins>; + pinctrl-names = "default"; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ ethernet-port@0 { + reg = <0>; + label = "lan5"; + }; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan4"; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan3"; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan2"; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "lan1"; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + ethernet = <ð1>; + phy-mode = "1000base-x"; +@@ -140,7 +138,7 @@ + }; + }; + +- port@6 { ++ ethernet-port@6 { + /* 88E1512 external phy */ + reg = <6>; + label = "lan6"; +diff --git a/arch/arm/boot/dts/marvell/armada-xp-linksys-mamba.dts b/arch/arm/boot/dts/marvell/armada-xp-linksys-mamba.dts +index 7a0614fd0c93..ea859f7ea042 100644 +--- a/arch/arm/boot/dts/marvell/armada-xp-linksys-mamba.dts ++++ b/arch/arm/boot/dts/marvell/armada-xp-linksys-mamba.dts +@@ -265,42 +265,40 @@ + &mdio { + status = "okay"; + +- switch@0 { ++ ethernet-switch@0 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <0>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ ethernet-port@0 { + reg = <0>; + label = "lan4"; + }; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan3"; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan2"; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan1"; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "internet"; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + phy-mode = "rgmii-id"; + ethernet = <ð0>; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-qcom-mdm9615-fix-pmic-node-labels.patch b/queue-6.6/arm-dts-qcom-mdm9615-fix-pmic-node-labels.patch new file mode 100644 index 00000000000..37d64d6c10a --- /dev/null +++ b/queue-6.6/arm-dts-qcom-mdm9615-fix-pmic-node-labels.patch @@ -0,0 +1,96 @@ +From f9aa873e41e40384f0c983c2a4e5b9afba04071b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Sep 2023 14:02:42 +0300 +Subject: ARM: dts: qcom: mdm9615: fix PMIC node labels + +From: Dmitry Baryshkov + +[ Upstream commit 0e4688cd4ee6efbeae2b31f75e16961fd7f72735 ] + +Change PM8018 node labels to start with pm8018_ prefix, following other +Qualcomm PMIC device nodes. + +Reviewed-by: Konrad Dybcio +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20230928110309.1212221-10-dmitry.baryshkov@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548.dtsi | 2 +- + arch/arm/boot/dts/qcom/qcom-mdm9615.dtsi | 14 +++++++------- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548.dtsi b/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548.dtsi +index 92c8003dac25..dac3aa793f71 100644 +--- a/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548.dtsi ++++ b/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548.dtsi +@@ -76,7 +76,7 @@ + }; + }; + +-&pmicgpio { ++&pm8018_gpio { + usb_vbus_5v_pins: usb-vbus-5v-state { + pins = "gpio4"; + function = "normal"; +diff --git a/arch/arm/boot/dts/qcom/qcom-mdm9615.dtsi b/arch/arm/boot/dts/qcom/qcom-mdm9615.dtsi +index 63e21aa23642..c0a60bae703b 100644 +--- a/arch/arm/boot/dts/qcom/qcom-mdm9615.dtsi ++++ b/arch/arm/boot/dts/qcom/qcom-mdm9615.dtsi +@@ -261,7 +261,7 @@ + reg = <0x500000 0x1000>; + qcom,controller-type = "pmic-arbiter"; + +- pmicintc: pmic { ++ pm8018: pmic { + compatible = "qcom,pm8018", "qcom,pm8921"; + interrupts = ; + #interrupt-cells = <2>; +@@ -272,38 +272,38 @@ + pwrkey@1c { + compatible = "qcom,pm8018-pwrkey", "qcom,pm8921-pwrkey"; + reg = <0x1c>; +- interrupt-parent = <&pmicintc>; ++ interrupt-parent = <&pm8018>; + interrupts = <50 IRQ_TYPE_EDGE_RISING>, + <51 IRQ_TYPE_EDGE_RISING>; + debounce = <15625>; + pull-up; + }; + +- pmicmpp: mpps@50 { ++ pm8018_mpps: mpps@50 { + compatible = "qcom,pm8018-mpp", "qcom,ssbi-mpp"; + interrupt-controller; + #interrupt-cells = <2>; + reg = <0x50>; + gpio-controller; + #gpio-cells = <2>; +- gpio-ranges = <&pmicmpp 0 0 6>; ++ gpio-ranges = <&pm8018_mpps 0 0 6>; + }; + + rtc@11d { + compatible = "qcom,pm8018-rtc", "qcom,pm8921-rtc"; +- interrupt-parent = <&pmicintc>; ++ interrupt-parent = <&pm8018>; + interrupts = <39 IRQ_TYPE_EDGE_RISING>; + reg = <0x11d>; + allow-set-time; + }; + +- pmicgpio: gpio@150 { ++ pm8018_gpio: gpio@150 { + compatible = "qcom,pm8018-gpio", "qcom,ssbi-gpio"; + reg = <0x150>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; +- gpio-ranges = <&pmicgpio 0 0 6>; ++ gpio-ranges = <&pm8018_gpio 0 0 6>; + #gpio-cells = <2>; + }; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-qcom-msm8660-fix-pmic-node-labels.patch b/queue-6.6/arm-dts-qcom-msm8660-fix-pmic-node-labels.patch new file mode 100644 index 00000000000..e8bbe424c77 --- /dev/null +++ b/queue-6.6/arm-dts-qcom-msm8660-fix-pmic-node-labels.patch @@ -0,0 +1,81 @@ +From 22dd5570f859fb5ceafdd0dbc725c79f7f166eee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Sep 2023 14:02:43 +0300 +Subject: ARM: dts: qcom: msm8660: fix PMIC node labels + +From: Dmitry Baryshkov + +[ Upstream commit c6d86aa8a12194d1c9c2f9108910a46c8a3ddc90 ] + +Change PM8058 node labels to start with pm8058_ prefix, following other +Qualcomm PMIC device nodes. + +Reviewed-by: Konrad Dybcio +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20230928110309.1212221-11-dmitry.baryshkov@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + .../boot/dts/qcom/qcom-apq8060-dragonboard.dts | 4 ++-- + arch/arm/boot/dts/qcom/qcom-msm8660.dtsi | 16 ++++++++-------- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts +index db4c791b2e2f..48fd1a1feea3 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts +@@ -72,7 +72,7 @@ + /* Trig on both edges - getting close or far away */ + interrupts-extended = <&pm8058_gpio 34 IRQ_TYPE_EDGE_BOTH>; + /* MPP05 analog input to the XOADC */ +- io-channels = <&xoadc 0x00 0x05>; ++ io-channels = <&pm8058_xoadc 0x00 0x05>; + io-channel-names = "aout"; + pinctrl-names = "default"; + pinctrl-0 = <&dragon_cm3605_gpios>, <&dragon_cm3605_mpps>; +@@ -945,7 +945,7 @@ + }; + }; + +-&xoadc { ++&pm8058_xoadc { + /* Reference voltage 2.2 V */ + xoadc-ref-supply = <&pm8058_l18>; + +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi +index 78023ed2fdf7..9217ced108c4 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi ++++ b/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi +@@ -80,13 +80,13 @@ + */ + iio-hwmon { + compatible = "iio-hwmon"; +- io-channels = <&xoadc 0x00 0x01>, /* Battery */ +- <&xoadc 0x00 0x02>, /* DC in (charger) */ +- <&xoadc 0x00 0x04>, /* VPH the main system voltage */ +- <&xoadc 0x00 0x0b>, /* Die temperature */ +- <&xoadc 0x00 0x0c>, /* Reference voltage 1.25V */ +- <&xoadc 0x00 0x0d>, /* Reference voltage 0.625V */ +- <&xoadc 0x00 0x0e>; /* Reference voltage 0.325V */ ++ io-channels = <&pm8058_xoadc 0x00 0x01>, /* Battery */ ++ <&pm8058_xoadc 0x00 0x02>, /* DC in (charger) */ ++ <&pm8058_xoadc 0x00 0x04>, /* VPH the main system voltage */ ++ <&pm8058_xoadc 0x00 0x0b>, /* Die temperature */ ++ <&pm8058_xoadc 0x00 0x0c>, /* Reference voltage 1.25V */ ++ <&pm8058_xoadc 0x00 0x0d>, /* Reference voltage 0.625V */ ++ <&pm8058_xoadc 0x00 0x0e>; /* Reference voltage 0.325V */ + }; + + soc: soc { +@@ -390,7 +390,7 @@ + row-hold = <91500>; + }; + +- xoadc: xoadc@197 { ++ pm8058_xoadc: xoadc@197 { + compatible = "qcom,pm8058-adc"; + reg = <0x197>; + interrupts-extended = <&pm8058 76 IRQ_TYPE_EDGE_RISING>; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-qcom-msm8960-fix-pmic-node-labels.patch b/queue-6.6/arm-dts-qcom-msm8960-fix-pmic-node-labels.patch new file mode 100644 index 00000000000..c2d7e5356f3 --- /dev/null +++ b/queue-6.6/arm-dts-qcom-msm8960-fix-pmic-node-labels.patch @@ -0,0 +1,64 @@ +From 9fae0df1e5953fd76e71a4f49d2a00fff7ee2ffb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Sep 2023 14:02:44 +0300 +Subject: ARM: dts: qcom: msm8960: fix PMIC node labels + +From: Dmitry Baryshkov + +[ Upstream commit a10a09f34eb80b83ca7275e23bf982dae2aa7632 ] + +Change PM8921 node labels to start with pm8921_ prefix, following other +Qualcomm PMIC device nodes. + +Reviewed-by: Konrad Dybcio +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20230928110309.1212221-12-dmitry.baryshkov@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi +index d13080fcbeea..9099b858a76f 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi ++++ b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi +@@ -264,7 +264,7 @@ + reg = <0x500000 0x1000>; + qcom,controller-type = "pmic-arbiter"; + +- pmicintc: pmic { ++ pm8921: pmic { + compatible = "qcom,pm8921"; + interrupt-parent = <&msmgpio>; + interrupts = <104 IRQ_TYPE_LEVEL_LOW>; +@@ -276,7 +276,7 @@ + pwrkey@1c { + compatible = "qcom,pm8921-pwrkey"; + reg = <0x1c>; +- interrupt-parent = <&pmicintc>; ++ interrupt-parent = <&pm8921>; + interrupts = <50 IRQ_TYPE_EDGE_RISING>, + <51 IRQ_TYPE_EDGE_RISING>; + debounce = <15625>; +@@ -286,7 +286,7 @@ + keypad@148 { + compatible = "qcom,pm8921-keypad"; + reg = <0x148>; +- interrupt-parent = <&pmicintc>; ++ interrupt-parent = <&pm8921>; + interrupts = <74 IRQ_TYPE_EDGE_RISING>, + <75 IRQ_TYPE_EDGE_RISING>; + debounce = <15>; +@@ -296,7 +296,7 @@ + + rtc@11d { + compatible = "qcom,pm8921-rtc"; +- interrupt-parent = <&pmicintc>; ++ interrupt-parent = <&pm8921>; + interrupts = <39 IRQ_TYPE_EDGE_RISING>; + reg = <0x11d>; + allow-set-time; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-qcom-strip-prefix-from-pmic-files.patch b/queue-6.6/arm-dts-qcom-strip-prefix-from-pmic-files.patch new file mode 100644 index 00000000000..3b5bf67fe76 --- /dev/null +++ b/queue-6.6/arm-dts-qcom-strip-prefix-from-pmic-files.patch @@ -0,0 +1,302 @@ +From 2e4ef88fc26497b242f800ff4bc6e3f4a3d305ef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Sep 2023 14:02:40 +0300 +Subject: ARM: dts: qcom: strip prefix from PMIC files + +From: Dmitry Baryshkov + +[ Upstream commit 455a4c46e023ab84263eae0fc7acca9a5ee8b7ac ] + +As the vendor DTS files were moved to per-vendor subdirs, there no need +to use common prefixes. Drop the `qcom-' prefix from PMIC dtsi file. +This makes 32-bit qcom/ dts files closer to arm64 ones. + +Reviewed-by: Konrad Dybcio +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20230928110309.1212221-8-dmitry.baryshkov@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/qcom/{qcom-pm8226.dtsi => pm8226.dtsi} | 0 + arch/arm/boot/dts/qcom/{qcom-pm8841.dtsi => pm8841.dtsi} | 0 + arch/arm/boot/dts/qcom/{qcom-pm8941.dtsi => pm8941.dtsi} | 0 + arch/arm/boot/dts/qcom/{qcom-pma8084.dtsi => pma8084.dtsi} | 0 + arch/arm/boot/dts/qcom/{qcom-pmx55.dtsi => pmx55.dtsi} | 0 + arch/arm/boot/dts/qcom/{qcom-pmx65.dtsi => pmx65.dtsi} | 0 + arch/arm/boot/dts/qcom/qcom-apq8026-asus-sparrow.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-apq8026-huawei-sturgeon.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-apq8026-lg-lenok.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-apq8026-samsung-matisse-wifi.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-apq8074-dragonboard.dts | 4 ++-- + arch/arm/boot/dts/qcom/qcom-apq8084-ifc6540.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-apq8084-mtp.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts | 4 ++-- + arch/arm/boot/dts/qcom/qcom-msm8974-sony-xperia-rhine.dtsi | 4 ++-- + arch/arm/boot/dts/qcom/qcom-msm8974pro-fairphone-fp2.dts | 4 ++-- + arch/arm/boot/dts/qcom/qcom-msm8974pro-oneplus-bacon.dts | 4 ++-- + arch/arm/boot/dts/qcom/qcom-msm8974pro-samsung-klte.dts | 2 +- + .../dts/qcom/qcom-msm8974pro-sony-xperia-shinano-castor.dts | 4 ++-- + arch/arm/boot/dts/qcom/qcom-sdx55-mtp.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-sdx55-t55.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-sdx55-telit-fn980-tlb.dts | 2 +- + arch/arm/boot/dts/qcom/qcom-sdx65-mtp.dts | 2 +- + 23 files changed, 23 insertions(+), 23 deletions(-) + rename arch/arm/boot/dts/qcom/{qcom-pm8226.dtsi => pm8226.dtsi} (100%) + rename arch/arm/boot/dts/qcom/{qcom-pm8841.dtsi => pm8841.dtsi} (100%) + rename arch/arm/boot/dts/qcom/{qcom-pm8941.dtsi => pm8941.dtsi} (100%) + rename arch/arm/boot/dts/qcom/{qcom-pma8084.dtsi => pma8084.dtsi} (100%) + rename arch/arm/boot/dts/qcom/{qcom-pmx55.dtsi => pmx55.dtsi} (100%) + rename arch/arm/boot/dts/qcom/{qcom-pmx65.dtsi => pmx65.dtsi} (100%) + +diff --git a/arch/arm/boot/dts/qcom/qcom-pm8226.dtsi b/arch/arm/boot/dts/qcom/pm8226.dtsi +similarity index 100% +rename from arch/arm/boot/dts/qcom/qcom-pm8226.dtsi +rename to arch/arm/boot/dts/qcom/pm8226.dtsi +diff --git a/arch/arm/boot/dts/qcom/qcom-pm8841.dtsi b/arch/arm/boot/dts/qcom/pm8841.dtsi +similarity index 100% +rename from arch/arm/boot/dts/qcom/qcom-pm8841.dtsi +rename to arch/arm/boot/dts/qcom/pm8841.dtsi +diff --git a/arch/arm/boot/dts/qcom/qcom-pm8941.dtsi b/arch/arm/boot/dts/qcom/pm8941.dtsi +similarity index 100% +rename from arch/arm/boot/dts/qcom/qcom-pm8941.dtsi +rename to arch/arm/boot/dts/qcom/pm8941.dtsi +diff --git a/arch/arm/boot/dts/qcom/qcom-pma8084.dtsi b/arch/arm/boot/dts/qcom/pma8084.dtsi +similarity index 100% +rename from arch/arm/boot/dts/qcom/qcom-pma8084.dtsi +rename to arch/arm/boot/dts/qcom/pma8084.dtsi +diff --git a/arch/arm/boot/dts/qcom/qcom-pmx55.dtsi b/arch/arm/boot/dts/qcom/pmx55.dtsi +similarity index 100% +rename from arch/arm/boot/dts/qcom/qcom-pmx55.dtsi +rename to arch/arm/boot/dts/qcom/pmx55.dtsi +diff --git a/arch/arm/boot/dts/qcom/qcom-pmx65.dtsi b/arch/arm/boot/dts/qcom/pmx65.dtsi +similarity index 100% +rename from arch/arm/boot/dts/qcom/qcom-pmx65.dtsi +rename to arch/arm/boot/dts/qcom/pmx65.dtsi +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8026-asus-sparrow.dts b/arch/arm/boot/dts/qcom/qcom-apq8026-asus-sparrow.dts +index aa0e0e8d2a97..a39f5a161b03 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8026-asus-sparrow.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8026-asus-sparrow.dts +@@ -6,7 +6,7 @@ + /dts-v1/; + + #include "qcom-msm8226.dtsi" +-#include "qcom-pm8226.dtsi" ++#include "pm8226.dtsi" + + /delete-node/ &adsp_region; + +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8026-huawei-sturgeon.dts b/arch/arm/boot/dts/qcom/qcom-apq8026-huawei-sturgeon.dts +index de19640efe55..59b218042d32 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8026-huawei-sturgeon.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8026-huawei-sturgeon.dts +@@ -6,7 +6,7 @@ + /dts-v1/; + + #include "qcom-msm8226.dtsi" +-#include "qcom-pm8226.dtsi" ++#include "pm8226.dtsi" + #include + + /delete-node/ &adsp_region; +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8026-lg-lenok.dts b/arch/arm/boot/dts/qcom/qcom-apq8026-lg-lenok.dts +index b887e5361ec3..feb78afef3a6 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8026-lg-lenok.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8026-lg-lenok.dts +@@ -6,7 +6,7 @@ + /dts-v1/; + + #include "qcom-msm8226.dtsi" +-#include "qcom-pm8226.dtsi" ++#include "pm8226.dtsi" + + /delete-node/ &adsp_region; + +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8026-samsung-matisse-wifi.dts b/arch/arm/boot/dts/qcom/qcom-apq8026-samsung-matisse-wifi.dts +index f516e0426bb9..cffc069712b2 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8026-samsung-matisse-wifi.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8026-samsung-matisse-wifi.dts +@@ -7,7 +7,7 @@ + + #include + #include "qcom-msm8226.dtsi" +-#include "qcom-pm8226.dtsi" ++#include "pm8226.dtsi" + + /delete-node/ &adsp_region; + /delete-node/ &smem_region; +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom/qcom-apq8074-dragonboard.dts +index 6d1b2439ae3a..950fa652f985 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8074-dragonboard.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8074-dragonboard.dts +@@ -4,8 +4,8 @@ + #include + #include + #include "qcom-msm8974.dtsi" +-#include "qcom-pm8841.dtsi" +-#include "qcom-pm8941.dtsi" ++#include "pm8841.dtsi" ++#include "pm8941.dtsi" + + /delete-node/ &mpss_region; + +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8084-ifc6540.dts b/arch/arm/boot/dts/qcom/qcom-apq8084-ifc6540.dts +index 116e59a3b76d..1df24c922be9 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8084-ifc6540.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8084-ifc6540.dts +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-apq8084.dtsi" +-#include "qcom-pma8084.dtsi" ++#include "pma8084.dtsi" + + / { + model = "Qualcomm APQ8084/IFC6540"; +diff --git a/arch/arm/boot/dts/qcom/qcom-apq8084-mtp.dts b/arch/arm/boot/dts/qcom/qcom-apq8084-mtp.dts +index c6b6680248a6..d4e6aee034af 100644 +--- a/arch/arm/boot/dts/qcom/qcom-apq8084-mtp.dts ++++ b/arch/arm/boot/dts/qcom/qcom-apq8084-mtp.dts +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-apq8084.dtsi" +-#include "qcom-pma8084.dtsi" ++#include "pma8084.dtsi" + + / { + model = "Qualcomm APQ 8084-MTP"; +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts +index 60bdfddeae69..da99f770d4f5 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts ++++ b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-msm8974.dtsi" +-#include "qcom-pm8841.dtsi" +-#include "qcom-pm8941.dtsi" ++#include "pm8841.dtsi" ++#include "pm8941.dtsi" + #include + #include + #include +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974-sony-xperia-rhine.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8974-sony-xperia-rhine.dtsi +index 68a2f9094e53..23ae474698aa 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8974-sony-xperia-rhine.dtsi ++++ b/arch/arm/boot/dts/qcom/qcom-msm8974-sony-xperia-rhine.dtsi +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-msm8974.dtsi" +-#include "qcom-pm8841.dtsi" +-#include "qcom-pm8941.dtsi" ++#include "pm8841.dtsi" ++#include "pm8941.dtsi" + #include + #include + #include +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974pro-fairphone-fp2.dts b/arch/arm/boot/dts/qcom/qcom-msm8974pro-fairphone-fp2.dts +index 42d253b75dad..6c4153689b39 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8974pro-fairphone-fp2.dts ++++ b/arch/arm/boot/dts/qcom/qcom-msm8974pro-fairphone-fp2.dts +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-msm8974pro.dtsi" +-#include "qcom-pm8841.dtsi" +-#include "qcom-pm8941.dtsi" ++#include "pm8841.dtsi" ++#include "pm8941.dtsi" + #include + #include + #include +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974pro-oneplus-bacon.dts b/arch/arm/boot/dts/qcom/qcom-msm8974pro-oneplus-bacon.dts +index 8230d0e1d95d..c0ca264d8140 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8974pro-oneplus-bacon.dts ++++ b/arch/arm/boot/dts/qcom/qcom-msm8974pro-oneplus-bacon.dts +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-msm8974pro.dtsi" +-#include "qcom-pm8841.dtsi" +-#include "qcom-pm8941.dtsi" ++#include "pm8841.dtsi" ++#include "pm8941.dtsi" + #include + #include + +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974pro-samsung-klte.dts b/arch/arm/boot/dts/qcom/qcom-msm8974pro-samsung-klte.dts +index 3e2c86591ee2..325feb89b343 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8974pro-samsung-klte.dts ++++ b/arch/arm/boot/dts/qcom/qcom-msm8974pro-samsung-klte.dts +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-msm8974pro.dtsi" +-#include "qcom-pma8084.dtsi" ++#include "pma8084.dtsi" + #include + #include + #include +diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974pro-sony-xperia-shinano-castor.dts b/arch/arm/boot/dts/qcom/qcom-msm8974pro-sony-xperia-shinano-castor.dts +index 11468d1409f7..0798cce3dbea 100644 +--- a/arch/arm/boot/dts/qcom/qcom-msm8974pro-sony-xperia-shinano-castor.dts ++++ b/arch/arm/boot/dts/qcom/qcom-msm8974pro-sony-xperia-shinano-castor.dts +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + #include "qcom-msm8974pro.dtsi" +-#include "qcom-pm8841.dtsi" +-#include "qcom-pm8941.dtsi" ++#include "pm8841.dtsi" ++#include "pm8941.dtsi" + #include + #include + #include +diff --git a/arch/arm/boot/dts/qcom/qcom-sdx55-mtp.dts b/arch/arm/boot/dts/qcom/qcom-sdx55-mtp.dts +index 7e97ad5803d8..247069361909 100644 +--- a/arch/arm/boot/dts/qcom/qcom-sdx55-mtp.dts ++++ b/arch/arm/boot/dts/qcom/qcom-sdx55-mtp.dts +@@ -9,7 +9,7 @@ + #include "qcom-sdx55.dtsi" + #include + #include +-#include "qcom-pmx55.dtsi" ++#include "pmx55.dtsi" + + / { + model = "Qualcomm Technologies, Inc. SDX55 MTP"; +diff --git a/arch/arm/boot/dts/qcom/qcom-sdx55-t55.dts b/arch/arm/boot/dts/qcom/qcom-sdx55-t55.dts +index 51058b065279..082f7ed1a01f 100644 +--- a/arch/arm/boot/dts/qcom/qcom-sdx55-t55.dts ++++ b/arch/arm/boot/dts/qcom/qcom-sdx55-t55.dts +@@ -8,7 +8,7 @@ + #include + #include + #include "qcom-sdx55.dtsi" +-#include "qcom-pmx55.dtsi" ++#include "pmx55.dtsi" + + / { + model = "Thundercomm T55 Development Kit"; +diff --git a/arch/arm/boot/dts/qcom/qcom-sdx55-telit-fn980-tlb.dts b/arch/arm/boot/dts/qcom/qcom-sdx55-telit-fn980-tlb.dts +index 8fadc6e70692..e336a15b45c4 100644 +--- a/arch/arm/boot/dts/qcom/qcom-sdx55-telit-fn980-tlb.dts ++++ b/arch/arm/boot/dts/qcom/qcom-sdx55-telit-fn980-tlb.dts +@@ -8,7 +8,7 @@ + #include + #include + #include "qcom-sdx55.dtsi" +-#include "qcom-pmx55.dtsi" ++#include "pmx55.dtsi" + + / { + model = "Telit FN980 TLB"; +diff --git a/arch/arm/boot/dts/qcom/qcom-sdx65-mtp.dts b/arch/arm/boot/dts/qcom/qcom-sdx65-mtp.dts +index fcf1c51c5e7a..b87c5434cc29 100644 +--- a/arch/arm/boot/dts/qcom/qcom-sdx65-mtp.dts ++++ b/arch/arm/boot/dts/qcom/qcom-sdx65-mtp.dts +@@ -8,7 +8,7 @@ + #include + #include + #include +-#include "qcom-pmx65.dtsi" ++#include "pmx65.dtsi" + + / { + model = "Qualcomm Technologies, Inc. SDX65 MTP"; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-rockchip-fix-rk3036-hdmi-ports-node.patch b/queue-6.6/arm-dts-rockchip-fix-rk3036-hdmi-ports-node.patch new file mode 100644 index 00000000000..63510060c33 --- /dev/null +++ b/queue-6.6/arm-dts-rockchip-fix-rk3036-hdmi-ports-node.patch @@ -0,0 +1,51 @@ +From da192f0e81c7f21635301bfdb220b04913f285ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 18:40:27 +0100 +Subject: ARM: dts: rockchip: fix rk3036 hdmi ports node + +From: Johan Jonker + +[ Upstream commit 27ded76ef0fcfcf939914532aae575cf23c221b4 ] + +Fix hdmi ports node so that it matches the +rockchip,inno-hdmi.yaml binding. + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/9a2afac1-ed5c-382d-02b0-b2f5f1af3abb@gmail.com +Signed-off-by: Heiko Stuebner +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/rockchip/rk3036.dtsi | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3036.dtsi b/arch/arm/boot/dts/rockchip/rk3036.dtsi +index 78686fc72ce6..c420c7c642cb 100644 +--- a/arch/arm/boot/dts/rockchip/rk3036.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3036.dtsi +@@ -402,12 +402,20 @@ + pinctrl-0 = <&hdmi_ctl>; + status = "disabled"; + +- hdmi_in: port { ++ ports { + #address-cells = <1>; + #size-cells = <0>; +- hdmi_in_vop: endpoint@0 { ++ ++ hdmi_in: port@0 { + reg = <0>; +- remote-endpoint = <&vop_out_hdmi>; ++ ++ hdmi_in_vop: endpoint { ++ remote-endpoint = <&vop_out_hdmi>; ++ }; ++ }; ++ ++ hdmi_out: port@1 { ++ reg = <1>; + }; + }; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-samsung-exynos4-fix-camera-unit-addresses-ra.patch b/queue-6.6/arm-dts-samsung-exynos4-fix-camera-unit-addresses-ra.patch new file mode 100644 index 00000000000..c6ae8333862 --- /dev/null +++ b/queue-6.6/arm-dts-samsung-exynos4-fix-camera-unit-addresses-ra.patch @@ -0,0 +1,171 @@ +From da9a16d1a74dbc3bf62f77f70502e7f0d16fc56a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 22 Jul 2023 14:17:18 +0200 +Subject: ARM: dts: samsung: exynos4: fix camera unit addresses/ranges + +From: Krzysztof Kozlowski + +[ Upstream commit ba2a45a48503665f7e8eeec51f8b40456566b0cd ] + +The camera node has both unit address and children within the same bus +mapping, thus needs proper ranges property to fix dtc W=1 warnings: + + Warning (unit_address_vs_reg): /soc/camera@11800000: node has a unit name, but no reg or ranges property + Warning (simple_bus_reg): /soc/camera@11800000: missing or empty reg/ranges property + +Subtract 0x11800000 from all its children nodes. No functional impact +expected. + +Link: https://lore.kernel.org/r/20230722121719.150094-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/samsung/exynos4.dtsi | 26 +++++++++++------------ + arch/arm/boot/dts/samsung/exynos4x12.dtsi | 17 ++++++++------- + 2 files changed, 22 insertions(+), 21 deletions(-) + +diff --git a/arch/arm/boot/dts/samsung/exynos4.dtsi b/arch/arm/boot/dts/samsung/exynos4.dtsi +index f775b9377a38..7f981b5c0d64 100644 +--- a/arch/arm/boot/dts/samsung/exynos4.dtsi ++++ b/arch/arm/boot/dts/samsung/exynos4.dtsi +@@ -203,16 +203,16 @@ + + camera: camera@11800000 { + compatible = "samsung,fimc"; ++ ranges = <0x0 0x11800000 0xa0000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + #clock-cells = <1>; + clock-output-names = "cam_a_clkout", "cam_b_clkout"; +- ranges; + +- fimc_0: fimc@11800000 { ++ fimc_0: fimc@0 { + compatible = "samsung,exynos4210-fimc"; +- reg = <0x11800000 0x1000>; ++ reg = <0x0 0x1000>; + interrupts = ; + clocks = <&clock CLK_FIMC0>, + <&clock CLK_SCLK_FIMC0>; +@@ -223,9 +223,9 @@ + status = "disabled"; + }; + +- fimc_1: fimc@11810000 { ++ fimc_1: fimc@10000 { + compatible = "samsung,exynos4210-fimc"; +- reg = <0x11810000 0x1000>; ++ reg = <0x00010000 0x1000>; + interrupts = ; + clocks = <&clock CLK_FIMC1>, + <&clock CLK_SCLK_FIMC1>; +@@ -236,9 +236,9 @@ + status = "disabled"; + }; + +- fimc_2: fimc@11820000 { ++ fimc_2: fimc@20000 { + compatible = "samsung,exynos4210-fimc"; +- reg = <0x11820000 0x1000>; ++ reg = <0x00020000 0x1000>; + interrupts = ; + clocks = <&clock CLK_FIMC2>, + <&clock CLK_SCLK_FIMC2>; +@@ -249,9 +249,9 @@ + status = "disabled"; + }; + +- fimc_3: fimc@11830000 { ++ fimc_3: fimc@30000 { + compatible = "samsung,exynos4210-fimc"; +- reg = <0x11830000 0x1000>; ++ reg = <0x00030000 0x1000>; + interrupts = ; + clocks = <&clock CLK_FIMC3>, + <&clock CLK_SCLK_FIMC3>; +@@ -262,9 +262,9 @@ + status = "disabled"; + }; + +- csis_0: csis@11880000 { ++ csis_0: csis@80000 { + compatible = "samsung,exynos4210-csis"; +- reg = <0x11880000 0x4000>; ++ reg = <0x00080000 0x4000>; + interrupts = ; + clocks = <&clock CLK_CSIS0>, + <&clock CLK_SCLK_CSIS0>; +@@ -278,9 +278,9 @@ + #size-cells = <0>; + }; + +- csis_1: csis@11890000 { ++ csis_1: csis@90000 { + compatible = "samsung,exynos4210-csis"; +- reg = <0x11890000 0x4000>; ++ reg = <0x00090000 0x4000>; + interrupts = ; + clocks = <&clock CLK_CSIS1>, + <&clock CLK_SCLK_CSIS1>; +diff --git a/arch/arm/boot/dts/samsung/exynos4x12.dtsi b/arch/arm/boot/dts/samsung/exynos4x12.dtsi +index 84c1db221c98..83d9d0a0a617 100644 +--- a/arch/arm/boot/dts/samsung/exynos4x12.dtsi ++++ b/arch/arm/boot/dts/samsung/exynos4x12.dtsi +@@ -451,14 +451,15 @@ + }; + + &camera { ++ ranges = <0x0 0x11800000 0xba1000>; + clocks = <&clock CLK_SCLK_CAM0>, <&clock CLK_SCLK_CAM1>, + <&clock CLK_PIXELASYNCM0>, <&clock CLK_PIXELASYNCM1>; + clock-names = "sclk_cam0", "sclk_cam1", "pxl_async0", "pxl_async1"; + + /* fimc_[0-3] are configured outside, under phandles */ +- fimc_lite_0: fimc-lite@12390000 { ++ fimc_lite_0: fimc-lite@b90000 { + compatible = "samsung,exynos4212-fimc-lite"; +- reg = <0x12390000 0x1000>; ++ reg = <0x00b90000 0x1000>; + interrupts = ; + power-domains = <&pd_isp>; + clocks = <&isp_clock CLK_ISP_FIMC_LITE0>; +@@ -467,9 +468,9 @@ + status = "disabled"; + }; + +- fimc_lite_1: fimc-lite@123a0000 { ++ fimc_lite_1: fimc-lite@ba0000 { + compatible = "samsung,exynos4212-fimc-lite"; +- reg = <0x123a0000 0x1000>; ++ reg = <0x00ba0000 0x1000>; + interrupts = ; + power-domains = <&pd_isp>; + clocks = <&isp_clock CLK_ISP_FIMC_LITE1>; +@@ -478,9 +479,9 @@ + status = "disabled"; + }; + +- fimc_is: fimc-is@12000000 { ++ fimc_is: fimc-is@800000 { + compatible = "samsung,exynos4212-fimc-is"; +- reg = <0x12000000 0x260000>; ++ reg = <0x00800000 0x260000>; + interrupts = , + ; + power-domains = <&pd_isp>; +@@ -525,9 +526,9 @@ + reg = <0x10020000 0x3000>; + }; + +- i2c1_isp: i2c-isp@12140000 { ++ i2c1_isp: i2c-isp@940000 { + compatible = "samsung,exynos4212-i2c-isp"; +- reg = <0x12140000 0x100>; ++ reg = <0x00940000 0x100>; + clocks = <&isp_clock CLK_ISP_I2C1_ISP>; + clock-names = "i2c_isp"; + #address-cells = <1>; +-- +2.43.0 + diff --git a/queue-6.6/arm-dts-samsung-s5pv210-fix-camera-unit-addresses-ra.patch b/queue-6.6/arm-dts-samsung-s5pv210-fix-camera-unit-addresses-ra.patch new file mode 100644 index 00000000000..8a304a6b2c0 --- /dev/null +++ b/queue-6.6/arm-dts-samsung-s5pv210-fix-camera-unit-addresses-ra.patch @@ -0,0 +1,89 @@ +From d5d036eb73c6648ef533ef53f46e36f70ff27fed Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 22 Jul 2023 14:17:19 +0200 +Subject: ARM: dts: samsung: s5pv210: fix camera unit addresses/ranges + +From: Krzysztof Kozlowski + +[ Upstream commit 07e6a553c2f1d385edfc9185081dee442a9dd38d ] + +The camera node has both unit address and children within the same bus +mapping, thus needs proper ranges property to fix dtc W=1 warnings: + + Warning (unit_address_vs_reg): /soc/camera@fa600000: node has a unit name, but no reg or ranges property + Warning (simple_bus_reg): /soc/camera@fa600000: missing or empty reg/ranges property + +Subtract 0xfa600000 from all its children nodes. No functional impact +expected. + +Link: https://lore.kernel.org/r/20230722121719.150094-3-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/samsung/s5pv210.dtsi | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/arch/arm/boot/dts/samsung/s5pv210.dtsi b/arch/arm/boot/dts/samsung/s5pv210.dtsi +index f7de5b5f2f38..ed560c9a3aa1 100644 +--- a/arch/arm/boot/dts/samsung/s5pv210.dtsi ++++ b/arch/arm/boot/dts/samsung/s5pv210.dtsi +@@ -549,17 +549,17 @@ + + camera: camera@fa600000 { + compatible = "samsung,fimc"; ++ ranges = <0x0 0xfa600000 0xe01000>; + clocks = <&clocks SCLK_CAM0>, <&clocks SCLK_CAM1>; + clock-names = "sclk_cam0", "sclk_cam1"; + #address-cells = <1>; + #size-cells = <1>; + #clock-cells = <1>; + clock-output-names = "cam_a_clkout", "cam_b_clkout"; +- ranges; + +- csis0: csis@fa600000 { ++ csis0: csis@0 { + compatible = "samsung,s5pv210-csis"; +- reg = <0xfa600000 0x4000>; ++ reg = <0x00000000 0x4000>; + interrupt-parent = <&vic2>; + interrupts = <29>; + clocks = <&clocks CLK_CSIS>, +@@ -572,9 +572,9 @@ + #size-cells = <0>; + }; + +- fimc0: fimc@fb200000 { ++ fimc0: fimc@c00000 { + compatible = "samsung,s5pv210-fimc"; +- reg = <0xfb200000 0x1000>; ++ reg = <0x00c00000 0x1000>; + interrupts = <5>; + interrupt-parent = <&vic2>; + clocks = <&clocks CLK_FIMC0>, +@@ -586,9 +586,9 @@ + samsung,cam-if; + }; + +- fimc1: fimc@fb300000 { ++ fimc1: fimc@d00000 { + compatible = "samsung,s5pv210-fimc"; +- reg = <0xfb300000 0x1000>; ++ reg = <0x00d00000 0x1000>; + interrupt-parent = <&vic2>; + interrupts = <6>; + clocks = <&clocks CLK_FIMC1>, +@@ -602,9 +602,9 @@ + samsung,lcd-wb; + }; + +- fimc2: fimc@fb400000 { ++ fimc2: fimc@e00000 { + compatible = "samsung,s5pv210-fimc"; +- reg = <0xfb400000 0x1000>; ++ reg = <0x00e00000 0x1000>; + interrupt-parent = <&vic2>; + interrupts = <7>; + clocks = <&clocks CLK_FIMC2>, +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-amlogic-fix-format-for-s4-uart-node.patch b/queue-6.6/arm64-dts-amlogic-fix-format-for-s4-uart-node.patch new file mode 100644 index 00000000000..59a4b36714a --- /dev/null +++ b/queue-6.6/arm64-dts-amlogic-fix-format-for-s4-uart-node.patch @@ -0,0 +1,66 @@ +From 01e8937749cfc2a33758b68d7e25883a58231bb9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Dec 2023 16:28:00 +0800 +Subject: arm64: dts: amlogic: fix format for s4 uart node + +From: Xianwei Zhao + +[ Upstream commit eb54ef36282f670c704ed5af8593da62bebba80d ] + +Aliases use lowercase letters and place status in end. + +Signed-off-by: Xianwei Zhao +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20231215-s4-dts-v1-1-7831ab6972be@amlogic.com +Signed-off-by: Neil Armstrong +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dts | 4 ++-- + arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dts b/arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dts +index 8ffbcb2b1ac5..bbd3c05cbd90 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dts +@@ -15,7 +15,7 @@ + #size-cells = <2>; + + aliases { +- serial0 = &uart_B; ++ serial0 = &uart_b; + }; + + memory@0 { +@@ -25,6 +25,6 @@ + + }; + +-&uart_B { ++&uart_b { + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi +index f24460186d3d..55ddea6dc9f8 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi +@@ -118,14 +118,14 @@ + <10 11 12 13 14 15 16 17 18 19 20 21>; + }; + +- uart_B: serial@7a000 { ++ uart_b: serial@7a000 { + compatible = "amlogic,meson-s4-uart", + "amlogic,meson-ao-uart"; + reg = <0x0 0x7a000 0x0 0x18>; + interrupts = ; +- status = "disabled"; + clocks = <&xtal>, <&xtal>, <&xtal>; + clock-names = "xtal", "pclk", "baud"; ++ status = "disabled"; + }; + + reset: reset-controller@2000 { +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-marvell-fix-some-common-switch-mistakes.patch b/queue-6.6/arm64-dts-marvell-fix-some-common-switch-mistakes.patch new file mode 100644 index 00000000000..4aefdaa6b0b --- /dev/null +++ b/queue-6.6/arm64-dts-marvell-fix-some-common-switch-mistakes.patch @@ -0,0 +1,783 @@ +From 902756fcb9ed7a29f13ea3ebe6501618f7a4f048 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 16:51:01 +0100 +Subject: ARM64: dts: marvell: Fix some common switch mistakes + +From: Linus Walleij + +[ Upstream commit 605a5f5d406df0c01d92e36a7b5419ffaf62a4ce ] + +Fix some errors in the Marvell MV88E6xxx switch descriptions: +- The top node had no address size or cells. +- switch0@0 is not OK, should be ethernet-switch@0. +- ports should be ethernet-ports +- port@0 should be ethernet-port@0 +- PHYs should be named ethernet-phy@ + +Reviewed-by: Andrew Lunn +Signed-off-by: Linus Walleij +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../marvell/armada-3720-espressobin-ultra.dts | 14 +-- + .../dts/marvell/armada-3720-espressobin.dtsi | 20 ++--- + .../dts/marvell/armada-3720-gl-mv1000.dts | 20 ++--- + .../dts/marvell/armada-3720-turris-mox.dts | 85 +++++++++++-------- + .../boot/dts/marvell/armada-7040-mochabin.dts | 24 +++--- + .../marvell/armada-8040-clearfog-gt-8k.dts | 22 ++--- + arch/arm64/boot/dts/marvell/cn9130-crb.dtsi | 42 +++++---- + 7 files changed, 115 insertions(+), 112 deletions(-) + +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts b/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts +index f9abef8dcc94..870bb380a40a 100644 +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts +@@ -126,32 +126,32 @@ + + reset-gpios = <&gpiosb 23 GPIO_ACTIVE_LOW>; + +- ports { +- switch0port1: port@1 { ++ ethernet-ports { ++ switch0port1: ethernet-port@1 { + reg = <1>; + label = "lan0"; + phy-handle = <&switch0phy0>; + }; + +- switch0port2: port@2 { ++ switch0port2: ethernet-port@2 { + reg = <2>; + label = "lan1"; + phy-handle = <&switch0phy1>; + }; + +- switch0port3: port@3 { ++ switch0port3: ethernet-port@3 { + reg = <3>; + label = "lan2"; + phy-handle = <&switch0phy2>; + }; + +- switch0port4: port@4 { ++ switch0port4: ethernet-port@4 { + reg = <4>; + label = "lan3"; + phy-handle = <&switch0phy3>; + }; + +- switch0port5: port@5 { ++ switch0port5: ethernet-port@5 { + reg = <5>; + label = "wan"; + phy-handle = <&extphy>; +@@ -160,7 +160,7 @@ + }; + + mdio { +- switch0phy3: switch0phy3@14 { ++ switch0phy3: ethernet-phy@14 { + reg = <0x14>; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi +index 5fc613d24151..86ec0df1c676 100644 +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi +@@ -145,19 +145,17 @@ + }; + + &mdio { +- switch0: switch0@1 { ++ switch0: ethernet-switch@1 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <1>; + + dsa,member = <0 0>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- switch0port0: port@0 { ++ switch0port0: ethernet-port@0 { + reg = <0>; + label = "cpu"; + ethernet = <ð0>; +@@ -168,19 +166,19 @@ + }; + }; + +- switch0port1: port@1 { ++ switch0port1: ethernet-port@1 { + reg = <1>; + label = "wan"; + phy-handle = <&switch0phy0>; + }; + +- switch0port2: port@2 { ++ switch0port2: ethernet-port@2 { + reg = <2>; + label = "lan0"; + phy-handle = <&switch0phy1>; + }; + +- switch0port3: port@3 { ++ switch0port3: ethernet-port@3 { + reg = <3>; + label = "lan1"; + phy-handle = <&switch0phy2>; +@@ -192,13 +190,13 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy0: switch0phy0@11 { ++ switch0phy0: ethernet-phy@11 { + reg = <0x11>; + }; +- switch0phy1: switch0phy1@12 { ++ switch0phy1: ethernet-phy@12 { + reg = <0x12>; + }; +- switch0phy2: switch0phy2@13 { ++ switch0phy2: ethernet-phy@13 { + reg = <0x13>; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts b/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +index b1b45b4fa9d4..63fbc8352161 100644 +--- a/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +@@ -152,31 +152,29 @@ + }; + + &mdio { +- switch0: switch0@1 { ++ switch0: ethernet-switch@1 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <1>; + + dsa,member = <0 0>; + +- ports: ports { ++ ports: ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ ethernet-port@0 { + reg = <0>; + label = "cpu"; + ethernet = <ð0>; + }; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "wan"; + phy-handle = <&switch0phy0>; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan0"; + phy-handle = <&switch0phy1>; +@@ -185,7 +183,7 @@ + nvmem-cell-names = "mac-address"; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan1"; + phy-handle = <&switch0phy2>; +@@ -199,13 +197,13 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy0: switch0phy0@11 { ++ switch0phy0: ethernet-phy@11 { + reg = <0x11>; + }; +- switch0phy1: switch0phy1@12 { ++ switch0phy1: ethernet-phy@12 { + reg = <0x12>; + }; +- switch0phy2: switch0phy2@13 { ++ switch0phy2: ethernet-phy@13 { + reg = <0x13>; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +index 805ef2d79b40..4249acdec5ae 100644 +--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +@@ -304,7 +304,13 @@ + reg = <1>; + }; + +- /* switch nodes are enabled by U-Boot if modules are present */ ++ /* ++ * NOTE: switch nodes are enabled by U-Boot if modules are present ++ * DO NOT change this node name (switch0@10) even if it is not following ++ * conventions! Deployed U-Boot binaries are explicitly looking for ++ * this node in order to augment the device tree! ++ * Also do not touch the "ports" or "port@n" nodes. These are also ABI. ++ */ + switch0@10 { + compatible = "marvell,mv88e6190"; + reg = <0x10>; +@@ -317,35 +323,35 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy1: switch0phy1@1 { ++ switch0phy1: ethernet-phy@1 { + reg = <0x1>; + }; + +- switch0phy2: switch0phy2@2 { ++ switch0phy2: ethernet-phy@2 { + reg = <0x2>; + }; + +- switch0phy3: switch0phy3@3 { ++ switch0phy3: ethernet-phy@3 { + reg = <0x3>; + }; + +- switch0phy4: switch0phy4@4 { ++ switch0phy4: ethernet-phy@4 { + reg = <0x4>; + }; + +- switch0phy5: switch0phy5@5 { ++ switch0phy5: ethernet-phy@5 { + reg = <0x5>; + }; + +- switch0phy6: switch0phy6@6 { ++ switch0phy6: ethernet-phy@6 { + reg = <0x6>; + }; + +- switch0phy7: switch0phy7@7 { ++ switch0phy7: ethernet-phy@7 { + reg = <0x7>; + }; + +- switch0phy8: switch0phy8@8 { ++ switch0phy8: ethernet-phy@8 { + reg = <0x8>; + }; + }; +@@ -430,6 +436,7 @@ + }; + }; + ++ /* NOTE: this node name is ABI, don't change it! */ + switch0@2 { + compatible = "marvell,mv88e6085"; + reg = <0x2>; +@@ -442,19 +449,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy1_topaz: switch0phy1@11 { ++ switch0phy1_topaz: ethernet-phy@11 { + reg = <0x11>; + }; + +- switch0phy2_topaz: switch0phy2@12 { ++ switch0phy2_topaz: ethernet-phy@12 { + reg = <0x12>; + }; + +- switch0phy3_topaz: switch0phy3@13 { ++ switch0phy3_topaz: ethernet-phy@13 { + reg = <0x13>; + }; + +- switch0phy4_topaz: switch0phy4@14 { ++ switch0phy4_topaz: ethernet-phy@14 { + reg = <0x14>; + }; + }; +@@ -497,6 +504,7 @@ + }; + }; + ++ /* NOTE: this node name is ABI, don't change it! */ + switch1@11 { + compatible = "marvell,mv88e6190"; + reg = <0x11>; +@@ -509,35 +517,35 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch1phy1: switch1phy1@1 { ++ switch1phy1: ethernet-phy@1 { + reg = <0x1>; + }; + +- switch1phy2: switch1phy2@2 { ++ switch1phy2: ethernet-phy@2 { + reg = <0x2>; + }; + +- switch1phy3: switch1phy3@3 { ++ switch1phy3: ethernet-phy@3 { + reg = <0x3>; + }; + +- switch1phy4: switch1phy4@4 { ++ switch1phy4: ethernet-phy@4 { + reg = <0x4>; + }; + +- switch1phy5: switch1phy5@5 { ++ switch1phy5: ethernet-phy@5 { + reg = <0x5>; + }; + +- switch1phy6: switch1phy6@6 { ++ switch1phy6: ethernet-phy@6 { + reg = <0x6>; + }; + +- switch1phy7: switch1phy7@7 { ++ switch1phy7: ethernet-phy@7 { + reg = <0x7>; + }; + +- switch1phy8: switch1phy8@8 { ++ switch1phy8: ethernet-phy@8 { + reg = <0x8>; + }; + }; +@@ -622,6 +630,7 @@ + }; + }; + ++ /* NOTE: this node name is ABI, don't change it! */ + switch1@2 { + compatible = "marvell,mv88e6085"; + reg = <0x2>; +@@ -634,19 +643,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch1phy1_topaz: switch1phy1@11 { ++ switch1phy1_topaz: ethernet-phy@11 { + reg = <0x11>; + }; + +- switch1phy2_topaz: switch1phy2@12 { ++ switch1phy2_topaz: ethernet-phy@12 { + reg = <0x12>; + }; + +- switch1phy3_topaz: switch1phy3@13 { ++ switch1phy3_topaz: ethernet-phy@13 { + reg = <0x13>; + }; + +- switch1phy4_topaz: switch1phy4@14 { ++ switch1phy4_topaz: ethernet-phy@14 { + reg = <0x14>; + }; + }; +@@ -689,6 +698,7 @@ + }; + }; + ++ /* NOTE: this node name is ABI, don't change it! */ + switch2@12 { + compatible = "marvell,mv88e6190"; + reg = <0x12>; +@@ -701,35 +711,35 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch2phy1: switch2phy1@1 { ++ switch2phy1: ethernet-phy@1 { + reg = <0x1>; + }; + +- switch2phy2: switch2phy2@2 { ++ switch2phy2: ethernet-phy@2 { + reg = <0x2>; + }; + +- switch2phy3: switch2phy3@3 { ++ switch2phy3: ethernet-phy@3 { + reg = <0x3>; + }; + +- switch2phy4: switch2phy4@4 { ++ switch2phy4: ethernet-phy@4 { + reg = <0x4>; + }; + +- switch2phy5: switch2phy5@5 { ++ switch2phy5: ethernet-phy@5 { + reg = <0x5>; + }; + +- switch2phy6: switch2phy6@6 { ++ switch2phy6: ethernet-phy@6 { + reg = <0x6>; + }; + +- switch2phy7: switch2phy7@7 { ++ switch2phy7: ethernet-phy@7 { + reg = <0x7>; + }; + +- switch2phy8: switch2phy8@8 { ++ switch2phy8: ethernet-phy@8 { + reg = <0x8>; + }; + }; +@@ -805,6 +815,7 @@ + }; + }; + ++ /* NOTE: this node name is ABI, don't change it! */ + switch2@2 { + compatible = "marvell,mv88e6085"; + reg = <0x2>; +@@ -817,19 +828,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch2phy1_topaz: switch2phy1@11 { ++ switch2phy1_topaz: ethernet-phy@11 { + reg = <0x11>; + }; + +- switch2phy2_topaz: switch2phy2@12 { ++ switch2phy2_topaz: ethernet-phy@12 { + reg = <0x12>; + }; + +- switch2phy3_topaz: switch2phy3@13 { ++ switch2phy3_topaz: ethernet-phy@13 { + reg = <0x13>; + }; + +- switch2phy4_topaz: switch2phy4@14 { ++ switch2phy4_topaz: ethernet-phy@14 { + reg = <0x14>; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts b/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts +index 48202810bf78..40b7ee7ead72 100644 +--- a/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts +@@ -301,10 +301,8 @@ + }; + + /* 88E6141 Topaz switch */ +- switch: switch@3 { ++ switch: ethernet-switch@3 { + compatible = "marvell,mv88e6085"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <3>; + + pinctrl-names = "default"; +@@ -314,35 +312,35 @@ + interrupt-parent = <&cp0_gpio1>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- swport1: port@1 { ++ swport1: ethernet-port@1 { + reg = <1>; + label = "lan0"; + phy-handle = <&swphy1>; + }; + +- swport2: port@2 { ++ swport2: ethernet-port@2 { + reg = <2>; + label = "lan1"; + phy-handle = <&swphy2>; + }; + +- swport3: port@3 { ++ swport3: ethernet-port@3 { + reg = <3>; + label = "lan2"; + phy-handle = <&swphy3>; + }; + +- swport4: port@4 { ++ swport4: ethernet-port@4 { + reg = <4>; + label = "lan3"; + phy-handle = <&swphy4>; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + label = "cpu"; + ethernet = <&cp0_eth1>; +@@ -355,19 +353,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- swphy1: swphy1@17 { ++ swphy1: ethernet-phy@17 { + reg = <17>; + }; + +- swphy2: swphy2@18 { ++ swphy2: ethernet-phy@18 { + reg = <18>; + }; + +- swphy3: swphy3@19 { ++ swphy3: ethernet-phy@19 { + reg = <19>; + }; + +- swphy4: swphy4@20 { ++ swphy4: ethernet-phy@20 { + reg = <20>; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts +index 4125202028c8..67892f0d2863 100644 +--- a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts ++++ b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts +@@ -497,42 +497,42 @@ + reset-deassert-us = <10000>; + }; + +- switch0: switch0@4 { ++ switch0: ethernet-switch@4 { + compatible = "marvell,mv88e6085"; + reg = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&cp1_switch_reset_pins>; + reset-gpios = <&cp1_gpio1 24 GPIO_ACTIVE_LOW>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "lan2"; + phy-handle = <&switch0phy0>; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "lan1"; + phy-handle = <&switch0phy1>; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "lan4"; + phy-handle = <&switch0phy2>; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "lan3"; + phy-handle = <&switch0phy3>; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + label = "cpu"; + ethernet = <&cp1_eth2>; +@@ -545,19 +545,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy0: switch0phy0@11 { ++ switch0phy0: ethernet-phy@11 { + reg = <0x11>; + }; + +- switch0phy1: switch0phy1@12 { ++ switch0phy1: ethernet-phy@12 { + reg = <0x12>; + }; + +- switch0phy2: switch0phy2@13 { ++ switch0phy2: ethernet-phy@13 { + reg = <0x13>; + }; + +- switch0phy3: switch0phy3@14 { ++ switch0phy3: ethernet-phy@14 { + reg = <0x14>; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/cn9130-crb.dtsi b/arch/arm64/boot/dts/marvell/cn9130-crb.dtsi +index 47d45ff3d6f5..6fcc34f7b464 100644 +--- a/arch/arm64/boot/dts/marvell/cn9130-crb.dtsi ++++ b/arch/arm64/boot/dts/marvell/cn9130-crb.dtsi +@@ -207,11 +207,9 @@ + reg = <0>; + }; + +- switch6: switch0@6 { ++ switch6: ethernet-switch@6 { + /* Actual device is MV88E6393X */ + compatible = "marvell,mv88e6190"; +- #address-cells = <1>; +- #size-cells = <0>; + reg = <6>; + interrupt-parent = <&cp0_gpio1>; + interrupts = <28 IRQ_TYPE_LEVEL_LOW>; +@@ -220,59 +218,59 @@ + + dsa,member = <0 0>; + +- ports { ++ ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@1 { ++ ethernet-port@1 { + reg = <1>; + label = "p1"; + phy-handle = <&switch0phy1>; + }; + +- port@2 { ++ ethernet-port@2 { + reg = <2>; + label = "p2"; + phy-handle = <&switch0phy2>; + }; + +- port@3 { ++ ethernet-port@3 { + reg = <3>; + label = "p3"; + phy-handle = <&switch0phy3>; + }; + +- port@4 { ++ ethernet-port@4 { + reg = <4>; + label = "p4"; + phy-handle = <&switch0phy4>; + }; + +- port@5 { ++ ethernet-port@5 { + reg = <5>; + label = "p5"; + phy-handle = <&switch0phy5>; + }; + +- port@6 { ++ ethernet-port@6 { + reg = <6>; + label = "p6"; + phy-handle = <&switch0phy6>; + }; + +- port@7 { ++ ethernet-port@7 { + reg = <7>; + label = "p7"; + phy-handle = <&switch0phy7>; + }; + +- port@8 { ++ ethernet-port@8 { + reg = <8>; + label = "p8"; + phy-handle = <&switch0phy8>; + }; + +- port@9 { ++ ethernet-port@9 { + reg = <9>; + label = "p9"; + phy-mode = "10gbase-r"; +@@ -280,7 +278,7 @@ + managed = "in-band-status"; + }; + +- port@a { ++ ethernet-port@a { + reg = <10>; + ethernet = <&cp0_eth0>; + phy-mode = "10gbase-r"; +@@ -293,35 +291,35 @@ + #address-cells = <1>; + #size-cells = <0>; + +- switch0phy1: switch0phy1@1 { ++ switch0phy1: ethernet-phy@1 { + reg = <0x1>; + }; + +- switch0phy2: switch0phy2@2 { ++ switch0phy2: ethernet-phy@2 { + reg = <0x2>; + }; + +- switch0phy3: switch0phy3@3 { ++ switch0phy3: ethernet-phy@3 { + reg = <0x3>; + }; + +- switch0phy4: switch0phy4@4 { ++ switch0phy4: ethernet-phy@4 { + reg = <0x4>; + }; + +- switch0phy5: switch0phy5@5 { ++ switch0phy5: ethernet-phy@5 { + reg = <0x5>; + }; + +- switch0phy6: switch0phy6@6 { ++ switch0phy6: ethernet-phy@6 { + reg = <0x6>; + }; + +- switch0phy7: switch0phy7@7 { ++ switch0phy7: ethernet-phy@7 { + reg = <0x7>; + }; + +- switch0phy8: switch0phy8@8 { ++ switch0phy8: ethernet-phy@8 { + reg = <0x8>; + }; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-qcom-fix-coresight-warnings-in-in-ports-an.patch b/queue-6.6/arm64-dts-qcom-fix-coresight-warnings-in-in-ports-an.patch new file mode 100644 index 00000000000..74dd56114e5 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-fix-coresight-warnings-in-in-ports-an.patch @@ -0,0 +1,126 @@ +From 772773d6aa04b6f66121308204d39d297ff689f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 23:26:31 -0800 +Subject: arm64: dts: qcom: Fix coresight warnings in in-ports and out-ports + +From: Mao Jinlong + +[ Upstream commit bdb6339fd46b8702ea7411b0b414587b86a40562 ] + +When a node is only one in port or one out port, address-cells and +size-cells are not required in in-ports and out-ports. And the number +and reg of the port need to be removed. + +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Mao Jinlong +Link: https://lore.kernel.org/r/20231210072633.4243-5-quic_jinlmao@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sdm845.dtsi | 5 +---- + arch/arm64/boot/dts/qcom/sm8150.dtsi | 5 +---- + arch/arm64/boot/dts/qcom/sm8250.dtsi | 24 ++++-------------------- + 3 files changed, 6 insertions(+), 28 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi +index 63f6515692e8..234d7875cd8e 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi +@@ -3555,11 +3555,8 @@ + }; + + in-ports { +- #address-cells = <1>; +- #size-cells = <0>; + +- port@1 { +- reg = <1>; ++ port { + etf_in: endpoint { + remote-endpoint = + <&merge_funnel_out>; +diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi +index f7e35e220018..26b6d84548a5 100644 +--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi +@@ -2973,11 +2973,8 @@ + }; + + in-ports { +- #address-cells = <1>; +- #size-cells = <0>; + +- port@1 { +- reg = <1>; ++ port { + replicator1_in: endpoint { + remote-endpoint = <&replicator_out1>; + }; +diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi +index 1a98481d0c7f..64a656dcfa1f 100644 +--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi +@@ -2830,11 +2830,8 @@ + clock-names = "apb_pclk"; + + out-ports { +- #address-cells = <1>; +- #size-cells = <0>; + +- port@0 { +- reg = <0>; ++ port { + tpda_out_funnel_qatb: endpoint { + remote-endpoint = <&funnel_qatb_in_tpda>; + }; +@@ -2877,11 +2874,7 @@ + }; + + in-ports { +- #address-cells = <1>; +- #size-cells = <0>; +- +- port@0 { +- reg = <0>; ++ port { + funnel_qatb_in_tpda: endpoint { + remote-endpoint = <&tpda_out_funnel_qatb>; + }; +@@ -3090,11 +3083,8 @@ + }; + + in-ports { +- #address-cells = <1>; +- #size-cells = <0>; + +- port@0 { +- reg = <0>; ++ port { + etf_in_funnel_swao_out: endpoint { + remote-endpoint = <&funnel_swao_out_etf>; + }; +@@ -3178,8 +3168,6 @@ + clock-names = "apb_pclk"; + + out-ports { +- #address-cells = <1>; +- #size-cells = <0>; + port { + tpdm_mm_out_tpda9: endpoint { + remote-endpoint = <&tpda_9_in_tpdm_mm>; +@@ -3445,11 +3433,7 @@ + }; + + in-ports { +- #address-cells = <1>; +- #size-cells = <0>; +- +- port@0 { +- reg = <0>; ++ port { + funnel_apss_merg_in_funnel_apss: endpoint { + remote-endpoint = <&funnel_apss_out_funnel_apss_merg>; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-qcom-msm8996-fix-in-ports-is-a-required-pr.patch b/queue-6.6/arm64-dts-qcom-msm8996-fix-in-ports-is-a-required-pr.patch new file mode 100644 index 00000000000..98436934d1a --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8996-fix-in-ports-is-a-required-pr.patch @@ -0,0 +1,63 @@ +From d4ff08bb0011b340dc82dc8315dbb5d713c59592 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 23:26:29 -0800 +Subject: arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property + +From: Mao Jinlong + +[ Upstream commit 9a6fc510a6a3ec150cb7450aec1e5f257e6fc77b ] + +Add the inport of funnel@3023000 to fix 'in-ports' is a required property +warning. + +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Mao Jinlong +Link: https://lore.kernel.org/r/20231210072633.4243-3-quic_jinlmao@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8996.dtsi | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi +index c8e0986425ab..4d87cba47c76 100644 +--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi +@@ -443,6 +443,19 @@ + reg = <0x0 0x80000000 0x0 0x0>; + }; + ++ etm { ++ compatible = "qcom,coresight-remote-etm"; ++ ++ out-ports { ++ port { ++ modem_etm_out_funnel_in2: endpoint { ++ remote-endpoint = ++ <&funnel_in2_in_modem_etm>; ++ }; ++ }; ++ }; ++ }; ++ + psci { + compatible = "arm,psci-1.0"; + method = "smc"; +@@ -2643,6 +2656,14 @@ + clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; + ++ in-ports { ++ port { ++ funnel_in2_in_modem_etm: endpoint { ++ remote-endpoint = ++ <&modem_etm_out_funnel_in2>; ++ }; ++ }; ++ }; + + out-ports { + port { +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-qcom-msm8998-fix-out-ports-is-a-required-p.patch b/queue-6.6/arm64-dts-qcom-msm8998-fix-out-ports-is-a-required-p.patch new file mode 100644 index 00000000000..99779e06dbf --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8998-fix-out-ports-is-a-required-p.patch @@ -0,0 +1,88 @@ +From 938a86d06a978c216b17603482a4e4e006798b17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 23:26:30 -0800 +Subject: arm64: dts: qcom: msm8998: Fix 'out-ports' is a required property + +From: Mao Jinlong + +[ Upstream commit ae5ee3562a2519214b12228545e88a203dd68bbd ] + +out-ports is a required property for coresight ETM. Add out-ports for +ETM nodes to fix the warning. + +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Mao Jinlong +Link: https://lore.kernel.org/r/20231210072633.4243-4-quic_jinlmao@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++---------- + 1 file changed, 20 insertions(+), 12 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi +index f180047cacb0..f91c58c844af 100644 +--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi +@@ -2034,9 +2034,11 @@ + + cpu = <&CPU4>; + +- port { +- etm4_out: endpoint { +- remote-endpoint = <&apss_funnel_in4>; ++ out-ports { ++ port { ++ etm4_out: endpoint { ++ remote-endpoint = <&apss_funnel_in4>; ++ }; + }; + }; + }; +@@ -2051,9 +2053,11 @@ + + cpu = <&CPU5>; + +- port { +- etm5_out: endpoint { +- remote-endpoint = <&apss_funnel_in5>; ++ out-ports { ++ port { ++ etm5_out: endpoint { ++ remote-endpoint = <&apss_funnel_in5>; ++ }; + }; + }; + }; +@@ -2068,9 +2072,11 @@ + + cpu = <&CPU6>; + +- port { +- etm6_out: endpoint { +- remote-endpoint = <&apss_funnel_in6>; ++ out-ports { ++ port { ++ etm6_out: endpoint { ++ remote-endpoint = <&apss_funnel_in6>; ++ }; + }; + }; + }; +@@ -2085,9 +2091,11 @@ + + cpu = <&CPU7>; + +- port { +- etm7_out: endpoint { +- remote-endpoint = <&apss_funnel_in7>; ++ out-ports { ++ port { ++ etm7_out: endpoint { ++ remote-endpoint = <&apss_funnel_in7>; ++ }; + }; + }; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-qcom-sm8350-fix-remoteproc-interrupt-type.patch b/queue-6.6/arm64-dts-qcom-sm8350-fix-remoteproc-interrupt-type.patch new file mode 100644 index 00000000000..3f805cf04d0 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8350-fix-remoteproc-interrupt-type.patch @@ -0,0 +1,66 @@ +From cd0ba83662b11c233d599e36c2fb8886d8558584 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 11 Nov 2023 23:07:42 +0100 +Subject: arm64: dts: qcom: sm8350: Fix remoteproc interrupt type + +From: Nia Espera + +[ Upstream commit 54ee322f845c7f25fbf6e43e11147b6cae8eff56 ] + +In a similar vein to +https://lore.kernel.org/lkml/20220530080842.37024-3-manivannan.sadhasivam@linaro.org/, +the remote processors on sm8350 fail to initialize with the 'correct' +(i.e., specified in downstream) IRQ type. Change this to EDGE_RISING. + +Signed-off-by: Nia Espera +Acked-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20231111-nia-sm8350-for-upstream-v4-4-3a638b02eea5@igalia.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8350.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qcom/sm8350.dtsi +index a7cf506f24b6..5ed464c37422 100644 +--- a/arch/arm64/boot/dts/qcom/sm8350.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi +@@ -2020,7 +2020,7 @@ + compatible = "qcom,sm8350-mpss-pas"; + reg = <0x0 0x04080000 0x0 0x4040>; + +- interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>, ++ interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 2 IRQ_TYPE_EDGE_RISING>, +@@ -2062,7 +2062,7 @@ + compatible = "qcom,sm8350-slpi-pas"; + reg = <0 0x05c00000 0 0x4000>; + +- interrupts-extended = <&pdc 9 IRQ_TYPE_LEVEL_HIGH>, ++ interrupts-extended = <&pdc 9 IRQ_TYPE_EDGE_RISING>, + <&smp2p_slpi_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_slpi_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_slpi_in 2 IRQ_TYPE_EDGE_RISING>, +@@ -3206,7 +3206,7 @@ + compatible = "qcom,sm8350-adsp-pas"; + reg = <0 0x17300000 0 0x100>; + +- interrupts-extended = <&pdc 6 IRQ_TYPE_LEVEL_HIGH>, ++ interrupts-extended = <&pdc 6 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 2 IRQ_TYPE_EDGE_RISING>, +@@ -3511,7 +3511,7 @@ + compatible = "qcom,sm8350-cdsp-pas"; + reg = <0 0x98900000 0 0x1400000>; + +- interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_LEVEL_HIGH>, ++ interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 2 IRQ_TYPE_EDGE_RISING>, +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-qcom-sm8450-fix-soundwire-controllers-node.patch b/queue-6.6/arm64-dts-qcom-sm8450-fix-soundwire-controllers-node.patch new file mode 100644 index 00000000000..6ad79092d0b --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8450-fix-soundwire-controllers-node.patch @@ -0,0 +1,65 @@ +From 837f6267b177b85baa54c6cf05481ed9512384e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Nov 2023 16:58:33 +0100 +Subject: arm64: dts: qcom: sm8450: fix soundwire controllers node name + +From: Neil Armstrong + +[ Upstream commit 11fcb81373de52eeb1d3ff135a8d24a4b18978d3 ] + +Fix the following dt bindings check: +arch/arm64/boot/dts/qcom/sm8450-hdk.dtb: soundwire-controller@31f0000: $nodename:0: 'soundwire-controller@31f0000' does not match '^soundwire(@.*)?$' + from schema $id: http://devicetree.org/schemas/soundwire/qcom,soundwire.yaml# + +Signed-off-by: Neil Armstrong +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20231106-topic-sm8450-upstream-soundwire-bindings-fix-v1-1-41d4844a5a7d@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8450.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi +index 79cc8fbcd846..91d856e5b06b 100644 +--- a/arch/arm64/boot/dts/qcom/sm8450.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi +@@ -2176,7 +2176,7 @@ + #sound-dai-cells = <1>; + }; + +- swr4: soundwire-controller@31f0000 { ++ swr4: soundwire@31f0000 { + compatible = "qcom,soundwire-v1.7.0"; + reg = <0 0x031f0000 0 0x2000>; + interrupts = ; +@@ -2224,7 +2224,7 @@ + #sound-dai-cells = <1>; + }; + +- swr1: soundwire-controller@3210000 { ++ swr1: soundwire@3210000 { + compatible = "qcom,soundwire-v1.7.0"; + reg = <0 0x03210000 0 0x2000>; + interrupts = ; +@@ -2291,7 +2291,7 @@ + #sound-dai-cells = <1>; + }; + +- swr0: soundwire-controller@3250000 { ++ swr0: soundwire@3250000 { + compatible = "qcom,soundwire-v1.7.0"; + reg = <0 0x03250000 0 0x2000>; + interrupts = ; +@@ -2318,7 +2318,7 @@ + status = "disabled"; + }; + +- swr2: soundwire-controller@33b0000 { ++ swr2: soundwire@33b0000 { + compatible = "qcom,soundwire-v1.7.0"; + reg = <0 0x033b0000 0 0x2000>; + interrupts = , +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-qcom-sm8550-fix-soundwire-controllers-node.patch b/queue-6.6/arm64-dts-qcom-sm8550-fix-soundwire-controllers-node.patch new file mode 100644 index 00000000000..9f7108bdaa8 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8550-fix-soundwire-controllers-node.patch @@ -0,0 +1,65 @@ +From c4cfe1442028d0511b3d2ca911da337f58fdef86 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Nov 2023 15:23:57 +0100 +Subject: arm64: dts: qcom: sm8550: fix soundwire controllers node name + +From: Neil Armstrong + +[ Upstream commit 07c88da81caf0e72c3690b689d30f0d325cfeff4 ] + +Fix the following dt bindings check: +arch/arm64/boot/dts/qcom/sm8550-mtp.dtb: soundwire-controller@6ab0000: $nodename:0: 'soundwire-controller@6ab0000' does not match '^soundwire(@.*)?$' +from schema $id: http://devicetree.org/schemas/soundwire/qcom,soundwire.yaml# + +Signed-off-by: Neil Armstrong +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20231106-topic-sm8550-upstream-soundwire-bindings-fix-v1-1-4ded91c805a1@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8550.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8550.dtsi b/arch/arm64/boot/dts/qcom/sm8550.dtsi +index 3a228d4f0c14..076715ef09d5 100644 +--- a/arch/arm64/boot/dts/qcom/sm8550.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8550.dtsi +@@ -2044,7 +2044,7 @@ + #sound-dai-cells = <1>; + }; + +- swr3: soundwire-controller@6ab0000 { ++ swr3: soundwire@6ab0000 { + compatible = "qcom,soundwire-v2.0.0"; + reg = <0 0x06ab0000 0 0x10000>; + interrupts = ; +@@ -2090,7 +2090,7 @@ + #sound-dai-cells = <1>; + }; + +- swr1: soundwire-controller@6ad0000 { ++ swr1: soundwire@6ad0000 { + compatible = "qcom,soundwire-v2.0.0"; + reg = <0 0x06ad0000 0 0x10000>; + interrupts = ; +@@ -2155,7 +2155,7 @@ + #sound-dai-cells = <1>; + }; + +- swr0: soundwire-controller@6b10000 { ++ swr0: soundwire@6b10000 { + compatible = "qcom,soundwire-v2.0.0"; + reg = <0 0x06b10000 0 0x10000>; + interrupts = ; +@@ -2182,7 +2182,7 @@ + status = "disabled"; + }; + +- swr2: soundwire-controller@6d30000 { ++ swr2: soundwire@6d30000 { + compatible = "qcom,soundwire-v2.0.0"; + reg = <0 0x06d30000 0 0x10000>; + interrupts = , +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-sprd-add-clock-reference-for-pll2-on-ums51.patch b/queue-6.6/arm64-dts-sprd-add-clock-reference-for-pll2-on-ums51.patch new file mode 100644 index 00000000000..1c83990dcbc --- /dev/null +++ b/queue-6.6/arm64-dts-sprd-add-clock-reference-for-pll2-on-ums51.patch @@ -0,0 +1,35 @@ +From e39c0cb3e64dc43d4fef4dab1f3af42bbb9f129d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Dec 2023 17:28:23 +0800 +Subject: arm64: dts: sprd: Add clock reference for pll2 on UMS512 + +From: Chunyan Zhang + +[ Upstream commit 829e3e70fe72edc084fbfc4964669594ebe427ce ] + +Fix below dtbs_check warning: + +'clocks' is a dependency of 'clock-names' + +Link: https://lore.kernel.org/r/20231221092824.1169453-2-chunyan.zhang@unisoc.com +Signed-off-by: Chunyan Zhang +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/sprd/ums512.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/sprd/ums512.dtsi b/arch/arm64/boot/dts/sprd/ums512.dtsi +index 97ac550af2f1..91c22667d40f 100644 +--- a/arch/arm64/boot/dts/sprd/ums512.dtsi ++++ b/arch/arm64/boot/dts/sprd/ums512.dtsi +@@ -291,6 +291,7 @@ + pll2: clock-controller@0 { + compatible = "sprd,ums512-gc-pll"; + reg = <0x0 0x100>; ++ clocks = <&ext_26m>; + clock-names = "ext-26m"; + #clock-cells = <1>; + }; +-- +2.43.0 + diff --git a/queue-6.6/arm64-dts-sprd-change-ums512-idle-state-nodename-to-.patch b/queue-6.6/arm64-dts-sprd-change-ums512-idle-state-nodename-to-.patch new file mode 100644 index 00000000000..c6b6cde0a3d --- /dev/null +++ b/queue-6.6/arm64-dts-sprd-change-ums512-idle-state-nodename-to-.patch @@ -0,0 +1,36 @@ +From 22dac9b992d1a5c2385adf970d9691fef27f4e91 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Dec 2023 17:28:24 +0800 +Subject: arm64: dts: sprd: Change UMS512 idle-state nodename to match bindings + +From: Chunyan Zhang + +[ Upstream commit 1cff7243334f851b7dddf450abdaa6223a7a28e3 ] + +Fix below dtbs_check warning: + +idle-states: 'core-pd' does not match any of the regexes: '^(cpu|cluster)-', 'pinctrl-[0-9]+' + +Link: https://lore.kernel.org/r/20231221092824.1169453-3-chunyan.zhang@unisoc.com +Signed-off-by: Chunyan Zhang +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/sprd/ums512.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/sprd/ums512.dtsi b/arch/arm64/boot/dts/sprd/ums512.dtsi +index 91c22667d40f..cc4459551e05 100644 +--- a/arch/arm64/boot/dts/sprd/ums512.dtsi ++++ b/arch/arm64/boot/dts/sprd/ums512.dtsi +@@ -113,7 +113,7 @@ + + idle-states { + entry-method = "psci"; +- CORE_PD: core-pd { ++ CORE_PD: cpu-pd { + compatible = "arm,idle-state"; + entry-latency-us = <4000>; + exit-latency-us = <4000>; +-- +2.43.0 + diff --git a/queue-6.6/arm64-irq-set-the-correct-node-for-vmap-stack.patch b/queue-6.6/arm64-irq-set-the-correct-node-for-vmap-stack.patch new file mode 100644 index 00000000000..6a802b162f6 --- /dev/null +++ b/queue-6.6/arm64-irq-set-the-correct-node-for-vmap-stack.patch @@ -0,0 +1,100 @@ +From 6d0085c651e5008c1bdb9c4faaa3c9119994d60f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Nov 2023 11:15:13 +0800 +Subject: arm64: irq: set the correct node for VMAP stack + +From: Huang Shijie + +[ Upstream commit 75b5e0bf90bffaca4b1f19114065dc59f5cc161f ] + +In current code, init_irq_stacks() will call cpu_to_node(). +The cpu_to_node() depends on percpu "numa_node" which is initialized in: + arch_call_rest_init() --> rest_init() -- kernel_init() + --> kernel_init_freeable() --> smp_prepare_cpus() + +But init_irq_stacks() is called in init_IRQ() which is before +arch_call_rest_init(). + +So in init_irq_stacks(), the cpu_to_node() does not work, it +always return 0. In NUMA, it makes the node 1 cpu accesses the IRQ stack which +is in the node 0. + +This patch fixes it by: + 1.) export the early_cpu_to_node(), and use it in the init_irq_stacks(). + 2.) change init_irq_stacks() to __init function. + +Reviewed-by: Catalin Marinas +Signed-off-by: Huang Shijie +Link: https://lore.kernel.org/r/20231124031513.81548-1-shijie@os.amperecomputing.com +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + arch/arm64/kernel/irq.c | 5 +++-- + drivers/base/arch_numa.c | 2 +- + include/asm-generic/numa.h | 2 ++ + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c +index 6ad5c6ef5329..9f253d8efe90 100644 +--- a/arch/arm64/kernel/irq.c ++++ b/arch/arm64/kernel/irq.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -51,13 +52,13 @@ static void init_irq_scs(void) + } + + #ifdef CONFIG_VMAP_STACK +-static void init_irq_stacks(void) ++static void __init init_irq_stacks(void) + { + int cpu; + unsigned long *p; + + for_each_possible_cpu(cpu) { +- p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, cpu_to_node(cpu)); ++ p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, early_cpu_to_node(cpu)); + per_cpu(irq_stack_ptr, cpu) = p; + } + } +diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c +index eaa31e567d1e..5b59d133b6af 100644 +--- a/drivers/base/arch_numa.c ++++ b/drivers/base/arch_numa.c +@@ -144,7 +144,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid) + unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; + EXPORT_SYMBOL(__per_cpu_offset); + +-static int __init early_cpu_to_node(int cpu) ++int __init early_cpu_to_node(int cpu) + { + return cpu_to_node_map[cpu]; + } +diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h +index 1a3ad6d29833..c32e0cf23c90 100644 +--- a/include/asm-generic/numa.h ++++ b/include/asm-generic/numa.h +@@ -35,6 +35,7 @@ int __init numa_add_memblk(int nodeid, u64 start, u64 end); + void __init numa_set_distance(int from, int to, int distance); + void __init numa_free_distance(void); + void __init early_map_cpu_to_node(unsigned int cpu, int nid); ++int __init early_cpu_to_node(int cpu); + void numa_store_cpu_info(unsigned int cpu); + void numa_add_cpu(unsigned int cpu); + void numa_remove_cpu(unsigned int cpu); +@@ -46,6 +47,7 @@ static inline void numa_add_cpu(unsigned int cpu) { } + static inline void numa_remove_cpu(unsigned int cpu) { } + static inline void arch_numa_init(void) { } + static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } ++static inline int early_cpu_to_node(int cpu) { return 0; } + + #endif /* CONFIG_NUMA */ + +-- +2.43.0 + diff --git a/queue-6.6/arm64-zynqmp-fix-clock-node-name-in-kv260-cards.patch b/queue-6.6/arm64-zynqmp-fix-clock-node-name-in-kv260-cards.patch new file mode 100644 index 00000000000..ef8bff87008 --- /dev/null +++ b/queue-6.6/arm64-zynqmp-fix-clock-node-name-in-kv260-cards.patch @@ -0,0 +1,117 @@ +From cdd491c9fde98efba3d2cae3b764bc7310f36a36 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 10:59:16 +0100 +Subject: arm64: zynqmp: Fix clock node name in kv260 cards + +From: Michal Simek + +[ Upstream commit 0bfb7950cc1975372c4c58c3d3f9803f05245d46 ] + +node name shouldn't use '_' that's why convert it to '-'. + +Signed-off-by: Michal Simek +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso | 12 ++++++------ + arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso | 12 ++++++------ + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso +index dee238739290..92f4190d564d 100644 +--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso ++++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso +@@ -22,37 +22,37 @@ + /plugin/; + + &{/} { +- si5332_0: si5332_0 { /* u17 */ ++ si5332_0: si5332-0 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + }; + +- si5332_1: si5332_1 { /* u17 */ ++ si5332_1: si5332-1 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <25000000>; + }; + +- si5332_2: si5332_2 { /* u17 */ ++ si5332_2: si5332-2 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + }; + +- si5332_3: si5332_3 { /* u17 */ ++ si5332_3: si5332-3 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + }; + +- si5332_4: si5332_4 { /* u17 */ ++ si5332_4: si5332-4 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <26000000>; + }; + +- si5332_5: si5332_5 { /* u17 */ ++ si5332_5: si5332-5 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <27000000>; +diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso +index 73c5cb156caf..f88b71f5b07a 100644 +--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso ++++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso +@@ -17,37 +17,37 @@ + /plugin/; + + &{/} { +- si5332_0: si5332_0 { /* u17 */ ++ si5332_0: si5332-0 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + }; + +- si5332_1: si5332_1 { /* u17 */ ++ si5332_1: si5332-1 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <25000000>; + }; + +- si5332_2: si5332_2 { /* u17 */ ++ si5332_2: si5332-2 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + }; + +- si5332_3: si5332_3 { /* u17 */ ++ si5332_3: si5332-3 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + }; + +- si5332_4: si5332_4 { /* u17 */ ++ si5332_4: si5332-4 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <26000000>; + }; + +- si5332_5: si5332_5 { /* u17 */ ++ si5332_5: si5332-5 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <27000000>; +-- +2.43.0 + diff --git a/queue-6.6/arm64-zynqmp-move-fixed-clock-to-for-kv260.patch b/queue-6.6/arm64-zynqmp-move-fixed-clock-to-for-kv260.patch new file mode 100644 index 00000000000..c6bc4cf425c --- /dev/null +++ b/queue-6.6/arm64-zynqmp-move-fixed-clock-to-for-kv260.patch @@ -0,0 +1,117 @@ +From 1713ad5615c29fe22222381c85d358b76038d542 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 10:59:15 +0100 +Subject: arm64: zynqmp: Move fixed clock to / for kv260 + +From: Michal Simek + +[ Upstream commit 6a10a19a6bd2fd8d27a510678bf87bd9408f51d8 ] + +fixed clock nodes can't be on the bus because they are missing reg +property. That's why move them to root. +And because it is root it is good to have it as the first node in a file. + +Signed-off-by: Michal Simek +Signed-off-by: Sasha Levin +--- + .../boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso | 28 ++++++++--------- + .../boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso | 30 +++++++++---------- + 2 files changed, 29 insertions(+), 29 deletions(-) + +diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso +index ae1b9b2bdbee..dee238739290 100644 +--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso ++++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso +@@ -21,20 +21,7 @@ + /dts-v1/; + /plugin/; + +-&i2c1 { /* I2C_SCK C23/C24 - MIO from SOM */ +- #address-cells = <1>; +- #size-cells = <0>; +- pinctrl-names = "default", "gpio"; +- pinctrl-0 = <&pinctrl_i2c1_default>; +- pinctrl-1 = <&pinctrl_i2c1_gpio>; +- scl-gpios = <&gpio 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; +- sda-gpios = <&gpio 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; +- +- /* u14 - 0x40 - ina260 */ +- /* u27 - 0xe0 - STDP4320 DP/HDMI splitter */ +-}; +- +-&amba { ++&{/} { + si5332_0: si5332_0 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; +@@ -72,6 +59,19 @@ + }; + }; + ++&i2c1 { /* I2C_SCK C23/C24 - MIO from SOM */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default", "gpio"; ++ pinctrl-0 = <&pinctrl_i2c1_default>; ++ pinctrl-1 = <&pinctrl_i2c1_gpio>; ++ scl-gpios = <&gpio 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpio 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ ++ /* u14 - 0x40 - ina260 */ ++ /* u27 - 0xe0 - STDP4320 DP/HDMI splitter */ ++}; ++ + /* DP/USB 3.0 and SATA */ + &psgtr { + status = "okay"; +diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso +index b59e48be6465..73c5cb156caf 100644 +--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso ++++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso +@@ -16,21 +16,7 @@ + /dts-v1/; + /plugin/; + +-&i2c1 { /* I2C_SCK C23/C24 - MIO from SOM */ +- #address-cells = <1>; +- #size-cells = <0>; +- pinctrl-names = "default", "gpio"; +- pinctrl-0 = <&pinctrl_i2c1_default>; +- pinctrl-1 = <&pinctrl_i2c1_gpio>; +- scl-gpios = <&gpio 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; +- sda-gpios = <&gpio 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; +- +- /* u14 - 0x40 - ina260 */ +- /* u43 - 0x2d - usb5744 */ +- /* u27 - 0xe0 - STDP4320 DP/HDMI splitter */ +-}; +- +-&amba { ++&{/} { + si5332_0: si5332_0 { /* u17 */ + compatible = "fixed-clock"; + #clock-cells = <0>; +@@ -68,6 +54,20 @@ + }; + }; + ++&i2c1 { /* I2C_SCK C23/C24 - MIO from SOM */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default", "gpio"; ++ pinctrl-0 = <&pinctrl_i2c1_default>; ++ pinctrl-1 = <&pinctrl_i2c1_gpio>; ++ scl-gpios = <&gpio 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpio 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ ++ /* u14 - 0x40 - ina260 */ ++ /* u43 - 0x2d - usb5744 */ ++ /* u27 - 0xe0 - STDP4320 DP/HDMI splitter */ ++}; ++ + /* DP/USB 3.0 */ + &psgtr { + status = "okay"; +-- +2.43.0 + diff --git a/queue-6.6/asm-generic-make-sparse-happy-with-odd-sized-put_una.patch b/queue-6.6/asm-generic-make-sparse-happy-with-odd-sized-put_una.patch new file mode 100644 index 00000000000..6c01d697d3c --- /dev/null +++ b/queue-6.6/asm-generic-make-sparse-happy-with-odd-sized-put_una.patch @@ -0,0 +1,86 @@ +From 3b2706b5e76c0cf62e0fe512760861d69b5c14ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 7 Jan 2024 22:16:45 -0800 +Subject: asm-generic: make sparse happy with odd-sized put_unaligned_*() + +From: Dmitry Torokhov + +[ Upstream commit 1ab33c03145d0f6c345823fc2da935d9a1a9e9fc ] + +__put_unaligned_be24() and friends use implicit casts to convert +larger-sized data to bytes, which trips sparse truncation warnings when +the argument is a constant: + + CC [M] drivers/input/touchscreen/hynitron_cstxxx.o + CHECK drivers/input/touchscreen/hynitron_cstxxx.c + drivers/input/touchscreen/hynitron_cstxxx.c: note: in included file (through arch/x86/include/generated/asm/unaligned.h): + include/asm-generic/unaligned.h:119:16: warning: cast truncates bits from constant value (aa01a0 becomes a0) + include/asm-generic/unaligned.h:120:20: warning: cast truncates bits from constant value (aa01 becomes 1) + include/asm-generic/unaligned.h:119:16: warning: cast truncates bits from constant value (ab00d0 becomes d0) + include/asm-generic/unaligned.h:120:20: warning: cast truncates bits from constant value (ab00 becomes 0) + +To avoid this let's mask off upper bits explicitly, the resulting code +should be exactly the same, but it will keep sparse happy. + +Reported-by: kernel test robot +Suggested-by: Linus Torvalds +Closes: https://lore.kernel.org/oe-kbuild-all/202401070147.gqwVulOn-lkp@intel.com/ +Signed-off-by: Dmitry Torokhov +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/asm-generic/unaligned.h | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h +index 699650f81970..a84c64e5f11e 100644 +--- a/include/asm-generic/unaligned.h ++++ b/include/asm-generic/unaligned.h +@@ -104,9 +104,9 @@ static inline u32 get_unaligned_le24(const void *p) + + static inline void __put_unaligned_be24(const u32 val, u8 *p) + { +- *p++ = val >> 16; +- *p++ = val >> 8; +- *p++ = val; ++ *p++ = (val >> 16) & 0xff; ++ *p++ = (val >> 8) & 0xff; ++ *p++ = val & 0xff; + } + + static inline void put_unaligned_be24(const u32 val, void *p) +@@ -116,9 +116,9 @@ static inline void put_unaligned_be24(const u32 val, void *p) + + static inline void __put_unaligned_le24(const u32 val, u8 *p) + { +- *p++ = val; +- *p++ = val >> 8; +- *p++ = val >> 16; ++ *p++ = val & 0xff; ++ *p++ = (val >> 8) & 0xff; ++ *p++ = (val >> 16) & 0xff; + } + + static inline void put_unaligned_le24(const u32 val, void *p) +@@ -128,12 +128,12 @@ static inline void put_unaligned_le24(const u32 val, void *p) + + static inline void __put_unaligned_be48(const u64 val, u8 *p) + { +- *p++ = val >> 40; +- *p++ = val >> 32; +- *p++ = val >> 24; +- *p++ = val >> 16; +- *p++ = val >> 8; +- *p++ = val; ++ *p++ = (val >> 40) & 0xff; ++ *p++ = (val >> 32) & 0xff; ++ *p++ = (val >> 24) & 0xff; ++ *p++ = (val >> 16) & 0xff; ++ *p++ = (val >> 8) & 0xff; ++ *p++ = val & 0xff; + } + + static inline void put_unaligned_be48(const u64 val, void *p) +-- +2.43.0 + diff --git a/queue-6.6/asoc-amd-add-new-dmi-entries-for-acp5x-platform.patch b/queue-6.6/asoc-amd-add-new-dmi-entries-for-acp5x-platform.patch new file mode 100644 index 00000000000..1a945a3d0fb --- /dev/null +++ b/queue-6.6/asoc-amd-add-new-dmi-entries-for-acp5x-platform.patch @@ -0,0 +1,55 @@ +From d83c7d315801e6e4a45fc7c2ff7ab11281745f21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 16:36:12 +0530 +Subject: ASoC: amd: Add new dmi entries for acp5x platform + +From: Venkata Prasad Potturu + +[ Upstream commit c3ab23a10771bbe06300e5374efa809789c65455 ] + +Add sys_vendor and product_name dmi entries for acp5x platform. + +Signed-off-by: Venkata Prasad Potturu +Link: https://lore.kernel.org/r/20231206110620.1695591-1-venkataprasad.potturu@amd.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/amd/acp-config.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c +index f27c27580009..955145448c23 100644 +--- a/sound/soc/amd/acp-config.c ++++ b/sound/soc/amd/acp-config.c +@@ -3,7 +3,7 @@ + // This file is provided under a dual BSD/GPLv2 license. When using or + // redistributing this file, you may do so under either license. + // +-// Copyright(c) 2021 Advanced Micro Devices, Inc. ++// Copyright(c) 2021, 2023 Advanced Micro Devices, Inc. + // + // Authors: Ajit Kumar Pandey + // +@@ -47,6 +47,19 @@ static const struct config_entry config_table[] = { + {} + }, + }, ++ { ++ .flags = FLAG_AMD_LEGACY, ++ .device = ACP_PCI_DEV_ID, ++ .dmi_table = (const struct dmi_system_id []) { ++ { ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Valve"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Jupiter"), ++ }, ++ }, ++ {} ++ }, ++ }, + { + .flags = FLAG_AMD_SOF, + .device = ACP_PCI_DEV_ID, +-- +2.43.0 + diff --git a/queue-6.6/asoc-doc-fix-undefined-snd_soc_dapm_nopm-argument.patch b/queue-6.6/asoc-doc-fix-undefined-snd_soc_dapm_nopm-argument.patch new file mode 100644 index 00000000000..2f27735d8e4 --- /dev/null +++ b/queue-6.6/asoc-doc-fix-undefined-snd_soc_dapm_nopm-argument.patch @@ -0,0 +1,37 @@ +From 4e1e3db971649da4d23a8dc770698583cbf514a0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 14:07:51 +0200 +Subject: ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument + +From: Cristian Ciocaltea + +[ Upstream commit 67c7666fe808c3a7af3cc6f9d0a3dd3acfd26115 ] + +The virtual widget example makes use of an undefined SND_SOC_DAPM_NOPM +argument passed to SND_SOC_DAPM_MIXER(). Replace with the correct +SND_SOC_NOPM definition. + +Signed-off-by: Cristian Ciocaltea +Link: https://lore.kernel.org/r/20231121120751.77355-1-cristian.ciocaltea@collabora.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + Documentation/sound/soc/dapm.rst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Documentation/sound/soc/dapm.rst b/Documentation/sound/soc/dapm.rst +index 8e44107933ab..c3154ce6e1b2 100644 +--- a/Documentation/sound/soc/dapm.rst ++++ b/Documentation/sound/soc/dapm.rst +@@ -234,7 +234,7 @@ corresponding soft power control. In this case it is necessary to create + a virtual widget - a widget with no control bits e.g. + :: + +- SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0), ++ SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + + This can be used to merge to signal paths together in software. + +-- +2.43.0 + diff --git a/queue-6.6/audit-send-netlink-ack-before-setting-connection-in-.patch b/queue-6.6/audit-send-netlink-ack-before-setting-connection-in-.patch new file mode 100644 index 00000000000..ff5c272e182 --- /dev/null +++ b/queue-6.6/audit-send-netlink-ack-before-setting-connection-in-.patch @@ -0,0 +1,117 @@ +From 7198787535fff7f709d41765a0275f28ced5569a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Oct 2023 09:23:51 +0000 +Subject: audit: Send netlink ACK before setting connection in auditd_set + +From: Chris Riches + +[ Upstream commit 022732e3d846e197539712e51ecada90ded0572a ] + +When auditd_set sets the auditd_conn pointer, audit messages can +immediately be put on the socket by other kernel threads. If the backlog +is large or the rate is high, this can immediately fill the socket +buffer. If the audit daemon requested an ACK for this operation, a full +socket buffer causes the ACK to get dropped, also setting ENOBUFS on the +socket. + +To avoid this race and ensure ACKs get through, fast-track the ACK in +this specific case to ensure it is sent before auditd_conn is set. + +Signed-off-by: Chris Riches +[PM: fix some tab vs space damage] +Signed-off-by: Paul Moore +Signed-off-by: Sasha Levin +--- + kernel/audit.c | 31 ++++++++++++++++++++++++------- + 1 file changed, 24 insertions(+), 7 deletions(-) + +diff --git a/kernel/audit.c b/kernel/audit.c +index 16205dd29843..9c8e5f732c4c 100644 +--- a/kernel/audit.c ++++ b/kernel/audit.c +@@ -487,15 +487,19 @@ static void auditd_conn_free(struct rcu_head *rcu) + * @pid: auditd PID + * @portid: auditd netlink portid + * @net: auditd network namespace pointer ++ * @skb: the netlink command from the audit daemon ++ * @ack: netlink ack flag, cleared if ack'd here + * + * Description: + * This function will obtain and drop network namespace references as + * necessary. Returns zero on success, negative values on failure. + */ +-static int auditd_set(struct pid *pid, u32 portid, struct net *net) ++static int auditd_set(struct pid *pid, u32 portid, struct net *net, ++ struct sk_buff *skb, bool *ack) + { + unsigned long flags; + struct auditd_connection *ac_old, *ac_new; ++ struct nlmsghdr *nlh; + + if (!pid || !net) + return -EINVAL; +@@ -507,6 +511,13 @@ static int auditd_set(struct pid *pid, u32 portid, struct net *net) + ac_new->portid = portid; + ac_new->net = get_net(net); + ++ /* send the ack now to avoid a race with the queue backlog */ ++ if (*ack) { ++ nlh = nlmsg_hdr(skb); ++ netlink_ack(skb, nlh, 0, NULL); ++ *ack = false; ++ } ++ + spin_lock_irqsave(&auditd_conn_lock, flags); + ac_old = rcu_dereference_protected(auditd_conn, + lockdep_is_held(&auditd_conn_lock)); +@@ -1200,7 +1211,8 @@ static int audit_replace(struct pid *pid) + return auditd_send_unicast_skb(skb); + } + +-static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ++static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh, ++ bool *ack) + { + u32 seq; + void *data; +@@ -1293,7 +1305,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) + /* register a new auditd connection */ + err = auditd_set(req_pid, + NETLINK_CB(skb).portid, +- sock_net(NETLINK_CB(skb).sk)); ++ sock_net(NETLINK_CB(skb).sk), ++ skb, ack); + if (audit_enabled != AUDIT_OFF) + audit_log_config_change("audit_pid", + new_pid, +@@ -1538,9 +1551,10 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) + * Parse the provided skb and deal with any messages that may be present, + * malformed skbs are discarded. + */ +-static void audit_receive(struct sk_buff *skb) ++static void audit_receive(struct sk_buff *skb) + { + struct nlmsghdr *nlh; ++ bool ack; + /* + * len MUST be signed for nlmsg_next to be able to dec it below 0 + * if the nlmsg_len was not aligned +@@ -1553,9 +1567,12 @@ static void audit_receive(struct sk_buff *skb) + + audit_ctl_lock(); + while (nlmsg_ok(nlh, len)) { +- err = audit_receive_msg(skb, nlh); +- /* if err or if this message says it wants a response */ +- if (err || (nlh->nlmsg_flags & NLM_F_ACK)) ++ ack = nlh->nlmsg_flags & NLM_F_ACK; ++ err = audit_receive_msg(skb, nlh, &ack); ++ ++ /* send an ack if the user asked for one and audit_receive_msg ++ * didn't already do it, or if there was an error. */ ++ if (ack || err) + netlink_ack(skb, nlh, err, NULL); + + nlh = nlmsg_next(nlh, &len); +-- +2.43.0 + diff --git a/queue-6.6/blk-mq-fix-io-hang-from-sbitmap-wakeup-race.patch b/queue-6.6/blk-mq-fix-io-hang-from-sbitmap-wakeup-race.patch new file mode 100644 index 00000000000..a0406260377 --- /dev/null +++ b/queue-6.6/blk-mq-fix-io-hang-from-sbitmap-wakeup-race.patch @@ -0,0 +1,72 @@ +From 4dc7a7a301653957bf3357fcc6433621890856fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Jan 2024 20:26:26 +0800 +Subject: blk-mq: fix IO hang from sbitmap wakeup race + +From: Ming Lei + +[ Upstream commit 5266caaf5660529e3da53004b8b7174cab6374ed ] + +In blk_mq_mark_tag_wait(), __add_wait_queue() may be re-ordered +with the following blk_mq_get_driver_tag() in case of getting driver +tag failure. + +Then in __sbitmap_queue_wake_up(), waitqueue_active() may not observe +the added waiter in blk_mq_mark_tag_wait() and wake up nothing, meantime +blk_mq_mark_tag_wait() can't get driver tag successfully. + +This issue can be reproduced by running the following test in loop, and +fio hang can be observed in < 30min when running it on my test VM +in laptop. + + modprobe -r scsi_debug + modprobe scsi_debug delay=0 dev_size_mb=4096 max_queue=1 host_max_queue=1 submit_queues=4 + dev=`ls -d /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*/block/* | head -1 | xargs basename` + fio --filename=/dev/"$dev" --direct=1 --rw=randrw --bs=4k --iodepth=1 \ + --runtime=100 --numjobs=40 --time_based --name=test \ + --ioengine=libaio + +Fix the issue by adding one explicit barrier in blk_mq_mark_tag_wait(), which +is just fine in case of running out of tag. + +Cc: Jan Kara +Cc: Kemeng Shi +Reported-by: Changhui Zhong +Signed-off-by: Ming Lei +Link: https://lore.kernel.org/r/20240112122626.4181044-1-ming.lei@redhat.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/blk-mq.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/block/blk-mq.c b/block/blk-mq.c +index 6041e17492ec..257b0addd47e 100644 +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -1870,6 +1870,22 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx, + wait->flags &= ~WQ_FLAG_EXCLUSIVE; + __add_wait_queue(wq, wait); + ++ /* ++ * Add one explicit barrier since blk_mq_get_driver_tag() may ++ * not imply barrier in case of failure. ++ * ++ * Order adding us to wait queue and allocating driver tag. ++ * ++ * The pair is the one implied in sbitmap_queue_wake_up() which ++ * orders clearing sbitmap tag bits and waitqueue_active() in ++ * __sbitmap_queue_wake_up(), since waitqueue_active() is lockless ++ * ++ * Otherwise, re-order of adding wait queue and getting driver tag ++ * may cause __sbitmap_queue_wake_up() to wake up nothing because ++ * the waitqueue_active() may not observe us in wait queue. ++ */ ++ smp_mb(); ++ + /* + * It's possible that a tag was freed in the window between the + * allocation failure and adding the hardware queue to the wait +-- +2.43.0 + diff --git a/queue-6.6/block-prevent-an-integer-overflow-in-bvec_try_merge_.patch b/queue-6.6/block-prevent-an-integer-overflow-in-bvec_try_merge_.patch new file mode 100644 index 00000000000..b58a638cbd9 --- /dev/null +++ b/queue-6.6/block-prevent-an-integer-overflow-in-bvec_try_merge_.patch @@ -0,0 +1,36 @@ +From 5ceaf886facbeb52b8ae623048d3aa9140061b69 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 18:34:18 +0100 +Subject: block: prevent an integer overflow in bvec_try_merge_hw_page + +From: Christoph Hellwig + +[ Upstream commit 3f034c374ad55773c12dd8f3c1607328e17c0072 ] + +Reordered a check to avoid a possible overflow when adding len to bv_len. + +Signed-off-by: Christoph Hellwig +Reviewed-by: Johannes Thumshirn +Link: https://lore.kernel.org/r/20231204173419.782378-2-hch@lst.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/bio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/bio.c b/block/bio.c +index 5eba53ca953b..270f6b99926e 100644 +--- a/block/bio.c ++++ b/block/bio.c +@@ -944,7 +944,7 @@ bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, + + if ((addr1 | mask) != (addr2 | mask)) + return false; +- if (bv->bv_len + len > queue_max_segment_size(q)) ++ if (len > queue_max_segment_size(q) - bv->bv_len) + return false; + return bvec_try_merge_page(bv, page, len, offset, same_page); + } +-- +2.43.0 + diff --git a/queue-6.6/block-rnbd-srv-check-for-unlikely-string-overflow.patch b/queue-6.6/block-rnbd-srv-check-for-unlikely-string-overflow.patch new file mode 100644 index 00000000000..d195403d97b --- /dev/null +++ b/queue-6.6/block-rnbd-srv-check-for-unlikely-string-overflow.patch @@ -0,0 +1,88 @@ +From 35e711459b42f75cd4882c1c8bd6cb3025a2151e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 13:47:42 -0800 +Subject: block/rnbd-srv: Check for unlikely string overflow + +From: Kees Cook + +[ Upstream commit 9e4bf6a08d1e127bcc4bd72557f2dfafc6bc7f41 ] + +Since "dev_search_path" can technically be as large as PATH_MAX, +there was a risk of truncation when copying it and a second string +into "full_path" since it was also PATH_MAX sized. The W=1 builds were +reporting this warning: + +drivers/block/rnbd/rnbd-srv.c: In function 'process_msg_open.isra': +drivers/block/rnbd/rnbd-srv.c:616:51: warning: '%s' directive output may be truncated writing up to 254 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] + 616 | snprintf(full_path, PATH_MAX, "%s/%s", + | ^~ +In function 'rnbd_srv_get_full_path', + inlined from 'process_msg_open.isra' at drivers/block/rnbd/rnbd-srv.c:721:14: drivers/block/rnbd/rnbd-srv.c:616:17: note: 'snprintf' output between 2 and 4351 bytes into a destination of size 4096 + 616 | snprintf(full_path, PATH_MAX, "%s/%s", + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 617 | dev_search_path, dev_name); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To fix this, unconditionally check for truncation (as was already done +for the case where "%SESSNAME%" was present). + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202312100355.lHoJPgKy-lkp@intel.com/ +Cc: Md. Haris Iqbal +Cc: Jack Wang +Cc: Jens Axboe +Cc: +Signed-off-by: Kees Cook +Acked-by: Guoqing Jiang +Acked-by: Jack Wang +Link: https://lore.kernel.org/r/20231212214738.work.169-kees@kernel.org +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/rnbd/rnbd-srv.c | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c +index c186df0ec641..b67e39a34010 100644 +--- a/drivers/block/rnbd/rnbd-srv.c ++++ b/drivers/block/rnbd/rnbd-srv.c +@@ -585,6 +585,7 @@ static char *rnbd_srv_get_full_path(struct rnbd_srv_session *srv_sess, + { + char *full_path; + char *a, *b; ++ int len; + + full_path = kmalloc(PATH_MAX, GFP_KERNEL); + if (!full_path) +@@ -596,19 +597,19 @@ static char *rnbd_srv_get_full_path(struct rnbd_srv_session *srv_sess, + */ + a = strnstr(dev_search_path, "%SESSNAME%", sizeof(dev_search_path)); + if (a) { +- int len = a - dev_search_path; ++ len = a - dev_search_path; + + len = snprintf(full_path, PATH_MAX, "%.*s/%s/%s", len, + dev_search_path, srv_sess->sessname, dev_name); +- if (len >= PATH_MAX) { +- pr_err("Too long path: %s, %s, %s\n", +- dev_search_path, srv_sess->sessname, dev_name); +- kfree(full_path); +- return ERR_PTR(-EINVAL); +- } + } else { +- snprintf(full_path, PATH_MAX, "%s/%s", +- dev_search_path, dev_name); ++ len = snprintf(full_path, PATH_MAX, "%s/%s", ++ dev_search_path, dev_name); ++ } ++ if (len >= PATH_MAX) { ++ pr_err("Too long path: %s, %s, %s\n", ++ dev_search_path, srv_sess->sessname, dev_name); ++ kfree(full_path); ++ return ERR_PTR(-EINVAL); + } + + /* eliminitate duplicated slashes */ +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-hci_sync-fix-br-edr-wakeup-bug.patch b/queue-6.6/bluetooth-hci_sync-fix-br-edr-wakeup-bug.patch new file mode 100644 index 00000000000..e6765b6ee21 --- /dev/null +++ b/queue-6.6/bluetooth-hci_sync-fix-br-edr-wakeup-bug.patch @@ -0,0 +1,47 @@ +From e0c2f7d81a536f0e0ff48b119aed0b2155f63a6d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Dec 2023 18:24:17 +0800 +Subject: Bluetooth: hci_sync: fix BR/EDR wakeup bug + +From: clancy shang + +[ Upstream commit d4b70ba1eab450eff9c5ef536f07c01d424b7eda ] + +when Bluetooth set the event mask and enter suspend, the controller +has hci mode change event coming, it cause controller can not enter +sleep mode. so it should to set the hci mode change event mask before +enter suspend. + +Signed-off-by: clancy shang +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/hci_sync.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c +index 9e71362c04b4..5c4efa624625 100644 +--- a/net/bluetooth/hci_sync.c ++++ b/net/bluetooth/hci_sync.c +@@ -3800,12 +3800,14 @@ static int hci_set_event_mask_sync(struct hci_dev *hdev) + if (lmp_bredr_capable(hdev)) { + events[4] |= 0x01; /* Flow Specification Complete */ + +- /* Don't set Disconnect Complete when suspended as that +- * would wakeup the host when disconnecting due to +- * suspend. ++ /* Don't set Disconnect Complete and mode change when ++ * suspended as that would wakeup the host when disconnecting ++ * due to suspend. + */ +- if (hdev->suspended) ++ if (hdev->suspended) { + events[0] &= 0xef; ++ events[2] &= 0xf7; ++ } + } else { + /* Use a different default for LE-only devices */ + memset(events, 0, sizeof(events)); +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-iso-avoid-creating-child-socket-if-pa-sync.patch b/queue-6.6/bluetooth-iso-avoid-creating-child-socket-if-pa-sync.patch new file mode 100644 index 00000000000..2b6e5ab2798 --- /dev/null +++ b/queue-6.6/bluetooth-iso-avoid-creating-child-socket-if-pa-sync.patch @@ -0,0 +1,138 @@ +From 4c82021e1c22a843ee8d449b343368600c549dac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 18:11:40 +0200 +Subject: Bluetooth: ISO: Avoid creating child socket if PA sync is terminating + +From: Iulia Tanasescu + +[ Upstream commit 9f150019f176078144b02c4b9b9dbe7fd5a2fcc3 ] + +When a PA sync socket is closed, the associated hcon is also unlinked +and cleaned up. If there are no other hcons marked with the +HCI_CONN_PA_SYNC flag, HCI_OP_LE_PA_TERM_SYNC is sent to controller. + +Between the time of the command and the moment PA sync is terminated +in controller, residual BIGInfo reports might continue to come. +This causes a new PA sync hcon to be added, and a new socket to be +notified to user space. + +This commit fixs this by adding a flag on a Broadcast listening +socket to mark when the PA sync child has been closed. + +This flag is checked when BIGInfo reports are indicated in +iso_connect_ind, to avoid recreating a hcon and socket if +residual reports arrive before PA sync is terminated. + +Signed-off-by: Iulia Tanasescu +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/iso.c | 51 ++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 48 insertions(+), 3 deletions(-) + +diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c +index 2132a16be93c..0eeec6480139 100644 +--- a/net/bluetooth/iso.c ++++ b/net/bluetooth/iso.c +@@ -52,6 +52,7 @@ static void iso_sock_kill(struct sock *sk); + enum { + BT_SK_BIG_SYNC, + BT_SK_PA_SYNC, ++ BT_SK_PA_SYNC_TERM, + }; + + struct iso_pinfo { +@@ -80,6 +81,11 @@ static bool iso_match_sid(struct sock *sk, void *data); + static bool iso_match_sync_handle(struct sock *sk, void *data); + static void iso_sock_disconn(struct sock *sk); + ++typedef bool (*iso_sock_match_t)(struct sock *sk, void *data); ++ ++static struct sock *iso_get_sock_listen(bdaddr_t *src, bdaddr_t *dst, ++ iso_sock_match_t match, void *data); ++ + /* ---- ISO timers ---- */ + #define ISO_CONN_TIMEOUT (HZ * 40) + #define ISO_DISCONN_TIMEOUT (HZ * 2) +@@ -188,10 +194,21 @@ static void iso_chan_del(struct sock *sk, int err) + sock_set_flag(sk, SOCK_ZAPPED); + } + ++static bool iso_match_conn_sync_handle(struct sock *sk, void *data) ++{ ++ struct hci_conn *hcon = data; ++ ++ if (test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags)) ++ return false; ++ ++ return hcon->sync_handle == iso_pi(sk)->sync_handle; ++} ++ + static void iso_conn_del(struct hci_conn *hcon, int err) + { + struct iso_conn *conn = hcon->iso_data; + struct sock *sk; ++ struct sock *parent; + + if (!conn) + return; +@@ -207,6 +224,25 @@ static void iso_conn_del(struct hci_conn *hcon, int err) + + if (sk) { + lock_sock(sk); ++ ++ /* While a PA sync hcon is in the process of closing, ++ * mark parent socket with a flag, so that any residual ++ * BIGInfo adv reports that arrive before PA sync is ++ * terminated are not processed anymore. ++ */ ++ if (test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags)) { ++ parent = iso_get_sock_listen(&hcon->src, ++ &hcon->dst, ++ iso_match_conn_sync_handle, ++ hcon); ++ ++ if (parent) { ++ set_bit(BT_SK_PA_SYNC_TERM, ++ &iso_pi(parent)->flags); ++ sock_put(parent); ++ } ++ } ++ + iso_sock_clear_timer(sk); + iso_chan_del(sk, err); + release_sock(sk); +@@ -543,8 +579,6 @@ static struct sock *__iso_get_sock_listen_by_sid(bdaddr_t *ba, bdaddr_t *bc, + return NULL; + } + +-typedef bool (*iso_sock_match_t)(struct sock *sk, void *data); +- + /* Find socket listening: + * source bdaddr (Unicast) + * destination bdaddr (Broadcast only) +@@ -1756,9 +1790,20 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags) + /* Try to get PA sync listening socket, if it exists */ + sk = iso_get_sock_listen(&hdev->bdaddr, bdaddr, + iso_match_pa_sync_flag, NULL); +- if (!sk) ++ ++ if (!sk) { + sk = iso_get_sock_listen(&hdev->bdaddr, bdaddr, + iso_match_sync_handle, ev2); ++ ++ /* If PA Sync is in process of terminating, ++ * do not handle any more BIGInfo adv reports. ++ */ ++ ++ if (sk && test_bit(BT_SK_PA_SYNC_TERM, ++ &iso_pi(sk)->flags)) ++ return lm; ++ } ++ + if (sk) { + int err; + +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-l2cap-fix-possible-multiple-reject-send.patch b/queue-6.6/bluetooth-l2cap-fix-possible-multiple-reject-send.patch new file mode 100644 index 00000000000..afeddf9c477 --- /dev/null +++ b/queue-6.6/bluetooth-l2cap-fix-possible-multiple-reject-send.patch @@ -0,0 +1,42 @@ +From 1ea9d7ee35ce5f3abe263eec833107a9e8e946ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Dec 2023 09:10:22 +0100 +Subject: Bluetooth: L2CAP: Fix possible multiple reject send +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Frédéric Danis + +[ Upstream commit 96a3398b467ab8aada3df2f3a79f4b7835d068b8 ] + +In case of an incomplete command or a command with a null identifier 2 +reject packets will be sent, one with the identifier and one with 0. +Consuming the data of the command will prevent it. +This allows to send a reject packet for each corrupted command in a +multi-command packet. + +Signed-off-by: Frédéric Danis +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/l2cap_core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c +index baeebee41cd9..60298975d5c4 100644 +--- a/net/bluetooth/l2cap_core.c ++++ b/net/bluetooth/l2cap_core.c +@@ -6526,7 +6526,8 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, + if (len > skb->len || !cmd->ident) { + BT_DBG("corrupted command"); + l2cap_sig_send_rej(conn, cmd->ident); +- break; ++ skb_pull(skb, len > skb->len ? skb->len : len); ++ continue; + } + + err = l2cap_bredr_sig_cmd(conn, cmd, len, skb->data); +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-qca-set-both-wideband_speech-and-le_states.patch b/queue-6.6/bluetooth-qca-set-both-wideband_speech-and-le_states.patch new file mode 100644 index 00000000000..4b2a258f124 --- /dev/null +++ b/queue-6.6/bluetooth-qca-set-both-wideband_speech-and-le_states.patch @@ -0,0 +1,35 @@ +From 0c9a82d79679ba6dfd8440470bfcb323c604c1a0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Nov 2023 14:02:46 +0800 +Subject: Bluetooth: qca: Set both WIDEBAND_SPEECH and LE_STATES quirks for + QCA2066 + +From: Zijun Hu + +[ Upstream commit 5d192b697c7417254cdd9edc3d5e9e0364eb9045 ] + +Set both WIDEBAND_SPEECH_SUPPORTED and VALID_LE_STATES quirks +for QCA2066. + +Signed-off-by: Zijun Hu +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/hci_qca.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c +index 4b57e15f9c7a..ad940027e4b5 100644 +--- a/drivers/bluetooth/hci_qca.c ++++ b/drivers/bluetooth/hci_qca.c +@@ -2035,6 +2035,7 @@ static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused = { + static const struct qca_device_data qca_soc_data_qca6390 __maybe_unused = { + .soc_type = QCA_QCA6390, + .num_vregs = 0, ++ .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES, + }; + + static const struct qca_device_data qca_soc_data_wcn6750 __maybe_unused = { +-- +2.43.0 + diff --git a/queue-6.6/bonding-return-enomem-instead-of-bug-in-alb_upper_de.patch b/queue-6.6/bonding-return-enomem-instead-of-bug-in-alb_upper_de.patch new file mode 100644 index 00000000000..986716b2cef --- /dev/null +++ b/queue-6.6/bonding-return-enomem-instead-of-bug-in-alb_upper_de.patch @@ -0,0 +1,69 @@ +From 6ccab3ab3ecca7c5f0ca4cb05f1c5bb375cd606c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 Nov 2023 16:16:53 +0800 +Subject: bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk + +From: Zhengchao Shao + +[ Upstream commit d6b83f1e3707c4d60acfa58afd3515e17e5d5384 ] + +If failed to allocate "tags" or could not find the final upper device from +start_dev's upper list in bond_verify_device_path(), only the loopback +detection of the current upper device should be affected, and the system is +no need to be panic. +So return -ENOMEM in alb_upper_dev_walk to stop walking, print some warn +information when failed to allocate memory for vlan tags in +bond_verify_device_path. + +I also think that the following function calls +netdev_walk_all_upper_dev_rcu +---->>>alb_upper_dev_walk +---------->>>bond_verify_device_path +From this way, "end device" can eventually be obtained from "start device" +in bond_verify_device_path, IS_ERR(tags) could be instead of +IS_ERR_OR_NULL(tags) in alb_upper_dev_walk. + +Signed-off-by: Zhengchao Shao +Acked-by: Jay Vosburgh +Link: https://lore.kernel.org/r/20231118081653.1481260-1-shaozhengchao@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/bonding/bond_alb.c | 3 ++- + drivers/net/bonding/bond_main.c | 5 ++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c +index dc2c7b979656..7edf0fd58c34 100644 +--- a/drivers/net/bonding/bond_alb.c ++++ b/drivers/net/bonding/bond_alb.c +@@ -985,7 +985,8 @@ static int alb_upper_dev_walk(struct net_device *upper, + if (netif_is_macvlan(upper) && !strict_match) { + tags = bond_verify_device_path(bond->dev, upper, 0); + if (IS_ERR_OR_NULL(tags)) +- BUG(); ++ return -ENOMEM; ++ + alb_send_lp_vid(slave, upper->dev_addr, + tags[0].vlan_proto, tags[0].vlan_id); + kfree(tags); +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c +index 8e6cc0e133b7..9c1652886f4e 100644 +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -2973,8 +2973,11 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev, + + if (start_dev == end_dev) { + tags = kcalloc(level + 1, sizeof(*tags), GFP_ATOMIC); +- if (!tags) ++ if (!tags) { ++ net_err_ratelimited("%s: %s: Failed to allocate tags\n", ++ __func__, start_dev->name); + return ERR_PTR(-ENOMEM); ++ } + tags[level].vlan_proto = BOND_VLAN_PROTO_NONE; + return tags; + } +-- +2.43.0 + diff --git a/queue-6.6/bpf-check-rcu_read_lock_trace_held-before-calling-bp.patch b/queue-6.6/bpf-check-rcu_read_lock_trace_held-before-calling-bp.patch new file mode 100644 index 00000000000..8e80ed1a160 --- /dev/null +++ b/queue-6.6/bpf-check-rcu_read_lock_trace_held-before-calling-bp.patch @@ -0,0 +1,95 @@ +From c37a2bdf8ad91c7c58cd99eae8e672d55bda829b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 22:04:19 +0800 +Subject: bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers + +From: Hou Tao + +[ Upstream commit 169410eba271afc9f0fb476d996795aa26770c6d ] + +These three bpf_map_{lookup,update,delete}_elem() helpers are also +available for sleepable bpf program, so add the corresponding lock +assertion for sleepable bpf program, otherwise the following warning +will be reported when a sleepable bpf program manipulates bpf map under +interpreter mode (aka bpf_jit_enable=0): + + WARNING: CPU: 3 PID: 4985 at kernel/bpf/helpers.c:40 ...... + CPU: 3 PID: 4985 Comm: test_progs Not tainted 6.6.0+ #2 + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) ...... + RIP: 0010:bpf_map_lookup_elem+0x54/0x60 + ...... + Call Trace: + + ? __warn+0xa5/0x240 + ? bpf_map_lookup_elem+0x54/0x60 + ? report_bug+0x1ba/0x1f0 + ? handle_bug+0x40/0x80 + ? exc_invalid_op+0x18/0x50 + ? asm_exc_invalid_op+0x1b/0x20 + ? __pfx_bpf_map_lookup_elem+0x10/0x10 + ? rcu_lockdep_current_cpu_online+0x65/0xb0 + ? rcu_is_watching+0x23/0x50 + ? bpf_map_lookup_elem+0x54/0x60 + ? __pfx_bpf_map_lookup_elem+0x10/0x10 + ___bpf_prog_run+0x513/0x3b70 + __bpf_prog_run32+0x9d/0xd0 + ? __bpf_prog_enter_sleepable_recur+0xad/0x120 + ? __bpf_prog_enter_sleepable_recur+0x3e/0x120 + bpf_trampoline_6442580665+0x4d/0x1000 + __x64_sys_getpgid+0x5/0x30 + ? do_syscall_64+0x36/0xb0 + entry_SYSCALL_64_after_hwframe+0x6e/0x76 + + +Signed-off-by: Hou Tao +Link: https://lore.kernel.org/r/20231204140425.1480317-2-houtao@huaweicloud.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/bpf/helpers.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c +index 607be04db75b..e68ef39cda67 100644 +--- a/kernel/bpf/helpers.c ++++ b/kernel/bpf/helpers.c +@@ -31,12 +31,13 @@ + * + * Different map implementations will rely on rcu in map methods + * lookup/update/delete, therefore eBPF programs must run under rcu lock +- * if program is allowed to access maps, so check rcu_read_lock_held in +- * all three functions. ++ * if program is allowed to access maps, so check rcu_read_lock_held() or ++ * rcu_read_lock_trace_held() in all three functions. + */ + BPF_CALL_2(bpf_map_lookup_elem, struct bpf_map *, map, void *, key) + { +- WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_bh_held()); ++ WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_trace_held() && ++ !rcu_read_lock_bh_held()); + return (unsigned long) map->ops->map_lookup_elem(map, key); + } + +@@ -52,7 +53,8 @@ const struct bpf_func_proto bpf_map_lookup_elem_proto = { + BPF_CALL_4(bpf_map_update_elem, struct bpf_map *, map, void *, key, + void *, value, u64, flags) + { +- WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_bh_held()); ++ WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_trace_held() && ++ !rcu_read_lock_bh_held()); + return map->ops->map_update_elem(map, key, value, flags); + } + +@@ -69,7 +71,8 @@ const struct bpf_func_proto bpf_map_update_elem_proto = { + + BPF_CALL_2(bpf_map_delete_elem, struct bpf_map *, map, void *, key) + { +- WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_bh_held()); ++ WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_trace_held() && ++ !rcu_read_lock_bh_held()); + return map->ops->map_delete_elem(map, key); + } + +-- +2.43.0 + diff --git a/queue-6.6/bpf-fix-a-few-selftest-failures-due-to-llvm18-change.patch b/queue-6.6/bpf-fix-a-few-selftest-failures-due-to-llvm18-change.patch new file mode 100644 index 00000000000..8078071d099 --- /dev/null +++ b/queue-6.6/bpf-fix-a-few-selftest-failures-due-to-llvm18-change.patch @@ -0,0 +1,99 @@ +From bb4eeff8062434942f86ca527f433fd859f3584a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Nov 2023 21:03:42 -0800 +Subject: bpf: Fix a few selftest failures due to llvm18 change + +From: Yonghong Song + +[ Upstream commit b16904fd9f01b580db357ef2b1cc9e86d89576c2 ] + +With latest upstream llvm18, the following test cases failed: + + $ ./test_progs -j + #13/2 bpf_cookie/multi_kprobe_link_api:FAIL + #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL + #13 bpf_cookie:FAIL + #77 fentry_fexit:FAIL + #78/1 fentry_test/fentry:FAIL + #78 fentry_test:FAIL + #82/1 fexit_test/fexit:FAIL + #82 fexit_test:FAIL + #112/1 kprobe_multi_test/skel_api:FAIL + #112/2 kprobe_multi_test/link_api_addrs:FAIL + [...] + #112 kprobe_multi_test:FAIL + #356/17 test_global_funcs/global_func17:FAIL + #356 test_global_funcs:FAIL + +Further analysis shows llvm upstream patch [1] is responsible for the above +failures. For example, for function bpf_fentry_test7() in net/bpf/test_run.c, +without [1], the asm code is: + + 0000000000000400 : + 400: f3 0f 1e fa endbr64 + 404: e8 00 00 00 00 callq 0x409 + 409: 48 89 f8 movq %rdi, %rax + 40c: c3 retq + 40d: 0f 1f 00 nopl (%rax) + +... and with [1], the asm code is: + + 0000000000005d20 : + 5d20: e8 00 00 00 00 callq 0x5d25 + 5d25: c3 retq + +... and is called instead of +and this caused test failures for #13/#77 etc. except #356. + +For test case #356/17, with [1] (progs/test_global_func17.c)), the main prog +looks like: + + 0000000000000000 : + 0: b4 00 00 00 2a 00 00 00 w0 = 0x2a + 1: 95 00 00 00 00 00 00 00 exit + +... which passed verification while the test itself expects a verification +failure. + +Let us add 'barrier_var' style asm code in both places to prevent function +specialization which caused selftests failure. + + [1] https://github.com/llvm/llvm-project/pull/72903 + +Signed-off-by: Yonghong Song +Signed-off-by: Daniel Borkmann +Link: https://lore.kernel.org/bpf/20231127050342.1945270-1-yonghong.song@linux.dev +Signed-off-by: Sasha Levin +--- + net/bpf/test_run.c | 2 +- + tools/testing/selftests/bpf/progs/test_global_func17.c | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c +index 0841f8d82419..478ee7aba85f 100644 +--- a/net/bpf/test_run.c ++++ b/net/bpf/test_run.c +@@ -543,7 +543,7 @@ struct bpf_fentry_test_t { + + int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) + { +- asm volatile (""); ++ asm volatile ("": "+r"(arg)); + return (long)arg; + } + +diff --git a/tools/testing/selftests/bpf/progs/test_global_func17.c b/tools/testing/selftests/bpf/progs/test_global_func17.c +index a32e11c7d933..5de44b09e8ec 100644 +--- a/tools/testing/selftests/bpf/progs/test_global_func17.c ++++ b/tools/testing/selftests/bpf/progs/test_global_func17.c +@@ -5,6 +5,7 @@ + + __noinline int foo(int *p) + { ++ barrier_var(p); + return p ? (*p = 42) : 0; + } + +-- +2.43.0 + diff --git a/queue-6.6/bpf-set-need_defer-as-false-when-clearing-fd-array-d.patch b/queue-6.6/bpf-set-need_defer-as-false-when-clearing-fd-array-d.patch new file mode 100644 index 00000000000..1da9e0bbc8c --- /dev/null +++ b/queue-6.6/bpf-set-need_defer-as-false-when-clearing-fd-array-d.patch @@ -0,0 +1,127 @@ +From 5f929980d3967f26eeb8f05ca4380637d8033022 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 22:04:21 +0800 +Subject: bpf: Set need_defer as false when clearing fd array during map free + +From: Hou Tao + +[ Upstream commit 79d93b3c6ffd79abcd8e43345980aa1e904879c4 ] + +Both map deletion operation, map release and map free operation use +fd_array_map_delete_elem() to remove the element from fd array and +need_defer is always true in fd_array_map_delete_elem(). For the map +deletion operation and map release operation, need_defer=true is +necessary, because the bpf program, which accesses the element in fd +array, may still alive. However for map free operation, it is certain +that the bpf program which owns the fd array has already been exited, so +setting need_defer as false is appropriate for map free operation. + +So fix it by adding need_defer parameter to bpf_fd_array_map_clear() and +adding a new helper __fd_array_map_delete_elem() to handle the map +deletion, map release and map free operations correspondingly. + +Signed-off-by: Hou Tao +Link: https://lore.kernel.org/r/20231204140425.1480317-4-houtao@huaweicloud.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/bpf/arraymap.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c +index 9bfad7e96913..c9843dde6908 100644 +--- a/kernel/bpf/arraymap.c ++++ b/kernel/bpf/arraymap.c +@@ -871,7 +871,7 @@ int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file, + return 0; + } + +-static long fd_array_map_delete_elem(struct bpf_map *map, void *key) ++static long __fd_array_map_delete_elem(struct bpf_map *map, void *key, bool need_defer) + { + struct bpf_array *array = container_of(map, struct bpf_array, map); + void *old_ptr; +@@ -890,13 +890,18 @@ static long fd_array_map_delete_elem(struct bpf_map *map, void *key) + } + + if (old_ptr) { +- map->ops->map_fd_put_ptr(map, old_ptr, true); ++ map->ops->map_fd_put_ptr(map, old_ptr, need_defer); + return 0; + } else { + return -ENOENT; + } + } + ++static long fd_array_map_delete_elem(struct bpf_map *map, void *key) ++{ ++ return __fd_array_map_delete_elem(map, key, true); ++} ++ + static void *prog_fd_array_get_ptr(struct bpf_map *map, + struct file *map_file, int fd) + { +@@ -925,13 +930,13 @@ static u32 prog_fd_array_sys_lookup_elem(void *ptr) + } + + /* decrement refcnt of all bpf_progs that are stored in this map */ +-static void bpf_fd_array_map_clear(struct bpf_map *map) ++static void bpf_fd_array_map_clear(struct bpf_map *map, bool need_defer) + { + struct bpf_array *array = container_of(map, struct bpf_array, map); + int i; + + for (i = 0; i < array->map.max_entries; i++) +- fd_array_map_delete_elem(map, &i); ++ __fd_array_map_delete_elem(map, &i, need_defer); + } + + static void prog_array_map_seq_show_elem(struct bpf_map *map, void *key, +@@ -1072,7 +1077,7 @@ static void prog_array_map_clear_deferred(struct work_struct *work) + { + struct bpf_map *map = container_of(work, struct bpf_array_aux, + work)->map; +- bpf_fd_array_map_clear(map); ++ bpf_fd_array_map_clear(map, true); + bpf_map_put(map); + } + +@@ -1222,7 +1227,7 @@ static void perf_event_fd_array_release(struct bpf_map *map, + for (i = 0; i < array->map.max_entries; i++) { + ee = READ_ONCE(array->ptrs[i]); + if (ee && ee->map_file == map_file) +- fd_array_map_delete_elem(map, &i); ++ __fd_array_map_delete_elem(map, &i, true); + } + rcu_read_unlock(); + } +@@ -1230,7 +1235,7 @@ static void perf_event_fd_array_release(struct bpf_map *map, + static void perf_event_fd_array_map_free(struct bpf_map *map) + { + if (map->map_flags & BPF_F_PRESERVE_ELEMS) +- bpf_fd_array_map_clear(map); ++ bpf_fd_array_map_clear(map, false); + fd_array_map_free(map); + } + +@@ -1266,7 +1271,7 @@ static void cgroup_fd_array_put_ptr(struct bpf_map *map, void *ptr, bool need_de + + static void cgroup_fd_array_free(struct bpf_map *map) + { +- bpf_fd_array_map_clear(map); ++ bpf_fd_array_map_clear(map, false); + fd_array_map_free(map); + } + +@@ -1311,7 +1316,7 @@ static void array_of_map_free(struct bpf_map *map) + * is protected by fdget/fdput. + */ + bpf_map_meta_free(map->inner_map_meta); +- bpf_fd_array_map_clear(map); ++ bpf_fd_array_map_clear(map, false); + fd_array_map_free(map); + } + +-- +2.43.0 + diff --git a/queue-6.6/bpf-set-uattr-batch.count-as-zero-before-batched-upd.patch b/queue-6.6/bpf-set-uattr-batch.count-as-zero-before-batched-upd.patch new file mode 100644 index 00000000000..e13b50f58b2 --- /dev/null +++ b/queue-6.6/bpf-set-uattr-batch.count-as-zero-before-batched-upd.patch @@ -0,0 +1,51 @@ +From faabe2c9e2adfd74fc4ccac30b29e43acc7c1760 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Dec 2023 18:23:53 +0800 +Subject: bpf: Set uattr->batch.count as zero before batched update or deletion + +From: Hou Tao + +[ Upstream commit 06e5c999f10269a532304e89a6adb2fbfeb0593c ] + +generic_map_{delete,update}_batch() doesn't set uattr->batch.count as +zero before it tries to allocate memory for key. If the memory +allocation fails, the value of uattr->batch.count will be incorrect. + +Fix it by setting uattr->batch.count as zero beore batched update or +deletion. + +Signed-off-by: Hou Tao +Link: https://lore.kernel.org/r/20231208102355.2628918-6-houtao@huaweicloud.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/bpf/syscall.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c +index f61c53237c19..4b7d186c7622 100644 +--- a/kernel/bpf/syscall.c ++++ b/kernel/bpf/syscall.c +@@ -1699,6 +1699,9 @@ int generic_map_delete_batch(struct bpf_map *map, + if (!max_count) + return 0; + ++ if (put_user(0, &uattr->batch.count)) ++ return -EFAULT; ++ + key = kvmalloc(map->key_size, GFP_USER | __GFP_NOWARN); + if (!key) + return -ENOMEM; +@@ -1756,6 +1759,9 @@ int generic_map_update_batch(struct bpf_map *map, struct file *map_file, + if (!max_count) + return 0; + ++ if (put_user(0, &uattr->batch.count)) ++ return -EFAULT; ++ + key = kvmalloc(map->key_size, GFP_USER | __GFP_NOWARN); + if (!key) + return -ENOMEM; +-- +2.43.0 + diff --git a/queue-6.6/bridge-cfm-fix-enum-typo-in-br_cc_ccm_tx_parse.patch b/queue-6.6/bridge-cfm-fix-enum-typo-in-br_cc_ccm_tx_parse.patch new file mode 100644 index 00000000000..39f01a433a6 --- /dev/null +++ b/queue-6.6/bridge-cfm-fix-enum-typo-in-br_cc_ccm_tx_parse.patch @@ -0,0 +1,46 @@ +From 81303fab4774620c324c3aa3f17efafa32cf1806 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Dec 2023 00:34:51 +0800 +Subject: bridge: cfm: fix enum typo in br_cc_ccm_tx_parse + +From: Lin Ma + +[ Upstream commit c2b2ee36250d967c21890cb801e24af4b6a9eaa5 ] + +It appears that there is a typo in the code where the nlattr array is +being parsed with policy br_cfm_cc_ccm_tx_policy, but the instance is +being accessed via IFLA_BRIDGE_CFM_CC_RDI_INSTANCE, which is associated +with the policy br_cfm_cc_rdi_policy. + +This problem was introduced by commit 2be665c3940d ("bridge: cfm: Netlink +SET configuration Interface."). + +Though it seems like a harmless typo since these two enum owns the exact +same value (1 here), it is quite misleading hence fix it by using the +correct enum IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE here. + +Signed-off-by: Lin Ma +Reviewed-by: Simon Horman +Acked-by: Nikolay Aleksandrov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/bridge/br_cfm_netlink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/bridge/br_cfm_netlink.c b/net/bridge/br_cfm_netlink.c +index 5c4c369f8536..2faab44652e7 100644 +--- a/net/bridge/br_cfm_netlink.c ++++ b/net/bridge/br_cfm_netlink.c +@@ -362,7 +362,7 @@ static int br_cc_ccm_tx_parse(struct net_bridge *br, struct nlattr *attr, + + memset(&tx_info, 0, sizeof(tx_info)); + +- instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]); ++ instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE]); + nla_memcpy(&tx_info.dmac.addr, + tb[IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC], + sizeof(tx_info.dmac.addr)); +-- +2.43.0 + diff --git a/queue-6.6/ceph-fix-deadlock-or-deadcode-of-misusing-dget.patch b/queue-6.6/ceph-fix-deadlock-or-deadcode-of-misusing-dget.patch new file mode 100644 index 00000000000..eec2e70b50a --- /dev/null +++ b/queue-6.6/ceph-fix-deadlock-or-deadcode-of-misusing-dget.patch @@ -0,0 +1,63 @@ +From d0fbc510ebbd5b9ec59278549892f8184f10ed3e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 13:26:18 +0800 +Subject: ceph: fix deadlock or deadcode of misusing dget() + +From: Xiubo Li + +[ Upstream commit b493ad718b1f0357394d2cdecbf00a44a36fa085 ] + +The lock order is incorrect between denty and its parent, we should +always make sure that the parent get the lock first. + +But since this deadcode is never used and the parent dir will always +be set from the callers, let's just remove it. + +Link: https://lore.kernel.org/r/20231116081919.GZ1957730@ZenIV +Reported-by: Al Viro +Signed-off-by: Xiubo Li +Reviewed-by: Jeff Layton +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/caps.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c +index 14215ec646f7..7f7e5f5d643c 100644 +--- a/fs/ceph/caps.c ++++ b/fs/ceph/caps.c +@@ -4780,12 +4780,14 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry, + struct inode *dir, + int mds, int drop, int unless) + { +- struct dentry *parent = NULL; + struct ceph_mds_request_release *rel = *p; + struct ceph_dentry_info *di = ceph_dentry(dentry); + int force = 0; + int ret; + ++ /* This shouldn't happen */ ++ BUG_ON(!dir); ++ + /* + * force an record for the directory caps if we have a dentry lease. + * this is racy (can't take i_ceph_lock and d_lock together), but it +@@ -4795,14 +4797,9 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry, + spin_lock(&dentry->d_lock); + if (di->lease_session && di->lease_session->s_mds == mds) + force = 1; +- if (!dir) { +- parent = dget(dentry->d_parent); +- dir = d_inode(parent); +- } + spin_unlock(&dentry->d_lock); + + ret = ceph_encode_inode_release(p, dir, mds, drop, unless, force); +- dput(parent); + + spin_lock(&dentry->d_lock); + if (ret && di->lease_session && di->lease_session->s_mds == mds) { +-- +2.43.0 + diff --git a/queue-6.6/ceph-fix-invalid-pointer-access-if-get_quota_realm-r.patch b/queue-6.6/ceph-fix-invalid-pointer-access-if-get_quota_realm-r.patch new file mode 100644 index 00000000000..f5baa45da70 --- /dev/null +++ b/queue-6.6/ceph-fix-invalid-pointer-access-if-get_quota_realm-r.patch @@ -0,0 +1,138 @@ +From 8e8c20ab30232bd05011b6f667359d2f1ff763b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 09:53:40 +0800 +Subject: ceph: fix invalid pointer access if get_quota_realm return ERR_PTR + +From: Wenchao Hao + +[ Upstream commit 0f4cf64eabc6e16cfc2704f1960e82dc79d91c8d ] + +This issue is reported by smatch that get_quota_realm() might return +ERR_PTR but we did not handle it. It's not a immediate bug, while we +still should address it to avoid potential bugs if get_quota_realm() +is changed to return other ERR_PTR in future. + +Set ceph_snap_realm's pointer in get_quota_realm()'s to address this +issue, the pointer would be set to NULL if get_quota_realm() failed +to get struct ceph_snap_realm, so no ERR_PTR would happen any more. + +[ xiubli: minor code style clean up ] + +Signed-off-by: Wenchao Hao +Reviewed-by: Xiubo Li +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/quota.c | 39 ++++++++++++++++++++++----------------- + 1 file changed, 22 insertions(+), 17 deletions(-) + +diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c +index f7fcf7f08ec6..ca4932e6f71b 100644 +--- a/fs/ceph/quota.c ++++ b/fs/ceph/quota.c +@@ -194,10 +194,10 @@ void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc) + } + + /* +- * This function walks through the snaprealm for an inode and returns the +- * ceph_snap_realm for the first snaprealm that has quotas set (max_files, ++ * This function walks through the snaprealm for an inode and set the ++ * realmp with the first snaprealm that has quotas set (max_files, + * max_bytes, or any, depending on the 'which_quota' argument). If the root is +- * reached, return the root ceph_snap_realm instead. ++ * reached, set the realmp with the root ceph_snap_realm instead. + * + * Note that the caller is responsible for calling ceph_put_snap_realm() on the + * returned realm. +@@ -208,18 +208,19 @@ void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc) + * this function will return -EAGAIN; otherwise, the snaprealms walk-through + * will be restarted. + */ +-static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, +- struct inode *inode, +- enum quota_get_realm which_quota, +- bool retry) ++static int get_quota_realm(struct ceph_mds_client *mdsc, struct inode *inode, ++ enum quota_get_realm which_quota, ++ struct ceph_snap_realm **realmp, bool retry) + { + struct ceph_inode_info *ci = NULL; + struct ceph_snap_realm *realm, *next; + struct inode *in; + bool has_quota; + ++ if (realmp) ++ *realmp = NULL; + if (ceph_snap(inode) != CEPH_NOSNAP) +- return NULL; ++ return 0; + + restart: + realm = ceph_inode(inode)->i_snap_realm; +@@ -245,7 +246,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, + break; + ceph_put_snap_realm(mdsc, realm); + if (!retry) +- return ERR_PTR(-EAGAIN); ++ return -EAGAIN; + goto restart; + } + +@@ -254,8 +255,11 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, + iput(in); + + next = realm->parent; +- if (has_quota || !next) +- return realm; ++ if (has_quota || !next) { ++ if (realmp) ++ *realmp = realm; ++ return 0; ++ } + + ceph_get_snap_realm(mdsc, next); + ceph_put_snap_realm(mdsc, realm); +@@ -264,7 +268,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, + if (realm) + ceph_put_snap_realm(mdsc, realm); + +- return NULL; ++ return 0; + } + + bool ceph_quota_is_same_realm(struct inode *old, struct inode *new) +@@ -272,6 +276,7 @@ bool ceph_quota_is_same_realm(struct inode *old, struct inode *new) + struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(old->i_sb); + struct ceph_snap_realm *old_realm, *new_realm; + bool is_same; ++ int ret; + + restart: + /* +@@ -281,9 +286,9 @@ bool ceph_quota_is_same_realm(struct inode *old, struct inode *new) + * dropped and we can then restart the whole operation. + */ + down_read(&mdsc->snap_rwsem); +- old_realm = get_quota_realm(mdsc, old, QUOTA_GET_ANY, true); +- new_realm = get_quota_realm(mdsc, new, QUOTA_GET_ANY, false); +- if (PTR_ERR(new_realm) == -EAGAIN) { ++ get_quota_realm(mdsc, old, QUOTA_GET_ANY, &old_realm, true); ++ ret = get_quota_realm(mdsc, new, QUOTA_GET_ANY, &new_realm, false); ++ if (ret == -EAGAIN) { + up_read(&mdsc->snap_rwsem); + if (old_realm) + ceph_put_snap_realm(mdsc, old_realm); +@@ -485,8 +490,8 @@ bool ceph_quota_update_statfs(struct ceph_fs_client *fsc, struct kstatfs *buf) + bool is_updated = false; + + down_read(&mdsc->snap_rwsem); +- realm = get_quota_realm(mdsc, d_inode(fsc->sb->s_root), +- QUOTA_GET_MAX_BYTES, true); ++ get_quota_realm(mdsc, d_inode(fsc->sb->s_root), QUOTA_GET_MAX_BYTES, ++ &realm, true); + up_read(&mdsc->snap_rwsem); + if (!realm) + return false; +-- +2.43.0 + diff --git a/queue-6.6/ceph-reinitialize-mds-feature-bit-even-when-session-.patch b/queue-6.6/ceph-reinitialize-mds-feature-bit-even-when-session-.patch new file mode 100644 index 00000000000..eda15fc86e8 --- /dev/null +++ b/queue-6.6/ceph-reinitialize-mds-feature-bit-even-when-session-.patch @@ -0,0 +1,45 @@ +From bca26a760ce7109decddb1d3a86f14abb38c6966 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Nov 2023 10:02:32 +0530 +Subject: ceph: reinitialize mds feature bit even when session in open + +From: Venky Shankar + +[ Upstream commit f48e0342a74d7770cdf1d11894bdc3b6d989b29e ] + +Following along the same lines as per the user-space fix. Right +now this isn't really an issue with the ceph kernel driver because +of the feature bit laginess, however, that can change over time +(when the new snaprealm info type is ported to the kernel driver) +and depending on the MDS version that's being upgraded can cause +message decoding issues - so, fix that early on. + +Link: http://tracker.ceph.com/issues/63188 +Signed-off-by: Venky Shankar +Reviewed-by: Xiubo Li +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/mds_client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c +index 293b93182955..6d76fd0f704a 100644 +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -4010,11 +4010,11 @@ static void handle_session(struct ceph_mds_session *session, + if (session->s_state == CEPH_MDS_SESSION_RECONNECTING) + pr_info("mds%d reconnect success\n", session->s_mds); + ++ session->s_features = features; + if (session->s_state == CEPH_MDS_SESSION_OPEN) { + pr_notice("mds%d is already opened\n", session->s_mds); + } else { + session->s_state = CEPH_MDS_SESSION_OPEN; +- session->s_features = features; + renewed_caps(mdsc, session, 0); + if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT, + &session->s_features)) +-- +2.43.0 + diff --git a/queue-6.6/cfi-add-cfi_noseal.patch b/queue-6.6/cfi-add-cfi_noseal.patch new file mode 100644 index 00000000000..41c38413ac1 --- /dev/null +++ b/queue-6.6/cfi-add-cfi_noseal.patch @@ -0,0 +1,58 @@ +From 53e565d7b79930b416aa4725c1f492957a993a3b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Dec 2023 10:12:21 +0100 +Subject: cfi: Add CFI_NOSEAL() + +From: Peter Zijlstra + +[ Upstream commit e9d13b9d2f99ccf7afeab490d97eaa5ac9846598 ] + +Add a CFI_NOSEAL() helper to mark functions that need to retain their +CFI information, despite not otherwise leaking their address. + +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lore.kernel.org/r/20231215092707.669401084@infradead.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + arch/x86/include/asm/cfi.h | 5 +++++ + include/linux/cfi.h | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h +index 58dacd90daef..67b010c224e4 100644 +--- a/arch/x86/include/asm/cfi.h ++++ b/arch/x86/include/asm/cfi.h +@@ -9,6 +9,7 @@ + */ + + #include ++#include + + #ifdef CONFIG_CFI_CLANG + enum bug_trap_type handle_cfi_failure(struct pt_regs *regs); +@@ -19,4 +20,8 @@ static inline enum bug_trap_type handle_cfi_failure(struct pt_regs *regs) + } + #endif /* CONFIG_CFI_CLANG */ + ++#if HAS_KERNEL_IBT == 1 ++#define CFI_NOSEAL(x) asm(IBT_NOSEAL(__stringify(x))) ++#endif ++ + #endif /* _ASM_X86_CFI_H */ +diff --git a/include/linux/cfi.h b/include/linux/cfi.h +index 3552ec82b725..bb084eb053e7 100644 +--- a/include/linux/cfi.h ++++ b/include/linux/cfi.h +@@ -38,4 +38,8 @@ static inline void module_cfi_finalize(const Elf_Ehdr *hdr, + #endif /* CONFIG_ARCH_USES_CFI_TRAPS */ + #endif /* CONFIG_MODULES */ + ++#ifndef CFI_NOSEAL ++#define CFI_NOSEAL(x) ++#endif ++ + #endif /* _LINUX_CFI_H */ +-- +2.43.0 + diff --git a/queue-6.6/clk-hi3620-fix-memory-leak-in-hi3620_mmc_clk_init.patch b/queue-6.6/clk-hi3620-fix-memory-leak-in-hi3620_mmc_clk_init.patch new file mode 100644 index 00000000000..c1a8ec14901 --- /dev/null +++ b/queue-6.6/clk-hi3620-fix-memory-leak-in-hi3620_mmc_clk_init.patch @@ -0,0 +1,41 @@ +From 63e4843c2e9ec1be91a0c816d2af45d0f3552a7d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 00:50:40 +0800 +Subject: clk: hi3620: Fix memory leak in hi3620_mmc_clk_init() + +From: Kuan-Wei Chiu + +[ Upstream commit bfbea9e5667cfa9552c3d88f023386f017f6c308 ] + +In cases where kcalloc() fails for the 'clk_data->clks' allocation, the +code path does not handle the failure gracefully, potentially leading +to a memory leak. This fix ensures proper cleanup by freeing the +allocated memory for 'clk_data' before returning. + +Signed-off-by: Kuan-Wei Chiu +Link: https://lore.kernel.org/r/20231210165040.3407545-1-visitorckw@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/hisilicon/clk-hi3620.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c +index 2d7186905abd..5d0226530fdb 100644 +--- a/drivers/clk/hisilicon/clk-hi3620.c ++++ b/drivers/clk/hisilicon/clk-hi3620.c +@@ -466,8 +466,10 @@ static void __init hi3620_mmc_clk_init(struct device_node *node) + return; + + clk_data->clks = kcalloc(num, sizeof(*clk_data->clks), GFP_KERNEL); +- if (!clk_data->clks) ++ if (!clk_data->clks) { ++ kfree(clk_data); + return; ++ } + + for (i = 0; i < num; i++) { + struct hisi_mmc_clock *mmc_clk = &hi3620_mmc_clks[i]; +-- +2.43.0 + diff --git a/queue-6.6/clk-imx-clk-imx8qxp-fix-lvds-bypass-pixel-and-phy-cl.patch b/queue-6.6/clk-imx-clk-imx8qxp-fix-lvds-bypass-pixel-and-phy-cl.patch new file mode 100644 index 00000000000..df36a24e9e8 --- /dev/null +++ b/queue-6.6/clk-imx-clk-imx8qxp-fix-lvds-bypass-pixel-and-phy-cl.patch @@ -0,0 +1,77 @@ +From 0255fcf59b459fba475aa556615c00c48bfee775 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Dec 2023 13:24:07 +0100 +Subject: clk: imx: clk-imx8qxp: fix LVDS bypass, pixel and phy clocks + +From: Alexander Stein + +[ Upstream commit 3f5f63adeea7e7aa715e101ffe4b4ac9705f9664 ] + +To be compatible with SCU firmware based on 1.15 a different clock +routing for LVDS is needed. + +Signed-off-by: Oliver F. Brown +Signed-off-by: Ranjani Vaidyanathan +Signed-off-by: Alexander Stein +Reviewed-by: Abel Vesa +Link: https://lore.kernel.org/r/20231218122407.2757175-1-alexander.stein@ew.tq-group.com/ +Signed-off-by: Abel Vesa +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx8qxp.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c +index 4020aa4b79bf..245761e01897 100644 +--- a/drivers/clk/imx/clk-imx8qxp.c ++++ b/drivers/clk/imx/clk-imx8qxp.c +@@ -66,6 +66,22 @@ static const char * const lcd_pxl_sels[] = { + "lcd_pxl_bypass_div_clk", + }; + ++static const char *const lvds0_sels[] = { ++ "clk_dummy", ++ "clk_dummy", ++ "clk_dummy", ++ "clk_dummy", ++ "mipi0_lvds_bypass_clk", ++}; ++ ++static const char *const lvds1_sels[] = { ++ "clk_dummy", ++ "clk_dummy", ++ "clk_dummy", ++ "clk_dummy", ++ "mipi1_lvds_bypass_clk", ++}; ++ + static const char * const mipi_sels[] = { + "clk_dummy", + "clk_dummy", +@@ -200,9 +216,9 @@ static int imx8qxp_clk_probe(struct platform_device *pdev) + /* MIPI-LVDS SS */ + imx_clk_scu("mipi0_bypass_clk", IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_BYPASS); + imx_clk_scu("mipi0_pixel_clk", IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_PER); +- imx_clk_scu("mipi0_lvds_pixel_clk", IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_MISC2); + imx_clk_scu("mipi0_lvds_bypass_clk", IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_BYPASS); +- imx_clk_scu("mipi0_lvds_phy_clk", IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_MISC3); ++ imx_clk_scu2("mipi0_lvds_pixel_clk", lvds0_sels, ARRAY_SIZE(lvds0_sels), IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_MISC2); ++ imx_clk_scu2("mipi0_lvds_phy_clk", lvds0_sels, ARRAY_SIZE(lvds0_sels), IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_MISC3); + imx_clk_scu2("mipi0_dsi_tx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_MST_BUS); + imx_clk_scu2("mipi0_dsi_rx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_SLV_BUS); + imx_clk_scu2("mipi0_dsi_phy_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_PHY); +@@ -212,9 +228,9 @@ static int imx8qxp_clk_probe(struct platform_device *pdev) + + imx_clk_scu("mipi1_bypass_clk", IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_BYPASS); + imx_clk_scu("mipi1_pixel_clk", IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_PER); +- imx_clk_scu("mipi1_lvds_pixel_clk", IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_MISC2); + imx_clk_scu("mipi1_lvds_bypass_clk", IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_BYPASS); +- imx_clk_scu("mipi1_lvds_phy_clk", IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_MISC3); ++ imx_clk_scu2("mipi1_lvds_pixel_clk", lvds1_sels, ARRAY_SIZE(lvds1_sels), IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_MISC2); ++ imx_clk_scu2("mipi1_lvds_phy_clk", lvds1_sels, ARRAY_SIZE(lvds1_sels), IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_MISC3); + + imx_clk_scu2("mipi1_dsi_tx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_MST_BUS); + imx_clk_scu2("mipi1_dsi_rx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_SLV_BUS); +-- +2.43.0 + diff --git a/queue-6.6/clk-mmp-pxa168-fix-memory-leak-in-pxa168_clk_init.patch b/queue-6.6/clk-mmp-pxa168-fix-memory-leak-in-pxa168_clk_init.patch new file mode 100644 index 00000000000..074948edb6f --- /dev/null +++ b/queue-6.6/clk-mmp-pxa168-fix-memory-leak-in-pxa168_clk_init.patch @@ -0,0 +1,51 @@ +From 441afe5ce7ce9d7b71de3d251a055e034615992e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 01:52:32 +0800 +Subject: clk: mmp: pxa168: Fix memory leak in pxa168_clk_init() + +From: Kuan-Wei Chiu + +[ Upstream commit 2fbabea626b6467eb4e6c4cb7a16523da12e43b4 ] + +In cases where mapping of mpmu/apmu/apbc registers fails, the code path +does not handle the failure gracefully, potentially leading to a memory +leak. This fix ensures proper cleanup by freeing the allocated memory +for 'pxa_unit' before returning. + +Signed-off-by: Kuan-Wei Chiu +Link: https://lore.kernel.org/r/20231210175232.3414584-1-visitorckw@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/mmp/clk-of-pxa168.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c +index fb0df64cf053..c5a7ba1deaa3 100644 +--- a/drivers/clk/mmp/clk-of-pxa168.c ++++ b/drivers/clk/mmp/clk-of-pxa168.c +@@ -308,18 +308,21 @@ static void __init pxa168_clk_init(struct device_node *np) + pxa_unit->mpmu_base = of_iomap(np, 0); + if (!pxa_unit->mpmu_base) { + pr_err("failed to map mpmu registers\n"); ++ kfree(pxa_unit); + return; + } + + pxa_unit->apmu_base = of_iomap(np, 1); + if (!pxa_unit->apmu_base) { + pr_err("failed to map apmu registers\n"); ++ kfree(pxa_unit); + return; + } + + pxa_unit->apbc_base = of_iomap(np, 2); + if (!pxa_unit->apbc_base) { + pr_err("failed to map apbc registers\n"); ++ kfree(pxa_unit); + return; + } + +-- +2.43.0 + diff --git a/queue-6.6/cpufreq-schedutil-use-a-fixed-reference-frequency.patch b/queue-6.6/cpufreq-schedutil-use-a-fixed-reference-frequency.patch new file mode 100644 index 00000000000..6ed73d09244 --- /dev/null +++ b/queue-6.6/cpufreq-schedutil-use-a-fixed-reference-frequency.patch @@ -0,0 +1,80 @@ +From 6dd7d8f215dbefd664a11f603c9c827c68d403fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 11:48:51 +0100 +Subject: cpufreq/schedutil: Use a fixed reference frequency + +From: Vincent Guittot + +[ Upstream commit b3edde44e5d4504c23a176819865cd603fd16d6c ] + +cpuinfo.max_freq can change at runtime because of boost as an example. This +implies that the value could be different than the one that has been +used when computing the capacity of a CPU. + +The new arch_scale_freq_ref() returns a fixed and coherent reference +frequency that can be used when computing a frequency based on utilization. + +Use this arch_scale_freq_ref() when available and fallback to +policy otherwise. + +Signed-off-by: Vincent Guittot +Signed-off-by: Ingo Molnar +Tested-by: Lukasz Luba +Reviewed-by: Lukasz Luba +Reviewed-by: Dietmar Eggemann +Acked-by: Rafael J. Wysocki +Acked-by: Viresh Kumar +Link: https://lore.kernel.org/r/20231211104855.558096-4-vincent.guittot@linaro.org +Signed-off-by: Sasha Levin +--- + kernel/sched/cpufreq_schedutil.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c +index 458d359f5991..7f6c9874a200 100644 +--- a/kernel/sched/cpufreq_schedutil.c ++++ b/kernel/sched/cpufreq_schedutil.c +@@ -114,6 +114,28 @@ static void sugov_deferred_update(struct sugov_policy *sg_policy) + } + } + ++/** ++ * get_capacity_ref_freq - get the reference frequency that has been used to ++ * correlate frequency and compute capacity for a given cpufreq policy. We use ++ * the CPU managing it for the arch_scale_freq_ref() call in the function. ++ * @policy: the cpufreq policy of the CPU in question. ++ * ++ * Return: the reference CPU frequency to compute a capacity. ++ */ ++static __always_inline ++unsigned long get_capacity_ref_freq(struct cpufreq_policy *policy) ++{ ++ unsigned int freq = arch_scale_freq_ref(policy->cpu); ++ ++ if (freq) ++ return freq; ++ ++ if (arch_scale_freq_invariant()) ++ return policy->cpuinfo.max_freq; ++ ++ return policy->cur; ++} ++ + /** + * get_next_freq - Compute a new frequency for a given cpufreq policy. + * @sg_policy: schedutil policy object to compute the new frequency for. +@@ -140,9 +162,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, + unsigned long util, unsigned long max) + { + struct cpufreq_policy *policy = sg_policy->policy; +- unsigned int freq = arch_scale_freq_invariant() ? +- policy->cpuinfo.max_freq : policy->cur; ++ unsigned int freq; + ++ freq = get_capacity_ref_freq(policy); + util = map_util_perf(util); + freq = map_util_freq(util, freq, max); + +-- +2.43.0 + diff --git a/queue-6.6/cpufreq-use-the-fixed-and-coherent-frequency-for-sca.patch b/queue-6.6/cpufreq-use-the-fixed-and-coherent-frequency-for-sca.patch new file mode 100644 index 00000000000..3ba103694a5 --- /dev/null +++ b/queue-6.6/cpufreq-use-the-fixed-and-coherent-frequency-for-sca.patch @@ -0,0 +1,68 @@ +From 0950167d5d273ea412602497ca5452d4752040d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 11:48:50 +0100 +Subject: cpufreq: Use the fixed and coherent frequency for scaling capacity + +From: Vincent Guittot + +[ Upstream commit 599457ba15403037b489fe536266a3d5f9efaed7 ] + +cpuinfo.max_freq can change at runtime because of boost as an example. This +implies that the value could be different from the frequency that has been +used to compute the capacity of a CPU. + +The new arch_scale_freq_ref() returns a fixed and coherent frequency +that can be used to compute the capacity for a given frequency. + +[ Also fix a arch_set_freq_scale() newline style wart in . ] + +Signed-off-by: Vincent Guittot +Signed-off-by: Ingo Molnar +Tested-by: Lukasz Luba +Reviewed-by: Lukasz Luba +Acked-by: Viresh Kumar +Acked-by: Rafael J. Wysocki +Link: https://lore.kernel.org/r/20231211104855.558096-3-vincent.guittot@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/cpufreq.c | 4 ++-- + include/linux/cpufreq.h | 1 + + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c +index 60ed89000e82..8c4f9c2f9c44 100644 +--- a/drivers/cpufreq/cpufreq.c ++++ b/drivers/cpufreq/cpufreq.c +@@ -454,7 +454,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, + + arch_set_freq_scale(policy->related_cpus, + policy->cur, +- policy->cpuinfo.max_freq); ++ arch_scale_freq_ref(policy->cpu)); + + spin_lock(&policy->transition_lock); + policy->transition_ongoing = false; +@@ -2174,7 +2174,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, + + policy->cur = freq; + arch_set_freq_scale(policy->related_cpus, freq, +- policy->cpuinfo.max_freq); ++ arch_scale_freq_ref(policy->cpu)); + cpufreq_stats_record_transition(policy, freq); + + if (trace_cpu_frequency_enabled()) { +diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h +index 71d186d6933a..738dcddf3cfe 100644 +--- a/include/linux/cpufreq.h ++++ b/include/linux/cpufreq.h +@@ -1211,6 +1211,7 @@ void arch_set_freq_scale(const struct cpumask *cpus, + { + } + #endif ++ + /* the following are really really optional */ + extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; + extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs; +-- +2.43.0 + diff --git a/queue-6.6/crypto-octeontx2-fix-cptvf-driver-cleanup.patch b/queue-6.6/crypto-octeontx2-fix-cptvf-driver-cleanup.patch new file mode 100644 index 00000000000..29968d8ab6e --- /dev/null +++ b/queue-6.6/crypto-octeontx2-fix-cptvf-driver-cleanup.patch @@ -0,0 +1,71 @@ +From a9f1f1f856cdce7fdcd1d3d7697f1fbd70814725 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 15:59:11 +0530 +Subject: crypto: octeontx2 - Fix cptvf driver cleanup + +From: Bharat Bhushan + +[ Upstream commit c480a421a4faf693c38e60b0fe6e554c9a3fee02 ] + +This patch fixes following cleanup issues: + - Missing instruction queue free on cleanup. This + will lead to memory leak. + - lfs->lfs_num is set to zero before cleanup, which + will lead to improper cleanup. + +Signed-off-by: Bharat Bhushan +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 6 ++++-- + drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 3 +++ + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptlf.c b/drivers/crypto/marvell/octeontx2/otx2_cptlf.c +index 6edd27ff8c4e..e4bd3f030cec 100644 +--- a/drivers/crypto/marvell/octeontx2/otx2_cptlf.c ++++ b/drivers/crypto/marvell/octeontx2/otx2_cptlf.c +@@ -419,8 +419,8 @@ int otx2_cptlf_init(struct otx2_cptlfs_info *lfs, u8 eng_grp_mask, int pri, + return 0; + + free_iq: +- otx2_cpt_free_instruction_queues(lfs); + cptlf_hw_cleanup(lfs); ++ otx2_cpt_free_instruction_queues(lfs); + detach_rsrcs: + otx2_cpt_detach_rsrcs_msg(lfs); + clear_lfs_num: +@@ -431,11 +431,13 @@ EXPORT_SYMBOL_NS_GPL(otx2_cptlf_init, CRYPTO_DEV_OCTEONTX2_CPT); + + void otx2_cptlf_shutdown(struct otx2_cptlfs_info *lfs) + { +- lfs->lfs_num = 0; + /* Cleanup LFs hardware side */ + cptlf_hw_cleanup(lfs); ++ /* Free instruction queues */ ++ otx2_cpt_free_instruction_queues(lfs); + /* Send request to detach LFs */ + otx2_cpt_detach_rsrcs_msg(lfs); ++ lfs->lfs_num = 0; + } + EXPORT_SYMBOL_NS_GPL(otx2_cptlf_shutdown, CRYPTO_DEV_OCTEONTX2_CPT); + +diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +index bac729c885f9..215a1b17b6ce 100644 +--- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c ++++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +@@ -249,8 +249,11 @@ static void cptvf_lf_shutdown(struct otx2_cptlfs_info *lfs) + otx2_cptlf_unregister_interrupts(lfs); + /* Cleanup LFs software side */ + lf_sw_cleanup(lfs); ++ /* Free instruction queues */ ++ otx2_cpt_free_instruction_queues(lfs); + /* Send request to detach LFs */ + otx2_cpt_detach_rsrcs_msg(lfs); ++ lfs->lfs_num = 0; + } + + static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf) +-- +2.43.0 + diff --git a/queue-6.6/crypto-p10-aes-gcm-avoid-wstringop-overflow-warnings.patch b/queue-6.6/crypto-p10-aes-gcm-avoid-wstringop-overflow-warnings.patch new file mode 100644 index 00000000000..70dd7291d45 --- /dev/null +++ b/queue-6.6/crypto-p10-aes-gcm-avoid-wstringop-overflow-warnings.patch @@ -0,0 +1,58 @@ +From 7fd2af17097ef4c2ae494811e9771c93cb98af6d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 12:52:44 -0600 +Subject: crypto: p10-aes-gcm - Avoid -Wstringop-overflow warnings + +From: Gustavo A. R. Silva + +[ Upstream commit aaa03fdb56c781db4a4831dd5d6ec8817918c726 ] + +The compiler doesn't know that `32` is an offset into the Hash table: + + 56 struct Hash_ctx { + 57 u8 H[16]; /* subkey */ + 58 u8 Htable[256]; /* Xi, Hash table(offset 32) */ + 59 }; + +So, it legitimately complains about a potential out-of-bounds issue +if `256 bytes` are accessed in `htable` (this implies going +`32 bytes` beyond the boundaries of `Htable`): + +arch/powerpc/crypto/aes-gcm-p10-glue.c: In function 'gcmp10_init': +arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: error: 'gcm_init_htable' accessing 256 bytes in a region of size 224 [-Werror=stringop-overflow=] + 120 | gcm_init_htable(hash->Htable+32, hash->H); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: note: referencing argument 1 of type 'unsigned char[256]' +arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: note: referencing argument 2 of type 'unsigned char[16]' +arch/powerpc/crypto/aes-gcm-p10-glue.c:40:17: note: in a call to function 'gcm_init_htable' + 40 | asmlinkage void gcm_init_htable(unsigned char htable[256], unsigned char Xi[16]); + | ^~~~~~~~~~~~~~~ + +Address this by avoiding specifying the size of `htable` in the function +prototype; and just for consistency, do the same for parameter `Xi`. + +Reported-by: Stephen Rothwell +Closes: https://lore.kernel.org/linux-next/20231121131903.68a37932@canb.auug.org.au/ +Signed-off-by: Gustavo A. R. Silva +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + arch/powerpc/crypto/aes-gcm-p10-glue.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/powerpc/crypto/aes-gcm-p10-glue.c b/arch/powerpc/crypto/aes-gcm-p10-glue.c +index 4b6e899895e7..f62ee54076c0 100644 +--- a/arch/powerpc/crypto/aes-gcm-p10-glue.c ++++ b/arch/powerpc/crypto/aes-gcm-p10-glue.c +@@ -37,7 +37,7 @@ asmlinkage void aes_p10_gcm_encrypt(u8 *in, u8 *out, size_t len, + void *rkey, u8 *iv, void *Xi); + asmlinkage void aes_p10_gcm_decrypt(u8 *in, u8 *out, size_t len, + void *rkey, u8 *iv, void *Xi); +-asmlinkage void gcm_init_htable(unsigned char htable[256], unsigned char Xi[16]); ++asmlinkage void gcm_init_htable(unsigned char htable[], unsigned char Xi[]); + asmlinkage void gcm_ghash_p10(unsigned char *Xi, unsigned char *Htable, + unsigned char *aad, unsigned int alen); + +-- +2.43.0 + diff --git a/queue-6.6/crypto-starfive-fix-dev_err_probe-return-error.patch b/queue-6.6/crypto-starfive-fix-dev_err_probe-return-error.patch new file mode 100644 index 00000000000..c615fb8512e --- /dev/null +++ b/queue-6.6/crypto-starfive-fix-dev_err_probe-return-error.patch @@ -0,0 +1,35 @@ +From 6114993a01da5616b7c4d05652f103253ca9da17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 11:04:13 +0800 +Subject: crypto: starfive - Fix dev_err_probe return error + +From: Jia Jie Ho + +[ Upstream commit 8517c34e87025b3f74f3c07813d493828f369598 ] + +Current dev_err_probe will return 0 instead of proper error code if +driver failed to get irq number. Fix the return code. + +Signed-off-by: Jia Jie Ho +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/starfive/jh7110-cryp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/crypto/starfive/jh7110-cryp.c b/drivers/crypto/starfive/jh7110-cryp.c +index 3a67ddc4d936..4f5b6818208d 100644 +--- a/drivers/crypto/starfive/jh7110-cryp.c ++++ b/drivers/crypto/starfive/jh7110-cryp.c +@@ -168,7 +168,7 @@ static int starfive_cryp_probe(struct platform_device *pdev) + ret = devm_request_irq(&pdev->dev, irq, starfive_cryp_irq, 0, pdev->name, + (void *)cryp); + if (ret) +- return dev_err_probe(&pdev->dev, irq, ++ return dev_err_probe(&pdev->dev, ret, + "Failed to register interrupt handler\n"); + + clk_prepare_enable(cryp->hclk); +-- +2.43.0 + diff --git a/queue-6.6/crypto-stm32-crc32-fix-parsing-list-of-devices.patch b/queue-6.6/crypto-stm32-crc32-fix-parsing-list-of-devices.patch new file mode 100644 index 00000000000..e91ea9d082e --- /dev/null +++ b/queue-6.6/crypto-stm32-crc32-fix-parsing-list-of-devices.patch @@ -0,0 +1,46 @@ +From 39d56c11130b91d8d273c18c39722a1f16531e3a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Dec 2023 12:17:24 +0100 +Subject: crypto: stm32/crc32 - fix parsing list of devices + +From: Thomas Bourgoin + +[ Upstream commit 0eaef675b94c746900dcea7f6c41b9a103ed5d53 ] + +smatch warnings: +drivers/crypto/stm32/stm32-crc32.c:108 stm32_crc_get_next_crc() warn: +can 'crc' even be NULL? + +Use list_first_entry_or_null instead of list_first_entry to retrieve +the first device registered. +The function list_first_entry always return a non NULL pointer even if +the list is empty. Hence checking if the pointer returned is NULL does +not tell if the list is empty or not. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/ +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/ +Signed-off-by: Thomas Bourgoin +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/stm32/stm32-crc32.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c +index 90a920e7f664..c439be1650c8 100644 +--- a/drivers/crypto/stm32/stm32-crc32.c ++++ b/drivers/crypto/stm32/stm32-crc32.c +@@ -104,7 +104,7 @@ static struct stm32_crc *stm32_crc_get_next_crc(void) + struct stm32_crc *crc; + + spin_lock_bh(&crc_list.lock); +- crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); ++ crc = list_first_entry_or_null(&crc_list.dev_list, struct stm32_crc, list); + if (crc) + list_move_tail(&crc->list, &crc_list.dev_list); + spin_unlock_bh(&crc_list.lock); +-- +2.43.0 + diff --git a/queue-6.6/debugobjects-stop-accessing-objects-after-releasing-.patch b/queue-6.6/debugobjects-stop-accessing-objects-after-releasing-.patch new file mode 100644 index 00000000000..75b29239847 --- /dev/null +++ b/queue-6.6/debugobjects-stop-accessing-objects-after-releasing-.patch @@ -0,0 +1,407 @@ +From 3b285f6ad3a908a89f0085fbbfba4ad5427b3c0f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Oct 2023 23:39:07 +0200 +Subject: debugobjects: Stop accessing objects after releasing hash bucket lock + +From: Andrzej Hajda + +[ Upstream commit 9bb6362652f3f4d74a87d572a91ee1b38e673ef6 ] + +After release of the hashbucket lock the tracking object can be modified or +freed by a concurrent thread. Using it in such a case is error prone, even +for printing the object state: + + 1. T1 tries to deactivate destroyed object, debugobjects detects it, + hash bucket lock is released. + + 2. T2 preempts T1 and frees the tracking object. + + 3. The freed tracking object is allocated and initialized for a + different to be tracked kernel object. + + 4. T1 resumes and reports error for wrong kernel object. + +Create a local copy of the tracking object before releasing the hash bucket +lock and use the local copy for reporting and fixups to prevent this. + +Signed-off-by: Andrzej Hajda +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/r/20231025-debugobjects_fix-v3-1-2bc3bf7084c2@intel.com +Signed-off-by: Sasha Levin +--- + lib/debugobjects.c | 200 ++++++++++++++++++--------------------------- + 1 file changed, 78 insertions(+), 122 deletions(-) + +diff --git a/lib/debugobjects.c b/lib/debugobjects.c +index a517256a270b..c90834a209b5 100644 +--- a/lib/debugobjects.c ++++ b/lib/debugobjects.c +@@ -620,9 +620,8 @@ static void debug_objects_fill_pool(void) + static void + __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) + { +- enum debug_obj_state state; ++ struct debug_obj *obj, o; + struct debug_bucket *db; +- struct debug_obj *obj; + unsigned long flags; + + debug_objects_fill_pool(); +@@ -643,24 +642,18 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack + case ODEBUG_STATE_INIT: + case ODEBUG_STATE_INACTIVE: + obj->state = ODEBUG_STATE_INIT; +- break; +- +- case ODEBUG_STATE_ACTIVE: +- state = obj->state; +- raw_spin_unlock_irqrestore(&db->lock, flags); +- debug_print_object(obj, "init"); +- debug_object_fixup(descr->fixup_init, addr, state); +- return; +- +- case ODEBUG_STATE_DESTROYED: + raw_spin_unlock_irqrestore(&db->lock, flags); +- debug_print_object(obj, "init"); + return; + default: + break; + } + ++ o = *obj; + raw_spin_unlock_irqrestore(&db->lock, flags); ++ debug_print_object(&o, "init"); ++ ++ if (o.state == ODEBUG_STATE_ACTIVE) ++ debug_object_fixup(descr->fixup_init, addr, o.state); + } + + /** +@@ -701,11 +694,9 @@ EXPORT_SYMBOL_GPL(debug_object_init_on_stack); + int debug_object_activate(void *addr, const struct debug_obj_descr *descr) + { + struct debug_obj o = { .object = addr, .state = ODEBUG_STATE_NOTAVAILABLE, .descr = descr }; +- enum debug_obj_state state; + struct debug_bucket *db; + struct debug_obj *obj; + unsigned long flags; +- int ret; + + if (!debug_objects_enabled) + return 0; +@@ -717,49 +708,38 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr) + raw_spin_lock_irqsave(&db->lock, flags); + + obj = lookup_object_or_alloc(addr, db, descr, false, true); +- if (likely(!IS_ERR_OR_NULL(obj))) { +- bool print_object = false; +- ++ if (unlikely(!obj)) { ++ raw_spin_unlock_irqrestore(&db->lock, flags); ++ debug_objects_oom(); ++ return 0; ++ } else if (likely(!IS_ERR(obj))) { + switch (obj->state) { +- case ODEBUG_STATE_INIT: +- case ODEBUG_STATE_INACTIVE: +- obj->state = ODEBUG_STATE_ACTIVE; +- ret = 0; +- break; +- + case ODEBUG_STATE_ACTIVE: +- state = obj->state; +- raw_spin_unlock_irqrestore(&db->lock, flags); +- debug_print_object(obj, "activate"); +- ret = debug_object_fixup(descr->fixup_activate, addr, state); +- return ret ? 0 : -EINVAL; +- + case ODEBUG_STATE_DESTROYED: +- print_object = true; +- ret = -EINVAL; ++ o = *obj; + break; ++ case ODEBUG_STATE_INIT: ++ case ODEBUG_STATE_INACTIVE: ++ obj->state = ODEBUG_STATE_ACTIVE; ++ fallthrough; + default: +- ret = 0; +- break; ++ raw_spin_unlock_irqrestore(&db->lock, flags); ++ return 0; + } +- raw_spin_unlock_irqrestore(&db->lock, flags); +- if (print_object) +- debug_print_object(obj, "activate"); +- return ret; + } + + raw_spin_unlock_irqrestore(&db->lock, flags); ++ debug_print_object(&o, "activate"); + +- /* If NULL the allocation has hit OOM */ +- if (!obj) { +- debug_objects_oom(); +- return 0; ++ switch (o.state) { ++ case ODEBUG_STATE_ACTIVE: ++ case ODEBUG_STATE_NOTAVAILABLE: ++ if (debug_object_fixup(descr->fixup_activate, addr, o.state)) ++ return 0; ++ fallthrough; ++ default: ++ return -EINVAL; + } +- +- /* Object is neither static nor tracked. It's not initialized */ +- debug_print_object(&o, "activate"); +- ret = debug_object_fixup(descr->fixup_activate, addr, ODEBUG_STATE_NOTAVAILABLE); +- return ret ? 0 : -EINVAL; + } + EXPORT_SYMBOL_GPL(debug_object_activate); + +@@ -770,10 +750,10 @@ EXPORT_SYMBOL_GPL(debug_object_activate); + */ + void debug_object_deactivate(void *addr, const struct debug_obj_descr *descr) + { ++ struct debug_obj o = { .object = addr, .state = ODEBUG_STATE_NOTAVAILABLE, .descr = descr }; + struct debug_bucket *db; + struct debug_obj *obj; + unsigned long flags; +- bool print_object = false; + + if (!debug_objects_enabled) + return; +@@ -785,33 +765,24 @@ void debug_object_deactivate(void *addr, const struct debug_obj_descr *descr) + obj = lookup_object(addr, db); + if (obj) { + switch (obj->state) { ++ case ODEBUG_STATE_DESTROYED: ++ break; + case ODEBUG_STATE_INIT: + case ODEBUG_STATE_INACTIVE: + case ODEBUG_STATE_ACTIVE: +- if (!obj->astate) +- obj->state = ODEBUG_STATE_INACTIVE; +- else +- print_object = true; +- break; +- +- case ODEBUG_STATE_DESTROYED: +- print_object = true; +- break; ++ if (obj->astate) ++ break; ++ obj->state = ODEBUG_STATE_INACTIVE; ++ fallthrough; + default: +- break; ++ raw_spin_unlock_irqrestore(&db->lock, flags); ++ return; + } ++ o = *obj; + } + + raw_spin_unlock_irqrestore(&db->lock, flags); +- if (!obj) { +- struct debug_obj o = { .object = addr, +- .state = ODEBUG_STATE_NOTAVAILABLE, +- .descr = descr }; +- +- debug_print_object(&o, "deactivate"); +- } else if (print_object) { +- debug_print_object(obj, "deactivate"); +- } ++ debug_print_object(&o, "deactivate"); + } + EXPORT_SYMBOL_GPL(debug_object_deactivate); + +@@ -822,11 +793,9 @@ EXPORT_SYMBOL_GPL(debug_object_deactivate); + */ + void debug_object_destroy(void *addr, const struct debug_obj_descr *descr) + { +- enum debug_obj_state state; ++ struct debug_obj *obj, o; + struct debug_bucket *db; +- struct debug_obj *obj; + unsigned long flags; +- bool print_object = false; + + if (!debug_objects_enabled) + return; +@@ -836,32 +805,31 @@ void debug_object_destroy(void *addr, const struct debug_obj_descr *descr) + raw_spin_lock_irqsave(&db->lock, flags); + + obj = lookup_object(addr, db); +- if (!obj) +- goto out_unlock; ++ if (!obj) { ++ raw_spin_unlock_irqrestore(&db->lock, flags); ++ return; ++ } + + switch (obj->state) { ++ case ODEBUG_STATE_ACTIVE: ++ case ODEBUG_STATE_DESTROYED: ++ break; + case ODEBUG_STATE_NONE: + case ODEBUG_STATE_INIT: + case ODEBUG_STATE_INACTIVE: + obj->state = ODEBUG_STATE_DESTROYED; +- break; +- case ODEBUG_STATE_ACTIVE: +- state = obj->state; ++ fallthrough; ++ default: + raw_spin_unlock_irqrestore(&db->lock, flags); +- debug_print_object(obj, "destroy"); +- debug_object_fixup(descr->fixup_destroy, addr, state); + return; +- +- case ODEBUG_STATE_DESTROYED: +- print_object = true; +- break; +- default: +- break; + } +-out_unlock: ++ ++ o = *obj; + raw_spin_unlock_irqrestore(&db->lock, flags); +- if (print_object) +- debug_print_object(obj, "destroy"); ++ debug_print_object(&o, "destroy"); ++ ++ if (o.state == ODEBUG_STATE_ACTIVE) ++ debug_object_fixup(descr->fixup_destroy, addr, o.state); + } + EXPORT_SYMBOL_GPL(debug_object_destroy); + +@@ -872,9 +840,8 @@ EXPORT_SYMBOL_GPL(debug_object_destroy); + */ + void debug_object_free(void *addr, const struct debug_obj_descr *descr) + { +- enum debug_obj_state state; ++ struct debug_obj *obj, o; + struct debug_bucket *db; +- struct debug_obj *obj; + unsigned long flags; + + if (!debug_objects_enabled) +@@ -885,24 +852,26 @@ void debug_object_free(void *addr, const struct debug_obj_descr *descr) + raw_spin_lock_irqsave(&db->lock, flags); + + obj = lookup_object(addr, db); +- if (!obj) +- goto out_unlock; ++ if (!obj) { ++ raw_spin_unlock_irqrestore(&db->lock, flags); ++ return; ++ } + + switch (obj->state) { + case ODEBUG_STATE_ACTIVE: +- state = obj->state; +- raw_spin_unlock_irqrestore(&db->lock, flags); +- debug_print_object(obj, "free"); +- debug_object_fixup(descr->fixup_free, addr, state); +- return; ++ break; + default: + hlist_del(&obj->node); + raw_spin_unlock_irqrestore(&db->lock, flags); + free_object(obj); + return; + } +-out_unlock: ++ ++ o = *obj; + raw_spin_unlock_irqrestore(&db->lock, flags); ++ debug_print_object(&o, "free"); ++ ++ debug_object_fixup(descr->fixup_free, addr, o.state); + } + EXPORT_SYMBOL_GPL(debug_object_free); + +@@ -954,10 +923,10 @@ void + debug_object_active_state(void *addr, const struct debug_obj_descr *descr, + unsigned int expect, unsigned int next) + { ++ struct debug_obj o = { .object = addr, .state = ODEBUG_STATE_NOTAVAILABLE, .descr = descr }; + struct debug_bucket *db; + struct debug_obj *obj; + unsigned long flags; +- bool print_object = false; + + if (!debug_objects_enabled) + return; +@@ -970,28 +939,19 @@ debug_object_active_state(void *addr, const struct debug_obj_descr *descr, + if (obj) { + switch (obj->state) { + case ODEBUG_STATE_ACTIVE: +- if (obj->astate == expect) +- obj->astate = next; +- else +- print_object = true; +- break; +- ++ if (obj->astate != expect) ++ break; ++ obj->astate = next; ++ raw_spin_unlock_irqrestore(&db->lock, flags); ++ return; + default: +- print_object = true; + break; + } ++ o = *obj; + } + + raw_spin_unlock_irqrestore(&db->lock, flags); +- if (!obj) { +- struct debug_obj o = { .object = addr, +- .state = ODEBUG_STATE_NOTAVAILABLE, +- .descr = descr }; +- +- debug_print_object(&o, "active_state"); +- } else if (print_object) { +- debug_print_object(obj, "active_state"); +- } ++ debug_print_object(&o, "active_state"); + } + EXPORT_SYMBOL_GPL(debug_object_active_state); + +@@ -999,12 +959,10 @@ EXPORT_SYMBOL_GPL(debug_object_active_state); + static void __debug_check_no_obj_freed(const void *address, unsigned long size) + { + unsigned long flags, oaddr, saddr, eaddr, paddr, chunks; +- const struct debug_obj_descr *descr; +- enum debug_obj_state state; ++ int cnt, objs_checked = 0; ++ struct debug_obj *obj, o; + struct debug_bucket *db; + struct hlist_node *tmp; +- struct debug_obj *obj; +- int cnt, objs_checked = 0; + + saddr = (unsigned long) address; + eaddr = saddr + size; +@@ -1026,12 +984,10 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size) + + switch (obj->state) { + case ODEBUG_STATE_ACTIVE: +- descr = obj->descr; +- state = obj->state; ++ o = *obj; + raw_spin_unlock_irqrestore(&db->lock, flags); +- debug_print_object(obj, "free"); +- debug_object_fixup(descr->fixup_free, +- (void *) oaddr, state); ++ debug_print_object(&o, "free"); ++ debug_object_fixup(o.descr->fixup_free, (void *)oaddr, o.state); + goto repeat; + default: + hlist_del(&obj->node); +-- +2.43.0 + diff --git a/queue-6.6/drivers-perf-pmuv3-don-t-expose-sw_incr-event-in-sys.patch b/queue-6.6/drivers-perf-pmuv3-don-t-expose-sw_incr-event-in-sys.patch new file mode 100644 index 00000000000..66e637d87ec --- /dev/null +++ b/queue-6.6/drivers-perf-pmuv3-don-t-expose-sw_incr-event-in-sys.patch @@ -0,0 +1,55 @@ +From 891353354b481af8b3075f9ae58a698070fc7842 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 11:58:47 +0000 +Subject: drivers/perf: pmuv3: don't expose SW_INCR event in sysfs + +From: Mark Rutland + +[ Upstream commit ca6f537e459e2da4b331fe8928d1a0b0f9301f42 ] + +The SW_INCR event is somewhat unusual, and depends on the specific HW +counter that it is programmed into. When programmed into PMEVCNTR, +SW_INCR will count any writes to PMSWINC_EL0 with bit n set, ignoring +writes to SW_INCR with bit n clear. + +Event rotation means that there's no fixed relationship between +perf_events and HW counters, so this isn't all that useful. + +Further, we program PMUSERENR.{SW,EN}=={0,0}, which causes EL0 writes to +PMSWINC_EL0 to be trapped and handled as UNDEFINED, resulting in a +SIGILL to userspace. + +Given that, it's not a good idea to expose SW_INCR in sysfs. Hide it as +we did for CHAIN back in commit: + + 4ba2578fa7b55701 ("arm64: perf: don't expose CHAIN event in sysfs") + +Signed-off-by: Mark Rutland +Cc: Will Deacon +Link: https://lore.kernel.org/r/20231204115847.2993026-1-mark.rutland@arm.com +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + drivers/perf/arm_pmuv3.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c +index d681638ec6b8..0e8f54168cb6 100644 +--- a/drivers/perf/arm_pmuv3.c ++++ b/drivers/perf/arm_pmuv3.c +@@ -169,7 +169,11 @@ armv8pmu_events_sysfs_show(struct device *dev, + PMU_EVENT_ATTR_ID(name, armv8pmu_events_sysfs_show, config) + + static struct attribute *armv8_pmuv3_event_attrs[] = { +- ARMV8_EVENT_ATTR(sw_incr, ARMV8_PMUV3_PERFCTR_SW_INCR), ++ /* ++ * Don't expose the sw_incr event in /sys. It's not usable as writes to ++ * PMSWINC_EL0 will trap as PMUSERENR.{SW,EN}=={0,0} and event rotation ++ * means we don't have a fixed event<->counter relationship regardless. ++ */ + ARMV8_EVENT_ATTR(l1i_cache_refill, ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL), + ARMV8_EVENT_ATTR(l1i_tlb_refill, ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL), + ARMV8_EVENT_ATTR(l1d_cache_refill, ARMV8_PMUV3_PERFCTR_L1D_CACHE_REFILL), +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-fix-minor-issues-in-bw-allocation-ph.patch b/queue-6.6/drm-amd-display-fix-minor-issues-in-bw-allocation-ph.patch new file mode 100644 index 00000000000..baa3a6f46d7 --- /dev/null +++ b/queue-6.6/drm-amd-display-fix-minor-issues-in-bw-allocation-ph.patch @@ -0,0 +1,461 @@ +From a510283521010ff90c86382b40627022147068ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 10:57:45 -0500 +Subject: drm/amd/display: Fix minor issues in BW Allocation Phase2 + +From: Meenakshikumar Somasundaram + +[ Upstream commit aa5dc05340eb97486a631ce6bccb8d020bf6b56b ] + +[Why] +Fix minor issues in BW Allocation Phase2. + +[How] +- In set_usb4_req_bw_req(), link->dpia_bw_alloc_config.response_ready + flag should be reset before writing DPCD REQUEST_BW. +- Fix the granularity for value of 2 in get_bw_granularity(). +- Removed bandwidth allocation support display fw boot option as + the fw would read feature enable status from bios. +- Clean up DPIA_EST_BW_CHANGED and DPIA_BW_REQ_SUCCESS cases in + dpia_handle_bw_alloc_response(). +- Removed allocate_usb4_bw and deallocate_usb4_bw. +- Optimized loop in get_lowest_dpia_index(). +- Updated link_dp_dpia_allocate_usb4_bandwidth_for_stream() and + set_usb4_req_bw_req() to always issue request bw. + +Tested-by: Daniel Wheeler +Reviewed-by: PeiChen Huang +Acked-by: Rodrigo Siqueira +Signed-off-by: Meenakshikumar Somasundaram +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../dc/link/protocols/link_dp_dpia_bw.c | 221 ++++++++---------- + .../dc/link/protocols/link_dp_dpia_bw.h | 4 +- + 2 files changed, 101 insertions(+), 124 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +index 7581023daa47..d6e1f969bfd5 100644 +--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c ++++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +@@ -50,6 +50,7 @@ static bool get_bw_alloc_proceed_flag(struct dc_link *tmp) + && tmp->hpd_status + && tmp->dpia_bw_alloc_config.bw_alloc_enabled); + } ++ + static void reset_bw_alloc_struct(struct dc_link *link) + { + link->dpia_bw_alloc_config.bw_alloc_enabled = false; +@@ -59,6 +60,11 @@ static void reset_bw_alloc_struct(struct dc_link *link) + link->dpia_bw_alloc_config.bw_granularity = 0; + link->dpia_bw_alloc_config.response_ready = false; + } ++ ++#define BW_GRANULARITY_0 4 // 0.25 Gbps ++#define BW_GRANULARITY_1 2 // 0.5 Gbps ++#define BW_GRANULARITY_2 1 // 1 Gbps ++ + static uint8_t get_bw_granularity(struct dc_link *link) + { + uint8_t bw_granularity = 0; +@@ -71,16 +77,20 @@ static uint8_t get_bw_granularity(struct dc_link *link) + + switch (bw_granularity & 0x3) { + case 0: +- bw_granularity = 4; ++ bw_granularity = BW_GRANULARITY_0; + break; + case 1: ++ bw_granularity = BW_GRANULARITY_1; ++ break; ++ case 2: + default: +- bw_granularity = 2; ++ bw_granularity = BW_GRANULARITY_2; + break; + } + + return bw_granularity; + } ++ + static int get_estimated_bw(struct dc_link *link) + { + uint8_t bw_estimated_bw = 0; +@@ -93,31 +103,7 @@ static int get_estimated_bw(struct dc_link *link) + + return bw_estimated_bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); + } +-static bool allocate_usb4_bw(int *stream_allocated_bw, int bw_needed, struct dc_link *link) +-{ +- if (bw_needed > 0) +- *stream_allocated_bw += bw_needed; +- +- return true; +-} +-static bool deallocate_usb4_bw(int *stream_allocated_bw, int bw_to_dealloc, struct dc_link *link) +-{ +- bool ret = false; +- +- if (*stream_allocated_bw > 0) { +- *stream_allocated_bw -= bw_to_dealloc; +- ret = true; +- } else { +- //Do nothing for now +- ret = true; +- } + +- // Unplug so reset values +- if (!link->hpd_status) +- reset_bw_alloc_struct(link); +- +- return ret; +-} + /* + * Read all New BW alloc configuration ex: estimated_bw, allocated_bw, + * granuality, Driver_ID, CM_Group, & populate the BW allocation structs +@@ -128,7 +114,12 @@ static void init_usb4_bw_struct(struct dc_link *link) + // Init the known values + link->dpia_bw_alloc_config.bw_granularity = get_bw_granularity(link); + link->dpia_bw_alloc_config.estimated_bw = get_estimated_bw(link); ++ ++ DC_LOG_DEBUG("%s: bw_granularity(%d), estimated_bw(%d)\n", ++ __func__, link->dpia_bw_alloc_config.bw_granularity, ++ link->dpia_bw_alloc_config.estimated_bw); + } ++ + static uint8_t get_lowest_dpia_index(struct dc_link *link) + { + const struct dc *dc_struct = link->dc; +@@ -141,12 +132,15 @@ static uint8_t get_lowest_dpia_index(struct dc_link *link) + dc_struct->links[i]->ep_type != DISPLAY_ENDPOINT_USB4_DPIA) + continue; + +- if (idx > dc_struct->links[i]->link_index) ++ if (idx > dc_struct->links[i]->link_index) { + idx = dc_struct->links[i]->link_index; ++ break; ++ } + } + + return idx; + } ++ + /* + * Get the Max Available BW or Max Estimated BW for each Host Router + * +@@ -186,6 +180,7 @@ static int get_host_router_total_bw(struct dc_link *link, uint8_t type) + + return total_bw; + } ++ + /* + * Cleanup function for when the dpia is unplugged to reset struct + * and perform any required clean up +@@ -194,42 +189,50 @@ static int get_host_router_total_bw(struct dc_link *link, uint8_t type) + * + * return: none + */ +-static bool dpia_bw_alloc_unplug(struct dc_link *link) ++static void dpia_bw_alloc_unplug(struct dc_link *link) + { +- if (!link) +- return true; +- +- return deallocate_usb4_bw(&link->dpia_bw_alloc_config.sink_allocated_bw, +- link->dpia_bw_alloc_config.sink_allocated_bw, link); ++ if (link) { ++ DC_LOG_DEBUG("%s: resetting bw alloc config for link(%d)\n", ++ __func__, link->link_index); ++ link->dpia_bw_alloc_config.sink_allocated_bw = 0; ++ reset_bw_alloc_struct(link); ++ } + } ++ + static void set_usb4_req_bw_req(struct dc_link *link, int req_bw) + { + uint8_t requested_bw; + uint32_t temp; + +- // 1. Add check for this corner case #1 +- if (req_bw > link->dpia_bw_alloc_config.estimated_bw) ++ /* Error check whether request bw greater than allocated */ ++ if (req_bw > link->dpia_bw_alloc_config.estimated_bw) { ++ DC_LOG_ERROR("%s: Request bw greater than estimated bw for link(%d)\n", ++ __func__, link->link_index); + req_bw = link->dpia_bw_alloc_config.estimated_bw; ++ } + + temp = req_bw * link->dpia_bw_alloc_config.bw_granularity; + requested_bw = temp / Kbps_TO_Gbps; + +- // Always make sure to add more to account for floating points ++ /* Always make sure to add more to account for floating points */ + if (temp % Kbps_TO_Gbps) + ++requested_bw; + +- // 2. Add check for this corner case #2 ++ /* Error check whether requested and allocated are equal */ + req_bw = requested_bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); +- if (req_bw == link->dpia_bw_alloc_config.sink_allocated_bw) +- return; ++ if (req_bw == link->dpia_bw_alloc_config.sink_allocated_bw) { ++ DC_LOG_ERROR("%s: Request bw equals to allocated bw for link(%d)\n", ++ __func__, link->link_index); ++ } + +- if (core_link_write_dpcd( ++ link->dpia_bw_alloc_config.response_ready = false; // Reset flag ++ core_link_write_dpcd( + link, + REQUESTED_BW, + &requested_bw, +- sizeof(uint8_t)) == DC_OK) +- link->dpia_bw_alloc_config.response_ready = false; // Reset flag ++ sizeof(uint8_t)); + } ++ + /* + * Return the response_ready flag from dc_link struct + * +@@ -241,6 +244,7 @@ static bool get_cm_response_ready_flag(struct dc_link *link) + { + return link->dpia_bw_alloc_config.response_ready; + } ++ + // ------------------------------------------------------------------ + // PUBLIC FUNCTIONS + // ------------------------------------------------------------------ +@@ -277,27 +281,27 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link) + DPTX_BW_ALLOCATION_MODE_CONTROL, + &response, + sizeof(uint8_t)) != DC_OK) { +- DC_LOG_DEBUG("%s: **** FAILURE Enabling DPtx BW Allocation Mode Support ***\n", +- __func__); ++ DC_LOG_DEBUG("%s: FAILURE Enabling DPtx BW Allocation Mode Support for link(%d)\n", ++ __func__, link->link_index); + } else { + // SUCCESS Enabled DPtx BW Allocation Mode Support +- link->dpia_bw_alloc_config.bw_alloc_enabled = true; +- DC_LOG_DEBUG("%s: **** SUCCESS Enabling DPtx BW Allocation Mode Support ***\n", +- __func__); ++ DC_LOG_DEBUG("%s: SUCCESS Enabling DPtx BW Allocation Mode Support for link(%d)\n", ++ __func__, link->link_index); + + ret = true; + init_usb4_bw_struct(link); ++ link->dpia_bw_alloc_config.bw_alloc_enabled = true; + } + } + + out: + return ret; + } ++ + void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result) + { + int bw_needed = 0; + int estimated = 0; +- int host_router_total_estimated_bw = 0; + + if (!get_bw_alloc_proceed_flag((link))) + return; +@@ -306,14 +310,22 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res + + case DPIA_BW_REQ_FAILED: + +- DC_LOG_DEBUG("%s: *** *** BW REQ FAILURE for DP-TX Request *** ***\n", __func__); ++ /* ++ * Ideally, we shouldn't run into this case as we always validate available ++ * bandwidth and request within that limit ++ */ ++ estimated = bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); + +- // Update the new Estimated BW value updated by CM +- link->dpia_bw_alloc_config.estimated_bw = +- bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); ++ DC_LOG_ERROR("%s: BW REQ FAILURE for DP-TX Request for link(%d)\n", ++ __func__, link->link_index); ++ DC_LOG_ERROR("%s: current estimated_bw(%d), new estimated_bw(%d)\n", ++ __func__, link->dpia_bw_alloc_config.estimated_bw, estimated); + ++ /* Update the new Estimated BW value updated by CM */ ++ link->dpia_bw_alloc_config.estimated_bw = estimated; ++ ++ /* Allocate the previously requested bandwidth */ + set_usb4_req_bw_req(link, link->dpia_bw_alloc_config.estimated_bw); +- link->dpia_bw_alloc_config.response_ready = false; + + /* + * If FAIL then it is either: +@@ -326,68 +338,34 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res + + case DPIA_BW_REQ_SUCCESS: + +- DC_LOG_DEBUG("%s: *** BW REQ SUCCESS for DP-TX Request ***\n", __func__); +- +- // 1. SUCCESS 1st time before any Pruning is done +- // 2. SUCCESS after prev. FAIL before any Pruning is done +- // 3. SUCCESS after Pruning is done but before enabling link +- + bw_needed = bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); + +- // 1. +- if (!link->dpia_bw_alloc_config.sink_allocated_bw) { +- +- allocate_usb4_bw(&link->dpia_bw_alloc_config.sink_allocated_bw, bw_needed, link); +- link->dpia_bw_alloc_config.sink_verified_bw = +- link->dpia_bw_alloc_config.sink_allocated_bw; ++ DC_LOG_DEBUG("%s: BW REQ SUCCESS for DP-TX Request for link(%d)\n", ++ __func__, link->link_index); ++ DC_LOG_DEBUG("%s: current allocated_bw(%d), new allocated_bw(%d)\n", ++ __func__, link->dpia_bw_alloc_config.sink_allocated_bw, bw_needed); + +- // SUCCESS from first attempt +- if (link->dpia_bw_alloc_config.sink_allocated_bw > +- link->dpia_bw_alloc_config.sink_max_bw) +- link->dpia_bw_alloc_config.sink_verified_bw = +- link->dpia_bw_alloc_config.sink_max_bw; +- } +- // 3. +- else if (link->dpia_bw_alloc_config.sink_allocated_bw) { +- +- // Find out how much do we need to de-alloc +- if (link->dpia_bw_alloc_config.sink_allocated_bw > bw_needed) +- deallocate_usb4_bw(&link->dpia_bw_alloc_config.sink_allocated_bw, +- link->dpia_bw_alloc_config.sink_allocated_bw - bw_needed, link); +- else +- allocate_usb4_bw(&link->dpia_bw_alloc_config.sink_allocated_bw, +- bw_needed - link->dpia_bw_alloc_config.sink_allocated_bw, link); +- } +- +- // 4. If this is the 2nd sink then any unused bw will be reallocated to master DPIA +- // => check if estimated_bw changed ++ link->dpia_bw_alloc_config.sink_allocated_bw = bw_needed; + + link->dpia_bw_alloc_config.response_ready = true; + break; + + case DPIA_EST_BW_CHANGED: + +- DC_LOG_DEBUG("%s: *** ESTIMATED BW CHANGED for DP-TX Request ***\n", __func__); +- + estimated = bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); +- host_router_total_estimated_bw = get_host_router_total_bw(link, HOST_ROUTER_BW_ESTIMATED); + +- // 1. If due to unplug of other sink +- if (estimated == host_router_total_estimated_bw) { +- // First update the estimated & max_bw fields +- if (link->dpia_bw_alloc_config.estimated_bw < estimated) +- link->dpia_bw_alloc_config.estimated_bw = estimated; +- } +- // 2. If due to realloc bw btw 2 dpia due to plug OR realloc unused Bw +- else { +- // We lost estimated bw usually due to plug event of other dpia +- link->dpia_bw_alloc_config.estimated_bw = estimated; +- } ++ DC_LOG_DEBUG("%s: ESTIMATED BW CHANGED for link(%d)\n", ++ __func__, link->link_index); ++ DC_LOG_DEBUG("%s: current estimated_bw(%d), new estimated_bw(%d)\n", ++ __func__, link->dpia_bw_alloc_config.estimated_bw, estimated); ++ ++ link->dpia_bw_alloc_config.estimated_bw = estimated; + break; + + case DPIA_BW_ALLOC_CAPS_CHANGED: + +- DC_LOG_DEBUG("%s: *** BW ALLOC CAPABILITY CHANGED for DP-TX Request ***\n", __func__); ++ DC_LOG_ERROR("%s: BW ALLOC CAPABILITY CHANGED to Disabled for link(%d)\n", ++ __func__, link->link_index); + link->dpia_bw_alloc_config.bw_alloc_enabled = false; + break; + } +@@ -409,11 +387,11 @@ int dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *link, int pea + set_usb4_req_bw_req(link, link->dpia_bw_alloc_config.sink_max_bw); + + do { +- if (!(timeout > 0)) ++ if (timeout > 0) + timeout--; + else + break; +- fsleep(10 * 1000); ++ msleep(10); + } while (!get_cm_response_ready_flag(link)); + + if (!timeout) +@@ -428,37 +406,36 @@ int dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *link, int pea + out: + return ret; + } +-int link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw) ++ ++bool link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw) + { +- int ret = 0; ++ bool ret = false; + uint8_t timeout = 10; + ++ DC_LOG_DEBUG("%s: ENTER: link(%d), hpd_status(%d), current allocated_bw(%d), req_bw(%d)\n", ++ __func__, link->link_index, link->hpd_status, ++ link->dpia_bw_alloc_config.sink_allocated_bw, req_bw); ++ + if (!get_bw_alloc_proceed_flag(link)) + goto out; + +- /* +- * Sometimes stream uses same timing parameters as the already +- * allocated max sink bw so no need to re-alloc +- */ +- if (req_bw != link->dpia_bw_alloc_config.sink_allocated_bw) { +- set_usb4_req_bw_req(link, req_bw); +- do { +- if (!(timeout > 0)) +- timeout--; +- else +- break; +- udelay(10 * 1000); +- } while (!get_cm_response_ready_flag(link)); ++ set_usb4_req_bw_req(link, req_bw); ++ do { ++ if (timeout > 0) ++ timeout--; ++ else ++ break; ++ msleep(10); ++ } while (!get_cm_response_ready_flag(link)); + +- if (!timeout) +- ret = 0;// ERROR TIMEOUT waiting for response for allocating bw +- else if (link->dpia_bw_alloc_config.sink_allocated_bw > 0) +- ret = get_host_router_total_bw(link, HOST_ROUTER_BW_ALLOCATED); +- } ++ if (timeout) ++ ret = true; + + out: ++ DC_LOG_DEBUG("%s: EXIT: timeout(%d), ret(%d)\n", __func__, timeout, ret); + return ret; + } ++ + bool dpia_validate_usb4_bw(struct dc_link **link, int *bw_needed_per_dpia, const unsigned int num_dpias) + { + bool ret = true; +diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h +index 7292690383ae..981bc4eb6120 100644 +--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h ++++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h +@@ -59,9 +59,9 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link); + * @link: pointer to the dc_link struct instance + * @req_bw: Bw requested by the stream + * +- * return: allocated bw else return 0 ++ * return: true if allocated successfully + */ +-int link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw); ++bool link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw); + + /* + * Handle the USB4 BW Allocation related functionality here: +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-fix-mst-pbn-x.y-value-calculations.patch b/queue-6.6/drm-amd-display-fix-mst-pbn-x.y-value-calculations.patch new file mode 100644 index 00000000000..77dc7f2cb41 --- /dev/null +++ b/queue-6.6/drm-amd-display-fix-mst-pbn-x.y-value-calculations.patch @@ -0,0 +1,57 @@ +From d7cf4cb189693982c9e4e448f6f8ff95bd16653e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Dec 2023 06:25:06 -0700 +Subject: drm/amd/display: Fix MST PBN/X.Y value calculations + +From: Ilya Bakoulin + +[ Upstream commit 94bbf802efd0a8f13147d6664af6e653637340a8 ] + +Changing PBN calculation to be more in line with spec. We don't need to +inflate PBN_NATIVE value by the 1.006 margin, since that is already +taken care of in the get_pbn_per_slot function. + +Tested-by: Daniel Wheeler +Reviewed-by: Wenjing Liu +Acked-by: Rodrigo Siqueira +Signed-off-by: Ilya Bakoulin +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c +index a96f0747628c..b9768cd9b8a0 100644 +--- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c ++++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c +@@ -1059,18 +1059,21 @@ static struct fixed31_32 get_pbn_from_bw_in_kbps(uint64_t kbps) + uint32_t denominator = 1; + + /* +- * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 ++ * The 1.006 factor (margin 5300ppm + 300ppm ~ 0.6% as per spec) is not ++ * required when determining PBN/time slot utilization on the link between ++ * us and the branch, since that overhead is already accounted for in ++ * the get_pbn_per_slot function. ++ * + * The unit of 54/64Mbytes/sec is an arbitrary unit chosen based on + * common multiplier to render an integer PBN for all link rate/lane + * counts combinations + * calculate +- * peak_kbps *= (1006/1000) + * peak_kbps *= (64/54) +- * peak_kbps *= 8 convert to bytes ++ * peak_kbps /= (8 * 1000) convert to bytes + */ + +- numerator = 64 * PEAK_FACTOR_X1000; +- denominator = 54 * 8 * 1000 * 1000; ++ numerator = 64; ++ denominator = 54 * 8 * 1000; + kbps *= numerator; + peak_kbps = dc_fixpt_from_fraction(kbps, denominator); + +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-fix-tiled-display-misalignment.patch b/queue-6.6/drm-amd-display-fix-tiled-display-misalignment.patch new file mode 100644 index 00000000000..961530454b2 --- /dev/null +++ b/queue-6.6/drm-amd-display-fix-tiled-display-misalignment.patch @@ -0,0 +1,43 @@ +From ba37fcbb80b7ea4c978997406634ce6f27069153 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Nov 2023 00:04:36 -0500 +Subject: drm/amd/display: Fix tiled display misalignment + +From: Meenakshikumar Somasundaram + +[ Upstream commit c4b8394e76adba4f50a3c2696c75b214a291e24a ] + +[Why] +When otg workaround is applied during clock update, otgs of +tiled display went out of sync. + +[How] +To call dc_trigger_sync() after clock update to sync otgs again. + +Reviewed-by: Nicholas Kazlauskas +Acked-by: Hamza Mahfooz +Signed-off-by: Meenakshikumar Somasundaram +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c +index 8cdf380bf366..46b10ff8f6d4 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c +@@ -1948,6 +1948,10 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c + wait_for_no_pipes_pending(dc, context); + /* pplib is notified if disp_num changed */ + dc->hwss.optimize_bandwidth(dc, context); ++ /* Need to do otg sync again as otg could be out of sync due to otg ++ * workaround applied during clock update ++ */ ++ dc_trigger_sync(dc, context); + } + + if (dc->hwss.update_dsc_pg) +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-fixing-stream-allocation-regression.patch b/queue-6.6/drm-amd-display-fixing-stream-allocation-regression.patch new file mode 100644 index 00000000000..f3d9b88efab --- /dev/null +++ b/queue-6.6/drm-amd-display-fixing-stream-allocation-regression.patch @@ -0,0 +1,42 @@ +From 491727afae5d6db2703829582ca96cc88dfe5d98 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Dec 2023 18:15:16 -0500 +Subject: drm/amd/display: Fixing stream allocation regression + +From: Relja Vojvodic + +[ Upstream commit 292c2116b2ae84c7e799ae340981e60551b18f5e ] + +For certain dual display configs that had one display using a 1080p +mode, the DPM level used to drive the configs regressed from DPM 0 to +DPM 3. This was caused by a missing check that should have only limited +the pipe segments on non-phantom pipes. This caused issues with detile +buffer allocation, which dissallow subvp from being used + +Tested-by: Daniel Wheeler +Reviewed-by: Dillon Varone +Reviewed-by: Martin Leung +Acked-by: Rodrigo Siqueira +Signed-off-by: Relja Vojvodic +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +index 3ad2b48954e0..03bd05596d21 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +@@ -190,7 +190,7 @@ bool dcn32_subvp_in_use(struct dc *dc, + for (i = 0; i < dc->res_pool->pipe_count; i++) { + struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; + +- if (pipe->stream && pipe->stream->mall_stream_config.type != SUBVP_NONE) ++ if (pipe->stream && pipe->stream->mall_stream_config.type != SUBVP_PHANTOM != SUBVP_NONE) + return true; + } + return false; +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-for-prefetch-mode-0-extend-prefetch-.patch b/queue-6.6/drm-amd-display-for-prefetch-mode-0-extend-prefetch-.patch new file mode 100644 index 00000000000..73f1d84ccd7 --- /dev/null +++ b/queue-6.6/drm-amd-display-for-prefetch-mode-0-extend-prefetch-.patch @@ -0,0 +1,124 @@ +From b647a308d3f35a692f8d2032e9cb0b0d31d671d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 14:52:31 -0500 +Subject: drm/amd/display: For prefetch mode > 0, extend prefetch if possible + +From: Alvin Lee + +[ Upstream commit dd4e4bb28843393065eed279e869fac248d03f0f ] + +[Description] +For mode programming we want to extend the prefetch as much as possible +(up to oto, or as long as we can for equ) if we're not already applying +the 60us prefetch requirement. This is to avoid intermittent underflow +issues during prefetch. + +The prefetch extension is applied under the following scenarios: +1. We're in prefetch mode 1 (i.e. we don't support MCLK switch in blank) +2. We're using subvp or drr methods of p-state switch, in which case we + we don't care if prefetch takes up more of the blanking time + +Mode programming typically chooses the smallest prefetch time possible +(i.e. highest bandwidth during prefetch) presumably to create margin between +p-states / c-states that happen in vblank and prefetch. Therefore we only +apply this prefetch extension when p-state in vblank is not required (UCLK +p-states take up the most vblank time). + +Reviewed-by: Jun Lei +Acked-by: Aurabindo Pillai +Signed-off-by: Alvin Lee +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../dc/dml/dcn32/display_mode_vba_32.c | 3 ++ + .../dc/dml/dcn32/display_mode_vba_util_32.c | 33 +++++++++++++++---- + .../dc/dml/dcn32/display_mode_vba_util_32.h | 1 + + 3 files changed, 31 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +index cbdfb762c10c..6c84b0fa40f4 100644 +--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c ++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +@@ -813,6 +813,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman + (v->DRAMSpeedPerState[mode_lib->vba.VoltageLevel] <= MEM_STROBE_FREQ_MHZ || + v->DCFCLKPerState[mode_lib->vba.VoltageLevel] <= DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ) ? + mode_lib->vba.ip.min_prefetch_in_strobe_us : 0, ++ mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] > 0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false, ++ + /* Output */ + &v->DSTXAfterScaler[k], + &v->DSTYAfterScaler[k], +@@ -3317,6 +3319,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l + v->SwathHeightCThisState[k], v->TWait, + (v->DRAMSpeedPerState[i] <= MEM_STROBE_FREQ_MHZ || v->DCFCLKState[i][j] <= DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ) ? + mode_lib->vba.ip.min_prefetch_in_strobe_us : 0, ++ mode_lib->vba.PrefetchModePerState[i][j] > 0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false, + + /* Output */ + &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k], +diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c +index ecea008f19d3..208b89d13d3f 100644 +--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c ++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c +@@ -3423,6 +3423,7 @@ bool dml32_CalculatePrefetchSchedule( + unsigned int SwathHeightC, + double TWait, + double TPreReq, ++ bool ExtendPrefetchIfPossible, + /* Output */ + double *DSTXAfterScaler, + double *DSTYAfterScaler, +@@ -3892,12 +3893,32 @@ bool dml32_CalculatePrefetchSchedule( + /* Clamp to oto for bandwidth calculation */ + LinesForPrefetchBandwidth = dst_y_prefetch_oto; + } else { +- *DestinationLinesForPrefetch = dst_y_prefetch_equ; +- TimeForFetchingMetaPTE = Tvm_equ; +- TimeForFetchingRowInVBlank = Tr0_equ; +- *PrefetchBandwidth = prefetch_bw_equ; +- /* Clamp to equ for bandwidth calculation */ +- LinesForPrefetchBandwidth = dst_y_prefetch_equ; ++ /* For mode programming we want to extend the prefetch as much as possible ++ * (up to oto, or as long as we can for equ) if we're not already applying ++ * the 60us prefetch requirement. This is to avoid intermittent underflow ++ * issues during prefetch. ++ * ++ * The prefetch extension is applied under the following scenarios: ++ * 1. We're in prefetch mode > 0 (i.e. we don't support MCLK switch in blank) ++ * 2. We're using subvp or drr methods of p-state switch, in which case we ++ * we don't care if prefetch takes up more of the blanking time ++ * ++ * Mode programming typically chooses the smallest prefetch time possible ++ * (i.e. highest bandwidth during prefetch) presumably to create margin between ++ * p-states / c-states that happen in vblank and prefetch. Therefore we only ++ * apply this prefetch extension when p-state in vblank is not required (UCLK ++ * p-states take up the most vblank time). ++ */ ++ if (ExtendPrefetchIfPossible && TPreReq == 0 && VStartup < MaxVStartup) { ++ MyError = true; ++ } else { ++ *DestinationLinesForPrefetch = dst_y_prefetch_equ; ++ TimeForFetchingMetaPTE = Tvm_equ; ++ TimeForFetchingRowInVBlank = Tr0_equ; ++ *PrefetchBandwidth = prefetch_bw_equ; ++ /* Clamp to equ for bandwidth calculation */ ++ LinesForPrefetchBandwidth = dst_y_prefetch_equ; ++ } + } + + *DestinationLinesToRequestVMInVBlank = dml_ceil(4.0 * TimeForFetchingMetaPTE / LineTime, 1.0) / 4.0; +diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h +index 592d174df6c6..5d34735df83d 100644 +--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h ++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h +@@ -747,6 +747,7 @@ bool dml32_CalculatePrefetchSchedule( + unsigned int SwathHeightC, + double TWait, + double TPreReq, ++ bool ExtendPrefetchIfPossible, + /* Output */ + double *DSTXAfterScaler, + double *DSTYAfterScaler, +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-force-p-state-disallow-if-leaving-no.patch b/queue-6.6/drm-amd-display-force-p-state-disallow-if-leaving-no.patch new file mode 100644 index 00000000000..a752e35ee2d --- /dev/null +++ b/queue-6.6/drm-amd-display-force-p-state-disallow-if-leaving-no.patch @@ -0,0 +1,76 @@ +From bfffec04fe5e2c9ff3fbeb6185285b8f4e2fc778 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 14:52:32 -0500 +Subject: drm/amd/display: Force p-state disallow if leaving no plane config + +From: Alvin Lee + +[ Upstream commit 9a902a9073c287353e25913c0761bfed49d75a88 ] + +[Description] +- When we're in a no plane config, DCN is always asserting + P-State allow +- This creates a scenario where the P-State blackout can start + just as VUPDATE takes place and transitions the DCN config to + a one where one or more HUBP's are active which can result in + underflow +- To fix this issue, force p-state disallow and unforce after + the transition from no planes case -> one or more planes active + +Reviewed-by: Samson Tam +Acked-by: Aurabindo Pillai +Signed-off-by: Alvin Lee +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 20 +++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +index a2e1ca3b93e8..2c4bcbca8bb8 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +@@ -1792,6 +1792,8 @@ void dcn20_program_front_end_for_ctx( + int i; + struct dce_hwseq *hws = dc->hwseq; + DC_LOGGER_INIT(dc->ctx->logger); ++ unsigned int prev_hubp_count = 0; ++ unsigned int hubp_count = 0; + + /* Carry over GSL groups in case the context is changing. */ + for (i = 0; i < dc->res_pool->pipe_count; i++) { +@@ -1815,6 +1817,20 @@ void dcn20_program_front_end_for_ctx( + } + } + ++ for (i = 0; i < dc->res_pool->pipe_count; i++) { ++ if (dc->current_state->res_ctx.pipe_ctx[i].plane_state) ++ prev_hubp_count++; ++ if (context->res_ctx.pipe_ctx[i].plane_state) ++ hubp_count++; ++ } ++ ++ if (prev_hubp_count == 0 && hubp_count > 0) { ++ if (dc->res_pool->hubbub->funcs->force_pstate_change_control) ++ dc->res_pool->hubbub->funcs->force_pstate_change_control( ++ dc->res_pool->hubbub, true, false); ++ udelay(500); ++ } ++ + /* Set pipe update flags and lock pipes */ + for (i = 0; i < dc->res_pool->pipe_count; i++) + dcn20_detect_pipe_changes(&dc->current_state->res_ctx.pipe_ctx[i], +@@ -1962,6 +1978,10 @@ void dcn20_post_unlock_program_front_end( + } + } + ++ if (dc->res_pool->hubbub->funcs->force_pstate_change_control) ++ dc->res_pool->hubbub->funcs->force_pstate_change_control( ++ dc->res_pool->hubbub, false, false); ++ + for (i = 0; i < dc->res_pool->pipe_count; i++) { + struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; + +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-make-flip_timestamp_in_us-a-64-bit-v.patch b/queue-6.6/drm-amd-display-make-flip_timestamp_in_us-a-64-bit-v.patch new file mode 100644 index 00000000000..2c7146733e7 --- /dev/null +++ b/queue-6.6/drm-amd-display-make-flip_timestamp_in_us-a-64-bit-v.patch @@ -0,0 +1,43 @@ +From e946202eee54c5bbf81cff824fe81e2d6cbb7bef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 12:01:05 -0500 +Subject: drm/amd/display: make flip_timestamp_in_us a 64-bit variable + +From: Josip Pavic + +[ Upstream commit 6fb12518ca58412dc51054e2a7400afb41328d85 ] + +[Why] +This variable currently overflows after about 71 minutes. This doesn't +cause any known functional issues but it does make debugging more +difficult. + +[How] +Make it a 64-bit variable. + +Reviewed-by: Aric Cyr +Acked-by: Wayne Lin +Signed-off-by: Josip Pavic +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dc_hw_types.h b/drivers/gpu/drm/amd/display/dc/dc_hw_types.h +index 99880b08cda0..00de342e5290 100644 +--- a/drivers/gpu/drm/amd/display/dc/dc_hw_types.h ++++ b/drivers/gpu/drm/amd/display/dc/dc_hw_types.h +@@ -244,7 +244,7 @@ enum pixel_format { + #define DC_MAX_DIRTY_RECTS 3 + struct dc_flip_addrs { + struct dc_plane_address address; +- unsigned int flip_timestamp_in_us; ++ unsigned long long flip_timestamp_in_us; + bool flip_immediate; + /* TODO: add flip duration for FreeSync */ + bool triplebuffer_flips; +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-display-only-clear-symclk-otg-flag-for-hdmi.patch b/queue-6.6/drm-amd-display-only-clear-symclk-otg-flag-for-hdmi.patch new file mode 100644 index 00000000000..5221e48ef29 --- /dev/null +++ b/queue-6.6/drm-amd-display-only-clear-symclk-otg-flag-for-hdmi.patch @@ -0,0 +1,94 @@ +From e9f6abae14477ecc3733e8b45a42112a19ea630e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Dec 2023 11:56:56 -0500 +Subject: drm/amd/display: Only clear symclk otg flag for HDMI + +From: Alvin Lee + +[ Upstream commit dff45f03f508c92cd8eb2050e27b726726b8ae0b ] + +[Description] +There is a corner case where the symclk otg flag is cleared +when disabling the phantom pipe for subvp (because the phantom +and main pipe share the same link). This is undesired because +we need the maintain the correct symclk otg flag state for +the main pipe. + +For now only clear the flag only for HDMI signal type, since +it's only set for HDMI signal type (phantom is virtual). The +ideal solution is to not clear it if the stream is phantom but +currently there's a bug that doesn't allow us to do this. Once +this issue is fixed the proper fix can be implemented. + +Reviewed-by: Samson Tam +Acked-by: Wayne Lin +Signed-off-by: Alvin Lee +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 3 ++- + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 ++- + drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 ++- + drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c | 3 ++- + 4 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +index 7fbbad69064f..251dd800a2a6 100644 +--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c ++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +@@ -2124,7 +2124,8 @@ static void dce110_reset_hw_ctx_wrap( + BREAK_TO_DEBUGGER(); + } + pipe_ctx_old->stream_res.tg->funcs->disable_crtc(pipe_ctx_old->stream_res.tg); +- pipe_ctx_old->stream->link->phy_state.symclk_ref_cnts.otg = 0; ++ if (dc_is_hdmi_tmds_signal(pipe_ctx_old->stream->signal)) ++ pipe_ctx_old->stream->link->phy_state.symclk_ref_cnts.otg = 0; + pipe_ctx_old->plane_res.mi->funcs->free_mem_input( + pipe_ctx_old->plane_res.mi, dc->current_state->stream_count); + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +index 13ccb57379c7..db1d7be7fda3 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +@@ -1054,7 +1054,8 @@ static void dcn10_reset_back_end_for_pipe( + if (pipe_ctx->stream_res.tg->funcs->set_drr) + pipe_ctx->stream_res.tg->funcs->set_drr( + pipe_ctx->stream_res.tg, NULL); +- pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg = 0; ++ if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal)) ++ pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg = 0; + } + + for (i = 0; i < dc->res_pool->pipe_count; i++) +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +index 2c4bcbca8bb8..1e3803739ae6 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +@@ -2533,7 +2533,8 @@ static void dcn20_reset_back_end_for_pipe( + * the case where the same symclk is shared across multiple otg + * instances + */ +- link->phy_state.symclk_ref_cnts.otg = 0; ++ if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal)) ++ link->phy_state.symclk_ref_cnts.otg = 0; + if (link->phy_state.symclk_state == SYMCLK_ON_TX_OFF) { + link_hwss->disable_link_output(link, + &pipe_ctx->link_res, pipe_ctx->stream->signal); +diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +index 2a7f47642a44..22da2007601e 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +@@ -523,7 +523,8 @@ static void dcn31_reset_back_end_for_pipe( + if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass) + pipe_ctx->stream_res.tg->funcs->set_odm_bypass( + pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); +- pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg = 0; ++ if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal)) ++ pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg = 0; + + if (pipe_ctx->stream_res.tg->funcs->set_drr) + pipe_ctx->stream_res.tg->funcs->set_drr( +-- +2.43.0 + diff --git a/queue-6.6/drm-amd-powerplay-fix-kzalloc-parameter-atom_tonga_p.patch b/queue-6.6/drm-amd-powerplay-fix-kzalloc-parameter-atom_tonga_p.patch new file mode 100644 index 00000000000..a27a5f3ddbd --- /dev/null +++ b/queue-6.6/drm-amd-powerplay-fix-kzalloc-parameter-atom_tonga_p.patch @@ -0,0 +1,47 @@ +From 0ed2253abd7d0c318e4e30f25763c2e49cffc9f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Jan 2024 12:05:09 +0530 +Subject: drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in + 'get_platform_power_management_table()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit 6616b5e1999146b1304abe78232af810080c67e3 ] + +In 'struct phm_ppm_table *ptr' allocation using kzalloc, an incorrect +structure type is passed to sizeof() in kzalloc, larger structure types +were used, thus using correct type 'struct phm_ppm_table' fixes the +below: + +drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/process_pptables_v1_0.c:203 get_platform_power_management_table() warn: struct type mismatch 'phm_ppm_table vs _ATOM_Tonga_PPM_Table' + +Cc: Eric Huang +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c +index f2a55c1413f5..17882f8dfdd3 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c +@@ -200,7 +200,7 @@ static int get_platform_power_management_table( + struct pp_hwmgr *hwmgr, + ATOM_Tonga_PPM_Table *atom_ppm_table) + { +- struct phm_ppm_table *ptr = kzalloc(sizeof(ATOM_Tonga_PPM_Table), GFP_KERNEL); ++ struct phm_ppm_table *ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); + struct phm_ppt_v1_information *pp_table_information = + (struct phm_ppt_v1_information *)(hwmgr->pptable); + +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-apply-the-rv2-system-aperture-fix-to-rn-c.patch b/queue-6.6/drm-amdgpu-apply-the-rv2-system-aperture-fix-to-rn-c.patch new file mode 100644 index 00000000000..8c3ce91635c --- /dev/null +++ b/queue-6.6/drm-amdgpu-apply-the-rv2-system-aperture-fix-to-rn-c.patch @@ -0,0 +1,97 @@ +From 935b4545a8cc15448a6c4563543fd1d7f06d9382 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jan 2024 11:55:53 -0500 +Subject: drm/amdgpu: apply the RV2 system aperture fix to RN/CZN as well + +From: Alex Deucher + +[ Upstream commit 16783d8ef08448815e149e40c82fc1e1fc41ddbf ] + +These chips needs the same fix. This was previously not seen +on then since the AGP aperture expanded the system aperture, +but this showed up again when AGP was disabled. + +Reviewed-and-tested-by: Jiadong Zhu +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 4 +++- + drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 4 +++- + drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 +++- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++++-- + 4 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +index cdc290a474a9..66c6bab75f8a 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +@@ -102,7 +102,9 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev) + WREG32_SOC15_RLC(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, + min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18); + +- if (adev->apu_flags & AMD_APU_IS_RAVEN2) ++ if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | ++ AMD_APU_IS_RENOIR | ++ AMD_APU_IS_GREEN_SARDINE)) + /* + * Raven2 has a HW issue that it is unable to use the + * vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. +diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +index 0834af771549..b50f24f7ea5c 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +@@ -139,7 +139,9 @@ gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev, + WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_SYSTEM_APERTURE_LOW_ADDR, + min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18); + +- if (adev->apu_flags & AMD_APU_IS_RAVEN2) ++ if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | ++ AMD_APU_IS_RENOIR | ++ AMD_APU_IS_GREEN_SARDINE)) + /* + * Raven2 has a HW issue that it is unable to use the + * vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. +diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +index fb91b31056ca..d25f87fb1971 100644 +--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +@@ -96,7 +96,9 @@ static void mmhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev) + WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, + min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18); + +- if (adev->apu_flags & AMD_APU_IS_RAVEN2) ++ if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | ++ AMD_APU_IS_RENOIR | ++ AMD_APU_IS_GREEN_SARDINE)) + /* + * Raven2 has a HW issue that it is unable to use the vram which + * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index fabbfea33b0c..56a61ac2b3f5 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -1247,7 +1247,9 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_ + /* AGP aperture is disabled */ + if (agp_bot == agp_top) { + logical_addr_low = adev->gmc.fb_start >> 18; +- if (adev->apu_flags & AMD_APU_IS_RAVEN2) ++ if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | ++ AMD_APU_IS_RENOIR | ++ AMD_APU_IS_GREEN_SARDINE)) + /* + * Raven2 has a HW issue that it is unable to use the vram which + * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the +@@ -1259,7 +1261,9 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_ + logical_addr_high = adev->gmc.fb_end >> 18; + } else { + logical_addr_low = min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18; +- if (adev->apu_flags & AMD_APU_IS_RAVEN2) ++ if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | ++ AMD_APU_IS_RENOIR | ++ AMD_APU_IS_GREEN_SARDINE)) + /* + * Raven2 has a HW issue that it is unable to use the vram which + * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-drop-fence-check-in-to_amdgpu_amdkfd_fenc.patch b/queue-6.6/drm-amdgpu-drop-fence-check-in-to_amdgpu_amdkfd_fenc.patch new file mode 100644 index 00000000000..47721764b06 --- /dev/null +++ b/queue-6.6/drm-amdgpu-drop-fence-check-in-to_amdgpu_amdkfd_fenc.patch @@ -0,0 +1,45 @@ +From aff43adc701473ce0bde738ed33e4cd8ed726b59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Dec 2023 12:54:44 +0530 +Subject: drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit bf2ad4fb8adca89374b54b225d494e0b1956dbea ] + +Return value of container_of(...) can't be null, so null check is not +required for 'fence'. Hence drop its NULL check. + +Fixes the below: +drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c:93 to_amdgpu_amdkfd_fence() warn: can 'fence' even be NULL? + +Cc: Felix Kuehling +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c +index 469785d33791..1ef758ac5076 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c +@@ -90,7 +90,7 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f) + return NULL; + + fence = container_of(f, struct amdgpu_amdkfd_fence, base); +- if (fence && f->ops == &amdkfd_fence_ops) ++ if (f->ops == &amdkfd_fence_ops) + return fence; + + return NULL; +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-fix-avg-vs-input-power-reporting-on-smu7.patch b/queue-6.6/drm-amdgpu-fix-avg-vs-input-power-reporting-on-smu7.patch new file mode 100644 index 00000000000..7af12300514 --- /dev/null +++ b/queue-6.6/drm-amdgpu-fix-avg-vs-input-power-reporting-on-smu7.patch @@ -0,0 +1,57 @@ +From d8e624b9c236a9bb423429adc39754d5f2cf1d24 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 14:27:13 -0400 +Subject: drm/amdgpu: fix avg vs input power reporting on smu7 + +From: Alex Deucher + +[ Upstream commit 25852d4b97572ff62ffee574cb8bb4bc551af23a ] + +Hawaii, Bonaire, Fiji, and Tonga support average power, the others +support current power. + +Reviewed-by: Yang Wang +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +index b1a8799e2dee..aa91730e4eaf 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +@@ -3999,6 +3999,7 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, + uint32_t sclk, mclk, activity_percent; + uint32_t offset, val_vid; + struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); ++ struct amdgpu_device *adev = hwmgr->adev; + + /* size must be at least 4 bytes for all sensors */ + if (*size < 4) +@@ -4042,7 +4043,21 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, + *size = 4; + return 0; + case AMDGPU_PP_SENSOR_GPU_INPUT_POWER: +- return smu7_get_gpu_power(hwmgr, (uint32_t *)value); ++ if ((adev->asic_type != CHIP_HAWAII) && ++ (adev->asic_type != CHIP_BONAIRE) && ++ (adev->asic_type != CHIP_FIJI) && ++ (adev->asic_type != CHIP_TONGA)) ++ return smu7_get_gpu_power(hwmgr, (uint32_t *)value); ++ else ++ return -EOPNOTSUPP; ++ case AMDGPU_PP_SENSOR_GPU_AVG_POWER: ++ if ((adev->asic_type != CHIP_HAWAII) && ++ (adev->asic_type != CHIP_BONAIRE) && ++ (adev->asic_type != CHIP_FIJI) && ++ (adev->asic_type != CHIP_TONGA)) ++ return -EOPNOTSUPP; ++ else ++ return smu7_get_gpu_power(hwmgr, (uint32_t *)value); + case AMDGPU_PP_SENSOR_VDDGFX: + if ((data->vr_config & VRCONF_VDDGFX_MASK) == + (VR_SVI2_PLANE_2 << VRCONF_VDDGFX_SHIFT)) +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-fix-ecc-irq-enable-disable-unpaired.patch b/queue-6.6/drm-amdgpu-fix-ecc-irq-enable-disable-unpaired.patch new file mode 100644 index 00000000000..f1710d4d500 --- /dev/null +++ b/queue-6.6/drm-amdgpu-fix-ecc-irq-enable-disable-unpaired.patch @@ -0,0 +1,124 @@ +From 65f9d25a975ff1eac1def17c7517f3e2c475e204 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Dec 2023 16:13:23 +0800 +Subject: drm/amdgpu: Fix ecc irq enable/disable unpaired + +From: Stanley.Yang + +[ Upstream commit a32c6f7f5737cc7e31cd7ad5133f0d96fca12ea6 ] + +The ecc_irq is disabled while GPU mode2 reset suspending process, +but not be enabled during GPU mode2 reset resume process. + +Changed from V1: + only do sdma/gfx ras_late_init in aldebaran_mode2_restore_ip + delete amdgpu_ras_late_resume function + +Changed from V2: + check umc ras supported before put ecc_irq + +Signed-off-by: Stanley.Yang +Reviewed-by: Tao Zhou +Reviewed-by: Hawking Zhang +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/aldebaran.c | 26 +++++++++++++++++++++++++- + drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 ++++ + drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 5 +++++ + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++++ + 4 files changed, 38 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/aldebaran.c b/drivers/gpu/drm/amd/amdgpu/aldebaran.c +index 2b97b8a96fb4..fa6193535d48 100644 +--- a/drivers/gpu/drm/amd/amdgpu/aldebaran.c ++++ b/drivers/gpu/drm/amd/amdgpu/aldebaran.c +@@ -333,6 +333,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, + { + struct list_head *reset_device_list = reset_context->reset_device_list; + struct amdgpu_device *tmp_adev = NULL; ++ struct amdgpu_ras *con; + int r; + + if (reset_device_list == NULL) +@@ -358,7 +359,30 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, + */ + amdgpu_register_gpu_instance(tmp_adev); + +- /* Resume RAS */ ++ /* Resume RAS, ecc_irq */ ++ con = amdgpu_ras_get_context(tmp_adev); ++ if (!amdgpu_sriov_vf(tmp_adev) && con) { ++ if (tmp_adev->sdma.ras && ++ tmp_adev->sdma.ras->ras_block.ras_late_init) { ++ r = tmp_adev->sdma.ras->ras_block.ras_late_init(tmp_adev, ++ &tmp_adev->sdma.ras->ras_block.ras_comm); ++ if (r) { ++ dev_err(tmp_adev->dev, "SDMA failed to execute ras_late_init! ret:%d\n", r); ++ goto end; ++ } ++ } ++ ++ if (tmp_adev->gfx.ras && ++ tmp_adev->gfx.ras->ras_block.ras_late_init) { ++ r = tmp_adev->gfx.ras->ras_block.ras_late_init(tmp_adev, ++ &tmp_adev->gfx.ras->ras_block.ras_comm); ++ if (r) { ++ dev_err(tmp_adev->dev, "GFX failed to execute ras_late_init! ret:%d\n", r); ++ goto end; ++ } ++ } ++ } ++ + amdgpu_ras_resume(tmp_adev); + + /* Update PSP FW topology after reset */ +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +index fa87a85e1017..62ecf4d89cb9 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +@@ -1141,6 +1141,10 @@ static int gmc_v10_0_hw_fini(void *handle) + + amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); + ++ if (adev->gmc.ecc_irq.funcs && ++ amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC)) ++ amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0); ++ + return 0; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +index e3b76fd28d15..3d797a1adef3 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +@@ -974,6 +974,11 @@ static int gmc_v11_0_hw_fini(void *handle) + } + + amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); ++ ++ if (adev->gmc.ecc_irq.funcs && ++ amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC)) ++ amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0); ++ + gmc_v11_0_gart_disable(adev); + + return 0; +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +index 89550d3df68d..f9f43742e9ce 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +@@ -2413,6 +2413,10 @@ static int gmc_v9_0_hw_fini(void *handle) + + amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); + ++ if (adev->gmc.ecc_irq.funcs && ++ amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC)) ++ amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0); ++ + return 0; + } + +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-fix-ftrace-event-amdgpu_bo_move-always-mo.patch b/queue-6.6/drm-amdgpu-fix-ftrace-event-amdgpu_bo_move-always-mo.patch new file mode 100644 index 00000000000..9861e3aa305 --- /dev/null +++ b/queue-6.6/drm-amdgpu-fix-ftrace-event-amdgpu_bo_move-always-mo.patch @@ -0,0 +1,114 @@ +From 0af945366638cc03f88b502d92a6a1610428a125 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 21:03:04 +0800 +Subject: drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Wang, Beyond + +[ Upstream commit 94aeb4117343d072e3a35b9595bcbfc0058ee724 ] + +Issue: during evict or validate happened on amdgpu_bo, the 'from' and +'to' is always same in ftrace event of amdgpu_bo_move + +where calling the 'trace_amdgpu_bo_move', the comment says move_notify +is called before move happens, but actually it is called after move +happens, here the new_mem is same as bo->resource + +Fix: move trace_amdgpu_bo_move from move_notify to amdgpu_bo_move + +Signed-off-by: Wang, Beyond +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +------------ + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 4 +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++-- + 3 files changed, 5 insertions(+), 17 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +index ace837cfa0a6..173b43a5aa13 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +@@ -1250,19 +1250,15 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, + * amdgpu_bo_move_notify - notification about a memory move + * @bo: pointer to a buffer object + * @evict: if this move is evicting the buffer from the graphics address space +- * @new_mem: new information of the bufer object + * + * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs + * bookkeeping. + * TTM driver callback which is called when ttm moves a buffer. + */ +-void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, +- bool evict, +- struct ttm_resource *new_mem) ++void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) + { + struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); + struct amdgpu_bo *abo; +- struct ttm_resource *old_mem = bo->resource; + + if (!amdgpu_bo_is_amdgpu_bo(bo)) + return; +@@ -1279,13 +1275,6 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, + /* remember the eviction */ + if (evict) + atomic64_inc(&adev->num_evictions); +- +- /* update statistics */ +- if (!new_mem) +- return; +- +- /* move_notify is called before move happens */ +- trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type); + } + + void amdgpu_bo_get_memory(struct amdgpu_bo *bo, +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +index d28e21baef16..a3ea8a82db23 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +@@ -344,9 +344,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, + int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, + size_t buffer_size, uint32_t *metadata_size, + uint64_t *flags); +-void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, +- bool evict, +- struct ttm_resource *new_mem); ++void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict); + void amdgpu_bo_release_notify(struct ttm_buffer_object *bo); + vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo); + void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence, +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +index 4e51dce3aab5..f573909332c0 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +@@ -545,10 +545,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, + return r; + } + ++ trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type); + out: + /* update statistics */ + atomic64_add(bo->base.size, &adev->num_bytes_moved); +- amdgpu_bo_move_notify(bo, evict, new_mem); ++ amdgpu_bo_move_notify(bo, evict); + return 0; + } + +@@ -1555,7 +1556,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, + static void + amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo) + { +- amdgpu_bo_move_notify(bo, false, NULL); ++ amdgpu_bo_move_notify(bo, false); + } + + static struct ttm_device_funcs amdgpu_bo_driver = { +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-fix-fw-from-request_firmware-not-released.patch b/queue-6.6/drm-amdgpu-fix-fw-from-request_firmware-not-released.patch new file mode 100644 index 00000000000..54d63a2532c --- /dev/null +++ b/queue-6.6/drm-amdgpu-fix-fw-from-request_firmware-not-released.patch @@ -0,0 +1,50 @@ +From 3638485997b1dfba748b25d2c53cee151062aaa6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jan 2024 22:22:44 +0530 +Subject: drm/amdgpu: Fix '*fw' from request_firmware() not released in + 'amdgpu_ucode_request()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit 13a1851f923d9a7a78a477497295c2dfd16ad4a4 ] + +Fixes the below: +drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:1404 amdgpu_ucode_request() warn: '*fw' from request_firmware() not released on lines: 1404. + +Cc: Mario Limonciello +Cc: Lijo Lazar +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +index 8beefc045e14..bef754177064 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +@@ -1326,9 +1326,13 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, + + if (err) + return -ENODEV; ++ + err = amdgpu_ucode_validate(*fw); +- if (err) ++ if (err) { + dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name); ++ release_firmware(*fw); ++ *fw = NULL; ++ } + + return err; + } +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-fix-with-right-return-code-eio-in-amdgpu_.patch b/queue-6.6/drm-amdgpu-fix-with-right-return-code-eio-in-amdgpu_.patch new file mode 100644 index 00000000000..65a5076724c --- /dev/null +++ b/queue-6.6/drm-amdgpu-fix-with-right-return-code-eio-in-amdgpu_.patch @@ -0,0 +1,79 @@ +From 14288ed6960b72a978ffabb7a298219203e46bfd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Jan 2024 15:26:42 +0530 +Subject: drm/amdgpu: Fix with right return code '-EIO' in + 'amdgpu_gmc_vram_checking()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit fac4ebd79fed60e79cccafdad45a2bb8d3795044 ] + +The amdgpu_gmc_vram_checking() function in emulation checks whether +all of the memory range of shared system memory could be accessed by +GPU, from this aspect, -EIO is returned for error scenarios. + +Fixes the below: +drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c:919 gmc_v6_0_hw_init() warn: missing error code? 'r' +drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c:1103 gmc_v7_0_hw_init() warn: missing error code? 'r' +drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c:1223 gmc_v8_0_hw_init() warn: missing error code? 'r' +drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:2344 gmc_v9_0_hw_init() warn: missing error code? 'r' + +Cc: Xiaojian Du +Cc: Lijo Lazar +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Suggested-by: Christian König +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +index d78bd9732543..bc0eda1a729c 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +@@ -876,21 +876,28 @@ int amdgpu_gmc_vram_checking(struct amdgpu_device *adev) + * seconds, so here, we just pick up three parts for emulation. + */ + ret = memcmp(vram_ptr, cptr, 10); +- if (ret) +- return ret; ++ if (ret) { ++ ret = -EIO; ++ goto release_buffer; ++ } + + ret = memcmp(vram_ptr + (size / 2), cptr, 10); +- if (ret) +- return ret; ++ if (ret) { ++ ret = -EIO; ++ goto release_buffer; ++ } + + ret = memcmp(vram_ptr + size - 10, cptr, 10); +- if (ret) +- return ret; ++ if (ret) { ++ ret = -EIO; ++ goto release_buffer; ++ } + ++release_buffer: + amdgpu_bo_free_kernel(&vram_bo, &vram_gpu, + &vram_ptr); + +- return 0; ++ return ret; + } + + static ssize_t current_memory_partition_show( +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-let-kfd-sync-with-vm-fences.patch b/queue-6.6/drm-amdgpu-let-kfd-sync-with-vm-fences.patch new file mode 100644 index 00000000000..f1919a0584a --- /dev/null +++ b/queue-6.6/drm-amdgpu-let-kfd-sync-with-vm-fences.patch @@ -0,0 +1,42 @@ +From 1daae06397fd5c970e1f63859e697755b75d72f7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Dec 2023 16:17:23 -0500 +Subject: drm/amdgpu: Let KFD sync with VM fences +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Felix Kuehling + +[ Upstream commit ec9ba4821fa52b5efdbc4cdf0a77497990655231 ] + +Change the rules for amdgpu_sync_resv to let KFD synchronize with VM +fences on page table reservations. This fixes intermittent memory +corruption after evictions when using amdgpu_vm_handle_moved to update +page tables for VM mappings managed through render nodes. + +Signed-off-by: Felix Kuehling +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +index dcd8c066bc1f..1b013a44ca99 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +@@ -191,7 +191,8 @@ static bool amdgpu_sync_test_fence(struct amdgpu_device *adev, + + /* Never sync to VM updates either. */ + if (fence_owner == AMDGPU_FENCE_OWNER_VM && +- owner != AMDGPU_FENCE_OWNER_UNDEFINED) ++ owner != AMDGPU_FENCE_OWNER_UNDEFINED && ++ owner != AMDGPU_FENCE_OWNER_KFD) + return false; + + /* Ignore fences depending on the sync mode */ +-- +2.43.0 + diff --git a/queue-6.6/drm-amdgpu-release-adev-pm.fw-before-return-in-amdgp.patch b/queue-6.6/drm-amdgpu-release-adev-pm.fw-before-return-in-amdgp.patch new file mode 100644 index 00000000000..314da3f4902 --- /dev/null +++ b/queue-6.6/drm-amdgpu-release-adev-pm.fw-before-return-in-amdgp.patch @@ -0,0 +1,48 @@ +From ea5514d5e16715f2081f000c7c9e71006132609a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Dec 2023 18:13:11 +0530 +Subject: drm/amdgpu: Release 'adev->pm.fw' before return in + 'amdgpu_device_need_post()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit 8a44fdd3cf91debbd09b43bd2519ad2b2486ccf4 ] + +In function 'amdgpu_device_need_post(struct amdgpu_device *adev)' - +'adev->pm.fw' may not be released before return. + +Using the function release_firmware() to release adev->pm.fw. + +Thus fixing the below: +drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1571 amdgpu_device_need_post() warn: 'adev->pm.fw' from request_firmware() not released on lines: 1554. + +Cc: Monk Liu +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Suggested-by: Lijo Lazar +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index 56d99ffbba2e..7791367e7c02 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -1218,6 +1218,7 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) + return true; + + fw_ver = *((uint32_t *)adev->pm.fw->data + 69); ++ release_firmware(adev->pm.fw); + if (fw_ver < 0x00160e00) + return true; + } +-- +2.43.0 + diff --git a/queue-6.6/drm-amdkfd-fix-iterator-used-outside-loop-in-kfd_add.patch b/queue-6.6/drm-amdkfd-fix-iterator-used-outside-loop-in-kfd_add.patch new file mode 100644 index 00000000000..dbea8cf85bf --- /dev/null +++ b/queue-6.6/drm-amdkfd-fix-iterator-used-outside-loop-in-kfd_add.patch @@ -0,0 +1,64 @@ +From 71ab7c431245734c1ddb1c5a70c5a820685867a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Dec 2023 15:07:09 +0530 +Subject: drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit b1a428b45dc7e47c7acc2ad0d08d8a6dda910c4c ] + +Fix the following about iterator use: +drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1456 kfd_add_peer_prop() warn: iterator used outside loop: 'iolink3' + +Cc: Felix Kuehling +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 24 ++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +index 6e75e8fa18be..61157fddc15c 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +@@ -1452,17 +1452,19 @@ static int kfd_add_peer_prop(struct kfd_topology_device *kdev, + /* CPU->CPU link*/ + cpu_dev = kfd_topology_device_by_proximity_domain(iolink1->node_to); + if (cpu_dev) { +- list_for_each_entry(iolink3, &cpu_dev->io_link_props, list) +- if (iolink3->node_to == iolink2->node_to) +- break; +- +- props->weight += iolink3->weight; +- props->min_latency += iolink3->min_latency; +- props->max_latency += iolink3->max_latency; +- props->min_bandwidth = min(props->min_bandwidth, +- iolink3->min_bandwidth); +- props->max_bandwidth = min(props->max_bandwidth, +- iolink3->max_bandwidth); ++ list_for_each_entry(iolink3, &cpu_dev->io_link_props, list) { ++ if (iolink3->node_to != iolink2->node_to) ++ continue; ++ ++ props->weight += iolink3->weight; ++ props->min_latency += iolink3->min_latency; ++ props->max_latency += iolink3->max_latency; ++ props->min_bandwidth = min(props->min_bandwidth, ++ iolink3->min_bandwidth); ++ props->max_bandwidth = min(props->max_bandwidth, ++ iolink3->max_bandwidth); ++ break; ++ } + } else { + WARN(1, "CPU node not found"); + } +-- +2.43.0 + diff --git a/queue-6.6/drm-amdkfd-fix-lock-dependency-warning-with-srcu.patch b/queue-6.6/drm-amdkfd-fix-lock-dependency-warning-with-srcu.patch new file mode 100644 index 00000000000..52ce36dadb8 --- /dev/null +++ b/queue-6.6/drm-amdkfd-fix-lock-dependency-warning-with-srcu.patch @@ -0,0 +1,103 @@ +From bd07bcb2946d8a01e3d500693764a6fa8754f410 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Dec 2023 15:19:25 -0500 +Subject: drm/amdkfd: Fix lock dependency warning with srcu + +From: Philip Yang + +[ Upstream commit 2a9de42e8d3c82c6990d226198602be44f43f340 ] + +====================================================== +WARNING: possible circular locking dependency detected +6.5.0-kfd-yangp #2289 Not tainted +------------------------------------------------------ +kworker/0:2/996 is trying to acquire lock: + (srcu){.+.+}-{0:0}, at: __synchronize_srcu+0x5/0x1a0 + +but task is already holding lock: + ((work_completion)(&svms->deferred_list_work)){+.+.}-{0:0}, at: + process_one_work+0x211/0x560 + +which lock already depends on the new lock. + +the existing dependency chain (in reverse order) is: + +-> #3 ((work_completion)(&svms->deferred_list_work)){+.+.}-{0:0}: + __flush_work+0x88/0x4f0 + svm_range_list_lock_and_flush_work+0x3d/0x110 [amdgpu] + svm_range_set_attr+0xd6/0x14c0 [amdgpu] + kfd_ioctl+0x1d1/0x630 [amdgpu] + __x64_sys_ioctl+0x88/0xc0 + +-> #2 (&info->lock#2){+.+.}-{3:3}: + __mutex_lock+0x99/0xc70 + amdgpu_amdkfd_gpuvm_restore_process_bos+0x54/0x740 [amdgpu] + restore_process_helper+0x22/0x80 [amdgpu] + restore_process_worker+0x2d/0xa0 [amdgpu] + process_one_work+0x29b/0x560 + worker_thread+0x3d/0x3d0 + +-> #1 ((work_completion)(&(&process->restore_work)->work)){+.+.}-{0:0}: + __flush_work+0x88/0x4f0 + __cancel_work_timer+0x12c/0x1c0 + kfd_process_notifier_release_internal+0x37/0x1f0 [amdgpu] + __mmu_notifier_release+0xad/0x240 + exit_mmap+0x6a/0x3a0 + mmput+0x6a/0x120 + do_exit+0x322/0xb90 + do_group_exit+0x37/0xa0 + __x64_sys_exit_group+0x18/0x20 + do_syscall_64+0x38/0x80 + +-> #0 (srcu){.+.+}-{0:0}: + __lock_acquire+0x1521/0x2510 + lock_sync+0x5f/0x90 + __synchronize_srcu+0x4f/0x1a0 + __mmu_notifier_release+0x128/0x240 + exit_mmap+0x6a/0x3a0 + mmput+0x6a/0x120 + svm_range_deferred_list_work+0x19f/0x350 [amdgpu] + process_one_work+0x29b/0x560 + worker_thread+0x3d/0x3d0 + +other info that might help us debug this: +Chain exists of: + srcu --> &info->lock#2 --> (work_completion)(&svms->deferred_list_work) + +Possible unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock((work_completion)(&svms->deferred_list_work)); + lock(&info->lock#2); + lock((work_completion)(&svms->deferred_list_work)); + sync(srcu); + +Signed-off-by: Philip Yang +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +index a4c911fa1675..b51224a85a38 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +@@ -2343,8 +2343,10 @@ static void svm_range_deferred_list_work(struct work_struct *work) + mutex_unlock(&svms->lock); + mmap_write_unlock(mm); + +- /* Pairs with mmget in svm_range_add_list_work */ +- mmput(mm); ++ /* Pairs with mmget in svm_range_add_list_work. If dropping the ++ * last mm refcount, schedule release work to avoid circular locking ++ */ ++ mmput_async(mm); + + spin_lock(&svms->deferred_list_lock); + } +-- +2.43.0 + diff --git a/queue-6.6/drm-amdkfd-fix-lock-dependency-warning.patch b/queue-6.6/drm-amdkfd-fix-lock-dependency-warning.patch new file mode 100644 index 00000000000..5fc12558076 --- /dev/null +++ b/queue-6.6/drm-amdkfd-fix-lock-dependency-warning.patch @@ -0,0 +1,145 @@ +From 1be4c8b4f95cd2a8bae8b93a37f3919d24aa58b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jan 2024 15:07:44 -0500 +Subject: drm/amdkfd: Fix lock dependency warning + +From: Felix Kuehling + +[ Upstream commit 47bf0f83fc86df1bf42b385a91aadb910137c5c9 ] + +====================================================== +WARNING: possible circular locking dependency detected +6.5.0-kfd-fkuehlin #276 Not tainted +------------------------------------------------------ +kworker/8:2/2676 is trying to acquire lock: +ffff9435aae95c88 ((work_completion)(&svm_bo->eviction_work)){+.+.}-{0:0}, at: __flush_work+0x52/0x550 + +but task is already holding lock: +ffff9435cd8e1720 (&svms->lock){+.+.}-{3:3}, at: svm_range_deferred_list_work+0xe8/0x340 [amdgpu] + +which lock already depends on the new lock. + +the existing dependency chain (in reverse order) is: + +-> #2 (&svms->lock){+.+.}-{3:3}: + __mutex_lock+0x97/0xd30 + kfd_ioctl_alloc_memory_of_gpu+0x6d/0x3c0 [amdgpu] + kfd_ioctl+0x1b2/0x5d0 [amdgpu] + __x64_sys_ioctl+0x86/0xc0 + do_syscall_64+0x39/0x80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd + +-> #1 (&mm->mmap_lock){++++}-{3:3}: + down_read+0x42/0x160 + svm_range_evict_svm_bo_worker+0x8b/0x340 [amdgpu] + process_one_work+0x27a/0x540 + worker_thread+0x53/0x3e0 + kthread+0xeb/0x120 + ret_from_fork+0x31/0x50 + ret_from_fork_asm+0x11/0x20 + +-> #0 ((work_completion)(&svm_bo->eviction_work)){+.+.}-{0:0}: + __lock_acquire+0x1426/0x2200 + lock_acquire+0xc1/0x2b0 + __flush_work+0x80/0x550 + __cancel_work_timer+0x109/0x190 + svm_range_bo_release+0xdc/0x1c0 [amdgpu] + svm_range_free+0x175/0x180 [amdgpu] + svm_range_deferred_list_work+0x15d/0x340 [amdgpu] + process_one_work+0x27a/0x540 + worker_thread+0x53/0x3e0 + kthread+0xeb/0x120 + ret_from_fork+0x31/0x50 + ret_from_fork_asm+0x11/0x20 + +other info that might help us debug this: + +Chain exists of: + (work_completion)(&svm_bo->eviction_work) --> &mm->mmap_lock --> &svms->lock + + Possible unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock(&svms->lock); + lock(&mm->mmap_lock); + lock(&svms->lock); + lock((work_completion)(&svm_bo->eviction_work)); + +I believe this cannot really lead to a deadlock in practice, because +svm_range_evict_svm_bo_worker only takes the mmap_read_lock if the BO +refcount is non-0. That means it's impossible that svm_range_bo_release +is running concurrently. However, there is no good way to annotate this. + +To avoid the problem, take a BO reference in +svm_range_schedule_evict_svm_bo instead of in the worker. That way it's +impossible for a BO to get freed while eviction work is pending and the +cancel_work_sync call in svm_range_bo_release can be eliminated. + +v2: Use svm_bo_ref_unless_zero and explained why that's safe. Also +removed redundant checks that are already done in +amdkfd_fence_enable_signaling. + +Signed-off-by: Felix Kuehling +Reviewed-by: Philip Yang +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 26 ++++++++++---------------- + 1 file changed, 10 insertions(+), 16 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +index 8e368e4659fd..a4c911fa1675 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +@@ -391,14 +391,9 @@ static void svm_range_bo_release(struct kref *kref) + spin_lock(&svm_bo->list_lock); + } + spin_unlock(&svm_bo->list_lock); +- if (!dma_fence_is_signaled(&svm_bo->eviction_fence->base)) { +- /* We're not in the eviction worker. +- * Signal the fence and synchronize with any +- * pending eviction work. +- */ ++ if (!dma_fence_is_signaled(&svm_bo->eviction_fence->base)) ++ /* We're not in the eviction worker. Signal the fence. */ + dma_fence_signal(&svm_bo->eviction_fence->base); +- cancel_work_sync(&svm_bo->eviction_work); +- } + dma_fence_put(&svm_bo->eviction_fence->base); + amdgpu_bo_unref(&svm_bo->bo); + kfree(svm_bo); +@@ -3424,13 +3419,14 @@ svm_range_trigger_migration(struct mm_struct *mm, struct svm_range *prange, + + int svm_range_schedule_evict_svm_bo(struct amdgpu_amdkfd_fence *fence) + { +- if (!fence) +- return -EINVAL; +- +- if (dma_fence_is_signaled(&fence->base)) +- return 0; +- +- if (fence->svm_bo) { ++ /* Dereferencing fence->svm_bo is safe here because the fence hasn't ++ * signaled yet and we're under the protection of the fence->lock. ++ * After the fence is signaled in svm_range_bo_release, we cannot get ++ * here any more. ++ * ++ * Reference is dropped in svm_range_evict_svm_bo_worker. ++ */ ++ if (svm_bo_ref_unless_zero(fence->svm_bo)) { + WRITE_ONCE(fence->svm_bo->evicting, 1); + schedule_work(&fence->svm_bo->eviction_work); + } +@@ -3445,8 +3441,6 @@ static void svm_range_evict_svm_bo_worker(struct work_struct *work) + int r = 0; + + svm_bo = container_of(work, struct svm_range_bo, eviction_work); +- if (!svm_bo_ref_unless_zero(svm_bo)) +- return; /* svm_bo was freed while eviction was pending */ + + if (mmget_not_zero(svm_bo->eviction_fence->mm)) { + mm = svm_bo->eviction_fence->mm; +-- +2.43.0 + diff --git a/queue-6.6/drm-amdkfd-fix-mes-set-shader-debugger-process-manag.patch b/queue-6.6/drm-amdkfd-fix-mes-set-shader-debugger-process-manag.patch new file mode 100644 index 00000000000..e0b4985fb31 --- /dev/null +++ b/queue-6.6/drm-amdkfd-fix-mes-set-shader-debugger-process-manag.patch @@ -0,0 +1,157 @@ +From 0a7195405de1b15bfc67298aaf9980cbfe82d16a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 12:22:07 -0500 +Subject: drm/amdkfd: fix mes set shader debugger process management + +From: Jonathan Kim + +[ Upstream commit bd33bb1409b494558a2935f7bbc7842def957fcd ] + +MES provides the driver a call to explicitly flush stale process memory +within the MES to avoid a race condition that results in a fatal +memory violation. + +When SET_SHADER_DEBUGGER is called, the driver passes a memory address +that represents a process context address MES uses to keep track of +future per-process calls. + +Normally, MES will purge its process context list when the last queue +has been removed. The driver, however, can call SET_SHADER_DEBUGGER +regardless of whether a queue has been added or not. + +If SET_SHADER_DEBUGGER has been called with no queues as the last call +prior to process termination, the passed process context address will +still reside within MES. + +On a new process call to SET_SHADER_DEBUGGER, the driver may end up +passing an identical process context address value (based on per-process +gpu memory address) to MES but is now pointing to a new allocated buffer +object during KFD process creation. Since the MES is unaware of this, +access of the passed address points to the stale object within MES and +triggers a fatal memory violation. + +The solution is for KFD to explicitly flush the process context address +from MES on process termination. + +Note that the flush call and the MES debugger calls use the same MES +interface but are separated as KFD calls to avoid conflicting with each +other. + +Signed-off-by: Jonathan Kim +Tested-by: Alice Wong +Reviewed-by: Eric Huang +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 31 +++++++++++++++++++ + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 10 +++--- + .../amd/amdkfd/kfd_process_queue_manager.c | 1 + + drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 +- + 4 files changed, 40 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +index 6aa75052309f..15c67fa404ff 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +@@ -885,6 +885,11 @@ int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev, + op_input.op = MES_MISC_OP_SET_SHADER_DEBUGGER; + op_input.set_shader_debugger.process_context_addr = process_context_addr; + op_input.set_shader_debugger.flags.u32all = flags; ++ ++ /* use amdgpu mes_flush_shader_debugger instead */ ++ if (op_input.set_shader_debugger.flags.process_ctx_flush) ++ return -EINVAL; ++ + op_input.set_shader_debugger.spi_gdbg_per_vmid_cntl = spi_gdbg_per_vmid_cntl; + memcpy(op_input.set_shader_debugger.tcp_watch_cntl, tcp_watch_cntl, + sizeof(op_input.set_shader_debugger.tcp_watch_cntl)); +@@ -904,6 +909,32 @@ int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev, + return r; + } + ++int amdgpu_mes_flush_shader_debugger(struct amdgpu_device *adev, ++ uint64_t process_context_addr) ++{ ++ struct mes_misc_op_input op_input = {0}; ++ int r; ++ ++ if (!adev->mes.funcs->misc_op) { ++ DRM_ERROR("mes flush shader debugger is not supported!\n"); ++ return -EINVAL; ++ } ++ ++ op_input.op = MES_MISC_OP_SET_SHADER_DEBUGGER; ++ op_input.set_shader_debugger.process_context_addr = process_context_addr; ++ op_input.set_shader_debugger.flags.process_ctx_flush = true; ++ ++ amdgpu_mes_lock(&adev->mes); ++ ++ r = adev->mes.funcs->misc_op(&adev->mes, &op_input); ++ if (r) ++ DRM_ERROR("failed to set_shader_debugger\n"); ++ ++ amdgpu_mes_unlock(&adev->mes); ++ ++ return r; ++} ++ + static void + amdgpu_mes_ring_to_queue_props(struct amdgpu_device *adev, + struct amdgpu_ring *ring, +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +index a27b424ffe00..c2c88b772361 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +@@ -291,9 +291,10 @@ struct mes_misc_op_input { + uint64_t process_context_addr; + union { + struct { +- uint64_t single_memop : 1; +- uint64_t single_alu_op : 1; +- uint64_t reserved: 30; ++ uint32_t single_memop : 1; ++ uint32_t single_alu_op : 1; ++ uint32_t reserved: 29; ++ uint32_t process_ctx_flush: 1; + }; + uint32_t u32all; + } flags; +@@ -369,7 +370,8 @@ int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev, + const uint32_t *tcp_watch_cntl, + uint32_t flags, + bool trap_en); +- ++int amdgpu_mes_flush_shader_debugger(struct amdgpu_device *adev, ++ uint64_t process_context_addr); + int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id, + int queue_type, int idx, + struct amdgpu_mes_ctx_data *ctx_data, +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +index 77f493262e05..8e55e78fce4e 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +@@ -87,6 +87,7 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) + return; + + dev->dqm->ops.process_termination(dev->dqm, &pdd->qpd); ++ amdgpu_mes_flush_shader_debugger(dev->adev, pdd->proc_ctx_gpu_addr); + pdd->already_dequeued = true; + } + +diff --git a/drivers/gpu/drm/amd/include/mes_v11_api_def.h b/drivers/gpu/drm/amd/include/mes_v11_api_def.h +index b1db2b190187..e07e93167a82 100644 +--- a/drivers/gpu/drm/amd/include/mes_v11_api_def.h ++++ b/drivers/gpu/drm/amd/include/mes_v11_api_def.h +@@ -571,7 +571,8 @@ struct SET_SHADER_DEBUGGER { + struct { + uint32_t single_memop : 1; /* SQ_DEBUG.single_memop */ + uint32_t single_alu_op : 1; /* SQ_DEBUG.single_alu_op */ +- uint32_t reserved : 30; ++ uint32_t reserved : 29; ++ uint32_t process_ctx_flush : 1; + }; + uint32_t u32all; + } flags; +-- +2.43.0 + diff --git a/queue-6.6/drm-amdkfd-fix-node-null-check-in-svm_range_get_rang.patch b/queue-6.6/drm-amdkfd-fix-node-null-check-in-svm_range_get_rang.patch new file mode 100644 index 00000000000..a74638eb70b --- /dev/null +++ b/queue-6.6/drm-amdkfd-fix-node-null-check-in-svm_range_get_rang.patch @@ -0,0 +1,67 @@ +From bce3fa23ac9bb606d6852405e6d008668801c497 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 9 Jan 2024 16:57:26 +0530 +Subject: drm/amdkfd: Fix 'node' NULL check in + 'svm_range_get_range_boundaries()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Srinivasan Shanmugam + +[ Upstream commit d7a254fad873775ce6c32b77796c81e81e6b7f2e ] + +Range interval [start, last] is ordered by rb_tree, rb_prev, rb_next +return value still needs NULL check, thus modified from "node" to "rb_node". + +Fixes the below: +drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:2691 svm_range_get_range_boundaries() warn: can 'node' even be NULL? + +Suggested-by: Philip Yang +Cc: Felix Kuehling +Cc: Christian König +Cc: Alex Deucher +Signed-off-by: Srinivasan Shanmugam +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +index b51224a85a38..87e9ca65e58e 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +@@ -2657,6 +2657,7 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, + { + struct vm_area_struct *vma; + struct interval_tree_node *node; ++ struct rb_node *rb_node; + unsigned long start_limit, end_limit; + + vma = vma_lookup(p->mm, addr << PAGE_SHIFT); +@@ -2676,16 +2677,15 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, + if (node) { + end_limit = min(end_limit, node->start); + /* Last range that ends before the fault address */ +- node = container_of(rb_prev(&node->rb), +- struct interval_tree_node, rb); ++ rb_node = rb_prev(&node->rb); + } else { + /* Last range must end before addr because + * there was no range after addr + */ +- node = container_of(rb_last(&p->svms.objects.rb_root), +- struct interval_tree_node, rb); ++ rb_node = rb_last(&p->svms.objects.rb_root); + } +- if (node) { ++ if (rb_node) { ++ node = container_of(rb_node, struct interval_tree_node, rb); + if (node->last >= addr) { + WARN(1, "Overlap with prev node and page fault addr\n"); + return -EFAULT; +-- +2.43.0 + diff --git a/queue-6.6/drm-amdkfd-only-flush-mes-process-context-if-mes-sup.patch b/queue-6.6/drm-amdkfd-only-flush-mes-process-context-if-mes-sup.patch new file mode 100644 index 00000000000..1f6dea0fbb9 --- /dev/null +++ b/queue-6.6/drm-amdkfd-only-flush-mes-process-context-if-mes-sup.patch @@ -0,0 +1,39 @@ +From e390f1ef51dcb5c004e59ec1c2a4ea3ef16eca8e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Dec 2023 22:08:03 -0500 +Subject: drm/amdkfd: only flush mes process context if mes support is there + +From: Jonathan Kim + +[ Upstream commit 24149412dfc71f7f4a54868702e9145e396263d3 ] + +Fix up on mes process context flush to prevent non-mes devices from +spamming error messages or running into undefined behaviour during +process termination. + +Fixes: bd33bb1409b4 ("drm/amdkfd: fix mes set shader debugger process management") +Signed-off-by: Jonathan Kim +Reviewed-by: Eric Huang +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +index 8e55e78fce4e..43eff221eae5 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +@@ -87,7 +87,8 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) + return; + + dev->dqm->ops.process_termination(dev->dqm, &pdd->qpd); +- amdgpu_mes_flush_shader_debugger(dev->adev, pdd->proc_ctx_gpu_addr); ++ if (dev->kfd->shared_resources.enable_mes) ++ amdgpu_mes_flush_shader_debugger(dev->adev, pdd->proc_ctx_gpu_addr); + pdd->already_dequeued = true; + } + +-- +2.43.0 + diff --git a/queue-6.6/drm-bridge-anx7625-fix-set-hpd-irq-detect-window-to-.patch b/queue-6.6/drm-bridge-anx7625-fix-set-hpd-irq-detect-window-to-.patch new file mode 100644 index 00000000000..ee75ff3ca81 --- /dev/null +++ b/queue-6.6/drm-bridge-anx7625-fix-set-hpd-irq-detect-window-to-.patch @@ -0,0 +1,119 @@ +From 87fc1b9e502a6bbc593030698df4e4f0caf1db9e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 17:10:37 +0800 +Subject: drm/bridge: anx7625: Fix Set HPD irq detect window to 2ms + +From: Xin Ji + +[ Upstream commit e3af7053de3f685c96158373bc234b2feca1f160 ] + +Polling firmware HPD GPIO status, set HPD irq detect window to 2ms +after firmware HPD GPIO initial done + +Signed-off-by: Xin Ji +Reviewed-by: Robert Foss +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20231120091038.284825-2-xji@analogixsemi.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/bridge/analogix/anx7625.c | 51 ++++++++++++++++------- + drivers/gpu/drm/bridge/analogix/anx7625.h | 4 ++ + 2 files changed, 40 insertions(+), 15 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c +index 5168628f11cf..29d91493b101 100644 +--- a/drivers/gpu/drm/bridge/analogix/anx7625.c ++++ b/drivers/gpu/drm/bridge/analogix/anx7625.c +@@ -1298,10 +1298,32 @@ static void anx7625_config(struct anx7625_data *ctx) + XTAL_FRQ_SEL, XTAL_FRQ_27M); + } + ++static int anx7625_hpd_timer_config(struct anx7625_data *ctx) ++{ ++ int ret; ++ ++ /* Set irq detect window to 2ms */ ++ ret = anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, ++ HPD_DET_TIMER_BIT0_7, HPD_TIME & 0xFF); ++ ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, ++ HPD_DET_TIMER_BIT8_15, ++ (HPD_TIME >> 8) & 0xFF); ++ ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, ++ HPD_DET_TIMER_BIT16_23, ++ (HPD_TIME >> 16) & 0xFF); ++ ++ return ret; ++} ++ ++static int anx7625_read_hpd_gpio_config_status(struct anx7625_data *ctx) ++{ ++ return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, GPIO_CTRL_2); ++} ++ + static void anx7625_disable_pd_protocol(struct anx7625_data *ctx) + { + struct device *dev = ctx->dev; +- int ret; ++ int ret, val; + + /* Reset main ocm */ + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, 0x88, 0x40); +@@ -1315,6 +1337,19 @@ static void anx7625_disable_pd_protocol(struct anx7625_data *ctx) + DRM_DEV_DEBUG_DRIVER(dev, "disable PD feature fail.\n"); + else + DRM_DEV_DEBUG_DRIVER(dev, "disable PD feature succeeded.\n"); ++ ++ /* ++ * Make sure the HPD GPIO already be configured after OCM release before ++ * setting HPD detect window register. Here we poll the status register ++ * at maximum 40ms, then config HPD irq detect window register ++ */ ++ readx_poll_timeout(anx7625_read_hpd_gpio_config_status, ++ ctx, val, ++ ((val & HPD_SOURCE) || (val < 0)), ++ 2000, 2000 * 20); ++ ++ /* Set HPD irq detect window to 2ms */ ++ anx7625_hpd_timer_config(ctx); + } + + static int anx7625_ocm_loading_check(struct anx7625_data *ctx) +@@ -1437,20 +1472,6 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx) + + static int anx7625_read_hpd_status_p0(struct anx7625_data *ctx) + { +- int ret; +- +- /* Set irq detect window to 2ms */ +- ret = anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, +- HPD_DET_TIMER_BIT0_7, HPD_TIME & 0xFF); +- ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, +- HPD_DET_TIMER_BIT8_15, +- (HPD_TIME >> 8) & 0xFF); +- ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, +- HPD_DET_TIMER_BIT16_23, +- (HPD_TIME >> 16) & 0xFF); +- if (ret < 0) +- return ret; +- + return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, SYSTEM_STSTUS); + } + +diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h +index 80d3fb4e985f..39ed35d33836 100644 +--- a/drivers/gpu/drm/bridge/analogix/anx7625.h ++++ b/drivers/gpu/drm/bridge/analogix/anx7625.h +@@ -259,6 +259,10 @@ + #define AP_MIPI_RX_EN BIT(5) /* 1: MIPI RX input in 0: no RX in */ + #define AP_DISABLE_PD BIT(6) + #define AP_DISABLE_DISPLAY BIT(7) ++ ++#define GPIO_CTRL_2 0x49 ++#define HPD_SOURCE BIT(6) ++ + /***************************************************************/ + /* Register definition of device address 0x84 */ + #define MIPI_PHY_CONTROL_3 0x03 +-- +2.43.0 + diff --git a/queue-6.6/drm-drm_file-fix-use-of-uninitialized-variable.patch b/queue-6.6/drm-drm_file-fix-use-of-uninitialized-variable.patch new file mode 100644 index 00000000000..71fdee883be --- /dev/null +++ b/queue-6.6/drm-drm_file-fix-use-of-uninitialized-variable.patch @@ -0,0 +1,43 @@ +From b7c63d031e6e07930dad7182bfac6bcc1cf21cf6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Nov 2023 15:14:03 +0200 +Subject: drm/drm_file: fix use of uninitialized variable + +From: Tomi Valkeinen + +[ Upstream commit 1d3062fad9c7313fff9970a88e0538a24480ffb8 ] + +smatch reports: + +drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'. + +'supported_status' is only set in one code path. I'm not familiar with +the code to say if that path will always be ran in real life, but +whether that is the case or not, I think it is good to initialize +'supported_status' to 0 to silence the warning (and possibly fix a bug). + +Reviewed-by: Laurent Pinchart +Acked-by: Maxime Ripard +Signed-off-by: Tomi Valkeinen +Link: https://patchwork.freedesktop.org/patch/msgid/20231103-uninit-fixes-v2-1-c22b2444f5f5@ideasonboard.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/drm_file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c +index e692770ef6d3..a7799086017a 100644 +--- a/drivers/gpu/drm/drm_file.c ++++ b/drivers/gpu/drm/drm_file.c +@@ -958,7 +958,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) + { + struct drm_gem_object *obj; + struct drm_memory_stats status = {}; +- enum drm_gem_object_status supported_status; ++ enum drm_gem_object_status supported_status = 0; + int id; + + spin_lock(&file->table_lock); +-- +2.43.0 + diff --git a/queue-6.6/drm-exynos-call-drm_atomic_helper_shutdown-at-shutdo.patch b/queue-6.6/drm-exynos-call-drm_atomic_helper_shutdown-at-shutdo.patch new file mode 100644 index 00000000000..b0f96ac8dbc --- /dev/null +++ b/queue-6.6/drm-exynos-call-drm_atomic_helper_shutdown-at-shutdo.patch @@ -0,0 +1,86 @@ +From 21e52deef2a9b0cabd67b04b097a8bf9b14197d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Sep 2023 12:26:52 -0700 +Subject: drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time + +From: Douglas Anderson + +[ Upstream commit 16ac5b21b31b439f03cdf44c153c5f5af94fb3eb ] + +Based on grepping through the source code this driver appears to be +missing a call to drm_atomic_helper_shutdown() at system shutdown time +and at driver unbind time. Among other things, this means that if a +panel is in use that it won't be cleanly powered off at system +shutdown time. + +The fact that we should call drm_atomic_helper_shutdown() in the case +of OS shutdown/restart and at driver remove (or unbind) time comes +straight out of the kernel doc "driver instance overview" in +drm_drv.c. + +A few notes about this fix: +- When adding drm_atomic_helper_shutdown() to the unbind path, I added + it after drm_kms_helper_poll_fini() since that's when other drivers + seemed to have it. +- Technically with a previous patch, ("drm/atomic-helper: + drm_atomic_helper_shutdown(NULL) should be a noop"), we don't + actually need to check to see if our "drm" pointer is NULL before + calling drm_atomic_helper_shutdown(). We'll leave the "if" test in, + though, so that this patch can land without any dependencies. It + could potentially be removed later. +- This patch also makes sure to set the drvdata to NULL in the case of + bind errors to make sure that shutdown can't access freed data. + +Suggested-by: Maxime Ripard +Reviewed-by: Maxime Ripard +Signed-off-by: Douglas Anderson +Tested-by: Marek Szyprowski +Reviewed-by: Marek Szyprowski +Signed-off-by: Inki Dae +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c +index 8399256cb5c9..5380fb6c55ae 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c +@@ -300,6 +300,7 @@ static int exynos_drm_bind(struct device *dev) + drm_mode_config_cleanup(drm); + exynos_drm_cleanup_dma(drm); + kfree(private); ++ dev_set_drvdata(dev, NULL); + err_free_drm: + drm_dev_put(drm); + +@@ -313,6 +314,7 @@ static void exynos_drm_unbind(struct device *dev) + drm_dev_unregister(drm); + + drm_kms_helper_poll_fini(drm); ++ drm_atomic_helper_shutdown(drm); + + component_unbind_all(drm->dev, drm); + drm_mode_config_cleanup(drm); +@@ -350,9 +352,18 @@ static int exynos_drm_platform_remove(struct platform_device *pdev) + return 0; + } + ++static void exynos_drm_platform_shutdown(struct platform_device *pdev) ++{ ++ struct drm_device *drm = platform_get_drvdata(pdev); ++ ++ if (drm) ++ drm_atomic_helper_shutdown(drm); ++} ++ + static struct platform_driver exynos_drm_platform_driver = { + .probe = exynos_drm_platform_probe, + .remove = exynos_drm_platform_remove, ++ .shutdown = exynos_drm_platform_shutdown, + .driver = { + .name = "exynos-drm", + .pm = &exynos_drm_pm_ops, +-- +2.43.0 + diff --git a/queue-6.6/drm-fix-color-lut-rounding.patch b/queue-6.6/drm-fix-color-lut-rounding.patch new file mode 100644 index 00000000000..228ae24f93d --- /dev/null +++ b/queue-6.6/drm-fix-color-lut-rounding.patch @@ -0,0 +1,100 @@ +From 5ca610239fb933a0793ab29761ef568f79fa3cdd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Oct 2023 16:13:59 +0300 +Subject: drm: Fix color LUT rounding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +[ Upstream commit c6fbb6bca10838485b820e8a26c23996f77ce580 ] + +The current implementation of drm_color_lut_extract() +generates weird results. Eg. if we go through all the +values for 16->8bpc conversion we see the following pattern: + +in out (count) + 0 - 7f -> 0 (128) + 80 - 17f -> 1 (256) + 180 - 27f -> 2 (256) + 280 - 37f -> 3 (256) +... +fb80 - fc7f -> fc (256) +fc80 - fd7f -> fd (256) +fd80 - fe7f -> fe (256) +fe80 - ffff -> ff (384) + +So less values map to 0 and more values map 0xff, which +doesn't seem particularly great. + +To get just the same number of input values to map to +the same output values we'd just need to drop the rounding +entrirely. But perhaps a better idea would be to follow the +OpenGL int<->float conversion rules, in which case we get +the following results: + +in out (count) + 0 - 80 -> 0 (129) + 81 - 181 -> 1 (257) + 182 - 282 -> 2 (257) + 283 - 383 -> 3 (257) +... +fc7c - fd7c -> fc (257) +fd7d - fe7d -> fd (257) +fe7e - ff7e -> fe (257) +ff7f - ffff -> ff (129) + +Note that since the divisor is constant the compiler +is able to optimize away the integer division in most +cases. The only exception is the _ULL() case on 32bit +architectures since that gets emitted as inline asm +via do_div() and thus the compiler doesn't get to +optimize it. + +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20231013131402.24072-2-ville.syrjala@linux.intel.com +Reviewed-by: Chaitanya Kumar Borah +Reviewed-by: Jani Nikula +Acked-by: Maxime Ripard +Signed-off-by: Sasha Levin +--- + include/drm/drm_color_mgmt.h | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h +index 81c298488b0c..54b2b2467bfd 100644 +--- a/include/drm/drm_color_mgmt.h ++++ b/include/drm/drm_color_mgmt.h +@@ -36,20 +36,17 @@ struct drm_plane; + * + * Extract a degamma/gamma LUT value provided by user (in the form of + * &drm_color_lut entries) and round it to the precision supported by the +- * hardware. ++ * hardware, following OpenGL int<->float conversion rules ++ * (see eg. OpenGL 4.6 specification - 2.3.5 Fixed-Point Data Conversions). + */ + static inline u32 drm_color_lut_extract(u32 user_input, int bit_precision) + { +- u32 val = user_input; +- u32 max = 0xffff >> (16 - bit_precision); +- +- /* Round only if we're not using full precision. */ +- if (bit_precision < 16) { +- val += 1UL << (16 - bit_precision - 1); +- val >>= 16 - bit_precision; +- } +- +- return clamp_val(val, 0, max); ++ if (bit_precision > 16) ++ return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1), ++ (1 << 16) - 1); ++ else ++ return DIV_ROUND_CLOSEST(user_input * ((1 << bit_precision) - 1), ++ (1 << 16) - 1); + } + + u64 drm_color_ctm_s31_32_to_qm_n(u64 user_input, u32 m, u32 n); +-- +2.43.0 + diff --git a/queue-6.6/drm-framebuffer-fix-use-of-uninitialized-variable.patch b/queue-6.6/drm-framebuffer-fix-use-of-uninitialized-variable.patch new file mode 100644 index 00000000000..064d25a161a --- /dev/null +++ b/queue-6.6/drm-framebuffer-fix-use-of-uninitialized-variable.patch @@ -0,0 +1,42 @@ +From ea16e07c84e21ad330d9bbea10c4a7c932caca3f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Nov 2023 15:14:04 +0200 +Subject: drm/framebuffer: Fix use of uninitialized variable + +From: Tomi Valkeinen + +[ Upstream commit f9af8f0c1dc567a5a6a6318ff324c45d80d4a60f ] + +smatch reports: + +drivers/gpu/drm/drm_framebuffer.c:654 drm_mode_getfb2_ioctl() error: uninitialized symbol 'ret'. + +'ret' is possibly not set when there are no errors, causing the error +above. I can't say if that ever happens in real-life, but in any case I +think it is good to initialize 'ret' to 0. + +Reviewed-by: Laurent Pinchart +Acked-by: Maxime Ripard +Signed-off-by: Tomi Valkeinen +Link: https://patchwork.freedesktop.org/patch/msgid/20231103-uninit-fixes-v2-2-c22b2444f5f5@ideasonboard.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/drm_framebuffer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c +index aff3746dedfb..1955eaeba0ab 100644 +--- a/drivers/gpu/drm/drm_framebuffer.c ++++ b/drivers/gpu/drm/drm_framebuffer.c +@@ -570,7 +570,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev, + struct drm_mode_fb_cmd2 *r = data; + struct drm_framebuffer *fb; + unsigned int i; +- int ret; ++ int ret = 0; + + if (!drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; +-- +2.43.0 + diff --git a/queue-6.6/drm-mipi-dsi-fix-detach-call-without-attach.patch b/queue-6.6/drm-mipi-dsi-fix-detach-call-without-attach.patch new file mode 100644 index 00000000000..ee8deace3f5 --- /dev/null +++ b/queue-6.6/drm-mipi-dsi-fix-detach-call-without-attach.patch @@ -0,0 +1,138 @@ +From 9a5865f4dfef25d2bb6744ca7e91799c1bc3ab9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Sep 2023 13:50:32 +0300 +Subject: drm/mipi-dsi: Fix detach call without attach + +From: Tomi Valkeinen + +[ Upstream commit 90d50b8d85834e73536fdccd5aa913b30494fef0 ] + +It's been reported that DSI host driver's detach can be called without +the attach ever happening: + +https://lore.kernel.org/all/20230412073954.20601-1-tony@atomide.com/ + +After reading the code, I think this is what happens: + +We have a DSI host defined in the device tree and a DSI peripheral under +that host (i.e. an i2c device using the DSI as data bus doesn't exhibit +this behavior). + +The host driver calls mipi_dsi_host_register(), which causes (via a few +functions) mipi_dsi_device_add() to be called for the DSI peripheral. So +now we have a DSI device under the host, but attach hasn't been called. + +Normally the probing of the devices continues, and eventually the DSI +peripheral's driver will call mipi_dsi_attach(), attaching the +peripheral. + +However, if the host driver's probe encounters an error after calling +mipi_dsi_host_register(), and before the peripheral has called +mipi_dsi_attach(), the host driver will do cleanups and return an error +from its probe function. The cleanups include calling +mipi_dsi_host_unregister(). + +mipi_dsi_host_unregister() will call two functions for all its DSI +peripheral devices: mipi_dsi_detach() and mipi_dsi_device_unregister(). +The latter makes sense, as the device exists, but the former may be +wrong as attach has not necessarily been done. + +To fix this, track the attached state of the peripheral, and only detach +from mipi_dsi_host_unregister() if the peripheral was attached. + +Note that I have only tested this with a board with an i2c DSI +peripheral, not with a "pure" DSI peripheral. + +However, slightly related, the unregister machinery still seems broken. +E.g. if the DSI host driver is unbound, it'll detach and unregister the +DSI peripherals. After that, when the DSI peripheral driver unbound +it'll call detach either directly or using the devm variant, leading to +a crash. And probably the driver will crash if it happens, for some +reason, to try to send a message via the DSI bus. + +But that's another topic. + +Tested-by: H. Nikolaus Schaller +Acked-by: Maxime Ripard +Reviewed-by: Sebastian Reichel +Tested-by: Tony Lindgren +Signed-off-by: Tomi Valkeinen +Link: https://patchwork.freedesktop.org/patch/msgid/20230921-dsi-detach-fix-v1-1-d0de2d1621d9@ideasonboard.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/drm_mipi_dsi.c | 17 +++++++++++++++-- + include/drm/drm_mipi_dsi.h | 2 ++ + 2 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c +index 14201f73aab1..843a6dbda93a 100644 +--- a/drivers/gpu/drm/drm_mipi_dsi.c ++++ b/drivers/gpu/drm/drm_mipi_dsi.c +@@ -347,7 +347,8 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) + { + struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + +- mipi_dsi_detach(dsi); ++ if (dsi->attached) ++ mipi_dsi_detach(dsi); + mipi_dsi_device_unregister(dsi); + + return 0; +@@ -370,11 +371,18 @@ EXPORT_SYMBOL(mipi_dsi_host_unregister); + int mipi_dsi_attach(struct mipi_dsi_device *dsi) + { + const struct mipi_dsi_host_ops *ops = dsi->host->ops; ++ int ret; + + if (!ops || !ops->attach) + return -ENOSYS; + +- return ops->attach(dsi->host, dsi); ++ ret = ops->attach(dsi->host, dsi); ++ if (ret) ++ return ret; ++ ++ dsi->attached = true; ++ ++ return 0; + } + EXPORT_SYMBOL(mipi_dsi_attach); + +@@ -386,9 +394,14 @@ int mipi_dsi_detach(struct mipi_dsi_device *dsi) + { + const struct mipi_dsi_host_ops *ops = dsi->host->ops; + ++ if (WARN_ON(!dsi->attached)) ++ return -EINVAL; ++ + if (!ops || !ops->detach) + return -ENOSYS; + ++ dsi->attached = false; ++ + return ops->detach(dsi->host, dsi); + } + EXPORT_SYMBOL(mipi_dsi_detach); +diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h +index c9df0407980c..c0aec0d4d664 100644 +--- a/include/drm/drm_mipi_dsi.h ++++ b/include/drm/drm_mipi_dsi.h +@@ -168,6 +168,7 @@ struct mipi_dsi_device_info { + * struct mipi_dsi_device - DSI peripheral device + * @host: DSI host for this peripheral + * @dev: driver model device node for this peripheral ++ * @attached: the DSI device has been successfully attached + * @name: DSI peripheral chip type + * @channel: virtual channel assigned to the peripheral + * @format: pixel format for video mode +@@ -184,6 +185,7 @@ struct mipi_dsi_device_info { + struct mipi_dsi_device { + struct mipi_dsi_host *host; + struct device dev; ++ bool attached; + + char name[DSI_DEV_NAME_SIZE]; + unsigned int channel; +-- +2.43.0 + diff --git a/queue-6.6/drm-msm-dp-add-displayport-controller-for-sm8650.patch b/queue-6.6/drm-msm-dp-add-displayport-controller-for-sm8650.patch new file mode 100644 index 00000000000..7870893b187 --- /dev/null +++ b/queue-6.6/drm-msm-dp-add-displayport-controller-for-sm8650.patch @@ -0,0 +1,50 @@ +From 714567ba458759398f8fa39388e8555129db33cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 17:37:18 +0100 +Subject: drm/msm/dp: Add DisplayPort controller for SM8650 + +From: Neil Armstrong + +[ Upstream commit 1b2d98bdd7b7c64265732f5f0dace4c52c9ba8a8 ] + +The Qualcomm SM8650 platform comes with a DisplayPort controller +with a different base offset than the previous SM8550 SoC, +add support for this in the DisplayPort driver. + +Signed-off-by: Neil Armstrong +Reviewed-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/571132/ +Link: https://lore.kernel.org/r/20231207-topic-sm8650-upstream-dp-v1-2-b762c06965bb@linaro.org +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c +index 76f13954015b..eec5768aac72 100644 +--- a/drivers/gpu/drm/msm/dp/dp_display.c ++++ b/drivers/gpu/drm/msm/dp/dp_display.c +@@ -171,6 +171,11 @@ static const struct msm_dp_desc sm8350_dp_descs[] = { + {} + }; + ++static const struct msm_dp_desc sm8650_dp_descs[] = { ++ { .io_start = 0x0af54000, .id = MSM_DP_CONTROLLER_0, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, ++ {} ++}; ++ + static const struct of_device_id dp_dt_match[] = { + { .compatible = "qcom,sc7180-dp", .data = &sc7180_dp_descs }, + { .compatible = "qcom,sc7280-dp", .data = &sc7280_dp_descs }, +@@ -181,6 +186,7 @@ static const struct of_device_id dp_dt_match[] = { + { .compatible = "qcom,sc8280xp-edp", .data = &sc8280xp_edp_descs }, + { .compatible = "qcom,sdm845-dp", .data = &sc7180_dp_descs }, + { .compatible = "qcom,sm8350-dp", .data = &sm8350_dp_descs }, ++ { .compatible = "qcom,sm8650-dp", .data = &sm8650_dp_descs }, + {} + }; + +-- +2.43.0 + diff --git a/queue-6.6/drm-msm-dpu-enable-writeback-on-sm8350.patch b/queue-6.6/drm-msm-dpu-enable-writeback-on-sm8350.patch new file mode 100644 index 00000000000..70b24dfbcfe --- /dev/null +++ b/queue-6.6/drm-msm-dpu-enable-writeback-on-sm8350.patch @@ -0,0 +1,66 @@ +From 3bad7079e071439d378475077c87ef444dd9185e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 3 Dec 2023 03:27:42 +0300 +Subject: drm/msm/dpu: enable writeback on SM8350 + +From: Dmitry Baryshkov + +[ Upstream commit c2949a49dfe960e952400029e14751dceff79d38 ] + +Enable WB2 hardware block, enabling writeback support on this platform. + +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/570188/ +Link: https://lore.kernel.org/r/20231203002743.1291956-3-dmitry.baryshkov@linaro.org +Signed-off-by: Sasha Levin +--- + .../drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h +index f8d16f9bf528..428bcbcfbf19 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h +@@ -31,6 +31,7 @@ static const struct dpu_mdp_cfg sm8350_mdp = { + [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2c4, .bit_off = 8 }, ++ [DPU_CLK_CTRL_WB2] = { .reg_off = 0x2bc, .bit_off = 16 }, + [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 }, + }, + }; +@@ -304,6 +305,21 @@ static const struct dpu_dsc_cfg sm8350_dsc[] = { + }, + }; + ++static const struct dpu_wb_cfg sm8350_wb[] = { ++ { ++ .name = "wb_2", .id = WB_2, ++ .base = 0x65000, .len = 0x2c8, ++ .features = WB_SM8250_MASK, ++ .format_list = wb2_formats, ++ .num_formats = ARRAY_SIZE(wb2_formats), ++ .clk_ctrl = DPU_CLK_CTRL_WB2, ++ .xin_id = 6, ++ .vbif_idx = VBIF_RT, ++ .maxlinewidth = 4096, ++ .intr_wb_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 4), ++ }, ++}; ++ + static const struct dpu_intf_cfg sm8350_intf[] = { + { + .name = "intf_0", .id = INTF_0, +@@ -401,6 +417,8 @@ const struct dpu_mdss_cfg dpu_sm8350_cfg = { + .dsc = sm8350_dsc, + .merge_3d_count = ARRAY_SIZE(sm8350_merge_3d), + .merge_3d = sm8350_merge_3d, ++ .wb_count = ARRAY_SIZE(sm8350_wb), ++ .wb = sm8350_wb, + .intf_count = ARRAY_SIZE(sm8350_intf), + .intf = sm8350_intf, + .vbif_count = ARRAY_SIZE(sdm845_vbif), +-- +2.43.0 + diff --git a/queue-6.6/drm-msm-dpu-enable-writeback-on-sm8450.patch b/queue-6.6/drm-msm-dpu-enable-writeback-on-sm8450.patch new file mode 100644 index 00000000000..84d8915e985 --- /dev/null +++ b/queue-6.6/drm-msm-dpu-enable-writeback-on-sm8450.patch @@ -0,0 +1,66 @@ +From 909ed7bca949c74c5c8d4467b0e5637f7db05bf8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 3 Dec 2023 03:27:43 +0300 +Subject: drm/msm/dpu: enable writeback on SM8450 + +From: Dmitry Baryshkov + +[ Upstream commit eaa647cdbf2e357b4a14903f2f1e47ed9c4f8df3 ] + +Enable WB2 hardware block, enabling writeback support on this platform. + +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/570187/ +Link: https://lore.kernel.org/r/20231203002743.1291956-4-dmitry.baryshkov@linaro.org +Signed-off-by: Sasha Levin +--- + .../drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h +index 1b12178dfbca..8a19cfa274de 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h +@@ -32,6 +32,7 @@ static const struct dpu_mdp_cfg sm8450_mdp = { + [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2c4, .bit_off = 8 }, ++ [DPU_CLK_CTRL_WB2] = { .reg_off = 0x2bc, .bit_off = 16 }, + [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 }, + }, + }; +@@ -326,6 +327,21 @@ static const struct dpu_dsc_cfg sm8450_dsc[] = { + }, + }; + ++static const struct dpu_wb_cfg sm8450_wb[] = { ++ { ++ .name = "wb_2", .id = WB_2, ++ .base = 0x65000, .len = 0x2c8, ++ .features = WB_SM8250_MASK, ++ .format_list = wb2_formats, ++ .num_formats = ARRAY_SIZE(wb2_formats), ++ .clk_ctrl = DPU_CLK_CTRL_WB2, ++ .xin_id = 6, ++ .vbif_idx = VBIF_RT, ++ .maxlinewidth = 4096, ++ .intr_wb_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 4), ++ }, ++}; ++ + static const struct dpu_intf_cfg sm8450_intf[] = { + { + .name = "intf_0", .id = INTF_0, +@@ -423,6 +439,8 @@ const struct dpu_mdss_cfg dpu_sm8450_cfg = { + .dsc = sm8450_dsc, + .merge_3d_count = ARRAY_SIZE(sm8450_merge_3d), + .merge_3d = sm8450_merge_3d, ++ .wb_count = ARRAY_SIZE(sm8450_wb), ++ .wb = sm8450_wb, + .intf_count = ARRAY_SIZE(sm8450_intf), + .intf = sm8450_intf, + .vbif_count = ARRAY_SIZE(sdm845_vbif), +-- +2.43.0 + diff --git a/queue-6.6/drm-msm-dpu-fix-writeback-programming-for-yuv-cases.patch b/queue-6.6/drm-msm-dpu-fix-writeback-programming-for-yuv-cases.patch new file mode 100644 index 00000000000..5b9f0733cb9 --- /dev/null +++ b/queue-6.6/drm-msm-dpu-fix-writeback-programming-for-yuv-cases.patch @@ -0,0 +1,44 @@ +From bebcd3207d240917e6de6d05353fe7f3568270cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 12:52:41 -0800 +Subject: drm/msm/dpu: fix writeback programming for YUV cases + +From: Abhinav Kumar + +[ Upstream commit 79caf2f2202b9eaad3a5a726e4b33807f67d0f1b ] + +For YUV cases, setting the required format bits was missed +out in the register programming. Lets fix it now in preparation +of adding YUV formats support for writeback. + +changes in v2: + - dropped the fixes tag as its not a fix but adding + new functionality + +Signed-off-by: Abhinav Kumar +Reviewed-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/571814/ +Link: https://lore.kernel.org/r/20231212205254.12422-4-quic_abhinavk@quicinc.com +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +index ebc416400382..0aa598b355e9 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +@@ -86,6 +86,9 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, + dst_format |= BIT(14); /* DST_ALPHA_X */ + } + ++ if (DPU_FORMAT_IS_YUV(fmt)) ++ dst_format |= BIT(15); ++ + pattern = (fmt->element[3] << 24) | + (fmt->element[2] << 16) | + (fmt->element[1] << 8) | +-- +2.43.0 + diff --git a/queue-6.6/drm-msm-dpu-ratelimit-framedone-timeout-msgs.patch b/queue-6.6/drm-msm-dpu-ratelimit-framedone-timeout-msgs.patch new file mode 100644 index 00000000000..96572adb268 --- /dev/null +++ b/queue-6.6/drm-msm-dpu-ratelimit-framedone-timeout-msgs.patch @@ -0,0 +1,62 @@ +From 0e8a8bbbec72f178dd922819ac32768199433700 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 10:19:55 -0800 +Subject: drm/msm/dpu: Ratelimit framedone timeout msgs + +From: Rob Clark + +[ Upstream commit 2b72e50c62de60ad2d6bcd86aa38d4ccbdd633f2 ] + +When we start getting these, we get a *lot*. So ratelimit it to not +flood dmesg. + +Signed-off-by: Rob Clark +Reviewed-by: Abhinav Kumar +Reviewed-by: Marijn Suijten +Patchwork: https://patchwork.freedesktop.org/patch/571584/ +Link: https://lore.kernel.org/r/20231211182000.218088-1-robdclark@gmail.com +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 5 ++++- + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +index b02aa2eb6c17..7d4cf81fd31c 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +@@ -39,6 +39,9 @@ + #define DPU_ERROR_ENC(e, fmt, ...) DPU_ERROR("enc%d " fmt,\ + (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) + ++#define DPU_ERROR_ENC_RATELIMITED(e, fmt, ...) DPU_ERROR_RATELIMITED("enc%d " fmt,\ ++ (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) ++ + /* + * Two to anticipate panels that can do cmd/vid dynamic switching + * plan is to create all possible physical encoder types, and switch between +@@ -2327,7 +2330,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t) + return; + } + +- DPU_ERROR_ENC(dpu_enc, "frame done timeout\n"); ++ DPU_ERROR_ENC_RATELIMITED(dpu_enc, "frame done timeout\n"); + + event = DPU_ENCODER_FRAME_EVENT_ERROR; + trace_dpu_enc_frame_done_timeout(DRMID(drm_enc), event); +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +index b6f53ca6e962..f5473d4dea92 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +@@ -51,6 +51,7 @@ + } while (0) + + #define DPU_ERROR(fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) ++#define DPU_ERROR_RATELIMITED(fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__) + + /** + * ktime_compare_safe - compare two ktime structures +-- +2.43.0 + diff --git a/queue-6.6/drm-panel-edp-add-override_edid_mode-quirk-for-gener.patch b/queue-6.6/drm-panel-edp-add-override_edid_mode-quirk-for-gener.patch new file mode 100644 index 00000000000..dea363582ef --- /dev/null +++ b/queue-6.6/drm-panel-edp-add-override_edid_mode-quirk-for-gener.patch @@ -0,0 +1,112 @@ +From b91392a8bc472889239b3ff0c8337ee8c0f2ab29 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 13:46:32 -0800 +Subject: drm/panel-edp: Add override_edid_mode quirk for generic edp + +From: Hsin-Yi Wang + +[ Upstream commit 9f7843b515811aea6c56527eb195b622e9c01f12 ] + +Generic edp gets mode from edid. However, some panels report incorrect +mode in this way, resulting in glitches on panel. Introduce a new quirk +additional_mode to the generic edid to pick a correct hardcoded mode. + +Signed-off-by: Hsin-Yi Wang +Reviewed-by: Douglas Anderson +Signed-off-by: Douglas Anderson +Link: https://patchwork.freedesktop.org/patch/msgid/20231117215056.1883314-2-hsinyi@chromium.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-edp.c | 48 +++++++++++++++++++++++++++++-- + 1 file changed, 45 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c +index 7dc6fb7308ce..cba5a93e6082 100644 +--- a/drivers/gpu/drm/panel/panel-edp.c ++++ b/drivers/gpu/drm/panel/panel-edp.c +@@ -203,6 +203,9 @@ struct edp_panel_entry { + + /** @name: Name of this panel (for printing to logs). */ + const char *name; ++ ++ /** @override_edid_mode: Override the mode obtained by edid. */ ++ const struct drm_display_mode *override_edid_mode; + }; + + struct panel_edp { +@@ -301,6 +304,24 @@ static unsigned int panel_edp_get_display_modes(struct panel_edp *panel, + return num; + } + ++static int panel_edp_override_edid_mode(struct panel_edp *panel, ++ struct drm_connector *connector, ++ const struct drm_display_mode *override_mode) ++{ ++ struct drm_display_mode *mode; ++ ++ mode = drm_mode_duplicate(connector->dev, override_mode); ++ if (!mode) { ++ dev_err(panel->base.dev, "failed to add additional mode\n"); ++ return 0; ++ } ++ ++ mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; ++ drm_mode_set_name(mode); ++ drm_mode_probed_add(connector, mode); ++ return 1; ++} ++ + static int panel_edp_get_non_edid_modes(struct panel_edp *panel, + struct drm_connector *connector) + { +@@ -568,6 +589,9 @@ static int panel_edp_get_modes(struct drm_panel *panel, + { + struct panel_edp *p = to_panel_edp(panel); + int num = 0; ++ bool has_override_edid_mode = p->detected_panel && ++ p->detected_panel != ERR_PTR(-EINVAL) && ++ p->detected_panel->override_edid_mode; + + /* probe EDID if a DDC bus is available */ + if (p->ddc) { +@@ -575,9 +599,18 @@ static int panel_edp_get_modes(struct drm_panel *panel, + + if (!p->edid) + p->edid = drm_get_edid(connector, p->ddc); +- +- if (p->edid) +- num += drm_add_edid_modes(connector, p->edid); ++ if (p->edid) { ++ if (has_override_edid_mode) { ++ /* ++ * override_edid_mode is specified. Use ++ * override_edid_mode instead of from edid. ++ */ ++ num += panel_edp_override_edid_mode(p, connector, ++ p->detected_panel->override_edid_mode); ++ } else { ++ num += drm_add_edid_modes(connector, p->edid); ++ } ++ } + + pm_runtime_mark_last_busy(panel->dev); + pm_runtime_put_autosuspend(panel->dev); +@@ -1830,6 +1863,15 @@ static const struct panel_delay delay_200_500_e200 = { + .delay = _delay \ + } + ++#define EDP_PANEL_ENTRY2(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name, _mode) \ ++{ \ ++ .name = _name, \ ++ .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ ++ product_id), \ ++ .delay = _delay, \ ++ .override_edid_mode = _mode \ ++} ++ + /* + * This table is used to figure out power sequencing delays for panels that + * are detected by EDID. Entries here may point to entries in the +-- +2.43.0 + diff --git a/queue-6.6/drm-using-mul_u32_u32-requires-linux-math64.h.patch b/queue-6.6/drm-using-mul_u32_u32-requires-linux-math64.h.patch new file mode 100644 index 00000000000..adf91a44a29 --- /dev/null +++ b/queue-6.6/drm-using-mul_u32_u32-requires-linux-math64.h.patch @@ -0,0 +1,45 @@ +From b6e95f439451602056c84a368b1ec1ff12be5b51 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Dec 2023 14:57:34 +1100 +Subject: drm: using mul_u32_u32() requires linux/math64.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Stephen Rothwell + +[ Upstream commit 933a2a376fb3f22ba4774f74233571504ac56b02 ] + +Some pending include file cleanups produced this error: + +In file included from include/linux/kernel.h:27, + from drivers/gpu/ipu-v3/ipu-dp.c:7: +include/drm/drm_color_mgmt.h: In function 'drm_color_lut_extract': +include/drm/drm_color_mgmt.h:45:46: error: implicit declaration of function 'mul_u32_u32' [-Werror=implicit-function-declaration] + 45 | return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1), + | ^~~~~~~~~~~ + +Fixes: c6fbb6bca108 ("drm: Fix color LUT rounding") +Signed-off-by: Stephen Rothwell +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20231219145734.13e40e1e@canb.auug.org.au +Signed-off-by: Sasha Levin +--- + include/drm/drm_color_mgmt.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h +index 54b2b2467bfd..ed81741036d7 100644 +--- a/include/drm/drm_color_mgmt.h ++++ b/include/drm/drm_color_mgmt.h +@@ -24,6 +24,7 @@ + #define __DRM_COLOR_MGMT_H__ + + #include ++#include + #include + + struct drm_crtc; +-- +2.43.0 + diff --git a/queue-6.6/ecryptfs-reject-casefold-directory-inodes.patch b/queue-6.6/ecryptfs-reject-casefold-directory-inodes.patch new file mode 100644 index 00000000000..ff0c0329b61 --- /dev/null +++ b/queue-6.6/ecryptfs-reject-casefold-directory-inodes.patch @@ -0,0 +1,46 @@ +From 1068dc70825ffb4170e4954cbee11fb8a5d68cbc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Aug 2023 14:38:12 -0400 +Subject: ecryptfs: Reject casefold directory inodes + +From: Gabriel Krisman Bertazi + +[ Upstream commit cd72c7ef5fed44272272a105b1da22810c91be69 ] + +Even though it seems to be able to resolve some names of +case-insensitive directories, the lack of d_hash and d_compare means we +end up with a broken state in the d_cache. Considering it was never a +goal to support these two together, and we are preparing to use +d_revalidate in case-insensitive filesystems, which would make the +combination even more broken, reject any attempt to get a casefolded +inode from ecryptfs. + +Signed-off-by: Gabriel Krisman Bertazi +Reviewed-by: Eric Biggers +Signed-off-by: Sasha Levin +--- + fs/ecryptfs/inode.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c +index 5ab4b87888a7..795e9fe2f721 100644 +--- a/fs/ecryptfs/inode.c ++++ b/fs/ecryptfs/inode.c +@@ -78,6 +78,14 @@ static struct inode *__ecryptfs_get_inode(struct inode *lower_inode, + + if (lower_inode->i_sb != ecryptfs_superblock_to_lower(sb)) + return ERR_PTR(-EXDEV); ++ ++ /* Reject dealing with casefold directories. */ ++ if (IS_CASEFOLDED(lower_inode)) { ++ pr_err_ratelimited("%s: Can't handle casefolded directory.\n", ++ __func__); ++ return ERR_PTR(-EREMOTE); ++ } ++ + if (!igrab(lower_inode)) + return ERR_PTR(-ESTALE); + inode = iget5_locked(sb, (unsigned long)lower_inode, +-- +2.43.0 + diff --git a/queue-6.6/energy_model-use-a-fixed-reference-frequency.patch b/queue-6.6/energy_model-use-a-fixed-reference-frequency.patch new file mode 100644 index 00000000000..fa6ac03c038 --- /dev/null +++ b/queue-6.6/energy_model-use-a-fixed-reference-frequency.patch @@ -0,0 +1,63 @@ +From e623316e9248407abf51a873d059454f62e09c17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 11:48:52 +0100 +Subject: energy_model: Use a fixed reference frequency + +From: Vincent Guittot + +[ Upstream commit 15cbbd1d317e07b4e5c6aca5d4c5579539a82784 ] + +The last item of a performance domain is not always the performance point +that has been used to compute CPU's capacity. This can lead to different +target frequency compared with other part of the system like schedutil and +would result in wrong energy estimation. + +A new arch_scale_freq_ref() is available to return a fixed and coherent +frequency reference that can be used when computing the CPU's frequency +for an level of utilization. Use this function to get this reference +frequency. + +Energy model is never used without defining arch_scale_freq_ref() but +can be compiled. Define a default arch_scale_freq_ref() returning 0 +in such case. + +Signed-off-by: Vincent Guittot +Signed-off-by: Ingo Molnar +Tested-by: Lukasz Luba +Reviewed-by: Lukasz Luba +Link: https://lore.kernel.org/r/20231211104855.558096-5-vincent.guittot@linaro.org +Signed-off-by: Sasha Levin +--- + include/linux/energy_model.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h +index b9caa01dfac4..c19e7effe764 100644 +--- a/include/linux/energy_model.h ++++ b/include/linux/energy_model.h +@@ -224,7 +224,7 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, + unsigned long max_util, unsigned long sum_util, + unsigned long allowed_cpu_cap) + { +- unsigned long freq, scale_cpu; ++ unsigned long freq, ref_freq, scale_cpu; + struct em_perf_state *ps; + int cpu; + +@@ -241,11 +241,11 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, + */ + cpu = cpumask_first(to_cpumask(pd->cpus)); + scale_cpu = arch_scale_cpu_capacity(cpu); +- ps = &pd->table[pd->nr_perf_states - 1]; ++ ref_freq = arch_scale_freq_ref(cpu); + + max_util = map_util_perf(max_util); + max_util = min(max_util, allowed_cpu_cap); +- freq = map_util_freq(max_util, ps->frequency, scale_cpu); ++ freq = map_util_freq(max_util, ref_freq, scale_cpu); + + /* + * Find the lowest performance state of the Energy Model above the +-- +2.43.0 + diff --git a/queue-6.6/erofs-fix-up-compacted-indexes-for-block-size-4096.patch b/queue-6.6/erofs-fix-up-compacted-indexes-for-block-size-4096.patch new file mode 100644 index 00000000000..55f67e681ef --- /dev/null +++ b/queue-6.6/erofs-fix-up-compacted-indexes-for-block-size-4096.patch @@ -0,0 +1,147 @@ +From dc4e9369ebff3d367907099ad4ca70ccec3de8dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 17:10:55 +0800 +Subject: erofs: fix up compacted indexes for block size < 4096 + +From: Gao Xiang + +[ Upstream commit 8d2517aaeea3ab8651bb517bca8f3c8664d318ea ] + +Previously, the block size always equaled to PAGE_SIZE, therefore +`lclusterbits` couldn't be less than 12. + +Since sub-page compressed blocks are now considered, `lobits` for +a lcluster in each pack cannot always be `lclusterbits` as before. +Otherwise, there is no enough room for the special value +`Z_EROFS_LI_D0_CBLKCNT`. + +To support smaller block sizes, `lobits` for each compacted lcluster is +now calculated as: + lobits = max(lclusterbits, ilog2(Z_EROFS_LI_D0_CBLKCNT) + 1) + +Reviewed-by: Yue Hu +Reviewed-by: Chao Yu +Signed-off-by: Gao Xiang +Link: https://lore.kernel.org/r/20231206091057.87027-4-hsiangkao@linux.alibaba.com +Signed-off-by: Sasha Levin +--- + fs/erofs/zmap.c | 32 ++++++++++++++------------------ + 1 file changed, 14 insertions(+), 18 deletions(-) + +diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c +index 7a1a24ae4a2d..e313c936351d 100644 +--- a/fs/erofs/zmap.c ++++ b/fs/erofs/zmap.c +@@ -82,29 +82,26 @@ static int z_erofs_load_full_lcluster(struct z_erofs_maprecorder *m, + } + + static unsigned int decode_compactedbits(unsigned int lobits, +- unsigned int lomask, + u8 *in, unsigned int pos, u8 *type) + { + const unsigned int v = get_unaligned_le32(in + pos / 8) >> (pos & 7); +- const unsigned int lo = v & lomask; ++ const unsigned int lo = v & ((1 << lobits) - 1); + + *type = (v >> lobits) & 3; + return lo; + } + +-static int get_compacted_la_distance(unsigned int lclusterbits, ++static int get_compacted_la_distance(unsigned int lobits, + unsigned int encodebits, + unsigned int vcnt, u8 *in, int i) + { +- const unsigned int lomask = (1 << lclusterbits) - 1; + unsigned int lo, d1 = 0; + u8 type; + + DBG_BUGON(i >= vcnt); + + do { +- lo = decode_compactedbits(lclusterbits, lomask, +- in, encodebits * i, &type); ++ lo = decode_compactedbits(lobits, in, encodebits * i, &type); + + if (type != Z_EROFS_LCLUSTER_TYPE_NONHEAD) + return d1; +@@ -123,15 +120,14 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, + { + struct erofs_inode *const vi = EROFS_I(m->inode); + const unsigned int lclusterbits = vi->z_logical_clusterbits; +- const unsigned int lomask = (1 << lclusterbits) - 1; +- unsigned int vcnt, base, lo, encodebits, nblk, eofs; ++ unsigned int vcnt, base, lo, lobits, encodebits, nblk, eofs; + int i; + u8 *in, type; + bool big_pcluster; + + if (1 << amortizedshift == 4 && lclusterbits <= 14) + vcnt = 2; +- else if (1 << amortizedshift == 2 && lclusterbits == 12) ++ else if (1 << amortizedshift == 2 && lclusterbits <= 12) + vcnt = 16; + else + return -EOPNOTSUPP; +@@ -140,6 +136,7 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, + m->nextpackoff = round_down(pos, vcnt << amortizedshift) + + (vcnt << amortizedshift); + big_pcluster = vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1; ++ lobits = max(lclusterbits, ilog2(Z_EROFS_LI_D0_CBLKCNT) + 1U); + encodebits = ((vcnt << amortizedshift) - sizeof(__le32)) * 8 / vcnt; + eofs = erofs_blkoff(m->inode->i_sb, pos); + base = round_down(eofs, vcnt << amortizedshift); +@@ -147,15 +144,14 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, + + i = (eofs - base) >> amortizedshift; + +- lo = decode_compactedbits(lclusterbits, lomask, +- in, encodebits * i, &type); ++ lo = decode_compactedbits(lobits, in, encodebits * i, &type); + m->type = type; + if (type == Z_EROFS_LCLUSTER_TYPE_NONHEAD) { + m->clusterofs = 1 << lclusterbits; + + /* figure out lookahead_distance: delta[1] if needed */ + if (lookahead) +- m->delta[1] = get_compacted_la_distance(lclusterbits, ++ m->delta[1] = get_compacted_la_distance(lobits, + encodebits, vcnt, in, i); + if (lo & Z_EROFS_LI_D0_CBLKCNT) { + if (!big_pcluster) { +@@ -174,8 +170,8 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, + * of which lo saves delta[1] rather than delta[0]. + * Hence, get delta[0] by the previous lcluster indirectly. + */ +- lo = decode_compactedbits(lclusterbits, lomask, +- in, encodebits * (i - 1), &type); ++ lo = decode_compactedbits(lobits, in, ++ encodebits * (i - 1), &type); + if (type != Z_EROFS_LCLUSTER_TYPE_NONHEAD) + lo = 0; + else if (lo & Z_EROFS_LI_D0_CBLKCNT) +@@ -190,8 +186,8 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, + nblk = 1; + while (i > 0) { + --i; +- lo = decode_compactedbits(lclusterbits, lomask, +- in, encodebits * i, &type); ++ lo = decode_compactedbits(lobits, in, ++ encodebits * i, &type); + if (type == Z_EROFS_LCLUSTER_TYPE_NONHEAD) + i -= lo; + +@@ -202,8 +198,8 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, + nblk = 0; + while (i > 0) { + --i; +- lo = decode_compactedbits(lclusterbits, lomask, +- in, encodebits * i, &type); ++ lo = decode_compactedbits(lobits, in, ++ encodebits * i, &type); + if (type == Z_EROFS_LCLUSTER_TYPE_NONHEAD) { + if (lo & Z_EROFS_LI_D0_CBLKCNT) { + --i; +-- +2.43.0 + diff --git a/queue-6.6/erofs-fix-ztailpacking-for-subpage-compressed-blocks.patch b/queue-6.6/erofs-fix-ztailpacking-for-subpage-compressed-blocks.patch new file mode 100644 index 00000000000..d0b06715b78 --- /dev/null +++ b/queue-6.6/erofs-fix-ztailpacking-for-subpage-compressed-blocks.patch @@ -0,0 +1,44 @@ +From 620fc5799ce192df0a70bcbdaa01827be56f47af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Dec 2023 00:13:37 +0800 +Subject: erofs: fix ztailpacking for subpage compressed blocks + +From: Gao Xiang + +[ Upstream commit e5aba911dee5e20fa82efbe13e0af8f38ea459e7 ] + +`pageofs_in` should be the compressed data offset of the page rather +than of the block. + +Acked-by: Chao Yu +Reviewed-by: Yue Hu +Signed-off-by: Gao Xiang +Link: https://lore.kernel.org/r/20231214161337.753049-1-hsiangkao@linux.alibaba.com +Signed-off-by: Sasha Levin +--- + fs/erofs/zdata.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c +index a33cd6757f98..1c0e6167d8e7 100644 +--- a/fs/erofs/zdata.c ++++ b/fs/erofs/zdata.c +@@ -815,7 +815,6 @@ static int z_erofs_register_pcluster(struct z_erofs_decompress_frontend *fe) + + if (ztailpacking) { + pcl->obj.index = 0; /* which indicates ztailpacking */ +- pcl->pageofs_in = erofs_blkoff(fe->inode->i_sb, map->m_pa); + pcl->tailpacking_size = map->m_plen; + } else { + pcl->obj.index = map->m_pa >> PAGE_SHIFT; +@@ -893,6 +892,7 @@ static int z_erofs_pcluster_begin(struct z_erofs_decompress_frontend *fe) + } + get_page(map->buf.page); + WRITE_ONCE(fe->pcl->compressed_bvecs[0].page, map->buf.page); ++ fe->pcl->pageofs_in = map->m_pa & ~PAGE_MASK; + fe->mode = Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE; + } + /* file-backed inplace I/O pages are traversed in reverse order */ +-- +2.43.0 + diff --git a/queue-6.6/ext4-avoid-online-resizing-failures-due-to-oversized.patch b/queue-6.6/ext4-avoid-online-resizing-failures-due-to-oversized.patch new file mode 100644 index 00000000000..1d0f9850563 --- /dev/null +++ b/queue-6.6/ext4-avoid-online-resizing-failures-due-to-oversized.patch @@ -0,0 +1,133 @@ +From 600f47e06b57d332b2349aa974f866ea8fc12dc3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Oct 2023 09:30:56 +0800 +Subject: ext4: avoid online resizing failures due to oversized flex bg +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Baokun Li + +[ Upstream commit 5d1935ac02ca5aee364a449a35e2977ea84509b0 ] + +When we online resize an ext4 filesystem with a oversized flexbg_size, + + mkfs.ext4 -F -G 67108864 $dev -b 4096 100M + mount $dev $dir + resize2fs $dev 16G + +the following WARN_ON is triggered: +================================================================== +WARNING: CPU: 0 PID: 427 at mm/page_alloc.c:4402 __alloc_pages+0x411/0x550 +Modules linked in: sg(E) +CPU: 0 PID: 427 Comm: resize2fs Tainted: G E 6.6.0-rc5+ #314 +RIP: 0010:__alloc_pages+0x411/0x550 +Call Trace: + + __kmalloc_large_node+0xa2/0x200 + __kmalloc+0x16e/0x290 + ext4_resize_fs+0x481/0xd80 + __ext4_ioctl+0x1616/0x1d90 + ext4_ioctl+0x12/0x20 + __x64_sys_ioctl+0xf0/0x150 + do_syscall_64+0x3b/0x90 +================================================================== + +This is because flexbg_size is too large and the size of the new_group_data +array to be allocated exceeds MAX_ORDER. Currently, the minimum value of +MAX_ORDER is 8, the minimum value of PAGE_SIZE is 4096, the corresponding +maximum number of groups that can be allocated is: + + (PAGE_SIZE << MAX_ORDER) / sizeof(struct ext4_new_group_data) ≈ 21845 + +And the value that is down-aligned to the power of 2 is 16384. Therefore, +this value is defined as MAX_RESIZE_BG, and the number of groups added +each time does not exceed this value during resizing, and is added multiple +times to complete the online resizing. The difference is that the metadata +in a flex_bg may be more dispersed. + +Signed-off-by: Baokun Li +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/20231023013057.2117948-4-libaokun1@huawei.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/resize.c | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c +index df47b269efce..be280268da9f 100644 +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -231,10 +231,17 @@ struct ext4_new_flex_group_data { + in the flex group */ + __u16 *bg_flags; /* block group flags of groups + in @groups */ ++ ext4_group_t resize_bg; /* number of allocated ++ new_group_data */ + ext4_group_t count; /* number of groups in @groups + */ + }; + ++/* ++ * Avoiding memory allocation failures due to too many groups added each time. ++ */ ++#define MAX_RESIZE_BG 16384 ++ + /* + * alloc_flex_gd() allocates a ext4_new_flex_group_data with size of + * @flexbg_size. +@@ -249,14 +256,18 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size) + if (flex_gd == NULL) + goto out3; + +- flex_gd->count = flexbg_size; +- flex_gd->groups = kmalloc_array(flexbg_size, ++ if (unlikely(flexbg_size > MAX_RESIZE_BG)) ++ flex_gd->resize_bg = MAX_RESIZE_BG; ++ else ++ flex_gd->resize_bg = flexbg_size; ++ ++ flex_gd->groups = kmalloc_array(flex_gd->resize_bg, + sizeof(struct ext4_new_group_data), + GFP_NOFS); + if (flex_gd->groups == NULL) + goto out2; + +- flex_gd->bg_flags = kmalloc_array(flexbg_size, sizeof(__u16), ++ flex_gd->bg_flags = kmalloc_array(flex_gd->resize_bg, sizeof(__u16), + GFP_NOFS); + if (flex_gd->bg_flags == NULL) + goto out1; +@@ -1619,8 +1630,7 @@ static int ext4_flex_group_add(struct super_block *sb, + + static int ext4_setup_next_flex_gd(struct super_block *sb, + struct ext4_new_flex_group_data *flex_gd, +- ext4_fsblk_t n_blocks_count, +- unsigned int flexbg_size) ++ ext4_fsblk_t n_blocks_count) + { + struct ext4_sb_info *sbi = EXT4_SB(sb); + struct ext4_super_block *es = sbi->s_es; +@@ -1644,7 +1654,7 @@ static int ext4_setup_next_flex_gd(struct super_block *sb, + BUG_ON(last); + ext4_get_group_no_and_offset(sb, n_blocks_count - 1, &n_group, &last); + +- last_group = group | (flexbg_size - 1); ++ last_group = group | (flex_gd->resize_bg - 1); + if (last_group > n_group) + last_group = n_group; + +@@ -2147,8 +2157,7 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) + /* Add flex groups. Note that a regular group is a + * flex group with 1 group. + */ +- while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count, +- flexbg_size)) { ++ while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count)) { + if (time_is_before_jiffies(last_update_time + HZ * 10)) { + if (last_update_time) + ext4_msg(sb, KERN_INFO, +-- +2.43.0 + diff --git a/queue-6.6/ext4-fix-inconsistent-between-segment-fstrim-and-ful.patch b/queue-6.6/ext4-fix-inconsistent-between-segment-fstrim-and-ful.patch new file mode 100644 index 00000000000..ebe59cdf162 --- /dev/null +++ b/queue-6.6/ext4-fix-inconsistent-between-segment-fstrim-and-ful.patch @@ -0,0 +1,66 @@ +From 4d9d59767c62317c2821caea7451b3d1d8608ce6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 16 Dec 2023 09:09:19 +0800 +Subject: ext4: fix inconsistent between segment fstrim and full fstrim + +From: Ye Bin + +[ Upstream commit 68da4c44b994aea797eb9821acb3a4a36015293e ] + +Suppose we issue two FITRIM ioctls for ranges [0,15] and [16,31] with +mininum length of trimmed range set to 8 blocks. If we have say a range of +blocks 10-22 free, this range will not be trimmed because it straddles the +boundary of the two FITRIM ranges and neither part is big enough. This is a +bit surprising to some users that call FITRIM on smaller ranges of blocks +to limit impact on the system. Also XFS trims all free space extents that +overlap with the specified range so we are inconsistent among filesystems. +Let's change ext4_try_to_trim_range() to consider for trimming the whole +free space extent that straddles the end of specified range, not just the +part of it within the range. + +Signed-off-by: Ye Bin +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/20231216010919.1995851-1-yebin10@huawei.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/mballoc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c +index 9a4b73485ded..1fd4ed19060d 100644 +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -6910,13 +6910,15 @@ static int ext4_try_to_trim_range(struct super_block *sb, + __acquires(ext4_group_lock_ptr(sb, e4b->bd_group)) + __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) + { +- ext4_grpblk_t next, count, free_count; ++ ext4_grpblk_t next, count, free_count, last, origin_start; + bool set_trimmed = false; + void *bitmap; + ++ last = ext4_last_grp_cluster(sb, e4b->bd_group); + bitmap = e4b->bd_bitmap; +- if (start == 0 && max >= ext4_last_grp_cluster(sb, e4b->bd_group)) ++ if (start == 0 && max >= last) + set_trimmed = true; ++ origin_start = start; + start = max(e4b->bd_info->bb_first_free, start); + count = 0; + free_count = 0; +@@ -6925,7 +6927,10 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) + start = mb_find_next_zero_bit(bitmap, max + 1, start); + if (start > max) + break; +- next = mb_find_next_bit(bitmap, max + 1, start); ++ ++ next = mb_find_next_bit(bitmap, last + 1, start); ++ if (origin_start == 0 && next >= last) ++ set_trimmed = true; + + if ((next - start) >= minblocks) { + int ret = ext4_trim_extent(sb, start, next - start, e4b); +-- +2.43.0 + diff --git a/queue-6.6/ext4-remove-unnecessary-check-from-alloc_flex_gd.patch b/queue-6.6/ext4-remove-unnecessary-check-from-alloc_flex_gd.patch new file mode 100644 index 00000000000..a231021363f --- /dev/null +++ b/queue-6.6/ext4-remove-unnecessary-check-from-alloc_flex_gd.patch @@ -0,0 +1,44 @@ +From cdd7e214c602bf6f2347631de2b0ac010ae93f77 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Oct 2023 09:30:55 +0800 +Subject: ext4: remove unnecessary check from alloc_flex_gd() + +From: Baokun Li + +[ Upstream commit b099eb87de105cf07cad731ded6fb40b2675108b ] + +In commit 967ac8af4475 ("ext4: fix potential integer overflow in +alloc_flex_gd()"), an overflow check is added to alloc_flex_gd() to +prevent the allocated memory from being smaller than expected due to +the overflow. However, after kmalloc() is replaced with kmalloc_array() +in commit 6da2ec56059c ("treewide: kmalloc() -> kmalloc_array()"), the +kmalloc_array() function has an overflow check, so the above problem +will not occur. Therefore, the extra check is removed. + +Signed-off-by: Baokun Li +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/20231023013057.2117948-3-libaokun1@huawei.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/resize.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c +index f3a9b97bb7e7..df47b269efce 100644 +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -249,10 +249,7 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size) + if (flex_gd == NULL) + goto out3; + +- if (flexbg_size >= UINT_MAX / sizeof(struct ext4_new_group_data)) +- goto out2; + flex_gd->count = flexbg_size; +- + flex_gd->groups = kmalloc_array(flexbg_size, + sizeof(struct ext4_new_group_data), + GFP_NOFS); +-- +2.43.0 + diff --git a/queue-6.6/ext4-treat-end-of-range-as-exclusive-in-ext4_zero_ra.patch b/queue-6.6/ext4-treat-end-of-range-as-exclusive-in-ext4_zero_ra.patch new file mode 100644 index 00000000000..fc4addde255 --- /dev/null +++ b/queue-6.6/ext4-treat-end-of-range-as-exclusive-in-ext4_zero_ra.patch @@ -0,0 +1,48 @@ +From 069a47137df3efff1c09b046a9929cb3d29017ea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Nov 2023 22:08:10 +0530 +Subject: ext4: treat end of range as exclusive in ext4_zero_range() + +From: Ojaswin Mujoo + +[ Upstream commit 92573369144f40397e8514440afdf59f24905b40 ] + +The call to filemap_write_and_wait_range() assumes the range passed to be +inclusive, so fix the call to make sure we follow that. + +Signed-off-by: Ojaswin Mujoo +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/e503107a7c73a2b68dec645c5ad798c437717c45.1698856309.git.ojaswin@linux.ibm.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/extents.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c +index 4d8496d1a8ac..4c3e2f38349d 100644 +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -4522,7 +4522,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, + * Round up offset. This is not fallocate, we need to zero out + * blocks, so convert interior block aligned part of the range to + * unwritten and possibly manually zero out unaligned parts of the +- * range. ++ * range. Here, start and partial_begin are inclusive, end and ++ * partial_end are exclusive. + */ + start = round_up(offset, 1 << blkbits); + end = round_down((offset + len), 1 << blkbits); +@@ -4608,7 +4609,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, + * disk in case of crash before zeroing trans is committed. + */ + if (ext4_should_journal_data(inode)) { +- ret = filemap_write_and_wait_range(mapping, start, end); ++ ret = filemap_write_and_wait_range(mapping, start, ++ end - 1); + if (ret) { + filemap_invalidate_unlock(mapping); + goto out_mutex; +-- +2.43.0 + diff --git a/queue-6.6/ext4-unify-the-type-of-flexbg_size-to-unsigned-int.patch b/queue-6.6/ext4-unify-the-type-of-flexbg_size-to-unsigned-int.patch new file mode 100644 index 00000000000..548710e0a0b --- /dev/null +++ b/queue-6.6/ext4-unify-the-type-of-flexbg_size-to-unsigned-int.patch @@ -0,0 +1,89 @@ +From d7ce7ed798d5ec40063a1e01e661e83c2516320f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Oct 2023 09:30:54 +0800 +Subject: ext4: unify the type of flexbg_size to unsigned int + +From: Baokun Li + +[ Upstream commit 658a52344fb139f9531e7543a6e0015b630feb38 ] + +The maximum value of flexbg_size is 2^31, but the maximum value of int +is (2^31 - 1), so overflow may occur when the type of flexbg_size is +declared as int. + +For example, when uninit_mask is initialized in ext4_alloc_group_tables(), +if flexbg_size == 2^31, the initialized uninit_mask is incorrect, and this +may causes set_flexbg_block_bitmap() to trigger a BUG_ON(). + +Therefore, the flexbg_size type is declared as unsigned int to avoid +overflow and memory waste. + +Signed-off-by: Baokun Li +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/20231023013057.2117948-2-libaokun1@huawei.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/resize.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c +index 667381180b26..f3a9b97bb7e7 100644 +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -241,7 +241,7 @@ struct ext4_new_flex_group_data { + * + * Returns NULL on failure otherwise address of the allocated structure. + */ +-static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned long flexbg_size) ++static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size) + { + struct ext4_new_flex_group_data *flex_gd; + +@@ -296,7 +296,7 @@ static void free_flex_gd(struct ext4_new_flex_group_data *flex_gd) + */ + static int ext4_alloc_group_tables(struct super_block *sb, + struct ext4_new_flex_group_data *flex_gd, +- int flexbg_size) ++ unsigned int flexbg_size) + { + struct ext4_new_group_data *group_data = flex_gd->groups; + ext4_fsblk_t start_blk; +@@ -397,12 +397,12 @@ static int ext4_alloc_group_tables(struct super_block *sb, + group = group_data[0].group; + + printk(KERN_DEBUG "EXT4-fs: adding a flex group with " +- "%d groups, flexbg size is %d:\n", flex_gd->count, ++ "%u groups, flexbg size is %u:\n", flex_gd->count, + flexbg_size); + + for (i = 0; i < flex_gd->count; i++) { + ext4_debug( +- "adding %s group %u: %u blocks (%d free, %d mdata blocks)\n", ++ "adding %s group %u: %u blocks (%u free, %u mdata blocks)\n", + ext4_bg_has_super(sb, group + i) ? "normal" : + "no-super", group + i, + group_data[i].blocks_count, +@@ -1623,7 +1623,7 @@ static int ext4_flex_group_add(struct super_block *sb, + static int ext4_setup_next_flex_gd(struct super_block *sb, + struct ext4_new_flex_group_data *flex_gd, + ext4_fsblk_t n_blocks_count, +- unsigned long flexbg_size) ++ unsigned int flexbg_size) + { + struct ext4_sb_info *sbi = EXT4_SB(sb); + struct ext4_super_block *es = sbi->s_es; +@@ -2007,8 +2007,9 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) + ext4_fsblk_t o_blocks_count; + ext4_fsblk_t n_blocks_count_retry = 0; + unsigned long last_update_time = 0; +- int err = 0, flexbg_size = 1 << sbi->s_log_groups_per_flex; ++ int err = 0; + int meta_bg; ++ unsigned int flexbg_size = ext4_flex_bg_size(sbi); + + /* See if the device is actually as big as what was requested */ + bh = ext4_sb_bread(sb, n_blocks_count - 1, 0); +-- +2.43.0 + diff --git a/queue-6.6/extcon-fix-possible-name-leak-in-extcon_dev_register.patch b/queue-6.6/extcon-fix-possible-name-leak-in-extcon_dev_register.patch new file mode 100644 index 00000000000..d30c2635c3b --- /dev/null +++ b/queue-6.6/extcon-fix-possible-name-leak-in-extcon_dev_register.patch @@ -0,0 +1,45 @@ +From 133a36c1285e84e7443654fb338d37fe7aae26c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Nov 2023 09:49:13 +0800 +Subject: extcon: fix possible name leak in extcon_dev_register() + +From: Yaxiong Tian + +[ Upstream commit e66523c72c9aae0ff0dae6859eb77b04de1e8e5f ] + +In the error path after calling dev_set_name(), the device +name is leaked. To fix this, moving dev_set_name() after the +error path and before device_register. + +Link: https://lore.kernel.org/lkml/TYZPR01MB4784ADCD3E951E0863F3DB72D5B8A@TYZPR01MB4784.apcprd01.prod.exchangelabs.com/ +Signed-off-by: Yaxiong Tian +Signed-off-by: Chanwoo Choi +Signed-off-by: Sasha Levin +--- + drivers/extcon/extcon.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c +index 6f7a60d2ed91..e7f55c021e56 100644 +--- a/drivers/extcon/extcon.c ++++ b/drivers/extcon/extcon.c +@@ -1280,8 +1280,6 @@ int extcon_dev_register(struct extcon_dev *edev) + + edev->id = ret; + +- dev_set_name(&edev->dev, "extcon%d", edev->id); +- + ret = extcon_alloc_cables(edev); + if (ret < 0) + goto err_alloc_cables; +@@ -1310,6 +1308,7 @@ int extcon_dev_register(struct extcon_dev *edev) + RAW_INIT_NOTIFIER_HEAD(&edev->nh_all); + + dev_set_drvdata(&edev->dev, edev); ++ dev_set_name(&edev->dev, "extcon%d", edev->id); + edev->state = 0; + + ret = device_register(&edev->dev); +-- +2.43.0 + diff --git a/queue-6.6/f2fs-fix-to-check-return-value-of-f2fs_reserve_new_b.patch b/queue-6.6/f2fs-fix-to-check-return-value-of-f2fs_reserve_new_b.patch new file mode 100644 index 00000000000..eace538d9c7 --- /dev/null +++ b/queue-6.6/f2fs-fix-to-check-return-value-of-f2fs_reserve_new_b.patch @@ -0,0 +1,69 @@ +From f8b1a7fc66cee7a449d36d33d57fe07ff6ad9a55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Nov 2023 14:25:56 +0800 +Subject: f2fs: fix to check return value of f2fs_reserve_new_block() + +From: Chao Yu + +[ Upstream commit 956fa1ddc132e028f3b7d4cf17e6bfc8cb36c7fd ] + +Let's check return value of f2fs_reserve_new_block() in do_recover_data() +rather than letting it fails silently. + +Also refactoring check condition on return value of f2fs_reserve_new_block() +as below: +- trigger f2fs_bug_on() only for ENOSPC case; +- use do-while statement to avoid redundant codes; + +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/recovery.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c +index 7be60df277a5..f0de36ef73c2 100644 +--- a/fs/f2fs/recovery.c ++++ b/fs/f2fs/recovery.c +@@ -712,7 +712,16 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, + */ + if (dest == NEW_ADDR) { + f2fs_truncate_data_blocks_range(&dn, 1); +- f2fs_reserve_new_block(&dn); ++ do { ++ err = f2fs_reserve_new_block(&dn); ++ if (err == -ENOSPC) { ++ f2fs_bug_on(sbi, 1); ++ break; ++ } ++ } while (err && ++ IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION)); ++ if (err) ++ goto err; + continue; + } + +@@ -720,12 +729,14 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, + if (f2fs_is_valid_blkaddr(sbi, dest, META_POR)) { + + if (src == NULL_ADDR) { +- err = f2fs_reserve_new_block(&dn); +- while (err && +- IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION)) ++ do { + err = f2fs_reserve_new_block(&dn); +- /* We should not get -ENOSPC */ +- f2fs_bug_on(sbi, err); ++ if (err == -ENOSPC) { ++ f2fs_bug_on(sbi, 1); ++ break; ++ } ++ } while (err && ++ IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION)); + if (err) + goto err; + } +-- +2.43.0 + diff --git a/queue-6.6/f2fs-fix-to-tag-gcing-flag-on-page-during-block-migr.patch b/queue-6.6/f2fs-fix-to-tag-gcing-flag-on-page-during-block-migr.patch new file mode 100644 index 00000000000..030d481e7c4 --- /dev/null +++ b/queue-6.6/f2fs-fix-to-tag-gcing-flag-on-page-during-block-migr.patch @@ -0,0 +1,64 @@ +From 4e750cfb2eb7e8fc57e940d9ea623bc8bf28d220 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 10 Dec 2023 19:35:42 +0800 +Subject: f2fs: fix to tag gcing flag on page during block migration + +From: Chao Yu + +[ Upstream commit 4961acdd65c956e97c1a000c82d91a8c1cdbe44b ] + +It needs to add missing gcing flag on page during block migration, +in order to garantee migrated data be persisted during checkpoint, +otherwise out-of-order persistency between data and node may cause +data corruption after SPOR. + +Similar issue was fixed by commit 2d1fe8a86bf5 ("f2fs: fix to tag +gcing flag on page during file defragment"). + +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/compress.c | 4 +++- + fs/f2fs/file.c | 2 ++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c +index 7514661bbfbb..372616ca8fb5 100644 +--- a/fs/f2fs/compress.c ++++ b/fs/f2fs/compress.c +@@ -1029,8 +1029,10 @@ static void set_cluster_dirty(struct compress_ctx *cc) + int i; + + for (i = 0; i < cc->cluster_size; i++) +- if (cc->rpages[i]) ++ if (cc->rpages[i]) { + set_page_dirty(cc->rpages[i]); ++ set_page_private_gcing(cc->rpages[i]); ++ } + } + + static int prepare_compress_overwrite(struct compress_ctx *cc, +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index a631d706e117..dcf2d926ab59 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -1317,6 +1317,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, + } + memcpy_page(pdst, 0, psrc, 0, PAGE_SIZE); + set_page_dirty(pdst); ++ set_page_private_gcing(pdst); + f2fs_put_page(pdst, 1); + f2fs_put_page(psrc, 1); + +@@ -4059,6 +4060,7 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) + f2fs_bug_on(F2FS_I_SB(inode), !page); + + set_page_dirty(page); ++ set_page_private_gcing(page); + f2fs_put_page(page, 1); + f2fs_put_page(page, 0); + } +-- +2.43.0 + diff --git a/queue-6.6/f2fs-fix-write-pointers-on-zoned-device-after-roll-f.patch b/queue-6.6/f2fs-fix-write-pointers-on-zoned-device-after-roll-f.patch new file mode 100644 index 00000000000..f6cef59edfa --- /dev/null +++ b/queue-6.6/f2fs-fix-write-pointers-on-zoned-device-after-roll-f.patch @@ -0,0 +1,37 @@ +From 856160f0ff562b561483bcc95dbf770e8671dcf2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 2 Dec 2023 00:08:57 -0800 +Subject: f2fs: fix write pointers on zoned device after roll forward + +From: Jaegeuk Kim + +[ Upstream commit 9dad4d964291295ef48243d4e03972b85138bc9f ] + +1. do roll forward recovery +2. update current segments pointers +3. fix the entire zones' write pointers +4. do checkpoint + +Reviewed-by: Daeho Jeong +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/recovery.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c +index f0de36ef73c2..c8ba9f1551b6 100644 +--- a/fs/f2fs/recovery.c ++++ b/fs/f2fs/recovery.c +@@ -917,6 +917,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) + if (!err && fix_curseg_write_pointer && !f2fs_readonly(sbi->sb) && + f2fs_sb_has_blkzoned(sbi)) { + err = f2fs_fix_curseg_write_pointer(sbi); ++ if (!err) ++ err = f2fs_check_write_pointer(sbi); + ret = err; + } + +-- +2.43.0 + diff --git a/queue-6.6/fast_dput-handle-underflows-gracefully.patch b/queue-6.6/fast_dput-handle-underflows-gracefully.patch new file mode 100644 index 00000000000..fac5dc06002 --- /dev/null +++ b/queue-6.6/fast_dput-handle-underflows-gracefully.patch @@ -0,0 +1,78 @@ +From 6327984cea5ce66387cbc04654a33cee4f96e93e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Nov 2023 01:08:54 -0400 +Subject: fast_dput(): handle underflows gracefully + +From: Al Viro + +[ Upstream commit 504e08cebe1d4e1efe25f915234f646e74a364a8 ] + +If refcount is less than 1, we should just warn, unlock dentry and +return true, so that the caller doesn't try to do anything else. + +Taking care of that leaves the rest of "lockref_put_return() has +failed" case equivalent to "decrement refcount and rejoin the +normal slow path after the point where we grab ->d_lock". + +NOTE: lockref_put_return() is strictly a fastpath thing - unlike +the rest of lockref primitives, it does not contain a fallback. +Caller (and it looks like fast_dput() is the only legitimate one +in the entire kernel) has to do that itself. Reasons for +lockref_put_return() failures: + * ->d_lock held by somebody + * refcount <= 0 + * ... or an architecture not supporting lockref use of +cmpxchg - sparc, anything non-SMP, config with spinlock debugging... + +We could add a fallback, but it would be a clumsy API - we'd have +to distinguish between: + (1) refcount > 1 - decremented, lock not held on return + (2) refcount < 1 - left alone, probably no sense to hold the lock + (3) refcount is 1, no cmphxcg - decremented, lock held on return + (4) refcount is 1, cmphxcg supported - decremented, lock *NOT* held + on return. +We want to return with no lock held in case (4); that's the whole point of that +thing. We very much do not want to have the fallback in case (3) return without +a lock, since the caller might have to retake it in that case. +So it wouldn't be more convenient than doing the fallback in the caller and +it would be very easy to screw up, especially since the test coverage would +suck - no way to test (3) and (4) on the same kernel build. + +Reviewed-by: Christian Brauner +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + fs/dcache.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/fs/dcache.c b/fs/dcache.c +index 25ac74d30bff..9ae808fba517 100644 +--- a/fs/dcache.c ++++ b/fs/dcache.c +@@ -787,12 +787,12 @@ static inline bool fast_dput(struct dentry *dentry) + */ + if (unlikely(ret < 0)) { + spin_lock(&dentry->d_lock); +- if (dentry->d_lockref.count > 1) { +- dentry->d_lockref.count--; ++ if (WARN_ON_ONCE(dentry->d_lockref.count <= 0)) { + spin_unlock(&dentry->d_lock); + return true; + } +- return false; ++ dentry->d_lockref.count--; ++ goto locked; + } + + /* +@@ -850,6 +850,7 @@ static inline bool fast_dput(struct dentry *dentry) + * else could have killed it and marked it dead. Either way, we + * don't need to do anything else. + */ ++locked: + if (dentry->d_lockref.count) { + spin_unlock(&dentry->d_lock); + return true; +-- +2.43.0 + diff --git a/queue-6.6/fs-jfs-ubsan-array-index-out-of-bounds-in-dbadjtree.patch b/queue-6.6/fs-jfs-ubsan-array-index-out-of-bounds-in-dbadjtree.patch new file mode 100644 index 00000000000..1f17e674827 --- /dev/null +++ b/queue-6.6/fs-jfs-ubsan-array-index-out-of-bounds-in-dbadjtree.patch @@ -0,0 +1,99 @@ +From e37c4a58d9292d7eac5acf71ebfc12e392c51610 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Oct 2023 23:46:37 +0500 +Subject: FS:JFS:UBSAN:array-index-out-of-bounds in dbAdjTree + +From: Osama Muhammad + +[ Upstream commit 9862ec7ac1cbc6eb5ee4a045b5d5b8edbb2f7e68 ] + +Syzkaller reported the following issue: + +UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:6 +index 196694 is out of range for type 's8[1365]' (aka 'signed char[1365]') +CPU: 1 PID: 109 Comm: jfsCommit Not tainted 6.6.0-rc3-syzkaller #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 +Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 + ubsan_epilogue lib/ubsan.c:217 [inline] + __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348 + dbAdjTree+0x474/0x4f0 fs/jfs/jfs_dmap.c:2867 + dbJoin+0x210/0x2d0 fs/jfs/jfs_dmap.c:2834 + dbFreeBits+0x4eb/0xda0 fs/jfs/jfs_dmap.c:2331 + dbFreeDmap fs/jfs/jfs_dmap.c:2080 [inline] + dbFree+0x343/0x650 fs/jfs/jfs_dmap.c:402 + txFreeMap+0x798/0xd50 fs/jfs/jfs_txnmgr.c:2534 + txUpdateMap+0x342/0x9e0 + txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] + jfs_lazycommit+0x47a/0xb70 fs/jfs/jfs_txnmgr.c:2732 + kthread+0x2d3/0x370 kernel/kthread.c:388 + ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 + ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 + +================================================================================ +Kernel panic - not syncing: UBSAN: panic_on_warn set ... +CPU: 1 PID: 109 Comm: jfsCommit Not tainted 6.6.0-rc3-syzkaller #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 +Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 + panic+0x30f/0x770 kernel/panic.c:340 + check_panic_on_warn+0x82/0xa0 kernel/panic.c:236 + ubsan_epilogue lib/ubsan.c:223 [inline] + __ubsan_handle_out_of_bounds+0x13c/0x150 lib/ubsan.c:348 + dbAdjTree+0x474/0x4f0 fs/jfs/jfs_dmap.c:2867 + dbJoin+0x210/0x2d0 fs/jfs/jfs_dmap.c:2834 + dbFreeBits+0x4eb/0xda0 fs/jfs/jfs_dmap.c:2331 + dbFreeDmap fs/jfs/jfs_dmap.c:2080 [inline] + dbFree+0x343/0x650 fs/jfs/jfs_dmap.c:402 + txFreeMap+0x798/0xd50 fs/jfs/jfs_txnmgr.c:2534 + txUpdateMap+0x342/0x9e0 + txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] + jfs_lazycommit+0x47a/0xb70 fs/jfs/jfs_txnmgr.c:2732 + kthread+0x2d3/0x370 kernel/kthread.c:388 + ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 + ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 + +Kernel Offset: disabled +Rebooting in 86400 seconds.. + +The issue is caused when the value of lp becomes greater than +CTLTREESIZE which is the max size of stree. Adding a simple check +solves this issue. + +Dave: +As the function returns a void, good error handling +would require a more intrusive code reorganization, so I modified +Osama's patch at use WARN_ON_ONCE for lack of a cleaner option. + +The patch is tested via syzbot. + +Reported-by: syzbot+39ba34a099ac2e9bd3cb@syzkaller.appspotmail.com +Link: https://syzkaller.appspot.com/bug?extid=39ba34a099ac2e9bd3cb +Signed-off-by: Osama Muhammad +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_dmap.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c +index 11c77757ead9..d55f0dd8d754 100644 +--- a/fs/jfs/jfs_dmap.c ++++ b/fs/jfs/jfs_dmap.c +@@ -2871,6 +2871,9 @@ static void dbAdjTree(dmtree_t * tp, int leafno, int newval) + /* is the current value the same as the old value ? if so, + * there is nothing to do. + */ ++ if (WARN_ON_ONCE(lp >= CTLTREESIZE)) ++ return; ++ + if (tp->dmt_stree[lp] == newval) + return; + +-- +2.43.0 + diff --git a/queue-6.6/fs-kernfs-dir-obey-s_isgid.patch b/queue-6.6/fs-kernfs-dir-obey-s_isgid.patch new file mode 100644 index 00000000000..a01c8390136 --- /dev/null +++ b/queue-6.6/fs-kernfs-dir-obey-s_isgid.patch @@ -0,0 +1,58 @@ +From 76d1329da352d0cc07919616bb30368509ec7351 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Dec 2023 10:33:10 +0100 +Subject: fs/kernfs/dir: obey S_ISGID + +From: Max Kellermann + +[ Upstream commit 5133bee62f0ea5d4c316d503cc0040cac5637601 ] + +Handling of S_ISGID is usually done by inode_init_owner() in all other +filesystems, but kernfs doesn't use that function. In kernfs, struct +kernfs_node is the primary data structure, and struct inode is only +created from it on demand. Therefore, inode_init_owner() can't be +used and we need to imitate its behavior. + +S_ISGID support is useful for the cgroup filesystem; it allows +subtrees managed by an unprivileged process to retain a certain owner +gid, which then enables sharing access to the subtree with another +unprivileged process. + +-- +v1 -> v2: minor coding style fix (comment) + +Signed-off-by: Max Kellermann +Acked-by: Tejun Heo +Link: https://lore.kernel.org/r/20231208093310.297233-2-max.kellermann@ionos.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + fs/kernfs/dir.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c +index 8b2bd65d70e7..62d39ecf0a46 100644 +--- a/fs/kernfs/dir.c ++++ b/fs/kernfs/dir.c +@@ -676,6 +676,18 @@ struct kernfs_node *kernfs_new_node(struct kernfs_node *parent, + { + struct kernfs_node *kn; + ++ if (parent->mode & S_ISGID) { ++ /* this code block imitates inode_init_owner() for ++ * kernfs ++ */ ++ ++ if (parent->iattr) ++ gid = parent->iattr->ia_gid; ++ ++ if (flags & KERNFS_DIR) ++ mode |= S_ISGID; ++ } ++ + kn = __kernfs_new_node(kernfs_root(parent), parent, + name, mode, uid, gid, flags); + if (kn) { +-- +2.43.0 + diff --git a/queue-6.6/hexagon-make-pfn-accessors-statics-inlines.patch b/queue-6.6/hexagon-make-pfn-accessors-statics-inlines.patch new file mode 100644 index 00000000000..c6b5183c309 --- /dev/null +++ b/queue-6.6/hexagon-make-pfn-accessors-statics-inlines.patch @@ -0,0 +1,68 @@ +From 8f284513b8c1713b605b61bf7e6fa23d87392ea2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Nov 2023 14:28:15 +0100 +Subject: Hexagon: Make pfn accessors statics inlines + +From: Linus Walleij + +[ Upstream commit d6e81532b10d8deb2bc30f7b44f09534876893e3 ] + +Making virt_to_pfn() a static inline taking a strongly typed +(const void *) makes the contract of a passing a pointer of that +type to the function explicit and exposes any misuse of the +macro virt_to_pfn() acting polymorphic and accepting many types +such as (void *), (unitptr_t) or (unsigned long) as arguments +without warnings. + +For symmetry do the same with pfn_to_virt(). + +For compiletime resolution of __pa() we need PAGE_OFFSET which +was not available to __pa() and resolved by the preprocessor +wherever __pa() was used. Fix this by explicitly including + where required, following the pattern of the +architectures page.h file. + +Acked-by: Brian Cain +Signed-off-by: Linus Walleij +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/hexagon/include/asm/page.h | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h +index 9c03b9965f07..10f1bc07423c 100644 +--- a/arch/hexagon/include/asm/page.h ++++ b/arch/hexagon/include/asm/page.h +@@ -78,6 +78,9 @@ typedef struct page *pgtable_t; + #define __pgd(x) ((pgd_t) { (x) }) + #define __pgprot(x) ((pgprot_t) { (x) }) + ++/* Needed for PAGE_OFFSET used in the macro right below */ ++#include ++ + /* + * We need a __pa and a __va routine for kernel space. + * MIPS says they're only used during mem_init. +@@ -125,8 +128,16 @@ static inline void clear_page(void *page) + */ + #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) + +-#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) +-#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) ++static inline unsigned long virt_to_pfn(const void *kaddr) ++{ ++ return __pa(kaddr) >> PAGE_SHIFT; ++} ++ ++static inline void *pfn_to_virt(unsigned long pfn) ++{ ++ return (void *)((unsigned long)__va(pfn) << PAGE_SHIFT); ++} ++ + + #define page_to_virt(page) __va(page_to_phys(page)) + +-- +2.43.0 + diff --git a/queue-6.6/hwmon-hp-wmi-sensors-fix-failure-to-load-on-elitedes.patch b/queue-6.6/hwmon-hp-wmi-sensors-fix-failure-to-load-on-elitedes.patch new file mode 100644 index 00000000000..e684d92bff8 --- /dev/null +++ b/queue-6.6/hwmon-hp-wmi-sensors-fix-failure-to-load-on-elitedes.patch @@ -0,0 +1,272 @@ +From b124acfb18e93c7f5b2d74236f4809f4cbc3e986 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 21:49:19 -0800 +Subject: hwmon: (hp-wmi-sensors) Fix failure to load on EliteDesk 800 G6 + +From: James Seo + +[ Upstream commit c9ba592580947b81f33f514320aeef02ddc001fd ] + +The EliteDesk 800 G6 stores a raw WMI string within the ACPI object in its +BIOS corresponding to one instance of HPBIOS_PlatformEvents.Name. This is +evidently a valid way of representing a WMI data item as far as the +Microsoft ACPI-WMI mapper is concerned, but is preventing the driver from +loading. + +This seems quite rare, but add support for such strings. Treating this as a +quirk pretty much means adding that support anyway. + +Also clean up an oversight in update_numeric_sensor_from_wobj() in which +the result of hp_wmi_strdup() was being used without error checking. + +Reported-by: Lukasz Stelmach +Closes: https://lore.kernel.org/linux-hwmon/7850a0bd-60e7-88f8-1d6c-0bb0e3234fdc@roeck-us.net/ +Tested-by: Lukasz Stelmach +Signed-off-by: James Seo +Link: https://lore.kernel.org/r/20231123054918.157098-1-james@equiv.tech +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/hp-wmi-sensors.c | 127 ++++++++++++++++++++++++++++----- + 1 file changed, 111 insertions(+), 16 deletions(-) + +diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c +index 17ae62f88bbf..b5325d0e72b9 100644 +--- a/drivers/hwmon/hp-wmi-sensors.c ++++ b/drivers/hwmon/hp-wmi-sensors.c +@@ -17,6 +17,8 @@ + * Available: https://github.com/linuxhw/ACPI + * [4] P. Rohár, "bmfdec - Decompile binary MOF file (BMF) from WMI buffer", + * 2017. [Online]. Available: https://github.com/pali/bmfdec ++ * [5] Microsoft Corporation, "Driver-Defined WMI Data Items", 2017. [Online]. ++ * Available: https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/driver-defined-wmi-data-items + */ + + #include +@@ -24,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -395,6 +398,50 @@ struct hp_wmi_sensors { + struct mutex lock; /* Lock polling WMI and driver state changes. */ + }; + ++static bool is_raw_wmi_string(const u8 *pointer, u32 length) ++{ ++ const u16 *ptr; ++ u16 len; ++ ++ /* WMI strings are length-prefixed UTF-16 [5]. */ ++ if (length <= sizeof(*ptr)) ++ return false; ++ ++ length -= sizeof(*ptr); ++ ptr = (const u16 *)pointer; ++ len = *ptr; ++ ++ return len <= length && !(len & 1); ++} ++ ++static char *convert_raw_wmi_string(const u8 *buf) ++{ ++ const wchar_t *src; ++ unsigned int cps; ++ unsigned int len; ++ char *dst; ++ int i; ++ ++ src = (const wchar_t *)buf; ++ ++ /* Count UTF-16 code points. Exclude trailing null padding. */ ++ cps = *src / sizeof(*src); ++ while (cps && !src[cps]) ++ cps--; ++ ++ /* Each code point becomes up to 3 UTF-8 characters. */ ++ len = min(cps * 3, HP_WMI_MAX_STR_SIZE - 1); ++ ++ dst = kmalloc((len + 1) * sizeof(*dst), GFP_KERNEL); ++ if (!dst) ++ return NULL; ++ ++ i = utf16s_to_utf8s(++src, cps, UTF16_LITTLE_ENDIAN, dst, len); ++ dst[i] = '\0'; ++ ++ return dst; ++} ++ + /* hp_wmi_strdup - devm_kstrdup, but length-limited */ + static char *hp_wmi_strdup(struct device *dev, const char *src) + { +@@ -412,6 +459,23 @@ static char *hp_wmi_strdup(struct device *dev, const char *src) + return dst; + } + ++/* hp_wmi_wstrdup - hp_wmi_strdup, but for a raw WMI string */ ++static char *hp_wmi_wstrdup(struct device *dev, const u8 *buf) ++{ ++ char *src; ++ char *dst; ++ ++ src = convert_raw_wmi_string(buf); ++ if (!src) ++ return NULL; ++ ++ dst = hp_wmi_strdup(dev, strim(src)); /* Note: Copy is trimmed. */ ++ ++ kfree(src); ++ ++ return dst; ++} ++ + /* + * hp_wmi_get_wobj - poll WMI for a WMI object instance + * @guid: WMI object GUID +@@ -462,8 +526,14 @@ static int check_wobj(const union acpi_object *wobj, + for (prop = 0; prop <= last_prop; prop++) { + type = elements[prop].type; + valid_type = property_map[prop]; +- if (type != valid_type) ++ if (type != valid_type) { ++ if (type == ACPI_TYPE_BUFFER && ++ valid_type == ACPI_TYPE_STRING && ++ is_raw_wmi_string(elements[prop].buffer.pointer, ++ elements[prop].buffer.length)) ++ continue; + return -EINVAL; ++ } + } + + return 0; +@@ -480,7 +550,9 @@ static int extract_acpi_value(struct device *dev, + break; + + case ACPI_TYPE_STRING: +- *out_string = hp_wmi_strdup(dev, strim(element->string.pointer)); ++ *out_string = element->type == ACPI_TYPE_BUFFER ? ++ hp_wmi_wstrdup(dev, element->buffer.pointer) : ++ hp_wmi_strdup(dev, strim(element->string.pointer)); + if (!*out_string) + return -ENOMEM; + break; +@@ -861,7 +933,9 @@ update_numeric_sensor_from_wobj(struct device *dev, + { + const union acpi_object *elements; + const union acpi_object *element; +- const char *string; ++ const char *new_string; ++ char *trimmed; ++ char *string; + bool is_new; + int offset; + u8 size; +@@ -885,11 +959,21 @@ update_numeric_sensor_from_wobj(struct device *dev, + offset = is_new ? size - 1 : -2; + + element = &elements[HP_WMI_PROPERTY_CURRENT_STATE + offset]; +- string = strim(element->string.pointer); +- +- if (strcmp(string, nsensor->current_state)) { +- devm_kfree(dev, nsensor->current_state); +- nsensor->current_state = hp_wmi_strdup(dev, string); ++ string = element->type == ACPI_TYPE_BUFFER ? ++ convert_raw_wmi_string(element->buffer.pointer) : ++ element->string.pointer; ++ ++ if (string) { ++ trimmed = strim(string); ++ if (strcmp(trimmed, nsensor->current_state)) { ++ new_string = hp_wmi_strdup(dev, trimmed); ++ if (new_string) { ++ devm_kfree(dev, nsensor->current_state); ++ nsensor->current_state = new_string; ++ } ++ } ++ if (element->type == ACPI_TYPE_BUFFER) ++ kfree(string); + } + + /* Old variant: -2 (not -1) because it lacks the Size property. */ +@@ -996,11 +1080,15 @@ static int check_event_wobj(const union acpi_object *wobj) + HP_WMI_EVENT_PROPERTY_STATUS); + } + +-static int populate_event_from_wobj(struct hp_wmi_event *event, ++static int populate_event_from_wobj(struct device *dev, ++ struct hp_wmi_event *event, + union acpi_object *wobj) + { + int prop = HP_WMI_EVENT_PROPERTY_NAME; + union acpi_object *element; ++ acpi_object_type type; ++ char *string; ++ u32 value; + int err; + + err = check_event_wobj(wobj); +@@ -1009,20 +1097,24 @@ static int populate_event_from_wobj(struct hp_wmi_event *event, + + element = wobj->package.elements; + +- /* Extracted strings are NOT device-managed copies. */ +- + for (; prop <= HP_WMI_EVENT_PROPERTY_CATEGORY; prop++, element++) { ++ type = hp_wmi_event_property_map[prop]; ++ ++ err = extract_acpi_value(dev, element, type, &value, &string); ++ if (err) ++ return err; ++ + switch (prop) { + case HP_WMI_EVENT_PROPERTY_NAME: +- event->name = strim(element->string.pointer); ++ event->name = string; + break; + + case HP_WMI_EVENT_PROPERTY_DESCRIPTION: +- event->description = strim(element->string.pointer); ++ event->description = string; + break; + + case HP_WMI_EVENT_PROPERTY_CATEGORY: +- event->category = element->integer.value; ++ event->category = value; + break; + + default: +@@ -1511,8 +1603,8 @@ static void hp_wmi_notify(u32 value, void *context) + struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL }; + struct hp_wmi_sensors *state = context; + struct device *dev = &state->wdev->dev; ++ struct hp_wmi_event event = {}; + struct hp_wmi_info *fan_info; +- struct hp_wmi_event event; + union acpi_object *wobj; + acpi_status err; + int event_type; +@@ -1546,7 +1638,7 @@ static void hp_wmi_notify(u32 value, void *context) + + wobj = out.pointer; + +- err = populate_event_from_wobj(&event, wobj); ++ err = populate_event_from_wobj(dev, &event, wobj); + if (err) { + dev_warn(dev, "Bad event data (ACPI type %d)\n", wobj->type); + goto out_free_wobj; +@@ -1577,6 +1669,9 @@ static void hp_wmi_notify(u32 value, void *context) + out_free_wobj: + kfree(wobj); + ++ devm_kfree(dev, event.name); ++ devm_kfree(dev, event.description); ++ + out_unlock: + mutex_unlock(&state->lock); + } +-- +2.43.0 + diff --git a/queue-6.6/hwmon-nct6775-fix-fan-speed-set-failure-in-automatic.patch b/queue-6.6/hwmon-nct6775-fix-fan-speed-set-failure-in-automatic.patch new file mode 100644 index 00000000000..da9f0e9c7d0 --- /dev/null +++ b/queue-6.6/hwmon-nct6775-fix-fan-speed-set-failure-in-automatic.patch @@ -0,0 +1,42 @@ +From 95f8076f725839e7f259a83b9cd04d0f605fadae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 16:16:04 +0800 +Subject: hwmon: (nct6775) Fix fan speed set failure in automatic mode + +From: Xing Tong Wu + +[ Upstream commit 8b3800256abad20e91c2698607f9b28591407b19 ] + +Setting the fan speed is only valid in manual mode; it is not possible +to set the fan's speed in automatic mode. +Return error when attempting to set the fan speed in automatic mode. + +Signed-off-by: Xing Tong Wu +Link: https://lore.kernel.org/r/20231121081604.2499-3-xingtong_wu@163.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/nct6775-core.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c +index d928eb8ae5a3..92a49fafe2c0 100644 +--- a/drivers/hwmon/nct6775-core.c ++++ b/drivers/hwmon/nct6775-core.c +@@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf, + int err; + u16 reg; + ++ /* ++ * The fan control mode should be set to manual if the user wants to adjust ++ * the fan speed. Otherwise, it will fail to set. ++ */ ++ if (index == 0 && data->pwm_enable[nr] > manual) ++ return -EBUSY; ++ + err = kstrtoul(buf, 10, &val); + if (err < 0) + return err; +-- +2.43.0 + diff --git a/queue-6.6/hwmon-pc87360-bounds-check-data-innr-usage.patch b/queue-6.6/hwmon-pc87360-bounds-check-data-innr-usage.patch new file mode 100644 index 00000000000..0f4ce2b437e --- /dev/null +++ b/queue-6.6/hwmon-pc87360-bounds-check-data-innr-usage.patch @@ -0,0 +1,60 @@ +From cd95b4c6be9f5e46a15a21ed918f92bac16f5295 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 12:02:07 -0800 +Subject: hwmon: (pc87360) Bounds check data->innr usage + +From: Kees Cook + +[ Upstream commit 4265eb062a7303e537ab3792ade31f424c3c5189 ] + +Without visibility into the initializers for data->innr, GCC suspects +using it as an index could walk off the end of the various 14-element +arrays in data. Perform an explicit clamp to the array size. Silences +the following warning with GCC 12+: + +../drivers/hwmon/pc87360.c: In function 'pc87360_update_device': +../drivers/hwmon/pc87360.c:341:49: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] + 341 | data->in_max[i] = pc87360_read_value(data, + | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + 342 | LD_IN, i, + | ~~~~~~~~~ + 343 | PC87365_REG_IN_MAX); + | ~~~~~~~~~~~~~~~~~~~ +../drivers/hwmon/pc87360.c:209:12: note: at offset 255 into destination object 'in_max' of size 14 + 209 | u8 in_max[14]; /* Register value */ + | ^~~~~~ + +Cc: Jim Cromie +Cc: Jean Delvare +Cc: Guenter Roeck +Cc: linux-hwmon@vger.kernel.org +Signed-off-by: Kees Cook +Reviewed-by: Gustavo A. R. Silva +Link: https://lore.kernel.org/r/20231130200207.work.679-kees@kernel.org +[groeck: Added comment into code clarifying context] +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/pc87360.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c +index a4adc8bd531f..534a6072036c 100644 +--- a/drivers/hwmon/pc87360.c ++++ b/drivers/hwmon/pc87360.c +@@ -323,7 +323,11 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) + } + + /* Voltages */ +- for (i = 0; i < data->innr; i++) { ++ /* ++ * The min() below does not have any practical meaning and is ++ * only needed to silence a warning observed with gcc 12+. ++ */ ++ for (i = 0; i < min(data->innr, ARRAY_SIZE(data->in)); i++) { + data->in_status[i] = pc87360_read_value(data, LD_IN, i, + PC87365_REG_IN_STATUS); + /* Clear bits */ +-- +2.43.0 + diff --git a/queue-6.6/hwrng-starfive-fix-dev_err_probe-return-error.patch b/queue-6.6/hwrng-starfive-fix-dev_err_probe-return-error.patch new file mode 100644 index 00000000000..11bcc205001 --- /dev/null +++ b/queue-6.6/hwrng-starfive-fix-dev_err_probe-return-error.patch @@ -0,0 +1,38 @@ +From 8821875a9ab760415605eaff54aa4fed5284c65c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 23:11:21 +0800 +Subject: hwrng: starfive - Fix dev_err_probe return error + +From: Jia Jie Ho + +[ Upstream commit 2d37b3649c412b3bcecfea932cb677f7a5775b15 ] + +Current dev_err_probe will return 0 instead of proper error code if +driver failed to get irq number. Fix the return err code. + +Signed-off-by: Jia Jie Ho +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202311160649.3GhKCfhd-lkp@intel.com/ +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/char/hw_random/jh7110-trng.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/hw_random/jh7110-trng.c b/drivers/char/hw_random/jh7110-trng.c +index 38474d48a25e..b1f94e3c0c6a 100644 +--- a/drivers/char/hw_random/jh7110-trng.c ++++ b/drivers/char/hw_random/jh7110-trng.c +@@ -300,7 +300,7 @@ static int starfive_trng_probe(struct platform_device *pdev) + ret = devm_request_irq(&pdev->dev, irq, starfive_trng_irq, 0, pdev->name, + (void *)trng); + if (ret) +- return dev_err_probe(&pdev->dev, irq, ++ return dev_err_probe(&pdev->dev, ret, + "Failed to register interrupt handler\n"); + + trng->hclk = devm_clk_get(&pdev->dev, "hclk"); +-- +2.43.0 + diff --git a/queue-6.6/i2c-rk3x-adjust-mask-value-offset-for-i2c2-on-rv1126.patch b/queue-6.6/i2c-rk3x-adjust-mask-value-offset-for-i2c2-on-rv1126.patch new file mode 100644 index 00000000000..8501b893816 --- /dev/null +++ b/queue-6.6/i2c-rk3x-adjust-mask-value-offset-for-i2c2-on-rv1126.patch @@ -0,0 +1,46 @@ +From 570c41f72b6144622322d862c061edb66d89dad1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 3 Dec 2023 23:39:59 +1100 +Subject: i2c: rk3x: Adjust mask/value offset for i2c2 on rv1126 + +From: Tim Lunn + +[ Upstream commit 92a85b7c6262f19c65a1c115cf15f411ba65a57c ] + +Rockchip RV1126 is using old style i2c controller, the i2c2 +bus uses a non-sequential offset in the grf register for the +mask/value bits for this bus. + +This patch fixes i2c2 bus on rv1126 SoCs. + +Signed-off-by: Tim Lunn +Acked-by: Heiko Stuebner +Reviewed-by: Andi Shyti +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-rk3x.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c +index 4362db7c5789..086fdf262e7b 100644 +--- a/drivers/i2c/busses/i2c-rk3x.c ++++ b/drivers/i2c/busses/i2c-rk3x.c +@@ -1295,8 +1295,12 @@ static int rk3x_i2c_probe(struct platform_device *pdev) + return -EINVAL; + } + +- /* 27+i: write mask, 11+i: value */ +- value = BIT(27 + bus_nr) | BIT(11 + bus_nr); ++ /* rv1126 i2c2 uses non-sequential write mask 20, value 4 */ ++ if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2) ++ value = BIT(20) | BIT(4); ++ else ++ /* 27+i: write mask, 11+i: value */ ++ value = BIT(27 + bus_nr) | BIT(11 + bus_nr); + + ret = regmap_write(grf, i2c->soc_data->grf_offset, value); + if (ret != 0) { +-- +2.43.0 + diff --git a/queue-6.6/i3c-master-cdns-update-maximum-prescaler-value-for-i.patch b/queue-6.6/i3c-master-cdns-update-maximum-prescaler-value-for-i.patch new file mode 100644 index 00000000000..d033c4d5278 --- /dev/null +++ b/queue-6.6/i3c-master-cdns-update-maximum-prescaler-value-for-i.patch @@ -0,0 +1,59 @@ +From cc7b71161204a368d180ee2822587c4c5c400de8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 30 Dec 2023 14:41:23 +0530 +Subject: i3c: master: cdns: Update maximum prescaler value for i2c clock + +From: Harshit Shah + +[ Upstream commit 374c13f9080a1b9835a5ed3e7bea93cf8e2dc262 ] + +As per the Cadence IP document fixed the I2C clock divider value limit from +16 bits instead of 10 bits. Without this change setting up the I2C clock to +low frequencies will not work as the prescaler value might be greater than +10 bit number. + +I3C clock divider value is 10 bits only. Updating the macro names for both. + +Signed-off-by: Harshit Shah +Link: https://lore.kernel.org/r/1703927483-28682-1-git-send-email-harshitshah.opendev@gmail.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +--- + drivers/i3c/master/i3c-master-cdns.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c +index 8f1fda3c7ac5..fa5aaaf44618 100644 +--- a/drivers/i3c/master/i3c-master-cdns.c ++++ b/drivers/i3c/master/i3c-master-cdns.c +@@ -76,7 +76,8 @@ + #define PRESCL_CTRL0 0x14 + #define PRESCL_CTRL0_I2C(x) ((x) << 16) + #define PRESCL_CTRL0_I3C(x) (x) +-#define PRESCL_CTRL0_MAX GENMASK(9, 0) ++#define PRESCL_CTRL0_I3C_MAX GENMASK(9, 0) ++#define PRESCL_CTRL0_I2C_MAX GENMASK(15, 0) + + #define PRESCL_CTRL1 0x18 + #define PRESCL_CTRL1_PP_LOW_MASK GENMASK(15, 8) +@@ -1233,7 +1234,7 @@ static int cdns_i3c_master_bus_init(struct i3c_master_controller *m) + return -EINVAL; + + pres = DIV_ROUND_UP(sysclk_rate, (bus->scl_rate.i3c * 4)) - 1; +- if (pres > PRESCL_CTRL0_MAX) ++ if (pres > PRESCL_CTRL0_I3C_MAX) + return -ERANGE; + + bus->scl_rate.i3c = sysclk_rate / ((pres + 1) * 4); +@@ -1246,7 +1247,7 @@ static int cdns_i3c_master_bus_init(struct i3c_master_controller *m) + max_i2cfreq = bus->scl_rate.i2c; + + pres = (sysclk_rate / (max_i2cfreq * 5)) - 1; +- if (pres > PRESCL_CTRL0_MAX) ++ if (pres > PRESCL_CTRL0_I2C_MAX) + return -ERANGE; + + bus->scl_rate.i2c = sysclk_rate / ((pres + 1) * 5); +-- +2.43.0 + diff --git a/queue-6.6/i40e-fix-vf-disable-behavior-to-block-all-traffic.patch b/queue-6.6/i40e-fix-vf-disable-behavior-to-block-all-traffic.patch new file mode 100644 index 00000000000..aa352faafcb --- /dev/null +++ b/queue-6.6/i40e-fix-vf-disable-behavior-to-block-all-traffic.patch @@ -0,0 +1,120 @@ +From 0f770b964191655bf8d95e82f212f649c63f0a57 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Nov 2023 15:24:12 +0100 +Subject: i40e: Fix VF disable behavior to block all traffic + +From: Andrii Staikov + +[ Upstream commit 31deb12e85c35ddd2c037f0107d05d8674cab2c0 ] + +Currently, if a VF is disabled using the +'ip link set dev $ETHX vf $VF_NUM state disable' command, the VF is still +able to receive traffic. + +Fix the behavior of the 'ip link set dev $ETHX vf $VF_NUM state disable' +to completely shutdown the VF's queues making it entirely disabled and +not able to receive or send any traffic. + +Modify the behavior of the 'ip link set $ETHX vf $VF_NUM state enable' +command to make a VF do reinitialization bringing the queues back up. + +Co-developed-by: Aleksandr Loktionov +Signed-off-by: Aleksandr Loktionov +Reviewed-by: Jan Sokolowski +Reviewed-by: Wojciech Drewek +Reviewed-by: Przemek Kitszel +Signed-off-by: Andrii Staikov +Tested-by: Rafal Romanowski +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 32 +++++++++++++++++++ + .../ethernet/intel/i40e/i40e_virtchnl_pf.h | 1 + + 2 files changed, 33 insertions(+) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index a97ca2224da0..cc4c53470db2 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -2605,6 +2605,14 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg) + int aq_ret = 0; + int i; + ++ if (vf->is_disabled_from_host) { ++ aq_ret = -EPERM; ++ dev_info(&pf->pdev->dev, ++ "Admin has disabled VF %d, will not enable queues\n", ++ vf->vf_id); ++ goto error_param; ++ } ++ + if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { + aq_ret = -EINVAL; + goto error_param; +@@ -4732,9 +4740,12 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) + struct i40e_link_status *ls = &pf->hw.phy.link_info; + struct virtchnl_pf_event pfe; + struct i40e_hw *hw = &pf->hw; ++ struct i40e_vsi *vsi; ++ unsigned long q_map; + struct i40e_vf *vf; + int abs_vf_id; + int ret = 0; ++ int tmp; + + if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { + dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); +@@ -4757,17 +4768,38 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) + switch (link) { + case IFLA_VF_LINK_STATE_AUTO: + vf->link_forced = false; ++ vf->is_disabled_from_host = false; ++ /* reset needed to reinit VF resources */ ++ i40e_vc_reset_vf(vf, true); + i40e_set_vf_link_state(vf, &pfe, ls); + break; + case IFLA_VF_LINK_STATE_ENABLE: + vf->link_forced = true; + vf->link_up = true; ++ vf->is_disabled_from_host = false; ++ /* reset needed to reinit VF resources */ ++ i40e_vc_reset_vf(vf, true); + i40e_set_vf_link_state(vf, &pfe, ls); + break; + case IFLA_VF_LINK_STATE_DISABLE: + vf->link_forced = true; + vf->link_up = false; + i40e_set_vf_link_state(vf, &pfe, ls); ++ ++ vsi = pf->vsi[vf->lan_vsi_idx]; ++ q_map = BIT(vsi->num_queue_pairs) - 1; ++ ++ vf->is_disabled_from_host = true; ++ ++ /* Try to stop both Tx&Rx rings even if one of the calls fails ++ * to ensure we stop the rings even in case of errors. ++ * If any of them returns with an error then the first ++ * error that occurred will be returned. ++ */ ++ tmp = i40e_ctrl_vf_tx_rings(vsi, q_map, false); ++ ret = i40e_ctrl_vf_rx_rings(vsi, q_map, false); ++ ++ ret = tmp ? tmp : ret; + break; + default: + ret = -EINVAL; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +index bda9ba668c41..cf190762421c 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +@@ -98,6 +98,7 @@ struct i40e_vf { + bool link_forced; + bool link_up; /* only valid if VF link is forced */ + bool spoofchk; ++ bool is_disabled_from_host; /* PF ctrl of VF enable/disable */ + u16 num_vlan; + + /* ADq related variables */ +-- +2.43.0 + diff --git a/queue-6.6/ib-ipoib-fix-mcast-list-locking.patch b/queue-6.6/ib-ipoib-fix-mcast-list-locking.patch new file mode 100644 index 00000000000..8d62a132d78 --- /dev/null +++ b/queue-6.6/ib-ipoib-fix-mcast-list-locking.patch @@ -0,0 +1,94 @@ +From e25ecad19a5a894e708a99b53b3ba8a797d98a59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 09:07:45 +0100 +Subject: IB/ipoib: Fix mcast list locking + +From: Daniel Vacek + +[ Upstream commit 4f973e211b3b1c6d36f7c6a19239d258856749f9 ] + +Releasing the `priv->lock` while iterating the `priv->multicast_list` in +`ipoib_mcast_join_task()` opens a window for `ipoib_mcast_dev_flush()` to +remove the items while in the middle of iteration. If the mcast is removed +while the lock was dropped, the for loop spins forever resulting in a hard +lockup (as was reported on RHEL 4.18.0-372.75.1.el8_6 kernel): + + Task A (kworker/u72:2 below) | Task B (kworker/u72:0 below) + -----------------------------------+----------------------------------- + ipoib_mcast_join_task(work) | ipoib_ib_dev_flush_light(work) + spin_lock_irq(&priv->lock) | __ipoib_ib_dev_flush(priv, ...) + list_for_each_entry(mcast, | ipoib_mcast_dev_flush(dev = priv->dev) + &priv->multicast_list, list) | + ipoib_mcast_join(dev, mcast) | + spin_unlock_irq(&priv->lock) | + | spin_lock_irqsave(&priv->lock, flags) + | list_for_each_entry_safe(mcast, tmcast, + | &priv->multicast_list, list) + | list_del(&mcast->list); + | list_add_tail(&mcast->list, &remove_list) + | spin_unlock_irqrestore(&priv->lock, flags) + spin_lock_irq(&priv->lock) | + | ipoib_mcast_remove_list(&remove_list) + (Here, `mcast` is no longer on the | list_for_each_entry_safe(mcast, tmcast, + `priv->multicast_list` and we keep | remove_list, list) + spinning on the `remove_list` of | >>> wait_for_completion(&mcast->done) + the other thread which is blocked | + and the list is still valid on | + it's stack.) + +Fix this by keeping the lock held and changing to GFP_ATOMIC to prevent +eventual sleeps. +Unfortunately we could not reproduce the lockup and confirm this fix but +based on the code review I think this fix should address such lockups. + +crash> bc 31 +PID: 747 TASK: ff1c6a1a007e8000 CPU: 31 COMMAND: "kworker/u72:2" +-- + [exception RIP: ipoib_mcast_join_task+0x1b1] + RIP: ffffffffc0944ac1 RSP: ff646f199a8c7e00 RFLAGS: 00000002 + RAX: 0000000000000000 RBX: ff1c6a1a04dc82f8 RCX: 0000000000000000 + work (&priv->mcast_task{,.work}) + RDX: ff1c6a192d60ac68 RSI: 0000000000000286 RDI: ff1c6a1a04dc8000 + &mcast->list + RBP: ff646f199a8c7e90 R8: ff1c699980019420 R9: ff1c6a1920c9a000 + R10: ff646f199a8c7e00 R11: ff1c6a191a7d9800 R12: ff1c6a192d60ac00 + mcast + R13: ff1c6a1d82200000 R14: ff1c6a1a04dc8000 R15: ff1c6a1a04dc82d8 + dev priv (&priv->lock) &priv->multicast_list (aka head) + ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 + +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +index 9e6967a40042..319d4288eddd 100644 +--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +@@ -531,21 +531,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) + if (test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) + rec.join_state = SENDONLY_FULLMEMBER_JOIN; + } +- spin_unlock_irq(&priv->lock); + + multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, +- &rec, comp_mask, GFP_KERNEL, ++ &rec, comp_mask, GFP_ATOMIC, + ipoib_mcast_join_complete, mcast); +- spin_lock_irq(&priv->lock); + if (IS_ERR(multicast)) { + ret = PTR_ERR(multicast); + ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); + /* Requeue this join task with a backoff delay */ + __ipoib_mcast_schedule_join_thread(priv, mcast, 1); + clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); +- spin_unlock_irq(&priv->lock); + complete(&mcast->done); +- spin_lock_irq(&priv->lock); + return ret; + } + return 0; +-- +2.43.0 + diff --git a/queue-6.6/ice-fix-ice_aq_vsi_q_opt_rss_-register-values.patch b/queue-6.6/ice-fix-ice_aq_vsi_q_opt_rss_-register-values.patch new file mode 100644 index 00000000000..75fc0cf04db --- /dev/null +++ b/queue-6.6/ice-fix-ice_aq_vsi_q_opt_rss_-register-values.patch @@ -0,0 +1,101 @@ +From 53e0cd026b45c5bf334792a7e2892c40b154d5d8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 17:33:17 -0700 +Subject: ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values + +From: Ahmed Zaki + +[ Upstream commit 20f73b60bb5c276cee9b1a530f100c677bc74af8 ] + +Fix the values of the ICE_AQ_VSI_Q_OPT_RSS_* registers. Shifting is +already done when the values are used, no need to double shift. Bug was +not discovered earlier since only ICE_AQ_VSI_Q_OPT_RSS_TPLZ (Zero) is +currently used. + +Also, rename ICE_AQ_VSI_Q_OPT_RSS_XXX to ICE_AQ_VSI_Q_OPT_RSS_HASH_XXX +for consistency. + +Co-developed-by: Jesse Brandeburg +Signed-off-by: Jesse Brandeburg +Reviewed-by: Wojciech Drewek +Signed-off-by: Ahmed Zaki +Link: https://lore.kernel.org/r/20231213003321.605376-5-ahmed.zaki@intel.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 8 ++++---- + drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++-- + drivers/net/ethernet/intel/ice/ice_virtchnl.c | 12 +++++------- + 3 files changed, 11 insertions(+), 13 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +index 29f7a9852aec..fafe083d1446 100644 +--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h ++++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +@@ -491,10 +491,10 @@ struct ice_aqc_vsi_props { + #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S) + #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S 6 + #define ICE_AQ_VSI_Q_OPT_RSS_HASH_M (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) +-#define ICE_AQ_VSI_Q_OPT_RSS_TPLZ (0x0 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) +-#define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ (0x1 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) +-#define ICE_AQ_VSI_Q_OPT_RSS_XOR (0x2 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) +-#define ICE_AQ_VSI_Q_OPT_RSS_JHASH (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) ++#define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ 0x0U ++#define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ 0x1U ++#define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR 0x2U ++#define ICE_AQ_VSI_Q_OPT_RSS_HASH_JHASH 0x3U + u8 q_opt_tc; + #define ICE_AQ_VSI_Q_OPT_TC_OVR_S 0 + #define ICE_AQ_VSI_Q_OPT_TC_OVR_M (0x1F << ICE_AQ_VSI_Q_OPT_TC_OVR_S) +diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c +index a66c3b6ccec1..4e7f67f54f1c 100644 +--- a/drivers/net/ethernet/intel/ice/ice_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_lib.c +@@ -1186,12 +1186,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) + case ICE_VSI_PF: + /* PF VSI will inherit RSS instance of PF */ + lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF; +- hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ; ++ hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; + break; + case ICE_VSI_VF: + /* VF VSI will gets a small RSS table which is a VSI LUT type */ + lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI; +- hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ; ++ hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; + break; + default: + dev_dbg(dev, "Unsupported VSI type %s\n", +diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/ethernet/intel/ice/ice_virtchnl.c +index 62337e6569b2..e7ab78bb0f86 100644 +--- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c ++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c +@@ -820,8 +820,8 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add) + int status; + + lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI; +- hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_XOR : +- ICE_AQ_VSI_Q_OPT_RSS_TPLZ; ++ hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR : ++ ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (!ctx) { +@@ -829,11 +829,9 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add) + goto error_param; + } + +- ctx->info.q_opt_rss = ((lut_type << +- ICE_AQ_VSI_Q_OPT_RSS_LUT_S) & +- ICE_AQ_VSI_Q_OPT_RSS_LUT_M) | +- (hash_type & +- ICE_AQ_VSI_Q_OPT_RSS_HASH_M); ++ ctx->info.q_opt_rss = ++ FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_LUT_M, lut_type) | ++ FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hash_type); + + /* Preserve existing queueing option setting */ + ctx->info.q_opt_rss |= (vsi->info.q_opt_rss & +-- +2.43.0 + diff --git a/queue-6.6/ice-fix-pre-shifted-bit-usage.patch b/queue-6.6/ice-fix-pre-shifted-bit-usage.patch new file mode 100644 index 00000000000..c88cdb708ea --- /dev/null +++ b/queue-6.6/ice-fix-pre-shifted-bit-usage.patch @@ -0,0 +1,121 @@ +From 2bc5c7190b18ae346c4bf18ac8ca308752b6c725 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 17:01:06 -0800 +Subject: ice: fix pre-shifted bit usage + +From: Jesse Brandeburg + +[ Upstream commit 7173be21ae29ef50ada42fd4464056a9d3f55bb3 ] + +While converting to FIELD_PREP() and FIELD_GET(), it was noticed that +some of the RSS defines had *included* the shift in their definitions. +This is completely outside of normal, such that a developer could easily +make a mistake and shift at the usage site (like when using +FIELD_PREP()). + +Rename the defines and set them to the "pre-shifted values" so they +match the template the driver normally uses for masks and the member +bits of the mask, which also allows the driver to use FIELD_PREP +correctly with these values. Use GENMASK() for this changed MASK value. + +Do the same for the VLAN EMODE defines as well. + +Reviewed-by: Marcin Szycik +Reviewed-by: Simon Horman +Signed-off-by: Jesse Brandeburg +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 10 +++++----- + drivers/net/ethernet/intel/ice/ice_lib.c | 3 ++- + .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 16 +++++++++++----- + 3 files changed, 18 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +index fafe083d1446..45f3e351653d 100644 +--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h ++++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +@@ -421,10 +421,10 @@ struct ice_aqc_vsi_props { + #define ICE_AQ_VSI_INNER_VLAN_INSERT_PVID BIT(2) + #define ICE_AQ_VSI_INNER_VLAN_EMODE_S 3 + #define ICE_AQ_VSI_INNER_VLAN_EMODE_M (0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S) +-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH (0x0 << ICE_AQ_VSI_INNER_VLAN_EMODE_S) +-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP (0x1 << ICE_AQ_VSI_INNER_VLAN_EMODE_S) +-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR (0x2 << ICE_AQ_VSI_INNER_VLAN_EMODE_S) +-#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING (0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S) ++#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH 0x0U ++#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP 0x1U ++#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR 0x2U ++#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING 0x3U + u8 inner_vlan_reserved2[3]; + /* ingress egress up sections */ + __le32 ingress_table; /* bitmap, 3 bits per up */ +@@ -490,7 +490,7 @@ struct ice_aqc_vsi_props { + #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S 2 + #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S) + #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S 6 +-#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) ++#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M GENMASK(7, 6) + #define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ 0x0U + #define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ 0x1U + #define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR 0x2U +diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c +index 4e7f67f54f1c..7f4bc110ead4 100644 +--- a/drivers/net/ethernet/intel/ice/ice_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_lib.c +@@ -979,7 +979,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt) + */ + if (ice_is_dvm_ena(hw)) { + ctxt->info.inner_vlan_flags |= +- ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING; ++ FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M, ++ ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING); + ctxt->info.outer_vlan_flags = + (ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL << + ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) & +diff --git a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c +index 76266e709a39..8307902115ff 100644 +--- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c +@@ -131,6 +131,7 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) + { + struct ice_hw *hw = &vsi->back->hw; + struct ice_vsi_ctx *ctxt; ++ u8 *ivf; + int err; + + /* do not allow modifying VLAN stripping when a port VLAN is configured +@@ -143,19 +144,24 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) + if (!ctxt) + return -ENOMEM; + ++ ivf = &ctxt->info.inner_vlan_flags; ++ + /* Here we are configuring what the VSI should do with the VLAN tag in + * the Rx packet. We can either leave the tag in the packet or put it in + * the Rx descriptor. + */ +- if (ena) ++ if (ena) { + /* Strip VLAN tag from Rx packet and put it in the desc */ +- ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH; +- else ++ *ivf = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M, ++ ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH); ++ } else { + /* Disable stripping. Leave tag in packet */ +- ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING; ++ *ivf = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M, ++ ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING); ++ } + + /* Allow all packets untagged/tagged */ +- ctxt->info.inner_vlan_flags |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL; ++ *ivf |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL; + + ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID); + +-- +2.43.0 + diff --git a/queue-6.6/ionic-bypass-firmware-cmds-when-stuck-in-reset.patch b/queue-6.6/ionic-bypass-firmware-cmds-when-stuck-in-reset.patch new file mode 100644 index 00000000000..37d150ad027 --- /dev/null +++ b/queue-6.6/ionic-bypass-firmware-cmds-when-stuck-in-reset.patch @@ -0,0 +1,100 @@ +From 33379171669c639d8e465f5f6c918ac8a81f2aec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 10:57:59 -0800 +Subject: ionic: bypass firmware cmds when stuck in reset + +From: Shannon Nelson + +[ Upstream commit ca5fdf9a7c5b65968c718f2be159cda4c13556a1 ] + +If the driver or firmware is stuck in reset state, don't bother +trying to use adminq commands. This speeds up shutdown and +prevents unnecessary timeouts and error messages. + +This includes a bit of rework on ionic_adminq_post_wait() +and ionic_adminq_post_wait_nomsg() to both use +__ionic_adminq_post_wait() which can do the checks needed in +both cases. + +Signed-off-by: Shannon Nelson +Reviewed-by: Brett Creeley +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../ethernet/pensando/ionic/ionic_bus_pci.c | 4 ++++ + .../net/ethernet/pensando/ionic/ionic_lif.c | 3 +++ + .../net/ethernet/pensando/ionic/ionic_main.c | 20 ++++++++++++------- + 3 files changed, 20 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +index d6ce113a4210..fa4237c27e06 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +@@ -392,6 +392,10 @@ static void ionic_remove(struct pci_dev *pdev) + del_timer_sync(&ionic->watchdog_timer); + + if (ionic->lif) { ++ /* prevent adminq cmds if already known as down */ ++ if (test_and_clear_bit(IONIC_LIF_F_FW_RESET, ionic->lif->state)) ++ set_bit(IONIC_LIF_F_FW_STOPPING, ionic->lif->state); ++ + ionic_lif_unregister(ionic->lif); + ionic_devlink_unregister(ionic); + ionic_lif_deinit(ionic->lif); +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +index c9bd2c57a37d..adb0f9b01bb1 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +@@ -3238,6 +3238,9 @@ static void ionic_lif_reset(struct ionic_lif *lif) + { + struct ionic_dev *idev = &lif->ionic->idev; + ++ if (!ionic_is_fw_running(idev)) ++ return; ++ + mutex_lock(&lif->ionic->dev_cmd_lock); + ionic_dev_cmd_lif_reset(idev, lif->index); + ionic_dev_cmd_wait(lif->ionic, DEVCMD_TIMEOUT); +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c +index baa865af49ad..f019277fec57 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c +@@ -410,22 +410,28 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, + do_msg); + } + +-int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) ++static int __ionic_adminq_post_wait(struct ionic_lif *lif, ++ struct ionic_admin_ctx *ctx, ++ const bool do_msg) + { + int err; + ++ if (!ionic_is_fw_running(&lif->ionic->idev)) ++ return 0; ++ + err = ionic_adminq_post(lif, ctx); + +- return ionic_adminq_wait(lif, ctx, err, true); ++ return ionic_adminq_wait(lif, ctx, err, do_msg); + } + +-int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) ++int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) + { +- int err; +- +- err = ionic_adminq_post(lif, ctx); ++ return __ionic_adminq_post_wait(lif, ctx, true); ++} + +- return ionic_adminq_wait(lif, ctx, err, false); ++int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) ++{ ++ return __ionic_adminq_post_wait(lif, ctx, false); + } + + static void ionic_dev_cmd_clean(struct ionic *ionic) +-- +2.43.0 + diff --git a/queue-6.6/ionic-pass-opcode-to-devcmd_wait.patch b/queue-6.6/ionic-pass-opcode-to-devcmd_wait.patch new file mode 100644 index 00000000000..349100945db --- /dev/null +++ b/queue-6.6/ionic-pass-opcode-to-devcmd_wait.patch @@ -0,0 +1,63 @@ +From e2463415c0088366c194e9a8842c71e1e1278a20 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 10:57:57 -0800 +Subject: ionic: pass opcode to devcmd_wait + +From: Shannon Nelson + +[ Upstream commit 24f110240c03c6b5368f1203bac72883d511e606 ] + +Don't rely on the PCI memory for the devcmd opcode because we +read a 0xff value if the PCI bus is broken, which can cause us +to report a bogus dev_cmd opcode later. + +Signed-off-by: Shannon Nelson +Reviewed-by: Brett Creeley +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/pensando/ionic/ionic_dev.c | 1 + + drivers/net/ethernet/pensando/ionic/ionic_dev.h | 1 + + drivers/net/ethernet/pensando/ionic/ionic_main.c | 2 +- + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c +index c06576f43916..22ab0a44fa8c 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c +@@ -321,6 +321,7 @@ void ionic_dev_cmd_comp(struct ionic_dev *idev, union ionic_dev_cmd_comp *comp) + + void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd) + { ++ idev->opcode = cmd->cmd.opcode; + memcpy_toio(&idev->dev_cmd_regs->cmd, cmd, sizeof(*cmd)); + iowrite32(0, &idev->dev_cmd_regs->done); + iowrite32(1, &idev->dev_cmd_regs->doorbell); +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h +index bd2d4a26f543..23f9d3b8029a 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h ++++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h +@@ -152,6 +152,7 @@ struct ionic_dev { + bool fw_hb_ready; + bool fw_status_ready; + u8 fw_generation; ++ u8 opcode; + + u64 __iomem *db_pages; + dma_addr_t phy_db_pages; +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c +index 1dc79cecc5cc..baa865af49ad 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c +@@ -465,7 +465,7 @@ static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds, + */ + max_wait = jiffies + (max_seconds * HZ); + try_again: +- opcode = readb(&idev->dev_cmd_regs->cmd.cmd.opcode); ++ opcode = idev->opcode; + start_time = jiffies; + for (fw_up = ionic_is_fw_running(idev); + !done && fw_up && time_before(jiffies, max_wait); +-- +2.43.0 + diff --git a/queue-6.6/jfs-fix-array-index-out-of-bounds-in-dbadjtree.patch b/queue-6.6/jfs-fix-array-index-out-of-bounds-in-dbadjtree.patch new file mode 100644 index 00000000000..446900e10ac --- /dev/null +++ b/queue-6.6/jfs-fix-array-index-out-of-bounds-in-dbadjtree.patch @@ -0,0 +1,239 @@ +From 8275a51c9e1ac287e5b5010c799b53ad4384e30d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Oct 2023 17:33:56 +0530 +Subject: jfs: fix array-index-out-of-bounds in dbAdjTree + +From: Manas Ghandat + +[ Upstream commit 74ecdda68242b174920fe7c6133a856fb7d8559b ] + +Currently there is a bound check missing in the dbAdjTree while +accessing the dmt_stree. To add the required check added the bool is_ctl +which is required to determine the size as suggest in the following +commit. +https://lore.kernel.org/linux-kernel-mentees/f9475918-2186-49b8-b801-6f0f9e75f4fa@oracle.com/ + +Reported-by: syzbot+39ba34a099ac2e9bd3cb@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=39ba34a099ac2e9bd3cb +Signed-off-by: Manas Ghandat +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_dmap.c | 60 ++++++++++++++++++++++++----------------------- + 1 file changed, 31 insertions(+), 29 deletions(-) + +diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c +index d55f0dd8d754..cb3cda1390ad 100644 +--- a/fs/jfs/jfs_dmap.c ++++ b/fs/jfs/jfs_dmap.c +@@ -63,10 +63,10 @@ + */ + static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, + int nblocks); +-static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); +-static int dbBackSplit(dmtree_t * tp, int leafno); +-static int dbJoin(dmtree_t * tp, int leafno, int newval); +-static void dbAdjTree(dmtree_t * tp, int leafno, int newval); ++static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl); ++static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl); ++static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl); ++static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl); + static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, + int level); + static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results); +@@ -2103,7 +2103,7 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, + * system. + */ + if (dp->tree.stree[word] == NOFREE) +- dbBackSplit((dmtree_t *) & dp->tree, word); ++ dbBackSplit((dmtree_t *)&dp->tree, word, false); + + dbAllocBits(bmp, dp, blkno, nblocks); + } +@@ -2189,7 +2189,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, + * the binary system of the leaves if need be. + */ + dbSplit(tp, word, BUDMIN, +- dbMaxBud((u8 *) & dp->wmap[word])); ++ dbMaxBud((u8 *)&dp->wmap[word]), false); + + word += 1; + } else { +@@ -2229,7 +2229,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, + * system of the leaves to reflect the current + * allocation (size). + */ +- dbSplit(tp, word, size, NOFREE); ++ dbSplit(tp, word, size, NOFREE, false); + + /* get the number of dmap words handled */ + nw = BUDSIZE(size, BUDMIN); +@@ -2336,7 +2336,7 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, + /* update the leaf for this dmap word. + */ + rc = dbJoin(tp, word, +- dbMaxBud((u8 *) & dp->wmap[word])); ++ dbMaxBud((u8 *)&dp->wmap[word]), false); + if (rc) + return rc; + +@@ -2369,7 +2369,7 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, + + /* update the leaf. + */ +- rc = dbJoin(tp, word, size); ++ rc = dbJoin(tp, word, size, false); + if (rc) + return rc; + +@@ -2521,16 +2521,16 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) + * that it is at the front of a binary buddy system. + */ + if (oldval == NOFREE) { +- rc = dbBackSplit((dmtree_t *) dcp, leafno); ++ rc = dbBackSplit((dmtree_t *)dcp, leafno, true); + if (rc) { + release_metapage(mp); + return rc; + } + oldval = dcp->stree[ti]; + } +- dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); ++ dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval, true); + } else { +- rc = dbJoin((dmtree_t *) dcp, leafno, newval); ++ rc = dbJoin((dmtree_t *) dcp, leafno, newval, true); + if (rc) { + release_metapage(mp); + return rc; +@@ -2561,7 +2561,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) + */ + if (alloc) { + dbJoin((dmtree_t *) dcp, leafno, +- oldval); ++ oldval, true); + } else { + /* the dbJoin() above might have + * caused a larger binary buddy system +@@ -2571,9 +2571,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) + */ + if (dcp->stree[ti] == NOFREE) + dbBackSplit((dmtree_t *) +- dcp, leafno); ++ dcp, leafno, true); + dbSplit((dmtree_t *) dcp, leafno, +- dcp->budmin, oldval); ++ dcp->budmin, oldval, true); + } + + /* release the buffer and return the error. +@@ -2621,7 +2621,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) + * + * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; + */ +-static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) ++static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl) + { + int budsz; + int cursz; +@@ -2643,7 +2643,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) + while (cursz >= splitsz) { + /* update the buddy's leaf with its new value. + */ +- dbAdjTree(tp, leafno ^ budsz, cursz); ++ dbAdjTree(tp, leafno ^ budsz, cursz, is_ctl); + + /* on to the next size and buddy. + */ +@@ -2655,7 +2655,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) + /* adjust the dmap tree to reflect the specified leaf's new + * value. + */ +- dbAdjTree(tp, leafno, newval); ++ dbAdjTree(tp, leafno, newval, is_ctl); + } + + +@@ -2686,7 +2686,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) + * + * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; + */ +-static int dbBackSplit(dmtree_t * tp, int leafno) ++static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl) + { + int budsz, bud, w, bsz, size; + int cursz; +@@ -2737,7 +2737,7 @@ static int dbBackSplit(dmtree_t * tp, int leafno) + * system in two. + */ + cursz = leaf[bud] - 1; +- dbSplit(tp, bud, cursz, cursz); ++ dbSplit(tp, bud, cursz, cursz, is_ctl); + break; + } + } +@@ -2765,7 +2765,7 @@ static int dbBackSplit(dmtree_t * tp, int leafno) + * + * RETURN VALUES: none + */ +-static int dbJoin(dmtree_t * tp, int leafno, int newval) ++static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) + { + int budsz, buddy; + s8 *leaf; +@@ -2820,12 +2820,12 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval) + if (leafno < buddy) { + /* leafno is the left buddy. + */ +- dbAdjTree(tp, buddy, NOFREE); ++ dbAdjTree(tp, buddy, NOFREE, is_ctl); + } else { + /* buddy is the left buddy and becomes + * leafno. + */ +- dbAdjTree(tp, leafno, NOFREE); ++ dbAdjTree(tp, leafno, NOFREE, is_ctl); + leafno = buddy; + } + +@@ -2838,7 +2838,7 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval) + + /* update the leaf value. + */ +- dbAdjTree(tp, leafno, newval); ++ dbAdjTree(tp, leafno, newval, is_ctl); + + return 0; + } +@@ -2859,21 +2859,23 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval) + * + * RETURN VALUES: none + */ +-static void dbAdjTree(dmtree_t * tp, int leafno, int newval) ++static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl) + { + int lp, pp, k; +- int max; ++ int max, size; ++ ++ size = is_ctl ? CTLTREESIZE : TREESIZE; + + /* pick up the index of the leaf for this leafno. + */ + lp = leafno + le32_to_cpu(tp->dmt_leafidx); + ++ if (WARN_ON_ONCE(lp >= size || lp < 0)) ++ return; ++ + /* is the current value the same as the old value ? if so, + * there is nothing to do. + */ +- if (WARN_ON_ONCE(lp >= CTLTREESIZE)) +- return; +- + if (tp->dmt_stree[lp] == newval) + return; + +-- +2.43.0 + diff --git a/queue-6.6/jfs-fix-array-index-out-of-bounds-in-dinewext.patch b/queue-6.6/jfs-fix-array-index-out-of-bounds-in-dinewext.patch new file mode 100644 index 00000000000..e5af97fce01 --- /dev/null +++ b/queue-6.6/jfs-fix-array-index-out-of-bounds-in-dinewext.patch @@ -0,0 +1,78 @@ +From b6efac759788f52f0f98f1b5cf9dd566614cedcf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 09:36:22 +0800 +Subject: jfs: fix array-index-out-of-bounds in diNewExt + +From: Edward Adam Davis + +[ Upstream commit 49f9637aafa6e63ba686c13cb8549bf5e6920402 ] + +[Syz report] +UBSAN: array-index-out-of-bounds in fs/jfs/jfs_imap.c:2360:2 +index -878706688 is out of range for type 'struct iagctl[128]' +CPU: 1 PID: 5065 Comm: syz-executor282 Not tainted 6.7.0-rc4-syzkaller-00009-gbee0e7762ad2 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 +Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 + ubsan_epilogue lib/ubsan.c:217 [inline] + __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348 + diNewExt+0x3cf3/0x4000 fs/jfs/jfs_imap.c:2360 + diAllocExt fs/jfs/jfs_imap.c:1949 [inline] + diAllocAG+0xbe8/0x1e50 fs/jfs/jfs_imap.c:1666 + diAlloc+0x1d3/0x1760 fs/jfs/jfs_imap.c:1587 + ialloc+0x8f/0x900 fs/jfs/jfs_inode.c:56 + jfs_mkdir+0x1c5/0xb90 fs/jfs/namei.c:225 + vfs_mkdir+0x2f1/0x4b0 fs/namei.c:4106 + do_mkdirat+0x264/0x3a0 fs/namei.c:4129 + __do_sys_mkdir fs/namei.c:4149 [inline] + __se_sys_mkdir fs/namei.c:4147 [inline] + __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4147 + do_syscall_x64 arch/x86/entry/common.c:51 [inline] + do_syscall_64+0x45/0x110 arch/x86/entry/common.c:82 + entry_SYSCALL_64_after_hwframe+0x63/0x6b +RIP: 0033:0x7fcb7e6a0b57 +Code: ff ff 77 07 31 c0 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 53 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 +RSP: 002b:00007ffd83023038 EFLAGS: 00000286 ORIG_RAX: 0000000000000053 +RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007fcb7e6a0b57 +RDX: 00000000000a1020 RSI: 00000000000001ff RDI: 0000000020000140 +RBP: 0000000020000140 R08: 0000000000000000 R09: 0000000000000000 +R10: 0000000000000000 R11: 0000000000000286 R12: 00007ffd830230d0 +R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 + +[Analysis] +When the agstart is too large, it can cause agno overflow. + +[Fix] +After obtaining agno, if the value is invalid, exit the subsequent process. + +Reported-and-tested-by: syzbot+553d90297e6d2f50dbc7@syzkaller.appspotmail.com +Signed-off-by: Edward Adam Davis + +Modified the test from agno > MAXAG to agno >= MAXAG based on linux-next +report by kernel test robot (Dan Carpenter). + +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_imap.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c +index 1b267eec3f36..eeedf606cf9d 100644 +--- a/fs/jfs/jfs_imap.c ++++ b/fs/jfs/jfs_imap.c +@@ -2179,6 +2179,9 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) + /* get the ag and iag numbers for this iag. + */ + agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi); ++ if (agno >= MAXAG || agno < 0) ++ return -EIO; ++ + iagno = le32_to_cpu(iagp->iagnum); + + /* check if this is the last free extent within the +-- +2.43.0 + diff --git a/queue-6.6/jfs-fix-slab-out-of-bounds-read-in-dtsearch.patch b/queue-6.6/jfs-fix-slab-out-of-bounds-read-in-dtsearch.patch new file mode 100644 index 00000000000..e971c3bf398 --- /dev/null +++ b/queue-6.6/jfs-fix-slab-out-of-bounds-read-in-dtsearch.patch @@ -0,0 +1,45 @@ +From 7c4f819c72628a73fb96d4e894e3e1a230931de2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Oct 2023 11:39:07 +0530 +Subject: jfs: fix slab-out-of-bounds Read in dtSearch + +From: Manas Ghandat + +[ Upstream commit fa5492ee89463a7590a1449358002ff7ef63529f ] + +Currently while searching for current page in the sorted entry table +of the page there is a out of bound access. Added a bound check to fix +the error. + +Dave: +Set return code to -EIO + +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202310241724.Ed02yUz9-lkp@intel.com/ +Signed-off-by: Manas Ghandat +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_dtree.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c +index f3d3e8b3f50c..031d8f570f58 100644 +--- a/fs/jfs/jfs_dtree.c ++++ b/fs/jfs/jfs_dtree.c +@@ -633,6 +633,11 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, + for (base = 0, lim = p->header.nextindex; lim; lim >>= 1) { + index = base + (lim >> 1); + ++ if (stbl[index] < 0) { ++ rc = -EIO; ++ goto out; ++ } ++ + if (p->header.flag & BT_LEAF) { + /* uppercase leaf name to compare */ + cmp = +-- +2.43.0 + diff --git a/queue-6.6/jfs-fix-uaf-in-jfs_evict_inode.patch b/queue-6.6/jfs-fix-uaf-in-jfs_evict_inode.patch new file mode 100644 index 00000000000..356de9bdb40 --- /dev/null +++ b/queue-6.6/jfs-fix-uaf-in-jfs_evict_inode.patch @@ -0,0 +1,50 @@ +From 3c055ab2d92a1c8fa20ba7648b2d481bc2a19fd7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Oct 2023 13:39:04 +0800 +Subject: jfs: fix uaf in jfs_evict_inode + +From: Edward Adam Davis + +[ Upstream commit e0e1958f4c365e380b17ccb35617345b31ef7bf3 ] + +When the execution of diMount(ipimap) fails, the object ipimap that has been +released may be accessed in diFreeSpecial(). Asynchronous ipimap release occurs +when rcu_core() calls jfs_free_node(). + +Therefore, when diMount(ipimap) fails, sbi->ipimap should not be initialized as +ipimap. + +Reported-and-tested-by: syzbot+01cf2dbcbe2022454388@syzkaller.appspotmail.com +Signed-off-by: Edward Adam Davis +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_mount.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c +index b83aae56a1f2..631b8bd3e438 100644 +--- a/fs/jfs/jfs_mount.c ++++ b/fs/jfs/jfs_mount.c +@@ -172,15 +172,15 @@ int jfs_mount(struct super_block *sb) + } + jfs_info("jfs_mount: ipimap:0x%p", ipimap); + +- /* map further access of per fileset inodes by the fileset inode */ +- sbi->ipimap = ipimap; +- + /* initialize fileset inode allocation map */ + if ((rc = diMount(ipimap))) { + jfs_err("jfs_mount: diMount failed w/rc = %d", rc); + goto err_ipimap; + } + ++ /* map further access of per fileset inodes by the fileset inode */ ++ sbi->ipimap = ipimap; ++ + return rc; + + /* +-- +2.43.0 + diff --git a/queue-6.6/kunit-tool-fix-parsing-of-test-attributes.patch b/queue-6.6/kunit-tool-fix-parsing-of-test-attributes.patch new file mode 100644 index 00000000000..6e471bb50b1 --- /dev/null +++ b/queue-6.6/kunit-tool-fix-parsing-of-test-attributes.patch @@ -0,0 +1,57 @@ +From a2c84985200405680819bb6d98f9195909d07926 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 21:34:09 +0000 +Subject: kunit: tool: fix parsing of test attributes + +From: Rae Moar + +[ Upstream commit 8ae27bc7fff4ef467a7964821a6cedb34a05d3b2 ] + +Add parsing of attributes as diagnostic data. Fixes issue with test plan +being parsed incorrectly as diagnostic data when located after +suite-level attributes. + +Note that if there does not exist a test plan line, the diagnostic lines +between the suite header and the first result will be saved in the suite +log rather than the first test case log. + +Signed-off-by: Rae Moar +Reviewed-by: David Gow +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/kunit/kunit_parser.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py +index 79d8832c862a..ce34be15c929 100644 +--- a/tools/testing/kunit/kunit_parser.py ++++ b/tools/testing/kunit/kunit_parser.py +@@ -450,7 +450,7 @@ def parse_diagnostic(lines: LineStream) -> List[str]: + Log of diagnostic lines + """ + log = [] # type: List[str] +- non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START] ++ non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START, TEST_PLAN] + while lines and not any(re.match(lines.peek()) + for re in non_diagnostic_lines): + log.append(lines.pop()) +@@ -726,6 +726,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: + # test plan + test.name = "main" + ktap_line = parse_ktap_header(lines, test) ++ test.log.extend(parse_diagnostic(lines)) + parse_test_plan(lines, test) + parent_test = True + else: +@@ -737,6 +738,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: + if parent_test: + # If KTAP version line and/or subtest header is found, attempt + # to parse test plan and print test header ++ test.log.extend(parse_diagnostic(lines)) + parse_test_plan(lines, test) + print_test_header(test) + expected_count = test.expected_count +-- +2.43.0 + diff --git a/queue-6.6/kvm-s390-fix-setting-of-fpc-register.patch b/queue-6.6/kvm-s390-fix-setting-of-fpc-register.patch new file mode 100644 index 00000000000..d7ffe7da051 --- /dev/null +++ b/queue-6.6/kvm-s390-fix-setting-of-fpc-register.patch @@ -0,0 +1,70 @@ +From cab7c54016c7bc38a971423a547ba5c0c606c5b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 18:56:00 +0100 +Subject: KVM: s390: fix setting of fpc register + +From: Heiko Carstens + +[ Upstream commit b988b1bb0053c0dcd26187d29ef07566a565cf55 ] + +kvm_arch_vcpu_ioctl_set_fpu() allows to set the floating point control +(fpc) register of a guest cpu. The new value is tested for validity by +temporarily loading it into the fpc register. + +This may lead to corruption of the fpc register of the host process: +if an interrupt happens while the value is temporarily loaded into the fpc +register, and within interrupt context floating point or vector registers +are used, the current fp/vx registers are saved with save_fpu_regs() +assuming they belong to user space and will be loaded into fp/vx registers +when returning to user space. + +test_fp_ctl() restores the original user space / host process fpc register +value, however it will be discarded, when returning to user space. + +In result the host process will incorrectly continue to run with the value +that was supposed to be used for a guest cpu. + +Fix this by simply removing the test. There is another test right before +the SIE context is entered which will handles invalid values. + +This results in a change of behaviour: invalid values will now be accepted +instead of that the ioctl fails with -EINVAL. This seems to be acceptable, +given that this interface is most likely not used anymore, and this is in +addition the same behaviour implemented with the memory mapped interface +(replace invalid values with zero) - see sync_regs() in kvm-s390.c. + +Reviewed-by: Christian Borntraeger +Reviewed-by: Claudio Imbrenda +Signed-off-by: Heiko Carstens +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/kvm/kvm-s390.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c +index b3f17e014cab..49cce436444e 100644 +--- a/arch/s390/kvm/kvm-s390.c ++++ b/arch/s390/kvm/kvm-s390.c +@@ -4307,10 +4307,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) + + vcpu_load(vcpu); + +- if (test_fp_ctl(fpu->fpc)) { +- ret = -EINVAL; +- goto out; +- } + vcpu->run->s.regs.fpc = fpu->fpc; + if (MACHINE_HAS_VX) + convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs, +@@ -4318,7 +4314,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) + else + memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs)); + +-out: + vcpu_put(vcpu); + return ret; + } +-- +2.43.0 + diff --git a/queue-6.6/leds-trigger-panic-don-t-register-panic-notifier-if-.patch b/queue-6.6/leds-trigger-panic-don-t-register-panic-notifier-if-.patch new file mode 100644 index 00000000000..964904c2d9f --- /dev/null +++ b/queue-6.6/leds-trigger-panic-don-t-register-panic-notifier-if-.patch @@ -0,0 +1,43 @@ +From a36fd97bbedcb7591cee9500e778cb55582f31d2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 16 Dec 2023 21:05:33 +0100 +Subject: leds: trigger: panic: Don't register panic notifier if creating the + trigger failed + +From: Heiner Kallweit + +[ Upstream commit afacb21834bb02785ddb0c3ec197208803b74faa ] + +It doesn't make sense to register the panic notifier if creating the +panic trigger failed. + +Signed-off-by: Heiner Kallweit +Link: https://lore.kernel.org/r/8a61e229-5388-46c7-919a-4d18cc7362b2@gmail.com +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/leds/trigger/ledtrig-panic.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c +index 64abf2e91608..5a6b21bfeb9a 100644 +--- a/drivers/leds/trigger/ledtrig-panic.c ++++ b/drivers/leds/trigger/ledtrig-panic.c +@@ -64,10 +64,13 @@ static long led_panic_blink(int state) + + static int __init ledtrig_panic_init(void) + { ++ led_trigger_register_simple("panic", &trigger); ++ if (!trigger) ++ return -ENOMEM; ++ + atomic_notifier_chain_register(&panic_notifier_list, + &led_trigger_panic_nb); + +- led_trigger_register_simple("panic", &trigger); + panic_blink = led_panic_blink; + return 0; + } +-- +2.43.0 + diff --git a/queue-6.6/libbpf-fix-null-pointer-dereference-in-bpf_object__c.patch b/queue-6.6/libbpf-fix-null-pointer-dereference-in-bpf_object__c.patch new file mode 100644 index 00000000000..8d9ffd806a1 --- /dev/null +++ b/queue-6.6/libbpf-fix-null-pointer-dereference-in-bpf_object__c.patch @@ -0,0 +1,73 @@ +From 12ee74ecb1c050c40180d3bd0e41ccb9a28c75e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Dec 2023 11:39:47 +0800 +Subject: libbpf: Fix NULL pointer dereference in + bpf_object__collect_prog_relos + +From: Mingyi Zhang + +[ Upstream commit fc3a5534e2a8855427403113cbeb54af5837bbe0 ] + +An issue occurred while reading an ELF file in libbpf.c during fuzzing: + + Program received signal SIGSEGV, Segmentation fault. + 0x0000000000958e97 in bpf_object.collect_prog_relos () at libbpf.c:4206 + 4206 in libbpf.c + (gdb) bt + #0 0x0000000000958e97 in bpf_object.collect_prog_relos () at libbpf.c:4206 + #1 0x000000000094f9d6 in bpf_object.collect_relos () at libbpf.c:6706 + #2 0x000000000092bef3 in bpf_object_open () at libbpf.c:7437 + #3 0x000000000092c046 in bpf_object.open_mem () at libbpf.c:7497 + #4 0x0000000000924afa in LLVMFuzzerTestOneInput () at fuzz/bpf-object-fuzzer.c:16 + #5 0x000000000060be11 in testblitz_engine::fuzzer::Fuzzer::run_one () + #6 0x000000000087ad92 in tracing::span::Span::in_scope () + #7 0x00000000006078aa in testblitz_engine::fuzzer::util::walkdir () + #8 0x00000000005f3217 in testblitz_engine::entrypoint::main::{{closure}} () + #9 0x00000000005f2601 in main () + (gdb) + +scn_data was null at this code(tools/lib/bpf/src/libbpf.c): + + if (rel->r_offset % BPF_INSN_SZ || rel->r_offset >= scn_data->d_size) { + +The scn_data is derived from the code above: + + scn = elf_sec_by_idx(obj, sec_idx); + scn_data = elf_sec_data(obj, scn); + + relo_sec_name = elf_sec_str(obj, shdr->sh_name); + sec_name = elf_sec_name(obj, scn); + if (!relo_sec_name || !sec_name)// don't check whether scn_data is NULL + return -EINVAL; + +In certain special scenarios, such as reading a malformed ELF file, +it is possible that scn_data may be a null pointer + +Signed-off-by: Mingyi Zhang +Signed-off-by: Xin Liu +Signed-off-by: Changye Wu +Signed-off-by: Andrii Nakryiko +Signed-off-by: Daniel Borkmann +Acked-by: Daniel Borkmann +Link: https://lore.kernel.org/bpf/20231221033947.154564-1-liuxin350@huawei.com +Signed-off-by: Sasha Levin +--- + tools/lib/bpf/libbpf.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c +index 96ff1aa4bf6a..de08b920a149 100644 +--- a/tools/lib/bpf/libbpf.c ++++ b/tools/lib/bpf/libbpf.c +@@ -4251,6 +4251,8 @@ bpf_object__collect_prog_relos(struct bpf_object *obj, Elf64_Shdr *shdr, Elf_Dat + + scn = elf_sec_by_idx(obj, sec_idx); + scn_data = elf_sec_data(obj, scn); ++ if (!scn_data) ++ return -LIBBPF_ERRNO__FORMAT; + + relo_sec_name = elf_sec_str(obj, shdr->sh_name); + sec_name = elf_sec_name(obj, scn); +-- +2.43.0 + diff --git a/queue-6.6/libbpf-fix-potential-uninitialized-tail-padding-with.patch b/queue-6.6/libbpf-fix-potential-uninitialized-tail-padding-with.patch new file mode 100644 index 00000000000..f3fb61eaf85 --- /dev/null +++ b/queue-6.6/libbpf-fix-potential-uninitialized-tail-padding-with.patch @@ -0,0 +1,207 @@ +From 137805da0e5770e47732ad68c549e18040de6c3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Nov 2023 12:15:11 -0800 +Subject: libbpf: Fix potential uninitialized tail padding with + LIBBPF_OPTS_RESET + +From: Yonghong Song + +[ Upstream commit 7f7c43693c1b46652cfafb7af67ba31726d6ec4e ] + +Martin reported that there is a libbpf complaining of non-zero-value tail +padding with LIBBPF_OPTS_RESET macro if struct bpf_netkit_opts is modified +to have a 4-byte tail padding. This only happens to clang compiler. +The commend line is: ./test_progs -t tc_netkit_multi_links +Martin and I did some investigation and found this indeed the case and +the following are the investigation details. + +Clang: + clang version 18.0.0 + + +tools/lib/bpf/libbpf_common.h: + #define LIBBPF_OPTS_RESET(NAME, ...) \ + do { \ + memset(&NAME, 0, sizeof(NAME)); \ + NAME = (typeof(NAME)) { \ + .sz = sizeof(NAME), \ + __VA_ARGS__ \ + }; \ + } while (0) + + #endif + +tools/lib/bpf/libbpf.h: + struct bpf_netkit_opts { + /* size of this struct, for forward/backward compatibility */ + size_t sz; + __u32 flags; + __u32 relative_fd; + __u32 relative_id; + __u64 expected_revision; + size_t :0; + }; + #define bpf_netkit_opts__last_field expected_revision +In the above struct bpf_netkit_opts, there is no tail padding. + +prog_tests/tc_netkit.c: + static void serial_test_tc_netkit_multi_links_target(int mode, int target) + { + ... + LIBBPF_OPTS(bpf_netkit_opts, optl); + ... + LIBBPF_OPTS_RESET(optl, + .flags = BPF_F_BEFORE, + .relative_fd = bpf_program__fd(skel->progs.tc1), + ); + ... + } + +Let us make the following source change, note that we have a 4-byte +tailing padding now. + diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h + index 6cd9c501624f..0dd83910ae9a 100644 + --- a/tools/lib/bpf/libbpf.h + +++ b/tools/lib/bpf/libbpf.h + @@ -803,13 +803,13 @@ bpf_program__attach_tcx(const struct bpf_program *prog, int ifindex, + struct bpf_netkit_opts { + /* size of this struct, for forward/backward compatibility */ + size_t sz; + - __u32 flags; + __u32 relative_fd; + __u32 relative_id; + __u64 expected_revision; + + __u32 flags; + size_t :0; + }; + -#define bpf_netkit_opts__last_field expected_revision + +#define bpf_netkit_opts__last_field flags + +The clang 18 generated asm code looks like below: + ; LIBBPF_OPTS_RESET(optl, + 55e3: 48 8d 7d 98 leaq -0x68(%rbp), %rdi + 55e7: 31 f6 xorl %esi, %esi + 55e9: ba 20 00 00 00 movl $0x20, %edx + 55ee: e8 00 00 00 00 callq 0x55f3 + 55f3: 48 c7 85 10 fd ff ff 20 00 00 00 movq $0x20, -0x2f0(%rbp) + 55fe: 48 8b 85 68 ff ff ff movq -0x98(%rbp), %rax + 5605: 48 8b 78 18 movq 0x18(%rax), %rdi + 5609: e8 00 00 00 00 callq 0x560e + 560e: 89 85 18 fd ff ff movl %eax, -0x2e8(%rbp) + 5614: c7 85 1c fd ff ff 00 00 00 00 movl $0x0, -0x2e4(%rbp) + 561e: 48 c7 85 20 fd ff ff 00 00 00 00 movq $0x0, -0x2e0(%rbp) + 5629: c7 85 28 fd ff ff 08 00 00 00 movl $0x8, -0x2d8(%rbp) + 5633: 48 8b 85 10 fd ff ff movq -0x2f0(%rbp), %rax + 563a: 48 89 45 98 movq %rax, -0x68(%rbp) + 563e: 48 8b 85 18 fd ff ff movq -0x2e8(%rbp), %rax + 5645: 48 89 45 a0 movq %rax, -0x60(%rbp) + 5649: 48 8b 85 20 fd ff ff movq -0x2e0(%rbp), %rax + 5650: 48 89 45 a8 movq %rax, -0x58(%rbp) + 5654: 48 8b 85 28 fd ff ff movq -0x2d8(%rbp), %rax + 565b: 48 89 45 b0 movq %rax, -0x50(%rbp) + ; link = bpf_program__attach_netkit(skel->progs.tc2, ifindex, &optl); + +At -O0 level, the clang compiler creates an intermediate copy. +We have below to store 'flags' with 4-byte store and leave another 4 byte +in the same 8-byte-aligned storage undefined, + 5629: c7 85 28 fd ff ff 08 00 00 00 movl $0x8, -0x2d8(%rbp) +and later we store 8-byte to the original zero'ed buffer + 5654: 48 8b 85 28 fd ff ff movq -0x2d8(%rbp), %rax + 565b: 48 89 45 b0 movq %rax, -0x50(%rbp) + +This caused a problem as the 4-byte value at [%rbp-0x2dc, %rbp-0x2e0) +may be garbage. + +gcc (gcc 11.4) does not have this issue as it does zeroing struct first before +doing assignments: + ; LIBBPF_OPTS_RESET(optl, + 50fd: 48 8d 85 40 fc ff ff leaq -0x3c0(%rbp), %rax + 5104: ba 20 00 00 00 movl $0x20, %edx + 5109: be 00 00 00 00 movl $0x0, %esi + 510e: 48 89 c7 movq %rax, %rdi + 5111: e8 00 00 00 00 callq 0x5116 + 5116: 48 8b 45 f0 movq -0x10(%rbp), %rax + 511a: 48 8b 40 18 movq 0x18(%rax), %rax + 511e: 48 89 c7 movq %rax, %rdi + 5121: e8 00 00 00 00 callq 0x5126 + 5126: 48 c7 85 40 fc ff ff 00 00 00 00 movq $0x0, -0x3c0(%rbp) + 5131: 48 c7 85 48 fc ff ff 00 00 00 00 movq $0x0, -0x3b8(%rbp) + 513c: 48 c7 85 50 fc ff ff 00 00 00 00 movq $0x0, -0x3b0(%rbp) + 5147: 48 c7 85 58 fc ff ff 00 00 00 00 movq $0x0, -0x3a8(%rbp) + 5152: 48 c7 85 40 fc ff ff 20 00 00 00 movq $0x20, -0x3c0(%rbp) + 515d: 89 85 48 fc ff ff movl %eax, -0x3b8(%rbp) + 5163: c7 85 58 fc ff ff 08 00 00 00 movl $0x8, -0x3a8(%rbp) + ; link = bpf_program__attach_netkit(skel->progs.tc2, ifindex, &optl); + +It is not clear how to resolve the compiler code generation as the compiler +generates correct code w.r.t. how to handle unnamed padding in C standard. +So this patch changed LIBBPF_OPTS_RESET macro to avoid uninitialized tail +padding. We already knows LIBBPF_OPTS macro works on both gcc and clang, +even with tail padding. So LIBBPF_OPTS_RESET is changed to be a +LIBBPF_OPTS followed by a memcpy(), thus avoiding uninitialized tail padding. + +The below is asm code generated with this patch and with clang compiler: + ; LIBBPF_OPTS_RESET(optl, + 55e3: 48 8d bd 10 fd ff ff leaq -0x2f0(%rbp), %rdi + 55ea: 31 f6 xorl %esi, %esi + 55ec: ba 20 00 00 00 movl $0x20, %edx + 55f1: e8 00 00 00 00 callq 0x55f6 + 55f6: 48 c7 85 10 fd ff ff 20 00 00 00 movq $0x20, -0x2f0(%rbp) + 5601: 48 8b 85 68 ff ff ff movq -0x98(%rbp), %rax + 5608: 48 8b 78 18 movq 0x18(%rax), %rdi + 560c: e8 00 00 00 00 callq 0x5611 + 5611: 89 85 18 fd ff ff movl %eax, -0x2e8(%rbp) + 5617: c7 85 1c fd ff ff 00 00 00 00 movl $0x0, -0x2e4(%rbp) + 5621: 48 c7 85 20 fd ff ff 00 00 00 00 movq $0x0, -0x2e0(%rbp) + 562c: c7 85 28 fd ff ff 08 00 00 00 movl $0x8, -0x2d8(%rbp) + 5636: 48 8b 85 10 fd ff ff movq -0x2f0(%rbp), %rax + 563d: 48 89 45 98 movq %rax, -0x68(%rbp) + 5641: 48 8b 85 18 fd ff ff movq -0x2e8(%rbp), %rax + 5648: 48 89 45 a0 movq %rax, -0x60(%rbp) + 564c: 48 8b 85 20 fd ff ff movq -0x2e0(%rbp), %rax + 5653: 48 89 45 a8 movq %rax, -0x58(%rbp) + 5657: 48 8b 85 28 fd ff ff movq -0x2d8(%rbp), %rax + 565e: 48 89 45 b0 movq %rax, -0x50(%rbp) + ; link = bpf_program__attach_netkit(skel->progs.tc2, ifindex, &optl); + +In the above code, a temporary buffer is zeroed and then has proper value assigned. +Finally, values in temporary buffer are copied to the original variable buffer, +hence tail padding is guaranteed to be 0. + +Signed-off-by: Yonghong Song +Signed-off-by: Andrii Nakryiko +Tested-by: Martin KaFai Lau +Link: https://lore.kernel.org/bpf/20231107201511.2548645-1-yonghong.song@linux.dev +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/lib/bpf/libbpf_common.h | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/tools/lib/bpf/libbpf_common.h b/tools/lib/bpf/libbpf_common.h +index b7060f254486..8fe248e14eb6 100644 +--- a/tools/lib/bpf/libbpf_common.h ++++ b/tools/lib/bpf/libbpf_common.h +@@ -79,11 +79,14 @@ + */ + #define LIBBPF_OPTS_RESET(NAME, ...) \ + do { \ +- memset(&NAME, 0, sizeof(NAME)); \ +- NAME = (typeof(NAME)) { \ +- .sz = sizeof(NAME), \ +- __VA_ARGS__ \ +- }; \ ++ typeof(NAME) ___##NAME = ({ \ ++ memset(&___##NAME, 0, sizeof(NAME)); \ ++ (typeof(NAME)) { \ ++ .sz = sizeof(NAME), \ ++ __VA_ARGS__ \ ++ }; \ ++ }); \ ++ memcpy(&NAME, &___##NAME, sizeof(NAME)); \ + } while (0) + + #endif /* __LIBBPF_LIBBPF_COMMON_H */ +-- +2.43.0 + diff --git a/queue-6.6/libsubcmd-fix-memory-leak-in-uniq.patch b/queue-6.6/libsubcmd-fix-memory-leak-in-uniq.patch new file mode 100644 index 00000000000..0d71c94b761 --- /dev/null +++ b/queue-6.6/libsubcmd-fix-memory-leak-in-uniq.patch @@ -0,0 +1,62 @@ +From 59ad55b5e76fbcb2936ab89387e0e152110b726d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 16:05:13 -0800 +Subject: libsubcmd: Fix memory leak in uniq() + +From: Ian Rogers + +[ Upstream commit ad30469a841b50dbb541df4d6971d891f703c297 ] + +uniq() will write one command name over another causing the overwritten +string to be leaked. Fix by doing a pass that removes duplicates and a +second that removes the holes. + +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Chenyuan Mi +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20231208000515.1693746-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/lib/subcmd/help.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/tools/lib/subcmd/help.c b/tools/lib/subcmd/help.c +index adfbae27dc36..8561b0f01a24 100644 +--- a/tools/lib/subcmd/help.c ++++ b/tools/lib/subcmd/help.c +@@ -52,11 +52,21 @@ void uniq(struct cmdnames *cmds) + if (!cmds->cnt) + return; + +- for (i = j = 1; i < cmds->cnt; i++) +- if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name)) +- cmds->names[j++] = cmds->names[i]; +- ++ for (i = 1; i < cmds->cnt; i++) { ++ if (!strcmp(cmds->names[i]->name, cmds->names[i-1]->name)) ++ zfree(&cmds->names[i - 1]); ++ } ++ for (i = 0, j = 0; i < cmds->cnt; i++) { ++ if (cmds->names[i]) { ++ if (i == j) ++ j++; ++ else ++ cmds->names[j++] = cmds->names[i]; ++ } ++ } + cmds->cnt = j; ++ while (j < i) ++ cmds->names[j++] = NULL; + } + + void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) +-- +2.43.0 + diff --git a/queue-6.6/mailbox-arm_mhuv2-fix-a-bug-for-mhuv2_sender_interru.patch b/queue-6.6/mailbox-arm_mhuv2-fix-a-bug-for-mhuv2_sender_interru.patch new file mode 100644 index 00000000000..3ef85ad8e60 --- /dev/null +++ b/queue-6.6/mailbox-arm_mhuv2-fix-a-bug-for-mhuv2_sender_interru.patch @@ -0,0 +1,60 @@ +From b74f0be0970a06f09e0600f8ebaefde4742b77f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 19:37:22 +0800 +Subject: mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt + +From: Xiaowu.ding + +[ Upstream commit ee01c0b4384d19ecc5dfa7db3fd4303f965c3eba ] + +Message Handling Unit version is v2.1. + +When arm_mhuv2 working with the data protocol transfer mode. +We have split one mhu into two channels, and every channel +include four channel windows, the two channels share +one gic spi interrupt. + +There is a problem with the sending scenario. + +The first channel will take up 0-3 channel windows, and the second +channel take up 4-7 channel windows. When the first channel send the +data, and the receiver will clear all the four channels status. +Although we only enabled the interrupt on the last channel window with +register CH_INT_EN,the register CHCOMB_INT_ST0 will be 0xf, not be 0x8. +Currently we just clear the last channel windows int status with the +data proctol mode.So after that,the CHCOMB_INT_ST0 status will be 0x7, +not be the 0x0. + +Then the second channel send the data, the receiver read the +data, clear all the four channel windows status, trigger the sender +interrupt. But currently the CHCOMB_INT_ST0 register will be 0xf7, +get_irq_chan_comb function will always return the first channel. + +So this patch clear all channel windows int status to avoid this interrupt +confusion. + +Signed-off-by: Xiaowu.ding +Acked-by: Viresh Kumar +Signed-off-by: Jassi Brar +Signed-off-by: Sasha Levin +--- + drivers/mailbox/arm_mhuv2.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c +index c6d4957c4da8..0ec21dcdbde7 100644 +--- a/drivers/mailbox/arm_mhuv2.c ++++ b/drivers/mailbox/arm_mhuv2.c +@@ -553,7 +553,8 @@ static irqreturn_t mhuv2_sender_interrupt(int irq, void *data) + priv = chan->con_priv; + + if (!IS_PROTOCOL_DOORBELL(priv)) { +- writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + priv->windows - 1].int_clr); ++ for (i = 0; i < priv->windows; i++) ++ writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + i].int_clr); + + if (chan->cl) { + mbox_chan_txdone(chan, 0); +-- +2.43.0 + diff --git a/queue-6.6/md-whenassemble-the-array-consult-the-superblock-of-.patch b/queue-6.6/md-whenassemble-the-array-consult-the-superblock-of-.patch new file mode 100644 index 00000000000..772f8fbeb26 --- /dev/null +++ b/queue-6.6/md-whenassemble-the-array-consult-the-superblock-of-.patch @@ -0,0 +1,155 @@ +From 3f27326a6c41c8fa2ecbd1fab7867616d17edad0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Dec 2023 14:24:31 +0200 +Subject: md: Whenassemble the array, consult the superblock of the freshest + device + +From: Alex Lyakas + +[ Upstream commit dc1cc22ed58f11d58d8553c5ec5f11cbfc3e3039 ] + +Upon assembling the array, both kernel and mdadm allow the devices to have event +counter difference of 1, and still consider them as up-to-date. +However, a device whose event count is behind by 1, may in fact not be up-to-date, +and array resync with such a device may cause data corruption. +To avoid this, consult the superblock of the freshest device about the status +of a device, whose event counter is behind by 1. + +Signed-off-by: Alex Lyakas +Signed-off-by: Song Liu +Link: https://lore.kernel.org/r/1702470271-16073-1-git-send-email-alex.lyakas@zadara.com +Signed-off-by: Sasha Levin +--- + drivers/md/md.c | 54 ++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 44 insertions(+), 10 deletions(-) + +diff --git a/drivers/md/md.c b/drivers/md/md.c +index 8c40c1c3959c..dccf270aa1b4 100644 +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -1122,6 +1122,7 @@ struct super_type { + struct md_rdev *refdev, + int minor_version); + int (*validate_super)(struct mddev *mddev, ++ struct md_rdev *freshest, + struct md_rdev *rdev); + void (*sync_super)(struct mddev *mddev, + struct md_rdev *rdev); +@@ -1259,8 +1260,9 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor + + /* + * validate_super for 0.90.0 ++ * note: we are not using "freshest" for 0.9 superblock + */ +-static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev) ++static int super_90_validate(struct mddev *mddev, struct md_rdev *freshest, struct md_rdev *rdev) + { + mdp_disk_t *desc; + mdp_super_t *sb = page_address(rdev->sb_page); +@@ -1772,7 +1774,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ + return ret; + } + +-static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) ++static int super_1_validate(struct mddev *mddev, struct md_rdev *freshest, struct md_rdev *rdev) + { + struct mdp_superblock_1 *sb = page_address(rdev->sb_page); + __u64 ev1 = le64_to_cpu(sb->events); +@@ -1868,13 +1870,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) + } + } else if (mddev->pers == NULL) { + /* Insist of good event counter while assembling, except for +- * spares (which don't need an event count) */ +- ++ev1; ++ * spares (which don't need an event count). ++ * Similar to mdadm, we allow event counter difference of 1 ++ * from the freshest device. ++ */ + if (rdev->desc_nr >= 0 && + rdev->desc_nr < le32_to_cpu(sb->max_dev) && + (le16_to_cpu(sb->dev_roles[rdev->desc_nr]) < MD_DISK_ROLE_MAX || + le16_to_cpu(sb->dev_roles[rdev->desc_nr]) == MD_DISK_ROLE_JOURNAL)) +- if (ev1 < mddev->events) ++ if (ev1 + 1 < mddev->events) + return -EINVAL; + } else if (mddev->bitmap) { + /* If adding to array with a bitmap, then we can accept an +@@ -1895,8 +1899,38 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) + rdev->desc_nr >= le32_to_cpu(sb->max_dev)) { + role = MD_DISK_ROLE_SPARE; + rdev->desc_nr = -1; +- } else ++ } else if (mddev->pers == NULL && freshest && ev1 < mddev->events) { ++ /* ++ * If we are assembling, and our event counter is smaller than the ++ * highest event counter, we cannot trust our superblock about the role. ++ * It could happen that our rdev was marked as Faulty, and all other ++ * superblocks were updated with +1 event counter. ++ * Then, before the next superblock update, which typically happens when ++ * remove_and_add_spares() removes the device from the array, there was ++ * a crash or reboot. ++ * If we allow current rdev without consulting the freshest superblock, ++ * we could cause data corruption. ++ * Note that in this case our event counter is smaller by 1 than the ++ * highest, otherwise, this rdev would not be allowed into array; ++ * both kernel and mdadm allow event counter difference of 1. ++ */ ++ struct mdp_superblock_1 *freshest_sb = page_address(freshest->sb_page); ++ u32 freshest_max_dev = le32_to_cpu(freshest_sb->max_dev); ++ ++ if (rdev->desc_nr >= freshest_max_dev) { ++ /* this is unexpected, better not proceed */ ++ pr_warn("md: %s: rdev[%pg]: desc_nr(%d) >= freshest(%pg)->sb->max_dev(%u)\n", ++ mdname(mddev), rdev->bdev, rdev->desc_nr, ++ freshest->bdev, freshest_max_dev); ++ return -EUCLEAN; ++ } ++ ++ role = le16_to_cpu(freshest_sb->dev_roles[rdev->desc_nr]); ++ pr_debug("md: %s: rdev[%pg]: role=%d(0x%x) according to freshest %pg\n", ++ mdname(mddev), rdev->bdev, role, role, freshest->bdev); ++ } else { + role = le16_to_cpu(sb->dev_roles[rdev->desc_nr]); ++ } + switch(role) { + case MD_DISK_ROLE_SPARE: /* spare */ + break; +@@ -2804,7 +2838,7 @@ static int add_bound_rdev(struct md_rdev *rdev) + * and should be added immediately. + */ + super_types[mddev->major_version]. +- validate_super(mddev, rdev); ++ validate_super(mddev, NULL/*freshest*/, rdev); + if (add_journal) + mddev_suspend(mddev); + err = mddev->pers->hot_add_disk(mddev, rdev); +@@ -3742,7 +3776,7 @@ static int analyze_sbs(struct mddev *mddev) + } + + super_types[mddev->major_version]. +- validate_super(mddev, freshest); ++ validate_super(mddev, NULL/*freshest*/, freshest); + + i = 0; + rdev_for_each_safe(rdev, tmp, mddev) { +@@ -3757,7 +3791,7 @@ static int analyze_sbs(struct mddev *mddev) + } + if (rdev != freshest) { + if (super_types[mddev->major_version]. +- validate_super(mddev, rdev)) { ++ validate_super(mddev, freshest, rdev)) { + pr_warn("md: kicking non-fresh %pg from array!\n", + rdev->bdev); + md_kick_rdev_from_array(rdev); +@@ -6809,7 +6843,7 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info) + rdev->saved_raid_disk = rdev->raid_disk; + } else + super_types[mddev->major_version]. +- validate_super(mddev, rdev); ++ validate_super(mddev, NULL/*freshest*/, rdev); + if ((info->state & (1<raid_disk != info->raid_disk) { + /* This was a hot-add request, but events doesn't +-- +2.43.0 + diff --git a/queue-6.6/media-amphion-remove-mutext-lock-in-condition-of-wai.patch b/queue-6.6/media-amphion-remove-mutext-lock-in-condition-of-wai.patch new file mode 100644 index 00000000000..a7be4f7d95b --- /dev/null +++ b/queue-6.6/media-amphion-remove-mutext-lock-in-condition-of-wai.patch @@ -0,0 +1,160 @@ +From b18e62a4948eb530dff13f51cc599a88b4aa86e8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Dec 2023 15:33:42 +0800 +Subject: media: amphion: remove mutext lock in condition of wait_event + +From: Ming Qian + +[ Upstream commit f9c8ddce2fe3b767582f299d03fc8fb85943568c ] + +mutext_lock should not be called in condition of wait_event, otherwise, +when CONFIG_DEBUG_ATOMIC_SLEEP is enabled, we may meet the following +warning: +do not call blocking ops when !TASK_RUNNING; state=2 +WARNING: CPU: 5 PID: 741 at kernel/sched/core.c:9859 +__might_sleep+0x80/0xa4 +Hardware name: Freescale i.MX8QM MEK (DT) +pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : +__might_sleep+0x80/0xa4 lr : __might_sleep+0x80/0xa4 sp : ffffffc0123738a0 +x29: ffffffc0123738a0 x28: ffffffc009194c48 x27: ffffffc00bbc1050 +x26: ffffff8814b282f0 x25: ffffff8814b280d0 x24: ffffff8814b28080 +x23: 0000000000000001 x22: 0000000000000032 x21: ffffffc00bbc1000 +x20: 000000000000011b x19: ffffffc009324670 x18: 00000000fffffffd +x17: 30303c5b20746120 x16: 74657320323d6574 x15: 617473203b474e49 +x14: 00058b5b8b9aa1f1 x13: ffffffc00903cda0 x12: 00000000d744fcc9 +x11: 000000000000001c x10: 00000000000009a0 x9 : ffffffc0090201f4 +x8 : ffffff8828245000 x7 : 0000000000000001 x6 : 0000000000000001 +x5 : 00000000410fd080 x4 : 0000000000000002 x3 : ffffff8815aab4c8 +x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff8828244600 +Call trace: + __might_sleep+0x80/0xa4 + mutex_lock+0x2c/0x80 + sync_session_response+0x110/0x310 + vpu_session_send_cmd+0x18c/0x244 + vpu_session_start+0x38/0x70 + vdec_start_session+0x1b4/0x3e0 + vpu_vb2_start_streaming+0xa0/0x1c4 + vb2_start_streaming+0x74/0x160 + vb2_core_qbuf+0x488/0x650 + vb2_qbuf+0x9c/0x100 + v4l2_m2m_qbuf+0x7c/0x224 + v4l2_m2m_ioctl_qbuf+0x20/0x2c + v4l_qbuf+0x50/0x6c + __video_do_ioctl+0x174/0x3f0 + video_usercopy+0x210/0x7cc + video_ioctl2+0x20/0x30 + v4l2_ioctl+0x48/0x6c + +we need to refine check_is_responsed() to remove the mutext_lock, each +cmd has a monotonically increasing id, and cmds are executed +sequentially, so we can check the id of the last reponsed cmd, then +determine whether a command has been responded or not. + +Signed-off-by: Ming Qian +CC: Xiaolei Wang +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/platform/amphion/vpu.h | 3 ++- + drivers/media/platform/amphion/vpu_cmds.c | 28 ++++++++--------------- + drivers/media/platform/amphion/vpu_v4l2.c | 1 + + 3 files changed, 12 insertions(+), 20 deletions(-) + +diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h +index 5a701f64289e..0246cf0ac3a8 100644 +--- a/drivers/media/platform/amphion/vpu.h ++++ b/drivers/media/platform/amphion/vpu.h +@@ -154,7 +154,6 @@ struct vpu_core { + struct vpu_mbox tx_type; + struct vpu_mbox tx_data; + struct vpu_mbox rx; +- unsigned long cmd_seq; + + wait_queue_head_t ack_wq; + struct completion cmp; +@@ -253,6 +252,8 @@ struct vpu_inst { + + struct list_head cmd_q; + void *pending; ++ unsigned long cmd_seq; ++ atomic_long_t last_response_cmd; + + struct vpu_inst_ops *ops; + const struct vpu_format *formats; +diff --git a/drivers/media/platform/amphion/vpu_cmds.c b/drivers/media/platform/amphion/vpu_cmds.c +index c2337812573e..5695f5c1cb3e 100644 +--- a/drivers/media/platform/amphion/vpu_cmds.c ++++ b/drivers/media/platform/amphion/vpu_cmds.c +@@ -32,6 +32,7 @@ struct vpu_cmd_t { + struct vpu_cmd_request *request; + struct vpu_rpc_event *pkt; + unsigned long key; ++ atomic_long_t *last_response_cmd; + }; + + static struct vpu_cmd_request vpu_cmd_requests[] = { +@@ -115,6 +116,8 @@ static void vpu_free_cmd(struct vpu_cmd_t *cmd) + { + if (!cmd) + return; ++ if (cmd->last_response_cmd) ++ atomic_long_set(cmd->last_response_cmd, cmd->key); + vfree(cmd->pkt); + vfree(cmd); + } +@@ -172,7 +175,8 @@ static int vpu_request_cmd(struct vpu_inst *inst, u32 id, void *data, + return -ENOMEM; + + mutex_lock(&core->cmd_lock); +- cmd->key = core->cmd_seq++; ++ cmd->key = ++inst->cmd_seq; ++ cmd->last_response_cmd = &inst->last_response_cmd; + if (key) + *key = cmd->key; + if (sync) +@@ -246,26 +250,12 @@ void vpu_clear_request(struct vpu_inst *inst) + + static bool check_is_responsed(struct vpu_inst *inst, unsigned long key) + { +- struct vpu_core *core = inst->core; +- struct vpu_cmd_t *cmd; +- bool flag = true; ++ unsigned long last_response = atomic_long_read(&inst->last_response_cmd); + +- mutex_lock(&core->cmd_lock); +- cmd = inst->pending; +- if (cmd && key == cmd->key) { +- flag = false; +- goto exit; +- } +- list_for_each_entry(cmd, &inst->cmd_q, list) { +- if (key == cmd->key) { +- flag = false; +- break; +- } +- } +-exit: +- mutex_unlock(&core->cmd_lock); ++ if (key <= last_response && (last_response - key) < (ULONG_MAX >> 1)) ++ return true; + +- return flag; ++ return false; + } + + static int sync_session_response(struct vpu_inst *inst, unsigned long key, long timeout, int try) +diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c +index 0f6e4c666440..d7e0de49b3dc 100644 +--- a/drivers/media/platform/amphion/vpu_v4l2.c ++++ b/drivers/media/platform/amphion/vpu_v4l2.c +@@ -716,6 +716,7 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *inst) + func = &vpu->decoder; + + atomic_set(&inst->ref_count, 0); ++ atomic_long_set(&inst->last_response_cmd, 0); + vpu_inst_get(inst); + inst->vpu = vpu; + inst->core = vpu_request_core(vpu, inst->type); +-- +2.43.0 + diff --git a/queue-6.6/media-ddbridge-fix-an-error-code-problem-in-ddb_prob.patch b/queue-6.6/media-ddbridge-fix-an-error-code-problem-in-ddb_prob.patch new file mode 100644 index 00000000000..e9d29657113 --- /dev/null +++ b/queue-6.6/media-ddbridge-fix-an-error-code-problem-in-ddb_prob.patch @@ -0,0 +1,34 @@ +From cc956ea901b221fcf057a6c9c274f45588dc4775 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Oct 2023 17:17:23 +0800 +Subject: media: ddbridge: fix an error code problem in ddb_probe + +From: Su Hui + +[ Upstream commit 09b4195021be69af1e1936cca995712a6d0f2562 ] + +Error code is assigned to 'stat', return 'stat' rather than '-1'. + +Signed-off-by: Su Hui +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/pci/ddbridge/ddbridge-main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c +index 91733ab9f58c..363badab7cf0 100644 +--- a/drivers/media/pci/ddbridge/ddbridge-main.c ++++ b/drivers/media/pci/ddbridge/ddbridge-main.c +@@ -238,7 +238,7 @@ static int ddb_probe(struct pci_dev *pdev, + ddb_unmap(dev); + pci_set_drvdata(pdev, NULL); + pci_disable_device(pdev); +- return -1; ++ return stat; + } + + /****************************************************************************/ +-- +2.43.0 + diff --git a/queue-6.6/media-i2c-imx335-fix-hblank-min-max-values.patch b/queue-6.6/media-i2c-imx335-fix-hblank-min-max-values.patch new file mode 100644 index 00000000000..d286e2718ad --- /dev/null +++ b/queue-6.6/media-i2c-imx335-fix-hblank-min-max-values.patch @@ -0,0 +1,41 @@ +From c6ab182f73b8c1afd1039feef33467663bd78309 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 18:29:48 +0530 +Subject: media: i2c: imx335: Fix hblank min/max values + +From: Kieran Bingham + +[ Upstream commit d7b95ad7a8d56248dfc34f861e445fad7a4004f4 ] + +The V4L2_CID_HBLANK control is marked as readonly and can only be a +single value. + +Set the minimum and maximum value to match the mode value. + +Reviewed-by: Umang Jain +Signed-off-by: Kieran Bingham +Signed-off-by: Sakari Ailus +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/imx335.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c +index 482a0b7f040a..26869abd77a6 100644 +--- a/drivers/media/i2c/imx335.c ++++ b/drivers/media/i2c/imx335.c +@@ -971,8 +971,8 @@ static int imx335_init_controls(struct imx335 *imx335) + imx335->hblank_ctrl = v4l2_ctrl_new_std(ctrl_hdlr, + &imx335_ctrl_ops, + V4L2_CID_HBLANK, +- IMX335_REG_MIN, +- IMX335_REG_MAX, ++ mode->hblank, ++ mode->hblank, + 1, mode->hblank); + if (imx335->hblank_ctrl) + imx335->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; +-- +2.43.0 + diff --git a/queue-6.6/media-renesas-vsp1-fix-references-to-pad-config.patch b/queue-6.6/media-renesas-vsp1-fix-references-to-pad-config.patch new file mode 100644 index 00000000000..532cc7d6f8b --- /dev/null +++ b/queue-6.6/media-renesas-vsp1-fix-references-to-pad-config.patch @@ -0,0 +1,1137 @@ +From 393089bc30f21d258db5e5ad9832e65c1af9977c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Nov 2023 03:37:15 +0200 +Subject: media: renesas: vsp1: Fix references to pad config + +From: Laurent Pinchart + +[ Upstream commit 30d187cd74874aaf24e1b4a2dd2a64dc850c6b14 ] + +V4L2 subdev operations have moved from operating on a +v4l2_subdev_pad_config to a v4l2_subdev_state a long time ago. Fix +remaining incorrect references to pad config in function and variable +names. + +Signed-off-by: Laurent Pinchart +Reviewed-by: Jacopo Mondi +Signed-off-by: Sakari Ailus +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + .../media/platform/renesas/vsp1/vsp1_brx.c | 40 +++++---- + .../media/platform/renesas/vsp1/vsp1_clu.c | 3 +- + .../media/platform/renesas/vsp1/vsp1_entity.c | 85 +++++++++---------- + .../media/platform/renesas/vsp1/vsp1_entity.h | 10 +-- + .../media/platform/renesas/vsp1/vsp1_hgo.c | 4 +- + .../media/platform/renesas/vsp1/vsp1_hgt.c | 4 +- + .../media/platform/renesas/vsp1/vsp1_histo.c | 24 +++--- + .../media/platform/renesas/vsp1/vsp1_hsit.c | 11 ++- + .../media/platform/renesas/vsp1/vsp1_lif.c | 2 +- + .../media/platform/renesas/vsp1/vsp1_rpf.c | 8 +- + .../media/platform/renesas/vsp1/vsp1_rwpf.c | 37 ++++---- + .../media/platform/renesas/vsp1/vsp1_sru.c | 36 ++++---- + .../media/platform/renesas/vsp1/vsp1_uds.c | 39 ++++----- + .../media/platform/renesas/vsp1/vsp1_uif.c | 24 +++--- + .../media/platform/renesas/vsp1/vsp1_video.c | 4 +- + .../media/platform/renesas/vsp1/vsp1_wpf.c | 10 +-- + 16 files changed, 162 insertions(+), 179 deletions(-) + +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_brx.c b/drivers/media/platform/renesas/vsp1/vsp1_brx.c +index 89385b4cabe5..23e815cea825 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_brx.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_brx.c +@@ -136,29 +136,28 @@ static int brx_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_format *fmt) + { + struct vsp1_brx *brx = to_brx(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&brx->entity.lock); + +- config = vsp1_entity_get_pad_config(&brx->entity, sd_state, +- fmt->which); +- if (!config) { ++ state = vsp1_entity_get_state(&brx->entity, sd_state, fmt->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + +- brx_try_format(brx, config, fmt->pad, &fmt->format); ++ brx_try_format(brx, state, fmt->pad, &fmt->format); + +- format = vsp1_entity_get_pad_format(&brx->entity, config, fmt->pad); ++ format = vsp1_entity_get_pad_format(&brx->entity, state, fmt->pad); + *format = fmt->format; + + /* Reset the compose rectangle. */ + if (fmt->pad != brx->entity.source_pad) { + struct v4l2_rect *compose; + +- compose = brx_get_compose(brx, config, fmt->pad); ++ compose = brx_get_compose(brx, state, fmt->pad); + compose->left = 0; + compose->top = 0; + compose->width = format->width; +@@ -171,7 +170,7 @@ static int brx_set_format(struct v4l2_subdev *subdev, + + for (i = 0; i <= brx->entity.source_pad; ++i) { + format = vsp1_entity_get_pad_format(&brx->entity, +- config, i); ++ state, i); + format->code = fmt->format.code; + } + } +@@ -186,7 +185,7 @@ static int brx_get_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_brx *brx = to_brx(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + + if (sel->pad == brx->entity.source_pad) + return -EINVAL; +@@ -200,13 +199,13 @@ static int brx_get_selection(struct v4l2_subdev *subdev, + return 0; + + case V4L2_SEL_TGT_COMPOSE: +- config = vsp1_entity_get_pad_config(&brx->entity, sd_state, +- sel->which); +- if (!config) ++ state = vsp1_entity_get_state(&brx->entity, sd_state, ++ sel->which); ++ if (!state) + return -EINVAL; + + mutex_lock(&brx->entity.lock); +- sel->r = *brx_get_compose(brx, config, sel->pad); ++ sel->r = *brx_get_compose(brx, state, sel->pad); + mutex_unlock(&brx->entity.lock); + return 0; + +@@ -220,7 +219,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_brx *brx = to_brx(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *compose; + int ret = 0; +@@ -233,9 +232,8 @@ static int brx_set_selection(struct v4l2_subdev *subdev, + + mutex_lock(&brx->entity.lock); + +- config = vsp1_entity_get_pad_config(&brx->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&brx->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } +@@ -244,7 +242,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev, + * The compose rectangle top left corner must be inside the output + * frame. + */ +- format = vsp1_entity_get_pad_format(&brx->entity, config, ++ format = vsp1_entity_get_pad_format(&brx->entity, state, + brx->entity.source_pad); + sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); + sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); +@@ -253,11 +251,11 @@ static int brx_set_selection(struct v4l2_subdev *subdev, + * Scaling isn't supported, the compose rectangle size must be identical + * to the sink format size. + */ +- format = vsp1_entity_get_pad_format(&brx->entity, config, sel->pad); ++ format = vsp1_entity_get_pad_format(&brx->entity, state, sel->pad); + sel->r.width = format->width; + sel->r.height = format->height; + +- compose = brx_get_compose(brx, config, sel->pad); ++ compose = brx_get_compose(brx, state, sel->pad); + *compose = sel->r; + + done: +@@ -293,7 +291,7 @@ static void brx_configure_stream(struct vsp1_entity *entity, + unsigned int flags; + unsigned int i; + +- format = vsp1_entity_get_pad_format(&brx->entity, brx->entity.config, ++ format = vsp1_entity_get_pad_format(&brx->entity, brx->entity.state, + brx->entity.source_pad); + + /* +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_clu.c b/drivers/media/platform/renesas/vsp1/vsp1_clu.c +index c5217fee24f1..50a5c0dc0e86 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_clu.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_clu.c +@@ -182,8 +182,7 @@ static void clu_configure_stream(struct vsp1_entity *entity, + * The yuv_mode can't be changed during streaming. Cache it internally + * for future runtime configuration calls. + */ +- format = vsp1_entity_get_pad_format(&clu->entity, +- clu->entity.config, ++ format = vsp1_entity_get_pad_format(&clu->entity, clu->entity.state, + CLU_PAD_SINK); + clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32; + } +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.c b/drivers/media/platform/renesas/vsp1/vsp1_entity.c +index c31f05a80bb5..47413f5c4824 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_entity.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.c +@@ -101,27 +101,26 @@ void vsp1_entity_configure_partition(struct vsp1_entity *entity, + */ + + /** +- * vsp1_entity_get_pad_config - Get the pad configuration for an entity ++ * vsp1_entity_get_state - Get the subdev state for an entity + * @entity: the entity + * @sd_state: the TRY state +- * @which: configuration selector (ACTIVE or TRY) ++ * @which: state selector (ACTIVE or TRY) + * + * When called with which set to V4L2_SUBDEV_FORMAT_ACTIVE the caller must hold + * the entity lock to access the returned configuration. + * +- * Return the pad configuration requested by the which argument. The TRY +- * configuration is passed explicitly to the function through the cfg argument +- * and simply returned when requested. The ACTIVE configuration comes from the +- * entity structure. ++ * Return the subdev state requested by the which argument. The TRY state is ++ * passed explicitly to the function through the sd_state argument and simply ++ * returned when requested. The ACTIVE state comes from the entity structure. + */ + struct v4l2_subdev_state * +-vsp1_entity_get_pad_config(struct vsp1_entity *entity, +- struct v4l2_subdev_state *sd_state, +- enum v4l2_subdev_format_whence which) ++vsp1_entity_get_state(struct vsp1_entity *entity, ++ struct v4l2_subdev_state *sd_state, ++ enum v4l2_subdev_format_whence which) + { + switch (which) { + case V4L2_SUBDEV_FORMAT_ACTIVE: +- return entity->config; ++ return entity->state; + case V4L2_SUBDEV_FORMAT_TRY: + default: + return sd_state; +@@ -176,10 +175,11 @@ vsp1_entity_get_pad_selection(struct vsp1_entity *entity, + /* + * vsp1_entity_init_cfg - Initialize formats on all pads + * @subdev: V4L2 subdevice +- * @cfg: V4L2 subdev pad configuration ++ * @sd_state: V4L2 subdev state + * +- * Initialize all pad formats with default values in the given pad config. This +- * function can be used as a handler for the subdev pad::init_cfg operation. ++ * Initialize all pad formats with default values in the given subdev state. ++ * This function can be used as a handler for the subdev pad::init_cfg ++ * operation. + */ + int vsp1_entity_init_cfg(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state) +@@ -202,7 +202,7 @@ int vsp1_entity_init_cfg(struct v4l2_subdev *subdev, + /* + * vsp1_subdev_get_pad_format - Subdev pad get_fmt handler + * @subdev: V4L2 subdevice +- * @cfg: V4L2 subdev pad configuration ++ * @sd_state: V4L2 subdev state + * @fmt: V4L2 subdev format + * + * This function implements the subdev get_fmt pad operation. It can be used as +@@ -213,14 +213,14 @@ int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_format *fmt) + { + struct vsp1_entity *entity = to_vsp1_entity(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + +- config = vsp1_entity_get_pad_config(entity, sd_state, fmt->which); +- if (!config) ++ state = vsp1_entity_get_state(entity, sd_state, fmt->which); ++ if (!state) + return -EINVAL; + + mutex_lock(&entity->lock); +- fmt->format = *vsp1_entity_get_pad_format(entity, config, fmt->pad); ++ fmt->format = *vsp1_entity_get_pad_format(entity, state, fmt->pad); + mutex_unlock(&entity->lock); + + return 0; +@@ -229,7 +229,7 @@ int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, + /* + * vsp1_subdev_enum_mbus_code - Subdev pad enum_mbus_code handler + * @subdev: V4L2 subdevice +- * @cfg: V4L2 subdev pad configuration ++ * @sd_state: V4L2 subdev state + * @code: Media bus code enumeration + * @codes: Array of supported media bus codes + * @ncodes: Number of supported media bus codes +@@ -252,7 +252,7 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, + + code->code = codes[code->index]; + } else { +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + + /* +@@ -262,13 +262,12 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, + if (code->index) + return -EINVAL; + +- config = vsp1_entity_get_pad_config(entity, sd_state, +- code->which); +- if (!config) ++ state = vsp1_entity_get_state(entity, sd_state, code->which); ++ if (!state) + return -EINVAL; + + mutex_lock(&entity->lock); +- format = vsp1_entity_get_pad_format(entity, config, 0); ++ format = vsp1_entity_get_pad_format(entity, state, 0); + code->code = format->code; + mutex_unlock(&entity->lock); + } +@@ -279,7 +278,7 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, + /* + * vsp1_subdev_enum_frame_size - Subdev pad enum_frame_size handler + * @subdev: V4L2 subdevice +- * @cfg: V4L2 subdev pad configuration ++ * @sd_state: V4L2 subdev state + * @fse: Frame size enumeration + * @min_width: Minimum image width + * @min_height: Minimum image height +@@ -298,15 +297,15 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, + unsigned int max_width, unsigned int max_height) + { + struct vsp1_entity *entity = to_vsp1_entity(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + +- config = vsp1_entity_get_pad_config(entity, sd_state, fse->which); +- if (!config) ++ state = vsp1_entity_get_state(entity, sd_state, fse->which); ++ if (!state) + return -EINVAL; + +- format = vsp1_entity_get_pad_format(entity, config, fse->pad); ++ format = vsp1_entity_get_pad_format(entity, state, fse->pad); + + mutex_lock(&entity->lock); + +@@ -339,7 +338,7 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, + /* + * vsp1_subdev_set_pad_format - Subdev pad set_fmt handler + * @subdev: V4L2 subdevice +- * @cfg: V4L2 subdev pad configuration ++ * @sd_state: V4L2 subdev state + * @fmt: V4L2 subdev format + * @codes: Array of supported media bus codes + * @ncodes: Number of supported media bus codes +@@ -362,7 +361,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, + unsigned int max_width, unsigned int max_height) + { + struct vsp1_entity *entity = to_vsp1_entity(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *selection; + unsigned int i; +@@ -370,13 +369,13 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, + + mutex_lock(&entity->lock); + +- config = vsp1_entity_get_pad_config(entity, sd_state, fmt->which); +- if (!config) { ++ state = vsp1_entity_get_state(entity, sd_state, fmt->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + +- format = vsp1_entity_get_pad_format(entity, config, fmt->pad); ++ format = vsp1_entity_get_pad_format(entity, state, fmt->pad); + + if (fmt->pad == entity->source_pad) { + /* The output format can't be modified. */ +@@ -404,18 +403,18 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, + fmt->format = *format; + + /* Propagate the format to the source pad. */ +- format = vsp1_entity_get_pad_format(entity, config, entity->source_pad); ++ format = vsp1_entity_get_pad_format(entity, state, entity->source_pad); + *format = fmt->format; + + /* Reset the crop and compose rectangles. */ +- selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, ++ selection = vsp1_entity_get_pad_selection(entity, state, fmt->pad, + V4L2_SEL_TGT_CROP); + selection->left = 0; + selection->top = 0; + selection->width = format->width; + selection->height = format->height; + +- selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, ++ selection = vsp1_entity_get_pad_selection(entity, state, fmt->pad, + V4L2_SEL_TGT_COMPOSE); + selection->left = 0; + selection->top = 0; +@@ -672,18 +671,18 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, + vsp1_entity_init_cfg(subdev, NULL); + + /* +- * Allocate the pad configuration to store formats and selection ++ * Allocate the subdev state to store formats and selection + * rectangles. + */ + /* + * FIXME: Drop this call, drivers are not supposed to use + * __v4l2_subdev_state_alloc(). + */ +- entity->config = __v4l2_subdev_state_alloc(&entity->subdev, +- "vsp1:config->lock", &key); +- if (IS_ERR(entity->config)) { ++ entity->state = __v4l2_subdev_state_alloc(&entity->subdev, ++ "vsp1:state->lock", &key); ++ if (IS_ERR(entity->state)) { + media_entity_cleanup(&entity->subdev.entity); +- return PTR_ERR(entity->config); ++ return PTR_ERR(entity->state); + } + + return 0; +@@ -695,6 +694,6 @@ void vsp1_entity_destroy(struct vsp1_entity *entity) + entity->ops->destroy(entity); + if (entity->subdev.ctrl_handler) + v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); +- __v4l2_subdev_state_free(entity->config); ++ __v4l2_subdev_state_free(entity->state); + media_entity_cleanup(&entity->subdev.entity); + } +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.h b/drivers/media/platform/renesas/vsp1/vsp1_entity.h +index 17f98a6a972e..8c737cadee81 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_entity.h ++++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.h +@@ -115,9 +115,9 @@ struct vsp1_entity { + unsigned int sink_pad; + + struct v4l2_subdev subdev; +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + +- struct mutex lock; /* Protects the pad config */ ++ struct mutex lock; /* Protects the state */ + }; + + static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev) +@@ -135,9 +135,9 @@ int vsp1_entity_link_setup(struct media_entity *entity, + const struct media_pad *remote, u32 flags); + + struct v4l2_subdev_state * +-vsp1_entity_get_pad_config(struct vsp1_entity *entity, +- struct v4l2_subdev_state *sd_state, +- enum v4l2_subdev_format_whence which); ++vsp1_entity_get_state(struct vsp1_entity *entity, ++ struct v4l2_subdev_state *sd_state, ++ enum v4l2_subdev_format_whence which); + struct v4l2_mbus_framefmt * + vsp1_entity_get_pad_format(struct vsp1_entity *entity, + struct v4l2_subdev_state *sd_state, +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hgo.c b/drivers/media/platform/renesas/vsp1/vsp1_hgo.c +index e6492deb0a64..40c571a987ef 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_hgo.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_hgo.c +@@ -140,9 +140,9 @@ static void hgo_configure_stream(struct vsp1_entity *entity, + unsigned int hratio; + unsigned int vratio; + +- crop = vsp1_entity_get_pad_selection(entity, entity->config, ++ crop = vsp1_entity_get_pad_selection(entity, entity->state, + HISTO_PAD_SINK, V4L2_SEL_TGT_CROP); +- compose = vsp1_entity_get_pad_selection(entity, entity->config, ++ compose = vsp1_entity_get_pad_selection(entity, entity->state, + HISTO_PAD_SINK, + V4L2_SEL_TGT_COMPOSE); + +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hgt.c b/drivers/media/platform/renesas/vsp1/vsp1_hgt.c +index aa1c718e0453..8281b86874ab 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_hgt.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_hgt.c +@@ -139,9 +139,9 @@ static void hgt_configure_stream(struct vsp1_entity *entity, + u8 upper; + unsigned int i; + +- crop = vsp1_entity_get_pad_selection(entity, entity->config, ++ crop = vsp1_entity_get_pad_selection(entity, entity->state, + HISTO_PAD_SINK, V4L2_SEL_TGT_CROP); +- compose = vsp1_entity_get_pad_selection(entity, entity->config, ++ compose = vsp1_entity_get_pad_selection(entity, entity->state, + HISTO_PAD_SINK, + V4L2_SEL_TGT_COMPOSE); + +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_histo.c b/drivers/media/platform/renesas/vsp1/vsp1_histo.c +index f22449dd654c..71155282ca11 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_histo.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_histo.c +@@ -203,7 +203,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_histogram *histo = subdev_to_histo(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *crop; + int ret = 0; +@@ -213,9 +213,8 @@ static int histo_get_selection(struct v4l2_subdev *subdev, + + mutex_lock(&histo->entity.lock); + +- config = vsp1_entity_get_pad_config(&histo->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&histo->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } +@@ -223,7 +222,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, + switch (sel->target) { + case V4L2_SEL_TGT_COMPOSE_BOUNDS: + case V4L2_SEL_TGT_COMPOSE_DEFAULT: +- crop = vsp1_entity_get_pad_selection(&histo->entity, config, ++ crop = vsp1_entity_get_pad_selection(&histo->entity, state, + HISTO_PAD_SINK, + V4L2_SEL_TGT_CROP); + sel->r.left = 0; +@@ -234,7 +233,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, + + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: +- format = vsp1_entity_get_pad_format(&histo->entity, config, ++ format = vsp1_entity_get_pad_format(&histo->entity, state, + HISTO_PAD_SINK); + sel->r.left = 0; + sel->r.top = 0; +@@ -244,7 +243,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, + + case V4L2_SEL_TGT_COMPOSE: + case V4L2_SEL_TGT_CROP: +- sel->r = *vsp1_entity_get_pad_selection(&histo->entity, config, ++ sel->r = *vsp1_entity_get_pad_selection(&histo->entity, state, + sel->pad, sel->target); + break; + +@@ -346,7 +345,7 @@ static int histo_set_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_histogram *histo = subdev_to_histo(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + int ret; + + if (sel->pad != HISTO_PAD_SINK) +@@ -354,17 +353,16 @@ static int histo_set_selection(struct v4l2_subdev *subdev, + + mutex_lock(&histo->entity.lock); + +- config = vsp1_entity_get_pad_config(&histo->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&histo->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + + if (sel->target == V4L2_SEL_TGT_CROP) +- ret = histo_set_crop(subdev, config, sel); ++ ret = histo_set_crop(subdev, state, sel); + else if (sel->target == V4L2_SEL_TGT_COMPOSE) +- ret = histo_set_compose(subdev, config, sel); ++ ret = histo_set_compose(subdev, state, sel); + else + ret = -EINVAL; + +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hsit.c b/drivers/media/platform/renesas/vsp1/vsp1_hsit.c +index 361a870380c2..6342ac7bdf54 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_hsit.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_hsit.c +@@ -66,20 +66,19 @@ static int hsit_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_format *fmt) + { + struct vsp1_hsit *hsit = to_hsit(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&hsit->entity.lock); + +- config = vsp1_entity_get_pad_config(&hsit->entity, sd_state, +- fmt->which); +- if (!config) { ++ state = vsp1_entity_get_state(&hsit->entity, sd_state, fmt->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + +- format = vsp1_entity_get_pad_format(&hsit->entity, config, fmt->pad); ++ format = vsp1_entity_get_pad_format(&hsit->entity, state, fmt->pad); + + if (fmt->pad == HSIT_PAD_SOURCE) { + /* +@@ -102,7 +101,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev, + fmt->format = *format; + + /* Propagate the format to the source pad. */ +- format = vsp1_entity_get_pad_format(&hsit->entity, config, ++ format = vsp1_entity_get_pad_format(&hsit->entity, state, + HSIT_PAD_SOURCE); + *format = fmt->format; + format->code = hsit->inverse ? MEDIA_BUS_FMT_ARGB8888_1X32 +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_lif.c b/drivers/media/platform/renesas/vsp1/vsp1_lif.c +index 0ab2e0c70474..75c24df41a7a 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_lif.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_lif.c +@@ -94,7 +94,7 @@ static void lif_configure_stream(struct vsp1_entity *entity, + unsigned int obth; + unsigned int lbth; + +- format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.config, ++ format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.state, + LIF_PAD_SOURCE); + + switch (entity->vsp1->version & VI6_IP_VERSION_MODEL_MASK) { +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +index 3b17f5fa4067..fb2d5873924e 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +@@ -89,10 +89,10 @@ static void rpf_configure_stream(struct vsp1_entity *entity, + + /* Format */ + sink_format = vsp1_entity_get_pad_format(&rpf->entity, +- rpf->entity.config, ++ rpf->entity.state, + RWPF_PAD_SINK); + source_format = vsp1_entity_get_pad_format(&rpf->entity, +- rpf->entity.config, ++ rpf->entity.state, + RWPF_PAD_SOURCE); + + infmt = VI6_RPF_INFMT_CIPM +@@ -166,7 +166,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity, + const struct v4l2_rect *compose; + + compose = vsp1_entity_get_pad_selection(pipe->brx, +- pipe->brx->config, ++ pipe->brx->state, + rpf->brx_input, + V4L2_SEL_TGT_COMPOSE); + left = compose->left; +@@ -310,7 +310,7 @@ static void rpf_configure_partition(struct vsp1_entity *entity, + * offsets are needed, as planes 2 and 3 always have identical + * strides. + */ +- crop = *vsp1_rwpf_get_crop(rpf, rpf->entity.config); ++ crop = *vsp1_rwpf_get_crop(rpf, rpf->entity.state); + + /* + * Partition Algorithm Control +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +index 22a82d218152..8a4165368f53 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +@@ -62,15 +62,14 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_format *fmt) + { + struct vsp1_rwpf *rwpf = to_rwpf(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&rwpf->entity.lock); + +- config = vsp1_entity_get_pad_config(&rwpf->entity, sd_state, +- fmt->which); +- if (!config) { ++ state = vsp1_entity_get_state(&rwpf->entity, sd_state, fmt->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } +@@ -81,7 +80,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, + fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) + fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; + +- format = vsp1_entity_get_pad_format(&rwpf->entity, config, fmt->pad); ++ format = vsp1_entity_get_pad_format(&rwpf->entity, state, fmt->pad); + + if (fmt->pad == RWPF_PAD_SOURCE) { + /* +@@ -107,7 +106,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, + struct v4l2_rect *crop; + + /* Update the sink crop rectangle. */ +- crop = vsp1_rwpf_get_crop(rwpf, config); ++ crop = vsp1_rwpf_get_crop(rwpf, state); + crop->left = 0; + crop->top = 0; + crop->width = fmt->format.width; +@@ -115,7 +114,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, + } + + /* Propagate the format to the source pad. */ +- format = vsp1_entity_get_pad_format(&rwpf->entity, config, ++ format = vsp1_entity_get_pad_format(&rwpf->entity, state, + RWPF_PAD_SOURCE); + *format = fmt->format; + +@@ -134,7 +133,7 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_rwpf *rwpf = to_rwpf(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + +@@ -147,20 +146,19 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, + + mutex_lock(&rwpf->entity.lock); + +- config = vsp1_entity_get_pad_config(&rwpf->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&rwpf->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: +- sel->r = *vsp1_rwpf_get_crop(rwpf, config); ++ sel->r = *vsp1_rwpf_get_crop(rwpf, state); + break; + + case V4L2_SEL_TGT_CROP_BOUNDS: +- format = vsp1_entity_get_pad_format(&rwpf->entity, config, ++ format = vsp1_entity_get_pad_format(&rwpf->entity, state, + RWPF_PAD_SINK); + sel->r.left = 0; + sel->r.top = 0; +@@ -183,7 +181,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_rwpf *rwpf = to_rwpf(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *crop; + int ret = 0; +@@ -200,15 +198,14 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, + + mutex_lock(&rwpf->entity.lock); + +- config = vsp1_entity_get_pad_config(&rwpf->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&rwpf->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + + /* Make sure the crop rectangle is entirely contained in the image. */ +- format = vsp1_entity_get_pad_format(&rwpf->entity, config, ++ format = vsp1_entity_get_pad_format(&rwpf->entity, state, + RWPF_PAD_SINK); + + /* +@@ -229,11 +226,11 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, + sel->r.height = min_t(unsigned int, sel->r.height, + format->height - sel->r.top); + +- crop = vsp1_rwpf_get_crop(rwpf, config); ++ crop = vsp1_rwpf_get_crop(rwpf, state); + *crop = sel->r; + + /* Propagate the format to the source pad. */ +- format = vsp1_entity_get_pad_format(&rwpf->entity, config, ++ format = vsp1_entity_get_pad_format(&rwpf->entity, state, + RWPF_PAD_SOURCE); + format->width = crop->width; + format->height = crop->height; +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_sru.c b/drivers/media/platform/renesas/vsp1/vsp1_sru.c +index b614a2aea461..2dd6f8575614 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_sru.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_sru.c +@@ -123,16 +123,15 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, + struct v4l2_subdev_frame_size_enum *fse) + { + struct vsp1_sru *sru = to_sru(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + +- config = vsp1_entity_get_pad_config(&sru->entity, sd_state, +- fse->which); +- if (!config) ++ state = vsp1_entity_get_state(&sru->entity, sd_state, fse->which); ++ if (!state) + return -EINVAL; + +- format = vsp1_entity_get_pad_format(&sru->entity, config, SRU_PAD_SINK); ++ format = vsp1_entity_get_pad_format(&sru->entity, state, SRU_PAD_SINK); + + mutex_lock(&sru->entity.lock); + +@@ -221,31 +220,30 @@ static int sru_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_format *fmt) + { + struct vsp1_sru *sru = to_sru(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&sru->entity.lock); + +- config = vsp1_entity_get_pad_config(&sru->entity, sd_state, +- fmt->which); +- if (!config) { ++ state = vsp1_entity_get_state(&sru->entity, sd_state, fmt->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + +- sru_try_format(sru, config, fmt->pad, &fmt->format); ++ sru_try_format(sru, state, fmt->pad, &fmt->format); + +- format = vsp1_entity_get_pad_format(&sru->entity, config, fmt->pad); ++ format = vsp1_entity_get_pad_format(&sru->entity, state, fmt->pad); + *format = fmt->format; + + if (fmt->pad == SRU_PAD_SINK) { + /* Propagate the format to the source pad. */ +- format = vsp1_entity_get_pad_format(&sru->entity, config, ++ format = vsp1_entity_get_pad_format(&sru->entity, state, + SRU_PAD_SOURCE); + *format = fmt->format; + +- sru_try_format(sru, config, SRU_PAD_SOURCE, format); ++ sru_try_format(sru, state, SRU_PAD_SOURCE, format); + } + + done: +@@ -280,9 +278,9 @@ static void sru_configure_stream(struct vsp1_entity *entity, + struct v4l2_mbus_framefmt *output; + u32 ctrl0; + +- input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, ++ input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, + SRU_PAD_SINK); +- output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, ++ output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, + SRU_PAD_SOURCE); + + if (input->code == MEDIA_BUS_FMT_ARGB8888_1X32) +@@ -310,9 +308,9 @@ static unsigned int sru_max_width(struct vsp1_entity *entity, + struct v4l2_mbus_framefmt *input; + struct v4l2_mbus_framefmt *output; + +- input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, ++ input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, + SRU_PAD_SINK); +- output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, ++ output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, + SRU_PAD_SOURCE); + + /* +@@ -336,9 +334,9 @@ static void sru_partition(struct vsp1_entity *entity, + struct v4l2_mbus_framefmt *input; + struct v4l2_mbus_framefmt *output; + +- input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, ++ input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, + SRU_PAD_SINK); +- output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, ++ output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, + SRU_PAD_SOURCE); + + /* Adapt if SRUx2 is enabled. */ +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_uds.c b/drivers/media/platform/renesas/vsp1/vsp1_uds.c +index 1c290cda005a..59ff4ae46cea 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_uds.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_uds.c +@@ -128,17 +128,15 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev, + struct v4l2_subdev_frame_size_enum *fse) + { + struct vsp1_uds *uds = to_uds(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + +- config = vsp1_entity_get_pad_config(&uds->entity, sd_state, +- fse->which); +- if (!config) ++ state = vsp1_entity_get_state(&uds->entity, sd_state, fse->which); ++ if (!state) + return -EINVAL; + +- format = vsp1_entity_get_pad_format(&uds->entity, config, +- UDS_PAD_SINK); ++ format = vsp1_entity_get_pad_format(&uds->entity, state, UDS_PAD_SINK); + + mutex_lock(&uds->entity.lock); + +@@ -205,31 +203,30 @@ static int uds_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_format *fmt) + { + struct vsp1_uds *uds = to_uds(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&uds->entity.lock); + +- config = vsp1_entity_get_pad_config(&uds->entity, sd_state, +- fmt->which); +- if (!config) { ++ state = vsp1_entity_get_state(&uds->entity, sd_state, fmt->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + +- uds_try_format(uds, config, fmt->pad, &fmt->format); ++ uds_try_format(uds, state, fmt->pad, &fmt->format); + +- format = vsp1_entity_get_pad_format(&uds->entity, config, fmt->pad); ++ format = vsp1_entity_get_pad_format(&uds->entity, state, fmt->pad); + *format = fmt->format; + + if (fmt->pad == UDS_PAD_SINK) { + /* Propagate the format to the source pad. */ +- format = vsp1_entity_get_pad_format(&uds->entity, config, ++ format = vsp1_entity_get_pad_format(&uds->entity, state, + UDS_PAD_SOURCE); + *format = fmt->format; + +- uds_try_format(uds, config, UDS_PAD_SOURCE, format); ++ uds_try_format(uds, state, UDS_PAD_SOURCE, format); + } + + done: +@@ -269,9 +266,9 @@ static void uds_configure_stream(struct vsp1_entity *entity, + unsigned int vscale; + bool multitap; + +- input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SINK); +- output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SOURCE); + + hscale = uds_compute_ratio(input->width, output->width); +@@ -314,7 +311,7 @@ static void uds_configure_partition(struct vsp1_entity *entity, + struct vsp1_partition *partition = pipe->partition; + const struct v4l2_mbus_framefmt *output; + +- output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SOURCE); + + /* Input size clipping. */ +@@ -339,9 +336,9 @@ static unsigned int uds_max_width(struct vsp1_entity *entity, + const struct v4l2_mbus_framefmt *input; + unsigned int hscale; + +- input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SINK); +- output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SOURCE); + hscale = output->width / input->width; + +@@ -381,9 +378,9 @@ static void uds_partition(struct vsp1_entity *entity, + partition->uds_sink = *window; + partition->uds_source = *window; + +- input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SINK); +- output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, ++ output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, + UDS_PAD_SOURCE); + + partition->uds_sink.width = window->width * input->width +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_uif.c b/drivers/media/platform/renesas/vsp1/vsp1_uif.c +index 83d7f17df80e..d84d10f35090 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_uif.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_uif.c +@@ -86,7 +86,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_uif *uif = to_uif(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + int ret = 0; + +@@ -95,9 +95,8 @@ static int uif_get_selection(struct v4l2_subdev *subdev, + + mutex_lock(&uif->entity.lock); + +- config = vsp1_entity_get_pad_config(&uif->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&uif->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } +@@ -105,7 +104,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev, + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: +- format = vsp1_entity_get_pad_format(&uif->entity, config, ++ format = vsp1_entity_get_pad_format(&uif->entity, state, + UIF_PAD_SINK); + sel->r.left = 0; + sel->r.top = 0; +@@ -114,7 +113,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev, + break; + + case V4L2_SEL_TGT_CROP: +- sel->r = *vsp1_entity_get_pad_selection(&uif->entity, config, ++ sel->r = *vsp1_entity_get_pad_selection(&uif->entity, state, + sel->pad, sel->target); + break; + +@@ -133,7 +132,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_selection *sel) + { + struct vsp1_uif *uif = to_uif(subdev); +- struct v4l2_subdev_state *config; ++ struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *selection; + int ret = 0; +@@ -144,15 +143,14 @@ static int uif_set_selection(struct v4l2_subdev *subdev, + + mutex_lock(&uif->entity.lock); + +- config = vsp1_entity_get_pad_config(&uif->entity, sd_state, +- sel->which); +- if (!config) { ++ state = vsp1_entity_get_state(&uif->entity, sd_state, sel->which); ++ if (!state) { + ret = -EINVAL; + goto done; + } + + /* The crop rectangle must be inside the input frame. */ +- format = vsp1_entity_get_pad_format(&uif->entity, config, UIF_PAD_SINK); ++ format = vsp1_entity_get_pad_format(&uif->entity, state, UIF_PAD_SINK); + + sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); + sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); +@@ -162,7 +160,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev, + format->height - sel->r.top); + + /* Store the crop rectangle. */ +- selection = vsp1_entity_get_pad_selection(&uif->entity, config, ++ selection = vsp1_entity_get_pad_selection(&uif->entity, state, + sel->pad, V4L2_SEL_TGT_CROP); + *selection = sel->r; + +@@ -206,7 +204,7 @@ static void uif_configure_stream(struct vsp1_entity *entity, + vsp1_uif_write(uif, dlb, VI6_UIF_DISCOM_DOCMPMR, + VI6_UIF_DISCOM_DOCMPMR_SEL(9)); + +- crop = vsp1_entity_get_pad_selection(entity, entity->config, ++ crop = vsp1_entity_get_pad_selection(entity, entity->state, + UIF_PAD_SINK, V4L2_SEL_TGT_CROP); + + left = crop->left; +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/media/platform/renesas/vsp1/vsp1_video.c +index e9d5027761bb..5a9cb0e5640e 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_video.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c +@@ -198,7 +198,7 @@ static void vsp1_video_calculate_partition(struct vsp1_pipeline *pipe, + * at the WPF sink. + */ + format = vsp1_entity_get_pad_format(&pipe->output->entity, +- pipe->output->entity.config, ++ pipe->output->entity.state, + RWPF_PAD_SINK); + + /* A single partition simply processes the output size in full. */ +@@ -263,7 +263,7 @@ static int vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) + * at the WPF sink. + */ + format = vsp1_entity_get_pad_format(&pipe->output->entity, +- pipe->output->entity.config, ++ pipe->output->entity.state, + RWPF_PAD_SINK); + div_size = format->width; + +diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +index d0074ca00920..23cd1cef03a9 100644 +--- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c ++++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +@@ -66,10 +66,10 @@ static int vsp1_wpf_set_rotation(struct vsp1_rwpf *wpf, unsigned int rotation) + } + + sink_format = vsp1_entity_get_pad_format(&wpf->entity, +- wpf->entity.config, ++ wpf->entity.state, + RWPF_PAD_SINK); + source_format = vsp1_entity_get_pad_format(&wpf->entity, +- wpf->entity.config, ++ wpf->entity.state, + RWPF_PAD_SOURCE); + + mutex_lock(&wpf->entity.lock); +@@ -269,10 +269,10 @@ static void wpf_configure_stream(struct vsp1_entity *entity, + int ret; + + sink_format = vsp1_entity_get_pad_format(&wpf->entity, +- wpf->entity.config, ++ wpf->entity.state, + RWPF_PAD_SINK); + source_format = vsp1_entity_get_pad_format(&wpf->entity, +- wpf->entity.config, ++ wpf->entity.state, + RWPF_PAD_SOURCE); + + /* Format */ +@@ -407,7 +407,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity, + unsigned int i; + + sink_format = vsp1_entity_get_pad_format(&wpf->entity, +- wpf->entity.config, ++ wpf->entity.state, + RWPF_PAD_SINK); + width = sink_format->width; + height = sink_format->height; +-- +2.43.0 + diff --git a/queue-6.6/media-rkisp1-drop-irqf_shared.patch b/queue-6.6/media-rkisp1-drop-irqf_shared.patch new file mode 100644 index 00000000000..ca660652c79 --- /dev/null +++ b/queue-6.6/media-rkisp1-drop-irqf_shared.patch @@ -0,0 +1,44 @@ +From c59f1c9664a42bb1122b8d15bd5708f52f554dc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 08:57:45 +0100 +Subject: media: rkisp1: Drop IRQF_SHARED + +From: Tomi Valkeinen + +[ Upstream commit 85d2a31fe4d9be1555f621ead7a520d8791e0f74 ] + +In all known platforms the ISP has dedicated IRQ lines, but for some +reason the driver uses IRQF_SHARED. + +Supporting IRQF_SHARED properly requires handling interrupts even when +our device is disabled, and the driver does not handle this. To avoid +adding such code, and to be sure the driver won't accidentally be used +in a platform with shared interrupts, let's drop the IRQF_SHARED flag. + +Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-1-358a2c871a3c@ideasonboard.com + +Tested-by: Adam Ford #imx8mp-beacon +Signed-off-by: Tomi Valkeinen +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +index 894d5afaff4e..b676db9bff62 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +@@ -542,7 +542,7 @@ static int rkisp1_probe(struct platform_device *pdev) + if (irq < 0) + return irq; + +- ret = devm_request_irq(dev, irq, info->isrs[i].isr, IRQF_SHARED, ++ ret = devm_request_irq(dev, irq, info->isrs[i].isr, 0, + dev_driver_string(dev), dev); + if (ret) { + dev_err(dev, "request irq failed: %d\n", ret); +-- +2.43.0 + diff --git a/queue-6.6/media-rkisp1-fix-irq-disable-race-issue.patch b/queue-6.6/media-rkisp1-fix-irq-disable-race-issue.patch new file mode 100644 index 00000000000..87bbc4a60de --- /dev/null +++ b/queue-6.6/media-rkisp1-fix-irq-disable-race-issue.patch @@ -0,0 +1,99 @@ +From af950f48fbbd17ce5e256e98bbb86b488bd65a1f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 08:57:48 +0100 +Subject: media: rkisp1: Fix IRQ disable race issue + +From: Tomi Valkeinen + +[ Upstream commit 870565f063a58576e8a4529f122cac4325c6b395 ] + +In rkisp1_isp_stop() and rkisp1_csi_disable() the driver masks the +interrupts and then apparently assumes that the interrupt handler won't +be running, and proceeds in the stop procedure. This is not the case, as +the interrupt handler can already be running, which would lead to the +ISP being disabled while the interrupt handler handling a captured +frame. + +This brings up two issues: 1) the ISP could be powered off while the +interrupt handler is still running and accessing registers, leading to +board lockup, and 2) the interrupt handler code and the code that +disables the streaming might do things that conflict. + +It is not clear to me if 2) causes a real issue, but 1) can be seen with +a suitable delay (or printk in my case) in the interrupt handler, +leading to board lockup. + +Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-4-358a2c871a3c@ideasonboard.com + +Tested-by: Adam Ford #imx8mp-beacon +Signed-off-by: Tomi Valkeinen +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + .../platform/rockchip/rkisp1/rkisp1-csi.c | 14 ++++++++++++- + .../platform/rockchip/rkisp1/rkisp1-isp.c | 20 ++++++++++++++++--- + 2 files changed, 30 insertions(+), 4 deletions(-) + +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c +index fdff3d0da4e5..0a67eb96402c 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c +@@ -141,8 +141,20 @@ static void rkisp1_csi_disable(struct rkisp1_csi *csi) + struct rkisp1_device *rkisp1 = csi->rkisp1; + u32 val; + +- /* Mask and clear interrupts. */ ++ /* Mask MIPI interrupts. */ + rkisp1_write(rkisp1, RKISP1_CIF_MIPI_IMSC, 0); ++ ++ /* Flush posted writes */ ++ rkisp1_read(rkisp1, RKISP1_CIF_MIPI_IMSC); ++ ++ /* ++ * Wait until the IRQ handler has ended. The IRQ handler may get called ++ * even after this, but it will return immediately as the MIPI ++ * interrupts have been masked. ++ */ ++ synchronize_irq(rkisp1->irqs[RKISP1_IRQ_MIPI]); ++ ++ /* Clear MIPI interrupt status */ + rkisp1_write(rkisp1, RKISP1_CIF_MIPI_ICR, ~0); + + val = rkisp1_read(rkisp1, RKISP1_CIF_MIPI_CTRL); +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +index 07fbb77ce234..2239fb6c7d39 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +@@ -281,11 +281,25 @@ static void rkisp1_isp_stop(struct rkisp1_isp *isp) + * ISP(mi) stop in mi frame end -> Stop ISP(mipi) -> + * Stop ISP(isp) ->wait for ISP isp off + */ +- /* stop and clear MI and ISP interrupts */ +- rkisp1_write(rkisp1, RKISP1_CIF_ISP_IMSC, 0); +- rkisp1_write(rkisp1, RKISP1_CIF_ISP_ICR, ~0); + ++ /* Mask MI and ISP interrupts */ ++ rkisp1_write(rkisp1, RKISP1_CIF_ISP_IMSC, 0); + rkisp1_write(rkisp1, RKISP1_CIF_MI_IMSC, 0); ++ ++ /* Flush posted writes */ ++ rkisp1_read(rkisp1, RKISP1_CIF_MI_IMSC); ++ ++ /* ++ * Wait until the IRQ handler has ended. The IRQ handler may get called ++ * even after this, but it will return immediately as the MI and ISP ++ * interrupts have been masked. ++ */ ++ synchronize_irq(rkisp1->irqs[RKISP1_IRQ_ISP]); ++ if (rkisp1->irqs[RKISP1_IRQ_ISP] != rkisp1->irqs[RKISP1_IRQ_MI]) ++ synchronize_irq(rkisp1->irqs[RKISP1_IRQ_MI]); ++ ++ /* Clear MI and ISP interrupt status */ ++ rkisp1_write(rkisp1, RKISP1_CIF_ISP_ICR, ~0); + rkisp1_write(rkisp1, RKISP1_CIF_MI_ICR, ~0); + + /* stop ISP */ +-- +2.43.0 + diff --git a/queue-6.6/media-rkisp1-fix-irq-handler-return-values.patch b/queue-6.6/media-rkisp1-fix-irq-handler-return-values.patch new file mode 100644 index 00000000000..9fab834aed3 --- /dev/null +++ b/queue-6.6/media-rkisp1-fix-irq-handler-return-values.patch @@ -0,0 +1,64 @@ +From c44e049abe8612806eb3a3877105953a5e9cf75d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 08:57:46 +0100 +Subject: media: rkisp1: Fix IRQ handler return values + +From: Tomi Valkeinen + +[ Upstream commit 3eb7910e1b16a2c136be26a8380f21469225b2f6 ] + +The IRQ handler rkisp1_isr() calls sub-handlers, all of which returns an +irqreturn_t value, but rkisp1_isr() ignores those values and always +returns IRQ_HANDLED. + +Fix this by collecting the return values, and returning IRQ_HANDLED or +IRQ_NONE as appropriate. + +Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-2-358a2c871a3c@ideasonboard.com + +Tested-by: Adam Ford #imx8mp-beacon +Signed-off-by: Tomi Valkeinen +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + .../media/platform/rockchip/rkisp1/rkisp1-dev.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +index b676db9bff62..7b8a361d4c4a 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +@@ -442,17 +442,25 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1) + + static irqreturn_t rkisp1_isr(int irq, void *ctx) + { ++ irqreturn_t ret = IRQ_NONE; ++ + /* + * Call rkisp1_capture_isr() first to handle the frame that + * potentially completed using the current frame_sequence number before + * it is potentially incremented by rkisp1_isp_isr() in the vertical + * sync. + */ +- rkisp1_capture_isr(irq, ctx); +- rkisp1_isp_isr(irq, ctx); +- rkisp1_csi_isr(irq, ctx); + +- return IRQ_HANDLED; ++ if (rkisp1_capture_isr(irq, ctx) == IRQ_HANDLED) ++ ret = IRQ_HANDLED; ++ ++ if (rkisp1_isp_isr(irq, ctx) == IRQ_HANDLED) ++ ret = IRQ_HANDLED; ++ ++ if (rkisp1_csi_isr(irq, ctx) == IRQ_HANDLED) ++ ret = IRQ_HANDLED; ++ ++ return ret; + } + + static const char * const px30_isp_clks[] = { +-- +2.43.0 + diff --git a/queue-6.6/media-rkisp1-resizer-stop-manual-allocation-of-v4l2_.patch b/queue-6.6/media-rkisp1-resizer-stop-manual-allocation-of-v4l2_.patch new file mode 100644 index 00000000000..6deb9624a61 --- /dev/null +++ b/queue-6.6/media-rkisp1-resizer-stop-manual-allocation-of-v4l2_.patch @@ -0,0 +1,99 @@ +From 3e06f7f58dd21124ef332bc961cefd226816fcb8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Nov 2023 03:09:48 +0100 +Subject: media: rkisp1: resizer: Stop manual allocation of v4l2_subdev_state + +From: Laurent Pinchart + +[ Upstream commit efa28efd9cba015f8c3d88123527c3c3cfcd13d0 ] + +Supported media bus codes on the resizer sink pad are identical to the +ISP source pad. The .enum_mbus_code() handler thus delegates the +enumeration to the ISP's operation. This is problematic for two +reasons: + +- Format enumeration on the ISP source pad is dependent on the format + configured on the ISP sink pad for the same subdev state (TRY or + ACTIVE), while format enumeration on the resizer sink pad should + return all formats supported by the resizer subdev, regardless of the + ISP configuration. + +- Delegating the operation involves creating a fake v4l2_subdev_state on + the stack to pass to the ISP .enum_mbus_code() handler. This gets in + the way of evolution of both the ISP enumeration handler and, more + generally, the V4L2 subdev state infrastructure. + +Fix those two issues by implementing format enumeration manually for the +resizer. + +Link: https://lore.kernel.org/r/20231126020948.2700-1-laurent.pinchart@ideasonboard.com + +Reviewed-by: Paul Elder +Reviewed-by: Tomi Valkeinen +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + .../platform/rockchip/rkisp1/rkisp1-resizer.c | 38 ++++++++++++------- + 1 file changed, 24 insertions(+), 14 deletions(-) + +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +index c15ae0218118..eb0aae56d2c7 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +@@ -363,12 +363,8 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd, + { + struct rkisp1_resizer *rsz = + container_of(sd, struct rkisp1_resizer, sd); +- struct v4l2_subdev_pad_config dummy_cfg; +- struct v4l2_subdev_state pad_state = { +- .pads = &dummy_cfg +- }; +- u32 pad = code->pad; +- int ret; ++ unsigned int index = code->index; ++ unsigned int i; + + if (code->pad == RKISP1_RSZ_PAD_SRC) { + /* supported mbus codes on the src are the same as in the capture */ +@@ -388,15 +384,29 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd, + return 0; + } + +- /* supported mbus codes on the sink pad are the same as isp src pad */ +- code->pad = RKISP1_ISP_PAD_SOURCE_VIDEO; +- ret = v4l2_subdev_call(&rsz->rkisp1->isp.sd, pad, enum_mbus_code, +- &pad_state, code); ++ /* ++ * Supported mbus codes on the sink pad are the same as on the ISP ++ * source pad. ++ */ ++ for (i = 0; ; i++) { ++ const struct rkisp1_mbus_info *fmt = ++ rkisp1_mbus_info_get_by_index(i); + +- /* restore pad */ +- code->pad = pad; +- code->flags = 0; +- return ret; ++ if (!fmt) ++ break; ++ ++ if (!(fmt->direction & RKISP1_ISP_SD_SRC)) ++ continue; ++ ++ if (!index) { ++ code->code = fmt->mbus_code; ++ return 0; ++ } ++ ++ index--; ++ } ++ ++ return -EINVAL; + } + + static int rkisp1_rsz_init_config(struct v4l2_subdev *sd, +-- +2.43.0 + diff --git a/queue-6.6/media-rkisp1-store-irq-lines.patch b/queue-6.6/media-rkisp1-store-irq-lines.patch new file mode 100644 index 00000000000..0dd7973da92 --- /dev/null +++ b/queue-6.6/media-rkisp1-store-irq-lines.patch @@ -0,0 +1,126 @@ +From 49dfaaa1fde9c22d1fb1789213e94abba1843214 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 08:57:47 +0100 +Subject: media: rkisp1: Store IRQ lines + +From: Tomi Valkeinen + +[ Upstream commit 0753874617de883c6d4da903142f334f76a75d70 ] + +Store the IRQ lines used by the driver for easy access. These are needed +in future patches which fix IRQ race issues. + +Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-3-358a2c871a3c@ideasonboard.com + +Tested-by: Adam Ford #imx8mp-beacon +Signed-off-by: Tomi Valkeinen +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + .../platform/rockchip/rkisp1/rkisp1-common.h | 11 ++++++++++- + .../media/platform/rockchip/rkisp1/rkisp1-dev.c | 17 +++++++++++++---- + 2 files changed, 23 insertions(+), 5 deletions(-) + +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +index d30f0ecb1bfd..104a1dbeff43 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +@@ -61,6 +61,14 @@ struct dentry; + RKISP1_CIF_ISP_EXP_END | \ + RKISP1_CIF_ISP_HIST_MEASURE_RDY) + ++/* IRQ lines */ ++enum rkisp1_irq_line { ++ RKISP1_IRQ_ISP = 0, ++ RKISP1_IRQ_MI, ++ RKISP1_IRQ_MIPI, ++ RKISP1_NUM_IRQS, ++}; ++ + /* enum for the resizer pads */ + enum rkisp1_rsz_pad { + RKISP1_RSZ_PAD_SINK, +@@ -441,7 +449,6 @@ struct rkisp1_debug { + * struct rkisp1_device - ISP platform device + * + * @base_addr: base register address +- * @irq: the irq number + * @dev: a pointer to the struct device + * @clk_size: number of clocks + * @clks: array of clocks +@@ -459,6 +466,7 @@ struct rkisp1_debug { + * @stream_lock: serializes {start/stop}_streaming callbacks between the capture devices. + * @debug: debug params to be exposed on debugfs + * @info: version-specific ISP information ++ * @irqs: IRQ line numbers + */ + struct rkisp1_device { + void __iomem *base_addr; +@@ -479,6 +487,7 @@ struct rkisp1_device { + struct mutex stream_lock; /* serialize {start/stop}_streaming cb between capture devices */ + struct rkisp1_debug debug; + const struct rkisp1_info *info; ++ int irqs[RKISP1_NUM_IRQS]; + }; + + /* +diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +index 7b8a361d4c4a..f96f821a7b50 100644 +--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c ++++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +@@ -114,6 +114,7 @@ + struct rkisp1_isr_data { + const char *name; + irqreturn_t (*isr)(int irq, void *ctx); ++ u32 line_mask; + }; + + /* ---------------------------------------------------------------------------- +@@ -471,9 +472,9 @@ static const char * const px30_isp_clks[] = { + }; + + static const struct rkisp1_isr_data px30_isp_isrs[] = { +- { "isp", rkisp1_isp_isr }, +- { "mi", rkisp1_capture_isr }, +- { "mipi", rkisp1_csi_isr }, ++ { "isp", rkisp1_isp_isr, BIT(RKISP1_IRQ_ISP) }, ++ { "mi", rkisp1_capture_isr, BIT(RKISP1_IRQ_MI) }, ++ { "mipi", rkisp1_csi_isr, BIT(RKISP1_IRQ_MIPI) }, + }; + + static const struct rkisp1_info px30_isp_info = { +@@ -492,7 +493,7 @@ static const char * const rk3399_isp_clks[] = { + }; + + static const struct rkisp1_isr_data rk3399_isp_isrs[] = { +- { NULL, rkisp1_isr }, ++ { NULL, rkisp1_isr, BIT(RKISP1_IRQ_ISP) | BIT(RKISP1_IRQ_MI) | BIT(RKISP1_IRQ_MIPI) }, + }; + + static const struct rkisp1_info rk3399_isp_info = { +@@ -543,6 +544,9 @@ static int rkisp1_probe(struct platform_device *pdev) + if (IS_ERR(rkisp1->base_addr)) + return PTR_ERR(rkisp1->base_addr); + ++ for (unsigned int il = 0; il < ARRAY_SIZE(rkisp1->irqs); ++il) ++ rkisp1->irqs[il] = -1; ++ + for (i = 0; i < info->isr_size; i++) { + irq = info->isrs[i].name + ? platform_get_irq_byname(pdev, info->isrs[i].name) +@@ -550,6 +554,11 @@ static int rkisp1_probe(struct platform_device *pdev) + if (irq < 0) + return irq; + ++ for (unsigned int il = 0; il < ARRAY_SIZE(rkisp1->irqs); ++il) { ++ if (info->isrs[i].line_mask & BIT(il)) ++ rkisp1->irqs[il] = irq; ++ } ++ + ret = devm_request_irq(dev, irq, info->isrs[i].isr, 0, + dev_driver_string(dev), dev); + if (ret) { +-- +2.43.0 + diff --git a/queue-6.6/media-rockchip-rga-fix-swizzling-for-rgb-formats.patch b/queue-6.6/media-rockchip-rga-fix-swizzling-for-rgb-formats.patch new file mode 100644 index 00000000000..62a5890a4d1 --- /dev/null +++ b/queue-6.6/media-rockchip-rga-fix-swizzling-for-rgb-formats.patch @@ -0,0 +1,74 @@ +From 31978350377c5b7700a5d0079c2388f76b1c6255 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Oct 2023 13:00:22 +0200 +Subject: media: rockchip: rga: fix swizzling for RGB formats + +From: Michael Tretter + +[ Upstream commit 9e7dc39260edac180c206bb6149595a40eabae3e ] + +When using 32 bit RGB formats, the RGA on the rk3568 produces wrong +colors as the wrong color channels are read or written. The reason is +that the format description for the channel swizzeling is wrong and the +wrong bits are configured. For example, when converting ARGB32 to NV12, +the alpha channel is used as blue channel.. This doesn't happen if the +color format is the same on both sides. + +Fix the color_swap settings of the formats to correctly handle 32 bit +RGB formats. + +For RGA_COLOR_FMT_XBGR8888, the RGA_COLOR_ALPHA_SWAP bit doesn't have an +effect. Thus, it isn't possible to handle the V4L2_PIX_FMT_XRGB32. Thus, +it is removed from the list of supported formats. + +Signed-off-by: Michael Tretter +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/platform/rockchip/rga/rga.c | 15 +++------------ + 1 file changed, 3 insertions(+), 12 deletions(-) + +diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c +index f1c532a5802a..25f5b5eebf13 100644 +--- a/drivers/media/platform/rockchip/rga/rga.c ++++ b/drivers/media/platform/rockchip/rga/rga.c +@@ -184,25 +184,16 @@ static int rga_setup_ctrls(struct rga_ctx *ctx) + static struct rga_fmt formats[] = { + { + .fourcc = V4L2_PIX_FMT_ARGB32, +- .color_swap = RGA_COLOR_RB_SWAP, ++ .color_swap = RGA_COLOR_ALPHA_SWAP, + .hw_format = RGA_COLOR_FMT_ABGR8888, + .depth = 32, + .uv_factor = 1, + .y_div = 1, + .x_div = 1, + }, +- { +- .fourcc = V4L2_PIX_FMT_XRGB32, +- .color_swap = RGA_COLOR_RB_SWAP, +- .hw_format = RGA_COLOR_FMT_XBGR8888, +- .depth = 32, +- .uv_factor = 1, +- .y_div = 1, +- .x_div = 1, +- }, + { + .fourcc = V4L2_PIX_FMT_ABGR32, +- .color_swap = RGA_COLOR_ALPHA_SWAP, ++ .color_swap = RGA_COLOR_RB_SWAP, + .hw_format = RGA_COLOR_FMT_ABGR8888, + .depth = 32, + .uv_factor = 1, +@@ -211,7 +202,7 @@ static struct rga_fmt formats[] = { + }, + { + .fourcc = V4L2_PIX_FMT_XBGR32, +- .color_swap = RGA_COLOR_ALPHA_SWAP, ++ .color_swap = RGA_COLOR_RB_SWAP, + .hw_format = RGA_COLOR_FMT_XBGR8888, + .depth = 32, + .uv_factor = 1, +-- +2.43.0 + diff --git a/queue-6.6/media-stk1160-fixed-high-volume-of-stk1160_dbg-messa.patch b/queue-6.6/media-stk1160-fixed-high-volume-of-stk1160_dbg-messa.patch new file mode 100644 index 00000000000..d7972fb641c --- /dev/null +++ b/queue-6.6/media-stk1160-fixed-high-volume-of-stk1160_dbg-messa.patch @@ -0,0 +1,47 @@ +From b9ff05faf2d7e5445755e71b007df7180c7c5336 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 14:32:36 +0530 +Subject: media: stk1160: Fixed high volume of stk1160_dbg messages + +From: Ghanshyam Agrawal + +[ Upstream commit b3695e86d25aafbe175dd51f6aaf6f68d341d590 ] + +The function stk1160_dbg gets called too many times, which causes +the output to get flooded with messages. Since stk1160_dbg uses +printk, it is now replaced with printk_ratelimited. + +Suggested-by: Phillip Potter +Signed-off-by: Ghanshyam Agrawal +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/usb/stk1160/stk1160-video.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c +index 4e966f6bf608..366f0e4a5dc0 100644 +--- a/drivers/media/usb/stk1160/stk1160-video.c ++++ b/drivers/media/usb/stk1160/stk1160-video.c +@@ -107,8 +107,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) + + /* + * TODO: These stk1160_dbg are very spammy! +- * We should 1) check why we are getting them +- * and 2) add ratelimit. ++ * We should check why we are getting them. + * + * UPDATE: One of the reasons (the only one?) for getting these + * is incorrect standard (mismatch between expected and configured). +@@ -151,7 +150,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) + + /* Let the bug hunt begin! sanity checks! */ + if (lencopy < 0) { +- stk1160_dbg("copy skipped: negative lencopy\n"); ++ printk_ratelimited(KERN_DEBUG "copy skipped: negative lencopy\n"); + return; + } + +-- +2.43.0 + diff --git a/queue-6.6/media-uvcvideo-fix-power-line-control-for-a-chicony-.patch b/queue-6.6/media-uvcvideo-fix-power-line-control-for-a-chicony-.patch new file mode 100644 index 00000000000..7e69027b66a --- /dev/null +++ b/queue-6.6/media-uvcvideo-fix-power-line-control-for-a-chicony-.patch @@ -0,0 +1,47 @@ +From e4e87019fa1647287e11df729b9d7cc5efd64120 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Sep 2023 17:29:52 +0200 +Subject: media: uvcvideo: Fix power line control for a Chicony camera + +From: Ricardo Ribalda + +[ Upstream commit dba3e701917a4cce92920f8ccb9fa4d4ee5ac07e ] + +The device does not implement the control properly. + +Fixes v4l2-compliance error: + +info: checking control 'Power Line Frequency' (0x00980918) +fail: v4l2-test-controls.cpp(552): could not set valid menu item 3 + +Signed-off-by: Ricardo Ribalda +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c +index 08fcd2ffa727..4b5ea3501753 100644 +--- a/drivers/media/usb/uvc/uvc_driver.c ++++ b/drivers/media/usb/uvc/uvc_driver.c +@@ -2592,6 +2592,15 @@ static const struct usb_device_id uvc_ids[] = { + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, ++ /* Chicony Electronics Co., Ltd Integrated Camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x04f2, ++ .idProduct = 0xb67c, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = UVC_PC_PROTOCOL_15, ++ .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 }, + /* Chicony EasyCamera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, +-- +2.43.0 + diff --git a/queue-6.6/media-uvcvideo-fix-power-line-control-for-sunplusit-.patch b/queue-6.6/media-uvcvideo-fix-power-line-control-for-sunplusit-.patch new file mode 100644 index 00000000000..5989e088910 --- /dev/null +++ b/queue-6.6/media-uvcvideo-fix-power-line-control-for-sunplusit-.patch @@ -0,0 +1,64 @@ +From e3bf0b896e41459a2971b2b05a157c14d0d1a4ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 28 Oct 2023 09:55:04 +0200 +Subject: media: uvcvideo: Fix power line control for SunplusIT camera + +From: Ricardo Ribalda + +[ Upstream commit 6180056b0e0c097dad5d1569dcd661eaf509ea43 ] + +The device does not implement the power line frequency control +correctly. It is a UVC 1.5 device, but implements the control as a UVC +1.1 device. + +Add the corresponding control mapping override. + +Bus 003 Device 002: ID 2b7e:b752 SunplusIT Inc HD Camera +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.01 + bDeviceClass 239 Miscellaneous Device + bDeviceSubClass 2 + bDeviceProtocol 1 Interface Association + bMaxPacketSize0 64 + idVendor 0x2b7e + idProduct 0xb752 + bcdDevice 0.04 + iManufacturer 1 SunplusIT Inc + iProduct 2 HD Camera + iSerial 3 01.00.00 + bNumConfigurations 1 + +Cc: Yunke Cao +Signed-off-by: Ricardo Ribalda +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c +index 4b5ea3501753..bbd90123a4e7 100644 +--- a/drivers/media/usb/uvc/uvc_driver.c ++++ b/drivers/media/usb/uvc/uvc_driver.c +@@ -3003,6 +3003,15 @@ static const struct usb_device_id uvc_ids[] = { + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) }, ++ /* SunplusIT Inc HD Camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x2b7e, ++ .idProduct = 0xb752, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = UVC_PC_PROTOCOL_15, ++ .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 }, + /* Lenovo Integrated Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, +-- +2.43.0 + diff --git a/queue-6.6/mfd-ti_am335x_tscadc-fix-ti-soc-dependencies.patch b/queue-6.6/mfd-ti_am335x_tscadc-fix-ti-soc-dependencies.patch new file mode 100644 index 00000000000..c19188ef3dd --- /dev/null +++ b/queue-6.6/mfd-ti_am335x_tscadc-fix-ti-soc-dependencies.patch @@ -0,0 +1,35 @@ +From f993aeb72f3044945067b2741d372b0d24057e7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Dec 2023 15:56:39 +0000 +Subject: mfd: ti_am335x_tscadc: Fix TI SoC dependencies + +From: Peter Robinson + +[ Upstream commit 284d16c456e5d4b143f375b8ccc4038ab3f4ee0f ] + +The ti_am335x_tscadc is specific to some TI SoCs, update +the dependencies for those SoCs and compile testing. + +Signed-off-by: Peter Robinson +Link: https://lore.kernel.org/r/20231220155643.445849-1-pbrobinson@gmail.com +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/mfd/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index 90ce58fd629e..68d71b4b55bd 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -1483,6 +1483,7 @@ config MFD_SYSCON + + config MFD_TI_AM335X_TSCADC + tristate "TI ADC / Touch Screen chip support" ++ depends on ARCH_OMAP2PLUS || ARCH_K3 || COMPILE_TEST + select MFD_CORE + select REGMAP + select REGMAP_MMIO +-- +2.43.0 + diff --git a/queue-6.6/misc-lis3lv02d_i2c-add-missing-setting-of-the-reg_ct.patch b/queue-6.6/misc-lis3lv02d_i2c-add-missing-setting-of-the-reg_ct.patch new file mode 100644 index 00000000000..315356b7206 --- /dev/null +++ b/queue-6.6/misc-lis3lv02d_i2c-add-missing-setting-of-the-reg_ct.patch @@ -0,0 +1,60 @@ +From dce6a5de5515f34b260c518a30c96fb2ed327dc9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 24 Dec 2023 19:34:02 +0100 +Subject: misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback + +From: Hans de Goede + +[ Upstream commit b1b9f7a494400c0c39f8cd83de3aaa6111c55087 ] + +The lis3lv02d_i2c driver was missing a line to set the lis3_dev's +reg_ctrl callback. + +lis3_reg_ctrl(on) is called from the init callback, but due to +the missing reg_ctrl callback the regulators where never turned off +again leading to the following oops/backtrace when detaching the driver: + +[ 82.313527] ------------[ cut here ]------------ +[ 82.313546] WARNING: CPU: 1 PID: 1724 at drivers/regulator/core.c:2396 _regulator_put+0x219/0x230 +... +[ 82.313695] RIP: 0010:_regulator_put+0x219/0x230 +... +[ 82.314767] Call Trace: +[ 82.314770] +[ 82.314772] ? _regulator_put+0x219/0x230 +[ 82.314777] ? __warn+0x81/0x170 +[ 82.314784] ? _regulator_put+0x219/0x230 +[ 82.314791] ? report_bug+0x18d/0x1c0 +[ 82.314801] ? handle_bug+0x3c/0x80 +[ 82.314806] ? exc_invalid_op+0x13/0x60 +[ 82.314812] ? asm_exc_invalid_op+0x16/0x20 +[ 82.314845] ? _regulator_put+0x219/0x230 +[ 82.314857] regulator_bulk_free+0x39/0x60 +[ 82.314865] i2c_device_remove+0x22/0xb0 + +Add the missing setting of the callback so that the regulators +properly get turned off again when not used. + +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20231224183402.95640-1-hdegoede@redhat.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c +index 3882e97e96a7..c6eb27d46cb0 100644 +--- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c ++++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c +@@ -150,6 +150,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client) + lis3_dev.init = lis3_i2c_init; + lis3_dev.read = lis3_i2c_read; + lis3_dev.write = lis3_i2c_write; ++ lis3_dev.reg_ctrl = lis3_reg_ctrl; + lis3_dev.irq = client->irq; + lis3_dev.ac = lis3lv02d_axis_map; + lis3_dev.pm_dev = &client->dev; +-- +2.43.0 + diff --git a/queue-6.6/net-atlantic-eliminate-double-free-in-error-handling.patch b/queue-6.6/net-atlantic-eliminate-double-free-in-error-handling.patch new file mode 100644 index 00000000000..c2bc6dc6978 --- /dev/null +++ b/queue-6.6/net-atlantic-eliminate-double-free-in-error-handling.patch @@ -0,0 +1,288 @@ +From e06e0e90040489382ee22541536bd52bbf97d710 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Dec 2023 10:50:44 +0100 +Subject: net: atlantic: eliminate double free in error handling logic + +From: Igor Russkikh + +[ Upstream commit b3cb7a830a24527877b0bc900b9bd74a96aea928 ] + +Driver has a logic leak in ring data allocation/free, +where aq_ring_free could be called multiple times on same ring, +if system is under stress and got memory allocation error. + +Ring pointer was used as an indicator of failure, but this is +not correct since only ring data is allocated/deallocated. +Ring itself is an array member. + +Changing ring allocation functions to return error code directly. +This simplifies error handling and eliminates aq_ring_free +on higher layer. + +Signed-off-by: Igor Russkikh +Link: https://lore.kernel.org/r/20231213095044.23146-1-irusskikh@marvell.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../net/ethernet/aquantia/atlantic/aq_ptp.c | 28 +++------ + .../net/ethernet/aquantia/atlantic/aq_ring.c | 61 +++++-------------- + .../net/ethernet/aquantia/atlantic/aq_ring.h | 22 +++---- + .../net/ethernet/aquantia/atlantic/aq_vec.c | 23 +++---- + 4 files changed, 47 insertions(+), 87 deletions(-) + +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c +index 28c9b6f1a54f..abd4832e4ed2 100644 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c +@@ -953,8 +953,6 @@ int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic) + { + struct aq_ptp_s *aq_ptp = aq_nic->aq_ptp; + unsigned int tx_ring_idx, rx_ring_idx; +- struct aq_ring_s *hwts; +- struct aq_ring_s *ring; + int err; + + if (!aq_ptp) +@@ -962,29 +960,23 @@ int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic) + + tx_ring_idx = aq_ptp_ring_idx(aq_nic->aq_nic_cfg.tc_mode); + +- ring = aq_ring_tx_alloc(&aq_ptp->ptp_tx, aq_nic, +- tx_ring_idx, &aq_nic->aq_nic_cfg); +- if (!ring) { +- err = -ENOMEM; ++ err = aq_ring_tx_alloc(&aq_ptp->ptp_tx, aq_nic, ++ tx_ring_idx, &aq_nic->aq_nic_cfg); ++ if (err) + goto err_exit; +- } + + rx_ring_idx = aq_ptp_ring_idx(aq_nic->aq_nic_cfg.tc_mode); + +- ring = aq_ring_rx_alloc(&aq_ptp->ptp_rx, aq_nic, +- rx_ring_idx, &aq_nic->aq_nic_cfg); +- if (!ring) { +- err = -ENOMEM; ++ err = aq_ring_rx_alloc(&aq_ptp->ptp_rx, aq_nic, ++ rx_ring_idx, &aq_nic->aq_nic_cfg); ++ if (err) + goto err_exit_ptp_tx; +- } + +- hwts = aq_ring_hwts_rx_alloc(&aq_ptp->hwts_rx, aq_nic, PTP_HWST_RING_IDX, +- aq_nic->aq_nic_cfg.rxds, +- aq_nic->aq_nic_cfg.aq_hw_caps->rxd_size); +- if (!hwts) { +- err = -ENOMEM; ++ err = aq_ring_hwts_rx_alloc(&aq_ptp->hwts_rx, aq_nic, PTP_HWST_RING_IDX, ++ aq_nic->aq_nic_cfg.rxds, ++ aq_nic->aq_nic_cfg.aq_hw_caps->rxd_size); ++ if (err) + goto err_exit_ptp_rx; +- } + + err = aq_ptp_skb_ring_init(&aq_ptp->skb_ring, aq_nic->aq_nic_cfg.rxds); + if (err != 0) { +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +index e1885c1eb100..cda8597b4e14 100644 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +@@ -132,8 +132,8 @@ static int aq_get_rxpages(struct aq_ring_s *self, struct aq_ring_buff_s *rxbuf) + return 0; + } + +-static struct aq_ring_s *aq_ring_alloc(struct aq_ring_s *self, +- struct aq_nic_s *aq_nic) ++static int aq_ring_alloc(struct aq_ring_s *self, ++ struct aq_nic_s *aq_nic) + { + int err = 0; + +@@ -156,46 +156,29 @@ static struct aq_ring_s *aq_ring_alloc(struct aq_ring_s *self, + err_exit: + if (err < 0) { + aq_ring_free(self); +- self = NULL; + } + +- return self; ++ return err; + } + +-struct aq_ring_s *aq_ring_tx_alloc(struct aq_ring_s *self, +- struct aq_nic_s *aq_nic, +- unsigned int idx, +- struct aq_nic_cfg_s *aq_nic_cfg) ++int aq_ring_tx_alloc(struct aq_ring_s *self, ++ struct aq_nic_s *aq_nic, ++ unsigned int idx, ++ struct aq_nic_cfg_s *aq_nic_cfg) + { +- int err = 0; +- + self->aq_nic = aq_nic; + self->idx = idx; + self->size = aq_nic_cfg->txds; + self->dx_size = aq_nic_cfg->aq_hw_caps->txd_size; + +- self = aq_ring_alloc(self, aq_nic); +- if (!self) { +- err = -ENOMEM; +- goto err_exit; +- } +- +-err_exit: +- if (err < 0) { +- aq_ring_free(self); +- self = NULL; +- } +- +- return self; ++ return aq_ring_alloc(self, aq_nic); + } + +-struct aq_ring_s *aq_ring_rx_alloc(struct aq_ring_s *self, +- struct aq_nic_s *aq_nic, +- unsigned int idx, +- struct aq_nic_cfg_s *aq_nic_cfg) ++int aq_ring_rx_alloc(struct aq_ring_s *self, ++ struct aq_nic_s *aq_nic, ++ unsigned int idx, ++ struct aq_nic_cfg_s *aq_nic_cfg) + { +- int err = 0; +- + self->aq_nic = aq_nic; + self->idx = idx; + self->size = aq_nic_cfg->rxds; +@@ -217,22 +200,10 @@ struct aq_ring_s *aq_ring_rx_alloc(struct aq_ring_s *self, + self->tail_size = 0; + } + +- self = aq_ring_alloc(self, aq_nic); +- if (!self) { +- err = -ENOMEM; +- goto err_exit; +- } +- +-err_exit: +- if (err < 0) { +- aq_ring_free(self); +- self = NULL; +- } +- +- return self; ++ return aq_ring_alloc(self, aq_nic); + } + +-struct aq_ring_s * ++int + aq_ring_hwts_rx_alloc(struct aq_ring_s *self, struct aq_nic_s *aq_nic, + unsigned int idx, unsigned int size, unsigned int dx_size) + { +@@ -250,10 +221,10 @@ aq_ring_hwts_rx_alloc(struct aq_ring_s *self, struct aq_nic_s *aq_nic, + GFP_KERNEL); + if (!self->dx_ring) { + aq_ring_free(self); +- return NULL; ++ return -ENOMEM; + } + +- return self; ++ return 0; + } + + int aq_ring_init(struct aq_ring_s *self, const enum atl_ring_type ring_type) +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h +index 0a6c34438c1d..52847310740a 100644 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h +@@ -183,14 +183,14 @@ static inline unsigned int aq_ring_avail_dx(struct aq_ring_s *self) + self->sw_head - self->sw_tail - 1); + } + +-struct aq_ring_s *aq_ring_tx_alloc(struct aq_ring_s *self, +- struct aq_nic_s *aq_nic, +- unsigned int idx, +- struct aq_nic_cfg_s *aq_nic_cfg); +-struct aq_ring_s *aq_ring_rx_alloc(struct aq_ring_s *self, +- struct aq_nic_s *aq_nic, +- unsigned int idx, +- struct aq_nic_cfg_s *aq_nic_cfg); ++int aq_ring_tx_alloc(struct aq_ring_s *self, ++ struct aq_nic_s *aq_nic, ++ unsigned int idx, ++ struct aq_nic_cfg_s *aq_nic_cfg); ++int aq_ring_rx_alloc(struct aq_ring_s *self, ++ struct aq_nic_s *aq_nic, ++ unsigned int idx, ++ struct aq_nic_cfg_s *aq_nic_cfg); + + int aq_ring_init(struct aq_ring_s *self, const enum atl_ring_type ring_type); + void aq_ring_rx_deinit(struct aq_ring_s *self); +@@ -207,9 +207,9 @@ int aq_ring_rx_clean(struct aq_ring_s *self, + int budget); + int aq_ring_rx_fill(struct aq_ring_s *self); + +-struct aq_ring_s *aq_ring_hwts_rx_alloc(struct aq_ring_s *self, +- struct aq_nic_s *aq_nic, unsigned int idx, +- unsigned int size, unsigned int dx_size); ++int aq_ring_hwts_rx_alloc(struct aq_ring_s *self, ++ struct aq_nic_s *aq_nic, unsigned int idx, ++ unsigned int size, unsigned int dx_size); + void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic); + + unsigned int aq_ring_fill_stats_data(struct aq_ring_s *self, u64 *data); +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +index f5db1c44e9b9..9769ab4f9bef 100644 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +@@ -136,35 +136,32 @@ int aq_vec_ring_alloc(struct aq_vec_s *self, struct aq_nic_s *aq_nic, + const unsigned int idx_ring = AQ_NIC_CFG_TCVEC2RING(aq_nic_cfg, + i, idx); + +- ring = aq_ring_tx_alloc(&self->ring[i][AQ_VEC_TX_ID], aq_nic, +- idx_ring, aq_nic_cfg); +- if (!ring) { +- err = -ENOMEM; ++ ring = &self->ring[i][AQ_VEC_TX_ID]; ++ err = aq_ring_tx_alloc(ring, aq_nic, idx_ring, aq_nic_cfg); ++ if (err) + goto err_exit; +- } + + ++self->tx_rings; + + aq_nic_set_tx_ring(aq_nic, idx_ring, ring); + +- if (xdp_rxq_info_reg(&self->ring[i][AQ_VEC_RX_ID].xdp_rxq, ++ ring = &self->ring[i][AQ_VEC_RX_ID]; ++ if (xdp_rxq_info_reg(&ring->xdp_rxq, + aq_nic->ndev, idx, + self->napi.napi_id) < 0) { + err = -ENOMEM; + goto err_exit; + } +- if (xdp_rxq_info_reg_mem_model(&self->ring[i][AQ_VEC_RX_ID].xdp_rxq, ++ if (xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, + MEM_TYPE_PAGE_SHARED, NULL) < 0) { +- xdp_rxq_info_unreg(&self->ring[i][AQ_VEC_RX_ID].xdp_rxq); ++ xdp_rxq_info_unreg(&ring->xdp_rxq); + err = -ENOMEM; + goto err_exit; + } + +- ring = aq_ring_rx_alloc(&self->ring[i][AQ_VEC_RX_ID], aq_nic, +- idx_ring, aq_nic_cfg); +- if (!ring) { +- xdp_rxq_info_unreg(&self->ring[i][AQ_VEC_RX_ID].xdp_rxq); +- err = -ENOMEM; ++ err = aq_ring_rx_alloc(ring, aq_nic, idx_ring, aq_nic_cfg); ++ if (err) { ++ xdp_rxq_info_unreg(&ring->xdp_rxq); + goto err_exit; + } + +-- +2.43.0 + diff --git a/queue-6.6/net-dsa-mv88e6xxx-fix-mv88e6352_serdes_get_stats-err.patch b/queue-6.6/net-dsa-mv88e6xxx-fix-mv88e6352_serdes_get_stats-err.patch new file mode 100644 index 00000000000..4a2cbac1680 --- /dev/null +++ b/queue-6.6/net-dsa-mv88e6xxx-fix-mv88e6352_serdes_get_stats-err.patch @@ -0,0 +1,102 @@ +From 859aa6fafd195cbb6a9175956c346749a8a0b8cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Dec 2023 14:50:24 +0100 +Subject: net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path + +From: Tobias Waldekranz + +[ Upstream commit fc82a08ae795ee6b73fb6b50785f7be248bec7b5 ] + +mv88e6xxx_get_stats, which collects stats from various sources, +expects all callees to return the number of stats read. If an error +occurs, 0 should be returned. + +Prevent future mishaps of this kind by updating the return type to +reflect this contract. + +Reviewed-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: Tobias Waldekranz +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mv88e6xxx/chip.h | 4 ++-- + drivers/net/dsa/mv88e6xxx/serdes.c | 10 +++++----- + drivers/net/dsa/mv88e6xxx/serdes.h | 8 ++++---- + 3 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h +index 44383a03ef2f..c54d305a1d83 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.h ++++ b/drivers/net/dsa/mv88e6xxx/chip.h +@@ -601,8 +601,8 @@ struct mv88e6xxx_ops { + int (*serdes_get_sset_count)(struct mv88e6xxx_chip *chip, int port); + int (*serdes_get_strings)(struct mv88e6xxx_chip *chip, int port, + uint8_t *data); +- int (*serdes_get_stats)(struct mv88e6xxx_chip *chip, int port, +- uint64_t *data); ++ size_t (*serdes_get_stats)(struct mv88e6xxx_chip *chip, int port, ++ uint64_t *data); + + /* SERDES registers for ethtool */ + int (*serdes_get_regs_len)(struct mv88e6xxx_chip *chip, int port); +diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c +index 3b4b42651fa3..01ea53940786 100644 +--- a/drivers/net/dsa/mv88e6xxx/serdes.c ++++ b/drivers/net/dsa/mv88e6xxx/serdes.c +@@ -177,8 +177,8 @@ static uint64_t mv88e6352_serdes_get_stat(struct mv88e6xxx_chip *chip, + return val; + } + +-int mv88e6352_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, +- uint64_t *data) ++size_t mv88e6352_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, ++ uint64_t *data) + { + struct mv88e6xxx_port *mv88e6xxx_port = &chip->ports[port]; + struct mv88e6352_serdes_hw_stat *stat; +@@ -187,7 +187,7 @@ int mv88e6352_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, + + err = mv88e6352_g2_scratch_port_has_serdes(chip, port); + if (err <= 0) +- return err; ++ return 0; + + BUILD_BUG_ON(ARRAY_SIZE(mv88e6352_serdes_hw_stats) > + ARRAY_SIZE(mv88e6xxx_port->serdes_stats)); +@@ -429,8 +429,8 @@ static uint64_t mv88e6390_serdes_get_stat(struct mv88e6xxx_chip *chip, int lane, + return reg[0] | ((u64)reg[1] << 16) | ((u64)reg[2] << 32); + } + +-int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, +- uint64_t *data) ++size_t mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, ++ uint64_t *data) + { + struct mv88e6390_serdes_hw_stat *stat; + int lane; +diff --git a/drivers/net/dsa/mv88e6xxx/serdes.h b/drivers/net/dsa/mv88e6xxx/serdes.h +index aac95cab46e3..ff5c3ab31e15 100644 +--- a/drivers/net/dsa/mv88e6xxx/serdes.h ++++ b/drivers/net/dsa/mv88e6xxx/serdes.h +@@ -127,13 +127,13 @@ unsigned int mv88e6390_serdes_irq_mapping(struct mv88e6xxx_chip *chip, + int mv88e6352_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port); + int mv88e6352_serdes_get_strings(struct mv88e6xxx_chip *chip, + int port, uint8_t *data); +-int mv88e6352_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, +- uint64_t *data); ++size_t mv88e6352_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, ++ uint64_t *data); + int mv88e6390_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port); + int mv88e6390_serdes_get_strings(struct mv88e6xxx_chip *chip, + int port, uint8_t *data); +-int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, +- uint64_t *data); ++size_t mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, ++ uint64_t *data); + + int mv88e6352_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port); + void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); +-- +2.43.0 + diff --git a/queue-6.6/net-dsa-qca8k-put-mdio-bus-of-node-on-qca8k_mdio_reg.patch b/queue-6.6/net-dsa-qca8k-put-mdio-bus-of-node-on-qca8k_mdio_reg.patch new file mode 100644 index 00000000000..c7bdc65e090 --- /dev/null +++ b/queue-6.6/net-dsa-qca8k-put-mdio-bus-of-node-on-qca8k_mdio_reg.patch @@ -0,0 +1,96 @@ +From f9b65aae90cecaaded0816e7046e55ad8911c153 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Jan 2024 16:00:31 +0200 +Subject: net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() + failure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Vladimir Oltean + +[ Upstream commit 68e1010cda7967cfca9c8650ee1f4efcae54ab90 ] + +of_get_child_by_name() gives us an OF node with an elevated refcount, +which should be dropped when we're done with it. This is so that, +if (of_node_check_flag(node, OF_DYNAMIC)) is true, the node's memory can +eventually be freed. + +There are 2 distinct paths to be considered in qca8k_mdio_register(): + +- devm_of_mdiobus_register() succeeds: since commit 3b73a7b8ec38 ("net: + mdio_bus: add refcounting for fwnodes to mdiobus"), the MDIO core + treats this well. + +- devm_of_mdiobus_register() or anything up to that point fails: it is + the duty of the qca8k driver to release the OF node. + +This change addresses the second case by making sure that the OF node +reference is not leaked. + +The "mdio" node may be NULL, but of_node_put(NULL) is safe. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Alvin Å ipraga +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c +index 4ce68e655a63..368d53d3b1d6 100644 +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -949,10 +949,15 @@ qca8k_mdio_register(struct qca8k_priv *priv) + struct dsa_switch *ds = priv->ds; + struct device_node *mdio; + struct mii_bus *bus; ++ int err; ++ ++ mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); + + bus = devm_mdiobus_alloc(ds->dev); +- if (!bus) +- return -ENOMEM; ++ if (!bus) { ++ err = -ENOMEM; ++ goto out_put_node; ++ } + + bus->priv = (void *)priv; + snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d", +@@ -962,12 +967,12 @@ qca8k_mdio_register(struct qca8k_priv *priv) + ds->slave_mii_bus = bus; + + /* Check if the devicetree declare the port:phy mapping */ +- mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); + if (of_device_is_available(mdio)) { + bus->name = "qca8k slave mii"; + bus->read = qca8k_internal_mdio_read; + bus->write = qca8k_internal_mdio_write; +- return devm_of_mdiobus_register(priv->dev, bus, mdio); ++ err = devm_of_mdiobus_register(priv->dev, bus, mdio); ++ goto out_put_node; + } + + /* If a mapping can't be found the legacy mapping is used, +@@ -976,7 +981,13 @@ qca8k_mdio_register(struct qca8k_priv *priv) + bus->name = "qca8k-legacy slave mii"; + bus->read = qca8k_legacy_mdio_read; + bus->write = qca8k_legacy_mdio_write; +- return devm_mdiobus_register(priv->dev, bus); ++ ++ err = devm_mdiobus_register(priv->dev, bus); ++ ++out_put_node: ++ of_node_put(mdio); ++ ++ return err; + } + + static int +-- +2.43.0 + diff --git a/queue-6.6/net-kcm-fix-direct-access-to-bv_len.patch b/queue-6.6/net-kcm-fix-direct-access-to-bv_len.patch new file mode 100644 index 00000000000..1cd35fb2386 --- /dev/null +++ b/queue-6.6/net-kcm-fix-direct-access-to-bv_len.patch @@ -0,0 +1,37 @@ +From fc1942db17f7ea86bc344c66f7bfe706491b7283 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jan 2024 12:59:58 -0800 +Subject: net: kcm: fix direct access to bv_len + +From: Mina Almasry + +[ Upstream commit b15a4cfe100b9acd097d3ae7052448bd1cdc2a3b ] + +Minor fix for kcm: code wanting to access the fields inside an skb +frag should use the skb_frag_*() helpers, instead of accessing the +fields directly. + +Signed-off-by: Mina Almasry +Link: https://lore.kernel.org/r/20240102205959.794513-1-almasrymina@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/kcm/kcmsock.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c +index dd1d8ffd5f59..083376ea237e 100644 +--- a/net/kcm/kcmsock.c ++++ b/net/kcm/kcmsock.c +@@ -634,7 +634,7 @@ static int kcm_write_msgs(struct kcm_sock *kcm) + + msize = 0; + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) +- msize += skb_shinfo(skb)->frags[i].bv_len; ++ msize += skb_frag_size(&skb_shinfo(skb)->frags[i]); + + iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, + skb_shinfo(skb)->frags, skb_shinfo(skb)->nr_frags, +-- +2.43.0 + diff --git a/queue-6.6/net-mvmdio-avoid-excessive-sleeps-in-polled-mode.patch b/queue-6.6/net-mvmdio-avoid-excessive-sleeps-in-polled-mode.patch new file mode 100644 index 00000000000..11bbee524c4 --- /dev/null +++ b/queue-6.6/net-mvmdio-avoid-excessive-sleeps-in-polled-mode.patch @@ -0,0 +1,139 @@ +From 8a94ca96e4b26dd2f847c3a07ddfbf5571f1ec8a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 11:08:10 +0100 +Subject: net: mvmdio: Avoid excessive sleeps in polled mode + +From: Tobias Waldekranz + +[ Upstream commit 7dd12fe34686d89c332b1a05104d18d728591f0a ] + +Before this change, when operating in polled mode, i.e. no IRQ is +available, every individual C45 access would be hit with a 150us sleep +after the bus access. + +For example, on a board with a CN9130 SoC connected to an MV88X3310 +PHY, a single C45 read would take around 165us: + + root@infix:~$ mdio f212a600.mdio-mii mmd 4:1 bench 0xc003 + Performed 1000 reads in 165ms + +By replacing the long sleep with a tighter poll loop, we observe a 10x +increase in bus throughput: + + root@infix:~$ mdio f212a600.mdio-mii mmd 4:1 bench 0xc003 + Performed 1000 reads in 15ms + +Signed-off-by: Tobias Waldekranz +Reviewed-by: Andrew Lunn +Tested-by: Andrew Lunn +Link: https://lore.kernel.org/r/20231204100811.2708884-3-tobias@waldekranz.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/mvmdio.c | 53 ++++++++------------------- + 1 file changed, 16 insertions(+), 37 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c +index 674913184ebf..2ef613a237d8 100644 +--- a/drivers/net/ethernet/marvell/mvmdio.c ++++ b/drivers/net/ethernet/marvell/mvmdio.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -58,11 +59,6 @@ + * - Armada 370 (Globalscale Mirabox): 41us to 43us (Polled) + */ + #define MVMDIO_SMI_TIMEOUT 1000 /* 1000us = 1ms */ +-#define MVMDIO_SMI_POLL_INTERVAL_MIN 45 +-#define MVMDIO_SMI_POLL_INTERVAL_MAX 55 +- +-#define MVMDIO_XSMI_POLL_INTERVAL_MIN 150 +-#define MVMDIO_XSMI_POLL_INTERVAL_MAX 160 + + struct orion_mdio_dev { + void __iomem *regs; +@@ -84,8 +80,6 @@ enum orion_mdio_bus_type { + + struct orion_mdio_ops { + int (*is_done)(struct orion_mdio_dev *); +- unsigned int poll_interval_min; +- unsigned int poll_interval_max; + }; + + /* Wait for the SMI unit to be ready for another operation +@@ -94,34 +88,23 @@ static int orion_mdio_wait_ready(const struct orion_mdio_ops *ops, + struct mii_bus *bus) + { + struct orion_mdio_dev *dev = bus->priv; +- unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT); +- unsigned long end = jiffies + timeout; +- int timedout = 0; ++ unsigned long timeout; ++ int done; + +- while (1) { +- if (ops->is_done(dev)) ++ if (dev->err_interrupt <= 0) { ++ if (!read_poll_timeout_atomic(ops->is_done, done, done, 2, ++ MVMDIO_SMI_TIMEOUT, false, dev)) ++ return 0; ++ } else { ++ /* wait_event_timeout does not guarantee a delay of at ++ * least one whole jiffie, so timeout must be no less ++ * than two. ++ */ ++ timeout = max(usecs_to_jiffies(MVMDIO_SMI_TIMEOUT), 2); ++ ++ if (wait_event_timeout(dev->smi_busy_wait, ++ ops->is_done(dev), timeout)) + return 0; +- else if (timedout) +- break; +- +- if (dev->err_interrupt <= 0) { +- usleep_range(ops->poll_interval_min, +- ops->poll_interval_max); +- +- if (time_is_before_jiffies(end)) +- ++timedout; +- } else { +- /* wait_event_timeout does not guarantee a delay of at +- * least one whole jiffie, so timeout must be no less +- * than two. +- */ +- if (timeout < 2) +- timeout = 2; +- wait_event_timeout(dev->smi_busy_wait, +- ops->is_done(dev), timeout); +- +- ++timedout; +- } + } + + dev_err(bus->parent, "Timeout: SMI busy for too long\n"); +@@ -135,8 +118,6 @@ static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev) + + static const struct orion_mdio_ops orion_mdio_smi_ops = { + .is_done = orion_mdio_smi_is_done, +- .poll_interval_min = MVMDIO_SMI_POLL_INTERVAL_MIN, +- .poll_interval_max = MVMDIO_SMI_POLL_INTERVAL_MAX, + }; + + static int orion_mdio_smi_read(struct mii_bus *bus, int mii_id, +@@ -194,8 +175,6 @@ static int orion_mdio_xsmi_is_done(struct orion_mdio_dev *dev) + + static const struct orion_mdio_ops orion_mdio_xsmi_ops = { + .is_done = orion_mdio_xsmi_is_done, +- .poll_interval_min = MVMDIO_XSMI_POLL_INTERVAL_MIN, +- .poll_interval_max = MVMDIO_XSMI_POLL_INTERVAL_MAX, + }; + + static int orion_mdio_xsmi_read_c45(struct mii_bus *bus, int mii_id, +-- +2.43.0 + diff --git a/queue-6.6/net-phy-at803x-fix-passing-the-wrong-reference-for-c.patch b/queue-6.6/net-phy-at803x-fix-passing-the-wrong-reference-for-c.patch new file mode 100644 index 00000000000..c5e7da6bca1 --- /dev/null +++ b/queue-6.6/net-phy-at803x-fix-passing-the-wrong-reference-for-c.patch @@ -0,0 +1,54 @@ +From 8a65b79f5b8d8567ad5e921af781f1f538e65164 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Dec 2023 15:51:48 +0100 +Subject: net: phy: at803x: fix passing the wrong reference for config_intr + +From: Christian Marangi + +[ Upstream commit f8fdbf3389f44c7026f16e36cb1f2ff017f7f5b2 ] + +Fix passing the wrong reference for config_initr on passing the function +pointer, drop the wrong & from at803x_config_intr in the PHY struct. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/at803x.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c +index 37fb033e1c29..ef203b0807e5 100644 +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -2104,7 +2104,7 @@ static struct phy_driver at803x_driver[] = { + .write_page = at803x_write_page, + .get_features = at803x_get_features, + .read_status = at803x_read_status, +- .config_intr = &at803x_config_intr, ++ .config_intr = at803x_config_intr, + .handle_interrupt = at803x_handle_interrupt, + .get_tunable = at803x_get_tunable, + .set_tunable = at803x_set_tunable, +@@ -2134,7 +2134,7 @@ static struct phy_driver at803x_driver[] = { + .resume = at803x_resume, + .flags = PHY_POLL_CABLE_TEST, + /* PHY_BASIC_FEATURES */ +- .config_intr = &at803x_config_intr, ++ .config_intr = at803x_config_intr, + .handle_interrupt = at803x_handle_interrupt, + .cable_test_start = at803x_cable_test_start, + .cable_test_get_status = at803x_cable_test_get_status, +@@ -2150,7 +2150,7 @@ static struct phy_driver at803x_driver[] = { + .resume = at803x_resume, + .flags = PHY_POLL_CABLE_TEST, + /* PHY_BASIC_FEATURES */ +- .config_intr = &at803x_config_intr, ++ .config_intr = at803x_config_intr, + .handle_interrupt = at803x_handle_interrupt, + .cable_test_start = at803x_cable_test_start, + .cable_test_get_status = at803x_cable_test_get_status, +-- +2.43.0 + diff --git a/queue-6.6/net-phy-micrel-fix-ts_info-value-in-case-of-no-phc.patch b/queue-6.6/net-phy-micrel-fix-ts_info-value-in-case-of-no-phc.patch new file mode 100644 index 00000000000..883b27620c5 --- /dev/null +++ b/queue-6.6/net-phy-micrel-fix-ts_info-value-in-case-of-no-phc.patch @@ -0,0 +1,41 @@ +From ff7d657c65f7727386e20158502ca605f5d9404e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 12:28:34 +0100 +Subject: net: phy: micrel: fix ts_info value in case of no phc + +From: Kory Maincent + +[ Upstream commit 915d25a9d69be969c1cc6c1dd0c3861f6da7b55e ] + +In case of no phc we should not return SOFTWARE TIMESTAMPING flags as we do +not know whether the netdev supports of timestamping. +Remove it from the lan8841_ts_info and simply return 0. + +Signed-off-by: Kory Maincent +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/micrel.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c +index 27ca25bbd141..f81c4bcd85a2 100644 +--- a/drivers/net/phy/micrel.c ++++ b/drivers/net/phy/micrel.c +@@ -3628,12 +3628,8 @@ static int lan8841_ts_info(struct mii_timestamper *mii_ts, + + info->phc_index = ptp_priv->ptp_clock ? + ptp_clock_index(ptp_priv->ptp_clock) : -1; +- if (info->phc_index == -1) { +- info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE | +- SOF_TIMESTAMPING_RX_SOFTWARE | +- SOF_TIMESTAMPING_SOFTWARE; ++ if (info->phc_index == -1) + return 0; +- } + + info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | + SOF_TIMESTAMPING_RX_HARDWARE | +-- +2.43.0 + diff --git a/queue-6.6/net-smc-disable-seid-on-non-s390-archs-where-virtual.patch b/queue-6.6/net-smc-disable-seid-on-non-s390-archs-where-virtual.patch new file mode 100644 index 00000000000..a7b579ff65d --- /dev/null +++ b/queue-6.6/net-smc-disable-seid-on-non-s390-archs-where-virtual.patch @@ -0,0 +1,91 @@ +From 332d34e51c108af5f1eaf93197da4c2bb514cc25 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Dec 2023 22:26:15 +0800 +Subject: net/smc: disable SEID on non-s390 archs where virtual ISM may be used + +From: Wen Gu + +[ Upstream commit c6b8b8eb49904018e22e4e4b1fa502e57dc747d9 ] + +The system EID (SEID) is an internal EID used by SMC-D to represent the +s390 physical machine that OS is executing on. On s390 architecture, it +predefined by fixed string and part of cpuid and is enabled regardless +of whether underlay device is virtual ISM or platform firmware ISM. + +However on non-s390 architectures where SMC-D can be used with virtual +ISM devices, there is no similar information to identify physical +machines, especially in virtualization scenarios. So in such cases, SEID +is forcibly disabled and the user-defined UEID will be used to represent +the communicable space. + +Signed-off-by: Wen Gu +Reviewed-and-tested-by: Wenjia Zhang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/smc/smc_clc.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c +index 72f4d81a3f41..1489a8421d78 100644 +--- a/net/smc/smc_clc.c ++++ b/net/smc/smc_clc.c +@@ -155,10 +155,12 @@ static int smc_clc_ueid_remove(char *ueid) + rc = 0; + } + } ++#if IS_ENABLED(CONFIG_S390) + if (!rc && !smc_clc_eid_table.ueid_cnt) { + smc_clc_eid_table.seid_enabled = 1; + rc = -EAGAIN; /* indicate success and enabling of seid */ + } ++#endif + write_unlock(&smc_clc_eid_table.lock); + return rc; + } +@@ -273,22 +275,30 @@ int smc_nl_dump_seid(struct sk_buff *skb, struct netlink_callback *cb) + + int smc_nl_enable_seid(struct sk_buff *skb, struct genl_info *info) + { ++#if IS_ENABLED(CONFIG_S390) + write_lock(&smc_clc_eid_table.lock); + smc_clc_eid_table.seid_enabled = 1; + write_unlock(&smc_clc_eid_table.lock); + return 0; ++#else ++ return -EOPNOTSUPP; ++#endif + } + + int smc_nl_disable_seid(struct sk_buff *skb, struct genl_info *info) + { + int rc = 0; + ++#if IS_ENABLED(CONFIG_S390) + write_lock(&smc_clc_eid_table.lock); + if (!smc_clc_eid_table.ueid_cnt) + rc = -ENOENT; + else + smc_clc_eid_table.seid_enabled = 0; + write_unlock(&smc_clc_eid_table.lock); ++#else ++ rc = -EOPNOTSUPP; ++#endif + return rc; + } + +@@ -1269,7 +1279,11 @@ void __init smc_clc_init(void) + INIT_LIST_HEAD(&smc_clc_eid_table.list); + rwlock_init(&smc_clc_eid_table.lock); + smc_clc_eid_table.ueid_cnt = 0; ++#if IS_ENABLED(CONFIG_S390) + smc_clc_eid_table.seid_enabled = 1; ++#else ++ smc_clc_eid_table.seid_enabled = 0; ++#endif + } + + void smc_clc_exit(void) +-- +2.43.0 + diff --git a/queue-6.6/net-usb-ax88179_178a-avoid-two-consecutive-device-re.patch b/queue-6.6/net-usb-ax88179_178a-avoid-two-consecutive-device-re.patch new file mode 100644 index 00000000000..a51fed2a84e --- /dev/null +++ b/queue-6.6/net-usb-ax88179_178a-avoid-two-consecutive-device-re.patch @@ -0,0 +1,43 @@ +From 6374f329218ece5cb4fd58139a79271c3cf4a69c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 13:11:41 +0100 +Subject: net: usb: ax88179_178a: avoid two consecutive device resets + +From: Jose Ignacio Tornos Martinez + +[ Upstream commit d2689b6a86b9d23574bd4b654bf770b6034e2c7e ] + +The device is always reset two consecutive times (ax88179_reset is called +twice), one from usbnet_probe during the device binding and the other from +usbnet_open. + +Remove the non-necessary reset during the device binding and let the reset +operation from open to keep the normal behavior (tested with generic ASIX +Electronics Corp. AX88179 Gigabit Ethernet device). + +Reported-by: Herb Wei +Tested-by: Herb Wei +Signed-off-by: Jose Ignacio Tornos Martinez +Link: https://lore.kernel.org/r/20231120121239.54504-1-jtornosm@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/usb/ax88179_178a.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c +index 5a1bf42ce156..d837c1887416 100644 +--- a/drivers/net/usb/ax88179_178a.c ++++ b/drivers/net/usb/ax88179_178a.c +@@ -1315,8 +1315,6 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) + + netif_set_tso_max_size(dev->net, 16384); + +- ax88179_reset(dev); +- + return 0; + } + +-- +2.43.0 + diff --git a/queue-6.6/octeontx2-af-fix-max-npc-mcam-entry-check-while-vali.patch b/queue-6.6/octeontx2-af-fix-max-npc-mcam-entry-check-while-vali.patch new file mode 100644 index 00000000000..2c049d52d17 --- /dev/null +++ b/queue-6.6/octeontx2-af-fix-max-npc-mcam-entry-check-while-vali.patch @@ -0,0 +1,54 @@ +From a4dbca49e369eb4b566ca4748fc871e1e62e7115 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jan 2024 20:20:42 +0530 +Subject: octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry + +From: Suman Ghosh + +[ Upstream commit 4ebb1f95e0c3c3e0eec5bb21aa43097580c4b6e4 ] + +As of today, the last MCAM entry was not getting allocated because of +a <= check with the max_bmap count. This patch modifies that and if the +requested entry is greater than the available entries then set it to the +max value. + +Signed-off-by: Suman Ghosh +Link: https://lore.kernel.org/r/20240101145042.419697-1-sumang@marvell.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +index 0bcf3e559280..3784347b6fd8 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +@@ -2678,18 +2678,17 @@ int rvu_mbox_handler_npc_mcam_alloc_entry(struct rvu *rvu, + rsp->entry = NPC_MCAM_ENTRY_INVALID; + rsp->free_count = 0; + +- /* Check if ref_entry is within range */ +- if (req->priority && req->ref_entry >= mcam->bmap_entries) { +- dev_err(rvu->dev, "%s: reference entry %d is out of range\n", +- __func__, req->ref_entry); +- return NPC_MCAM_INVALID_REQ; +- } ++ /* Check if ref_entry is greater that the range ++ * then set it to max value. ++ */ ++ if (req->ref_entry > mcam->bmap_entries) ++ req->ref_entry = mcam->bmap_entries; + + /* ref_entry can't be '0' if requested priority is high. + * Can't be last entry if requested priority is low. + */ + if ((!req->ref_entry && req->priority == NPC_MCAM_HIGHER_PRIO) || +- ((req->ref_entry == (mcam->bmap_entries - 1)) && ++ ((req->ref_entry == mcam->bmap_entries) && + req->priority == NPC_MCAM_LOWER_PRIO)) + return NPC_MCAM_INVALID_REQ; + +-- +2.43.0 + diff --git a/queue-6.6/pci-add-intel_hda_arl-to-pci_ids.h.patch b/queue-6.6/pci-add-intel_hda_arl-to-pci_ids.h.patch new file mode 100644 index 00000000000..cd3b67d2678 --- /dev/null +++ b/queue-6.6/pci-add-intel_hda_arl-to-pci_ids.h.patch @@ -0,0 +1,41 @@ +From 0397541d878e4f0694525922678461931ff676f7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 15:27:06 -0600 +Subject: PCI: add INTEL_HDA_ARL to pci_ids.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Louis Bossart + +[ Upstream commit 5ec42bf04d72fd6d0a6855810cc779e0ee31dfd7 ] + +The PCI ID insertion follows the increasing order in the table, but +this hardware follows MTL (MeteorLake). + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Péter Ujfalusi +Reviewed-by: Kai Vehmanen +Acked-by: Mark Brown +Link: https://lore.kernel.org/r/20231204212710.185976-2-pierre-louis.bossart@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + include/linux/pci_ids.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h +index fe4a3589bb3f..a6c66ea80194 100644 +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -3064,6 +3064,7 @@ + #define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 + #define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 + #define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 ++#define PCI_DEVICE_ID_INTEL_HDA_ARL 0x7728 + #define PCI_DEVICE_ID_INTEL_HDA_RPL_S 0x7a50 + #define PCI_DEVICE_ID_INTEL_HDA_ADL_S 0x7ad0 + #define PCI_DEVICE_ID_INTEL_HDA_MTL 0x7e28 +-- +2.43.0 + diff --git a/queue-6.6/pci-add-no-pm-reset-quirk-for-nvidia-spectrum-device.patch b/queue-6.6/pci-add-no-pm-reset-quirk-for-nvidia-spectrum-device.patch new file mode 100644 index 00000000000..3a3d5b28387 --- /dev/null +++ b/queue-6.6/pci-add-no-pm-reset-quirk-for-nvidia-spectrum-device.patch @@ -0,0 +1,62 @@ +From 47d81d3679b5ecaac92b3cb2b14f12f5dec44117 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Nov 2023 13:17:16 +0100 +Subject: PCI: Add no PM reset quirk for NVIDIA Spectrum devices + +From: Ido Schimmel + +[ Upstream commit 3ed48c80b28d8dcd584d6ddaf00c75b7673e1a05 ] + +Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a +reset (i.e., they advertise NoSoftRst-). However, this transition does +not have any effect on the device: It continues to be operational and +network ports remain up. Advertising this support makes it seem as if a +PM reset is viable for these devices. Mark it as unavailable to skip it +when testing reset methods. + +Before: + + # cat /sys/bus/pci/devices/0000\:03\:00.0/reset_method + pm bus + +After: + + # cat /sys/bus/pci/devices/0000\:03\:00.0/reset_method + bus + +Signed-off-by: Ido Schimmel +Acked-by: Bjorn Helgaas +Signed-off-by: Petr Machata +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index e0081914052f..8f3b91e0d264 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -3786,6 +3786,19 @@ static void quirk_no_pm_reset(struct pci_dev *dev) + DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, PCI_ANY_ID, + PCI_CLASS_DISPLAY_VGA, 8, quirk_no_pm_reset); + ++/* ++ * Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a reset ++ * (i.e., they advertise NoSoftRst-). However, this transition does not have ++ * any effect on the device: It continues to be operational and network ports ++ * remain up. Advertising this support makes it seem as if a PM reset is viable ++ * for these devices. Mark it as unavailable to skip it when testing reset ++ * methods. ++ */ ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, 0xcb84, quirk_no_pm_reset); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, 0xcf6c, quirk_no_pm_reset); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, 0xcf70, quirk_no_pm_reset); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, 0xcf80, quirk_no_pm_reset); ++ + /* + * Thunderbolt controllers with broken MSI hotplug signaling: + * Entire 1st generation (Light Ridge, Eagle Ridge, Light Peak) and part +-- +2.43.0 + diff --git a/queue-6.6/pci-aer-decode-requester-id-when-no-error-info-found.patch b/queue-6.6/pci-aer-decode-requester-id-when-no-error-info-found.patch new file mode 100644 index 00000000000..78d515c2224 --- /dev/null +++ b/queue-6.6/pci-aer-decode-requester-id-when-no-error-info-found.patch @@ -0,0 +1,69 @@ +From dde8d022518ea642253179270eb1dc25eef3ed96 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 16:42:30 -0600 +Subject: PCI/AER: Decode Requester ID when no error info found + +From: Bjorn Helgaas + +[ Upstream commit 1291b716bbf969e101d517bfb8ba18d958f758b8 ] + +When a device with AER detects an error, it logs error information in its +own AER Error Status registers. It may send an Error Message to the Root +Port (RCEC in the case of an RCiEP), which logs the fact that an Error +Message was received (Root Error Status) and the Requester ID of the +message source (Error Source Identification). + +aer_print_port_info() prints the Requester ID from the Root Port Error +Source in the usual Linux "bb:dd.f" format, but when find_source_device() +finds no error details in the hierarchy below the Root Port, it printed the +raw Requester ID without decoding it. + +Decode the Requester ID in the usual Linux format so it matches other +messages. + +Sample message changes: + + - pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5 + - pcieport 0000:00:1c.5: AER: can't find device of ID00e5 + + pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5 + + pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5 + +Link: https://lore.kernel.org/r/20231206224231.732765-3-helgaas@kernel.org +Signed-off-by: Bjorn Helgaas +Reviewed-by: Jonathan Cameron +Reviewed-by: Kuppuswamy Sathyanarayanan +Signed-off-by: Sasha Levin +--- + drivers/pci/pcie/aer.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c +index 40d84cb0c601..c9afe4362835 100644 +--- a/drivers/pci/pcie/aer.c ++++ b/drivers/pci/pcie/aer.c +@@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) + u8 bus = info->id >> 8; + u8 devfn = info->id & 0xff; + +- pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", ++ pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", + info->multi_error_valid ? "Multiple " : "", + aer_error_severity_string[info->severity], + pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), +@@ -928,7 +928,12 @@ static bool find_source_device(struct pci_dev *parent, + pci_walk_bus(parent->subordinate, find_device_iter, e_info); + + if (!e_info->error_dev_num) { +- pci_info(parent, "can't find device of ID%04x\n", e_info->id); ++ u8 bus = e_info->id >> 8; ++ u8 devfn = e_info->id & 0xff; ++ ++ pci_info(parent, "found no error details for %04x:%02x:%02x.%d\n", ++ pci_domain_nr(parent->bus), bus, PCI_SLOT(devfn), ++ PCI_FUNC(devfn)); + return false; + } + return true; +-- +2.43.0 + diff --git a/queue-6.6/pci-fix-64gt-s-effective-data-rate-calculation.patch b/queue-6.6/pci-fix-64gt-s-effective-data-rate-calculation.patch new file mode 100644 index 00000000000..09773b2e627 --- /dev/null +++ b/queue-6.6/pci-fix-64gt-s-effective-data-rate-calculation.patch @@ -0,0 +1,40 @@ +From 4d3e260c1db1dd142cfe146c15ffda2534e34306 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jan 2024 19:27:00 +0200 +Subject: PCI: Fix 64GT/s effective data rate calculation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +[ Upstream commit ac4f1897fa5433a1b07a625503a91b6aa9d7e643 ] + +Unlike the lower rates, the PCIe 64GT/s Data Rate uses 1b/1b encoding, not +128b/130b (PCIe r6.1 sec 1.2, Table 1-1). Correct the PCIE_SPEED2MBS_ENC() +calculation to reflect that. + +Link: https://lore.kernel.org/r/20240102172701.65501-1-ilpo.jarvinen@linux.intel.com +Signed-off-by: Ilpo Järvinen +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/pci.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h +index 5484048f457d..99abc4cec0df 100644 +--- a/drivers/pci/pci.h ++++ b/drivers/pci/pci.h +@@ -269,7 +269,7 @@ void pci_bus_put(struct pci_bus *bus); + + /* PCIe speed to Mb/s reduced by encoding overhead */ + #define PCIE_SPEED2MBS_ENC(speed) \ +- ((speed) == PCIE_SPEED_64_0GT ? 64000*128/130 : \ ++ ((speed) == PCIE_SPEED_64_0GT ? 64000*1/1 : \ + (speed) == PCIE_SPEED_32_0GT ? 32000*128/130 : \ + (speed) == PCIE_SPEED_16_0GT ? 16000*128/130 : \ + (speed) == PCIE_SPEED_8_0GT ? 8000*128/130 : \ +-- +2.43.0 + diff --git a/queue-6.6/pci-only-override-amd-usb-controller-if-required.patch b/queue-6.6/pci-only-override-amd-usb-controller-if-required.patch new file mode 100644 index 00000000000..d3746a66144 --- /dev/null +++ b/queue-6.6/pci-only-override-amd-usb-controller-if-required.patch @@ -0,0 +1,55 @@ +From 6ec50c757776a7473ed6a9a754ebf40dcbf919fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 13:04:36 -0300 +Subject: PCI: Only override AMD USB controller if required + +From: Guilherme G. Piccoli + +[ Upstream commit e585a37e5061f6d5060517aed1ca4ccb2e56a34c ] + +By running a Van Gogh device (Steam Deck), the following message +was noticed in the kernel log: + + pci 0000:04:00.3: PCI class overridden (0x0c03fe -> 0x0c03fe) so dwc3 driver can claim this instead of xhci + +Effectively this means the quirk executed but changed nothing, since the +class of this device was already the proper one (likely adjusted by newer +firmware versions). + +Check and perform the override only if necessary. + +Link: https://lore.kernel.org/r/20231120160531.361552-1-gpiccoli@igalia.com +Signed-off-by: Guilherme G. Piccoli +Signed-off-by: Bjorn Helgaas +Cc: Huang Rui +Cc: Vicki Pfau +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 8f3b91e0d264..b5b96d2a9f4b 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -702,10 +702,13 @@ static void quirk_amd_dwc_class(struct pci_dev *pdev) + { + u32 class = pdev->class; + +- /* Use "USB Device (not host controller)" class */ +- pdev->class = PCI_CLASS_SERIAL_USB_DEVICE; +- pci_info(pdev, "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n", +- class, pdev->class); ++ if (class != PCI_CLASS_SERIAL_USB_DEVICE) { ++ /* Use "USB Device (not host controller)" class */ ++ pdev->class = PCI_CLASS_SERIAL_USB_DEVICE; ++ pci_info(pdev, ++ "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n", ++ class, pdev->class); ++ } + } + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, + quirk_amd_dwc_class); +-- +2.43.0 + diff --git a/queue-6.6/pci-switchtec-fix-stdev_release-crash-after-surprise.patch b/queue-6.6/pci-switchtec-fix-stdev_release-crash-after-surprise.patch new file mode 100644 index 00000000000..13d4c34185b --- /dev/null +++ b/queue-6.6/pci-switchtec-fix-stdev_release-crash-after-surprise.patch @@ -0,0 +1,104 @@ +From cab37b243db8c629f160f683e867c50d45b0ccc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 20:23:16 -0800 +Subject: PCI: switchtec: Fix stdev_release() crash after surprise hot remove + +From: Daniel Stodden + +[ Upstream commit df25461119d987b8c81d232cfe4411e91dcabe66 ] + +A PCI device hot removal may occur while stdev->cdev is held open. The call +to stdev_release() then happens during close or exit, at a point way past +switchtec_pci_remove(). Otherwise the last ref would vanish with the +trailing put_device(), just before return. + +At that later point in time, the devm cleanup has already removed the +stdev->mmio_mrpc mapping. Also, the stdev->pdev reference was not a counted +one. Therefore, in DMA mode, the iowrite32() in stdev_release() will cause +a fatal page fault, and the subsequent dma_free_coherent(), if reached, +would pass a stale &stdev->pdev->dev pointer. + +Fix by moving MRPC DMA shutdown into switchtec_pci_remove(), after +stdev_kill(). Counting the stdev->pdev ref is now optional, but may prevent +future accidents. + +Reproducible via the script at +https://lore.kernel.org/r/20231113212150.96410-1-dns@arista.com + +Link: https://lore.kernel.org/r/20231122042316.91208-2-dns@arista.com +Signed-off-by: Daniel Stodden +Signed-off-by: Bjorn Helgaas +Reviewed-by: Logan Gunthorpe +Reviewed-by: Dmitry Safonov +Signed-off-by: Sasha Levin +--- + drivers/pci/switch/switchtec.c | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c +index 5b921387eca6..1804794d0e68 100644 +--- a/drivers/pci/switch/switchtec.c ++++ b/drivers/pci/switch/switchtec.c +@@ -1308,13 +1308,6 @@ static void stdev_release(struct device *dev) + { + struct switchtec_dev *stdev = to_stdev(dev); + +- if (stdev->dma_mrpc) { +- iowrite32(0, &stdev->mmio_mrpc->dma_en); +- flush_wc_buf(stdev); +- writeq(0, &stdev->mmio_mrpc->dma_addr); +- dma_free_coherent(&stdev->pdev->dev, sizeof(*stdev->dma_mrpc), +- stdev->dma_mrpc, stdev->dma_mrpc_dma_addr); +- } + kfree(stdev); + } + +@@ -1358,7 +1351,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) + return ERR_PTR(-ENOMEM); + + stdev->alive = true; +- stdev->pdev = pdev; ++ stdev->pdev = pci_dev_get(pdev); + INIT_LIST_HEAD(&stdev->mrpc_queue); + mutex_init(&stdev->mrpc_mutex); + stdev->mrpc_busy = 0; +@@ -1391,6 +1384,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) + return stdev; + + err_put: ++ pci_dev_put(stdev->pdev); + put_device(&stdev->dev); + return ERR_PTR(rc); + } +@@ -1644,6 +1638,18 @@ static int switchtec_init_pci(struct switchtec_dev *stdev, + return 0; + } + ++static void switchtec_exit_pci(struct switchtec_dev *stdev) ++{ ++ if (stdev->dma_mrpc) { ++ iowrite32(0, &stdev->mmio_mrpc->dma_en); ++ flush_wc_buf(stdev); ++ writeq(0, &stdev->mmio_mrpc->dma_addr); ++ dma_free_coherent(&stdev->pdev->dev, sizeof(*stdev->dma_mrpc), ++ stdev->dma_mrpc, stdev->dma_mrpc_dma_addr); ++ stdev->dma_mrpc = NULL; ++ } ++} ++ + static int switchtec_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *id) + { +@@ -1703,6 +1709,9 @@ static void switchtec_pci_remove(struct pci_dev *pdev) + ida_free(&switchtec_minor_ida, MINOR(stdev->dev.devt)); + dev_info(&stdev->dev, "unregistered.\n"); + stdev_kill(stdev); ++ switchtec_exit_pci(stdev); ++ pci_dev_put(stdev->pdev); ++ stdev->pdev = NULL; + put_device(&stdev->dev); + } + +-- +2.43.0 + diff --git a/queue-6.6/perf-core-fix-narrow-startup-race-when-creating-the-.patch b/queue-6.6/perf-core-fix-narrow-startup-race-when-creating-the-.patch new file mode 100644 index 00000000000..386f43f4353 --- /dev/null +++ b/queue-6.6/perf-core-fix-narrow-startup-race-when-creating-the-.patch @@ -0,0 +1,82 @@ +From d46f73e3cc0d607d20422564f3a3f4a639310c08 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Jun 2023 15:09:09 +0200 +Subject: perf/core: Fix narrow startup race when creating the perf + nr_addr_filters sysfs file + +From: Greg KH + +[ Upstream commit 652ffc2104ec1f69dd4a46313888c33527145ccf ] + +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lkml.kernel.org/r/2023061204-decal-flyable-6090@gregkh +Signed-off-by: Sasha Levin +--- + kernel/events/core.c | 40 ++++++++++++++++++++++++++++------------ + 1 file changed, 28 insertions(+), 12 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 58ecb1c24387..f22c540350a1 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -11413,9 +11413,32 @@ static DEVICE_ATTR_RW(perf_event_mux_interval_ms); + static struct attribute *pmu_dev_attrs[] = { + &dev_attr_type.attr, + &dev_attr_perf_event_mux_interval_ms.attr, ++ &dev_attr_nr_addr_filters.attr, ++ NULL, ++}; ++ ++static umode_t pmu_dev_is_visible(struct kobject *kobj, struct attribute *a, int n) ++{ ++ struct device *dev = kobj_to_dev(kobj); ++ struct pmu *pmu = dev_get_drvdata(dev); ++ ++ if (!pmu->nr_addr_filters) ++ return 0; ++ ++ return a->mode; ++ ++ return 0; ++} ++ ++static struct attribute_group pmu_dev_attr_group = { ++ .is_visible = pmu_dev_is_visible, ++ .attrs = pmu_dev_attrs, ++}; ++ ++static const struct attribute_group *pmu_dev_groups[] = { ++ &pmu_dev_attr_group, + NULL, + }; +-ATTRIBUTE_GROUPS(pmu_dev); + + static int pmu_bus_running; + static struct bus_type pmu_bus = { +@@ -11452,18 +11475,11 @@ static int pmu_dev_alloc(struct pmu *pmu) + if (ret) + goto free_dev; + +- /* For PMUs with address filters, throw in an extra attribute: */ +- if (pmu->nr_addr_filters) +- ret = device_create_file(pmu->dev, &dev_attr_nr_addr_filters); +- +- if (ret) +- goto del_dev; +- +- if (pmu->attr_update) ++ if (pmu->attr_update) { + ret = sysfs_update_groups(&pmu->dev->kobj, pmu->attr_update); +- +- if (ret) +- goto del_dev; ++ if (ret) ++ goto del_dev; ++ } + + out: + return ret; +-- +2.43.0 + diff --git a/queue-6.6/perf-cs-etm-bump-minimum-opencsd-version-to-ensure-a.patch b/queue-6.6/perf-cs-etm-bump-minimum-opencsd-version-to-ensure-a.patch new file mode 100644 index 00000000000..1b10b0faeb3 --- /dev/null +++ b/queue-6.6/perf-cs-etm-bump-minimum-opencsd-version-to-ensure-a.patch @@ -0,0 +1,59 @@ +From 6155ea685663fe91b410b46e5399675c438c34c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Sep 2023 14:37:15 +0100 +Subject: perf cs-etm: Bump minimum OpenCSD version to ensure a bugfix is + present + +From: James Clark + +[ Upstream commit 2dbba30fd69b604802a9535b74bddb5bcca23793 ] + +Since commit d927ef5004ef ("perf cs-etm: Add exception level consistency +check"), the exception that was added to Perf will be triggered unless +the following bugfix from OpenCSD is present: + + - _Version 1.2.1_: + - __Bugfix__: + ETM4x / ETE - output of context elements to client can in some + circumstances be delayed until after subsequent atoms have been + processed leading to incorrect memory decode access via the client + callbacks. Fixed to flush context elements immediately they are + committed. + +Rather than remove the assert and silently fail, just increase the +minimum version requirement to avoid hard to debug issues and +regressions. + +Reviewed-by: Ian Rogers +Signed-off-by: James Clark +Tested-by: Leo Yan +Cc: John Garry +Cc: Mike Leach +Cc: Will Deacon +Cc: linux-arm-kernel@lists.infradead.org +Link: https://lore.kernel.org/r/20230901133716.677499-1-james.clark@arm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/build/feature/test-libopencsd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/build/feature/test-libopencsd.c b/tools/build/feature/test-libopencsd.c +index eb6303ff446e..4cfcef9da3e4 100644 +--- a/tools/build/feature/test-libopencsd.c ++++ b/tools/build/feature/test-libopencsd.c +@@ -4,9 +4,9 @@ + /* + * Check OpenCSD library version is sufficient to provide required features + */ +-#define OCSD_MIN_VER ((1 << 16) | (1 << 8) | (1)) ++#define OCSD_MIN_VER ((1 << 16) | (2 << 8) | (1)) + #if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER) +-#error "OpenCSD >= 1.1.1 is required" ++#error "OpenCSD >= 1.2.1 is required" + #endif + + int main(void) +-- +2.43.0 + diff --git a/queue-6.6/perf-fix-the-nr_addr_filters-fix.patch b/queue-6.6/perf-fix-the-nr_addr_filters-fix.patch new file mode 100644 index 00000000000..d459df13081 --- /dev/null +++ b/queue-6.6/perf-fix-the-nr_addr_filters-fix.patch @@ -0,0 +1,50 @@ +From ba00b36b75e73fb35b2311a7c85a0d67f6954b7c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 11:07:56 +0100 +Subject: perf: Fix the nr_addr_filters fix + +From: Peter Zijlstra + +[ Upstream commit 388a1fb7da6aaa1970c7e2a7d7fcd983a87a8484 ] + +Thomas reported that commit 652ffc2104ec ("perf/core: Fix narrow +startup race when creating the perf nr_addr_filters sysfs file") made +the entire attribute group vanish, instead of only the nr_addr_filters +attribute. + +Additionally a stray return. + +Insufficient coffee was involved with both writing and merging the +patch. + +Fixes: 652ffc2104ec ("perf/core: Fix narrow startup race when creating the perf nr_addr_filters sysfs file") +Reported-by: Thomas Richter +Signed-off-by: Peter Zijlstra (Intel) +Tested-by: Thomas Richter +Link: https://lkml.kernel.org/r/20231122100756.GP8262@noisy.programming.kicks-ass.net +Signed-off-by: Sasha Levin +--- + kernel/events/core.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index f22c540350a1..fe543e7898f5 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -11422,12 +11422,10 @@ static umode_t pmu_dev_is_visible(struct kobject *kobj, struct attribute *a, int + struct device *dev = kobj_to_dev(kobj); + struct pmu *pmu = dev_get_drvdata(dev); + +- if (!pmu->nr_addr_filters) ++ if (n == 2 && !pmu->nr_addr_filters) + return 0; + + return a->mode; +- +- return 0; + } + + static struct attribute_group pmu_dev_attr_group = { +-- +2.43.0 + diff --git a/queue-6.6/pinctrl-baytrail-fix-types-of-config-value-in-byt_pi.patch b/queue-6.6/pinctrl-baytrail-fix-types-of-config-value-in-byt_pi.patch new file mode 100644 index 00000000000..afa8bc2c8f1 --- /dev/null +++ b/queue-6.6/pinctrl-baytrail-fix-types-of-config-value-in-byt_pi.patch @@ -0,0 +1,42 @@ +From 9e217fd1fa2824da07f69c60ce122329309bfab4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 19:50:36 +0200 +Subject: pinctrl: baytrail: Fix types of config value in byt_pin_config_set() + +From: Andy Shevchenko + +[ Upstream commit 1a856a22e6036c5f0d6da7568b4550270f989038 ] + +When unpacked, the config value is split to two of different types. +Fix the types accordingly. + +Acked-by: Mika Westerberg +Signed-off-by: Andy Shevchenko +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/intel/pinctrl-baytrail.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c +index ec76e43527c5..95a8a3a22b2b 100644 +--- a/drivers/pinctrl/intel/pinctrl-baytrail.c ++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c +@@ -921,13 +921,14 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, + unsigned int num_configs) + { + struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctl_dev); +- unsigned int param, arg; + void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); + void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); + void __iomem *db_reg = byt_gpio_reg(vg, offset, BYT_DEBOUNCE_REG); + u32 conf, val, db_pulse, debounce; ++ enum pin_config_param param; + unsigned long flags; + int i, ret = 0; ++ u32 arg; + + raw_spin_lock_irqsave(&byt_lock, flags); + +-- +2.43.0 + diff --git a/queue-6.6/pm-devfreq-synchronize-devfreq_monitor_-start-stop.patch b/queue-6.6/pm-devfreq-synchronize-devfreq_monitor_-start-stop.patch new file mode 100644 index 00000000000..f4ee5bc36cc --- /dev/null +++ b/queue-6.6/pm-devfreq-synchronize-devfreq_monitor_-start-stop.patch @@ -0,0 +1,167 @@ +From c19cf0f864f3a41486a7c790fbd0adb5cd45df87 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 02:41:58 +0530 +Subject: PM / devfreq: Synchronize devfreq_monitor_[start/stop] + +From: Mukesh Ojha + +[ Upstream commit aed5ed595960c6d301dcd4ed31aeaa7a8054c0c6 ] + +There is a chance if a frequent switch of the governor +done in a loop result in timer list corruption where +timer cancel being done from two place one from +cancel_delayed_work_sync() and followed by expire_timers() +can be seen from the traces[1]. + +while true +do + echo "simple_ondemand" > /sys/class/devfreq/1d84000.ufshc/governor + echo "performance" > /sys/class/devfreq/1d84000.ufshc/governor +done + +It looks to be issue with devfreq driver where +device_monitor_[start/stop] need to synchronized so that +delayed work should get corrupted while it is either +being queued or running or being cancelled. + +Let's use polling flag and devfreq lock to synchronize the +queueing the timer instance twice and work data being +corrupted. + +[1] +... +.. +-0 [003] 9436.209662: timer_cancel timer=0xffffff80444f0428 +-0 [003] 9436.209664: timer_expire_entry timer=0xffffff80444f0428 now=0x10022da1c function=__typeid__ZTSFvP10timer_listE_global_addr baseclk=0x10022da1c +-0 [003] 9436.209718: timer_expire_exit timer=0xffffff80444f0428 +kworker/u16:6-14217 [003] 9436.209863: timer_start timer=0xffffff80444f0428 function=__typeid__ZTSFvP10timer_listE_global_addr expires=0x10022da2b now=0x10022da1c flags=182452227 +vendor.xxxyyy.ha-1593 [004] 9436.209888: timer_cancel timer=0xffffff80444f0428 +vendor.xxxyyy.ha-1593 [004] 9436.216390: timer_init timer=0xffffff80444f0428 +vendor.xxxyyy.ha-1593 [004] 9436.216392: timer_start timer=0xffffff80444f0428 function=__typeid__ZTSFvP10timer_listE_global_addr expires=0x10022da2c now=0x10022da1d flags=186646532 +vendor.xxxyyy.ha-1593 [005] 9436.220992: timer_cancel timer=0xffffff80444f0428 +xxxyyyTraceManag-7795 [004] 9436.261641: timer_cancel timer=0xffffff80444f0428 + +[2] + + 9436.261653][ C4] Unable to handle kernel paging request at virtual address dead00000000012a +[ 9436.261664][ C4] Mem abort info: +[ 9436.261666][ C4] ESR = 0x96000044 +[ 9436.261669][ C4] EC = 0x25: DABT (current EL), IL = 32 bits +[ 9436.261671][ C4] SET = 0, FnV = 0 +[ 9436.261673][ C4] EA = 0, S1PTW = 0 +[ 9436.261675][ C4] Data abort info: +[ 9436.261677][ C4] ISV = 0, ISS = 0x00000044 +[ 9436.261680][ C4] CM = 0, WnR = 1 +[ 9436.261682][ C4] [dead00000000012a] address between user and kernel address ranges +[ 9436.261685][ C4] Internal error: Oops: 96000044 [#1] PREEMPT SMP +[ 9436.261701][ C4] Skip md ftrace buffer dump for: 0x3a982d0 +... + +[ 9436.262138][ C4] CPU: 4 PID: 7795 Comm: TraceManag Tainted: G S W O 5.10.149-android12-9-o-g17f915d29d0c #1 +[ 9436.262141][ C4] Hardware name: Qualcomm Technologies, Inc. (DT) +[ 9436.262144][ C4] pstate: 22400085 (nzCv daIf +PAN -UAO +TCO BTYPE=--) +[ 9436.262161][ C4] pc : expire_timers+0x9c/0x438 +[ 9436.262164][ C4] lr : expire_timers+0x2a4/0x438 +[ 9436.262168][ C4] sp : ffffffc010023dd0 +[ 9436.262171][ C4] x29: ffffffc010023df0 x28: ffffffd0636fdc18 +[ 9436.262178][ C4] x27: ffffffd063569dd0 x26: ffffffd063536008 +[ 9436.262182][ C4] x25: 0000000000000001 x24: ffffff88f7c69280 +[ 9436.262185][ C4] x23: 00000000000000e0 x22: dead000000000122 +[ 9436.262188][ C4] x21: 000000010022da29 x20: ffffff8af72b4e80 +[ 9436.262191][ C4] x19: ffffffc010023e50 x18: ffffffc010025038 +[ 9436.262195][ C4] x17: 0000000000000240 x16: 0000000000000201 +[ 9436.262199][ C4] x15: ffffffffffffffff x14: ffffff889f3c3100 +[ 9436.262203][ C4] x13: ffffff889f3c3100 x12: 00000000049f56b8 +[ 9436.262207][ C4] x11: 00000000049f56b8 x10: 00000000ffffffff +[ 9436.262212][ C4] x9 : ffffffc010023e50 x8 : dead000000000122 +[ 9436.262216][ C4] x7 : ffffffffffffffff x6 : ffffffc0100239d8 +[ 9436.262220][ C4] x5 : 0000000000000000 x4 : 0000000000000101 +[ 9436.262223][ C4] x3 : 0000000000000080 x2 : ffffff889edc155c +[ 9436.262227][ C4] x1 : ffffff8001005200 x0 : ffffff80444f0428 +[ 9436.262232][ C4] Call trace: +[ 9436.262236][ C4] expire_timers+0x9c/0x438 +[ 9436.262240][ C4] __run_timers+0x1f0/0x330 +[ 9436.262245][ C4] run_timer_softirq+0x28/0x58 +[ 9436.262255][ C4] efi_header_end+0x168/0x5ec +[ 9436.262265][ C4] __irq_exit_rcu+0x108/0x124 +[ 9436.262274][ C4] __handle_domain_irq+0x118/0x1e4 +[ 9436.262282][ C4] gic_handle_irq.30369+0x6c/0x2bc +[ 9436.262286][ C4] el0_irq_naked+0x60/0x6c + +Link: https://lore.kernel.org/all/1700860318-4025-1-git-send-email-quic_mojha@quicinc.com/ +Reported-by: Joyyoung Huang +Acked-by: MyungJoo Ham +Signed-off-by: Mukesh Ojha +Signed-off-by: Chanwoo Choi +Signed-off-by: Sasha Levin +--- + drivers/devfreq/devfreq.c | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c +index 81d9df89dde6..49c542ecccde 100644 +--- a/drivers/devfreq/devfreq.c ++++ b/drivers/devfreq/devfreq.c +@@ -461,10 +461,14 @@ static void devfreq_monitor(struct work_struct *work) + if (err) + dev_err(&devfreq->dev, "dvfs failed with (%d) error\n", err); + ++ if (devfreq->stop_polling) ++ goto out; ++ + queue_delayed_work(devfreq_wq, &devfreq->work, + msecs_to_jiffies(devfreq->profile->polling_ms)); +- mutex_unlock(&devfreq->lock); + ++out: ++ mutex_unlock(&devfreq->lock); + trace_devfreq_monitor(devfreq); + } + +@@ -483,6 +487,10 @@ void devfreq_monitor_start(struct devfreq *devfreq) + if (IS_SUPPORTED_FLAG(devfreq->governor->flags, IRQ_DRIVEN)) + return; + ++ mutex_lock(&devfreq->lock); ++ if (delayed_work_pending(&devfreq->work)) ++ goto out; ++ + switch (devfreq->profile->timer) { + case DEVFREQ_TIMER_DEFERRABLE: + INIT_DEFERRABLE_WORK(&devfreq->work, devfreq_monitor); +@@ -491,12 +499,16 @@ void devfreq_monitor_start(struct devfreq *devfreq) + INIT_DELAYED_WORK(&devfreq->work, devfreq_monitor); + break; + default: +- return; ++ goto out; + } + + if (devfreq->profile->polling_ms) + queue_delayed_work(devfreq_wq, &devfreq->work, + msecs_to_jiffies(devfreq->profile->polling_ms)); ++ ++out: ++ devfreq->stop_polling = false; ++ mutex_unlock(&devfreq->lock); + } + EXPORT_SYMBOL(devfreq_monitor_start); + +@@ -513,6 +525,14 @@ void devfreq_monitor_stop(struct devfreq *devfreq) + if (IS_SUPPORTED_FLAG(devfreq->governor->flags, IRQ_DRIVEN)) + return; + ++ mutex_lock(&devfreq->lock); ++ if (devfreq->stop_polling) { ++ mutex_unlock(&devfreq->lock); ++ return; ++ } ++ ++ devfreq->stop_polling = true; ++ mutex_unlock(&devfreq->lock); + cancel_delayed_work_sync(&devfreq->work); + } + EXPORT_SYMBOL(devfreq_monitor_stop); +-- +2.43.0 + diff --git a/queue-6.6/pnp-acpi-fix-fortify-warning.patch b/queue-6.6/pnp-acpi-fix-fortify-warning.patch new file mode 100644 index 00000000000..022dcf53b70 --- /dev/null +++ b/queue-6.6/pnp-acpi-fix-fortify-warning.patch @@ -0,0 +1,83 @@ +From 28d5d9ead43f2b8560a8282ff407a9568b012193 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 05:52:10 +0300 +Subject: PNP: ACPI: fix fortify warning + +From: Dmitry Antipov + +[ Upstream commit ba3f5058db437d919f8468db50483dd9028ff688 ] + +When compiling with gcc version 14.0.0 20231126 (experimental) +and CONFIG_FORTIFY_SOURCE=y, I've noticed the following: + +In file included from ./include/linux/string.h:295, + from ./include/linux/bitmap.h:12, + from ./include/linux/cpumask.h:12, + from ./arch/x86/include/asm/paravirt.h:17, + from ./arch/x86/include/asm/cpuid.h:62, + from ./arch/x86/include/asm/processor.h:19, + from ./arch/x86/include/asm/cpufeature.h:5, + from ./arch/x86/include/asm/thread_info.h:53, + from ./include/linux/thread_info.h:60, + from ./arch/x86/include/asm/preempt.h:9, + from ./include/linux/preempt.h:79, + from ./include/linux/spinlock.h:56, + from ./include/linux/mmzone.h:8, + from ./include/linux/gfp.h:7, + from ./include/linux/slab.h:16, + from ./include/linux/resource_ext.h:11, + from ./include/linux/acpi.h:13, + from drivers/pnp/pnpacpi/rsparser.c:11: +In function 'fortify_memcpy_chk', + inlined from 'pnpacpi_parse_allocated_vendor' at drivers/pnp/pnpacpi/rsparser.c:158:3, + inlined from 'pnpacpi_allocated_resource' at drivers/pnp/pnpacpi/rsparser.c:249:3: +./include/linux/fortify-string.h:588:25: warning: call to '__read_overflow2_field' +declared with attribute warning: detected read beyond size of field (2nd parameter); +maybe use struct_group()? [-Wattribute-warning] + 588 | __read_overflow2_field(q_size_field, size); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +According to the comments in include/linux/fortify-string.h, 'memcpy()', +'memmove()' and 'memset()' must not be used beyond individual struct +members to ensure that the compiler can enforce protection against +buffer overflows, and, IIUC, this also applies to partial copies from +the particular member ('vendor->byte_data' in this case). So it should +be better (and safer) to do both copies at once (and 'byte_data' of +'struct acpi_resource_vendor_typed' seems to be a good candidate for +'__counted_by(byte_length)' as well). + +Signed-off-by: Dmitry Antipov +Reviewed-by: Kees Cook +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/pnp/pnpacpi/rsparser.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c +index 4f05f610391b..c02ce0834c2c 100644 +--- a/drivers/pnp/pnpacpi/rsparser.c ++++ b/drivers/pnp/pnpacpi/rsparser.c +@@ -151,13 +151,13 @@ static int vendor_resource_matches(struct pnp_dev *dev, + static void pnpacpi_parse_allocated_vendor(struct pnp_dev *dev, + struct acpi_resource_vendor_typed *vendor) + { +- if (vendor_resource_matches(dev, vendor, &hp_ccsr_uuid, 16)) { +- u64 start, length; ++ struct { u64 start, length; } range; + +- memcpy(&start, vendor->byte_data, sizeof(start)); +- memcpy(&length, vendor->byte_data + 8, sizeof(length)); +- +- pnp_add_mem_resource(dev, start, start + length - 1, 0); ++ if (vendor_resource_matches(dev, vendor, &hp_ccsr_uuid, ++ sizeof(range))) { ++ memcpy(&range, vendor->byte_data, sizeof(range)); ++ pnp_add_mem_resource(dev, range.start, range.start + ++ range.length - 1, 0); + } + } + +-- +2.43.0 + diff --git a/queue-6.6/powerpc-64s-fix-config_numa-n-build-due-to-create_se.patch b/queue-6.6/powerpc-64s-fix-config_numa-n-build-due-to-create_se.patch new file mode 100644 index 00000000000..2a35d2a9344 --- /dev/null +++ b/queue-6.6/powerpc-64s-fix-config_numa-n-build-due-to-create_se.patch @@ -0,0 +1,65 @@ +From 51b65dd372e601cfd3f3b436ed6d71dae51eb576 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 00:19:19 +1100 +Subject: powerpc/64s: Fix CONFIG_NUMA=n build due to create_section_mapping() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michael Ellerman + +[ Upstream commit ede66cd22441820cbd399936bf84fdc4294bc7fa ] + +With CONFIG_NUMA=n the build fails with: + + arch/powerpc/mm/book3s64/pgtable.c:275:15: error: no previous prototype for ‘create_section_mapping’ [-Werror=missing-prototypes] + 275 | int __meminit create_section_mapping(unsigned long start, unsigned long end, + | ^~~~~~~~~~~~~~~~~~~~~~ + +That happens because the prototype for create_section_mapping() is in +asm/mmzone.h, but asm/mmzone.h is only included by linux/mmzone.h +when CONFIG_NUMA=y. + +In fact the prototype is only needed by arch/powerpc/mm code, so move +the prototype into arch/powerpc/mm/mmu_decl.h, which also fixes the +build error. + +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231129131919.2528517-5-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/mmzone.h | 5 ----- + arch/powerpc/mm/mmu_decl.h | 5 +++++ + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h +index 3764d3585d30..da827d2d0866 100644 +--- a/arch/powerpc/include/asm/mmzone.h ++++ b/arch/powerpc/include/asm/mmzone.h +@@ -43,10 +43,5 @@ u64 memory_hotplug_max(void); + #define memory_hotplug_max() memblock_end_of_DRAM() + #endif /* CONFIG_NUMA */ + +-#ifdef CONFIG_MEMORY_HOTPLUG +-extern int create_section_mapping(unsigned long start, unsigned long end, +- int nid, pgprot_t prot); +-#endif +- + #endif /* __KERNEL__ */ + #endif /* _ASM_MMZONE_H_ */ +diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h +index 7f9ff0640124..72341b9fb552 100644 +--- a/arch/powerpc/mm/mmu_decl.h ++++ b/arch/powerpc/mm/mmu_decl.h +@@ -181,3 +181,8 @@ static inline bool debug_pagealloc_enabled_or_kfence(void) + { + return IS_ENABLED(CONFIG_KFENCE) || debug_pagealloc_enabled(); + } ++ ++#ifdef CONFIG_MEMORY_HOTPLUG ++int create_section_mapping(unsigned long start, unsigned long end, ++ int nid, pgprot_t prot); ++#endif +-- +2.43.0 + diff --git a/queue-6.6/powerpc-fix-build-error-due-to-is_valid_bugaddr.patch b/queue-6.6/powerpc-fix-build-error-due-to-is_valid_bugaddr.patch new file mode 100644 index 00000000000..1147d2179fb --- /dev/null +++ b/queue-6.6/powerpc-fix-build-error-due-to-is_valid_bugaddr.patch @@ -0,0 +1,48 @@ +From df719840d84f5d605a3756566f3c9aab7e4536b9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 22:44:33 +1100 +Subject: powerpc: Fix build error due to is_valid_bugaddr() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michael Ellerman + +[ Upstream commit f8d3555355653848082c351fa90775214fb8a4fa ] + +With CONFIG_GENERIC_BUG=n the build fails with: + + arch/powerpc/kernel/traps.c:1442:5: error: no previous prototype for ‘is_valid_bugaddr’ [-Werror=missing-prototypes] + 1442 | int is_valid_bugaddr(unsigned long addr) + | ^~~~~~~~~~~~~~~~ + +The prototype is only defined, and the function is only needed, when +CONFIG_GENERIC_BUG=y, so move the implementation under that. + +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231130114433.3053544-2-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/traps.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c +index fe3f720c9cd6..2de7f6dcd32b 100644 +--- a/arch/powerpc/kernel/traps.c ++++ b/arch/powerpc/kernel/traps.c +@@ -1439,10 +1439,12 @@ static int emulate_instruction(struct pt_regs *regs) + return -EINVAL; + } + ++#ifdef CONFIG_GENERIC_BUG + int is_valid_bugaddr(unsigned long addr) + { + return is_kernel_addr(addr); + } ++#endif + + #ifdef CONFIG_MATH_EMULATION + static int emulate_math(struct pt_regs *regs) +-- +2.43.0 + diff --git a/queue-6.6/powerpc-lib-validate-size-for-vector-operations.patch b/queue-6.6/powerpc-lib-validate-size-for-vector-operations.patch new file mode 100644 index 00000000000..8ac9f78bc12 --- /dev/null +++ b/queue-6.6/powerpc-lib-validate-size-for-vector-operations.patch @@ -0,0 +1,71 @@ +From d564e5860899fb8b463928556acfc0225021b80d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 12:47:05 +0530 +Subject: powerpc/lib: Validate size for vector operations + +From: Naveen N Rao + +[ Upstream commit 8f9abaa6d7de0a70fc68acaedce290c1f96e2e59 ] + +Some of the fp/vmx code in sstep.c assume a certain maximum size for the +instructions being emulated. The size of those operations however is +determined separately in analyse_instr(). + +Add a check to validate the assumption on the maximum size of the +operations, so as to prevent any unintended kernel stack corruption. + +Signed-off-by: Naveen N Rao +Reviewed-by: Gustavo A. R. Silva +Build-tested-by: Gustavo A. R. Silva +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231123071705.397625-1-naveen@kernel.org +Signed-off-by: Sasha Levin +--- + arch/powerpc/lib/sstep.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c +index a4ab8625061a..6af97dc0f6d5 100644 +--- a/arch/powerpc/lib/sstep.c ++++ b/arch/powerpc/lib/sstep.c +@@ -586,6 +586,8 @@ static int do_fp_load(struct instruction_op *op, unsigned long ea, + } u; + + nb = GETSIZE(op->type); ++ if (nb > sizeof(u)) ++ return -EINVAL; + if (!address_ok(regs, ea, nb)) + return -EFAULT; + rn = op->reg; +@@ -636,6 +638,8 @@ static int do_fp_store(struct instruction_op *op, unsigned long ea, + } u; + + nb = GETSIZE(op->type); ++ if (nb > sizeof(u)) ++ return -EINVAL; + if (!address_ok(regs, ea, nb)) + return -EFAULT; + rn = op->reg; +@@ -680,6 +684,9 @@ static nokprobe_inline int do_vec_load(int rn, unsigned long ea, + u8 b[sizeof(__vector128)]; + } u = {}; + ++ if (size > sizeof(u)) ++ return -EINVAL; ++ + if (!address_ok(regs, ea & ~0xfUL, 16)) + return -EFAULT; + /* align to multiple of size */ +@@ -707,6 +714,9 @@ static nokprobe_inline int do_vec_store(int rn, unsigned long ea, + u8 b[sizeof(__vector128)]; + } u; + ++ if (size > sizeof(u)) ++ return -EINVAL; ++ + if (!address_ok(regs, ea & ~0xfUL, 16)) + return -EFAULT; + /* align to multiple of size */ +-- +2.43.0 + diff --git a/queue-6.6/powerpc-mm-fix-build-failures-due-to-arch_reserved_k.patch b/queue-6.6/powerpc-mm-fix-build-failures-due-to-arch_reserved_k.patch new file mode 100644 index 00000000000..380bc5a2f96 --- /dev/null +++ b/queue-6.6/powerpc-mm-fix-build-failures-due-to-arch_reserved_k.patch @@ -0,0 +1,68 @@ +From a49f42b12424398b3744e7eb93c15fa34eb02673 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 22:44:32 +1100 +Subject: powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michael Ellerman + +[ Upstream commit d8c3f243d4db24675b653f0568bb65dae34e6455 ] + +With NUMA=n and FA_DUMP=y or PRESERVE_FA_DUMP=y the build fails with: + + arch/powerpc/kernel/fadump.c:1739:22: error: no previous prototype for ‘arch_reserved_kernel_pages’ [-Werror=missing-prototypes] + 1739 | unsigned long __init arch_reserved_kernel_pages(void) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + +The prototype for arch_reserved_kernel_pages() is in include/linux/mm.h, +but it's guarded by __HAVE_ARCH_RESERVED_KERNEL_PAGES. The powerpc +headers define __HAVE_ARCH_RESERVED_KERNEL_PAGES in asm/mmzone.h, which +is not included into the generic headers when NUMA=n. + +Move the definition of __HAVE_ARCH_RESERVED_KERNEL_PAGES into asm/mmu.h +which is included regardless of NUMA=n. + +Additionally the ifdef around __HAVE_ARCH_RESERVED_KERNEL_PAGES needs to +also check for CONFIG_PRESERVE_FA_DUMP. + +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231130114433.3053544-1-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/mmu.h | 4 ++++ + arch/powerpc/include/asm/mmzone.h | 3 --- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h +index 52cc25864a1b..d8b7e246a32f 100644 +--- a/arch/powerpc/include/asm/mmu.h ++++ b/arch/powerpc/include/asm/mmu.h +@@ -412,5 +412,9 @@ extern void *abatron_pteptrs[2]; + #include + #endif + ++#if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP) ++#define __HAVE_ARCH_RESERVED_KERNEL_PAGES ++#endif ++ + #endif /* __KERNEL__ */ + #endif /* _ASM_POWERPC_MMU_H_ */ +diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h +index 4c6c6dbd182f..3764d3585d30 100644 +--- a/arch/powerpc/include/asm/mmzone.h ++++ b/arch/powerpc/include/asm/mmzone.h +@@ -42,9 +42,6 @@ u64 memory_hotplug_max(void); + #else + #define memory_hotplug_max() memblock_end_of_DRAM() + #endif /* CONFIG_NUMA */ +-#ifdef CONFIG_FA_DUMP +-#define __HAVE_ARCH_RESERVED_KERNEL_PAGES +-#endif + + #ifdef CONFIG_MEMORY_HOTPLUG + extern int create_section_mapping(unsigned long start, unsigned long end, +-- +2.43.0 + diff --git a/queue-6.6/powerpc-mm-fix-null-pointer-dereference-in-pgtable_c.patch b/queue-6.6/powerpc-mm-fix-null-pointer-dereference-in-pgtable_c.patch new file mode 100644 index 00000000000..03f99eb8750 --- /dev/null +++ b/queue-6.6/powerpc-mm-fix-null-pointer-dereference-in-pgtable_c.patch @@ -0,0 +1,49 @@ +From 0d33bb1cd2559047d3b281d902b79dfa074413aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 10:32:23 +0800 +Subject: powerpc/mm: Fix null-pointer dereference in pgtable_cache_add + +From: Kunwu Chan + +[ Upstream commit f46c8a75263f97bda13c739ba1c90aced0d3b071 ] + +kasprintf() returns a pointer to dynamically allocated memory +which can be NULL upon failure. Ensure the allocation was successful +by checking the pointer validity. + +Suggested-by: Christophe Leroy +Suggested-by: Michael Ellerman +Signed-off-by: Kunwu Chan +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231204023223.2447523-1-chentao@kylinos.cn +Signed-off-by: Sasha Levin +--- + arch/powerpc/mm/init-common.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c +index 119ef491f797..d3a7726ecf51 100644 +--- a/arch/powerpc/mm/init-common.c ++++ b/arch/powerpc/mm/init-common.c +@@ -126,7 +126,7 @@ void pgtable_cache_add(unsigned int shift) + * as to leave enough 0 bits in the address to contain it. */ + unsigned long minalign = max(MAX_PGTABLE_INDEX_SIZE + 1, + HUGEPD_SHIFT_MASK + 1); +- struct kmem_cache *new; ++ struct kmem_cache *new = NULL; + + /* It would be nice if this was a BUILD_BUG_ON(), but at the + * moment, gcc doesn't seem to recognize is_power_of_2 as a +@@ -139,7 +139,8 @@ void pgtable_cache_add(unsigned int shift) + + align = max_t(unsigned long, align, minalign); + name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); +- new = kmem_cache_create(name, table_size, align, 0, ctor(shift)); ++ if (name) ++ new = kmem_cache_create(name, table_size, align, 0, ctor(shift)); + if (!new) + panic("Could not allocate pgtable cache for order %d", shift); + +-- +2.43.0 + diff --git a/queue-6.6/powerpc-pmd_move_must_withdraw-is-only-needed-for-co.patch b/queue-6.6/powerpc-pmd_move_must_withdraw-is-only-needed-for-co.patch new file mode 100644 index 00000000000..dc234f21dc5 --- /dev/null +++ b/queue-6.6/powerpc-pmd_move_must_withdraw-is-only-needed-for-co.patch @@ -0,0 +1,56 @@ +From 7e436c5045472077dd1df8fe8d3de1464f4caf71 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 13:28:09 +1100 +Subject: powerpc: pmd_move_must_withdraw() is only needed for + CONFIG_TRANSPARENT_HUGEPAGE + +From: Stephen Rothwell + +[ Upstream commit 0d555b57ee660d8a871781c0eebf006e855e918d ] + +The linux-next build of powerpc64 allnoconfig fails with: + + arch/powerpc/mm/book3s64/pgtable.c:557:5: error: no previous prototype for 'pmd_move_must_withdraw' + 557 | int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, + | ^~~~~~~~~~~~~~~~~~~~~~ + +Caused by commit: + + c6345dfa6e3e ("Makefile.extrawarn: turn on missing-prototypes globally") + +Fix it by moving the function definition under +CONFIG_TRANSPARENT_HUGEPAGE like the prototype. The function is only +called when CONFIG_TRANSPARENT_HUGEPAGE=y. + +Signed-off-by: Stephen Rothwell +[mpe: Flesh out change log from linux-next patch] +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231127132809.45c2b398@canb.auug.org.au +Signed-off-by: Sasha Levin +--- + arch/powerpc/mm/book3s64/pgtable.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c +index 8f8a62d3ff4d..926bec775f41 100644 +--- a/arch/powerpc/mm/book3s64/pgtable.c ++++ b/arch/powerpc/mm/book3s64/pgtable.c +@@ -542,6 +542,7 @@ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, + set_pte_at(vma->vm_mm, addr, ptep, pte); + } + ++#ifdef CONFIG_TRANSPARENT_HUGEPAGE + /* + * For hash translation mode, we use the deposited table to store hash slot + * information and they are stored at PTRS_PER_PMD offset from related pmd +@@ -563,6 +564,7 @@ int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, + + return true; + } ++#endif + + /* + * Does the CPU support tlbie? +-- +2.43.0 + diff --git a/queue-6.6/pstore-ram-fix-crash-when-setting-number-of-cpus-to-.patch b/queue-6.6/pstore-ram-fix-crash-when-setting-number-of-cpus-to-.patch new file mode 100644 index 00000000000..b561c0bd194 --- /dev/null +++ b/queue-6.6/pstore-ram-fix-crash-when-setting-number-of-cpus-to-.patch @@ -0,0 +1,47 @@ +From 18141b9fb6bc9584de50aab4796605769670007e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Feb 2023 10:36:32 +0800 +Subject: pstore/ram: Fix crash when setting number of cpus to an odd number + +From: Weichen Chen + +[ Upstream commit d49270a04623ce3c0afddbf3e984cb245aa48e9c ] + +When the number of cpu cores is adjusted to 7 or other odd numbers, +the zone size will become an odd number. +The address of the zone will become: + addr of zone0 = BASE + addr of zone1 = BASE + zone_size + addr of zone2 = BASE + zone_size*2 + ... +The address of zone1/3/5/7 will be mapped to non-alignment va. +Eventually crashes will occur when accessing these va. + +So, use ALIGN_DOWN() to make sure the zone size is even +to avoid this bug. + +Signed-off-by: Weichen Chen +Reviewed-by: Matthias Brugger +Tested-by: "Guilherme G. Piccoli" +Link: https://lore.kernel.org/r/20230224023632.6840-1-weichen.chen@mediatek.com +Signed-off-by: Kees Cook +Signed-off-by: Sasha Levin +--- + fs/pstore/ram.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c +index d36702c7ab3c..88b34fdbf759 100644 +--- a/fs/pstore/ram.c ++++ b/fs/pstore/ram.c +@@ -529,6 +529,7 @@ static int ramoops_init_przs(const char *name, + } + + zone_sz = mem_sz / *cnt; ++ zone_sz = ALIGN_DOWN(zone_sz, 2); + if (!zone_sz) { + dev_err(dev, "%s zone size == 0\n", name); + goto fail; +-- +2.43.0 + diff --git a/queue-6.6/rdma-ipoib-fix-error-code-return-in-ipoib_mcast_join.patch b/queue-6.6/rdma-ipoib-fix-error-code-return-in-ipoib_mcast_join.patch new file mode 100644 index 00000000000..948ffae13bd --- /dev/null +++ b/queue-6.6/rdma-ipoib-fix-error-code-return-in-ipoib_mcast_join.patch @@ -0,0 +1,34 @@ +From 4089f559fe138662f2842ea03d50d7aa0f46eb21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 14:03:15 +0100 +Subject: RDMA/IPoIB: Fix error code return in ipoib_mcast_join + +From: Jack Wang + +[ Upstream commit 753fff78f430704548f45eda52d6d55371a52c0f ] + +Return the error code in case of ib_sa_join_multicast fail. + +Signed-off-by: Jack Wang +Link: https://lore.kernel.org/r/20231121130316.126364-2-jinpu.wang@ionos.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +index 5b3154503bf4..9e6967a40042 100644 +--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +@@ -546,6 +546,7 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) + spin_unlock_irq(&priv->lock); + complete(&mcast->done); + spin_lock_irq(&priv->lock); ++ return ret; + } + return 0; + } +-- +2.43.0 + diff --git a/queue-6.6/re-revert-drm-amd-display-enable-replay-for-static-s.patch b/queue-6.6/re-revert-drm-amd-display-enable-replay-for-static-s.patch new file mode 100644 index 00000000000..9dce2cdb58b --- /dev/null +++ b/queue-6.6/re-revert-drm-amd-display-enable-replay-for-static-s.patch @@ -0,0 +1,141 @@ +From ed15fb29d08b8e47f5bb955578bb6f0be1e5de3b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 13:47:54 -0400 +Subject: Re-revert "drm/amd/display: Enable Replay for static screen use + cases" + +From: Ivan Lipski + +[ Upstream commit d6398866a6b47e92319ef6efdb0126a4fbb7796a ] + +This reverts commit 44e60b14d5a72f91fd0bdeae8da59ae37a3ca8e5. + +Since, it causes a regression in which eDP displays with PSR support, +but no Replay support (Sink support <= 0x03), fail to enable PSR and +consequently all IGT amd_psr tests fail. So, revert this until a more +suitable fix can be found. + +This got brought back accidently with the backmerge. + +Acked-by: Leo Li +Signed-off-by: Ivan Lipski +Signed-off-by: Hamza Mahfooz +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 22 ------------------- + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +------- + drivers/gpu/drm/amd/include/amd_shared.h | 2 -- + 3 files changed, 1 insertion(+), 32 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 861b5e45e2a7..fabbfea33b0c 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -65,7 +65,6 @@ + #include "amdgpu_dm_debugfs.h" + #endif + #include "amdgpu_dm_psr.h" +-#include "amdgpu_dm_replay.h" + + #include "ivsrcid/ivsrcid_vislands30.h" + +@@ -4338,7 +4337,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) + enum dc_connection_type new_connection_type = dc_connection_none; + const struct dc_plane_cap *plane; + bool psr_feature_enabled = false; +- bool replay_feature_enabled = false; + int max_overlay = dm->dc->caps.max_slave_planes; + + dm->display_indexes_num = dm->dc->caps.max_streams; +@@ -4448,20 +4446,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) + } + } + +- if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) { +- switch (adev->ip_versions[DCE_HWIP][0]) { +- case IP_VERSION(3, 1, 4): +- case IP_VERSION(3, 1, 5): +- case IP_VERSION(3, 1, 6): +- case IP_VERSION(3, 2, 0): +- case IP_VERSION(3, 2, 1): +- replay_feature_enabled = true; +- break; +- default: +- replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK; +- break; +- } +- } + /* loops over all connectors on the board */ + for (i = 0; i < link_cnt; i++) { + struct dc_link *link = NULL; +@@ -4510,12 +4494,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) + amdgpu_dm_update_connector_after_detect(aconnector); + setup_backlight_device(dm, aconnector); + +- /* +- * Disable psr if replay can be enabled +- */ +- if (replay_feature_enabled && amdgpu_dm_setup_replay(link, aconnector)) +- psr_feature_enabled = false; +- + if (psr_feature_enabled) + amdgpu_dm_set_psr_caps(link); + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +index 97b7a0b8a1c2..30d4c6fd95f5 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +@@ -29,7 +29,6 @@ + #include "dc.h" + #include "amdgpu.h" + #include "amdgpu_dm_psr.h" +-#include "amdgpu_dm_replay.h" + #include "amdgpu_dm_crtc.h" + #include "amdgpu_dm_plane.h" + #include "amdgpu_dm_trace.h" +@@ -124,12 +123,7 @@ static void vblank_control_worker(struct work_struct *work) + * fill_dc_dirty_rects(). + */ + if (vblank_work->stream && vblank_work->stream->link) { +- /* +- * Prioritize replay, instead of psr +- */ +- if (vblank_work->stream->link->replay_settings.replay_feature_enabled) +- amdgpu_dm_replay_enable(vblank_work->stream, false); +- else if (vblank_work->enable) { ++ if (vblank_work->enable) { + if (vblank_work->stream->link->psr_settings.psr_version < DC_PSR_VERSION_SU_1 && + vblank_work->stream->link->psr_settings.psr_allow_active) + amdgpu_dm_psr_disable(vblank_work->stream); +@@ -138,7 +132,6 @@ static void vblank_control_worker(struct work_struct *work) + #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY + !amdgpu_dm_crc_window_is_activated(&vblank_work->acrtc->base) && + #endif +- vblank_work->stream->link->panel_config.psr.disallow_replay && + vblank_work->acrtc->dm_irq_params.allow_psr_entry) { + amdgpu_dm_psr_enable(vblank_work->stream); + } +diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h +index 67d7b7ee8a2a..abe829bbd54a 100644 +--- a/drivers/gpu/drm/amd/include/amd_shared.h ++++ b/drivers/gpu/drm/amd/include/amd_shared.h +@@ -240,7 +240,6 @@ enum DC_FEATURE_MASK { + DC_DISABLE_LTTPR_DP2_0 = (1 << 6), //0x40, disabled by default + DC_PSR_ALLOW_SMU_OPT = (1 << 7), //0x80, disabled by default + DC_PSR_ALLOW_MULTI_DISP_OPT = (1 << 8), //0x100, disabled by default +- DC_REPLAY_MASK = (1 << 9), //0x200, disabled by default for dcn < 3.1.4 + }; + + enum DC_DEBUG_MASK { +@@ -251,7 +250,6 @@ enum DC_DEBUG_MASK { + DC_DISABLE_PSR = 0x10, + DC_FORCE_SUBVP_MCLK_SWITCH = 0x20, + DC_DISABLE_MPO = 0x40, +- DC_DISABLE_REPLAY = 0x50, + DC_ENABLE_DPIA_TRACE = 0x80, + }; + +-- +2.43.0 + diff --git a/queue-6.6/regulator-core-only-increment-use_count-when-enable_.patch b/queue-6.6/regulator-core-only-increment-use_count-when-enable_.patch new file mode 100644 index 00000000000..d51fc757571 --- /dev/null +++ b/queue-6.6/regulator-core-only-increment-use_count-when-enable_.patch @@ -0,0 +1,113 @@ +From 5ace68e8db42c58eb16dc153cd2585a0ac44d8e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Nov 2023 15:42:31 +0800 +Subject: regulator: core: Only increment use_count when enable_count changes + +From: Rui Zhang + +[ Upstream commit 7993d3a9c34f609c02171e115fd12c10e2105ff4 ] + +The use_count of a regulator should only be incremented when the +enable_count changes from 0 to 1. Similarly, the use_count should +only be decremented when the enable_count changes from 1 to 0. + +In the previous implementation, use_count was sometimes decremented +to 0 when some consumer called unbalanced disable, +leading to unexpected disable even the regulator is enabled by +other consumers. With this change, the use_count accurately reflects +the number of users which the regulator is enabled. + +This should make things more robust in the case where a consumer does +leak references. + +Signed-off-by: Rui Zhang +Link: https://lore.kernel.org/r/20231103074231.8031-1-zr.zhang@vivo.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/regulator/core.c | 56 +++++++++++++++++++++------------------- + 1 file changed, 30 insertions(+), 26 deletions(-) + +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c +index 3137e40fcd3e..a7b3e548ea5a 100644 +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -2918,7 +2918,8 @@ static int _regulator_enable(struct regulator *regulator) + /* Fallthrough on positive return values - already enabled */ + } + +- rdev->use_count++; ++ if (regulator->enable_count == 1) ++ rdev->use_count++; + + return 0; + +@@ -2993,37 +2994,40 @@ static int _regulator_disable(struct regulator *regulator) + + lockdep_assert_held_once(&rdev->mutex.base); + +- if (WARN(rdev->use_count <= 0, ++ if (WARN(regulator->enable_count == 0, + "unbalanced disables for %s\n", rdev_get_name(rdev))) + return -EIO; + +- /* are we the last user and permitted to disable ? */ +- if (rdev->use_count == 1 && +- (rdev->constraints && !rdev->constraints->always_on)) { +- +- /* we are last user */ +- if (regulator_ops_is_valid(rdev, REGULATOR_CHANGE_STATUS)) { +- ret = _notifier_call_chain(rdev, +- REGULATOR_EVENT_PRE_DISABLE, +- NULL); +- if (ret & NOTIFY_STOP_MASK) +- return -EINVAL; +- +- ret = _regulator_do_disable(rdev); +- if (ret < 0) { +- rdev_err(rdev, "failed to disable: %pe\n", ERR_PTR(ret)); +- _notifier_call_chain(rdev, +- REGULATOR_EVENT_ABORT_DISABLE, ++ if (regulator->enable_count == 1) { ++ /* disabling last enable_count from this regulator */ ++ /* are we the last user and permitted to disable ? */ ++ if (rdev->use_count == 1 && ++ (rdev->constraints && !rdev->constraints->always_on)) { ++ ++ /* we are last user */ ++ if (regulator_ops_is_valid(rdev, REGULATOR_CHANGE_STATUS)) { ++ ret = _notifier_call_chain(rdev, ++ REGULATOR_EVENT_PRE_DISABLE, ++ NULL); ++ if (ret & NOTIFY_STOP_MASK) ++ return -EINVAL; ++ ++ ret = _regulator_do_disable(rdev); ++ if (ret < 0) { ++ rdev_err(rdev, "failed to disable: %pe\n", ERR_PTR(ret)); ++ _notifier_call_chain(rdev, ++ REGULATOR_EVENT_ABORT_DISABLE, ++ NULL); ++ return ret; ++ } ++ _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE, + NULL); +- return ret; + } +- _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE, +- NULL); +- } + +- rdev->use_count = 0; +- } else if (rdev->use_count > 1) { +- rdev->use_count--; ++ rdev->use_count = 0; ++ } else if (rdev->use_count > 1) { ++ rdev->use_count--; ++ } + } + + if (ret == 0) +-- +2.43.0 + diff --git a/queue-6.6/reiserfs-avoid-touching-renamed-directory-if-parent-.patch b/queue-6.6/reiserfs-avoid-touching-renamed-directory-if-parent-.patch new file mode 100644 index 00000000000..f98099c02cb --- /dev/null +++ b/queue-6.6/reiserfs-avoid-touching-renamed-directory-if-parent-.patch @@ -0,0 +1,143 @@ +From 2879cbb6cc9cc84020f418accbe040d123a28ac3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 23:14:20 +0200 +Subject: reiserfs: Avoid touching renamed directory if parent does not change + +From: Jan Kara + +[ Upstream commit 49db9b1b86a82448dfaf3fcfefcf678dee56c8ed ] + +The VFS will not be locking moved directory if its parent does not +change. Change reiserfs rename code to avoid touching renamed directory +if its parent does not change as without locking that can corrupt the +filesystem. + +Signed-off-by: Jan Kara +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + fs/reiserfs/namei.c | 54 ++++++++++++++++++++++++--------------------- + 1 file changed, 29 insertions(+), 25 deletions(-) + +diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c +index 9c5704be2435..889341c6b8f0 100644 +--- a/fs/reiserfs/namei.c ++++ b/fs/reiserfs/namei.c +@@ -1324,8 +1324,8 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + struct inode *old_inode, *new_dentry_inode; + struct reiserfs_transaction_handle th; + int jbegin_count; +- umode_t old_inode_mode; + unsigned long savelink = 1; ++ bool update_dir_parent = false; + + if (flags & ~RENAME_NOREPLACE) + return -EINVAL; +@@ -1375,8 +1375,7 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + return -ENOENT; + } + +- old_inode_mode = old_inode->i_mode; +- if (S_ISDIR(old_inode_mode)) { ++ if (S_ISDIR(old_inode->i_mode)) { + /* + * make sure that directory being renamed has correct ".." + * and that its new parent directory has not too many links +@@ -1389,24 +1388,28 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + } + } + +- /* +- * directory is renamed, its parent directory will be changed, +- * so find ".." entry +- */ +- dot_dot_de.de_gen_number_bit_string = NULL; +- retval = +- reiserfs_find_entry(old_inode, "..", 2, &dot_dot_entry_path, ++ if (old_dir != new_dir) { ++ /* ++ * directory is renamed, its parent directory will be ++ * changed, so find ".." entry ++ */ ++ dot_dot_de.de_gen_number_bit_string = NULL; ++ retval = ++ reiserfs_find_entry(old_inode, "..", 2, ++ &dot_dot_entry_path, + &dot_dot_de); +- pathrelse(&dot_dot_entry_path); +- if (retval != NAME_FOUND) { +- reiserfs_write_unlock(old_dir->i_sb); +- return -EIO; +- } ++ pathrelse(&dot_dot_entry_path); ++ if (retval != NAME_FOUND) { ++ reiserfs_write_unlock(old_dir->i_sb); ++ return -EIO; ++ } + +- /* inode number of .. must equal old_dir->i_ino */ +- if (dot_dot_de.de_objectid != old_dir->i_ino) { +- reiserfs_write_unlock(old_dir->i_sb); +- return -EIO; ++ /* inode number of .. must equal old_dir->i_ino */ ++ if (dot_dot_de.de_objectid != old_dir->i_ino) { ++ reiserfs_write_unlock(old_dir->i_sb); ++ return -EIO; ++ } ++ update_dir_parent = true; + } + } + +@@ -1486,7 +1489,7 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + + reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1); + +- if (S_ISDIR(old_inode->i_mode)) { ++ if (update_dir_parent) { + if ((retval = + search_by_entry_key(new_dir->i_sb, + &dot_dot_de.de_entry_key, +@@ -1534,14 +1537,14 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + new_de.de_bh); + reiserfs_restore_prepared_buffer(old_inode->i_sb, + old_de.de_bh); +- if (S_ISDIR(old_inode_mode)) ++ if (update_dir_parent) + reiserfs_restore_prepared_buffer(old_inode-> + i_sb, + dot_dot_de. + de_bh); + continue; + } +- if (S_ISDIR(old_inode_mode)) { ++ if (update_dir_parent) { + if (item_moved(&dot_dot_ih, &dot_dot_entry_path) || + !entry_points_to_object("..", 2, &dot_dot_de, + old_dir)) { +@@ -1559,7 +1562,7 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + } + } + +- RFALSE(S_ISDIR(old_inode_mode) && ++ RFALSE(update_dir_parent && + !buffer_journal_prepared(dot_dot_de.de_bh), ""); + + break; +@@ -1592,11 +1595,12 @@ static int reiserfs_rename(struct mnt_idmap *idmap, + savelink = new_dentry_inode->i_nlink; + } + +- if (S_ISDIR(old_inode_mode)) { ++ if (update_dir_parent) { + /* adjust ".." of renamed directory */ + set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir)); + journal_mark_dirty(&th, dot_dot_de.de_bh); +- ++ } ++ if (S_ISDIR(old_inode->i_mode)) { + /* + * there (in new_dir) was no directory, so it got new link + * (".." of renamed directory) +-- +2.43.0 + diff --git a/queue-6.6/riscv-fix-build-error-on-rv32-xip.patch b/queue-6.6/riscv-fix-build-error-on-rv32-xip.patch new file mode 100644 index 00000000000..fa78c1b56f2 --- /dev/null +++ b/queue-6.6/riscv-fix-build-error-on-rv32-xip.patch @@ -0,0 +1,50 @@ +From 09ab5f3b9448987e2977df767a3157053d39000a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Jan 2024 22:21:20 +0100 +Subject: riscv: Fix build error on rv32 + XIP + +From: Alexandre Ghiti + +[ Upstream commit 66f962d8939fd2ac74de901d30d30310c8ddca79 ] + +commit 66f1e6809397 ("riscv: Make XIP bootable again") restricted page +offset to the sv39 page offset instead of the default sv57, which makes +sense since probably the platforms that target XIP kernels do not +support anything else than sv39 and we do not try to find out the +largest address space supported on XIP kernels (ie set_satp_mode()). + +But PAGE_OFFSET_L3 is not defined for rv32, so fix the build error by +restoring the previous behaviour which picks CONFIG_PAGE_OFFSET for rv32. + +Fixes: 66f1e6809397 ("riscv: Make XIP bootable again") +Reported-by: Randy Dunlap +Closes: https://lore.kernel.org/linux-riscv/344dca85-5c48-44e1-bc64-4fa7973edd12@infradead.org/T/#u +Signed-off-by: Alexandre Ghiti +Acked-by: Randy Dunlap +Tested-by: Randy Dunlap # build-tested +Link: https://lore.kernel.org/r/20240118212120.2087803-1-alexghiti@rivosinc.com +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/mm/init.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c +index 5f1921d014b1..e71dd19ac801 100644 +--- a/arch/riscv/mm/init.c ++++ b/arch/riscv/mm/init.c +@@ -1058,7 +1058,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) + kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset; + + #ifdef CONFIG_XIP_KERNEL ++#ifdef CONFIG_64BIT + kernel_map.page_offset = PAGE_OFFSET_L3; ++#else ++ kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL); ++#endif + kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR; + kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom); + +-- +2.43.0 + diff --git a/queue-6.6/riscv-make-xip-bootable-again.patch b/queue-6.6/riscv-make-xip-bootable-again.patch new file mode 100644 index 00000000000..6c5eb43b189 --- /dev/null +++ b/queue-6.6/riscv-make-xip-bootable-again.patch @@ -0,0 +1,79 @@ +From 2c67ceaf8efabf220e0fd16b0db264a674dcee7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 14:01:12 +0100 +Subject: riscv: Make XIP bootable again + +From: Frederik Haxel + +[ Upstream commit 66f1e68093979816a23412a3fad066f5bcbc0360 ] + +Currently, the XIP kernel seems to fail to boot due to missing +XIP_FIXUP and a wrong page_offset value. A superfluous XIP_FIXUP +has also been removed. + +Signed-off-by: Frederik Haxel +Link: https://lore.kernel.org/r/20231212130116.848530-2-haxel@fzi.de +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/kernel/head.S | 1 + + arch/riscv/mm/init.c | 8 ++++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S +index 3710ea5d160f..0097c145385f 100644 +--- a/arch/riscv/kernel/head.S ++++ b/arch/riscv/kernel/head.S +@@ -88,6 +88,7 @@ relocate_enable_mmu: + /* Compute satp for kernel page tables, but don't load it yet */ + srl a2, a0, PAGE_SHIFT + la a1, satp_mode ++ XIP_FIXUP_OFFSET a1 + REG_L a1, 0(a1) + or a2, a2, a1 + +diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c +index 0798bd861dcb..5f1921d014b1 100644 +--- a/arch/riscv/mm/init.c ++++ b/arch/riscv/mm/init.c +@@ -172,6 +172,9 @@ void __init mem_init(void) + + /* Limit the memory size via mem. */ + static phys_addr_t memory_limit; ++#ifdef CONFIG_XIP_KERNEL ++#define memory_limit (*(phys_addr_t *)XIP_FIXUP(&memory_limit)) ++#endif /* CONFIG_XIP_KERNEL */ + + static int __init early_mem(char *p) + { +@@ -950,7 +953,7 @@ static void __init create_fdt_early_page_table(uintptr_t fix_fdt_va, + * setup_vm_final installs the linear mapping. For 32-bit kernel, as the + * kernel is mapped in the linear mapping, that makes no difference. + */ +- dtb_early_va = kernel_mapping_pa_to_va(XIP_FIXUP(dtb_pa)); ++ dtb_early_va = kernel_mapping_pa_to_va(dtb_pa); + #endif + + dtb_early_pa = dtb_pa; +@@ -1053,9 +1056,9 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) + #endif + + kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset; +- kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL); + + #ifdef CONFIG_XIP_KERNEL ++ kernel_map.page_offset = PAGE_OFFSET_L3; + kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR; + kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom); + +@@ -1065,6 +1068,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) + + kernel_map.va_kernel_xip_pa_offset = kernel_map.virt_addr - kernel_map.xiprom; + #else ++ kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL); + kernel_map.phys_addr = (uintptr_t)(&_start); + kernel_map.size = (uintptr_t)(&_end) - kernel_map.phys_addr; + #endif +-- +2.43.0 + diff --git a/queue-6.6/rxrpc_find_service_conn_rcu-fix-the-usage-of-read_se.patch b/queue-6.6/rxrpc_find_service_conn_rcu-fix-the-usage-of-read_se.patch new file mode 100644 index 00000000000..b1b6290a5f5 --- /dev/null +++ b/queue-6.6/rxrpc_find_service_conn_rcu-fix-the-usage-of-read_se.patch @@ -0,0 +1,46 @@ +From 85e27dc24c45f42a3a930e7ee677459a097e51cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 17:48:46 +0100 +Subject: rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock() + +From: Oleg Nesterov + +[ Upstream commit bad1a11c0f061aa073bab785389fe04f19ba02e1 ] + +rxrpc_find_service_conn_rcu() should make the "seq" counter odd on the +second pass, otherwise read_seqbegin_or_lock() never takes the lock. + +Signed-off-by: Oleg Nesterov +Signed-off-by: David Howells +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Link: https://lore.kernel.org/r/20231117164846.GA10410@redhat.com/ +Signed-off-by: Sasha Levin +--- + net/rxrpc/conn_service.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/rxrpc/conn_service.c b/net/rxrpc/conn_service.c +index 89ac05a711a4..39c908a3ca6e 100644 +--- a/net/rxrpc/conn_service.c ++++ b/net/rxrpc/conn_service.c +@@ -25,7 +25,7 @@ struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *peer, + struct rxrpc_conn_proto k; + struct rxrpc_skb_priv *sp = rxrpc_skb(skb); + struct rb_node *p; +- unsigned int seq = 0; ++ unsigned int seq = 1; + + k.epoch = sp->hdr.epoch; + k.cid = sp->hdr.cid & RXRPC_CIDMASK; +@@ -35,6 +35,7 @@ struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *peer, + * under just the RCU read lock, so we have to check for + * changes. + */ ++ seq++; /* 2 on the 1st/lockless path, otherwise odd */ + read_seqbegin_or_lock(&peer->service_conn_lock, &seq); + + p = rcu_dereference_raw(peer->service_conns.rb_node); +-- +2.43.0 + diff --git a/queue-6.6/s390-boot-always-align-vmalloc-area-on-segment-bound.patch b/queue-6.6/s390-boot-always-align-vmalloc-area-on-segment-bound.patch new file mode 100644 index 00000000000..372d7bd6b40 --- /dev/null +++ b/queue-6.6/s390-boot-always-align-vmalloc-area-on-segment-bound.patch @@ -0,0 +1,63 @@ +From c041e16276a4461286d89f2f2ad9ed72fac38954 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 16 Jul 2023 10:56:00 +0200 +Subject: s390/boot: always align vmalloc area on segment boundary + +From: Alexander Gordeev + +[ Upstream commit 65f8780e2d70257200547b5a7654974aa7c37ce1 ] + +The size of vmalloc area depends from various factors +on boot and could be set to: + +1. Default size as determined by VMALLOC_DEFAULT_SIZE macro; +2. One half of the virtual address space not occupied by + modules and fixed mappings; +3. The size provided by user with vmalloc= kernel command + line parameter; + +In cases [1] and [2] the vmalloc area base address is aligned +on Region3 table type boundary, while in case [3] in might get +aligned on page boundary. + +Limit the waste of page tables and always align vmalloc area +size and base address on segment boundary. + +Acked-by: Heiko Carstens +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/boot/ipl_parm.c | 2 +- + arch/s390/boot/startup.c | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c +index 7b7521762633..4230144645bc 100644 +--- a/arch/s390/boot/ipl_parm.c ++++ b/arch/s390/boot/ipl_parm.c +@@ -272,7 +272,7 @@ void parse_boot_command_line(void) + memory_limit = round_down(memparse(val, NULL), PAGE_SIZE); + + if (!strcmp(param, "vmalloc") && val) { +- vmalloc_size = round_up(memparse(val, NULL), PAGE_SIZE); ++ vmalloc_size = round_up(memparse(val, NULL), _SEGMENT_SIZE); + vmalloc_size_set = 1; + } + +diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c +index d3e48bd9c394..d08db5df6091 100644 +--- a/arch/s390/boot/startup.c ++++ b/arch/s390/boot/startup.c +@@ -212,7 +212,8 @@ static unsigned long setup_kernel_memory_layout(void) + VMALLOC_END = MODULES_VADDR; + + /* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */ +- vmalloc_size = min(vmalloc_size, round_down(VMALLOC_END / 2, _REGION3_SIZE)); ++ vsize = round_down(VMALLOC_END / 2, _SEGMENT_SIZE); ++ vmalloc_size = min(vmalloc_size, vsize); + VMALLOC_START = VMALLOC_END - vmalloc_size; + + /* split remaining virtual space between 1:1 mapping & vmemmap array */ +-- +2.43.0 + diff --git a/queue-6.6/s390-ptrace-handle-setting-of-fpc-register-correctly.patch b/queue-6.6/s390-ptrace-handle-setting-of-fpc-register-correctly.patch new file mode 100644 index 00000000000..c12ef01c9f9 --- /dev/null +++ b/queue-6.6/s390-ptrace-handle-setting-of-fpc-register-correctly.patch @@ -0,0 +1,71 @@ +From 5d1028dd2e2a75e9c0cd8f702839bf79e3fcc8e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 18:55:59 +0100 +Subject: s390/ptrace: handle setting of fpc register correctly + +From: Heiko Carstens + +[ Upstream commit 8b13601d19c541158a6e18b278c00ba69ae37829 ] + +If the content of the floating point control (fpc) register of a traced +process is modified with the ptrace interface the new value is tested for +validity by temporarily loading it into the fpc register. + +This may lead to corruption of the fpc register of the tracing process: +if an interrupt happens while the value is temporarily loaded into the +fpc register, and within interrupt context floating point or vector +registers are used, the current fp/vx registers are saved with +save_fpu_regs() assuming they belong to user space and will be loaded into +fp/vx registers when returning to user space. + +test_fp_ctl() restores the original user space fpc register value, however +it will be discarded, when returning to user space. + +In result the tracer will incorrectly continue to run with the value that +was supposed to be used for the traced process. + +Fix this by saving fpu register contents with save_fpu_regs() before using +test_fp_ctl(). + +Reviewed-by: Claudio Imbrenda +Signed-off-by: Heiko Carstens +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/ptrace.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c +index ea244a73efad..512b81473759 100644 +--- a/arch/s390/kernel/ptrace.c ++++ b/arch/s390/kernel/ptrace.c +@@ -385,6 +385,7 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) + /* + * floating point control reg. is in the thread structure + */ ++ save_fpu_regs(); + if ((unsigned int) data != 0 || + test_fp_ctl(data >> (BITS_PER_LONG - 32))) + return -EINVAL; +@@ -741,6 +742,7 @@ static int __poke_user_compat(struct task_struct *child, + /* + * floating point control reg. is in the thread structure + */ ++ save_fpu_regs(); + if (test_fp_ctl(tmp)) + return -EINVAL; + child->thread.fpu.fpc = data; +@@ -904,9 +906,7 @@ static int s390_fpregs_set(struct task_struct *target, + int rc = 0; + freg_t fprs[__NUM_FPRS]; + +- if (target == current) +- save_fpu_regs(); +- ++ save_fpu_regs(); + if (MACHINE_HAS_VX) + convert_vx_to_fp(fprs, target->thread.fpu.vxrs); + else +-- +2.43.0 + diff --git a/queue-6.6/s390-vfio-ap-fix-sysfs-status-attribute-for-ap-queue.patch b/queue-6.6/s390-vfio-ap-fix-sysfs-status-attribute-for-ap-queue.patch new file mode 100644 index 00000000000..e26af5f2bb2 --- /dev/null +++ b/queue-6.6/s390-vfio-ap-fix-sysfs-status-attribute-for-ap-queue.patch @@ -0,0 +1,95 @@ +From b22b6f92140605b7ee0b4d3dd543afc763c10f00 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Nov 2023 15:11:30 -0500 +Subject: s390/vfio-ap: fix sysfs status attribute for AP queue devices + +From: Tony Krowiak + +[ Upstream commit a0d8f4eeb7c4ffaee21702bcc91a09b3988c5b7a ] + +The 'status' attribute for AP queue devices bound to the vfio_ap device +driver displays incorrect status when the mediated device is attached to a +guest, but the queue device is not passed through. In the current +implementation, the status displayed is 'in_use' which is not correct; it +should be 'assigned'. This can happen if one of the queue devices +associated with a given adapter is not bound to the vfio_ap device driver. +For example: + +Queues listed in /sys/bus/ap/drivers/vfio_ap: +14.0005 +14.0006 +14.000d +16.0006 +16.000d + +Queues listed in /sys/devices/vfio_ap/matrix/$UUID/matrix +14.0005 +14.0006 +14.000d +16.0005 +16.0006 +16.000d + +Queues listed in /sys/devices/vfio_ap/matrix/$UUID/guest_matrix +14.0005 +14.0006 +14.000d + +The reason no queues for adapter 0x16 are listed in the guest_matrix is +because queue 16.0005 is not bound to the vfio_ap device driver, so no +queue associated with the adapter is passed through to the guest; +therefore, each queue device for adapter 0x16 should display 'assigned' +instead of 'in_use', because those queues are not in use by a guest, but +only assigned to the mediated device. + +Let's check the AP configuration for the guest to determine whether a +queue device is passed through before displaying a status of 'in_use'. + +Signed-off-by: Tony Krowiak +Acked-by: Halil Pasic +Acked-by: Harald Freudenberger +Link: https://lore.kernel.org/r/20231108201135.351419-1-akrowiak@linux.ibm.com +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + drivers/s390/crypto/vfio_ap_ops.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c +index 88f41f95cc94..d6ea2fd4c2a0 100644 +--- a/drivers/s390/crypto/vfio_ap_ops.c ++++ b/drivers/s390/crypto/vfio_ap_ops.c +@@ -2044,6 +2044,7 @@ static ssize_t status_show(struct device *dev, + { + ssize_t nchars = 0; + struct vfio_ap_queue *q; ++ unsigned long apid, apqi; + struct ap_matrix_mdev *matrix_mdev; + struct ap_device *apdev = to_ap_dev(dev); + +@@ -2051,8 +2052,21 @@ static ssize_t status_show(struct device *dev, + q = dev_get_drvdata(&apdev->device); + matrix_mdev = vfio_ap_mdev_for_queue(q); + ++ /* If the queue is assigned to the matrix mediated device, then ++ * determine whether it is passed through to a guest; otherwise, ++ * indicate that it is unassigned. ++ */ + if (matrix_mdev) { +- if (matrix_mdev->kvm) ++ apid = AP_QID_CARD(q->apqn); ++ apqi = AP_QID_QUEUE(q->apqn); ++ /* ++ * If the queue is passed through to the guest, then indicate ++ * that it is in use; otherwise, indicate that it is ++ * merely assigned to a matrix mediated device. ++ */ ++ if (matrix_mdev->kvm && ++ test_bit_inv(apid, matrix_mdev->shadow_apcb.apm) && ++ test_bit_inv(apqi, matrix_mdev->shadow_apcb.aqm)) + nchars = scnprintf(buf, PAGE_SIZE, "%s\n", + AP_QUEUE_IN_USE); + else +-- +2.43.0 + diff --git a/queue-6.6/sched-topology-add-a-new-arch_scale_freq_ref-method.patch b/queue-6.6/sched-topology-add-a-new-arch_scale_freq_ref-method.patch new file mode 100644 index 00000000000..e7e78f1c7e6 --- /dev/null +++ b/queue-6.6/sched-topology-add-a-new-arch_scale_freq_ref-method.patch @@ -0,0 +1,215 @@ +From b84e7f7bcc91d2815e2ce356dc4211c904eff4a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 11:48:49 +0100 +Subject: sched/topology: Add a new arch_scale_freq_ref() method + +From: Vincent Guittot + +[ Upstream commit 9942cb22ea458c34fa17b73d143ea32d4df1caca ] + +Create a new method to get a unique and fixed max frequency. Currently +cpuinfo.max_freq or the highest (or last) state of performance domain are +used as the max frequency when computing the frequency for a level of +utilization, but: + + - cpuinfo_max_freq can change at runtime. boost is one example of + such change. + + - cpuinfo.max_freq and last item of the PD can be different leading to + different results between cpufreq and energy model. + +We need to save the reference frequency that has been used when computing +the CPUs capacity and use this fixed and coherent value to convert between +frequency and CPU's capacity. + +In fact, we already save the frequency that has been used when computing +the capacity of each CPU. We extend the precision to save kHz instead of +MHz currently and we modify the type to be aligned with other variables +used when converting frequency to capacity and the other way. + +[ mingo: Minor edits. ] + +Signed-off-by: Vincent Guittot +Signed-off-by: Ingo Molnar +Tested-by: Lukasz Luba +Reviewed-by: Lukasz Luba +Acked-by: Sudeep Holla +Link: https://lore.kernel.org/r/20231211104855.558096-2-vincent.guittot@linaro.org +Signed-off-by: Sasha Levin +--- + arch/arm/include/asm/topology.h | 1 + + arch/arm64/include/asm/topology.h | 1 + + arch/riscv/include/asm/topology.h | 1 + + drivers/base/arch_topology.c | 29 ++++++++++++++--------------- + include/linux/arch_topology.h | 7 +++++++ + include/linux/sched/topology.h | 8 ++++++++ + 6 files changed, 32 insertions(+), 15 deletions(-) + +diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h +index c7d2510e5a78..853c4f81ba4a 100644 +--- a/arch/arm/include/asm/topology.h ++++ b/arch/arm/include/asm/topology.h +@@ -13,6 +13,7 @@ + #define arch_set_freq_scale topology_set_freq_scale + #define arch_scale_freq_capacity topology_get_freq_scale + #define arch_scale_freq_invariant topology_scale_freq_invariant ++#define arch_scale_freq_ref topology_get_freq_ref + #endif + + /* Replace task scheduler's default cpu-invariant accounting */ +diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h +index 9fab663dd2de..a323b109b9c4 100644 +--- a/arch/arm64/include/asm/topology.h ++++ b/arch/arm64/include/asm/topology.h +@@ -23,6 +23,7 @@ void update_freq_counters_refs(void); + #define arch_set_freq_scale topology_set_freq_scale + #define arch_scale_freq_capacity topology_get_freq_scale + #define arch_scale_freq_invariant topology_scale_freq_invariant ++#define arch_scale_freq_ref topology_get_freq_ref + + #ifdef CONFIG_ACPI_CPPC_LIB + #define arch_init_invariance_cppc topology_init_cpu_capacity_cppc +diff --git a/arch/riscv/include/asm/topology.h b/arch/riscv/include/asm/topology.h +index e316ab3b77f3..61183688bdd5 100644 +--- a/arch/riscv/include/asm/topology.h ++++ b/arch/riscv/include/asm/topology.h +@@ -9,6 +9,7 @@ + #define arch_set_freq_scale topology_set_freq_scale + #define arch_scale_freq_capacity topology_get_freq_scale + #define arch_scale_freq_invariant topology_scale_freq_invariant ++#define arch_scale_freq_ref topology_get_freq_ref + + /* Replace task scheduler's default cpu-invariant accounting */ + #define arch_scale_cpu_capacity topology_get_cpu_scale +diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c +index b741b5ba82bd..0c9ae5b157b1 100644 +--- a/drivers/base/arch_topology.c ++++ b/drivers/base/arch_topology.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #define CREATE_TRACE_POINTS + #include +@@ -26,7 +27,8 @@ + static DEFINE_PER_CPU(struct scale_freq_data __rcu *, sft_data); + static struct cpumask scale_freq_counters_mask; + static bool scale_freq_invariant; +-static DEFINE_PER_CPU(u32, freq_factor) = 1; ++DEFINE_PER_CPU(unsigned long, capacity_freq_ref) = 1; ++EXPORT_PER_CPU_SYMBOL_GPL(capacity_freq_ref); + + static bool supports_scale_freq_counters(const struct cpumask *cpus) + { +@@ -170,9 +172,9 @@ DEFINE_PER_CPU(unsigned long, thermal_pressure); + * operating on stale data when hot-plug is used for some CPUs. The + * @capped_freq reflects the currently allowed max CPUs frequency due to + * thermal capping. It might be also a boost frequency value, which is bigger +- * than the internal 'freq_factor' max frequency. In such case the pressure +- * value should simply be removed, since this is an indication that there is +- * no thermal throttling. The @capped_freq must be provided in kHz. ++ * than the internal 'capacity_freq_ref' max frequency. In such case the ++ * pressure value should simply be removed, since this is an indication that ++ * there is no thermal throttling. The @capped_freq must be provided in kHz. + */ + void topology_update_thermal_pressure(const struct cpumask *cpus, + unsigned long capped_freq) +@@ -183,10 +185,7 @@ void topology_update_thermal_pressure(const struct cpumask *cpus, + + cpu = cpumask_first(cpus); + max_capacity = arch_scale_cpu_capacity(cpu); +- max_freq = per_cpu(freq_factor, cpu); +- +- /* Convert to MHz scale which is used in 'freq_factor' */ +- capped_freq /= 1000; ++ max_freq = arch_scale_freq_ref(cpu); + + /* + * Handle properly the boost frequencies, which should simply clean +@@ -279,13 +278,13 @@ void topology_normalize_cpu_scale(void) + + capacity_scale = 1; + for_each_possible_cpu(cpu) { +- capacity = raw_capacity[cpu] * per_cpu(freq_factor, cpu); ++ capacity = raw_capacity[cpu] * per_cpu(capacity_freq_ref, cpu); + capacity_scale = max(capacity, capacity_scale); + } + + pr_debug("cpu_capacity: capacity_scale=%llu\n", capacity_scale); + for_each_possible_cpu(cpu) { +- capacity = raw_capacity[cpu] * per_cpu(freq_factor, cpu); ++ capacity = raw_capacity[cpu] * per_cpu(capacity_freq_ref, cpu); + capacity = div64_u64(capacity << SCHED_CAPACITY_SHIFT, + capacity_scale); + topology_set_cpu_scale(cpu, capacity); +@@ -321,15 +320,15 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) + cpu_node, raw_capacity[cpu]); + + /* +- * Update freq_factor for calculating early boot cpu capacities. ++ * Update capacity_freq_ref for calculating early boot CPU capacities. + * For non-clk CPU DVFS mechanism, there's no way to get the + * frequency value now, assuming they are running at the same +- * frequency (by keeping the initial freq_factor value). ++ * frequency (by keeping the initial capacity_freq_ref value). + */ + cpu_clk = of_clk_get(cpu_node, 0); + if (!PTR_ERR_OR_ZERO(cpu_clk)) { +- per_cpu(freq_factor, cpu) = +- clk_get_rate(cpu_clk) / 1000; ++ per_cpu(capacity_freq_ref, cpu) = ++ clk_get_rate(cpu_clk) / HZ_PER_KHZ; + clk_put(cpu_clk); + } + } else { +@@ -411,7 +410,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, + cpumask_andnot(cpus_to_visit, cpus_to_visit, policy->related_cpus); + + for_each_cpu(cpu, policy->related_cpus) +- per_cpu(freq_factor, cpu) = policy->cpuinfo.max_freq / 1000; ++ per_cpu(capacity_freq_ref, cpu) = policy->cpuinfo.max_freq; + + if (cpumask_empty(cpus_to_visit)) { + topology_normalize_cpu_scale(); +diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h +index a07b510e7dc5..32c24ff4f2a8 100644 +--- a/include/linux/arch_topology.h ++++ b/include/linux/arch_topology.h +@@ -27,6 +27,13 @@ static inline unsigned long topology_get_cpu_scale(int cpu) + + void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity); + ++DECLARE_PER_CPU(unsigned long, capacity_freq_ref); ++ ++static inline unsigned long topology_get_freq_ref(int cpu) ++{ ++ return per_cpu(capacity_freq_ref, cpu); ++} ++ + DECLARE_PER_CPU(unsigned long, arch_freq_scale); + + static inline unsigned long topology_get_freq_scale(int cpu) +diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h +index 67b573d5bf28..9671b7234684 100644 +--- a/include/linux/sched/topology.h ++++ b/include/linux/sched/topology.h +@@ -275,6 +275,14 @@ void arch_update_thermal_pressure(const struct cpumask *cpus, + { } + #endif + ++#ifndef arch_scale_freq_ref ++static __always_inline ++unsigned int arch_scale_freq_ref(int cpu) ++{ ++ return 0; ++} ++#endif ++ + static inline int task_node(const struct task_struct *p) + { + return cpu_to_node(task_cpu(p)); +-- +2.43.0 + diff --git a/queue-6.6/scsi-arcmsr-support-new-pci-device-ids-1883-and-1886.patch b/queue-6.6/scsi-arcmsr-support-new-pci-device-ids-1883-and-1886.patch new file mode 100644 index 00000000000..0da26512f2b --- /dev/null +++ b/queue-6.6/scsi-arcmsr-support-new-pci-device-ids-1883-and-1886.patch @@ -0,0 +1,70 @@ +From e2b6d7405044788f1478351ffa62aac715d0c743 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 17:50:27 +0800 +Subject: scsi: arcmsr: Support new PCI device IDs 1883 and 1886 + +From: ching Huang + +[ Upstream commit 41c8a1a1e90fa4721f856bf3cf71211fd16d6434 ] + +Add support for Areca RAID controllers with PCI device IDs 1883 and 1886. + +Signed-off-by: ching Huang +Link: https://lore.kernel.org/r/7732e743eaad57681b1552eec9c6a86c76dbe459.camel@areca.com.tw +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/arcmsr/arcmsr.h | 4 ++++ + drivers/scsi/arcmsr/arcmsr_hba.c | 6 ++++++ + 2 files changed, 10 insertions(+) + +diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h +index ed8d9319862a..3819d559ebbb 100644 +--- a/drivers/scsi/arcmsr/arcmsr.h ++++ b/drivers/scsi/arcmsr/arcmsr.h +@@ -78,9 +78,13 @@ struct device_attribute; + #ifndef PCI_DEVICE_ID_ARECA_1203 + #define PCI_DEVICE_ID_ARECA_1203 0x1203 + #endif ++#ifndef PCI_DEVICE_ID_ARECA_1883 ++#define PCI_DEVICE_ID_ARECA_1883 0x1883 ++#endif + #ifndef PCI_DEVICE_ID_ARECA_1884 + #define PCI_DEVICE_ID_ARECA_1884 0x1884 + #endif ++#define PCI_DEVICE_ID_ARECA_1886_0 0x1886 + #define PCI_DEVICE_ID_ARECA_1886 0x188A + #define ARCMSR_HOURS (1000 * 60 * 60 * 4) + #define ARCMSR_MINUTES (1000 * 60 * 60) +diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c +index a66221c3b72f..01fb1396e1a9 100644 +--- a/drivers/scsi/arcmsr/arcmsr_hba.c ++++ b/drivers/scsi/arcmsr/arcmsr_hba.c +@@ -214,8 +214,12 @@ static struct pci_device_id arcmsr_device_id_table[] = { + .driver_data = ACB_ADAPTER_TYPE_A}, + {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1880), + .driver_data = ACB_ADAPTER_TYPE_C}, ++ {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1883), ++ .driver_data = ACB_ADAPTER_TYPE_C}, + {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1884), + .driver_data = ACB_ADAPTER_TYPE_E}, ++ {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1886_0), ++ .driver_data = ACB_ADAPTER_TYPE_F}, + {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1886), + .driver_data = ACB_ADAPTER_TYPE_F}, + {0, 0}, /* Terminating entry */ +@@ -4706,9 +4710,11 @@ static const char *arcmsr_info(struct Scsi_Host *host) + case PCI_DEVICE_ID_ARECA_1680: + case PCI_DEVICE_ID_ARECA_1681: + case PCI_DEVICE_ID_ARECA_1880: ++ case PCI_DEVICE_ID_ARECA_1883: + case PCI_DEVICE_ID_ARECA_1884: + type = "SAS/SATA"; + break; ++ case PCI_DEVICE_ID_ARECA_1886_0: + case PCI_DEVICE_ID_ARECA_1886: + type = "NVMe/SAS/SATA"; + break; +-- +2.43.0 + diff --git a/queue-6.6/scsi-hisi_sas-set-.phy_attached-before-notifing-phyu.patch b/queue-6.6/scsi-hisi_sas-set-.phy_attached-before-notifing-phyu.patch new file mode 100644 index 00000000000..9236560a14e --- /dev/null +++ b/queue-6.6/scsi-hisi_sas-set-.phy_attached-before-notifing-phyu.patch @@ -0,0 +1,57 @@ +From 9fa5dfcb8b97190ffdd41d237accb0b53a170783 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Dec 2023 11:45:12 +0800 +Subject: scsi: hisi_sas: Set .phy_attached before notifing phyup event + HISI_PHYE_PHY_UP_PM + +From: Yihang Li + +[ Upstream commit ce26497c745d0541aec930d5211b431a1c26af97 ] + +Currently in directly attached scenario, the phyup event +HISI_PHYE_PHY_UP_PM is notified before .phy_attached is set - this may +cause the phyup work hisi_sas_bytes_dmaed() execution failed and the +attached device will not be found. + +To fix it, set .phy_attached before notifing phyup event. + +Signed-off-by: Yihang Li +Signed-off-by: Xiang Chen +Link: https://lore.kernel.org/r/1702525516-51258-2-git-send-email-chenxiang66@hisilicon.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +index 520fffc14282..e914c0c13bb5 100644 +--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c ++++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +@@ -1606,6 +1606,11 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) + } + + phy->port_id = port_id; ++ spin_lock(&phy->lock); ++ /* Delete timer and set phy_attached atomically */ ++ del_timer(&phy->timer); ++ phy->phy_attached = 1; ++ spin_unlock(&phy->lock); + + /* + * Call pm_runtime_get_noresume() which pairs with +@@ -1619,11 +1624,6 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) + + res = IRQ_HANDLED; + +- spin_lock(&phy->lock); +- /* Delete timer and set phy_attached atomically */ +- del_timer(&phy->timer); +- phy->phy_attached = 1; +- spin_unlock(&phy->lock); + end: + if (phy->reset_completion) + complete(phy->reset_completion); +-- +2.43.0 + diff --git a/queue-6.6/scsi-libfc-don-t-schedule-abort-twice.patch b/queue-6.6/scsi-libfc-don-t-schedule-abort-twice.patch new file mode 100644 index 00000000000..d9c5a3e6ab9 --- /dev/null +++ b/queue-6.6/scsi-libfc-don-t-schedule-abort-twice.patch @@ -0,0 +1,68 @@ +From 558302f062583dc7c402c58f8599c948d0409c46 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Nov 2023 17:58:30 +0100 +Subject: scsi: libfc: Don't schedule abort twice + +From: Hannes Reinecke + +[ Upstream commit b57c4db5d23b9df0118a25e2441c9288edd73710 ] + +The current FC error recovery is sending up to three REC (recovery) frames +in 10 second intervals, and as a final step sending an ABTS after 30 +seconds for the command itself. Unfortunately sending an ABTS is also the +action for the SCSI abort handler, and the default timeout for SCSI +commands is also 30 seconds. This causes two ABTS to be scheduled, with the +libfc one slightly earlier. The ABTS scheduled by SCSI EH then sees the +command to be already aborted, and will always return with a 'GOOD' status +irrespective on the actual result from the first ABTS. This causes the +SCSI EH abort handler to always succeed, and SCSI EH never to be engaged. +Fix this by not issuing an ABTS when a SCSI command is present for the +exchange, but rather wait for the abort scheduled from SCSI EH. And warn +if an abort is already scheduled to avoid similar errors in the future. + +Signed-off-by: Hannes Reinecke +Link: https://lore.kernel.org/r/20231129165832.224100-2-hare@kernel.org +Reviewed-by: Christoph Hellwig +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libfc/fc_fcp.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c +index 945adca5e72f..3f189cedf6db 100644 +--- a/drivers/scsi/libfc/fc_fcp.c ++++ b/drivers/scsi/libfc/fc_fcp.c +@@ -265,6 +265,11 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp) + if (!fsp->seq_ptr) + return -EINVAL; + ++ if (fsp->state & FC_SRB_ABORT_PENDING) { ++ FC_FCP_DBG(fsp, "abort already pending\n"); ++ return -EBUSY; ++ } ++ + this_cpu_inc(fsp->lp->stats->FcpPktAborts); + + fsp->state |= FC_SRB_ABORT_PENDING; +@@ -1690,11 +1695,12 @@ static void fc_fcp_recovery(struct fc_fcp_pkt *fsp, u8 code) + fsp->status_code = code; + fsp->cdb_status = 0; + fsp->io_status = 0; +- /* +- * if this fails then we let the scsi command timer fire and +- * scsi-ml escalate. +- */ +- fc_fcp_send_abort(fsp); ++ if (!fsp->cmd) ++ /* ++ * Only abort non-scsi commands; otherwise let the ++ * scsi command timer fire and scsi-ml escalate. ++ */ ++ fc_fcp_send_abort(fsp); + } + + /** +-- +2.43.0 + diff --git a/queue-6.6/scsi-libfc-fix-up-timeout-error-in-fc_fcp_rec_error.patch b/queue-6.6/scsi-libfc-fix-up-timeout-error-in-fc_fcp_rec_error.patch new file mode 100644 index 00000000000..180bb355b59 --- /dev/null +++ b/queue-6.6/scsi-libfc-fix-up-timeout-error-in-fc_fcp_rec_error.patch @@ -0,0 +1,37 @@ +From 8adc63369ce842de5c61c834ae94ff3af5584d1b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Nov 2023 17:58:31 +0100 +Subject: scsi: libfc: Fix up timeout error in fc_fcp_rec_error() + +From: Hannes Reinecke + +[ Upstream commit 53122a49f49796beb2c4a1bb702303b66347e29f ] + +We should set the status to FC_TIMED_OUT when a timeout error is passed to +fc_fcp_rec_error(). + +Signed-off-by: Hannes Reinecke +Link: https://lore.kernel.org/r/20231129165832.224100-3-hare@kernel.org +Reviewed-by: Christoph Hellwig +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libfc/fc_fcp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c +index 3f189cedf6db..05be0810b5e3 100644 +--- a/drivers/scsi/libfc/fc_fcp.c ++++ b/drivers/scsi/libfc/fc_fcp.c +@@ -1676,7 +1676,7 @@ static void fc_fcp_rec_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp) + if (fsp->recov_retry++ < FC_MAX_RECOV_RETRY) + fc_fcp_rec(fsp); + else +- fc_fcp_recovery(fsp, FC_ERROR); ++ fc_fcp_recovery(fsp, FC_TIMED_OUT); + break; + } + fc_fcp_unlock_pkt(fsp); +-- +2.43.0 + diff --git a/queue-6.6/scsi-lpfc-fix-possible-file-string-name-overflow-whe.patch b/queue-6.6/scsi-lpfc-fix-possible-file-string-name-overflow-whe.patch new file mode 100644 index 00000000000..ca91be7272a --- /dev/null +++ b/queue-6.6/scsi-lpfc-fix-possible-file-string-name-overflow-whe.patch @@ -0,0 +1,64 @@ +From 5f845afa259e2e8d6f3fef19c46b864d92899f82 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Oct 2023 12:12:17 -0700 +Subject: scsi: lpfc: Fix possible file string name overflow when updating + firmware + +From: Justin Tee + +[ Upstream commit f5779b529240b715f0e358489ad0ed933bf77c97 ] + +Because file_name and phba->ModelName are both declared a size 80 bytes, +the extra ".grp" file extension could cause an overflow into file_name. + +Define a ELX_FW_NAME_SIZE macro with value 84. 84 incorporates the 4 extra +characters from ".grp". file_name is changed to be declared as a char and +initialized to zeros i.e. null chars. + +Signed-off-by: Justin Tee +Link: https://lore.kernel.org/r/20231031191224.150862-3-justintee8345@gmail.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc.h | 1 + + drivers/scsi/lpfc/lpfc_init.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h +index af15f7a22d25..04d608ea9106 100644 +--- a/drivers/scsi/lpfc/lpfc.h ++++ b/drivers/scsi/lpfc/lpfc.h +@@ -33,6 +33,7 @@ + struct lpfc_sli2_slim; + + #define ELX_MODEL_NAME_SIZE 80 ++#define ELX_FW_NAME_SIZE 84 + + #define LPFC_PCI_DEV_LP 0x1 + #define LPFC_PCI_DEV_OC 0x2 +diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c +index 9e59c050103d..2c336953e56c 100644 +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -14725,7 +14725,7 @@ lpfc_write_firmware(const struct firmware *fw, void *context) + int + lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) + { +- uint8_t file_name[ELX_MODEL_NAME_SIZE]; ++ char file_name[ELX_FW_NAME_SIZE] = {0}; + int ret; + const struct firmware *fw; + +@@ -14734,7 +14734,7 @@ lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) + LPFC_SLI_INTF_IF_TYPE_2) + return -EPERM; + +- snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); ++ scnprintf(file_name, sizeof(file_name), "%s.grp", phba->ModelName); + + if (fw_upgrade == INT_FW_UPGRADE) { + ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT, +-- +2.43.0 + diff --git a/queue-6.6/scsi-lpfc-move-determination-of-vmid_flag-after-vmid.patch b/queue-6.6/scsi-lpfc-move-determination-of-vmid_flag-after-vmid.patch new file mode 100644 index 00000000000..cf4d1e548c7 --- /dev/null +++ b/queue-6.6/scsi-lpfc-move-determination-of-vmid_flag-after-vmid.patch @@ -0,0 +1,62 @@ +From 56e8023b024285e780e0c844b2e04265f7db1b70 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 14:40:38 -0800 +Subject: scsi: lpfc: Move determination of vmid_flag after VMID + reinitialization completes + +From: Justin Tee + +[ Upstream commit aba0fb0ef607a71511d23a07406f11130c1a54c5 ] + +If priority tagging is set in the service parameters of a FLOGI cmpl, then +we update the vmid_flag. In the current logic, if a follow up FLOGI cmpl +updates its service parameters such that priority tagging is no longer set, +then the vmid_flag ends up keeping stale data. + +Fix by ensuring we clear the vmid_flag member during lpfc_reinit_vmid, and +check the priority tagging service parameter after reinitialization of the +vmid data structures. + +Signed-off-by: Justin Tee +Link: https://lore.kernel.org/r/20231207224039.35466-4-justintee8345@gmail.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_els.c | 6 +++--- + drivers/scsi/lpfc/lpfc_vmid.c | 1 + + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c +index 932d47951cf3..18b8325fd419 100644 +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -1119,12 +1119,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, + vport->port_state, vport->fc_flag, + sp->cmn.priority_tagging, kref_read(&ndlp->kref)); + +- if (sp->cmn.priority_tagging) +- vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA | +- LPFC_VMID_TYPE_PRIO); + /* reinitialize the VMID datastructure before returning */ + if (lpfc_is_vmid_enabled(phba)) + lpfc_reinit_vmid(vport); ++ if (sp->cmn.priority_tagging) ++ vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA | ++ LPFC_VMID_TYPE_PRIO); + + /* + * Address a timing race with dev_loss. If dev_loss is active on +diff --git a/drivers/scsi/lpfc/lpfc_vmid.c b/drivers/scsi/lpfc/lpfc_vmid.c +index cf8ba840d0ea..773e02ae20c3 100644 +--- a/drivers/scsi/lpfc/lpfc_vmid.c ++++ b/drivers/scsi/lpfc/lpfc_vmid.c +@@ -321,5 +321,6 @@ lpfc_reinit_vmid(struct lpfc_vport *vport) + if (!hash_empty(vport->hash_table)) + hash_for_each_safe(vport->hash_table, bucket, tmp, cur, hnode) + hash_del(&cur->hnode); ++ vport->vmid_flag = 0; + write_unlock(&vport->vmid_lock); + } +-- +2.43.0 + diff --git a/queue-6.6/scsi-lpfc-reinitialize-an-npiv-s-vmid-data-structure.patch b/queue-6.6/scsi-lpfc-reinitialize-an-npiv-s-vmid-data-structure.patch new file mode 100644 index 00000000000..addf78bc5e2 --- /dev/null +++ b/queue-6.6/scsi-lpfc-reinitialize-an-npiv-s-vmid-data-structure.patch @@ -0,0 +1,45 @@ +From bcf0ed1bcc1674f782ce8f393f79439709356cf6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Dec 2023 14:40:37 -0800 +Subject: scsi: lpfc: Reinitialize an NPIV's VMID data structures after FDISC + +From: Justin Tee + +[ Upstream commit 8dc8eb89f4df74593ba4bf30c3d31a0fc6d3ea47 ] + +After a follow up FDISC cmpl, an NPIV's VMID data structures are not +updated. + +Fix by calling lpfc_reinit_vmid and copying the physical port's vmid_flag +to the NPIV's vmid_flag in the NPIV registration cmpl code path. + +Signed-off-by: Justin Tee +Link: https://lore.kernel.org/r/20231207224039.35466-3-justintee8345@gmail.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_els.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c +index 54e47f268235..932d47951cf3 100644 +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -11110,6 +11110,14 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) + lpfc_nlp_put(ndlp); + + mempool_free(pmb, phba->mbox_mem_pool); ++ ++ /* reinitialize the VMID datastructure before returning. ++ * this is specifically for vport ++ */ ++ if (lpfc_is_vmid_enabled(phba)) ++ lpfc_reinit_vmid(vport); ++ vport->vmid_flag = vport->phba->pport->vmid_flag; ++ + return; + } + +-- +2.43.0 + diff --git a/queue-6.6/scsi-mpi3mr-add-pci-checks-where-sas5116-diverges-fr.patch b/queue-6.6/scsi-mpi3mr-add-pci-checks-where-sas5116-diverges-fr.patch new file mode 100644 index 00000000000..d4c6f78114a --- /dev/null +++ b/queue-6.6/scsi-mpi3mr-add-pci-checks-where-sas5116-diverges-fr.patch @@ -0,0 +1,54 @@ +From 5b8a327b8ad79672a9b095e163d4dcb429ea6e8c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 21:31:29 +0530 +Subject: scsi: mpi3mr: Add PCI checks where SAS5116 diverges from SAS4116 + +From: Sumit Saxena + +[ Upstream commit c9260ff28ee561fca5f96425c9328a9698e8427b ] + +Add PCI IDs checks for the cases where SAS5116 diverges from SAS4116 in +behavior. + +Signed-off-by: Sumit Saxena +Link: https://lore.kernel.org/r/20231123160132.4155-3-sumit.saxena@broadcom.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/mpi3mr/mpi3mr_fw.c | 3 ++- + drivers/scsi/mpi3mr/mpi3mr_os.c | 5 ++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c +index f039f1d98647..0d148c39ebcc 100644 +--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c ++++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c +@@ -1892,7 +1892,8 @@ static int mpi3mr_create_op_reply_q(struct mpi3mr_ioc *mrioc, u16 qidx) + + reply_qid = qidx + 1; + op_reply_q->num_replies = MPI3MR_OP_REP_Q_QD; +- if (!mrioc->pdev->revision) ++ if ((mrioc->pdev->device == MPI3_MFGPAGE_DEVID_SAS4116) && ++ !mrioc->pdev->revision) + op_reply_q->num_replies = MPI3MR_OP_REP_Q_QD4K; + op_reply_q->ci = 0; + op_reply_q->ephase = 1; +diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c +index 5c50701aa3f7..80d71041086e 100644 +--- a/drivers/scsi/mpi3mr/mpi3mr_os.c ++++ b/drivers/scsi/mpi3mr/mpi3mr_os.c +@@ -5095,7 +5095,10 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) + mpi3mr_init_drv_cmd(&mrioc->evtack_cmds[i], + MPI3MR_HOSTTAG_EVTACKCMD_MIN + i); + +- if (pdev->revision) ++ if ((pdev->device == MPI3_MFGPAGE_DEVID_SAS4116) && ++ !pdev->revision) ++ mrioc->enable_segqueue = false; ++ else + mrioc->enable_segqueue = true; + + init_waitqueue_head(&mrioc->reset_waitq); +-- +2.43.0 + diff --git a/queue-6.6/scsi-mpi3mr-add-support-for-sas5116-pci-ids.patch b/queue-6.6/scsi-mpi3mr-add-support-for-sas5116-pci-ids.patch new file mode 100644 index 00000000000..c1940389a73 --- /dev/null +++ b/queue-6.6/scsi-mpi3mr-add-support-for-sas5116-pci-ids.patch @@ -0,0 +1,41 @@ +From 8639e1d5be7edfaefbd60fb31f60bffd82006ef6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 21:31:28 +0530 +Subject: scsi: mpi3mr: Add support for SAS5116 PCI IDs + +From: Sumit Saxena + +[ Upstream commit 6fa21eab82be57a3ad2470fac27b982793805336 ] + +Add support for Broadcom's SAS5116 IO/RAID controllers PCI IDs. + +Signed-off-by: Sumit Saxena +Link: https://lore.kernel.org/r/20231123160132.4155-2-sumit.saxena@broadcom.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/mpi3mr/mpi3mr_os.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c +index c7c75257425d..5c50701aa3f7 100644 +--- a/drivers/scsi/mpi3mr/mpi3mr_os.c ++++ b/drivers/scsi/mpi3mr/mpi3mr_os.c +@@ -5424,6 +5424,14 @@ static const struct pci_device_id mpi3mr_pci_id_table[] = { + PCI_DEVICE_SUB(MPI3_MFGPAGE_VENDORID_BROADCOM, + MPI3_MFGPAGE_DEVID_SAS4116, PCI_ANY_ID, PCI_ANY_ID) + }, ++ { ++ PCI_DEVICE_SUB(MPI3_MFGPAGE_VENDORID_BROADCOM, ++ MPI3_MFGPAGE_DEVID_SAS5116_MPI, PCI_ANY_ID, PCI_ANY_ID) ++ }, ++ { ++ PCI_DEVICE_SUB(MPI3_MFGPAGE_VENDORID_BROADCOM, ++ MPI3_MFGPAGE_DEVID_SAS5116_MPI_MGMT, PCI_ANY_ID, PCI_ANY_ID) ++ }, + { 0 } + }; + MODULE_DEVICE_TABLE(pci, mpi3mr_pci_id_table); +-- +2.43.0 + diff --git a/queue-6.6/selftests-bpf-fix-compiler-warnings-in-release-1-mod.patch b/queue-6.6/selftests-bpf-fix-compiler-warnings-in-release-1-mod.patch new file mode 100644 index 00000000000..6be61e3a11d --- /dev/null +++ b/queue-6.6/selftests-bpf-fix-compiler-warnings-in-release-1-mod.patch @@ -0,0 +1,52 @@ +From 04e273ee4464c8fa68c0fe73d94f0a1c14210e99 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 14:53:43 -0800 +Subject: selftests/bpf: fix compiler warnings in RELEASE=1 mode + +From: Andrii Nakryiko + +[ Upstream commit 62d9a969f4a95219c757831e9ad66cd4dd9edee5 ] + +When compiling BPF selftests with RELEASE=1, we get two new +warnings, which are treated as errors. Fix them. + +Signed-off-by: Andrii Nakryiko +Acked-by: Yonghong Song +Acked-by: John Fastabend +Link: https://lore.kernel.org/r/20231212225343.1723081-1-andrii@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/veristat.c | 2 +- + tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c +index 655095810d4a..0ad98b6a8e6e 100644 +--- a/tools/testing/selftests/bpf/veristat.c ++++ b/tools/testing/selftests/bpf/veristat.c +@@ -1214,7 +1214,7 @@ static int cmp_join_stat(const struct verif_stats_join *s1, + enum stat_id id, enum stat_variant var, bool asc) + { + const char *str1 = NULL, *str2 = NULL; +- double v1, v2; ++ double v1 = 0.0, v2 = 0.0; + int cmp = 0; + + fetch_join_stat_value(s1, id, var, &str1, &v1); +diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c +index 613321eb84c1..adb77c1a6a74 100644 +--- a/tools/testing/selftests/bpf/xdp_hw_metadata.c ++++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c +@@ -68,7 +68,7 @@ static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id) + .frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE, + .flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG, + }; +- __u32 idx; ++ __u32 idx = 0; + u64 addr; + int ret; + int i; +-- +2.43.0 + diff --git a/queue-6.6/selftests-bpf-fix-issues-in-setup_classid_environmen.patch b/queue-6.6/selftests-bpf-fix-issues-in-setup_classid_environmen.patch new file mode 100644 index 00000000000..ce5309ceabd --- /dev/null +++ b/queue-6.6/selftests-bpf-fix-issues-in-setup_classid_environmen.patch @@ -0,0 +1,85 @@ +From 314a6a0a14c58d4edbe3cb3b22ba7a425c973414 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 11 Nov 2023 09:00:30 +0000 +Subject: selftests/bpf: Fix issues in setup_classid_environment() + +From: Yafang Shao + +[ Upstream commit 4849775587844e44d215289c425bcd70f315efe7 ] + +If the net_cls subsystem is already mounted, attempting to mount it again +in setup_classid_environment() will result in a failure with the error code +EBUSY. Despite this, tmpfs will have been successfully mounted at +/sys/fs/cgroup/net_cls. Consequently, the /sys/fs/cgroup/net_cls directory +will be empty, causing subsequent setup operations to fail. + +Here's an error log excerpt illustrating the issue when net_cls has already +been mounted at /sys/fs/cgroup/net_cls prior to running +setup_classid_environment(): + +- Before that change + + $ tools/testing/selftests/bpf/test_progs --name=cgroup_v1v2 + test_cgroup_v1v2:PASS:server_fd 0 nsec + test_cgroup_v1v2:PASS:client_fd 0 nsec + test_cgroup_v1v2:PASS:cgroup_fd 0 nsec + test_cgroup_v1v2:PASS:server_fd 0 nsec + run_test:PASS:skel_open 0 nsec + run_test:PASS:prog_attach 0 nsec + test_cgroup_v1v2:PASS:cgroup-v2-only 0 nsec + (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup.procs + (cgroup_helpers.c:540: errno: No such file or directory) Opening cgroup classid: /sys/fs/cgroup/net_cls/cgroup-test-work-dir/net_cls.classid + run_test:PASS:skel_open 0 nsec + run_test:PASS:prog_attach 0 nsec + (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup-test-work-dir/cgroup.procs + run_test:FAIL:join_classid unexpected error: 1 (errno 2) + test_cgroup_v1v2:FAIL:cgroup-v1v2 unexpected error: -1 (errno 2) + (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup.procs + #44 cgroup_v1v2:FAIL + Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED + +- After that change + $ tools/testing/selftests/bpf/test_progs --name=cgroup_v1v2 + #44 cgroup_v1v2:OK + Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED + +Signed-off-by: Yafang Shao +Link: https://lore.kernel.org/r/20231111090034.4248-3-laoar.shao@gmail.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/cgroup_helpers.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c +index 2caee8423ee0..f68fbc6c3f52 100644 +--- a/tools/testing/selftests/bpf/cgroup_helpers.c ++++ b/tools/testing/selftests/bpf/cgroup_helpers.c +@@ -499,10 +499,20 @@ int setup_classid_environment(void) + return 1; + } + +- if (mount("net_cls", NETCLS_MOUNT_PATH, "cgroup", 0, "net_cls") && +- errno != EBUSY) { +- log_err("mount cgroup net_cls"); +- return 1; ++ if (mount("net_cls", NETCLS_MOUNT_PATH, "cgroup", 0, "net_cls")) { ++ if (errno != EBUSY) { ++ log_err("mount cgroup net_cls"); ++ return 1; ++ } ++ ++ if (rmdir(NETCLS_MOUNT_PATH)) { ++ log_err("rmdir cgroup net_cls"); ++ return 1; ++ } ++ if (umount(CGROUP_MOUNT_DFLT)) { ++ log_err("umount cgroup base"); ++ return 1; ++ } + } + + cleanup_classid_environment(); +-- +2.43.0 + diff --git a/queue-6.6/selftests-bpf-fix-pyperf180-compilation-failure-with.patch b/queue-6.6/selftests-bpf-fix-pyperf180-compilation-failure-with.patch new file mode 100644 index 00000000000..6a21ff55fec --- /dev/null +++ b/queue-6.6/selftests-bpf-fix-pyperf180-compilation-failure-with.patch @@ -0,0 +1,83 @@ +From 42c00145fc49eb0c15f1cdd726e7bdccdc81b296 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Nov 2023 11:36:44 -0800 +Subject: selftests/bpf: Fix pyperf180 compilation failure with clang18 + +From: Yonghong Song + +[ Upstream commit 100888fb6d8a185866b1520031ee7e3182b173de ] + +With latest clang18 (main branch of llvm-project repo), when building bpf selftests, + [~/work/bpf-next (master)]$ make -C tools/testing/selftests/bpf LLVM=1 -j + +The following compilation error happens: + fatal error: error in backend: Branch target out of insn range + ... + Stack dump: + 0. Program arguments: clang -g -Wall -Werror -D__TARGET_ARCH_x86 -mlittle-endian + -I/home/yhs/work/bpf-next/tools/testing/selftests/bpf/tools/include + -I/home/yhs/work/bpf-next/tools/testing/selftests/bpf -I/home/yhs/work/bpf-next/tools/include/uapi + -I/home/yhs/work/bpf-next/tools/testing/selftests/usr/include -idirafter + /home/yhs/work/llvm-project/llvm/build.18/install/lib/clang/18/include -idirafter /usr/local/include + -idirafter /usr/include -Wno-compare-distinct-pointer-types -DENABLE_ATOMICS_TESTS -O2 --target=bpf + -c progs/pyperf180.c -mcpu=v3 -o /home/yhs/work/bpf-next/tools/testing/selftests/bpf/pyperf180.bpf.o + 1. parser at end of file + 2. Code generation + ... + +The compilation failure only happens to cpu=v2 and cpu=v3. cpu=v4 is okay +since cpu=v4 supports 32-bit branch target offset. + +The above failure is due to upstream llvm patch [1] where some inlining behavior +are changed in clang18. + +To workaround the issue, previously all 180 loop iterations are fully unrolled. +The bpf macro __BPF_CPU_VERSION__ (implemented in clang18 recently) is used to avoid +unrolling changes if cpu=v4. If __BPF_CPU_VERSION__ is not available and the +compiler is clang18, the unrollng amount is unconditionally reduced. + + [1] https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16e + +Signed-off-by: Yonghong Song +Signed-off-by: Andrii Nakryiko +Tested-by: Alan Maguire +Link: https://lore.kernel.org/bpf/20231110193644.3130906-1-yonghong.song@linux.dev +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/progs/pyperf180.c | 22 +++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/tools/testing/selftests/bpf/progs/pyperf180.c b/tools/testing/selftests/bpf/progs/pyperf180.c +index c39f559d3100..42c4a8b62e36 100644 +--- a/tools/testing/selftests/bpf/progs/pyperf180.c ++++ b/tools/testing/selftests/bpf/progs/pyperf180.c +@@ -1,4 +1,26 @@ + // SPDX-License-Identifier: GPL-2.0 + // Copyright (c) 2019 Facebook + #define STACK_MAX_LEN 180 ++ ++/* llvm upstream commit at clang18 ++ * https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16e ++ * changed inlining behavior and caused compilation failure as some branch ++ * target distance exceeded 16bit representation which is the maximum for ++ * cpu v1/v2/v3. Macro __BPF_CPU_VERSION__ is later implemented in clang18 ++ * to specify which cpu version is used for compilation. So a smaller ++ * unroll_count can be set if __BPF_CPU_VERSION__ is less than 4, which ++ * reduced some branch target distances and resolved the compilation failure. ++ * ++ * To capture the case where a developer/ci uses clang18 but the corresponding ++ * repo checkpoint does not have __BPF_CPU_VERSION__, a smaller unroll_count ++ * will be set as well to prevent potential compilation failures. ++ */ ++#ifdef __BPF_CPU_VERSION__ ++#if __BPF_CPU_VERSION__ < 4 ++#define UNROLL_COUNT 90 ++#endif ++#elif __clang_major__ == 18 ++#define UNROLL_COUNT 90 ++#endif ++ + #include "pyperf.h" +-- +2.43.0 + diff --git a/queue-6.6/selftests-bpf-fix-release-1-build-for-tc_opts.patch b/queue-6.6/selftests-bpf-fix-release-1-build-for-tc_opts.patch new file mode 100644 index 00000000000..d1193ded583 --- /dev/null +++ b/queue-6.6/selftests-bpf-fix-release-1-build-for-tc_opts.patch @@ -0,0 +1,50 @@ +From 1a84a3af96fa6497d9b09683c7e3f67c8480078f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Nov 2023 20:37:43 -0700 +Subject: selftests/bpf: fix RELEASE=1 build for tc_opts + +From: Andrii Nakryiko + +[ Upstream commit 2b62aa59d02ed281fa4fc218df3ca91b773e1e62 ] + +Compiler complains about malloc(). We also don't need to dynamically +allocate anything, so make the life easier by using statically sized +buffer. + +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/r/20231102033759.2541186-2-andrii@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/prog_tests/tc_opts.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/tools/testing/selftests/bpf/prog_tests/tc_opts.c b/tools/testing/selftests/bpf/prog_tests/tc_opts.c +index ca506d2fcf58..d6fd09c2d6e6 100644 +--- a/tools/testing/selftests/bpf/prog_tests/tc_opts.c ++++ b/tools/testing/selftests/bpf/prog_tests/tc_opts.c +@@ -2387,12 +2387,9 @@ static int generate_dummy_prog(void) + const size_t prog_insn_cnt = sizeof(prog_insns) / sizeof(struct bpf_insn); + LIBBPF_OPTS(bpf_prog_load_opts, opts); + const size_t log_buf_sz = 256; +- char *log_buf; ++ char log_buf[log_buf_sz]; + int fd = -1; + +- log_buf = malloc(log_buf_sz); +- if (!ASSERT_OK_PTR(log_buf, "log_buf_alloc")) +- return fd; + opts.log_buf = log_buf; + opts.log_size = log_buf_sz; + +@@ -2402,7 +2399,6 @@ static int generate_dummy_prog(void) + prog_insns, prog_insn_cnt, &opts); + ASSERT_STREQ(log_buf, "", "log_0"); + ASSERT_GE(fd, 0, "prog_fd"); +- free(log_buf); + return fd; + } + +-- +2.43.0 + diff --git a/queue-6.6/selftests-bpf-satisfy-compiler-by-having-explicit-re.patch b/queue-6.6/selftests-bpf-satisfy-compiler-by-having-explicit-re.patch new file mode 100644 index 00000000000..aa4050e380f --- /dev/null +++ b/queue-6.6/selftests-bpf-satisfy-compiler-by-having-explicit-re.patch @@ -0,0 +1,35 @@ +From 31e55dc78509d99d6df7e0f468d0e530a8335a95 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Nov 2023 20:37:44 -0700 +Subject: selftests/bpf: satisfy compiler by having explicit return in btf test + +From: Andrii Nakryiko + +[ Upstream commit f4c7e887324f5776eef6e6e47a90e0ac8058a7a8 ] + +Some compilers complain about get_pprint_mapv_size() not returning value +in some code paths. Fix with explicit return. + +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/r/20231102033759.2541186-3-andrii@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/prog_tests/btf.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c +index 4e0cdb593318..1b8e967f2604 100644 +--- a/tools/testing/selftests/bpf/prog_tests/btf.c ++++ b/tools/testing/selftests/bpf/prog_tests/btf.c +@@ -5265,6 +5265,7 @@ static size_t get_pprint_mapv_size(enum pprint_mapv_kind_t mapv_kind) + #endif + + assert(0); ++ return 0; + } + + static void set_pprint_mapv(enum pprint_mapv_kind_t mapv_kind, +-- +2.43.0 + diff --git a/queue-6.6/selftests-nolibc-fix-testcase-status-alignment.patch b/queue-6.6/selftests-nolibc-fix-testcase-status-alignment.patch new file mode 100644 index 00000000000..fb374adb100 --- /dev/null +++ b/queue-6.6/selftests-nolibc-fix-testcase-status-alignment.patch @@ -0,0 +1,63 @@ +From 88d6475013d19d55440db1bcc9b08aa68bb273eb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Nov 2023 15:16:38 +0100 +Subject: selftests/nolibc: fix testcase status alignment +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Thomas Weißschuh + +[ Upstream commit 07f679b50252dc9e3d0c19aca5801f82c230c527 ] + +Center-align all possible status reports. +Before OK and FAIL were center-aligned in relation to each other but +SKIPPED and FAILED would be left-aligned. + +Before: + +7 environ_addr = <0x7fffef3e7c50> [OK] +8 environ_envp = <0x7fffef3e7c58> [FAIL] +9 environ_auxv [SKIPPED] +10 environ_total [SKIPPED] +11 environ_HOME = <0x7fffef3e99bd> [OK] +12 auxv_addr [SKIPPED] +13 auxv_AT_UID = 1000 [OK] + +After: + +7 environ_addr = <0x7ffff13b00a0> [OK] +8 environ_envp = <0x7ffff13b00a8> [FAIL] +9 environ_auxv [SKIPPED] +10 environ_total [SKIPPED] +11 environ_HOME = <0x7ffff13b19bd> [OK] +12 auxv_addr [SKIPPED] +13 auxv_AT_UID = 1000 [OK] + +Signed-off-by: Thomas Weißschuh +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c +index fb3bf91462e2..1fc4998f06bf 100644 +--- a/tools/testing/selftests/nolibc/nolibc-test.c ++++ b/tools/testing/selftests/nolibc/nolibc-test.c +@@ -145,11 +145,11 @@ static void result(int llen, enum RESULT r) + const char *msg; + + if (r == OK) +- msg = " [OK]"; ++ msg = " [OK]"; + else if (r == SKIPPED) + msg = "[SKIPPED]"; + else +- msg = "[FAIL]"; ++ msg = " [FAIL]"; + + if (llen < 64) + putcharn(' ', 64 - llen); +-- +2.43.0 + diff --git a/queue-6.6/selftests-sgx-fix-linker-script-asserts.patch b/queue-6.6/selftests-sgx-fix-linker-script-asserts.patch new file mode 100644 index 00000000000..8d5e2a3b24a --- /dev/null +++ b/queue-6.6/selftests-sgx-fix-linker-script-asserts.patch @@ -0,0 +1,39 @@ +From 17c97258517a83f65d537233c3297b31fc3a1c3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Oct 2023 17:38:50 +0200 +Subject: selftests/sgx: Fix linker script asserts + +From: Jo Van Bulck + +[ Upstream commit 9fd552ee32c6c1e27c125016b87d295bea6faea7 ] + +DEFINED only considers symbols, not section names. Hence, replace the +check for .got.plt with the _GLOBAL_OFFSET_TABLE_ symbol and remove other +(non-essential) asserts. + +Signed-off-by: Jo Van Bulck +Signed-off-by: Dave Hansen +Reviewed-by: Jarkko Sakkinen +Link: https://lore.kernel.org/all/20231005153854.25566-10-jo.vanbulck%40cs.kuleuven.be +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/sgx/test_encl.lds | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/tools/testing/selftests/sgx/test_encl.lds b/tools/testing/selftests/sgx/test_encl.lds +index a1ec64f7d91f..108bc11d1d8c 100644 +--- a/tools/testing/selftests/sgx/test_encl.lds ++++ b/tools/testing/selftests/sgx/test_encl.lds +@@ -34,8 +34,4 @@ SECTIONS + } + } + +-ASSERT(!DEFINED(.altinstructions), "ALTERNATIVES are not supported in enclaves") +-ASSERT(!DEFINED(.altinstr_replacement), "ALTERNATIVES are not supported in enclaves") +-ASSERT(!DEFINED(.discard.retpoline_safe), "RETPOLINE ALTERNATIVES are not supported in enclaves") +-ASSERT(!DEFINED(.discard.nospec), "RETPOLINE ALTERNATIVES are not supported in enclaves") +-ASSERT(!DEFINED(.got.plt), "Libcalls are not supported in enclaves") ++ASSERT(!DEFINED(_GLOBAL_OFFSET_TABLE_), "Libcalls through GOT are not supported in enclaves") +-- +2.43.0 + diff --git a/queue-6.6/series b/queue-6.6/series index a5c81223cfc..da2319c6ae1 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -1 +1,268 @@ documentation-sphinx-fix-python-string-escapes.patch +asm-generic-make-sparse-happy-with-odd-sized-put_una.patch +powerpc-mm-fix-null-pointer-dereference-in-pgtable_c.patch +arm64-irq-set-the-correct-node-for-vmap-stack.patch +drivers-perf-pmuv3-don-t-expose-sw_incr-event-in-sys.patch +powerpc-fix-build-error-due-to-is_valid_bugaddr.patch +powerpc-mm-fix-build-failures-due-to-arch_reserved_k.patch +powerpc-64s-fix-config_numa-n-build-due-to-create_se.patch +x86-boot-ignore-nmis-during-very-early-boot.patch +powerpc-pmd_move_must_withdraw-is-only-needed-for-co.patch +powerpc-lib-validate-size-for-vector-operations.patch +x86-mce-mark-fatal-mce-s-page-as-poison-to-avoid-pan.patch +perf-core-fix-narrow-startup-race-when-creating-the-.patch +debugobjects-stop-accessing-objects-after-releasing-.patch +sched-topology-add-a-new-arch_scale_freq_ref-method.patch +cpufreq-use-the-fixed-and-coherent-frequency-for-sca.patch +cpufreq-schedutil-use-a-fixed-reference-frequency.patch +energy_model-use-a-fixed-reference-frequency.patch +regulator-core-only-increment-use_count-when-enable_.patch +audit-send-netlink-ack-before-setting-connection-in-.patch +acpi-video-add-quirk-for-the-colorful-x15-at-23-lapt.patch +pnp-acpi-fix-fortify-warning.patch +acpi-extlog-fix-null-pointer-dereference-check.patch +selftests-nolibc-fix-testcase-status-alignment.patch +acpi-numa-fix-the-logic-of-getting-the-fake_pxm-valu.patch +kunit-tool-fix-parsing-of-test-attributes.patch +pm-devfreq-synchronize-devfreq_monitor_-start-stop.patch +acpi-apei-set-memory-failure-flags-as-mf_action_requ.patch +thermal-core-fix-thermal-zone-suspend-resume-synchro.patch +fs-jfs-ubsan-array-index-out-of-bounds-in-dbadjtree.patch +ubsan-array-index-out-of-bounds-in-dtsplitroot.patch +jfs-fix-slab-out-of-bounds-read-in-dtsearch.patch +jfs-fix-array-index-out-of-bounds-in-dbadjtree.patch +jfs-fix-uaf-in-jfs_evict_inode.patch +hwrng-starfive-fix-dev_err_probe-return-error.patch +crypto-p10-aes-gcm-avoid-wstringop-overflow-warnings.patch +pstore-ram-fix-crash-when-setting-number-of-cpus-to-.patch +erofs-fix-up-compacted-indexes-for-block-size-4096.patch +crypto-starfive-fix-dev_err_probe-return-error.patch +crypto-octeontx2-fix-cptvf-driver-cleanup.patch +erofs-fix-ztailpacking-for-subpage-compressed-blocks.patch +crypto-stm32-crc32-fix-parsing-list-of-devices.patch +afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_lo.patch +afs-fix-the-usage-of-read_seqbegin_or_lock-in-afs_fi.patch +rxrpc_find_service_conn_rcu-fix-the-usage-of-read_se.patch +jfs-fix-array-index-out-of-bounds-in-dinewext.patch +s390-boot-always-align-vmalloc-area-on-segment-bound.patch +arch-consolidate-arch_irq_work_raise-prototypes.patch +s390-vfio-ap-fix-sysfs-status-attribute-for-ap-queue.patch +hexagon-make-pfn-accessors-statics-inlines.patch +s390-ptrace-handle-setting-of-fpc-register-correctly.patch +kvm-s390-fix-setting-of-fpc-register.patch +sysctl-fix-out-of-bounds-access-for-empty-sysctl-reg.patch +sunrpc-fix-a-suspicious-rcu-usage-warning.patch +ext4-treat-end-of-range-as-exclusive-in-ext4_zero_ra.patch +smb-client-fix-renaming-of-reparse-points.patch +smb-client-fix-hardlinking-of-reparse-points.patch +ecryptfs-reject-casefold-directory-inodes.patch +ext4-fix-inconsistent-between-segment-fstrim-and-ful.patch +ext4-unify-the-type-of-flexbg_size-to-unsigned-int.patch +ext4-remove-unnecessary-check-from-alloc_flex_gd.patch +ext4-avoid-online-resizing-failures-due-to-oversized.patch +wifi-rtw89-fix-timeout-calculation-in-rtw89_roc_end.patch +wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch +selftests-bpf-fix-release-1-build-for-tc_opts.patch +selftests-bpf-satisfy-compiler-by-having-explicit-re.patch +libbpf-fix-potential-uninitialized-tail-padding-with.patch +selftests-bpf-fix-pyperf180-compilation-failure-with.patch +wifi-rt2x00-correct-wrong-bbp-register-in-rxdcoc-cal.patch +selftests-bpf-fix-issues-in-setup_classid_environmen.patch +arm-dts-qcom-strip-prefix-from-pmic-files.patch +arm-dts-qcom-mdm9615-fix-pmic-node-labels.patch +arm-dts-qcom-msm8660-fix-pmic-node-labels.patch +arm-dts-qcom-msm8960-fix-pmic-node-labels.patch +soc-xilinx-fix-for-call-trace-due-to-the-usage-of-sm.patch +soc-xilinx-fix-unhandled-sgi-warning-message.patch +scsi-lpfc-fix-possible-file-string-name-overflow-whe.patch +arm-dts-samsung-exynos4-fix-camera-unit-addresses-ra.patch +arm-dts-samsung-s5pv210-fix-camera-unit-addresses-ra.patch +net-phy-micrel-fix-ts_info-value-in-case-of-no-phc.patch +pci-add-no-pm-reset-quirk-for-nvidia-spectrum-device.patch +bonding-return-enomem-instead-of-bug-in-alb_upper_de.patch +net-usb-ax88179_178a-avoid-two-consecutive-device-re.patch +scsi-mpi3mr-add-support-for-sas5116-pci-ids.patch +scsi-mpi3mr-add-pci-checks-where-sas5116-diverges-fr.patch +scsi-arcmsr-support-new-pci-device-ids-1883-and-1886.patch +arm-dts-imx7d-fix-coresight-funnel-ports.patch +arm-dts-imx7s-fix-lcdif-compatible.patch +arm-dts-imx7s-fix-nand-controller-size-cells.patch +bpf-fix-a-few-selftest-failures-due-to-llvm18-change.patch +wifi-ath9k-fix-potential-array-index-out-of-bounds-r.patch +wifi-ath11k-fix-race-due-to-setting-ath11k_flag_ext_.patch +wifi-rtw89-fix-misbehavior-of-tx-beacon-in-concurren.patch +bpf-check-rcu_read_lock_trace_held-before-calling-bp.patch +bpf-set-need_defer-as-false-when-clearing-fd-array-d.patch +wifi-ath12k-fix-and-enable-ap-mode-for-wcn7850.patch +scsi-libfc-don-t-schedule-abort-twice.patch +scsi-libfc-fix-up-timeout-error-in-fc_fcp_rec_error.patch +net-mvmdio-avoid-excessive-sleeps-in-polled-mode.patch +arm64-dts-qcom-sm8550-fix-soundwire-controllers-node.patch +arm64-dts-qcom-sm8450-fix-soundwire-controllers-node.patch +arm64-dts-qcom-sm8350-fix-remoteproc-interrupt-type.patch +wifi-mt76-connac-fix-eht-phy-mode-check.patch +wifi-mt76-mt7996-add-pci-ids-for-mt7992.patch +bpf-set-uattr-batch.count-as-zero-before-batched-upd.patch +wifi-wfx-fix-possible-null-pointer-dereference-in-wf.patch +wifi-ath12k-fix-the-issue-that-the-multicast-broadca.patch +arm-dts-rockchip-fix-rk3036-hdmi-ports-node.patch +arm-dts-imx25-27-eukrea-fix-rtc-node-name.patch +arm-dts-imx-use-flash-0-0-pattern.patch +arm-dts-imx27-fix-sram-node.patch +arm-dts-imx1-fix-sram-node.patch +net-phy-at803x-fix-passing-the-wrong-reference-for-c.patch +ionic-pass-opcode-to-devcmd_wait.patch +ionic-bypass-firmware-cmds-when-stuck-in-reset.patch +block-rnbd-srv-check-for-unlikely-string-overflow.patch +arm64-zynqmp-move-fixed-clock-to-for-kv260.patch +arm64-zynqmp-fix-clock-node-name-in-kv260-cards.patch +selftests-bpf-fix-compiler-warnings-in-release-1-mod.patch +arm-dts-imx25-fix-the-iim-compatible-string.patch +arm-dts-imx25-27-pass-timing0.patch +arm-dts-imx27-apf27dev-fix-led-name.patch +arm-dts-imx23-sansa-use-preferred-i2c-gpios-properti.patch +arm-dts-imx23-28-fix-the-dma-controller-node-name.patch +scsi-lpfc-reinitialize-an-npiv-s-vmid-data-structure.patch +scsi-lpfc-move-determination-of-vmid_flag-after-vmid.patch +scsi-hisi_sas-set-.phy_attached-before-notifing-phyu.patch +ice-fix-ice_aq_vsi_q_opt_rss_-register-values.patch +net-atlantic-eliminate-double-free-in-error-handling.patch +net-dsa-mv88e6xxx-fix-mv88e6352_serdes_get_stats-err.patch +arm-dts-marvell-fix-some-common-switch-mistakes.patch +arm64-dts-marvell-fix-some-common-switch-mistakes.patch +block-prevent-an-integer-overflow-in-bvec_try_merge_.patch +md-whenassemble-the-array-consult-the-superblock-of-.patch +cfi-add-cfi_noseal.patch +arm64-dts-qcom-msm8996-fix-in-ports-is-a-required-pr.patch +arm64-dts-qcom-msm8998-fix-out-ports-is-a-required-p.patch +arm64-dts-qcom-fix-coresight-warnings-in-in-ports-an.patch +ice-fix-pre-shifted-bit-usage.patch +arm64-dts-amlogic-fix-format-for-s4-uart-node.patch +wifi-rtl8xxxu-add-additional-usb-ids-for-rtl8192eu-d.patch +wifi-rtw89-coex-fix-wrong-wi-fi-role-info-and-fddt-p.patch +libbpf-fix-null-pointer-dereference-in-bpf_object__c.patch +wifi-rtlwifi-rtl8723-be-ae-using-calculate_bit_shift.patch +wifi-cfg80211-free-beacon_ies-when-overridden-from-h.patch +bluetooth-qca-set-both-wideband_speech-and-le_states.patch +bluetooth-iso-avoid-creating-child-socket-if-pa-sync.patch +bluetooth-hci_sync-fix-br-edr-wakeup-bug.patch +bluetooth-l2cap-fix-possible-multiple-reject-send.patch +net-smc-disable-seid-on-non-s390-archs-where-virtual.patch +bridge-cfm-fix-enum-typo-in-br_cc_ccm_tx_parse.patch +arm64-dts-sprd-add-clock-reference-for-pll2-on-ums51.patch +arm64-dts-sprd-change-ums512-idle-state-nodename-to-.patch +i40e-fix-vf-disable-behavior-to-block-all-traffic.patch +octeontx2-af-fix-max-npc-mcam-entry-check-while-vali.patch +net-kcm-fix-direct-access-to-bv_len.patch +net-dsa-qca8k-put-mdio-bus-of-node-on-qca8k_mdio_reg.patch +f2fs-fix-to-check-return-value-of-f2fs_reserve_new_b.patch +alsa-hda-refer-to-correct-stream-index-at-loops.patch +asoc-doc-fix-undefined-snd_soc_dapm_nopm-argument.patch +drm-fix-color-lut-rounding.patch +fast_dput-handle-underflows-gracefully.patch +reiserfs-avoid-touching-renamed-directory-if-parent-.patch +rdma-ipoib-fix-error-code-return-in-ipoib_mcast_join.patch +drm-panel-edp-add-override_edid_mode-quirk-for-gener.patch +drm-bridge-anx7625-fix-set-hpd-irq-detect-window-to-.patch +drm-amd-display-fix-tiled-display-misalignment.patch +media-renesas-vsp1-fix-references-to-pad-config.patch +f2fs-fix-write-pointers-on-zoned-device-after-roll-f.patch +asoc-amd-add-new-dmi-entries-for-acp5x-platform.patch +drm-amd-display-fix-mst-pbn-x.y-value-calculations.patch +drm-drm_file-fix-use-of-uninitialized-variable.patch +drm-framebuffer-fix-use-of-uninitialized-variable.patch +drm-mipi-dsi-fix-detach-call-without-attach.patch +media-stk1160-fixed-high-volume-of-stk1160_dbg-messa.patch +media-rockchip-rga-fix-swizzling-for-rgb-formats.patch +pci-add-intel_hda_arl-to-pci_ids.h.patch +alsa-hda-intel-add-hda_arl-pci-id-support.patch +alsa-hda-intel-dspcfg-add-filters-for-arl-s-and-arl.patch +drm-msm-dp-add-displayport-controller-for-sm8650.patch +media-uvcvideo-fix-power-line-control-for-a-chicony-.patch +media-uvcvideo-fix-power-line-control-for-sunplusit-.patch +media-rkisp1-drop-irqf_shared.patch +media-rkisp1-fix-irq-handler-return-values.patch +media-rkisp1-store-irq-lines.patch +media-rkisp1-fix-irq-disable-race-issue.patch +media-rkisp1-resizer-stop-manual-allocation-of-v4l2_.patch +hwmon-nct6775-fix-fan-speed-set-failure-in-automatic.patch +hwmon-pc87360-bounds-check-data-innr-usage.patch +hwmon-hp-wmi-sensors-fix-failure-to-load-on-elitedes.patch +f2fs-fix-to-tag-gcing-flag-on-page-during-block-migr.patch +drm-exynos-call-drm_atomic_helper_shutdown-at-shutdo.patch +ib-ipoib-fix-mcast-list-locking.patch +media-amphion-remove-mutext-lock-in-condition-of-wai.patch +media-ddbridge-fix-an-error-code-problem-in-ddb_prob.patch +media-i2c-imx335-fix-hblank-min-max-values.patch +drm-amd-display-for-prefetch-mode-0-extend-prefetch-.patch +drm-amd-display-force-p-state-disallow-if-leaving-no.patch +drm-amdkfd-fix-mes-set-shader-debugger-process-manag.patch +drm-msm-dpu-enable-writeback-on-sm8350.patch +drm-msm-dpu-enable-writeback-on-sm8450.patch +drm-msm-dpu-ratelimit-framedone-timeout-msgs.patch +drm-msm-dpu-fix-writeback-programming-for-yuv-cases.patch +drm-amdgpu-fix-ftrace-event-amdgpu_bo_move-always-mo.patch +clk-hi3620-fix-memory-leak-in-hi3620_mmc_clk_init.patch +clk-mmp-pxa168-fix-memory-leak-in-pxa168_clk_init.patch +watchdog-starfive-add-lock-annotations-to-fix-contex.patch +watchdog-it87_wdt-keep-wdtctrl-bit-3-unmodified-for-.patch +accel-habanalabs-add-support-for-gaudi2c-device.patch +drm-amd-display-make-flip_timestamp_in_us-a-64-bit-v.patch +drm-amd-display-only-clear-symclk-otg-flag-for-hdmi.patch +clk-imx-clk-imx8qxp-fix-lvds-bypass-pixel-and-phy-cl.patch +drm-amdgpu-fix-ecc-irq-enable-disable-unpaired.patch +drm-amd-display-fix-minor-issues-in-bw-allocation-ph.patch +drm-amdgpu-let-kfd-sync-with-vm-fences.patch +drm-amd-display-fixing-stream-allocation-regression.patch +re-revert-drm-amd-display-enable-replay-for-static-s.patch +drm-amdgpu-fix-fw-from-request_firmware-not-released.patch +drm-amdgpu-drop-fence-check-in-to_amdgpu_amdkfd_fenc.patch +drm-amdkfd-fix-iterator-used-outside-loop-in-kfd_add.patch +drm-amdgpu-apply-the-rv2-system-aperture-fix-to-rn-c.patch +alsa-hda-conexant-fix-headset-auto-detect-fail-in-cx.patch +pinctrl-baytrail-fix-types-of-config-value-in-byt_pi.patch +leds-trigger-panic-don-t-register-panic-notifier-if-.patch +um-fix-naming-clash-between-uml-and-scheduler.patch +um-don-t-use-vfprintf-for-os_info.patch +um-net-fix-return-type-of-uml_net_start_xmit.patch +um-time-travel-fix-time-corruption.patch +i3c-master-cdns-update-maximum-prescaler-value-for-i.patch +riscv-make-xip-bootable-again.patch +xen-gntdev-fix-the-abuse-of-underlying-struct-page-i.patch +mfd-ti_am335x_tscadc-fix-ti-soc-dependencies.patch +mailbox-arm_mhuv2-fix-a-bug-for-mhuv2_sender_interru.patch +pci-only-override-amd-usb-controller-if-required.patch +pci-switchtec-fix-stdev_release-crash-after-surprise.patch +perf-cs-etm-bump-minimum-opencsd-version-to-ensure-a.patch +xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch +extcon-fix-possible-name-leak-in-extcon_dev_register.patch +usb-hub-replace-hardcoded-quirk-value-with-bit-macro.patch +usb-hub-add-quirk-to-decrease-in-ep-poll-interval-fo.patch +selftests-sgx-fix-linker-script-asserts.patch +tty-allow-tiocslcktrmios-with-cap_checkpoint_restore.patch +fs-kernfs-dir-obey-s_isgid.patch +spmi-mediatek-fix-uaf-on-device-remove.patch +pci-fix-64gt-s-effective-data-rate-calculation.patch +pci-aer-decode-requester-id-when-no-error-info-found.patch +9p-fix-initialisation-of-netfs_inode-for-9p.patch +usb-xhci-plat-fix-usb-disconnect-issue-after-s4.patch +misc-lis3lv02d_i2c-add-missing-setting-of-the-reg_ct.patch +libsubcmd-fix-memory-leak-in-uniq.patch +drm-amdkfd-fix-lock-dependency-warning.patch +drm-amdkfd-fix-lock-dependency-warning-with-srcu.patch +virtio_net-fix-d-directive-writing-between-1-and-11-.patch +blk-mq-fix-io-hang-from-sbitmap-wakeup-race.patch +ceph-reinitialize-mds-feature-bit-even-when-session-.patch +ceph-fix-deadlock-or-deadcode-of-misusing-dget.patch +ceph-fix-invalid-pointer-access-if-get_quota_realm-r.patch +drm-amdgpu-fix-avg-vs-input-power-reporting-on-smu7.patch +drm-amd-powerplay-fix-kzalloc-parameter-atom_tonga_p.patch +drm-amdgpu-fix-with-right-return-code-eio-in-amdgpu_.patch +drm-amdgpu-release-adev-pm.fw-before-return-in-amdgp.patch +drm-amdkfd-fix-node-null-check-in-svm_range_get_rang.patch +i2c-rk3x-adjust-mask-value-offset-for-i2c2-on-rv1126.patch +perf-fix-the-nr_addr_filters-fix.patch +wifi-cfg80211-fix-rcu-dereference-in-__cfg80211_bss_.patch +drm-using-mul_u32_u32-requires-linux-math64.h.patch +drm-amdkfd-only-flush-mes-process-context-if-mes-sup.patch +riscv-fix-build-error-on-rv32-xip.patch diff --git a/queue-6.6/smb-client-fix-hardlinking-of-reparse-points.patch b/queue-6.6/smb-client-fix-hardlinking-of-reparse-points.patch new file mode 100644 index 00000000000..106dab108c6 --- /dev/null +++ b/queue-6.6/smb-client-fix-hardlinking-of-reparse-points.patch @@ -0,0 +1,184 @@ +From 9e83eb5aa87cd4e0b8cd290eba716d7eb91784a6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 23:55:07 -0300 +Subject: smb: client: fix hardlinking of reparse points + +From: Paulo Alcantara + +[ Upstream commit 5408990aa662bcfd6ba894734023a023a16e8729 ] + +The client was sending an SMB2_CREATE request without setting +OPEN_REPARSE_POINT flag thus failing the entire hardlink operation. + +Fix this by setting OPEN_REPARSE_POINT in create options for +SMB2_CREATE request when the source inode is a repase point. + +Signed-off-by: Paulo Alcantara (SUSE) +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/cifsglob.h | 8 +++++--- + fs/smb/client/cifsproto.h | 8 +++++--- + fs/smb/client/cifssmb.c | 9 +++++---- + fs/smb/client/link.c | 4 ++-- + fs/smb/client/smb2inode.c | 33 +++++++++++++++++++++------------ + fs/smb/client/smb2proto.h | 8 +++++--- + 6 files changed, 43 insertions(+), 27 deletions(-) + +diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h +index 4d07b96038d8..942e6ece56b1 100644 +--- a/fs/smb/client/cifsglob.h ++++ b/fs/smb/client/cifsglob.h +@@ -405,9 +405,11 @@ struct smb_version_operations { + const char *from_name, const char *to_name, + struct cifs_sb_info *cifs_sb); + /* send create hardlink request */ +- int (*create_hardlink)(const unsigned int, struct cifs_tcon *, +- const char *, const char *, +- struct cifs_sb_info *); ++ int (*create_hardlink)(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb); + /* query symlink target */ + int (*query_symlink)(const unsigned int xid, + struct cifs_tcon *tcon, +diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h +index f89e6c2a4974..260a6299bddb 100644 +--- a/fs/smb/client/cifsproto.h ++++ b/fs/smb/client/cifsproto.h +@@ -443,9 +443,11 @@ extern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon, + int netfid, const char *target_name, + const struct nls_table *nls_codepage, + int remap_special_chars); +-extern int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb); ++int CIFSCreateHardLink(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb); + extern int CIFSUnixCreateHardLink(const unsigned int xid, + struct cifs_tcon *tcon, + const char *fromName, const char *toName, +diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c +index 5bdea01919e8..e9e33b0b3ac4 100644 +--- a/fs/smb/client/cifssmb.c ++++ b/fs/smb/client/cifssmb.c +@@ -2530,10 +2530,11 @@ CIFSUnixCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, + return rc; + } + +-int +-CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb) ++int CIFSCreateHardLink(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb) + { + int rc = 0; + NT_RENAME_REQ *pSMB = NULL; +diff --git a/fs/smb/client/link.c b/fs/smb/client/link.c +index c66be4904e1f..6c4ae52ddc04 100644 +--- a/fs/smb/client/link.c ++++ b/fs/smb/client/link.c +@@ -522,8 +522,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, + rc = -ENOSYS; + goto cifs_hl_exit; + } +- rc = server->ops->create_hardlink(xid, tcon, from_name, to_name, +- cifs_sb); ++ rc = server->ops->create_hardlink(xid, tcon, old_file, ++ from_name, to_name, cifs_sb); + if ((rc == -EIO) || (rc == -EINVAL)) + rc = -EOPNOTSUPP; + } +diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c +index c3e28673e0cd..6cac0b107a2d 100644 +--- a/fs/smb/client/smb2inode.c ++++ b/fs/smb/client/smb2inode.c +@@ -35,6 +35,18 @@ free_set_inf_compound(struct smb_rqst *rqst) + SMB2_close_free(&rqst[2]); + } + ++static inline __u32 file_create_options(struct dentry *dentry) ++{ ++ struct cifsInodeInfo *ci; ++ ++ if (dentry) { ++ ci = CIFS_I(d_inode(dentry)); ++ if (ci->cifsAttrs & ATTR_REPARSE) ++ return OPEN_REPARSE_POINT; ++ } ++ return 0; ++} ++ + /* + * note: If cfile is passed, the reference to it is dropped here. + * So make sure that you do not reuse cfile after return from this func. +@@ -809,15 +821,9 @@ int smb2_rename_path(const unsigned int xid, + const char *from_name, const char *to_name, + struct cifs_sb_info *cifs_sb) + { +- struct cifsInodeInfo *ci; + struct cifsFileInfo *cfile; +- __u32 co = 0; ++ __u32 co = file_create_options(source_dentry); + +- if (source_dentry) { +- ci = CIFS_I(d_inode(source_dentry)); +- if (ci->cifsAttrs & ATTR_REPARSE) +- co |= OPEN_REPARSE_POINT; +- } + drop_cached_dir_by_name(xid, tcon, from_name, cifs_sb); + cifs_get_writable_path(tcon, from_name, FIND_WR_WITH_DELETE, &cfile); + +@@ -825,13 +831,16 @@ int smb2_rename_path(const unsigned int xid, + co, DELETE, SMB2_OP_RENAME, cfile); + } + +-int +-smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb) ++int smb2_create_hardlink(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb) + { ++ __u32 co = file_create_options(source_dentry); ++ + return smb2_set_path_attr(xid, tcon, from_name, to_name, +- cifs_sb, 0, FILE_READ_ATTRIBUTES, ++ cifs_sb, co, FILE_READ_ATTRIBUTES, + SMB2_OP_HARDLINK, NULL); + } + +diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h +index 7cbf1a76b42d..a8084ce7fcbd 100644 +--- a/fs/smb/client/smb2proto.h ++++ b/fs/smb/client/smb2proto.h +@@ -85,9 +85,11 @@ int smb2_rename_path(const unsigned int xid, + struct dentry *source_dentry, + const char *from_name, const char *to_name, + struct cifs_sb_info *cifs_sb); +-extern int smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb); ++int smb2_create_hardlink(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb); + extern int smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, + struct cifs_sb_info *cifs_sb, const unsigned char *path, + char *pbuf, unsigned int *pbytes_written); +-- +2.43.0 + diff --git a/queue-6.6/smb-client-fix-renaming-of-reparse-points.patch b/queue-6.6/smb-client-fix-renaming-of-reparse-points.patch new file mode 100644 index 00000000000..2ac3fef264d --- /dev/null +++ b/queue-6.6/smb-client-fix-renaming-of-reparse-points.patch @@ -0,0 +1,215 @@ +From 1ffad0c5f1273be87101cd26c807dd4f617ee9ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 23:55:06 -0300 +Subject: smb: client: fix renaming of reparse points + +From: Paulo Alcantara + +[ Upstream commit 7435d51b7ea2ab7801279c43ecd72063e9d5c92f ] + +The client was sending an SMB2_CREATE request without setting +OPEN_REPARSE_POINT flag thus failing the entire rename operation. + +Fix this by setting OPEN_REPARSE_POINT in create options for +SMB2_CREATE request when the source inode is a repase point. + +Signed-off-by: Paulo Alcantara (SUSE) +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/cifsglob.h | 22 +++++++++++++++++----- + fs/smb/client/cifsproto.h | 7 ++++--- + fs/smb/client/cifssmb.c | 8 ++++---- + fs/smb/client/inode.c | 3 ++- + fs/smb/client/smb2inode.c | 38 +++++++++++++++++++++++--------------- + fs/smb/client/smb2proto.h | 8 +++++--- + 6 files changed, 55 insertions(+), 31 deletions(-) + +diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h +index 5e32c79f03a7..4d07b96038d8 100644 +--- a/fs/smb/client/cifsglob.h ++++ b/fs/smb/client/cifsglob.h +@@ -205,9 +205,18 @@ struct cifs_open_info_data { + }; + }; + +-#define cifs_open_data_reparse(d) \ +- ((d)->reparse_point || \ +- (le32_to_cpu((d)->fi.Attributes) & ATTR_REPARSE)) ++static inline bool cifs_open_data_reparse(struct cifs_open_info_data *data) ++{ ++ struct smb2_file_all_info *fi = &data->fi; ++ u32 attrs = le32_to_cpu(fi->Attributes); ++ bool ret; ++ ++ ret = data->reparse_point || (attrs & ATTR_REPARSE); ++ if (ret) ++ attrs |= ATTR_REPARSE; ++ fi->Attributes = cpu_to_le32(attrs); ++ return ret; ++} + + static inline void cifs_free_open_info(struct cifs_open_info_data *data) + { +@@ -390,8 +399,11 @@ struct smb_version_operations { + int (*rename_pending_delete)(const char *, struct dentry *, + const unsigned int); + /* send rename request */ +- int (*rename)(const unsigned int, struct cifs_tcon *, const char *, +- const char *, struct cifs_sb_info *); ++ int (*rename)(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb); + /* send create hardlink request */ + int (*create_hardlink)(const unsigned int, struct cifs_tcon *, + const char *, const char *, +diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h +index c00f84420559..f89e6c2a4974 100644 +--- a/fs/smb/client/cifsproto.h ++++ b/fs/smb/client/cifsproto.h +@@ -435,9 +435,10 @@ extern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon, + int remap_special_chars); + extern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon, + const char *name, struct cifs_sb_info *cifs_sb); +-extern int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb); ++int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb); + extern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon, + int netfid, const char *target_name, + const struct nls_table *nls_codepage, +diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c +index 9ee348e6d106..5bdea01919e8 100644 +--- a/fs/smb/client/cifssmb.c ++++ b/fs/smb/client/cifssmb.c +@@ -2149,10 +2149,10 @@ CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon, int smb_file_id) + return rc; + } + +-int +-CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb) ++int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb) + { + int rc = 0; + RENAME_REQ *pSMB = NULL; +diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c +index 09c5c0f5c96e..eb54e4893777 100644 +--- a/fs/smb/client/inode.c ++++ b/fs/smb/client/inode.c +@@ -2219,7 +2219,8 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, + return -ENOSYS; + + /* try path-based rename first */ +- rc = server->ops->rename(xid, tcon, from_path, to_path, cifs_sb); ++ rc = server->ops->rename(xid, tcon, from_dentry, ++ from_path, to_path, cifs_sb); + + /* + * Don't bother with rename by filehandle unless file is busy and +diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c +index c94940af5d4b..c3e28673e0cd 100644 +--- a/fs/smb/client/smb2inode.c ++++ b/fs/smb/client/smb2inode.c +@@ -781,11 +781,11 @@ smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name, + ACL_NO_MODE, NULL, SMB2_OP_DELETE, NULL, NULL, NULL, NULL, NULL); + } + +-static int +-smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb, __u32 access, int command, +- struct cifsFileInfo *cfile) ++static int smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb, ++ __u32 create_options, __u32 access, ++ int command, struct cifsFileInfo *cfile) + { + __le16 *smb2_to_name = NULL; + int rc; +@@ -796,25 +796,33 @@ smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon, + goto smb2_rename_path; + } + rc = smb2_compound_op(xid, tcon, cifs_sb, from_name, access, +- FILE_OPEN, 0, ACL_NO_MODE, smb2_to_name, ++ FILE_OPEN, create_options, ACL_NO_MODE, smb2_to_name, + command, cfile, NULL, NULL, NULL, NULL); + smb2_rename_path: + kfree(smb2_to_name); + return rc; + } + +-int +-smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb) ++int smb2_rename_path(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb) + { ++ struct cifsInodeInfo *ci; + struct cifsFileInfo *cfile; ++ __u32 co = 0; + ++ if (source_dentry) { ++ ci = CIFS_I(d_inode(source_dentry)); ++ if (ci->cifsAttrs & ATTR_REPARSE) ++ co |= OPEN_REPARSE_POINT; ++ } + drop_cached_dir_by_name(xid, tcon, from_name, cifs_sb); + cifs_get_writable_path(tcon, from_name, FIND_WR_WITH_DELETE, &cfile); + +- return smb2_set_path_attr(xid, tcon, from_name, to_name, +- cifs_sb, DELETE, SMB2_OP_RENAME, cfile); ++ return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb, ++ co, DELETE, SMB2_OP_RENAME, cfile); + } + + int +@@ -822,9 +830,9 @@ smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, + const char *from_name, const char *to_name, + struct cifs_sb_info *cifs_sb) + { +- return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb, +- FILE_READ_ATTRIBUTES, SMB2_OP_HARDLINK, +- NULL); ++ return smb2_set_path_attr(xid, tcon, from_name, to_name, ++ cifs_sb, 0, FILE_READ_ATTRIBUTES, ++ SMB2_OP_HARDLINK, NULL); + } + + int +diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h +index 0e371f7e2854..7cbf1a76b42d 100644 +--- a/fs/smb/client/smb2proto.h ++++ b/fs/smb/client/smb2proto.h +@@ -80,9 +80,11 @@ extern int smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, + const char *name, struct cifs_sb_info *cifs_sb); + extern int smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, + const char *name, struct cifs_sb_info *cifs_sb); +-extern int smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon, +- const char *from_name, const char *to_name, +- struct cifs_sb_info *cifs_sb); ++int smb2_rename_path(const unsigned int xid, ++ struct cifs_tcon *tcon, ++ struct dentry *source_dentry, ++ const char *from_name, const char *to_name, ++ struct cifs_sb_info *cifs_sb); + extern int smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, + const char *from_name, const char *to_name, + struct cifs_sb_info *cifs_sb); +-- +2.43.0 + diff --git a/queue-6.6/soc-xilinx-fix-for-call-trace-due-to-the-usage-of-sm.patch b/queue-6.6/soc-xilinx-fix-for-call-trace-due-to-the-usage-of-sm.patch new file mode 100644 index 00000000000..6c0a5642aab --- /dev/null +++ b/queue-6.6/soc-xilinx-fix-for-call-trace-due-to-the-usage-of-sm.patch @@ -0,0 +1,70 @@ +From 8353882184983cfe4bf19f73729f0dbf8d32f8cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Oct 2023 22:56:22 -0700 +Subject: soc: xilinx: Fix for call trace due to the usage of + smp_processor_id() + +From: HariBabu Gattem + +[ Upstream commit daed80ed07580e5adc0e6d8bc79933a35154135a ] + +When preemption is enabled in kernel and if any task which can be +preempted should not use smp_processor_id() directly, since CPU +switch can happen at any time, the previous value of cpu_id +differs with current cpu_id. As a result we see the below call trace +during xlnx_event_manager_probe. + +[ 6.140197] dump_backtrace+0x0/0x190 +[ 6.143884] show_stack+0x18/0x40 +[ 6.147220] dump_stack_lvl+0x7c/0xa0 +[ 6.150907] dump_stack+0x18/0x34 +[ 6.154241] check_preemption_disabled+0x124/0x134 +[ 6.159068] debug_smp_processor_id+0x20/0x2c +[ 6.163453] xlnx_event_manager_probe+0x48/0x250 + +To protect cpu_id, It is recommended to use get_cpu()/put_cpu() +to disable preemption, get the cpu_id and enable preemption respectively. +(For Reference, Documentation/locking/preempt-locking.rst and +Documentation/kernel-hacking/hacking.rst) + +Use preempt_disable()/smp_processor_id()/preempt_enable() +API's to achieve the same. + +Signed-off-by: HariBabu Gattem +Signed-off-by: Jay Buddhabhatti +Link: https://lore.kernel.org/r/20231027055622.21544-1-jay.buddhabhatti@amd.com +Signed-off-by: Michal Simek +Signed-off-by: Sasha Levin +--- + drivers/soc/xilinx/xlnx_event_manager.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c +index 86a048a10a13..edfb1d5c10c6 100644 +--- a/drivers/soc/xilinx/xlnx_event_manager.c ++++ b/drivers/soc/xilinx/xlnx_event_manager.c +@@ -555,7 +555,7 @@ static void xlnx_disable_percpu_irq(void *data) + static int xlnx_event_init_sgi(struct platform_device *pdev) + { + int ret = 0; +- int cpu = smp_processor_id(); ++ int cpu; + /* + * IRQ related structures are used for the following: + * for each SGI interrupt ensure its mapped by GIC IRQ domain +@@ -592,9 +592,12 @@ static int xlnx_event_init_sgi(struct platform_device *pdev) + sgi_fwspec.param[0] = sgi_num; + virq_sgi = irq_create_fwspec_mapping(&sgi_fwspec); + ++ cpu = get_cpu(); + per_cpu(cpu_number1, cpu) = cpu; + ret = request_percpu_irq(virq_sgi, xlnx_event_handler, "xlnx_event_mgmt", + &cpu_number1); ++ put_cpu(); ++ + WARN_ON(ret); + if (ret) { + irq_dispose_mapping(virq_sgi); +-- +2.43.0 + diff --git a/queue-6.6/soc-xilinx-fix-unhandled-sgi-warning-message.patch b/queue-6.6/soc-xilinx-fix-unhandled-sgi-warning-message.patch new file mode 100644 index 00000000000..bbfb2c19623 --- /dev/null +++ b/queue-6.6/soc-xilinx-fix-unhandled-sgi-warning-message.patch @@ -0,0 +1,39 @@ +From f06a1fc929461e9afc3d067e2add18a479fbf417 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Oct 2023 23:53:59 +0530 +Subject: soc: xilinx: fix unhandled SGI warning message + +From: Tanmay Shah + +[ Upstream commit 9c6724abf969251af53cdae525ad8100ec78d3c2 ] + +Xen broadcasts SGI to each VM when multiple VMs run on Xen hypervisor. In +such case spurious SGI is expected if one event is registered by one VM and +not registered by another VM. We let users know that Unhandled SGI is not +error and expected if kernel is running on Xen hypervisor. + +Signed-off-by: Tanmay Shah +Signed-off-by: Radhey Shyam Pandey +Link: https://lore.kernel.org/r/1698431039-2734260-1-git-send-email-radhey.shyam.pandey@amd.com +Signed-off-by: Michal Simek +Signed-off-by: Sasha Levin +--- + drivers/soc/xilinx/xlnx_event_manager.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c +index edfb1d5c10c6..042553abe1bf 100644 +--- a/drivers/soc/xilinx/xlnx_event_manager.c ++++ b/drivers/soc/xilinx/xlnx_event_manager.c +@@ -477,7 +477,7 @@ static void xlnx_call_notify_cb_handler(const u32 *payload) + } + } + if (!is_callback_found) +- pr_warn("Didn't find any registered callback for 0x%x 0x%x\n", ++ pr_warn("Unhandled SGI node 0x%x event 0x%x. Expected with Xen hypervisor\n", + payload[1], payload[2]); + } + +-- +2.43.0 + diff --git a/queue-6.6/spmi-mediatek-fix-uaf-on-device-remove.patch b/queue-6.6/spmi-mediatek-fix-uaf-on-device-remove.patch new file mode 100644 index 00000000000..0f9964c78fb --- /dev/null +++ b/queue-6.6/spmi-mediatek-fix-uaf-on-device-remove.patch @@ -0,0 +1,78 @@ +From f709738e0bb0cdcf18e03bebb4b2329b4071b50f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 15:17:25 -0800 +Subject: spmi: mediatek: Fix UAF on device remove + +From: Yu-Che Cheng + +[ Upstream commit e821d50ab5b956ed0effa49faaf29912fd4106d9 ] + +The pmif driver data that contains the clocks is allocated along with +spmi_controller. +On device remove, spmi_controller will be freed first, and then devres +, including the clocks, will be cleanup. +This leads to UAF because putting the clocks will access the clocks in +the pmif driver data, which is already freed along with spmi_controller. + +This can be reproduced by enabling DEBUG_TEST_DRIVER_REMOVE and +building the kernel with KASAN. + +Fix the UAF issue by using unmanaged clk_bulk_get() and putting the +clocks before freeing spmi_controller. + +Reported-by: Fei Shao +Signed-off-by: Yu-Che Cheng +Link: https://lore.kernel.org/r/20230717173934.1.If004a6e055a189c7f2d0724fa814422c26789839@changeid +Tested-by: Fei Shao +Reviewed-by: Fei Shao +Reviewed-by: Chen-Yu Tsai +Signed-off-by: Stephen Boyd +Link: https://lore.kernel.org/r/20231206231733.4031901-3-sboyd@kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/spmi/spmi-mtk-pmif.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c +index 54c35f5535cb..1261f381cae6 100644 +--- a/drivers/spmi/spmi-mtk-pmif.c ++++ b/drivers/spmi/spmi-mtk-pmif.c +@@ -475,7 +475,7 @@ static int mtk_spmi_probe(struct platform_device *pdev) + for (i = 0; i < arb->nclks; i++) + arb->clks[i].id = pmif_clock_names[i]; + +- err = devm_clk_bulk_get(&pdev->dev, arb->nclks, arb->clks); ++ err = clk_bulk_get(&pdev->dev, arb->nclks, arb->clks); + if (err) { + dev_err(&pdev->dev, "Failed to get clocks: %d\n", err); + goto err_put_ctrl; +@@ -484,7 +484,7 @@ static int mtk_spmi_probe(struct platform_device *pdev) + err = clk_bulk_prepare_enable(arb->nclks, arb->clks); + if (err) { + dev_err(&pdev->dev, "Failed to enable clocks: %d\n", err); +- goto err_put_ctrl; ++ goto err_put_clks; + } + + ctrl->cmd = pmif_arb_cmd; +@@ -510,6 +510,8 @@ static int mtk_spmi_probe(struct platform_device *pdev) + + err_domain_remove: + clk_bulk_disable_unprepare(arb->nclks, arb->clks); ++err_put_clks: ++ clk_bulk_put(arb->nclks, arb->clks); + err_put_ctrl: + spmi_controller_put(ctrl); + return err; +@@ -521,6 +523,7 @@ static void mtk_spmi_remove(struct platform_device *pdev) + struct pmif *arb = spmi_controller_get_drvdata(ctrl); + + clk_bulk_disable_unprepare(arb->nclks, arb->clks); ++ clk_bulk_put(arb->nclks, arb->clks); + spmi_controller_remove(ctrl); + spmi_controller_put(ctrl); + } +-- +2.43.0 + diff --git a/queue-6.6/sunrpc-fix-a-suspicious-rcu-usage-warning.patch b/queue-6.6/sunrpc-fix-a-suspicious-rcu-usage-warning.patch new file mode 100644 index 00000000000..1954c4ffccb --- /dev/null +++ b/queue-6.6/sunrpc-fix-a-suspicious-rcu-usage-warning.patch @@ -0,0 +1,121 @@ +From 4efabf4fe32edf23f4e314e1468556fad50ca81c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 17:06:18 -0500 +Subject: SUNRPC: Fix a suspicious RCU usage warning + +From: Anna Schumaker + +[ Upstream commit 31b62908693c90d4d07db597e685d9f25a120073 ] + +I received the following warning while running cthon against an ontap +server running pNFS: + +[ 57.202521] ============================= +[ 57.202522] WARNING: suspicious RCU usage +[ 57.202523] 6.7.0-rc3-g2cc14f52aeb7 #41492 Not tainted +[ 57.202525] ----------------------------- +[ 57.202525] net/sunrpc/xprtmultipath.c:349 RCU-list traversed in non-reader section!! +[ 57.202527] + other info that might help us debug this: + +[ 57.202528] + rcu_scheduler_active = 2, debug_locks = 1 +[ 57.202529] no locks held by test5/3567. +[ 57.202530] + stack backtrace: +[ 57.202532] CPU: 0 PID: 3567 Comm: test5 Not tainted 6.7.0-rc3-g2cc14f52aeb7 #41492 5b09971b4965c0aceba19f3eea324a4a806e227e +[ 57.202534] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 2/2/2022 +[ 57.202536] Call Trace: +[ 57.202537] +[ 57.202540] dump_stack_lvl+0x77/0xb0 +[ 57.202551] lockdep_rcu_suspicious+0x154/0x1a0 +[ 57.202556] rpc_xprt_switch_has_addr+0x17c/0x190 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6] +[ 57.202596] rpc_clnt_setup_test_and_add_xprt+0x50/0x180 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6] +[ 57.202621] ? rpc_clnt_add_xprt+0x254/0x300 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6] +[ 57.202646] rpc_clnt_add_xprt+0x27a/0x300 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6] +[ 57.202671] ? __pfx_rpc_clnt_setup_test_and_add_xprt+0x10/0x10 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6] +[ 57.202696] nfs4_pnfs_ds_connect+0x345/0x760 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9] +[ 57.202728] ? __pfx_nfs4_test_session_trunk+0x10/0x10 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9] +[ 57.202754] nfs4_fl_prepare_ds+0x75/0xc0 [nfs_layout_nfsv41_files e3a4187f18ae8a27b630f9feae6831b584a9360a] +[ 57.202760] filelayout_write_pagelist+0x4a/0x200 [nfs_layout_nfsv41_files e3a4187f18ae8a27b630f9feae6831b584a9360a] +[ 57.202765] pnfs_generic_pg_writepages+0xbe/0x230 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9] +[ 57.202788] __nfs_pageio_add_request+0x3fd/0x520 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202813] nfs_pageio_add_request+0x18b/0x390 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202831] nfs_do_writepage+0x116/0x1e0 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202849] nfs_writepages_callback+0x13/0x30 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202866] write_cache_pages+0x265/0x450 +[ 57.202870] ? __pfx_nfs_writepages_callback+0x10/0x10 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202891] nfs_writepages+0x141/0x230 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202913] do_writepages+0xd2/0x230 +[ 57.202917] ? filemap_fdatawrite_wbc+0x5c/0x80 +[ 57.202921] filemap_fdatawrite_wbc+0x67/0x80 +[ 57.202924] filemap_write_and_wait_range+0xd9/0x170 +[ 57.202930] nfs_wb_all+0x49/0x180 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902] +[ 57.202947] nfs4_file_flush+0x72/0xb0 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9] +[ 57.202969] __se_sys_close+0x46/0xd0 +[ 57.202972] do_syscall_64+0x68/0x100 +[ 57.202975] ? do_syscall_64+0x77/0x100 +[ 57.202976] ? do_syscall_64+0x77/0x100 +[ 57.202979] entry_SYSCALL_64_after_hwframe+0x6e/0x76 +[ 57.202982] RIP: 0033:0x7fe2b12e4a94 +[ 57.202985] Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 80 3d d5 18 0e 00 00 74 13 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 44 c3 0f 1f 00 48 83 ec 18 89 7c 24 0c e8 c3 +[ 57.202987] RSP: 002b:00007ffe857ddb38 EFLAGS: 00000202 ORIG_RAX: 0000000000000003 +[ 57.202989] RAX: ffffffffffffffda RBX: 00007ffe857dfd68 RCX: 00007fe2b12e4a94 +[ 57.202991] RDX: 0000000000002000 RSI: 00007ffe857ddc40 RDI: 0000000000000003 +[ 57.202992] RBP: 00007ffe857dfc50 R08: 7fffffffffffffff R09: 0000000065650f49 +[ 57.202993] R10: 00007fe2b11f8300 R11: 0000000000000202 R12: 0000000000000000 +[ 57.202994] R13: 00007ffe857dfd80 R14: 00007fe2b1445000 R15: 0000000000000000 +[ 57.202999] + +The problem seems to be that two out of three callers aren't taking the +rcu_read_lock() before calling the list_for_each_entry_rcu() function in +rpc_xprt_switch_has_addr(). I fix this by having +rpc_xprt_switch_has_addr() unconditionaly take the rcu_read_lock(), +which is okay to do recursively in the case that the lock has already +been taken by a caller. + +Reviewed-by: Jeff Layton +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + net/sunrpc/xprtmultipath.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c +index 74ee2271251e..720d3ba742ec 100644 +--- a/net/sunrpc/xprtmultipath.c ++++ b/net/sunrpc/xprtmultipath.c +@@ -336,8 +336,9 @@ struct rpc_xprt *xprt_iter_current_entry_offline(struct rpc_xprt_iter *xpi) + xprt_switch_find_current_entry_offline); + } + +-bool rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps, +- const struct sockaddr *sap) ++static ++bool __rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps, ++ const struct sockaddr *sap) + { + struct list_head *head; + struct rpc_xprt *pos; +@@ -356,6 +357,18 @@ bool rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps, + return false; + } + ++bool rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps, ++ const struct sockaddr *sap) ++{ ++ bool res; ++ ++ rcu_read_lock(); ++ res = __rpc_xprt_switch_has_addr(xps, sap); ++ rcu_read_unlock(); ++ ++ return res; ++} ++ + static + struct rpc_xprt *xprt_switch_find_next_entry(struct list_head *head, + const struct rpc_xprt *cur, bool check_active) +-- +2.43.0 + diff --git a/queue-6.6/sysctl-fix-out-of-bounds-access-for-empty-sysctl-reg.patch b/queue-6.6/sysctl-fix-out-of-bounds-access-for-empty-sysctl-reg.patch new file mode 100644 index 00000000000..c54296e2f98 --- /dev/null +++ b/queue-6.6/sysctl-fix-out-of-bounds-access-for-empty-sysctl-reg.patch @@ -0,0 +1,67 @@ +From 5b0f7f2e4621464f71d7d51d845e427528740172 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 12:02:18 +0100 +Subject: sysctl: Fix out of bounds access for empty sysctl registers + +From: Joel Granados + +[ Upstream commit 315552310c7de92baea4e570967066569937a843 ] + +When registering tables to the sysctl subsystem there is a check to see +if header is a permanently empty directory (used for mounts). This check +evaluates the first element of the ctl_table. This results in an out of +bounds evaluation when registering empty directories. + +The function register_sysctl_mount_point now passes a ctl_table of size +1 instead of size 0. It now relies solely on the type to identify +a permanently empty register. + +Make sure that the ctl_table has at least one element before testing for +permanent emptiness. + +Signed-off-by: Joel Granados +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-lkp/202311201431.57aae8f3-oliver.sang@intel.com +Signed-off-by: Luis Chamberlain +Signed-off-by: Sasha Levin +--- + fs/proc/proc_sysctl.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c +index de484195f49f..5b5cdc747cef 100644 +--- a/fs/proc/proc_sysctl.c ++++ b/fs/proc/proc_sysctl.c +@@ -44,7 +44,7 @@ static struct ctl_table sysctl_mount_point[] = { + */ + struct ctl_table_header *register_sysctl_mount_point(const char *path) + { +- return register_sysctl_sz(path, sysctl_mount_point, 0); ++ return register_sysctl(path, sysctl_mount_point); + } + EXPORT_SYMBOL(register_sysctl_mount_point); + +@@ -233,7 +233,8 @@ static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header) + return -EROFS; + + /* Am I creating a permanently empty directory? */ +- if (sysctl_is_perm_empty_ctl_table(header->ctl_table)) { ++ if (header->ctl_table_size > 0 && ++ sysctl_is_perm_empty_ctl_table(header->ctl_table)) { + if (!RB_EMPTY_ROOT(&dir->root)) + return -EINVAL; + sysctl_set_perm_empty_ctl_header(dir_h); +@@ -1213,6 +1214,10 @@ static bool get_links(struct ctl_dir *dir, + struct ctl_table_header *tmp_head; + struct ctl_table *entry, *link; + ++ if (header->ctl_table_size == 0 || ++ sysctl_is_perm_empty_ctl_table(header->ctl_table)) ++ return true; ++ + /* Are there links available for every entry in table? */ + list_for_each_table_entry(entry, header) { + const char *procname = entry->procname; +-- +2.43.0 + diff --git a/queue-6.6/thermal-core-fix-thermal-zone-suspend-resume-synchro.patch b/queue-6.6/thermal-core-fix-thermal-zone-suspend-resume-synchro.patch new file mode 100644 index 00000000000..be557c54b8a --- /dev/null +++ b/queue-6.6/thermal-core-fix-thermal-zone-suspend-resume-synchro.patch @@ -0,0 +1,132 @@ +From 5b024b239aaf03ae6ab431d7f749986d025346a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Dec 2023 20:25:02 +0100 +Subject: thermal: core: Fix thermal zone suspend-resume synchronization + +From: Rafael J. Wysocki + +[ Upstream commit 4e814173a8c4f432fd068b1c796f0416328c9d99 ] + +There are 3 synchronization issues with thermal zone suspend-resume +during system-wide transitions: + + 1. The resume code runs in a PM notifier which is invoked after user + space has been thawed, so it can run concurrently with user space + which can trigger a thermal zone device removal. If that happens, + the thermal zone resume code may use a stale pointer to the next + list element and crash, because it does not hold thermal_list_lock + while walking thermal_tz_list. + + 2. The thermal zone resume code calls thermal_zone_device_init() + outside the zone lock, so user space or an update triggered by + the platform firmware may see an inconsistent state of a + thermal zone leading to unexpected behavior. + + 3. Clearing the in_suspend global variable in thermal_pm_notify() + allows __thermal_zone_device_update() to continue for all thermal + zones and it may as well run before the thermal_tz_list walk (or + at any point during the list walk for that matter) and attempt to + operate on a thermal zone that has not been resumed yet. It may + also race destructively with thermal_zone_device_init(). + +To address these issues, add thermal_list_lock locking to +thermal_pm_notify(), especially arount the thermal_tz_list, +make it call thermal_zone_device_init() back-to-back with +__thermal_zone_device_update() under the zone lock and replace +in_suspend with per-zone bool "suspend" indicators set and unset +under the given zone's lock. + +Link: https://lore.kernel.org/linux-pm/20231218162348.69101-1-bo.ye@mediatek.com/ +Reported-by: Bo Ye +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/thermal/thermal_core.c | 30 +++++++++++++++++++++++------- + include/linux/thermal.h | 2 ++ + 2 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c +index 1494ffa59754..dee3022539cf 100644 +--- a/drivers/thermal/thermal_core.c ++++ b/drivers/thermal/thermal_core.c +@@ -37,8 +37,6 @@ static LIST_HEAD(thermal_governor_list); + static DEFINE_MUTEX(thermal_list_lock); + static DEFINE_MUTEX(thermal_governor_lock); + +-static atomic_t in_suspend; +- + static struct thermal_governor *def_governor; + + /* +@@ -409,7 +407,7 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz, + { + int count; + +- if (atomic_read(&in_suspend)) ++ if (tz->suspended) + return; + + if (WARN_ONCE(!tz->ops->get_temp, +@@ -1532,17 +1530,35 @@ static int thermal_pm_notify(struct notifier_block *nb, + case PM_HIBERNATION_PREPARE: + case PM_RESTORE_PREPARE: + case PM_SUSPEND_PREPARE: +- atomic_set(&in_suspend, 1); ++ mutex_lock(&thermal_list_lock); ++ ++ list_for_each_entry(tz, &thermal_tz_list, node) { ++ mutex_lock(&tz->lock); ++ ++ tz->suspended = true; ++ ++ mutex_unlock(&tz->lock); ++ } ++ ++ mutex_unlock(&thermal_list_lock); + break; + case PM_POST_HIBERNATION: + case PM_POST_RESTORE: + case PM_POST_SUSPEND: +- atomic_set(&in_suspend, 0); ++ mutex_lock(&thermal_list_lock); ++ + list_for_each_entry(tz, &thermal_tz_list, node) { ++ mutex_lock(&tz->lock); ++ ++ tz->suspended = false; ++ + thermal_zone_device_init(tz); +- thermal_zone_device_update(tz, +- THERMAL_EVENT_UNSPECIFIED); ++ __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); ++ ++ mutex_unlock(&tz->lock); + } ++ ++ mutex_unlock(&thermal_list_lock); + break; + default: + break; +diff --git a/include/linux/thermal.h b/include/linux/thermal.h +index a5ae4af955ff..4012f440bfdc 100644 +--- a/include/linux/thermal.h ++++ b/include/linux/thermal.h +@@ -150,6 +150,7 @@ struct thermal_cooling_device { + * @node: node in thermal_tz_list (in thermal_core.c) + * @poll_queue: delayed work for polling + * @notify_event: Last notification event ++ * @suspended: thermal zone suspend indicator + */ + struct thermal_zone_device { + int id; +@@ -183,6 +184,7 @@ struct thermal_zone_device { + struct list_head node; + struct delayed_work poll_queue; + enum thermal_notify_event notify_event; ++ bool suspended; + }; + + /** +-- +2.43.0 + diff --git a/queue-6.6/tty-allow-tiocslcktrmios-with-cap_checkpoint_restore.patch b/queue-6.6/tty-allow-tiocslcktrmios-with-cap_checkpoint_restore.patch new file mode 100644 index 00000000000..f33004bcd47 --- /dev/null +++ b/queue-6.6/tty-allow-tiocslcktrmios-with-cap_checkpoint_restore.patch @@ -0,0 +1,63 @@ +From 8ed806f7381112d27f15c8912af747b4b12abfcb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Dec 2023 15:36:56 +0100 +Subject: tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE + +From: Adrian Reber + +[ Upstream commit e0f25b8992345aa5f113da2815f5add98738c611 ] + +The capability CAP_CHECKPOINT_RESTORE was introduced to allow non-root +users to checkpoint and restore processes as non-root with CRIU. + +This change extends CAP_CHECKPOINT_RESTORE to enable the CRIU option +'--shell-job' as non-root. CRIU's man-page describes the '--shell-job' +option like this: + + Allow one to dump shell jobs. This implies the restored task will + inherit session and process group ID from the criu itself. This option + also allows to migrate a single external tty connection, to migrate + applications like top. + +TIOCSLCKTRMIOS can only be done if the process has CAP_SYS_ADMIN and +this change extends it to CAP_SYS_ADMIN or CAP_CHECKPOINT_RESTORE. + +With this change it is possible to checkpoint and restore processes +which have a tty connection as non-root if CAP_CHECKPOINT_RESTORE is +set. + +Acked-by: Christian Brauner +Signed-off-by: Adrian Reber +Acked-by: Andrei Vagin +Link: https://lore.kernel.org/r/20231208143656.1019-1-areber@redhat.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/tty_ioctl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c +index 7958bf6d27c4..7c6253685545 100644 +--- a/drivers/tty/tty_ioctl.c ++++ b/drivers/tty/tty_ioctl.c +@@ -850,7 +850,7 @@ int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + return ret; + case TIOCSLCKTRMIOS: +- if (!capable(CAP_SYS_ADMIN)) ++ if (!checkpoint_restore_ns_capable(&init_user_ns)) + return -EPERM; + copy_termios_locked(real_tty, &kterm); + if (user_termios_to_kernel_termios(&kterm, +@@ -867,7 +867,7 @@ int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + return ret; + case TIOCSLCKTRMIOS: +- if (!capable(CAP_SYS_ADMIN)) ++ if (!checkpoint_restore_ns_capable(&init_user_ns)) + return -EPERM; + copy_termios_locked(real_tty, &kterm); + if (user_termios_to_kernel_termios_1(&kterm, +-- +2.43.0 + diff --git a/queue-6.6/ubsan-array-index-out-of-bounds-in-dtsplitroot.patch b/queue-6.6/ubsan-array-index-out-of-bounds-in-dtsplitroot.patch new file mode 100644 index 00000000000..76181475434 --- /dev/null +++ b/queue-6.6/ubsan-array-index-out-of-bounds-in-dtsplitroot.patch @@ -0,0 +1,77 @@ +From 5bc1841771b837f0fce3a2de6c3970e6712b71b1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Oct 2023 00:10:28 +0500 +Subject: UBSAN: array-index-out-of-bounds in dtSplitRoot + +From: Osama Muhammad + +[ Upstream commit 27e56f59bab5ddafbcfe69ad7a4a6ea1279c1b16 ] + +Syzkaller reported the following issue: + +oop0: detected capacity change from 0 to 32768 + +UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dtree.c:1971:9 +index -2 is out of range for type 'struct dtslot [128]' +CPU: 0 PID: 3613 Comm: syz-executor270 Not tainted 6.0.0-syzkaller-09423-g493ffd6605b2 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 +Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 + ubsan_epilogue lib/ubsan.c:151 [inline] + __ubsan_handle_out_of_bounds+0xdb/0x130 lib/ubsan.c:283 + dtSplitRoot+0x8d8/0x1900 fs/jfs/jfs_dtree.c:1971 + dtSplitUp fs/jfs/jfs_dtree.c:985 [inline] + dtInsert+0x1189/0x6b80 fs/jfs/jfs_dtree.c:863 + jfs_mkdir+0x757/0xb00 fs/jfs/namei.c:270 + vfs_mkdir+0x3b3/0x590 fs/namei.c:4013 + do_mkdirat+0x279/0x550 fs/namei.c:4038 + __do_sys_mkdirat fs/namei.c:4053 [inline] + __se_sys_mkdirat fs/namei.c:4051 [inline] + __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4051 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd +RIP: 0033:0x7fcdc0113fd9 +Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 +RSP: 002b:00007ffeb8bc67d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 +RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcdc0113fd9 +RDX: 0000000000000000 RSI: 0000000020000340 RDI: 0000000000000003 +RBP: 00007fcdc00d37a0 R08: 0000000000000000 R09: 00007fcdc00d37a0 +R10: 00005555559a72c0 R11: 0000000000000246 R12: 00000000f8008000 +R13: 0000000000000000 R14: 00083878000000f8 R15: 0000000000000000 + + +The issue is caused when the value of fsi becomes less than -1. +The check to break the loop when fsi value becomes -1 is present +but syzbot was able to produce value less than -1 which cause the error. +This patch simply add the change for the values less than 0. + +The patch is tested via syzbot. + +Reported-and-tested-by: syzbot+d4b1df2e9d4ded6488ec@syzkaller.appspotmail.com +Link: https://syzkaller.appspot.com/bug?extid=d4b1df2e9d4ded6488ec +Signed-off-by: Osama Muhammad +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_dtree.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c +index 92b7c533407c..f3d3e8b3f50c 100644 +--- a/fs/jfs/jfs_dtree.c ++++ b/fs/jfs/jfs_dtree.c +@@ -1970,7 +1970,7 @@ static int dtSplitRoot(tid_t tid, + do { + f = &rp->slot[fsi]; + fsi = f->next; +- } while (fsi != -1); ++ } while (fsi >= 0); + + f->next = n; + } +-- +2.43.0 + diff --git a/queue-6.6/um-don-t-use-vfprintf-for-os_info.patch b/queue-6.6/um-don-t-use-vfprintf-for-os_info.patch new file mode 100644 index 00000000000..4a9161d0beb --- /dev/null +++ b/queue-6.6/um-don-t-use-vfprintf-for-os_info.patch @@ -0,0 +1,72 @@ +From f93c3d6866881b83ec6d680de3366350df1985e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Nov 2023 12:03:41 +0100 +Subject: um: Don't use vfprintf() for os_info() + +From: Benjamin Berg + +[ Upstream commit 236f9fe39b02c15fa5530b53e9cca48354394389 ] + +The threads allocated inside the kernel have only a single page of +stack. Unfortunately, the vfprintf function in standard glibc may use +too much stack-space, overflowing it. + +To make os_info safe to be used by helper threads, use the kernel +vscnprintf function into a smallish buffer and write out the information +to stderr. + +Signed-off-by: Benjamin Berg +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/os-Linux/util.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c +index fc0f2a9dee5a..1dca4ffbd572 100644 +--- a/arch/um/os-Linux/util.c ++++ b/arch/um/os-Linux/util.c +@@ -173,23 +173,38 @@ __uml_setup("quiet", quiet_cmd_param, + "quiet\n" + " Turns off information messages during boot.\n\n"); + ++/* ++ * The os_info/os_warn functions will be called by helper threads. These ++ * have a very limited stack size and using the libc formatting functions ++ * may overflow the stack. ++ * So pull in the kernel vscnprintf and use that instead with a fixed ++ * on-stack buffer. ++ */ ++int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); ++ + void os_info(const char *fmt, ...) + { ++ char buf[256]; + va_list list; ++ int len; + + if (quiet_info) + return; + + va_start(list, fmt); +- vfprintf(stderr, fmt, list); ++ len = vscnprintf(buf, sizeof(buf), fmt, list); ++ fwrite(buf, len, 1, stderr); + va_end(list); + } + + void os_warn(const char *fmt, ...) + { ++ char buf[256]; + va_list list; ++ int len; + + va_start(list, fmt); +- vfprintf(stderr, fmt, list); ++ len = vscnprintf(buf, sizeof(buf), fmt, list); ++ fwrite(buf, len, 1, stderr); + va_end(list); + } +-- +2.43.0 + diff --git a/queue-6.6/um-fix-naming-clash-between-uml-and-scheduler.patch b/queue-6.6/um-fix-naming-clash-between-uml-and-scheduler.patch new file mode 100644 index 00000000000..1389de9fc7d --- /dev/null +++ b/queue-6.6/um-fix-naming-clash-between-uml-and-scheduler.patch @@ -0,0 +1,82 @@ +From f0435d49f2b1ddf7a9618ad50746fdfb350b48c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Sep 2023 15:34:44 +0100 +Subject: um: Fix naming clash between UML and scheduler + +From: Anton Ivanov + +[ Upstream commit 541d4e4d435c8b9bfd29f70a1da4a2db97794e0a ] + +__cant_sleep was already used and exported by the scheduler. +The name had to be changed to a UML specific one. + +Signed-off-by: Anton Ivanov +Reviewed-by: Peter Lafreniere +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/include/shared/kern_util.h | 2 +- + arch/um/kernel/process.c | 2 +- + arch/um/os-Linux/helper.c | 6 +++--- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h +index d8b8b4f07e42..444bae755b16 100644 +--- a/arch/um/include/shared/kern_util.h ++++ b/arch/um/include/shared/kern_util.h +@@ -50,7 +50,7 @@ extern void do_uml_exitcalls(void); + * Are we disallowed to sleep? Used to choose between GFP_KERNEL and + * GFP_ATOMIC. + */ +-extern int __cant_sleep(void); ++extern int __uml_cant_sleep(void); + extern int get_current_pid(void); + extern int copy_from_user_proc(void *to, void *from, int size); + extern char *uml_strdup(const char *string); +diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c +index 106b7da2f8d6..6daffb9d8a8d 100644 +--- a/arch/um/kernel/process.c ++++ b/arch/um/kernel/process.c +@@ -220,7 +220,7 @@ void arch_cpu_idle(void) + um_idle_sleep(); + } + +-int __cant_sleep(void) { ++int __uml_cant_sleep(void) { + return in_atomic() || irqs_disabled() || in_interrupt(); + /* Is in_interrupt() really needed? */ + } +diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c +index b459745f52e2..3cb8ac63be6e 100644 +--- a/arch/um/os-Linux/helper.c ++++ b/arch/um/os-Linux/helper.c +@@ -46,7 +46,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv) + unsigned long stack, sp; + int pid, fds[2], ret, n; + +- stack = alloc_stack(0, __cant_sleep()); ++ stack = alloc_stack(0, __uml_cant_sleep()); + if (stack == 0) + return -ENOMEM; + +@@ -70,7 +70,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv) + data.pre_data = pre_data; + data.argv = argv; + data.fd = fds[1]; +- data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) : ++ data.buf = __uml_cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) : + uml_kmalloc(PATH_MAX, UM_GFP_KERNEL); + pid = clone(helper_child, (void *) sp, CLONE_VM, &data); + if (pid < 0) { +@@ -121,7 +121,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, + unsigned long stack, sp; + int pid, status, err; + +- stack = alloc_stack(0, __cant_sleep()); ++ stack = alloc_stack(0, __uml_cant_sleep()); + if (stack == 0) + return -ENOMEM; + +-- +2.43.0 + diff --git a/queue-6.6/um-net-fix-return-type-of-uml_net_start_xmit.patch b/queue-6.6/um-net-fix-return-type-of-uml_net_start_xmit.patch new file mode 100644 index 00000000000..95420b31e99 --- /dev/null +++ b/queue-6.6/um-net-fix-return-type-of-uml_net_start_xmit.patch @@ -0,0 +1,53 @@ +From 351e0f70d6f56d22d8f3b7d4c46ac7ab78cd4620 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 09:49:46 -0700 +Subject: um: net: Fix return type of uml_net_start_xmit() + +From: Nathan Chancellor + +[ Upstream commit 7d748f60a4b82b50bf25fad1bd42d33f049f76aa ] + +With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), +indirect call targets are validated against the expected function +pointer prototype to make sure the call target is valid to help mitigate +ROP attacks. If they are not identical, there is a failure at run time, +which manifests as either a kernel panic or thread getting killed. A +warning in clang aims to catch these at compile time, which reveals: + + arch/um/drivers/net_kern.c:353:21: warning: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Wincompatible-function-pointer-types-strict] + 353 | .ndo_start_xmit = uml_net_start_xmit, + | ^~~~~~~~~~~~~~~~~~ + 1 warning generated. + +->ndo_start_xmit() in 'struct net_device_ops' expects a return type of +'netdev_tx_t', not 'int'. Adjust the return type of uml_net_start_xmit() +to match the prototype's to resolve the warning. While UML does not +currently implement support for kCFI, it could in the future, which +means this warning becomes a fatal CFI failure at run time. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202310031340.v1vPh207-lkp@intel.com/ +Acked-by: Anton Ivanov +Signed-off-by: Nathan Chancellor +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/drivers/net_kern.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c +index 3d7836c46507..cabcc501b448 100644 +--- a/arch/um/drivers/net_kern.c ++++ b/arch/um/drivers/net_kern.c +@@ -204,7 +204,7 @@ static int uml_net_close(struct net_device *dev) + return 0; + } + +-static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct uml_net_private *lp = netdev_priv(dev); + unsigned long flags; +-- +2.43.0 + diff --git a/queue-6.6/um-time-travel-fix-time-corruption.patch b/queue-6.6/um-time-travel-fix-time-corruption.patch new file mode 100644 index 00000000000..475ceaab660 --- /dev/null +++ b/queue-6.6/um-time-travel-fix-time-corruption.patch @@ -0,0 +1,93 @@ +From 9c9ad1c1f3c727c4cc19c9d791a09d3e6bce0097 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Oct 2023 22:45:05 +0200 +Subject: um: time-travel: fix time corruption + +From: Johannes Berg + +[ Upstream commit abe4eaa8618bb36c2b33e9cdde0499296a23448c ] + +In 'basic' time-travel mode (without =inf-cpu or =ext), we +still get timer interrupts. These can happen at arbitrary +points in time, i.e. while in timer_read(), which pushes +time forward just a little bit. Then, if we happen to get +the interrupt after calculating the new time to push to, +but before actually finishing that, the interrupt will set +the time to a value that's incompatible with the forward, +and we'll crash because time goes backwards when we do the +forwarding. + +Fix this by reading the time_travel_time, calculating the +adjustment, and doing the adjustment all with interrupts +disabled. + +Reported-by: Vincent Whitchurch +Signed-off-by: Johannes Berg +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/kernel/time.c | 32 +++++++++++++++++++++++++++----- + 1 file changed, 27 insertions(+), 5 deletions(-) + +diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c +index fddd1dec27e6..3e270da6b6f6 100644 +--- a/arch/um/kernel/time.c ++++ b/arch/um/kernel/time.c +@@ -432,9 +432,29 @@ static void time_travel_update_time(unsigned long long next, bool idle) + time_travel_del_event(&ne); + } + ++static void time_travel_update_time_rel(unsigned long long offs) ++{ ++ unsigned long flags; ++ ++ /* ++ * Disable interrupts before calculating the new time so ++ * that a real timer interrupt (signal) can't happen at ++ * a bad time e.g. after we read time_travel_time but ++ * before we've completed updating the time. ++ */ ++ local_irq_save(flags); ++ time_travel_update_time(time_travel_time + offs, false); ++ local_irq_restore(flags); ++} ++ + void time_travel_ndelay(unsigned long nsec) + { +- time_travel_update_time(time_travel_time + nsec, false); ++ /* ++ * Not strictly needed to use _rel() version since this is ++ * only used in INFCPU/EXT modes, but it doesn't hurt and ++ * is more readable too. ++ */ ++ time_travel_update_time_rel(nsec); + } + EXPORT_SYMBOL(time_travel_ndelay); + +@@ -568,7 +588,11 @@ static void time_travel_set_start(void) + #define time_travel_time 0 + #define time_travel_ext_waiting 0 + +-static inline void time_travel_update_time(unsigned long long ns, bool retearly) ++static inline void time_travel_update_time(unsigned long long ns, bool idle) ++{ ++} ++ ++static inline void time_travel_update_time_rel(unsigned long long offs) + { + } + +@@ -720,9 +744,7 @@ static u64 timer_read(struct clocksource *cs) + */ + if (!irqs_disabled() && !in_interrupt() && !in_softirq() && + !time_travel_ext_waiting) +- time_travel_update_time(time_travel_time + +- TIMER_MULTIPLIER, +- false); ++ time_travel_update_time_rel(TIMER_MULTIPLIER); + return time_travel_time / TIMER_MULTIPLIER; + } + +-- +2.43.0 + diff --git a/queue-6.6/usb-hub-add-quirk-to-decrease-in-ep-poll-interval-fo.patch b/queue-6.6/usb-hub-add-quirk-to-decrease-in-ep-poll-interval-fo.patch new file mode 100644 index 00000000000..c2efe9973dd --- /dev/null +++ b/queue-6.6/usb-hub-add-quirk-to-decrease-in-ep-poll-interval-fo.patch @@ -0,0 +1,98 @@ +From 32fa5bf558179e81e8f77fc0c6304a4d1a97a60a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 19:18:29 +0100 +Subject: usb: hub: Add quirk to decrease IN-ep poll interval for Microchip + USB491x hub + +From: Hardik Gajjar + +[ Upstream commit 855d75cf8311fee156fabb5639bb53757ca83dd4 ] + +There is a potential delay in notifying Linux USB drivers of downstream +USB bus activity when connecting a high-speed or superSpeed device via the +Microchip USB491x hub. This delay is due to the fixed bInterval value of +12 in the silicon of the Microchip USB491x hub. + +Microchip requested to ignore the device descriptor and decrease that +value to 9 as it was too late to modify that in silicon. + +This patch speeds up the USB enummeration process that helps to pass +Apple Carplay certifications and improve the User experience when utilizing +the USB device via Microchip Multihost USB491x Hub. + +A new hub quirk HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL speeds up +the notification process for Microchip USB491x hub by limiting +the maximum bInterval value to 9. + +Signed-off-by: Hardik Gajjar +Reviewed-by: Alan Stern +Link: https://lore.kernel.org/r/20231205181829.127353-2-hgajjar@de.adit-jv.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/core/hub.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index f5abfba68e69..bd27741327df 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -47,12 +47,18 @@ + #define USB_VENDOR_TEXAS_INSTRUMENTS 0x0451 + #define USB_PRODUCT_TUSB8041_USB3 0x8140 + #define USB_PRODUCT_TUSB8041_USB2 0x8142 ++#define USB_VENDOR_MICROCHIP 0x0424 ++#define USB_PRODUCT_USB4913 0x4913 ++#define USB_PRODUCT_USB4914 0x4914 ++#define USB_PRODUCT_USB4915 0x4915 + #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND BIT(0) + #define HUB_QUIRK_DISABLE_AUTOSUSPEND BIT(1) ++#define HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL BIT(2) + + #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ + #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ + #define USB_PING_RESPONSE_TIME 400 /* ns */ ++#define USB_REDUCE_FRAME_INTR_BINTERVAL 9 + + /* Protect struct usb_device->state and ->children members + * Note: Both are also protected by ->dev.sem, except that ->state can +@@ -1904,6 +1910,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) + usb_autopm_get_interface_no_resume(intf); + } + ++ if ((id->driver_info & HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL) && ++ desc->endpoint[0].desc.bInterval > USB_REDUCE_FRAME_INTR_BINTERVAL) { ++ desc->endpoint[0].desc.bInterval = ++ USB_REDUCE_FRAME_INTR_BINTERVAL; ++ /* Tell the HCD about the interrupt ep's new bInterval */ ++ usb_set_interface(hdev, 0, 0); ++ } ++ + if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) { + onboard_hub_create_pdevs(hdev, &hub->onboard_hub_devs); + +@@ -5891,6 +5905,21 @@ static const struct usb_device_id hub_id_table[] = { + .idVendor = USB_VENDOR_TEXAS_INSTRUMENTS, + .idProduct = USB_PRODUCT_TUSB8041_USB3, + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, ++ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR ++ | USB_DEVICE_ID_MATCH_PRODUCT, ++ .idVendor = USB_VENDOR_MICROCHIP, ++ .idProduct = USB_PRODUCT_USB4913, ++ .driver_info = HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, ++ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR ++ | USB_DEVICE_ID_MATCH_PRODUCT, ++ .idVendor = USB_VENDOR_MICROCHIP, ++ .idProduct = USB_PRODUCT_USB4914, ++ .driver_info = HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, ++ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR ++ | USB_DEVICE_ID_MATCH_PRODUCT, ++ .idVendor = USB_VENDOR_MICROCHIP, ++ .idProduct = USB_PRODUCT_USB4915, ++ .driver_info = HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, + { .match_flags = USB_DEVICE_ID_MATCH_DEV_CLASS, + .bDeviceClass = USB_CLASS_HUB}, + { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, +-- +2.43.0 + diff --git a/queue-6.6/usb-hub-replace-hardcoded-quirk-value-with-bit-macro.patch b/queue-6.6/usb-hub-replace-hardcoded-quirk-value-with-bit-macro.patch new file mode 100644 index 00000000000..1bbf7686d92 --- /dev/null +++ b/queue-6.6/usb-hub-replace-hardcoded-quirk-value-with-bit-macro.patch @@ -0,0 +1,39 @@ +From e4006e7985ab672c0f01bf81ffd45376d6beefcb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 19:18:28 +0100 +Subject: usb: hub: Replace hardcoded quirk value with BIT() macro + +From: Hardik Gajjar + +[ Upstream commit 6666ea93d2c422ebeb8039d11e642552da682070 ] + +This patch replaces the hardcoded quirk value in the macro with +BIT(). + +Signed-off-by: Hardik Gajjar +Reviewed-by: Alan Stern +Link: https://lore.kernel.org/r/20231205181829.127353-1-hgajjar@de.adit-jv.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/core/hub.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index dfc30cebd4c4..f5abfba68e69 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -47,8 +47,8 @@ + #define USB_VENDOR_TEXAS_INSTRUMENTS 0x0451 + #define USB_PRODUCT_TUSB8041_USB3 0x8140 + #define USB_PRODUCT_TUSB8041_USB2 0x8142 +-#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 +-#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02 ++#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND BIT(0) ++#define HUB_QUIRK_DISABLE_AUTOSUSPEND BIT(1) + + #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ + #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ +-- +2.43.0 + diff --git a/queue-6.6/usb-xhci-plat-fix-usb-disconnect-issue-after-s4.patch b/queue-6.6/usb-xhci-plat-fix-usb-disconnect-issue-after-s4.patch new file mode 100644 index 00000000000..c74bc0e3a37 --- /dev/null +++ b/queue-6.6/usb-xhci-plat-fix-usb-disconnect-issue-after-s4.patch @@ -0,0 +1,89 @@ +From 6e6bdd36e7989b570157935374c935ba86b3533a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Dec 2023 15:11:13 +0800 +Subject: usb: xhci-plat: fix usb disconnect issue after s4 + +From: Yinbo Zhu + +[ Upstream commit 6d6887c42e946f43bed2e64571a40c8476a1e4a9 ] + +The xhci retaining bogus hardware states cause usb disconnect devices +connected before hibernation(s4) and refer to the commit 'f3d478858be +("usb: ohci-platform: fix usb disconnect issue after s4")' which set +flag "hibernated" as true when resume-from-hibernation and that the +drivers will reset the hardware to get rid of any existing state and +make sure resume from hibernation re-enumerates everything for xhci. + +Signed-off-by: Yinbo Zhu +Link: https://lore.kernel.org/r/20231228071113.1719-1-zhuyinbo@loongson.cn +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/host/xhci-plat.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c +index 732cdeb73920..f0853c4478f5 100644 +--- a/drivers/usb/host/xhci-plat.c ++++ b/drivers/usb/host/xhci-plat.c +@@ -433,7 +433,7 @@ void xhci_plat_remove(struct platform_device *dev) + } + EXPORT_SYMBOL_GPL(xhci_plat_remove); + +-static int __maybe_unused xhci_plat_suspend(struct device *dev) ++static int xhci_plat_suspend(struct device *dev) + { + struct usb_hcd *hcd = dev_get_drvdata(dev); + struct xhci_hcd *xhci = hcd_to_xhci(hcd); +@@ -461,7 +461,7 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) + return 0; + } + +-static int __maybe_unused xhci_plat_resume(struct device *dev) ++static int xhci_plat_resume_common(struct device *dev, struct pm_message pmsg) + { + struct usb_hcd *hcd = dev_get_drvdata(dev); + struct xhci_hcd *xhci = hcd_to_xhci(hcd); +@@ -483,7 +483,7 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) + if (ret) + goto disable_clks; + +- ret = xhci_resume(xhci, PMSG_RESUME); ++ ret = xhci_resume(xhci, pmsg); + if (ret) + goto disable_clks; + +@@ -502,6 +502,16 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) + return ret; + } + ++static int xhci_plat_resume(struct device *dev) ++{ ++ return xhci_plat_resume_common(dev, PMSG_RESUME); ++} ++ ++static int xhci_plat_restore(struct device *dev) ++{ ++ return xhci_plat_resume_common(dev, PMSG_RESTORE); ++} ++ + static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) + { + struct usb_hcd *hcd = dev_get_drvdata(dev); +@@ -524,7 +534,12 @@ static int __maybe_unused xhci_plat_runtime_resume(struct device *dev) + } + + const struct dev_pm_ops xhci_plat_pm_ops = { +- SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume) ++ .suspend = pm_sleep_ptr(xhci_plat_suspend), ++ .resume = pm_sleep_ptr(xhci_plat_resume), ++ .freeze = pm_sleep_ptr(xhci_plat_suspend), ++ .thaw = pm_sleep_ptr(xhci_plat_resume), ++ .poweroff = pm_sleep_ptr(xhci_plat_suspend), ++ .restore = pm_sleep_ptr(xhci_plat_restore), + + SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, + xhci_plat_runtime_resume, +-- +2.43.0 + diff --git a/queue-6.6/virtio_net-fix-d-directive-writing-between-1-and-11-.patch b/queue-6.6/virtio_net-fix-d-directive-writing-between-1-and-11-.patch new file mode 100644 index 00000000000..6689d5a091f --- /dev/null +++ b/queue-6.6/virtio_net-fix-d-directive-writing-between-1-and-11-.patch @@ -0,0 +1,84 @@ +From 324929a23c9ef4a5e5dd8fc18a379da32ea2039d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Jan 2024 10:09:02 +0800 +Subject: =?UTF-8?q?virtio=5Fnet:=20Fix=20"=E2=80=98%d=E2=80=99=20directive?= + =?UTF-8?q?=20writing=20between=201=20and=2011=20bytes=20into=20a=20region?= + =?UTF-8?q?=20of=20size=2010"=20warnings?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Zhu Yanjun + +[ Upstream commit e3fe8d28c67bf6c291e920c6d04fa22afa14e6e4 ] + +Fix the warnings when building virtio_net driver. + +" +drivers/net/virtio_net.c: In function ‘init_vqs’: +drivers/net/virtio_net.c:4551:48: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=] + 4551 | sprintf(vi->rq[i].name, "input.%d", i); + | ^~ +In function ‘virtnet_find_vqs’, + inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8: +drivers/net/virtio_net.c:4551:41: note: directive argument in the range [-2147483643, 65534] + 4551 | sprintf(vi->rq[i].name, "input.%d", i); + | ^~~~~~~~~~ +drivers/net/virtio_net.c:4551:17: note: ‘sprintf’ output between 8 and 18 bytes into a destination of size 16 + 4551 | sprintf(vi->rq[i].name, "input.%d", i); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +drivers/net/virtio_net.c: In function ‘init_vqs’: +drivers/net/virtio_net.c:4552:49: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=] + 4552 | sprintf(vi->sq[i].name, "output.%d", i); + | ^~ +In function ‘virtnet_find_vqs’, + inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8: +drivers/net/virtio_net.c:4552:41: note: directive argument in the range [-2147483643, 65534] + 4552 | sprintf(vi->sq[i].name, "output.%d", i); + | ^~~~~~~~~~~ +drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and 19 bytes into a destination of size 16 + 4552 | sprintf(vi->sq[i].name, "output.%d", i); + +" + +Reviewed-by: Xuan Zhuo +Signed-off-by: Zhu Yanjun +Link: https://lore.kernel.org/r/20240104020902.2753599-1-yanjun.zhu@intel.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/virtio_net.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c +index deb2229ab4d8..7cb0548d17a3 100644 +--- a/drivers/net/virtio_net.c ++++ b/drivers/net/virtio_net.c +@@ -4096,10 +4096,11 @@ static int virtnet_find_vqs(struct virtnet_info *vi) + { + vq_callback_t **callbacks; + struct virtqueue **vqs; +- int ret = -ENOMEM; +- int i, total_vqs; + const char **names; ++ int ret = -ENOMEM; ++ int total_vqs; + bool *ctx; ++ u16 i; + + /* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by + * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by +@@ -4136,8 +4137,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi) + for (i = 0; i < vi->max_queue_pairs; i++) { + callbacks[rxq2vq(i)] = skb_recv_done; + callbacks[txq2vq(i)] = skb_xmit_done; +- sprintf(vi->rq[i].name, "input.%d", i); +- sprintf(vi->sq[i].name, "output.%d", i); ++ sprintf(vi->rq[i].name, "input.%u", i); ++ sprintf(vi->sq[i].name, "output.%u", i); + names[rxq2vq(i)] = vi->rq[i].name; + names[txq2vq(i)] = vi->sq[i].name; + if (ctx) +-- +2.43.0 + diff --git a/queue-6.6/watchdog-it87_wdt-keep-wdtctrl-bit-3-unmodified-for-.patch b/queue-6.6/watchdog-it87_wdt-keep-wdtctrl-bit-3-unmodified-for-.patch new file mode 100644 index 00000000000..8568770172a --- /dev/null +++ b/queue-6.6/watchdog-it87_wdt-keep-wdtctrl-bit-3-unmodified-for-.patch @@ -0,0 +1,71 @@ +From 61ea8ddd524399b58a5dadcefaf07c92ff0b82f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Dec 2023 10:45:25 +0100 +Subject: watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 + +From: Werner Fischer + +[ Upstream commit d12971849d71781c1e4ffd1117d4878ce233d319 ] + +WDTCTRL bit 3 sets the mode choice for the clock input of IT8784/IT8786. +Some motherboards require this bit to be set to 1 (= PCICLK mode), +otherwise the watchdog functionality gets broken. The BIOS of those +motherboards sets WDTCTRL bit 3 already to 1. + +Instead of setting all bits of WDTCTRL to 0 by writing 0x00 to it, keep +bit 3 of it unchanged for IT8784/IT8786 chips. In this way, bit 3 keeps +the status as set by the BIOS of the motherboard. + +Watchdog tests have been successful with this patch with the following +systems: + IT8784: Thomas-Krenn LES plus v2 (YANLING YL-KBRL2 V2) + IT8786: Thomas-Krenn LES plus v3 (YANLING YL-CLU L2) + IT8786: Thomas-Krenn LES network 6L v2 (YANLING YL-CLU6L) + +Link: https://lore.kernel.org/all/140b264d-341f-465b-8715-dacfe84b3f71@roeck-us.net/ + +Signed-off-by: Werner Fischer +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20231213094525.11849-4-devlists@wefi.net +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/it87_wdt.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c +index bb1122909396..843f9f8e3917 100644 +--- a/drivers/watchdog/it87_wdt.c ++++ b/drivers/watchdog/it87_wdt.c +@@ -255,6 +255,7 @@ static struct watchdog_device wdt_dev = { + static int __init it87_wdt_init(void) + { + u8 chip_rev; ++ u8 ctrl; + int rc; + + rc = superio_enter(); +@@ -313,7 +314,18 @@ static int __init it87_wdt_init(void) + + superio_select(GPIO); + superio_outb(WDT_TOV1, WDTCFG); +- superio_outb(0x00, WDTCTRL); ++ ++ switch (chip_type) { ++ case IT8784_ID: ++ case IT8786_ID: ++ ctrl = superio_inb(WDTCTRL); ++ ctrl &= 0x08; ++ superio_outb(ctrl, WDTCTRL); ++ break; ++ default: ++ superio_outb(0x00, WDTCTRL); ++ } ++ + superio_exit(); + + if (timeout < 1 || timeout > max_units * 60) { +-- +2.43.0 + diff --git a/queue-6.6/watchdog-starfive-add-lock-annotations-to-fix-contex.patch b/queue-6.6/watchdog-starfive-add-lock-annotations-to-fix-contex.patch new file mode 100644 index 00000000000..4b319af65ca --- /dev/null +++ b/queue-6.6/watchdog-starfive-add-lock-annotations-to-fix-contex.patch @@ -0,0 +1,48 @@ +From 20e684853a9260530cdc9e7408eccb0e2ac2da09 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 08:51:18 +0000 +Subject: watchdog: starfive: add lock annotations to fix context imbalances + +From: Ben Dooks + +[ Upstream commit f77999887235f8c378af343df11a6bcedda5b284 ] + +Add the necessary __acquires() and __releases() to the functions +that take and release the wdt lock to avoid the following sparse +warnings: + +drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit +drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock + +Signed-off-by: Ben Dooks +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20231122085118.177589-1-ben.dooks@codethink.co.uk +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/starfive-wdt.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c +index 5f501b41faf9..49b38ecc092d 100644 +--- a/drivers/watchdog/starfive-wdt.c ++++ b/drivers/watchdog/starfive-wdt.c +@@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks) + + /* Write unlock-key to unlock. Write other value to lock. */ + static void starfive_wdt_unlock(struct starfive_wdt *wdt) ++ __acquires(&wdt->lock) + { + spin_lock(&wdt->lock); + writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock); + } + + static void starfive_wdt_lock(struct starfive_wdt *wdt) ++ __releases(&wdt->lock) + { + writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock); + spin_unlock(&wdt->lock); +-- +2.43.0 + diff --git a/queue-6.6/wifi-ath11k-fix-race-due-to-setting-ath11k_flag_ext_.patch b/queue-6.6/wifi-ath11k-fix-race-due-to-setting-ath11k_flag_ext_.patch new file mode 100644 index 00000000000..5434bb7b3ef --- /dev/null +++ b/queue-6.6/wifi-ath11k-fix-race-due-to-setting-ath11k_flag_ext_.patch @@ -0,0 +1,75 @@ +From d5644a63d4e3a62723c187a021da27b58c3217e9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 08:39:19 +0800 +Subject: wifi: ath11k: fix race due to setting ATH11K_FLAG_EXT_IRQ_ENABLED too + early + +From: Baochen Qiang + +[ Upstream commit 5082b3e3027eae393a4e86874bffb4ce3f83c26e ] + +We are seeing below error randomly in the case where only +one MSI vector is configured: + +kernel: ath11k_pci 0000:03:00.0: wmi command 16387 timeout + +The reason is, currently, in ath11k_pcic_ext_irq_enable(), +ATH11K_FLAG_EXT_IRQ_ENABLED is set before NAPI is enabled. +This results in a race condition: after +ATH11K_FLAG_EXT_IRQ_ENABLED is set but before NAPI enabled, +CE interrupt breaks in. Since IRQ is shared by CE and data +path, ath11k_pcic_ext_interrupt_handler() is also called +where we call disable_irq_nosync() to disable IRQ. Then +napi_schedule() is called but it does nothing because NAPI +is not enabled at that time, meaning +ath11k_pcic_ext_grp_napi_poll() will never run, so we have +no chance to call enable_irq() to enable IRQ back. Finally +we get above error. + +Fix it by setting ATH11K_FLAG_EXT_IRQ_ENABLED after all +NAPI and IRQ work are done. With the fix, we are sure that +by the time ATH11K_FLAG_EXT_IRQ_ENABLED is set, NAPI is +enabled. + +Note that the fix above also introduce some side effects: +if ath11k_pcic_ext_interrupt_handler() breaks in after NAPI +enabled but before ATH11K_FLAG_EXT_IRQ_ENABLED set, nothing +will be done by the handler this time, the work will be +postponed till the next time the IRQ fires. + +Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 + +Signed-off-by: Baochen Qiang +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231117003919.26218-1-quic_bqiang@quicinc.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/ath11k/pcic.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath11k/pcic.c b/drivers/net/wireless/ath/ath11k/pcic.c +index c63083633b37..011cf5fb8023 100644 +--- a/drivers/net/wireless/ath/ath11k/pcic.c ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -460,8 +460,6 @@ void ath11k_pcic_ext_irq_enable(struct ath11k_base *ab) + { + int i; + +- set_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); +- + for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { + struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + +@@ -471,6 +469,8 @@ void ath11k_pcic_ext_irq_enable(struct ath11k_base *ab) + } + ath11k_pcic_ext_grp_enable(irq_grp); + } ++ ++ set_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); + } + EXPORT_SYMBOL(ath11k_pcic_ext_irq_enable); + +-- +2.43.0 + diff --git a/queue-6.6/wifi-ath12k-fix-and-enable-ap-mode-for-wcn7850.patch b/queue-6.6/wifi-ath12k-fix-and-enable-ap-mode-for-wcn7850.patch new file mode 100644 index 00000000000..c540b1c4734 --- /dev/null +++ b/queue-6.6/wifi-ath12k-fix-and-enable-ap-mode-for-wcn7850.patch @@ -0,0 +1,74 @@ +From 67057e6b4fbd402c60ce2920024ed83a961581eb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Dec 2023 18:09:48 +0200 +Subject: wifi: ath12k: fix and enable AP mode for WCN7850 + +From: Kang Yang + +[ Upstream commit ed7e818a7b501012038d6bc6fedadaf7375a380a ] + +For AP mode, the peer is created earlier in ath12k_mac_op_add_interface() but +ath12k_mac_op_assign_vif_chanctx() will try to create peer again. Then an +error will return which makes AP mode startup fail. + +Kernel log: + +[ 5017.665006] ath12k_pci 0000:04:00.0: failed to create peer after vdev start delay: -22 + +wpa_supplicant log: + +Failed to set beacon parameters +Interface initialization failed +wls1: interface state UNINITIALIZED->DISABLED +wls1: AP-DISABLED +wls1: Unable to setup interface. +Failed to initialize AP interface +wls1: interface state DISABLED->DISABLED +wls1: AP-DISABLED + +So fix this check and enable AP mode for WCN7850, as now AP mode works normally. + +Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 + +Signed-off-by: Kang Yang +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231121022459.17209-1-quic_kangyang@quicinc.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/ath12k/hw.c | 3 ++- + drivers/net/wireless/ath/ath12k/mac.c | 4 ++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c +index 5991cc91cd00..c1dcdd849f9d 100644 +--- a/drivers/net/wireless/ath/ath12k/hw.c ++++ b/drivers/net/wireless/ath/ath12k/hw.c +@@ -942,7 +942,8 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { + .rx_mac_buf_ring = true, + .vdev_start_delay = true, + +- .interface_modes = BIT(NL80211_IFTYPE_STATION), ++ .interface_modes = BIT(NL80211_IFTYPE_STATION) | ++ BIT(NL80211_IFTYPE_AP), + .supports_monitor = false, + + .idle_ps = true, +diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c +index 88346e66bb75..5434883eaf96 100644 +--- a/drivers/net/wireless/ath/ath12k/mac.c ++++ b/drivers/net/wireless/ath/ath12k/mac.c +@@ -6196,8 +6196,8 @@ ath12k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, + } + + if (ab->hw_params->vdev_start_delay && +- (arvif->vdev_type == WMI_VDEV_TYPE_AP || +- arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)) { ++ arvif->vdev_type != WMI_VDEV_TYPE_AP && ++ arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) { + param.vdev_id = arvif->vdev_id; + param.peer_type = WMI_PEER_TYPE_DEFAULT; + param.peer_addr = ar->mac_addr; +-- +2.43.0 + diff --git a/queue-6.6/wifi-ath12k-fix-the-issue-that-the-multicast-broadca.patch b/queue-6.6/wifi-ath12k-fix-the-issue-that-the-multicast-broadca.patch new file mode 100644 index 00000000000..f53ea6ccda4 --- /dev/null +++ b/queue-6.6/wifi-ath12k-fix-the-issue-that-the-multicast-broadca.patch @@ -0,0 +1,44 @@ +From 097bb9ba05bc179efc960c0b3d858b8dd53fbffb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 22:17:59 +0800 +Subject: wifi: ath12k: fix the issue that the multicast/broadcast indicator is + not read correctly for WCN7850 + +From: Lingbo Kong + +[ Upstream commit 7133b072dfbfac8763ffb017642c9c894894c50d ] + +We observe some packets are discarded in ieee80211_rx_handlers_result +function for WCN7850. This is because the way to get multicast/broadcast +indicator with RX_MSDU_END_INFO5_DA_IS_MCBC & info5 is incorrect. It should +use RX_MSDU_END_INFO13_MCAST_BCAST & info13 to get multicast/broadcast +indicator. + +Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 + +Signed-off-by: Lingbo Kong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231206141759.5430-1-quic_lingbok@quicinc.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/ath12k/hal.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath12k/hal.c b/drivers/net/wireless/ath/ath12k/hal.c +index e7a150e7158e..b49a4add8828 100644 +--- a/drivers/net/wireless/ath/ath12k/hal.c ++++ b/drivers/net/wireless/ath/ath12k/hal.c +@@ -889,8 +889,8 @@ static u8 *ath12k_hw_wcn7850_rx_desc_mpdu_start_addr2(struct hal_rx_desc *desc) + + static bool ath12k_hw_wcn7850_rx_desc_is_da_mcbc(struct hal_rx_desc *desc) + { +- return __le16_to_cpu(desc->u.wcn7850.msdu_end.info5) & +- RX_MSDU_END_INFO5_DA_IS_MCBC; ++ return __le32_to_cpu(desc->u.wcn7850.msdu_end.info13) & ++ RX_MSDU_END_INFO13_MCAST_BCAST; + } + + static void ath12k_hw_wcn7850_rx_desc_get_dot11_hdr(struct hal_rx_desc *desc, +-- +2.43.0 + diff --git a/queue-6.6/wifi-ath9k-fix-potential-array-index-out-of-bounds-r.patch b/queue-6.6/wifi-ath9k-fix-potential-array-index-out-of-bounds-r.patch new file mode 100644 index 00000000000..ad3b590ca56 --- /dev/null +++ b/queue-6.6/wifi-ath9k-fix-potential-array-index-out-of-bounds-r.patch @@ -0,0 +1,61 @@ +From f2482040a952485d36f72151d0fc0fb6ad7a7215 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 20:31:04 +0200 +Subject: wifi: ath9k: Fix potential array-index-out-of-bounds read in + ath9k_htc_txstatus() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Minsuk Kang + +[ Upstream commit 2adc886244dff60f948497b59affb6c6ebb3c348 ] + +Fix an array-index-out-of-bounds read in ath9k_htc_txstatus(). The bug +occurs when txs->cnt, data from a URB provided by a USB device, is +bigger than the size of the array txs->txstatus, which is +HTC_MAX_TX_STATUS. WARN_ON() already checks it, but there is no bug +handling code after the check. Make the function return if that is the +case. + +Found by a modified version of syzkaller. + +UBSAN: array-index-out-of-bounds in htc_drv_txrx.c +index 13 is out of range for type '__wmi_event_txstatus [12]' +Call Trace: + ath9k_htc_txstatus + ath9k_wmi_event_tasklet + tasklet_action_common + __do_softirq + irq_exit_rxu + sysvec_apic_timer_interrupt + +Signed-off-by: Minsuk Kang +Acked-by: Toke Høiland-Jørgensen +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231113065756.1491991-1-linuxlovemin@yonsei.ac.kr +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +index 672789e3c55d..d6a3f001dacb 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +@@ -652,9 +652,10 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event) + struct ath9k_htc_tx_event *tx_pend; + int i; + +- for (i = 0; i < txs->cnt; i++) { +- WARN_ON(txs->cnt > HTC_MAX_TX_STATUS); ++ if (WARN_ON_ONCE(txs->cnt > HTC_MAX_TX_STATUS)) ++ return; + ++ for (i = 0; i < txs->cnt; i++) { + __txs = &txs->txstatus[i]; + + skb = ath9k_htc_tx_get_packet(priv, __txs); +-- +2.43.0 + diff --git a/queue-6.6/wifi-cfg80211-fix-rcu-dereference-in-__cfg80211_bss_.patch b/queue-6.6/wifi-cfg80211-fix-rcu-dereference-in-__cfg80211_bss_.patch new file mode 100644 index 00000000000..6efbbf61430 --- /dev/null +++ b/queue-6.6/wifi-cfg80211-fix-rcu-dereference-in-__cfg80211_bss_.patch @@ -0,0 +1,38 @@ +From 3d437e53e3e50e934485c14ac7a5736896cb79e9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jan 2024 20:13:51 +0800 +Subject: wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update + +From: Edward Adam Davis + +[ Upstream commit 1184950e341c11b6f82bc5b59564411d9537ab27 ] + +Replace rcu_dereference() with rcu_access_pointer() since we hold +the lock here (and aren't in an RCU critical section). + +Fixes: 32af9a9e1069 ("wifi: cfg80211: free beacon_ies when overridden from hidden BSS") +Reported-and-tested-by: syzbot+864a269c27ee06b58374@syzkaller.appspotmail.com +Signed-off-by: Edward Adam Davis +Link: https://msgid.link/tencent_BF8F0DF0258C8DBF124CDDE4DD8D992DCF07@qq.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/scan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index 04ef7cdd39b5..c646094a5fc4 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -1830,7 +1830,7 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev, + &hidden->hidden_list); + hidden->refcount++; + +- ies = (void *)rcu_dereference(new->pub.beacon_ies); ++ ies = (void *)rcu_access_pointer(new->pub.beacon_ies); + rcu_assign_pointer(new->pub.beacon_ies, + hidden->pub.beacon_ies); + if (ies) +-- +2.43.0 + diff --git a/queue-6.6/wifi-cfg80211-free-beacon_ies-when-overridden-from-h.patch b/queue-6.6/wifi-cfg80211-free-beacon_ies-when-overridden-from-h.patch new file mode 100644 index 00000000000..52656a52d48 --- /dev/null +++ b/queue-6.6/wifi-cfg80211-free-beacon_ies-when-overridden-from-h.patch @@ -0,0 +1,44 @@ +From b0a344d193a00bd070a42d55e94f4652bdff0375 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Dec 2023 13:41:41 +0200 +Subject: wifi: cfg80211: free beacon_ies when overridden from hidden BSS + +From: Benjamin Berg + +[ Upstream commit 32af9a9e1069e55bc02741fb00ac9d0ca1a2eaef ] + +This is a more of a cosmetic fix. The branch will only be taken if +proberesp_ies is set, which implies that beacon_ies is not set unless we +are connected to an AP that just did a channel switch. And, in that case +we should have found the BSS in the internal storage to begin with. + +Signed-off-by: Benjamin Berg +Reviewed-by: Johannes Berg +Signed-off-by: Miri Korenblit +Link: https://msgid.link/20231220133549.b898e22dadff.Id8c4c10aedd176ef2e18a4cad747b299f150f9df@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/scan.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index bd4dd75e446e..04ef7cdd39b5 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -1829,8 +1829,12 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev, + list_add(&new->hidden_list, + &hidden->hidden_list); + hidden->refcount++; ++ ++ ies = (void *)rcu_dereference(new->pub.beacon_ies); + rcu_assign_pointer(new->pub.beacon_ies, + hidden->pub.beacon_ies); ++ if (ies) ++ kfree_rcu(ies, rcu_head); + } + } else { + /* +-- +2.43.0 + diff --git a/queue-6.6/wifi-mt76-connac-fix-eht-phy-mode-check.patch b/queue-6.6/wifi-mt76-connac-fix-eht-phy-mode-check.patch new file mode 100644 index 00000000000..819fc636d82 --- /dev/null +++ b/queue-6.6/wifi-mt76-connac-fix-eht-phy-mode-check.patch @@ -0,0 +1,37 @@ +From 8bbada895e9f41b3b53072bbb3f0044819658edd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Nov 2023 18:03:02 +0800 +Subject: wifi: mt76: connac: fix EHT phy mode check + +From: MeiChia Chiu + +[ Upstream commit 2c2f50bf6407e1fd43a1a257916aeaa5ffdacd6c ] + +Add a BSS eht_support check before returning EHT phy mode. Without this +patch, there might be an inconsistency where the softmac layer thinks +the BSS is in HE mode, while the FW thinks it is in EHT mode. + +Signed-off-by: MeiChia Chiu +Signed-off-by: Shayne Chen +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +index 8274a57e1f0f..dc4fbab1e1b7 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +@@ -1347,7 +1347,7 @@ u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, + sband = phy->hw->wiphy->bands[band]; + eht_cap = ieee80211_get_eht_iftype_cap(sband, vif->type); + +- if (!eht_cap || !eht_cap->has_eht) ++ if (!eht_cap || !eht_cap->has_eht || !vif->bss_conf.eht_support) + return mode; + + switch (band) { +-- +2.43.0 + diff --git a/queue-6.6/wifi-mt76-mt7996-add-pci-ids-for-mt7992.patch b/queue-6.6/wifi-mt76-mt7996-add-pci-ids-for-mt7992.patch new file mode 100644 index 00000000000..084a917a5ed --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-add-pci-ids-for-mt7992.patch @@ -0,0 +1,60 @@ +From a5ad442d9d0484ad71ca7151d0c073e4fc96e630 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Nov 2023 15:06:19 +0800 +Subject: wifi: mt76: mt7996: add PCI IDs for mt7992 + +From: StanleyYP Wang + +[ Upstream commit 3d3f117a259a65353bf2714a18e25731b3ca5770 ] + +Add PCI device IDs to enable mt7992 chipsets support. + +Signed-off-by: StanleyYP Wang +Signed-off-by: Shayne Chen +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/pci.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/pci.c b/drivers/net/wireless/mediatek/mt76/mt7996/pci.c +index c5301050ff8b..67c015896243 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/pci.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/pci.c +@@ -17,11 +17,13 @@ static u32 hif_idx; + + static const struct pci_device_id mt7996_pci_device_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7990) }, ++ { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7992) }, + { }, + }; + + static const struct pci_device_id mt7996_hif_device_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7991) }, ++ { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x799a) }, + { }, + }; + +@@ -60,7 +62,9 @@ static void mt7996_put_hif2(struct mt7996_hif *hif) + static struct mt7996_hif *mt7996_pci_init_hif2(struct pci_dev *pdev) + { + hif_idx++; +- if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x7991, NULL)) ++ ++ if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x7991, NULL) && ++ !pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x799a, NULL)) + return NULL; + + writel(hif_idx | MT_PCIE_RECOG_ID_SEM, +@@ -113,7 +117,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev, + + mt76_pci_disable_aspm(pdev); + +- if (id->device == 0x7991) ++ if (id->device == 0x7991 || id->device == 0x799a) + return mt7996_pci_hif2_probe(pdev); + + dev = mt7996_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0], +-- +2.43.0 + diff --git a/queue-6.6/wifi-rt2x00-correct-wrong-bbp-register-in-rxdcoc-cal.patch b/queue-6.6/wifi-rt2x00-correct-wrong-bbp-register-in-rxdcoc-cal.patch new file mode 100644 index 00000000000..61e878663d6 --- /dev/null +++ b/queue-6.6/wifi-rt2x00-correct-wrong-bbp-register-in-rxdcoc-cal.patch @@ -0,0 +1,39 @@ +From 3677d4f557df88f76c39cc95fbe75db3d5e6a937 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Nov 2023 12:38:51 +0800 +Subject: wifi: rt2x00: correct wrong BBP register in RxDCOC calibration + +From: Shiji Yang + +[ Upstream commit 50da74e1e8b682853d1e07fc8bbe3a0774ae5e09 ] + +Refer to Mediatek vendor driver RxDCOC_Calibration() function, when +performing gainfreeze calibration, we should write register 140 +instead of 141. This fix can reduce the total calibration time from +6 seconds to 1 second. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315B13B89DF57B6B27BB854BCAFA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +index e65cc00fa17c..c13ae87f94f4 100644 +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8695,7 +8695,7 @@ static void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) + rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); + rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, saverfb7r4); + +- rt2800_bbp_write(rt2x00dev, 158, 141); ++ rt2800_bbp_write(rt2x00dev, 158, 140); + bbpreg = rt2800_bbp_read(rt2x00dev, 159); + bbpreg = bbpreg & (~0x40); + rt2800_bbp_write(rt2x00dev, 159, bbpreg); +-- +2.43.0 + diff --git a/queue-6.6/wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch b/queue-6.6/wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch new file mode 100644 index 00000000000..47c11ee6bd7 --- /dev/null +++ b/queue-6.6/wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch @@ -0,0 +1,79 @@ +From bdb061b36476434f1b5361fc240d50d64553f065 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Nov 2023 16:58:00 +0800 +Subject: wifi: rt2x00: restart beacon queue when hardware reset + +From: Shiji Yang + +[ Upstream commit a11d965a218f0cd95b13fe44d0bcd8a20ce134a8 ] + +When a hardware reset is triggered, all registers are reset, so all +queues are forced to stop in hardware interface. However, mac80211 +will not automatically stop the queue. If we don't manually stop the +beacon queue, the queue will be deadlocked and unable to start again. +This patch fixes the issue where Apple devices cannot connect to the +AP after calling ieee80211_restart_hw(). + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031530EB6D98DCE4DF20766CBCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 +++ + drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 11 +++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +index 9a9cfd0ce402..00b945053e19 100644 +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -101,6 +101,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) + rt2x00link_stop_tuner(rt2x00dev); + rt2x00queue_stop_queues(rt2x00dev); + rt2x00queue_flush_queues(rt2x00dev, true); ++ rt2x00queue_stop_queue(rt2x00dev->bcn); + + /* + * Disable radio. +@@ -1286,6 +1287,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; + rt2x00dev->intf_associated = 0; ++ rt2x00dev->intf_beaconing = 0; + + /* Enable the radio */ + retval = rt2x00lib_enable_radio(rt2x00dev); +@@ -1312,6 +1314,7 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; + rt2x00dev->intf_associated = 0; ++ rt2x00dev->intf_beaconing = 0; + } + + static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +index 4202c6517783..75fda72c14ca 100644 +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +@@ -598,6 +598,17 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, + */ + if (changes & BSS_CHANGED_BEACON_ENABLED) { + mutex_lock(&intf->beacon_skb_mutex); ++ ++ /* ++ * Clear the 'enable_beacon' flag and clear beacon because ++ * the beacon queue has been stopped after hardware reset. ++ */ ++ if (test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags) && ++ intf->enable_beacon) { ++ intf->enable_beacon = false; ++ rt2x00queue_clear_beacon(rt2x00dev, vif); ++ } ++ + if (!bss_conf->enable_beacon && intf->enable_beacon) { + rt2x00dev->intf_beaconing--; + intf->enable_beacon = false; +-- +2.43.0 + diff --git a/queue-6.6/wifi-rtl8xxxu-add-additional-usb-ids-for-rtl8192eu-d.patch b/queue-6.6/wifi-rtl8xxxu-add-additional-usb-ids-for-rtl8192eu-d.patch new file mode 100644 index 00000000000..0c3bb467fef --- /dev/null +++ b/queue-6.6/wifi-rtl8xxxu-add-additional-usb-ids-for-rtl8192eu-d.patch @@ -0,0 +1,48 @@ +From 1d0456a3da3ab742a7daefd1d6b513e762a279d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 17 Dec 2023 20:30:17 +0800 +Subject: wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices + +From: Zenm Chen + +[ Upstream commit 4e87ca403e2008b9e182239e1abbf6876a55eb33 ] + +Add additional USB IDs found in the vendor driver from +https://github.com/Mange/rtl8192eu-linux-driver to support more +RTL8192EU devices. + +Signed-off-by: Zenm Chen +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231217123017.1982-1-zenmchen@gmail.com +Signed-off-by: Sasha Levin +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +index 5d102a1246a3..77b356fedd82 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -7959,6 +7959,18 @@ static const struct usb_device_id dev_table[] = { + .driver_info = (unsigned long)&rtl8192eu_fops}, + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x818c, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, ++/* D-Link DWA-131 rev C1 */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3312, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8192eu_fops}, ++/* TP-Link TL-WN8200ND V2 */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0126, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8192eu_fops}, ++/* Mercusys MW300UM */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0100, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8192eu_fops}, ++/* Mercusys MW300UH */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0104, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8192eu_fops}, + #endif + { } + }; +-- +2.43.0 + diff --git a/queue-6.6/wifi-rtlwifi-rtl8723-be-ae-using-calculate_bit_shift.patch b/queue-6.6/wifi-rtlwifi-rtl8723-be-ae-using-calculate_bit_shift.patch new file mode 100644 index 00000000000..29b03ecfc02 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-rtl8723-be-ae-using-calculate_bit_shift.patch @@ -0,0 +1,77 @@ +From 811431cedf803eebebaba436409afedd4635ca5b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Dec 2023 14:57:39 +0800 +Subject: wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift() + +From: Su Hui + +[ Upstream commit 5c16618bc06a41ad68fd8499a21d35ef57ca06c2 ] + +Using calculate_bit_shift() to replace rtl8723_phy_calculate_bit_shift(). +And fix an undefined bitwise shift behavior problem. + +Signed-off-by: Su Hui +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231219065739.1895666-12-suhui@nfschina.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c | 6 +++--- + drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c +index fe9b407dc2af..71e29b103da5 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c +@@ -49,7 +49,7 @@ u32 rtl8723e_phy_query_rf_reg(struct ieee80211_hw *hw, + rfpath, regaddr); + } + +- bitshift = rtl8723_phy_calculate_bit_shift(bitmask); ++ bitshift = calculate_bit_shift(bitmask); + readback_value = (original_value & bitmask) >> bitshift; + + spin_unlock(&rtlpriv->locks.rf_lock); +@@ -80,7 +80,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw, + original_value = rtl8723_phy_rf_serial_read(hw, + rfpath, + regaddr); +- bitshift = rtl8723_phy_calculate_bit_shift(bitmask); ++ bitshift = calculate_bit_shift(bitmask); + data = + ((original_value & (~bitmask)) | + (data << bitshift)); +@@ -89,7 +89,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw, + rtl8723_phy_rf_serial_write(hw, rfpath, regaddr, data); + } else { + if (bitmask != RFREG_OFFSET_MASK) { +- bitshift = rtl8723_phy_calculate_bit_shift(bitmask); ++ bitshift = calculate_bit_shift(bitmask); + data = + ((original_value & (~bitmask)) | + (data << bitshift)); +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +index 2b9313cb93db..094cb36153f5 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +@@ -41,7 +41,7 @@ u32 rtl8723be_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, + spin_lock(&rtlpriv->locks.rf_lock); + + original_value = rtl8723_phy_rf_serial_read(hw, rfpath, regaddr); +- bitshift = rtl8723_phy_calculate_bit_shift(bitmask); ++ bitshift = calculate_bit_shift(bitmask); + readback_value = (original_value & bitmask) >> bitshift; + + spin_unlock(&rtlpriv->locks.rf_lock); +@@ -68,7 +68,7 @@ void rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path path, + if (bitmask != RFREG_OFFSET_MASK) { + original_value = rtl8723_phy_rf_serial_read(hw, path, + regaddr); +- bitshift = rtl8723_phy_calculate_bit_shift(bitmask); ++ bitshift = calculate_bit_shift(bitmask); + data = ((original_value & (~bitmask)) | + (data << bitshift)); + } +-- +2.43.0 + diff --git a/queue-6.6/wifi-rtw89-coex-fix-wrong-wi-fi-role-info-and-fddt-p.patch b/queue-6.6/wifi-rtw89-coex-fix-wrong-wi-fi-role-info-and-fddt-p.patch new file mode 100644 index 00000000000..089d1a9b93c --- /dev/null +++ b/queue-6.6/wifi-rtw89-coex-fix-wrong-wi-fi-role-info-and-fddt-p.patch @@ -0,0 +1,79 @@ +From 248734cc1aa5697c3f87bf3fccc0eb02b1306525 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Dec 2023 14:13:31 +0800 +Subject: wifi: rtw89: coex: Fix wrong Wi-Fi role info and FDDT parameter + members + +From: Ching-Te Ku + +[ Upstream commit acc55d7dd4de525ac07e43e90ea3cc630677ec8a ] + +The Wi-Fi firmware 29.29.X should use version 2 role info format. FDDT +mechanism version 5 use the same cell members to judge traffic situation, +don't need to add another new format. + +Signed-off-by: Ching-Te Ku +Signed-off-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231218061341.51255-2-pkshih@realtek.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtw89/coex.c | 4 ++-- + drivers/net/wireless/realtek/rtw89/core.h | 12 +++--------- + 2 files changed, 5 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c +index 4ba8b3df70ae..6ab1b6ffbb50 100644 +--- a/drivers/net/wireless/realtek/rtw89/coex.c ++++ b/drivers/net/wireless/realtek/rtw89/coex.c +@@ -131,7 +131,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = { + .fcxbtcrpt = 105, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 5, + .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 2, .fcxgpiodbg = 1, + .fcxbtver = 1, .fcxbtscan = 2, .fcxbtafh = 2, .fcxbtdevinfo = 1, +- .fwlrole = 1, .frptmap = 3, .fcxctrl = 1, ++ .fwlrole = 2, .frptmap = 3, .fcxctrl = 1, + .info_buf = 1800, .max_role_num = 6, + }, + {RTL8852C, RTW89_FW_VER_CODE(0, 27, 57, 0), +@@ -159,7 +159,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = { + .fcxbtcrpt = 105, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 5, + .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 2, .fcxgpiodbg = 1, + .fcxbtver = 1, .fcxbtscan = 2, .fcxbtafh = 2, .fcxbtdevinfo = 1, +- .fwlrole = 1, .frptmap = 3, .fcxctrl = 1, ++ .fwlrole = 2, .frptmap = 3, .fcxctrl = 1, + .info_buf = 1800, .max_role_num = 6, + }, + {RTL8852B, RTW89_FW_VER_CODE(0, 29, 14, 0), +diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h +index 04ce221730f9..ee6ae2a0c798 100644 +--- a/drivers/net/wireless/realtek/rtw89/core.h ++++ b/drivers/net/wireless/realtek/rtw89/core.h +@@ -2230,12 +2230,6 @@ struct rtw89_btc_fbtc_fddt_cell_status { + u8 state_phase; /* [0:3] train state, [4:7] train phase */ + } __packed; + +-struct rtw89_btc_fbtc_fddt_cell_status_v5 { +- s8 wl_tx_pwr; +- s8 bt_tx_pwr; +- s8 bt_rx_gain; +-} __packed; +- + struct rtw89_btc_fbtc_cysta_v3 { /* statistics for cycles */ + u8 fver; + u8 rsvd; +@@ -2299,9 +2293,9 @@ struct rtw89_btc_fbtc_cysta_v5 { /* statistics for cycles */ + struct rtw89_btc_fbtc_cycle_a2dp_empty_info a2dp_ept; + struct rtw89_btc_fbtc_a2dp_trx_stat_v4 a2dp_trx[BTC_CYCLE_SLOT_MAX]; + struct rtw89_btc_fbtc_cycle_fddt_info_v5 fddt_trx[BTC_CYCLE_SLOT_MAX]; +- struct rtw89_btc_fbtc_fddt_cell_status_v5 fddt_cells[FDD_TRAIN_WL_DIRECTION] +- [FDD_TRAIN_WL_RSSI_LEVEL] +- [FDD_TRAIN_BT_RSSI_LEVEL]; ++ struct rtw89_btc_fbtc_fddt_cell_status fddt_cells[FDD_TRAIN_WL_DIRECTION] ++ [FDD_TRAIN_WL_RSSI_LEVEL] ++ [FDD_TRAIN_BT_RSSI_LEVEL]; + __le32 except_map; + } __packed; + +-- +2.43.0 + diff --git a/queue-6.6/wifi-rtw89-fix-misbehavior-of-tx-beacon-in-concurren.patch b/queue-6.6/wifi-rtw89-fix-misbehavior-of-tx-beacon-in-concurren.patch new file mode 100644 index 00000000000..9cfa6e1e64c --- /dev/null +++ b/queue-6.6/wifi-rtw89-fix-misbehavior-of-tx-beacon-in-concurren.patch @@ -0,0 +1,172 @@ +From cdf627b39ed94ef4961e35dd738faad4523be382 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Nov 2023 15:00:46 +0800 +Subject: wifi: rtw89: fix misbehavior of TX beacon in concurrent mode + +From: Chih-Kang Chang + +[ Upstream commit 756b31203d482d2dd1aa6c208978b0410dc7530f ] + +In concurrent mode, when STA interface is scanning, it causes +AP interface TX beacon on wrong channel. We modified it to scan +with the operating channel when one of the interfaces is already +connected. Additionally, STA interface need to stop scan when AP +interface is starting to avoid TX beacon on wrong channel. Finally, +AP interface need to stop TX beacon when STA interface is scanning +and switching to non-OP channel,This prevent other device to get +beacons on wrong channel. + +Signed-off-by: Chih-Kang Chang +Signed-off-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231129070046.18443-5-pkshih@realtek.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtw89/fw.c | 17 +++++++++-- + drivers/net/wireless/realtek/rtw89/mac.c | 29 +++++++++++++++---- + drivers/net/wireless/realtek/rtw89/mac.h | 1 + + drivers/net/wireless/realtek/rtw89/mac80211.c | 3 ++ + 4 files changed, 43 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c +index df1dc2f43c86..468cfa43ec04 100644 +--- a/drivers/net/wireless/realtek/rtw89/fw.c ++++ b/drivers/net/wireless/realtek/rtw89/fw.c +@@ -3912,6 +3912,7 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, + rtw89_core_scan_complete(rtwdev, vif, true); + ieee80211_scan_completed(rtwdev->hw, &info); + ieee80211_wake_queues(rtwdev->hw); ++ rtw89_mac_enable_beacon_for_ap_vifs(rtwdev, true); + + rtw89_release_pkt_list(rtwdev); + rtwvif = (struct rtw89_vif *)vif->drv_priv; +@@ -3929,6 +3930,19 @@ void rtw89_hw_scan_abort(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif) + rtw89_hw_scan_complete(rtwdev, vif, true); + } + ++static bool rtw89_is_any_vif_connected_or_connecting(struct rtw89_dev *rtwdev) ++{ ++ struct rtw89_vif *rtwvif; ++ ++ rtw89_for_each_rtwvif(rtwdev, rtwvif) { ++ /* This variable implies connected or during attempt to connect */ ++ if (!is_zero_ether_addr(rtwvif->bssid)) ++ return true; ++ } ++ ++ return false; ++} ++ + int rtw89_hw_scan_offload(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, + bool enable) + { +@@ -3941,8 +3955,7 @@ int rtw89_hw_scan_offload(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, + if (!rtwvif) + return -EINVAL; + +- /* This variable implies connected or during attempt to connect */ +- connected = !is_zero_ether_addr(rtwvif->bssid); ++ connected = rtw89_is_any_vif_connected_or_connecting(rtwdev); + opt.enable = enable; + opt.target_ch_mode = connected; + if (enable) { +diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c +index fab9f5004a75..3c818c4b4653 100644 +--- a/drivers/net/wireless/realtek/rtw89/mac.c ++++ b/drivers/net/wireless/realtek/rtw89/mac.c +@@ -3833,11 +3833,9 @@ static void rtw89_mac_port_cfg_rx_sync(struct rtw89_dev *rtwdev, + } + + static void rtw89_mac_port_cfg_tx_sw(struct rtw89_dev *rtwdev, +- struct rtw89_vif *rtwvif) ++ struct rtw89_vif *rtwvif, bool en) + { + const struct rtw89_port_reg *p = &rtw_port_base; +- bool en = rtwvif->net_type == RTW89_NET_TYPE_AP_MODE || +- rtwvif->net_type == RTW89_NET_TYPE_AD_HOC; + + if (en) + rtw89_write32_port_set(rtwdev, rtwvif, p->port_cfg, B_AX_BCNTX_EN); +@@ -3845,6 +3843,24 @@ static void rtw89_mac_port_cfg_tx_sw(struct rtw89_dev *rtwdev, + rtw89_write32_port_clr(rtwdev, rtwvif, p->port_cfg, B_AX_BCNTX_EN); + } + ++static void rtw89_mac_port_cfg_tx_sw_by_nettype(struct rtw89_dev *rtwdev, ++ struct rtw89_vif *rtwvif) ++{ ++ bool en = rtwvif->net_type == RTW89_NET_TYPE_AP_MODE || ++ rtwvif->net_type == RTW89_NET_TYPE_AD_HOC; ++ ++ rtw89_mac_port_cfg_tx_sw(rtwdev, rtwvif, en); ++} ++ ++void rtw89_mac_enable_beacon_for_ap_vifs(struct rtw89_dev *rtwdev, bool en) ++{ ++ struct rtw89_vif *rtwvif; ++ ++ rtw89_for_each_rtwvif(rtwdev, rtwvif) ++ if (rtwvif->net_type == RTW89_NET_TYPE_AP_MODE) ++ rtw89_mac_port_cfg_tx_sw(rtwdev, rtwvif, en); ++} ++ + static void rtw89_mac_port_cfg_bcn_intv(struct rtw89_dev *rtwdev, + struct rtw89_vif *rtwvif) + { +@@ -4137,7 +4153,7 @@ int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) + rtw89_mac_port_cfg_bcn_prct(rtwdev, rtwvif); + rtw89_mac_port_cfg_rx_sw(rtwdev, rtwvif); + rtw89_mac_port_cfg_rx_sync(rtwdev, rtwvif); +- rtw89_mac_port_cfg_tx_sw(rtwdev, rtwvif); ++ rtw89_mac_port_cfg_tx_sw_by_nettype(rtwdev, rtwvif); + rtw89_mac_port_cfg_bcn_intv(rtwdev, rtwvif); + rtw89_mac_port_cfg_hiq_win(rtwdev, rtwvif); + rtw89_mac_port_cfg_hiq_dtim(rtwdev, rtwvif); +@@ -4298,8 +4314,10 @@ rtw89_mac_c2h_scanofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h, + + switch (reason) { + case RTW89_SCAN_LEAVE_CH_NOTIFY: +- if (rtw89_is_op_chan(rtwdev, band, chan)) ++ if (rtw89_is_op_chan(rtwdev, band, chan)) { ++ rtw89_mac_enable_beacon_for_ap_vifs(rtwdev, false); + ieee80211_stop_queues(rtwdev->hw); ++ } + return; + case RTW89_SCAN_END_SCAN_NOTIFY: + if (rtwvif && rtwvif->scan_req && +@@ -4317,6 +4335,7 @@ rtw89_mac_c2h_scanofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h, + if (rtw89_is_op_chan(rtwdev, band, chan)) { + rtw89_assign_entity_chan(rtwdev, rtwvif->sub_entity_idx, + &rtwdev->scan_info.op_chan); ++ rtw89_mac_enable_beacon_for_ap_vifs(rtwdev, true); + ieee80211_wake_queues(rtwdev->hw); + } else { + rtw89_chan_create(&new, chan, chan, band, +diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h +index 7cf34137c0bc..7c57ab2814c7 100644 +--- a/drivers/net/wireless/realtek/rtw89/mac.h ++++ b/drivers/net/wireless/realtek/rtw89/mac.h +@@ -974,6 +974,7 @@ int rtw89_mac_port_get_tsf(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, + void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev, + struct ieee80211_vif *vif); + void rtw89_mac_stop_ap(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif); ++void rtw89_mac_enable_beacon_for_ap_vifs(struct rtw89_dev *rtwdev, bool en); + int rtw89_mac_remove_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *vif); + void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev); + int rtw89_mac_enable_cpu(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw); +diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c +index 5e48618706d9..e70757e4dc2c 100644 +--- a/drivers/net/wireless/realtek/rtw89/mac80211.c ++++ b/drivers/net/wireless/realtek/rtw89/mac80211.c +@@ -472,6 +472,9 @@ static int rtw89_ops_start_ap(struct ieee80211_hw *hw, + return -EOPNOTSUPP; + } + ++ if (rtwdev->scanning) ++ rtw89_hw_scan_abort(rtwdev, rtwdev->scan_info.scanning_vif); ++ + ether_addr_copy(rtwvif->bssid, vif->bss_conf.bssid); + rtw89_cam_bssid_changed(rtwdev, rtwvif); + rtw89_mac_port_update(rtwdev, rtwvif); +-- +2.43.0 + diff --git a/queue-6.6/wifi-rtw89-fix-timeout-calculation-in-rtw89_roc_end.patch b/queue-6.6/wifi-rtw89-fix-timeout-calculation-in-rtw89_roc_end.patch new file mode 100644 index 00000000000..bd74bd95447 --- /dev/null +++ b/queue-6.6/wifi-rtw89-fix-timeout-calculation-in-rtw89_roc_end.patch @@ -0,0 +1,41 @@ +From 212e93267ced36db729018689c505885548fe400 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Oct 2023 17:31:33 +0300 +Subject: wifi: rtw89: fix timeout calculation in rtw89_roc_end() + +From: Dmitry Antipov + +[ Upstream commit e416514e309f7e25e577fee45a65f246f67b2261 ] + +Since 'rtw89_core_tx_kick_off_and_wait()' assumes timeout +(actually RTW89_ROC_TX_TIMEOUT) in milliseconds, I suppose +that RTW89_ROC_IDLE_TIMEOUT is in milliseconds as well. If +so, 'msecs_to_jiffies()' should be used in a call to +'ieee80211_queue_delayed_work()' from 'rtw89_roc_end()'. +Compile tested only. + +Signed-off-by: Dmitry Antipov +Acked-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231024143137.30393-1-dmantipov@yandex.ru +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtw89/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c +index 133bf289bacb..535393eca564 100644 +--- a/drivers/net/wireless/realtek/rtw89/core.c ++++ b/drivers/net/wireless/realtek/rtw89/core.c +@@ -2548,7 +2548,7 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) + + if (hw->conf.flags & IEEE80211_CONF_IDLE) + ieee80211_queue_delayed_work(hw, &roc->roc_work, +- RTW89_ROC_IDLE_TIMEOUT); ++ msecs_to_jiffies(RTW89_ROC_IDLE_TIMEOUT)); + } + + void rtw89_roc_work(struct work_struct *work) +-- +2.43.0 + diff --git a/queue-6.6/wifi-wfx-fix-possible-null-pointer-dereference-in-wf.patch b/queue-6.6/wifi-wfx-fix-possible-null-pointer-dereference-in-wf.patch new file mode 100644 index 00000000000..ca18f648bbd --- /dev/null +++ b/queue-6.6/wifi-wfx-fix-possible-null-pointer-dereference-in-wf.patch @@ -0,0 +1,98 @@ +From b42d3646b322aff0f9382d3b31ab7a084d4b61d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 20:11:28 +0300 +Subject: wifi: wfx: fix possible NULL pointer dereference in wfx_set_mfp_ap() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Dmitry Antipov + +[ Upstream commit fe0a7776d4d19e613bb8dd80fe2d78ae49e8b49d ] + +Since 'ieee80211_beacon_get()' can return NULL, 'wfx_set_mfp_ap()' +should check the return value before examining skb data. So convert +the latter to return an appropriate error code and propagate it to +return from 'wfx_start_ap()' as well. Compile tested only. + +Signed-off-by: Dmitry Antipov +Tested-by: Jérôme Pouiller +Acked-by: Jérôme Pouiller +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231204171130.141394-1-dmantipov@yandex.ru +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/silabs/wfx/sta.c | 42 ++++++++++++++++----------- + 1 file changed, 25 insertions(+), 17 deletions(-) + +diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c +index 626dfb4b7a55..073e870b2641 100644 +--- a/drivers/net/wireless/silabs/wfx/sta.c ++++ b/drivers/net/wireless/silabs/wfx/sta.c +@@ -354,29 +354,38 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) + return 0; + } + +-static void wfx_set_mfp_ap(struct wfx_vif *wvif) ++static int wfx_set_mfp_ap(struct wfx_vif *wvif) + { + struct ieee80211_vif *vif = wvif_to_vif(wvif); + struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, vif, 0); + const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); +- const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, skb->data + ieoffset, +- skb->len - ieoffset); + const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); + const int pairwise_cipher_suite_size = 4 / sizeof(u16); + const int akm_suite_size = 4 / sizeof(u16); ++ const u16 *ptr; + +- if (ptr) { +- ptr += pairwise_cipher_suite_count_offset; +- if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) +- return; +- ptr += 1 + pairwise_cipher_suite_size * *ptr; +- if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) +- return; +- ptr += 1 + akm_suite_size * *ptr; +- if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) +- return; +- wfx_hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); +- } ++ if (unlikely(!skb)) ++ return -ENOMEM; ++ ++ ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, skb->data + ieoffset, ++ skb->len - ieoffset); ++ if (unlikely(!ptr)) ++ return -EINVAL; ++ ++ ptr += pairwise_cipher_suite_count_offset; ++ if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) ++ return -EINVAL; ++ ++ ptr += 1 + pairwise_cipher_suite_size * *ptr; ++ if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) ++ return -EINVAL; ++ ++ ptr += 1 + akm_suite_size * *ptr; ++ if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) ++ return -EINVAL; ++ ++ wfx_hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); ++ return 0; + } + + int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +@@ -394,8 +403,7 @@ int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + ret = wfx_hif_start(wvif, &vif->bss_conf, wvif->channel); + if (ret > 0) + return -EIO; +- wfx_set_mfp_ap(wvif); +- return ret; ++ return wfx_set_mfp_ap(wvif); + } + + void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +-- +2.43.0 + diff --git a/queue-6.6/x86-boot-ignore-nmis-during-very-early-boot.patch b/queue-6.6/x86-boot-ignore-nmis-during-very-early-boot.patch new file mode 100644 index 00000000000..7e873a98a42 --- /dev/null +++ b/queue-6.6/x86-boot-ignore-nmis-during-very-early-boot.patch @@ -0,0 +1,94 @@ +From 514a2432a59cd4ea75b275ddce462fe5d4d3c558 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Nov 2023 15:44:49 -0500 +Subject: x86/boot: Ignore NMIs during very early boot + +From: Jun'ichi Nomura + +[ Upstream commit 78a509fba9c9b1fcb77f95b7c6be30da3d24823a ] + +When there are two racing NMIs on x86, the first NMI invokes NMI handler and +the 2nd NMI is latched until IRET is executed. + +If panic on NMI and panic kexec are enabled, the first NMI triggers +panic and starts booting the next kernel via kexec. Note that the 2nd +NMI is still latched. During the early boot of the next kernel, once +an IRET is executed as a result of a page fault, then the 2nd NMI is +unlatched and invokes the NMI handler. + +However, NMI handler is not set up at the early stage of boot, which +results in a boot failure. + +Avoid such problems by setting up a NOP handler for early NMIs. + +[ mingo: Refined the changelog. ] + +Signed-off-by: Jun'ichi Nomura +Signed-off-by: Derek Barbosa +Signed-off-by: Ingo Molnar +Cc: Kees Cook +Cc: Linus Torvalds +Cc: Paul E. McKenney +Cc: Andy Lutomirski +Cc: "H. Peter Anvin" +Cc: Peter Zijlstra +Signed-off-by: Sasha Levin +--- + arch/x86/boot/compressed/ident_map_64.c | 5 +++++ + arch/x86/boot/compressed/idt_64.c | 1 + + arch/x86/boot/compressed/idt_handlers_64.S | 1 + + arch/x86/boot/compressed/misc.h | 1 + + 4 files changed, 8 insertions(+) + +diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c +index 08f93b0401bb..aead80ec70a0 100644 +--- a/arch/x86/boot/compressed/ident_map_64.c ++++ b/arch/x86/boot/compressed/ident_map_64.c +@@ -385,3 +385,8 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code) + */ + kernel_add_identity_map(address, end); + } ++ ++void do_boot_nmi_trap(struct pt_regs *regs, unsigned long error_code) ++{ ++ /* Empty handler to ignore NMI during early boot */ ++} +diff --git a/arch/x86/boot/compressed/idt_64.c b/arch/x86/boot/compressed/idt_64.c +index 3cdf94b41456..d100284bbef4 100644 +--- a/arch/x86/boot/compressed/idt_64.c ++++ b/arch/x86/boot/compressed/idt_64.c +@@ -61,6 +61,7 @@ void load_stage2_idt(void) + boot_idt_desc.address = (unsigned long)boot_idt; + + set_idt_entry(X86_TRAP_PF, boot_page_fault); ++ set_idt_entry(X86_TRAP_NMI, boot_nmi_trap); + + #ifdef CONFIG_AMD_MEM_ENCRYPT + /* +diff --git a/arch/x86/boot/compressed/idt_handlers_64.S b/arch/x86/boot/compressed/idt_handlers_64.S +index 22890e199f5b..4d03c8562f63 100644 +--- a/arch/x86/boot/compressed/idt_handlers_64.S ++++ b/arch/x86/boot/compressed/idt_handlers_64.S +@@ -70,6 +70,7 @@ SYM_FUNC_END(\name) + .code64 + + EXCEPTION_HANDLER boot_page_fault do_boot_page_fault error_code=1 ++EXCEPTION_HANDLER boot_nmi_trap do_boot_nmi_trap error_code=0 + + #ifdef CONFIG_AMD_MEM_ENCRYPT + EXCEPTION_HANDLER boot_stage1_vc do_vc_no_ghcb error_code=1 +diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h +index cc70d3fb9049..aae1a2db4251 100644 +--- a/arch/x86/boot/compressed/misc.h ++++ b/arch/x86/boot/compressed/misc.h +@@ -197,6 +197,7 @@ static inline void cleanup_exception_handling(void) { } + + /* IDT Entry Points */ + void boot_page_fault(void); ++void boot_nmi_trap(void); + void boot_stage1_vc(void); + void boot_stage2_vc(void); + +-- +2.43.0 + diff --git a/queue-6.6/x86-mce-mark-fatal-mce-s-page-as-poison-to-avoid-pan.patch b/queue-6.6/x86-mce-mark-fatal-mce-s-page-as-poison-to-avoid-pan.patch new file mode 100644 index 00000000000..9ca9f4a79aa --- /dev/null +++ b/queue-6.6/x86-mce-mark-fatal-mce-s-page-as-poison-to-avoid-pan.patch @@ -0,0 +1,83 @@ +From 28ecc6b653f2de33d74a7922d8ed7cdc696c5d85 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Oct 2023 08:39:03 +0800 +Subject: x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump + kernel + +From: Zhiquan Li + +[ Upstream commit 9f3b130048bfa2e44a8cfb1b616f826d9d5d8188 ] + +Memory errors don't happen very often, especially fatal ones. However, +in large-scale scenarios such as data centers, that probability +increases with the amount of machines present. + +When a fatal machine check happens, mce_panic() is called based on the +severity grading of that error. The page containing the error is not +marked as poison. + +However, when kexec is enabled, tools like makedumpfile understand when +pages are marked as poison and do not touch them so as not to cause +a fatal machine check exception again while dumping the previous +kernel's memory. + +Therefore, mark the page containing the error as poisoned so that the +kexec'ed kernel can avoid accessing the page. + + [ bp: Rewrite commit message and comment. ] + +Co-developed-by: Youquan Song +Signed-off-by: Youquan Song +Signed-off-by: Zhiquan Li +Signed-off-by: Borislav Petkov (AMD) +Reviewed-by: Naoya Horiguchi +Link: https://lore.kernel.org/r/20231014051754.3759099-1-zhiquan1.li@intel.com +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/cpu/mce/core.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c +index 6f35f724cc14..20ab11aec60b 100644 +--- a/arch/x86/kernel/cpu/mce/core.c ++++ b/arch/x86/kernel/cpu/mce/core.c +@@ -44,6 +44,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -233,6 +234,7 @@ static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) + struct llist_node *pending; + struct mce_evt_llist *l; + int apei_err = 0; ++ struct page *p; + + /* + * Allow instrumentation around external facilities usage. Not that it +@@ -286,6 +288,20 @@ static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) + if (!fake_panic) { + if (panic_timeout == 0) + panic_timeout = mca_cfg.panic_timeout; ++ ++ /* ++ * Kdump skips the poisoned page in order to avoid ++ * touching the error bits again. Poison the page even ++ * if the error is fatal and the machine is about to ++ * panic. ++ */ ++ if (kexec_crash_loaded()) { ++ if (final && (final->status & MCI_STATUS_ADDRV)) { ++ p = pfn_to_online_page(final->addr >> PAGE_SHIFT); ++ if (p) ++ SetPageHWPoison(p); ++ } ++ } + panic(msg); + } else + pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); +-- +2.43.0 + diff --git a/queue-6.6/xen-gntdev-fix-the-abuse-of-underlying-struct-page-i.patch b/queue-6.6/xen-gntdev-fix-the-abuse-of-underlying-struct-page-i.patch new file mode 100644 index 00000000000..731558c1352 --- /dev/null +++ b/queue-6.6/xen-gntdev-fix-the-abuse-of-underlying-struct-page-i.patch @@ -0,0 +1,151 @@ +From 950b20a205639ff99851a3d6dbf94c1fd0ab5c62 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 7 Jan 2024 12:34:26 +0200 +Subject: xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Oleksandr Tyshchenko + +[ Upstream commit 2d2db7d40254d5fb53b11ebd703cd1ed0c5de7a1 ] + +DO NOT access the underlying struct page of an sg table exported +by DMA-buf in dmabuf_imp_to_refs(), this is not allowed. +Please see drivers/dma-buf/dma-buf.c:mangle_sg_table() for details. + +Fortunately, here (for special Xen device) we can avoid using +pages and calculate gfns directly from dma addresses provided by +the sg table. + +Suggested-by: Daniel Vetter +Signed-off-by: Oleksandr Tyshchenko +Acked-by: Christian König +Reviewed-by: Stefano Stabellini +Acked-by: Daniel Vetter +Link: https://lore.kernel.org/r/20240107103426.2038075-1-olekstysh@gmail.com +Signed-off-by: Juergen Gross +Signed-off-by: Sasha Levin +--- + drivers/xen/gntdev-dmabuf.c | 50 ++++++++++++++++++------------------- + 1 file changed, 25 insertions(+), 25 deletions(-) + +diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c +index 4440e626b797..42adc2c1e06b 100644 +--- a/drivers/xen/gntdev-dmabuf.c ++++ b/drivers/xen/gntdev-dmabuf.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -50,7 +51,7 @@ struct gntdev_dmabuf { + + /* Number of pages this buffer has. */ + int nr_pages; +- /* Pages of this buffer. */ ++ /* Pages of this buffer (only for dma-buf export). */ + struct page **pages; + }; + +@@ -484,7 +485,7 @@ static int dmabuf_exp_from_refs(struct gntdev_priv *priv, int flags, + /* DMA buffer import support. */ + + static int +-dmabuf_imp_grant_foreign_access(struct page **pages, u32 *refs, ++dmabuf_imp_grant_foreign_access(unsigned long *gfns, u32 *refs, + int count, int domid) + { + grant_ref_t priv_gref_head; +@@ -507,7 +508,7 @@ dmabuf_imp_grant_foreign_access(struct page **pages, u32 *refs, + } + + gnttab_grant_foreign_access_ref(cur_ref, domid, +- xen_page_to_gfn(pages[i]), 0); ++ gfns[i], 0); + refs[i] = cur_ref; + } + +@@ -529,7 +530,6 @@ static void dmabuf_imp_end_foreign_access(u32 *refs, int count) + + static void dmabuf_imp_free_storage(struct gntdev_dmabuf *gntdev_dmabuf) + { +- kfree(gntdev_dmabuf->pages); + kfree(gntdev_dmabuf->u.imp.refs); + kfree(gntdev_dmabuf); + } +@@ -549,12 +549,6 @@ static struct gntdev_dmabuf *dmabuf_imp_alloc_storage(int count) + if (!gntdev_dmabuf->u.imp.refs) + goto fail; + +- gntdev_dmabuf->pages = kcalloc(count, +- sizeof(gntdev_dmabuf->pages[0]), +- GFP_KERNEL); +- if (!gntdev_dmabuf->pages) +- goto fail; +- + gntdev_dmabuf->nr_pages = count; + + for (i = 0; i < count; i++) +@@ -576,7 +570,8 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev, + struct dma_buf *dma_buf; + struct dma_buf_attachment *attach; + struct sg_table *sgt; +- struct sg_page_iter sg_iter; ++ struct sg_dma_page_iter sg_iter; ++ unsigned long *gfns; + int i; + + dma_buf = dma_buf_get(fd); +@@ -624,26 +619,31 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev, + + gntdev_dmabuf->u.imp.sgt = sgt; + +- /* Now convert sgt to array of pages and check for page validity. */ ++ gfns = kcalloc(count, sizeof(*gfns), GFP_KERNEL); ++ if (!gfns) { ++ ret = ERR_PTR(-ENOMEM); ++ goto fail_unmap; ++ } ++ ++ /* ++ * Now convert sgt to array of gfns without accessing underlying pages. ++ * It is not allowed to access the underlying struct page of an sg table ++ * exported by DMA-buf, but since we deal with special Xen dma device here ++ * (not a normal physical one) look at the dma addresses in the sg table ++ * and then calculate gfns directly from them. ++ */ + i = 0; +- for_each_sgtable_page(sgt, &sg_iter, 0) { +- struct page *page = sg_page_iter_page(&sg_iter); +- /* +- * Check if page is valid: this can happen if we are given +- * a page from VRAM or other resources which are not backed +- * by a struct page. +- */ +- if (!pfn_valid(page_to_pfn(page))) { +- ret = ERR_PTR(-EINVAL); +- goto fail_unmap; +- } ++ for_each_sgtable_dma_page(sgt, &sg_iter, 0) { ++ dma_addr_t addr = sg_page_iter_dma_address(&sg_iter); ++ unsigned long pfn = bfn_to_pfn(XEN_PFN_DOWN(dma_to_phys(dev, addr))); + +- gntdev_dmabuf->pages[i++] = page; ++ gfns[i++] = pfn_to_gfn(pfn); + } + +- ret = ERR_PTR(dmabuf_imp_grant_foreign_access(gntdev_dmabuf->pages, ++ ret = ERR_PTR(dmabuf_imp_grant_foreign_access(gfns, + gntdev_dmabuf->u.imp.refs, + count, domid)); ++ kfree(gfns); + if (IS_ERR(ret)) + goto fail_end_access; + +-- +2.43.0 + diff --git a/queue-6.6/xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch b/queue-6.6/xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch new file mode 100644 index 00000000000..25b9622ff96 --- /dev/null +++ b/queue-6.6/xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch @@ -0,0 +1,98 @@ +From 160ef5b4740f0bc272b0996ec76446db9ddbf20a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Dec 2023 17:06:47 +0200 +Subject: xhci: fix possible null pointer deref during xhci urb enqueue + +From: Mathias Nyman + +[ Upstream commit e2e2aacf042f52854c92775b7800ba668e0bdfe4 ] + +There is a short gap between urb being submitted and actually added to the +endpoint queue (linked). If the device is disconnected during this time +then usb core is not yet aware of the pending urb, and device may be freed +just before xhci_urq_enqueue() continues, dereferencing the freed device. + +Freeing the device is protected by the xhci spinlock, so make sure we take +and keep the lock while checking that device exists, dereference it, and +add the urb to the queue. + +Remove the unnecessary URB check, usb core checks it before calling +xhci_urb_enqueue() + +Suggested-by: Kuen-Han Tsai +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20231201150647.1307406-20-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/host/xhci.c | 40 +++++++++++++++++++++++----------------- + 1 file changed, 23 insertions(+), 17 deletions(-) + +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 132b76fa7ca6..e39c5ba9b7c7 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -1498,24 +1498,7 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag + struct urb_priv *urb_priv; + int num_tds; + +- if (!urb) +- return -EINVAL; +- ret = xhci_check_args(hcd, urb->dev, urb->ep, +- true, true, __func__); +- if (ret <= 0) +- return ret ? ret : -EINVAL; +- +- slot_id = urb->dev->slot_id; + ep_index = xhci_get_endpoint_index(&urb->ep->desc); +- ep_state = &xhci->devs[slot_id]->eps[ep_index].ep_state; +- +- if (!HCD_HW_ACCESSIBLE(hcd)) +- return -ESHUTDOWN; +- +- if (xhci->devs[slot_id]->flags & VDEV_PORT_ERROR) { +- xhci_dbg(xhci, "Can't queue urb, port error, link inactive\n"); +- return -ENODEV; +- } + + if (usb_endpoint_xfer_isoc(&urb->ep->desc)) + num_tds = urb->number_of_packets; +@@ -1554,12 +1537,35 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag + + spin_lock_irqsave(&xhci->lock, flags); + ++ ret = xhci_check_args(hcd, urb->dev, urb->ep, ++ true, true, __func__); ++ if (ret <= 0) { ++ ret = ret ? ret : -EINVAL; ++ goto free_priv; ++ } ++ ++ slot_id = urb->dev->slot_id; ++ ++ if (!HCD_HW_ACCESSIBLE(hcd)) { ++ ret = -ESHUTDOWN; ++ goto free_priv; ++ } ++ ++ if (xhci->devs[slot_id]->flags & VDEV_PORT_ERROR) { ++ xhci_dbg(xhci, "Can't queue urb, port error, link inactive\n"); ++ ret = -ENODEV; ++ goto free_priv; ++ } ++ + if (xhci->xhc_state & XHCI_STATE_DYING) { + xhci_dbg(xhci, "Ep 0x%x: URB %p submitted for non-responsive xHCI host.\n", + urb->ep->desc.bEndpointAddress, urb); + ret = -ESHUTDOWN; + goto free_priv; + } ++ ++ ep_state = &xhci->devs[slot_id]->eps[ep_index].ep_state; ++ + if (*ep_state & (EP_GETTING_STREAMS | EP_GETTING_NO_STREAMS)) { + xhci_warn(xhci, "WARN: Can't enqueue URB, ep in streams transition state %x\n", + *ep_state); +-- +2.43.0 + -- 2.47.3