37e14da1f2
* refs/heads/tmp-075ce55: ANDROID: 16K: Avoid mmap lock assertions for padding VMAs ANDROID: consolidate.fragment: don't disable CONFIG_PM_ADVANCED_DEBUG ANDROID: GKI: Update symbol list for mtk Revert "f2fs: fix to tag gcing flag on page during block migration" ANDROID: 16K: Only check basename of linker context FROMGIT: arm64: mte: Make mte_check_tfsr_*() conditional on KASAN instead of MTE ANDROID: gki_defconfig: Disable CONFIG_BRCMSTB_DPFE and CONFIG_BRCMSTB_MEMC FROMGIT: f2fs: fix to avoid use SSR allocate when do defragment ANDROID: 16K: Only check basename of linker context ANDROID: 16K: Avoid and document padding madvise lock warning ANDROID: arm64: vdso32: support user-supplied flags ANDROID: GKI: Add initial symbol list for bcmstb ANDROID: gki_defconfig: Enable Broadcom STB SoCs UPSTREAM: mmc: core: Do not force a retune before RPMB switch UPSTREAM: arm64/arm: arm_pmuv3: perf: Don't truncate 64-bit registers BACKPORT: net: phy: Allow drivers to always call into ->suspend() UPSTREAM: ARM: perf: Mark all accessor functions inline UPSTREAM: arm64: perf: Mark all accessor functions inline UPSTREAM: perf/core: Drop __weak attribute from arch_perf_update_userpage() prototype UPSTREAM: ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM UPSTREAM: ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations UPSTREAM: perf: pmuv3: Change GENMASK to GENMASK_ULL UPSTREAM: perf: pmuv3: Move inclusion of kvm_host.h to the arch-specific helper UPSTREAM: perf: pmuv3: Abstract PMU version checks UPSTREAM: arm64: perf: Abstract system register accesses away UPSTREAM: arm64: perf: Move PMUv3 driver to drivers/perf UPSTREAM: arm64/perf: Replace PMU version number '0' with ID_AA64DFR0_EL1_PMUVer_NI ANDROID: GKI: Update oplus symbol list UPSTREAM: block/blk-mq: Don't complete locally if capacities are different BACKPORT: sched: Add a new function to compare if two cpus have the same capacity ANDROID: GKI: Update symbol list for mtk ANDROID: GKI: Update rockchip symbols for rndis_host. ANDROID: GKI: Update rockchip symbols for snd multi dais. UPSTREAM: usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete UPSTREAM: usb: gadget: f_fs: use io_data->status consistently ANDROID: set rewrite_absolute_paths_in_config for GKI aarch64. UPSTREAM: wifi: cfg80211: Clear mlo_links info when STA disconnects ANDROID: ABI: Add usb_gadget_connect & usb_gadget_disconnect symbol ANDROID: GKI: Update symbol list for mtk BACKPORT: iommu: Have __iommu_probe_device() check for already probed devices ANDROID: ABI fixup for abi break in struct dst_ops BACKPORT: net: fix __dst_negative_advice() race ANDROID: ABI fixup for abi break in struct dst_ops BACKPORT: net: fix __dst_negative_advice() race Revert "crypto: api - Disallow identical driver names" UPSTREAM: USB: gadget: core: create sysfs link between udc and gadget ANDROID: GKI: add tegra20-cpufreq.ko to rockpi4 build ANDROID: GKI: update symbol list for db845c ANDROID: Build some tegra configs as vendor module ANDROID: gki_defconfig: Enable Tegra SoCs ANDROID: Update the ABI symbol list Revert^2 "BACKPORT: FROMGIT: module: allow UNUSED_KSYMS_WHITELIST ..." ANDROID: binder: fix KMI-break due to alloc->lock ANDROID: binder: fix ptrdiff_t printk-format issue ANDROID: binder: fix KMI-break due to address type change Reapply "ANDROID: vendor_hooks: Add hook for binder_detect_low_async_space" Reapply "ANDROID: Add vendor hooks for binder perf tuning" UPSTREAM: binder: switch alloc->mutex to spinlock_t UPSTREAM: binder: reverse locking order in shrinker callback UPSTREAM: binder: avoid user addresses in debug logs UPSTREAM: binder: refactor binder_delete_free_buffer() UPSTREAM: binder: collapse print_binder_buffer() into caller UPSTREAM: binder: document the final page calculation BACKPORT: UPSTREAM: binder: rename lru shrinker utilities UPSTREAM: binder: make oversized buffer code more readable UPSTREAM: binder: remove redundant debug log UPSTREAM: binder: perform page installation outside of locks UPSTREAM: binder: initialize lru pages in mmap callback UPSTREAM: binder: malloc new_buffer outside of locks UPSTREAM: binder: refactor page range allocation UPSTREAM: binder: relocate binder_alloc_clear_buf() UPSTREAM: binder: relocate low space calculation UPSTREAM: binder: separate the no-space debugging logic UPSTREAM: binder: remove pid param in binder_alloc_new_buf() UPSTREAM: binder: do unlocked work in binder_alloc_new_buf() UPSTREAM: binder: split up binder_update_page_range() UPSTREAM: binder: keep vma addresses type as unsigned long UPSTREAM: binder: remove extern from function prototypes Revert "ANDROID: Add vendor hooks for binder perf tuning" Revert "ANDROID: vendor_hooks: Add hook for binder_detect_low_async_space_locked" Revert "ANDROID: vendor_hook: rename the the name of hooks" ANDROID: GKI: Update rockchip symbols for some usb wifi bt. UPSTREAM: selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior ANDROID: GKI: Update rockchip symbols to add iova APIs FROMLIST: kheaders: explicitly define file modes for archived headers ANDROID: incremental-fs: Make work with 16k pages ANDROID: pahole -J -j1 for reproducible BTF Revert "BACKPORT: FROMGIT: module: allow UNUSED_KSYMS_WHITELIST ..." BACKPORT: FROMGIT: module: allow UNUSED_KSYMS_WHITELIST to be relative against objtree. ANDROID: export one function for mm metrics ANDROID: GKI: Update symbol list for mtk FROMLIST: kheaders: explicitly define file modes for archived headers ANDROID: pahole -J -j1 for reproducible BTF FROMLIST: usb: typec: tcpm: Ignore received Hard Reset in TOGGLING state ANDROID: Export sysctl_sched_wakeup_granularity to enable modifying it UPSTREAM: epoll: be better about file lifetimes FROMLIST: usb: typec: tcpm: Ignore received Hard Reset in TOGGLING state FROMLIST: usb: typec: tcpm: Ignore received Hard Reset in TOGGLING state UPSTREAM: usb: gadget: ncm: Fix handling of zero block length packets ANDROID: Update the ABI symbol list ANDROID: GKI: Update symbol list for mtk UPSTREAM: usb: gadget: ncm: Avoid dropping datagrams of properly parsed NTBs ANDROID: GKI: Update rockchip symbols to add iova APIs FROMLIST: sched/pi: Reweight fair_policy() tasks when inheriting prio ANDROID: Update the ABI symbol list ANDROID: mm: Add restricted vendor hook in do_read_fault() ANDROID: abi_gki_aarch64_qcom: Update symbol list ANDROID: abi_gki_aarch64_qcom: Update symbol list ANDROID: Update the ABI symbol list ANDROID: add vendor hooks and expoert reclaim_pages to reclaim memory FROMGIT: usb: dwc3: Wait unconditionally after issuing EndXfer command ANDROID: ABI: Update honor symbol list ANDROID: add vendor hook in do_read_fault to tune fault_around_bytes ANDROID: usb: Optimize the problem of slow transfer rate in USB accessory mode ANDROID: Zap kernel/sched/android.h stubs ANDROID: Update the ABI symbol list ANDROID: Export sysctl_sched_wakeup_granularity to enable modifying it ANDROID: export one function for mm metrics ANDROID: Update the ABI symbol list ANDROID: Export sysctl_sched_wakeup_granularity to enable modifying it UPSTREAM: ALSA: virtio: use ack callback UPSTREAM: usb: typec: tcpm: clear pd_event queue in PORT_RESET BACKPORT: usb: typec: tcpm: enforce ready state when queueing alt mode vdm ANDROID: GKI: Update QCOM symbol list and ABI STG ANDROID: GKI: fix ABI breakage in struct userfaultfd_ctx UPSTREAM: userfaultfd: fix deadlock warning when locking src and dst VMAs BACKPORT: userfaultfd: use per-vma locks in userfaultfd operations BACKPORT: mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK BACKPORT: userfaultfd: protect mmap_changing with rw_sem in userfaulfd_ctx BACKPORT: userfaultfd: move userfaultfd_ctx struct to header file BACKPORT: userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb BACKPORT: selftests/mm: add separate UFFDIO_MOVE test for PMD splitting BACKPORT: selftests/mm: add UFFDIO_MOVE ioctl test BACKPORT: selftests/mm: add uffd_test_case_ops to allow test case-specific operations BACKPORT: selftests/mm: call uffd_test_ctx_clear at the end of the test UPSTREAM: userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl BACKPORT: userfaultfd: change src_folio after ensuring it's unpinned in UFFDIO_MOVE BACKPORT: mm: userfaultfd: fix unexpected change to src_folio when UFFDIO_MOVE fails BACKPORT: userfaultfd: handle zeropage moves by UFFDIO_MOVE UPSTREAM: userfaultfd: avoid huge_zero_page in UFFDIO_MOVE UPSTREAM: userfaultfd: fix move_pages_pte() splitting folio under RCU read lock BACKPORT: userfaultfd: UFFDIO_MOVE uABI UPSTREAM: mm/rmap: support move to different root anon_vma in folio_move_anon_rmap() UPSTREAM: crypto: x86/curve25519 - disable gcov ANDROID: GKI: Update QCOM symbol list and ABI STG ANDROID: GKI: update symbol list file for xiaomi UPSTREAM: netfilter: nft_set_pipapo: do not free live element UPSTREAM: net: tls: handle backlogging of crypto requests UPSTREAM: af_unix: Fix garbage collector racing against connect() UPSTREAM: af_unix: Do not use atomic ops for unix_sk(sk)->inflight. ANDROID: 16K: Fix show maps CFI failure ANDROID: 16K: Handle pad VMA splits and merges ANDROID: 16K: madvise_vma_pad_pages: Remove filemap_fault check ANDROID: 16K: Only madvise padding from dynamic linker context ANDROID: 16K: Separate padding from ELF LOAD segment mappings ANDROID: 16K: Exclude ELF padding for fault around range ANDROID: 16K: Use MADV_DONTNEED to save VMA padding pages. ANDROID: 16K: Introduce ELF padding representation for VMAs ANDROID: 16K: Introduce /sys/kernel/mm/pgsize_miration/enabled FROMGIT: usb: typec: tcpm: Check for port partner validity before consuming it FROMGIT: usb: typec: tcpm: Check for port partner validity before consuming it Revert "FROMGIT: usb: typec: tcpm: Check for port partner validity before consuming it" FROMGIT: usb: typec: tcpm: Check for port partner validity before consuming it ANDROID: vendor_hooks: add symbols for lazy preemption ANDROID: vendor_hooks: add two hooks for lazy preemption ANDROID: KVM: arm64: wait_for_initramfs for pKVM module loading procfs ANDROID: GKI: Expose device async to userspace BACKPORT: mtk-mmsys: Change mtk-mmsys & mtk-mutex to modules ANDROID: Update the ABI symbol list BACKPORT: clk: mediatek: Split configuration options for MT8186 clock drivers BACKPORT: clk: mediatek: Add MODULE_LICENSE() where missing FROMGIT: coresight: etm4x: Fix access to resource selector registers FROMGIT: coresight: etm4x: Safe access for TRCQCLTR FROMGIT: coresight: etm4x: Do not save/restore Data trace control registers FROMGIT: coresight: etm4x: Do not hardcode IOMEM access for register restore ANDROID: GKI: Update honda symbol list for led-trigger ANDROID: GKI: Update symbols to symbol list ANDROID: vendor_hook: Add hooks to support reader optimistic spin in rwsem UPSTREAM: af_unix: Fix garbage collector racing against connect() UPSTREAM: af_unix: Do not use atomic ops for unix_sk(sk)->inflight. ANDROID: GKI: fix ABI breakage in struct userfaultfd_ctx UPSTREAM: userfaultfd: fix deadlock warning when locking src and dst VMAs BACKPORT: userfaultfd: use per-vma locks in userfaultfd operations BACKPORT: mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK BACKPORT: userfaultfd: protect mmap_changing with rw_sem in userfaulfd_ctx BACKPORT: userfaultfd: move userfaultfd_ctx struct to header file BACKPORT: userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb BACKPORT: selftests/mm: add separate UFFDIO_MOVE test for PMD splitting BACKPORT: selftests/mm: add UFFDIO_MOVE ioctl test BACKPORT: selftests/mm: add uffd_test_case_ops to allow test case-specific operations BACKPORT: selftests/mm: call uffd_test_ctx_clear at the end of the test UPSTREAM: userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl BACKPORT: userfaultfd: change src_folio after ensuring it's unpinned in UFFDIO_MOVE BACKPORT: mm: userfaultfd: fix unexpected change to src_folio when UFFDIO_MOVE fails BACKPORT: userfaultfd: handle zeropage moves by UFFDIO_MOVE UPSTREAM: userfaultfd: avoid huge_zero_page in UFFDIO_MOVE UPSTREAM: userfaultfd: fix move_pages_pte() splitting folio under RCU read lock BACKPORT: userfaultfd: UFFDIO_MOVE uABI UPSTREAM: mm/rmap: support move to different root anon_vma in folio_move_anon_rmap() ANDROID: PM: hibernate: Encryption support with compression ANDROID: abi_gki_aarch64_qcom: Update symbol list ANDROID: vendor_hooks: Add hooks to support hibernation ANDROID: gki_defconfig: Sync gki_defconfig UPSTREAM: PM: hibernate: Support to select compression algorithm UPSTREAM: PM: hibernate: Add support for LZ4 compression for hibernation BACKPORT: PM: hibernate: Move to crypto APIs for LZO compression BACKPORT: PM: hibernate: Rename lzo* to make it generic Revert "hrtimer: Report offline hrtimer enqueue" Revert "drm/mipi-dsi: Fix detach call without attach" ANDROID: ABI: Update symbol list for Exynos SoC ANDROID: abi_gki_aarch64_qcom: Update symbol list BACKPORT: mtk-mmsys: Change mtk-mmsys & mtk-mutex to modules BACKPORT: clk: mediatek: Split configuration options for MT8186 clock drivers BACKPORT: clk: mediatek: Add MODULE_LICENSE() where missing ANDROID: Update the ABI symbol list Reapply "ANDROID: block: Add support for filesystem requests and small segments" UPSTREAM: usb:typec:tcpm:support double Rp to Vbus cable as sink ANDROID: Update the ABI symbol list ANDROID: Add known structs used by modules to KMI ANDROID: use reserved cpucaps for new capability Revert "mm/sparsemem: fix race in accessing memory_section->usage" UPSTREAM: netfilter: nf_tables: release mutex after nft_gc_seq_end from abort path UPSTREAM: netfilter: nf_tables: release batch on table validation from abort path UPSTREAM: netfilter: nf_tables: mark set as dead when unbinding anonymous set with timeout UPSTREAM: netfilter: nft_set_pipapo: release elements in clone only from destroy path ANDROID: GKI: Add symbol list for Nothing ANDROID: GKI: Update honda symbol list for asound ANDROID: GKI: Update honda symbol list for xt_LOG ANDROID: GKI: Update honda symbol list for ebtables ANDROID: GKI: Update honda symbol list for net scheduler ANDROID: softirq: add tasklet to LONG_SOFTIRQ_MASK ANDROID: Update the ABI symbol list ANDROID: vendor_hooks: add restricted vendor hook for meminfo ANDROID: Update the ABI symbol list BACKPORT: cpufreq: Don't unregister cpufreq cooling on CPU hotplug FROMGIT: usb: typec: tcpm: Correct the PDO counting in pd_set UPSTREAM: tls: fix race between tx work scheduling and socket close UPSTREAM: netfilter: nft_chain_filter: handle NETDEV_UNREGISTER for inet/ingress basechain UPSTREAM: tls: fix race between async notify and socket close UPSTREAM: net: tls: factor out tls_*crypt_async_wait() UPSTREAM: tls: extract context alloc/initialization out of tls_set_sw_offload BACKPORT: mm: update mark_victim tracepoints fields Revert "FROMGIT: BACKPORT: mm: update mark_victim tracepoints fields" ANDROID: Update the ABI symbol list ANDROID: export two function to reclaim memory ANDROID: add reclaim tune parameter functions UPSTREAM: netfilter: nf_tables: disallow anonymous set with timeout flag ANDROID: drop redundant OWNERS_DrNo file UPSTREAM: ALSA: virtio: Fix "Coverity: virtsnd_kctl_tlv_op(): Uninitialized variables" warning. UPSTREAM: ALSA: virtio: add support for audio controls ANDROID: Update symbols list for virtio_snd.ko audio controls ANDROID: Move cpu_busy_with_softirqs() into sched.h UPSTREAM: mm: page_alloc: unreserve highatomic page blocks before oom UPSTREAM: mm: page_alloc: enforce minimum zone size to do high atomic reserves UPSTREAM: mm: page_alloc: correct high atomic reserve calculations ANDROID: Update the ABI symbol list ANDROID: Export cpu_busy_with_softirqs() ANDROID: GKI: update symbol list file for xiaomi Reapply "ANDROID: null_blk: Support configuring the maximum segment size" UPSTREAM: usb: typec: Return size of buffer if pd_set operation succeeds UPSTREAM: usb: typec: tcpm: Update PD of Type-C port upon pd_set UPSTREAM: usb: typec: tcpm: fix double-free issue in tcpm_port_unregister_pd() UPSTREAM: usb: typec: tcpm: Correct port source pdo array in pd_set callback Reapply "Merge tag 'android14-6.1.75_r00' into android14-6.1" Revert "ANDROID: null_blk: Support configuring the maximum segment size" Revert "usb: dwc3: core: configure TX/RX threshold for DWC3_IP" ANDROID: Update the ABI symbol list ANDROID: GKI: Update symbols for rockchip drm FROMLIST: binder: check offset alignment in binder_get_object() ANDROID: GKI: Add symbol list for Nothing ANDROID: thermal: Add vendor thermal_pm_notify_suspend function UPSTREAM: usb: dwc3: gadget: Don't disconnect if not started Revert "ANDROID: block: Add support for filesystem requests and small segments" ANDROID: vendor_hook: fix issue vip thread do not sleep while no vip work UPSTREAM: sched/wait: Fix a kthread_park race with wait_woken() ANDROID: KVM: arm64: Fix TLB invalidation when coalescing into a block ANDROID: ABI: Update symbol list for Exynos SoC ANDROID: GKI: Add symbols for rockchip snd trcm FROMGIT: usb: dwc2: Disable clock gating feature on Rockchip SoCs ANDROID: ABI: Update symbol list for Exynos SoC ANDROID: Add symbols for IIO SCMI module ANDROID: KVM: arm64: Fix missing trace event for nVHE dyn HVCs ANDROID: Update the ABI symbol list ANDROID: Update symbols list for open-dice.ko ANDROID: Add symbols for IIO SCMI module ANDROID: GKI: Update symbols for rockchip UPSTREAM: usb: dwc2: disable lpm feature on Rockchip SoCs ANDROID: Update symbols list for open-dice.ko FROMLIST: mm/migrate: set swap entry values of THP tail pages properly. ANDROID: Update the ABI symbol list ANDROID: virt: gunyah: Move send_lock around req and reply ANDROID: null_blk: Support configuring the maximum segment size ANDROID: scsi_debug: Support configuring the maximum segment size ANDROID: block: Add support for filesystem requests and small segments ANDROID: block: Support submitting passthrough requests with small segments ANDROID: block: Make sub_page_limit_queues available in debugfs ANDROID: block: Support configuring limits below the page size ANDROID: block: Prepare for supporting sub-page limits ANDROID: block: Use pr_info() instead of printk(KERN_INFO ...) ANDROID: sound: usb: add vendor hook for cpu suspend support ANDROID: usb: Add vendor hook for usb suspend and resume ANDROID: fips140: change linker script guard Revert "ANDROID: Update symbols list for open-dice.ko" ANDROID: Update symbols list for open-dice.ko FROMGIT: PM: sleep: wakeirq: fix wake irq warning in system suspend ANDROID: ABI: Update symbol for Exynos SoC UPSTREAM: usb: dwc3: core: set force_gen1 bit in USB31 devices if max speed is SS UPSTREAM: PCI: dwc: Strengthen the MSI address allocation logic UPSTREAM: PCI: dwc: Restrict only coherent DMA mask for MSI address allocation ANDROID: ABI: Update oplus symbol list ANDROID: vendor_hook: rename the the name of hooks FROMGIT: usb: xhci: Add error handling in xhci_map_urb_for_dma FROMGIT: usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK FROMGIT: usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK ANDROID: fuse-bpf: Fix readdir for getdents Linux 6.1.78 netfilter: nft_set_rbtree: skip end interval element from gc net: stmmac: xgmac: fix a typo of register name in DPP safety handling ALSA: usb-audio: Sort quirk table entries net: stmmac: xgmac: use #define for string constants clocksource: Skip watchdog check for large watchdog intervals block: treat poll queue enter similarly to timeouts f2fs: add helper to check compression level RDMA/irdma: Fix support for 64k pages vhost: use kzalloc() instead of kmalloc() followed by memset() Revert "ASoC: amd: Add new dmi entries for acp5x platform" io_uring/net: fix sr->len for IORING_OP_RECV with MSG_WAITALL and buffers Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID Input: i8042 - fix strange behavior of touchpad on Clevo NS70PU hrtimer: Report offline hrtimer enqueue usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK USB: serial: cp210x: add ID for IMST iM871A-USB USB: serial: option: add Fibocom FM101-GL variant USB: serial: qcserial: add new usb-id for Dell Wireless DW5826e ALSA: usb-audio: add quirk for RODE NT-USB+ ALSA: usb-audio: Add a quirk for Yamaha YIT-W12TX transmitter ALSA: usb-audio: Add delay quirk for MOTU M Series 2nd revision mtd: parsers: ofpart: add workaround for #size-cells 0 fs: dlm: don't put dlm_local_addrs on heap blk-iocost: Fix an UBSAN shift-out-of-bounds warning scsi: core: Move scsi_host_busy() out of host lock if it is for per-command fs/ntfs3: Fix an NULL dereference bug netfilter: nft_set_pipapo: remove scratch_aligned pointer netfilter: nft_set_pipapo: add helper to release pcpu scratch area netfilter: nft_set_pipapo: store index in scratch maps netfilter: nft_ct: reject direction for ct id drm/amd/display: Implement bounds check for stream encoder creation in DCN301 netfilter: nft_compat: restrict match/target protocol to u16 netfilter: nft_compat: reject unused compat flag netfilter: nft_compat: narrow down revision to unsigned 8-bits selftests: cmsg_ipv6: repeat the exact packet ppp_async: limit MRU to 64K af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC. tipc: Check the bearer type before calling tipc_udp_nl_bearer_add() rxrpc: Fix response to PING RESPONSE ACKs to a dead call drm/i915/gvt: Fix uninitialized variable in handle_mmio() inet: read sk->sk_family once in inet_recv_error() hwmon: (coretemp) Fix bogus core_id to attr name mapping hwmon: (coretemp) Fix out-of-bounds memory access hwmon: (aspeed-pwm-tacho) mutex for tach reading octeontx2-pf: Fix a memleak otx2_sq_init atm: idt77252: fix a memleak in open_card_ubr0 tunnels: fix out of bounds access when building IPv6 PMTU error selftests: net: avoid just another constant wait selftests: net: cut more slack for gro fwd tests. net: atlantic: Fix DMA mapping for PTP hwts ring netdevsim: avoid potential loop in nsim_dev_trap_report_work() wifi: mac80211: fix waiting for beacons logic net: stmmac: xgmac: fix handling of DPP safety error for DMA channels drm/msm/dpu: check for valid hw_pp in dpu_encoder_helper_phys_cleanup drm/msm/dp: return correct Colorimetry for DP_TEST_DYNAMIC_RANGE_CEA case drm/msms/dp: fixed link clock divider bits be over written in BPC unknown case cifs: failure to add channel on iface should bump up weight phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV phy: renesas: rcar-gen3-usb2: Fix returning wrong error code dmaengine: fsl-qdma: Fix a memory leak related to the queue command DMA dmaengine: fsl-qdma: Fix a memory leak related to the status queue DMA dmaengine: ti: k3-udma: Report short packet errors dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools ext4: regenerate buddy after block freeing failed if under fc replay Linux 6.1.77 drm/amdgpu: Fix missing error code in 'gmc_v6/7/8/9_0_hw_init()' ASoC: codecs: wsa883x: fix PA volume control ASoC: codecs: lpass-wsa-macro: fix compander volume hack bonding: remove print in bond_verify_device_path gve: Fix use-after-free vulnerability LoongArch/smp: Call rcutree_report_cpu_starting() at tlb_init() drm/msm/dsi: Enable runtime PM Revert "drm/amd/display: Disable PSR-SU on Parade 0803 TCON again" mm, kmsan: fix infinite recursion due to RCU critical section arm64: irq: set the correct node for shadow call stack selftests: bonding: Check initial state selftests: team: Add missing config options net: sysfs: Fix /sys/class/net/<iface> path selftests: net: fix available tunnels detection af_unix: fix lockdep positive in sk_diag_dump_icons() net: ipv4: fix a memleak in ip_setup_cork netfilter: nft_ct: sanitize layer 3 and 4 protocol number in custom expectations netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger netfilter: nf_tables: restrict tunnel object to NFPROTO_NETDEV netfilter: conntrack: correct window scaling with retransmitted SYN selftests: net: add missing config for GENEVE bridge: mcast: fix disabled snooping after long uptime llc: call sock_orphan() at release time ipv6: Ensure natural alignment of const ipv6 loopback and router addresses net: dsa: qca8k: fix illegal usage of GPIO ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550() ixgbe: Refactor overtemp event handling ixgbe: Refactor returning internal error codes tcp: add sanity checks to rx zerocopy net: lan966x: Fix port configuration when using SGMII interface ipmr: fix kernel panic when forwarding mcast packets ipv4: raw: add drop reasons ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv() selftests: net: give more time for GRO aggregation HID: hidraw: fix a problem of memory leak in hidraw_release() scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for shared interrupt register scsi: isci: Fix an error code problem in isci_io_request_build() drm: using mul_u32_u32() requires linux/math64.h wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update perf: Fix the nr_addr_filters fix drm/amdkfd: Fix 'node' NULL check in 'svm_range_get_range_boundaries()' drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()' drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()' drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_power_management_table()' ceph: fix invalid pointer access if get_quota_realm return ERR_PTR ceph: fix deadlock or deadcode of misusing dget() ceph: reinitialize mds feature bit even when session in open blk-mq: fix IO hang from sbitmap wakeup race virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings drm/amdkfd: Fix lock dependency warning with srcu drm/amdkfd: Fix lock dependency warning libsubcmd: Fix memory leak in uniq() misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback 9p: Fix initialisation of netfs_inode for 9p PCI/AER: Decode Requester ID when no error info found PCI: Fix 64GT/s effective data rate calculation spmi: mediatek: Fix UAF on device remove fs/kernfs/dir: obey S_ISGID tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE selftests/sgx: Fix linker script asserts usb: hub: Add quirk to decrease IN-ep poll interval for Microchip USB491x hub usb: hub: Replace hardcoded quirk value with BIT() macro perf cs-etm: Bump minimum OpenCSD version to ensure a bugfix is present PCI: switchtec: Fix stdev_release() crash after surprise hot remove PCI: Only override AMD USB controller if required mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt mfd: ti_am335x_tscadc: Fix TI SoC dependencies xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import i3c: master: cdns: Update maximum prescaler value for i2c clock um: time-travel: fix time corruption um: net: Fix return type of uml_net_start_xmit() um: Don't use vfprintf() for os_info() um: Fix naming clash between UML and scheduler leds: trigger: panic: Don't register panic notifier if creating the trigger failed ALSA: hda/conexant: Fix headset auto detect fail in cx8070 and SN6140 drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()' drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()' drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()' drm/amdgpu: Let KFD sync with VM fences drm/amdgpu: Fix ecc irq enable/disable unpaired clk: imx: clk-imx8qxp: fix LVDS bypass, pixel and phy clocks drm/amd/display: make flip_timestamp_in_us a 64-bit variable watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 clk: mmp: pxa168: Fix memory leak in pxa168_clk_init() clk: hi3620: Fix memory leak in hi3620_mmc_clk_init() drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap drm/msm/dpu: fix writeback programming for YUV cases drm/msm/dpu: Ratelimit framedone timeout msgs drm/amd/display: For prefetch mode > 0, extend prefetch if possible media: i2c: imx335: Fix hblank min/max values media: ddbridge: fix an error code problem in ddb_probe media: amphion: remove mutext lock in condition of wait_event IB/ipoib: Fix mcast list locking drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time f2fs: fix to tag gcing flag on page during block migration hwmon: (nct6775) Fix fan speed set failure in automatic mode media: rkisp1: Fix IRQ disable race issue media: rkisp1: Store IRQ lines media: rkisp1: Fix IRQ handler return values media: rkisp1: Drop IRQF_SHARED ALSA: hda: Intel: add HDA_ARL PCI ID support PCI: add INTEL_HDA_ARL to pci_ids.h media: rockchip: rga: fix swizzling for RGB formats media: stk1160: Fixed high volume of stk1160_dbg messages drm/mipi-dsi: Fix detach call without attach drm/framebuffer: Fix use of uninitialized variable drm/drm_file: fix use of uninitialized variable ASoC: amd: Add new dmi entries for acp5x platform f2fs: fix write pointers on zoned device after roll forward drm/amd/display: Fix tiled display misalignment drm/bridge: anx7625: Fix Set HPD irq detect window to 2ms drm/panel-edp: Add override_edid_mode quirk for generic edp RDMA/IPoIB: Fix error code return in ipoib_mcast_join fast_dput(): handle underflows gracefully ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument ALSA: hda: Refer to correct stream index at loops f2fs: fix to check return value of f2fs_reserve_new_block() net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry i40e: Fix VF disable behavior to block all traffic bridge: cfm: fix enum typo in br_cc_ccm_tx_parse net/smc: disable SEID on non-s390 archs where virtual ISM may be used Bluetooth: L2CAP: Fix possible multiple reject send Bluetooth: hci_sync: fix BR/EDR wakeup bug Bluetooth: qca: Set both WIDEBAND_SPEECH and LE_STATES quirks for QCA2066 wifi: cfg80211: free beacon_ies when overridden from hidden BSS wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift() libbpf: Fix NULL pointer dereference in bpf_object__collect_prog_relos wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices arm64: dts: amlogic: fix format for s4 uart node ice: fix pre-shifted bit usage arm64: dts: qcom: msm8998: Fix 'out-ports' is a required property arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property md: Whenassemble the array, consult the superblock of the freshest device block: prevent an integer overflow in bvec_try_merge_hw_page net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path net: atlantic: eliminate double free in error handling logic ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values scsi: hisi_sas: Set .phy_attached before notifing phyup event HISI_PHYE_PHY_UP_PM ARM: dts: imx23/28: Fix the DMA controller node name ARM: dts: imx23-sansa: Use preferred i2c-gpios properties ARM: dts: imx27-apf27dev: Fix LED name ARM: dts: imx25/27: Pass timing0 ARM: dts: imx25: Fix the iim compatible string block/rnbd-srv: Check for unlikely string overflow ionic: bypass firmware cmds when stuck in reset ionic: pass opcode to devcmd_wait net: phy: at803x: fix passing the wrong reference for config_intr ARM: dts: imx1: Fix sram node ARM: dts: imx27: Fix sram node ARM: dts: imx: Use flash@0,0 pattern ARM: dts: imx25/27-eukrea: Fix RTC node name ARM: dts: rockchip: fix rk3036 hdmi ports node wifi: wfx: fix possible NULL pointer dereference in wfx_set_mfp_ap() bpf: Set uattr->batch.count as zero before batched update or deletion scsi: libfc: Fix up timeout error in fc_fcp_rec_error() scsi: libfc: Don't schedule abort twice bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers wifi: ath11k: fix race due to setting ATH11K_FLAG_EXT_IRQ_ENABLED too early wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus() ARM: dts: imx7s: Fix nand-controller #size-cells ARM: dts: imx7s: Fix lcdif compatible ARM: dts: imx7d: Fix coresight funnel ports scsi: arcmsr: Support new PCI device IDs 1883 and 1886 scsi: mpi3mr: Add PCI checks where SAS5116 diverges from SAS4116 net: usb: ax88179_178a: avoid two consecutive device resets bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk PCI: Add no PM reset quirk for NVIDIA Spectrum devices scsi: lpfc: Fix possible file string name overflow when updating firmware soc: xilinx: fix unhandled SGI warning message soc: xilinx: Fix for call trace due to the usage of smp_processor_id() selftests/bpf: Fix issues in setup_classid_environment() wifi: rt2x00: correct wrong BBP register in RxDCOC calibration selftests/bpf: Fix pyperf180 compilation failure with clang18 selftests/bpf: satisfy compiler by having explicit return in btf test wifi: rt2x00: restart beacon queue when hardware reset ext4: avoid online resizing failures due to oversized flex bg ext4: remove unnecessary check from alloc_flex_gd() ext4: unify the type of flexbg_size to unsigned int ext4: fix inconsistent between segment fstrim and full fstrim ecryptfs: Reject casefold directory inodes SUNRPC: Fix a suspicious RCU usage warning KVM: s390: fix setting of fpc register s390/ptrace: handle setting of fpc register correctly s390/vfio-ap: fix sysfs status attribute for AP queue devices arch: consolidate arch_irq_work_raise prototypes jfs: fix array-index-out-of-bounds in diNewExt rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock() afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*() afs: fix the usage of read_seqbegin_or_lock() in afs_lookup_volume_rcu() crypto: stm32/crc32 - fix parsing list of devices erofs: fix ztailpacking for subpage compressed blocks crypto: octeontx2 - Fix cptvf driver cleanup pstore/ram: Fix crash when setting number of cpus to an odd number jfs: fix uaf in jfs_evict_inode jfs: fix array-index-out-of-bounds in dbAdjTree jfs: fix slab-out-of-bounds Read in dtSearch UBSAN: array-index-out-of-bounds in dtSplitRoot FS:JFS:UBSAN:array-index-out-of-bounds in dbAdjTree ACPI: APEI: set memory failure flags as MF_ACTION_REQUIRED on synchronous events PM / devfreq: Synchronize devfreq_monitor_[start/stop] ACPI: NUMA: Fix the logic of getting the fake_pxm value ACPI: extlog: fix NULL pointer dereference check PNP: ACPI: fix fortify warning ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop audit: Send netlink ACK before setting connection in auditd_set regulator: core: Only increment use_count when enable_count changes debugobjects: Stop accessing objects after releasing hash bucket lock perf/core: Fix narrow startup race when creating the perf nr_addr_filters sysfs file x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel powerpc/lib: Validate size for vector operations powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE x86/boot: Ignore NMIs during very early boot powerpc/64s: Fix CONFIG_NUMA=n build due to create_section_mapping() powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() powerpc: Fix build error due to is_valid_bugaddr() drivers/perf: pmuv3: don't expose SW_INCR event in sysfs arm64: irq: set the correct node for VMAP stack powerpc/mm: Fix null-pointer dereference in pgtable_cache_add asm-generic: make sparse happy with odd-sized put_unaligned_*() Linux 6.1.76 net/mlx5e: Handle hardware IPsec limits events serial: core: fix kernel-doc for uart_port_unlock_irqrestore() x86/entry/ia32: Ensure s32 is sign extended to s64 tick/sched: Preserve number of idle sleeps across CPU hotplug events mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan cxl/region:Fix overflow issue in alloc_hpa() MIPS: lantiq: register smp_ops on non-smp platforms spi: fix finalize message on error return spi: bcm-qspi: fix SFDP BFPT read by usig mspi read drm/bridge: anx7625: Ensure bridge is suspended in disable() block: Move checking GENHD_FL_NO_PART to bdev_add_partition() gpio: eic-sprd: Clear interrupt after set the interrupt type drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume drm/exynos: fix accidental on-stack copy of exynos_drm_plane drm/bridge: parade-ps8640: Make sure we drop the AUX mutex in the error case drm/bridge: parade-ps8640: Ensure bridge is suspended in .post_disable() drm/bridge: sii902x: Fix audio codec unregistration drm/bridge: sii902x: Fix probing race issue drm/bridge: sii902x: Use devm_regulator_bulk_get_enable() drm: panel-simple: add missing bus flags for Tianma tm070jvhg[30/33] drm/bridge: parade-ps8640: Wait for HPD when doing an AUX transfer Revert "powerpc/64s: Increase default stack size to 32KB" drm/panel-edp: drm/panel-edp: Fix AUO B116XAK01 name and timing btrfs: zoned: optimize hint byte for zoned allocator btrfs: zoned: factor out prepare_allocation_zoned() serial: sc16is7xx: fix unconditional activation of THRI interrupt serial: sc16is7xx: Use port lock wrappers serial: core: Provide port lock wrappers dlm: use kernel_connect() and kernel_bind() ARM: dts: qcom: sdx55: fix USB SS wakeup ARM: dts: qcom: sdx55: fix USB DP/DM HS PHY interrupts ARM: dts: qcom: sdx55: fix pdc '#interrupt-cells' ARM: dts: samsung: exynos4210-i9100: Unconditionally enable LDO12 ARM: dts: qcom: sdx55: fix USB wakeup interrupt types pipe: wakeup wr_wait after setting max_usage fs/pipe: move check to pipe_has_watch_queue() thermal: intel: hfi: Add syscore callbacks for system-wide PM thermal: intel: hfi: Disable an HFI instance when all its CPUs go offline thermal: intel: hfi: Refactor enabling code into helper functions PM: sleep: Fix possible deadlocks in core system-wide PM code PM: core: Remove unnecessary (void *) conversions bus: mhi: ep: Do not allocate event ring element on stack media: ov13b10: Enable runtime PM before registering async sub-device media: ov13b10: Support device probe in non-zero ACPI D state erofs: fix lz4 inplace decompression erofs: get rid of the remaining kmap_atomic() drm/amdgpu/pm: Fix the power source flag error drm/amd/display: Port DENTIST hang and TDR fixes to OTG disable W/A drm/bridge: nxp-ptn3460: simplify some error checking platform/x86: intel-uncore-freq: Fix types in sysfs callbacks drm/amd/display: Disable PSR-SU on Parade 0803 TCON again drm/tidss: Fix atomic_flush check drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking drm: Don't unref the same fb many times by mistake due to deadlock handling cpufreq: intel_pstate: Refine computation of P-state for given frequency gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04 xfs: read only mounts with fsopen mount API are busted firmware: arm_scmi: Check mailbox/SMT channel for consistency ksmbd: fix global oob in ksmbd_nl_policy platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe netfilter: nf_tables: reject QUEUE/DROP verdict parameters netfilter: nft_chain_filter: handle NETDEV_UNREGISTER for inet/ingress basechain hv_netvsc: Calculate correct ring size when PAGE_SIZE is not 4 Kbytes wifi: iwlwifi: fix a memory corruption exec: Fix error handling in begin_new_exec() rbd: don't move requests to the running list on errors btrfs: don't abort filesystem when attempting to snapshot deleted subvolume btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args btrfs: don't warn if discard range is not aligned to sector btrfs: tree-checker: fix inline ref size in error messages btrfs: ref-verify: free ref cache before clearing mount opt btrfs: avoid copying BTRFS_ROOT_SUBVOL_DEAD flag to snapshot of subvolume being deleted nbd: always initialize struct msghdr completely net: fec: fix the unhandled context fault from smmu fjes: fix memleaks in fjes_hw_setup selftests: netdevsim: fix the udp_tunnel_nic test net: mvpp2: clear BM pool before initialization net: stmmac: Wait a bit for the reset to take effect netfilter: nf_tables: validate NFPROTO_* family netfilter: nf_tables: restrict anonymous set and map names to 16 bytes btrfs: fix race between reading a directory and adding entries to it btrfs: refresh dir last index during a rewinddir(3) call btrfs: set last dir index to the current last index when opening dir btrfs: fix infinite directory reads netfilter: nft_limit: reject configurations that cause integer overflow rcu: Defer RCU kthreads wakeup when CPU is dying net/mlx5e: fix a potential double-free in fs_any_create_groups net/mlx5e: fix a double-free in arfs_create_groups net/mlx5e: Allow software parsing when IPsec crypto is enabled net/mlx5: Use mlx5 device constant for selecting CQ period mode for ASO net/mlx5: DR, Can't go to uplink vport on RX rule net/mlx5: DR, Use the right GVMI number for drop action ipv6: init the accept_queue's spinlocks in inet6_create netlink: fix potential sleeping issue in mqueue_flush_file tcp: Add memory barrier to tcp_push() afs: Hide silly-rename files from userspace tracing: Ensure visibility when inserting an element into tracing_map netfs, fscache: Prevent Oops in fscache_put_cache() net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv net: micrel: Fix PTP frame parsing for lan8814 tun: add missing rx stats accounting in tun_xdp_act tun: fix missing dropped counter in tun_xdp_act net: fix removing a namespace with conflicting altnames udp: fix busy polling llc: Drop support for ETH_P_TR_802_2. llc: make llc_ui_sendmsg() more robust against bonding changes vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING bnxt_en: Wait for FLR to complete during probe tcp: make sure init the accept_queue's spinlocks once net/smc: fix illegal rmb_desc access in SMC-D connection dump wifi: mac80211: fix potential sta-link leak drm/amd/display: pbn_div need be updated for hotplug event Revert "drm/amd: Enable PCIe PME from D3" ksmbd: Add missing set_freezable() for freezable kthread ksmbd: send lease break notification on FILE_RENAME_INFORMATION ksmbd: don't increment epoch if current state and request state are same ksmbd: fix potential circular locking issue in smb2_set_ea() ksmbd: set v2 lease version on lease upgrade mm: page_alloc: unreserve highatomic page blocks before oom LoongArch/smp: Call rcutree_report_cpu_starting() earlier serial: sc16is7xx: improve do/while loop in sc16is7xx_irq() serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq() serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error serial: sc16is7xx: convert from _raw_ to _noinc_ regmap functions for FIFO serial: sc16is7xx: change EFR lock to operate on each channels serial: sc16is7xx: remove unused line structure member serial: sc16is7xx: remove global regmap from struct sc16is7xx_port serial: sc16is7xx: remove wasteful static buffer in sc16is7xx_regmap_name() serial: sc16is7xx: improve regmap debugfs by using one regmap per port rename(): fix the locking of subdirectories mm/sparsemem: fix race in accessing memory_section->usage mm/rmap: fix misplaced parenthesis of a likely() ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path nouveau/vmm: don't set addr on the fail path to avoid warning rtc: Extend timeout for waiting for UIP to clear to 1s rtc: Add support for configuring the UIP timeout for RTC reads rtc: mc146818-lib: Adjust failure return code for mc146818_get_time() rtc: Adjust failure return code for cmos_set_alarm() rtc: cmos: Use ACPI alarm for non-Intel x86 systems too arm64: Rename ARM64_WORKAROUND_2966298 media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run mmc: mmc_spi: remove custom DMA mapped buffers mmc: core: Use mrq.sbc in close-ended ffu media: videobuf2-dma-sg: fix vmap callback scripts/get_abi: fix source path leak docs: kernel_abi.py: fix command injection lsm: new security_file_ioctl_compat() hook arm64: dts: qcom: sm8150: fix USB DP/DM HS PHY interrupts arm64: dts: qcom: sdm845: fix USB DP/DM HS PHY interrupts arm64: dts: qcom: sc7280: fix usb_1 wakeup interrupt types arm64: dts: qcom: sm8150: fix USB wakeup interrupt types arm64: dts: qcom: sdm845: fix USB wakeup interrupt types arm64: dts: qcom: sc7180: fix USB wakeup interrupt types scsi: ufs: core: Remove the ufshcd_hba_exit() call from ufshcd_async_scan() dmaengine: fix NULL pointer in channel unregistration function iio: adc: ad7091r: Enable internal vref if external vref is not supplied async: Introduce async_schedule_dev_nocall() async: Split async_schedule_node_domain() parisc/power: Fix power soft-off button emulation on qemu parisc/firmware: Fix F-extend for PDC addresses bus: mhi: host: Add spinlock to protect WP access when queueing TREs bus: mhi: host: Drop chan lock before queuing buffers bus: mhi: host: Add alignment check for event ring read pointer mips: Fix max_mapnr being uninitialized on early stages s390/vfio-ap: let on_scan_complete() callback filter matrix and update guest's APCB s390/vfio-ap: loop over the shadow APCB when filtering guest's AP configuration s390/vfio-ap: always filter entire AP matrix media: ov9734: Enable runtime PM before registering async sub-device rpmsg: virtio: Free driver_override when rpmsg_remove() media: imx355: Enable runtime PM before registering async sub-device PM / devfreq: Fix buffer overflow in trans_stat_show s390/vfio-ap: unpin pages on gisc registration failure crypto: s390/aes - Fix buffer overread in CTR mode hwrng: core - Fix page fault dead lock on mmap-ed hwrng PM: hibernate: Enforce ordering during image compression/decompression crypto: api - Disallow identical driver names btrfs: sysfs: validate scrub_speed_max value OPP: Pass rounded rate to _set_opp() arm64: properly install vmlinuz.efi ext4: allow for the last group to be marked as trimmed iio: adc: ad7091r: Allow users to configure device events iio: adc: ad7091r: Set alert bit in config register Revert "nSVM: Check for reserved encodings of TLB_CONTROL in nested VMCB" usb: dwc3: gadget: Handle EP0 request dequeuing properly usb: dwc3: gadget: Queue PM runtime idle on disconnect event usb: dwc3: gadget: Refactor EP0 forced stall/restart into a separate API Conflicts: Documentation/devicetree/bindings Documentation/devicetree/bindings/gpio/xlnx,gpio-xilinx.yaml Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml Documentation/devicetree/bindings/media/mediatek,mdp3-wrot.yaml Documentation/devicetree/bindings/media/rockchip-isp1.yaml Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml drivers/bus/mhi/host/main.c drivers/clk/qcom/videocc-sm8150.c drivers/soc/qcom/llcc-qcom.c include/dt-bindings/clock/qcom,videocc-sm8150.h Change-Id: I736b858a11a53d39b1a31aaa270d6508d9d527ba Upstream-Build: ks_qcom-android14-6.1-keystone-qcom-release@12087153 UKQ2.240714.001 Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
1399 lines
36 KiB
C
1399 lines
36 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
*/
|
|
#include <linux/spinlock.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/blkdev.h>
|
|
#include <linux/hdreg.h>
|
|
#include <linux/module.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/virtio.h>
|
|
#include <linux/virtio_blk.h>
|
|
#include <linux/scatterlist.h>
|
|
#include <linux/string_helpers.h>
|
|
#include <linux/idr.h>
|
|
#include <linux/blk-mq.h>
|
|
#include <linux/blk-mq-virtio.h>
|
|
#include <linux/numa.h>
|
|
#include <uapi/linux/virtio_ring.h>
|
|
#ifdef CONFIG_GH_VIRTIO_DEBUG
|
|
#include <trace/events/gh_virtio_frontend.h>
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
#include <linux/blk-crypto-profile.h>
|
|
#include "virtio_blk_qti_crypto.h"
|
|
#endif
|
|
|
|
#define PART_BITS 4
|
|
#define VQ_NAME_LEN 16
|
|
#define MAX_DISCARD_SEGMENTS 256u
|
|
|
|
/* The maximum number of sg elements that fit into a virtqueue */
|
|
#define VIRTIO_BLK_MAX_SG_ELEMS 32768
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
/* ICE feature bits needs to be moved to uapi headers.*/
|
|
/* support ice virtualization */
|
|
#define VIRTIO_BLK_F_ICE 23
|
|
/* support ice virtualization with iv (initialization vector) */
|
|
#define VIRTIO_BLK_F_ICE_IV 22
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_NO_SG_CHAIN
|
|
#define VIRTIO_BLK_INLINE_SG_CNT 0
|
|
#else
|
|
#define VIRTIO_BLK_INLINE_SG_CNT 2
|
|
#endif
|
|
|
|
static unsigned int num_request_queues;
|
|
module_param(num_request_queues, uint, 0644);
|
|
MODULE_PARM_DESC(num_request_queues,
|
|
"Limit the number of request queues to use for blk device. "
|
|
"0 for no limit. "
|
|
"Values > nr_cpu_ids truncated to nr_cpu_ids.");
|
|
|
|
static unsigned int poll_queues;
|
|
module_param(poll_queues, uint, 0644);
|
|
MODULE_PARM_DESC(poll_queues, "The number of dedicated virtqueues for polling I/O");
|
|
|
|
static int major;
|
|
static DEFINE_IDA(vd_index_ida);
|
|
|
|
static struct workqueue_struct *virtblk_wq;
|
|
|
|
struct virtio_blk_vq {
|
|
struct virtqueue *vq;
|
|
spinlock_t lock;
|
|
char name[VQ_NAME_LEN];
|
|
} ____cacheline_aligned_in_smp;
|
|
|
|
struct virtio_blk {
|
|
/*
|
|
* This mutex must be held by anything that may run after
|
|
* virtblk_remove() sets vblk->vdev to NULL.
|
|
*
|
|
* blk-mq, virtqueue processing, and sysfs attribute code paths are
|
|
* shut down before vblk->vdev is set to NULL and therefore do not need
|
|
* to hold this mutex.
|
|
*/
|
|
struct mutex vdev_mutex;
|
|
struct virtio_device *vdev;
|
|
|
|
/* The disk structure for the kernel. */
|
|
struct gendisk *disk;
|
|
|
|
/* Block layer tags. */
|
|
struct blk_mq_tag_set tag_set;
|
|
|
|
/* Process context for config space updates */
|
|
struct work_struct config_work;
|
|
|
|
/* Ida index - used to track minor number allocations. */
|
|
int index;
|
|
|
|
/* num of vqs */
|
|
int num_vqs;
|
|
int io_queues[HCTX_MAX_TYPES];
|
|
struct virtio_blk_vq *vqs;
|
|
};
|
|
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
struct virtio_blk_ice_info {
|
|
/*the key slot to use for inline crypto*/
|
|
u8 ice_slot;
|
|
u8 activate;
|
|
u16 reserved;
|
|
u32 reserved1;
|
|
u64 data_unit_num;
|
|
} __packed;
|
|
#endif
|
|
|
|
struct virtblk_req {
|
|
struct virtio_blk_outhdr out_hdr;
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
struct virtio_blk_ice_info ice_info;
|
|
#endif
|
|
u8 status;
|
|
struct sg_table sg_table;
|
|
struct scatterlist sg[];
|
|
};
|
|
|
|
static inline blk_status_t virtblk_result(struct virtblk_req *vbr)
|
|
{
|
|
switch (vbr->status) {
|
|
case VIRTIO_BLK_S_OK:
|
|
return BLK_STS_OK;
|
|
case VIRTIO_BLK_S_UNSUPP:
|
|
return BLK_STS_NOTSUPP;
|
|
default:
|
|
return BLK_STS_IOERR;
|
|
}
|
|
}
|
|
|
|
static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx)
|
|
{
|
|
struct virtio_blk *vblk = hctx->queue->queuedata;
|
|
struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num];
|
|
|
|
return vq;
|
|
}
|
|
|
|
static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr)
|
|
{
|
|
struct scatterlist hdr, status, *sgs[3];
|
|
unsigned int num_out = 0, num_in = 0;
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
/* Backend (HOST) expects to receive encryption info via extended
|
|
* structure when ICE negotiation is successful which will be used
|
|
* by backend ufs/sdhci host controller to program the descriptors
|
|
* as per spec standards to enable the encryption on read/write
|
|
* of data from/to disk.
|
|
*/
|
|
size_t const hdr_size = virtio_has_feature(vq->vdev, VIRTIO_BLK_F_ICE_IV) ?
|
|
sizeof(vbr->out_hdr) + sizeof(vbr->ice_info) :
|
|
sizeof(vbr->out_hdr);
|
|
sg_init_one(&hdr, &vbr->out_hdr, hdr_size);
|
|
#else
|
|
sg_init_one(&hdr, &vbr->out_hdr, sizeof(vbr->out_hdr));
|
|
#endif
|
|
sgs[num_out++] = &hdr;
|
|
|
|
if (vbr->sg_table.nents) {
|
|
if (vbr->out_hdr.type & cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT))
|
|
sgs[num_out++] = vbr->sg_table.sgl;
|
|
else
|
|
sgs[num_out + num_in++] = vbr->sg_table.sgl;
|
|
}
|
|
|
|
sg_init_one(&status, &vbr->status, sizeof(vbr->status));
|
|
sgs[num_out + num_in++] = &status;
|
|
|
|
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
|
|
}
|
|
|
|
static int virtblk_setup_discard_write_zeroes_erase(struct request *req, bool unmap)
|
|
{
|
|
unsigned short segments = blk_rq_nr_discard_segments(req);
|
|
unsigned short n = 0;
|
|
struct virtio_blk_discard_write_zeroes *range;
|
|
struct bio *bio;
|
|
u32 flags = 0;
|
|
|
|
if (unmap)
|
|
flags |= VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP;
|
|
|
|
range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
|
|
if (!range)
|
|
return -ENOMEM;
|
|
|
|
/*
|
|
* Single max discard segment means multi-range discard isn't
|
|
* supported, and block layer only runs contiguity merge like
|
|
* normal RW request. So we can't reply on bio for retrieving
|
|
* each range info.
|
|
*/
|
|
if (queue_max_discard_segments(req->q) == 1) {
|
|
range[0].flags = cpu_to_le32(flags);
|
|
range[0].num_sectors = cpu_to_le32(blk_rq_sectors(req));
|
|
range[0].sector = cpu_to_le64(blk_rq_pos(req));
|
|
n = 1;
|
|
} else {
|
|
__rq_for_each_bio(bio, req) {
|
|
u64 sector = bio->bi_iter.bi_sector;
|
|
u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT;
|
|
|
|
range[n].flags = cpu_to_le32(flags);
|
|
range[n].num_sectors = cpu_to_le32(num_sectors);
|
|
range[n].sector = cpu_to_le64(sector);
|
|
n++;
|
|
}
|
|
}
|
|
|
|
WARN_ON_ONCE(n != segments);
|
|
|
|
req->special_vec.bv_page = virt_to_page(range);
|
|
req->special_vec.bv_offset = offset_in_page(range);
|
|
req->special_vec.bv_len = sizeof(*range) * segments;
|
|
req->rq_flags |= RQF_SPECIAL_PAYLOAD;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void virtblk_unmap_data(struct request *req, struct virtblk_req *vbr)
|
|
{
|
|
if (blk_rq_nr_phys_segments(req))
|
|
sg_free_table_chained(&vbr->sg_table,
|
|
VIRTIO_BLK_INLINE_SG_CNT);
|
|
}
|
|
|
|
static int virtblk_map_data(struct blk_mq_hw_ctx *hctx, struct request *req,
|
|
struct virtblk_req *vbr)
|
|
{
|
|
int err;
|
|
|
|
if (!blk_rq_nr_phys_segments(req))
|
|
return 0;
|
|
|
|
vbr->sg_table.sgl = vbr->sg;
|
|
err = sg_alloc_table_chained(&vbr->sg_table,
|
|
blk_rq_nr_phys_segments(req),
|
|
vbr->sg_table.sgl,
|
|
VIRTIO_BLK_INLINE_SG_CNT);
|
|
if (unlikely(err))
|
|
return -ENOMEM;
|
|
|
|
return blk_rq_map_sg(hctx->queue, req, vbr->sg_table.sgl);
|
|
}
|
|
|
|
static void virtblk_cleanup_cmd(struct request *req)
|
|
{
|
|
if (req->rq_flags & RQF_SPECIAL_PAYLOAD)
|
|
kfree(bvec_virt(&req->special_vec));
|
|
}
|
|
|
|
static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
|
|
struct request *req,
|
|
struct virtblk_req *vbr)
|
|
{
|
|
bool unmap = false;
|
|
u32 type;
|
|
|
|
vbr->out_hdr.sector = 0;
|
|
|
|
switch (req_op(req)) {
|
|
case REQ_OP_READ:
|
|
type = VIRTIO_BLK_T_IN;
|
|
vbr->out_hdr.sector = cpu_to_virtio64(vdev,
|
|
blk_rq_pos(req));
|
|
break;
|
|
case REQ_OP_WRITE:
|
|
type = VIRTIO_BLK_T_OUT;
|
|
vbr->out_hdr.sector = cpu_to_virtio64(vdev,
|
|
blk_rq_pos(req));
|
|
break;
|
|
case REQ_OP_FLUSH:
|
|
type = VIRTIO_BLK_T_FLUSH;
|
|
break;
|
|
case REQ_OP_DISCARD:
|
|
type = VIRTIO_BLK_T_DISCARD;
|
|
break;
|
|
case REQ_OP_WRITE_ZEROES:
|
|
type = VIRTIO_BLK_T_WRITE_ZEROES;
|
|
unmap = !(req->cmd_flags & REQ_NOUNMAP);
|
|
break;
|
|
case REQ_OP_SECURE_ERASE:
|
|
type = VIRTIO_BLK_T_SECURE_ERASE;
|
|
break;
|
|
case REQ_OP_DRV_IN:
|
|
type = VIRTIO_BLK_T_GET_ID;
|
|
break;
|
|
default:
|
|
WARN_ON_ONCE(1);
|
|
return BLK_STS_IOERR;
|
|
}
|
|
|
|
vbr->out_hdr.type = cpu_to_virtio32(vdev, type);
|
|
vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
|
|
|
|
if (type == VIRTIO_BLK_T_DISCARD || type == VIRTIO_BLK_T_WRITE_ZEROES ||
|
|
type == VIRTIO_BLK_T_SECURE_ERASE) {
|
|
if (virtblk_setup_discard_write_zeroes_erase(req, unmap))
|
|
return BLK_STS_RESOURCE;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline void virtblk_request_done(struct request *req)
|
|
{
|
|
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
|
|
|
|
virtblk_unmap_data(req, vbr);
|
|
virtblk_cleanup_cmd(req);
|
|
blk_mq_end_request(req, virtblk_result(vbr));
|
|
}
|
|
|
|
static void virtblk_done(struct virtqueue *vq)
|
|
{
|
|
struct virtio_blk *vblk = vq->vdev->priv;
|
|
bool req_done = false;
|
|
int qid = vq->index;
|
|
struct virtblk_req *vbr;
|
|
unsigned long flags;
|
|
unsigned int len;
|
|
|
|
spin_lock_irqsave(&vblk->vqs[qid].lock, flags);
|
|
do {
|
|
virtqueue_disable_cb(vq);
|
|
while ((vbr = virtqueue_get_buf(vblk->vqs[qid].vq, &len)) != NULL) {
|
|
struct request *req = blk_mq_rq_from_pdu(vbr);
|
|
|
|
if (likely(!blk_should_fake_timeout(req->q)))
|
|
blk_mq_complete_request(req);
|
|
#ifdef CONFIG_GH_VIRTIO_DEBUG
|
|
trace_virtio_block_done(vq->vdev->index, req_op(req), blk_rq_pos(req));
|
|
#endif
|
|
req_done = true;
|
|
}
|
|
if (unlikely(virtqueue_is_broken(vq)))
|
|
break;
|
|
} while (!virtqueue_enable_cb(vq));
|
|
|
|
/* In case queue is stopped waiting for more buffers. */
|
|
if (req_done)
|
|
blk_mq_start_stopped_hw_queues(vblk->disk->queue, true);
|
|
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
|
|
}
|
|
|
|
static void virtio_commit_rqs(struct blk_mq_hw_ctx *hctx)
|
|
{
|
|
struct virtio_blk *vblk = hctx->queue->queuedata;
|
|
struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num];
|
|
bool kick;
|
|
|
|
spin_lock_irq(&vq->lock);
|
|
kick = virtqueue_kick_prepare(vq->vq);
|
|
spin_unlock_irq(&vq->lock);
|
|
|
|
if (kick)
|
|
virtqueue_notify(vq->vq);
|
|
}
|
|
|
|
static blk_status_t virtblk_fail_to_queue(struct request *req, int rc)
|
|
{
|
|
virtblk_cleanup_cmd(req);
|
|
switch (rc) {
|
|
case -ENOSPC:
|
|
return BLK_STS_DEV_RESOURCE;
|
|
case -ENOMEM:
|
|
return BLK_STS_RESOURCE;
|
|
default:
|
|
return BLK_STS_IOERR;
|
|
}
|
|
}
|
|
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
static void virtblk_get_ice_info(struct request *req)
|
|
{
|
|
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
|
|
|
|
/* whether or not the request needs inline crypto operations*/
|
|
if (!req || !req->crypt_keyslot) {
|
|
/* ice is not activated */
|
|
vbr->ice_info.activate = false;
|
|
} else {
|
|
vbr->ice_info.ice_slot = blk_crypto_keyslot_index(req->crypt_keyslot);
|
|
/* ice is activated - successful flow */
|
|
vbr->ice_info.activate = true;
|
|
/* data unit number i.e. iv value */
|
|
vbr->ice_info.data_unit_num = req->crypt_ctx->bc_dun[0];
|
|
}
|
|
}
|
|
#endif
|
|
|
|
static blk_status_t virtblk_prep_rq(struct blk_mq_hw_ctx *hctx,
|
|
struct virtio_blk *vblk,
|
|
struct request *req,
|
|
struct virtblk_req *vbr)
|
|
{
|
|
blk_status_t status;
|
|
int num;
|
|
|
|
status = virtblk_setup_cmd(vblk->vdev, req, vbr);
|
|
if (unlikely(status))
|
|
return status;
|
|
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
if (virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_ICE_IV))
|
|
virtblk_get_ice_info(req);
|
|
#endif
|
|
num = virtblk_map_data(hctx, req, vbr);
|
|
if (unlikely(num < 0))
|
|
return virtblk_fail_to_queue(req, -ENOMEM);
|
|
vbr->sg_table.nents = num;
|
|
|
|
blk_mq_start_request(req);
|
|
|
|
return BLK_STS_OK;
|
|
}
|
|
|
|
static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|
const struct blk_mq_queue_data *bd)
|
|
{
|
|
struct virtio_blk *vblk = hctx->queue->queuedata;
|
|
struct request *req = bd->rq;
|
|
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
|
|
unsigned long flags;
|
|
int qid = hctx->queue_num;
|
|
bool notify = false;
|
|
blk_status_t status;
|
|
int err;
|
|
|
|
status = virtblk_prep_rq(hctx, vblk, req, vbr);
|
|
if (unlikely(status))
|
|
return status;
|
|
|
|
spin_lock_irqsave(&vblk->vqs[qid].lock, flags);
|
|
err = virtblk_add_req(vblk->vqs[qid].vq, vbr);
|
|
#ifdef CONFIG_GH_VIRTIO_DEBUG
|
|
trace_virtio_block_submit(vblk->vqs[qid].vq->vdev->index,
|
|
vbr->out_hdr.type, vbr->out_hdr.sector, vbr->out_hdr.ioprio, err);
|
|
#endif
|
|
if (err) {
|
|
virtqueue_kick(vblk->vqs[qid].vq);
|
|
/* Don't stop the queue if -ENOMEM: we may have failed to
|
|
* bounce the buffer due to global resource outage.
|
|
*/
|
|
if (err == -ENOSPC)
|
|
blk_mq_stop_hw_queue(hctx);
|
|
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
|
|
virtblk_unmap_data(req, vbr);
|
|
return virtblk_fail_to_queue(req, err);
|
|
}
|
|
|
|
if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq))
|
|
notify = true;
|
|
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
|
|
|
|
if (notify)
|
|
virtqueue_notify(vblk->vqs[qid].vq);
|
|
return BLK_STS_OK;
|
|
}
|
|
|
|
static bool virtblk_prep_rq_batch(struct request *req)
|
|
{
|
|
struct virtio_blk *vblk = req->mq_hctx->queue->queuedata;
|
|
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
|
|
|
|
req->mq_hctx->tags->rqs[req->tag] = req;
|
|
|
|
return virtblk_prep_rq(req->mq_hctx, vblk, req, vbr) == BLK_STS_OK;
|
|
}
|
|
|
|
static bool virtblk_add_req_batch(struct virtio_blk_vq *vq,
|
|
struct request **rqlist)
|
|
{
|
|
unsigned long flags;
|
|
int err;
|
|
bool kick;
|
|
|
|
spin_lock_irqsave(&vq->lock, flags);
|
|
|
|
while (!rq_list_empty(*rqlist)) {
|
|
struct request *req = rq_list_pop(rqlist);
|
|
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
|
|
|
|
err = virtblk_add_req(vq->vq, vbr);
|
|
if (err) {
|
|
virtblk_unmap_data(req, vbr);
|
|
virtblk_cleanup_cmd(req);
|
|
blk_mq_requeue_request(req, true);
|
|
}
|
|
}
|
|
|
|
kick = virtqueue_kick_prepare(vq->vq);
|
|
spin_unlock_irqrestore(&vq->lock, flags);
|
|
|
|
return kick;
|
|
}
|
|
|
|
static void virtio_queue_rqs(struct request **rqlist)
|
|
{
|
|
struct request *req, *next, *prev = NULL;
|
|
struct request *requeue_list = NULL;
|
|
|
|
rq_list_for_each_safe(rqlist, req, next) {
|
|
struct virtio_blk_vq *vq = get_virtio_blk_vq(req->mq_hctx);
|
|
bool kick;
|
|
|
|
if (!virtblk_prep_rq_batch(req)) {
|
|
rq_list_move(rqlist, &requeue_list, req, prev);
|
|
req = prev;
|
|
if (!req)
|
|
continue;
|
|
}
|
|
|
|
if (!next || req->mq_hctx != next->mq_hctx) {
|
|
req->rq_next = NULL;
|
|
kick = virtblk_add_req_batch(vq, rqlist);
|
|
if (kick)
|
|
virtqueue_notify(vq->vq);
|
|
|
|
*rqlist = next;
|
|
prev = NULL;
|
|
} else
|
|
prev = req;
|
|
}
|
|
|
|
*rqlist = requeue_list;
|
|
}
|
|
|
|
/* return id (s/n) string for *disk to *id_str
|
|
*/
|
|
static int virtblk_get_id(struct gendisk *disk, char *id_str)
|
|
{
|
|
struct virtio_blk *vblk = disk->private_data;
|
|
struct request_queue *q = vblk->disk->queue;
|
|
struct request *req;
|
|
int err;
|
|
|
|
req = blk_mq_alloc_request(q, REQ_OP_DRV_IN, 0);
|
|
if (IS_ERR(req))
|
|
return PTR_ERR(req);
|
|
|
|
err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL);
|
|
if (err)
|
|
goto out;
|
|
|
|
blk_execute_rq(req, false);
|
|
err = blk_status_to_errno(virtblk_result(blk_mq_rq_to_pdu(req)));
|
|
out:
|
|
blk_mq_free_request(req);
|
|
return err;
|
|
}
|
|
|
|
/* We provide getgeo only to please some old bootloader/partitioning tools */
|
|
static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
|
|
{
|
|
struct virtio_blk *vblk = bd->bd_disk->private_data;
|
|
int ret = 0;
|
|
|
|
mutex_lock(&vblk->vdev_mutex);
|
|
|
|
if (!vblk->vdev) {
|
|
ret = -ENXIO;
|
|
goto out;
|
|
}
|
|
|
|
/* see if the host passed in geometry config */
|
|
if (virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_GEOMETRY)) {
|
|
virtio_cread(vblk->vdev, struct virtio_blk_config,
|
|
geometry.cylinders, &geo->cylinders);
|
|
virtio_cread(vblk->vdev, struct virtio_blk_config,
|
|
geometry.heads, &geo->heads);
|
|
virtio_cread(vblk->vdev, struct virtio_blk_config,
|
|
geometry.sectors, &geo->sectors);
|
|
} else {
|
|
/* some standard values, similar to sd */
|
|
geo->heads = 1 << 6;
|
|
geo->sectors = 1 << 5;
|
|
geo->cylinders = get_capacity(bd->bd_disk) >> 11;
|
|
}
|
|
out:
|
|
mutex_unlock(&vblk->vdev_mutex);
|
|
return ret;
|
|
}
|
|
|
|
static void virtblk_free_disk(struct gendisk *disk)
|
|
{
|
|
struct virtio_blk *vblk = disk->private_data;
|
|
|
|
ida_simple_remove(&vd_index_ida, vblk->index);
|
|
mutex_destroy(&vblk->vdev_mutex);
|
|
kfree(vblk);
|
|
}
|
|
|
|
static const struct block_device_operations virtblk_fops = {
|
|
.owner = THIS_MODULE,
|
|
.getgeo = virtblk_getgeo,
|
|
.free_disk = virtblk_free_disk,
|
|
};
|
|
|
|
static int index_to_minor(int index)
|
|
{
|
|
return index << PART_BITS;
|
|
}
|
|
|
|
static int minor_to_index(int minor)
|
|
{
|
|
return minor >> PART_BITS;
|
|
}
|
|
|
|
static ssize_t serial_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct gendisk *disk = dev_to_disk(dev);
|
|
int err;
|
|
|
|
/* sysfs gives us a PAGE_SIZE buffer */
|
|
BUILD_BUG_ON(PAGE_SIZE < VIRTIO_BLK_ID_BYTES);
|
|
|
|
buf[VIRTIO_BLK_ID_BYTES] = '\0';
|
|
err = virtblk_get_id(disk, buf);
|
|
if (!err)
|
|
return strlen(buf);
|
|
|
|
if (err == -EIO) /* Unsupported? Make it empty. */
|
|
return 0;
|
|
|
|
return err;
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(serial);
|
|
|
|
/* The queue's logical block size must be set before calling this */
|
|
static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
|
|
{
|
|
struct virtio_device *vdev = vblk->vdev;
|
|
struct request_queue *q = vblk->disk->queue;
|
|
char cap_str_2[10], cap_str_10[10];
|
|
unsigned long long nblocks;
|
|
u64 capacity;
|
|
|
|
/* Host must always specify the capacity. */
|
|
virtio_cread(vdev, struct virtio_blk_config, capacity, &capacity);
|
|
|
|
nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
|
|
|
|
string_get_size(nblocks, queue_logical_block_size(q),
|
|
STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
|
|
string_get_size(nblocks, queue_logical_block_size(q),
|
|
STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
|
|
|
|
dev_notice(&vdev->dev,
|
|
"[%s] %s%llu %d-byte logical blocks (%s/%s)\n",
|
|
vblk->disk->disk_name,
|
|
resize ? "new size: " : "",
|
|
nblocks,
|
|
queue_logical_block_size(q),
|
|
cap_str_10,
|
|
cap_str_2);
|
|
|
|
set_capacity_and_notify(vblk->disk, capacity);
|
|
}
|
|
|
|
static void virtblk_config_changed_work(struct work_struct *work)
|
|
{
|
|
struct virtio_blk *vblk =
|
|
container_of(work, struct virtio_blk, config_work);
|
|
|
|
virtblk_update_capacity(vblk, true);
|
|
}
|
|
|
|
static void virtblk_config_changed(struct virtio_device *vdev)
|
|
{
|
|
struct virtio_blk *vblk = vdev->priv;
|
|
|
|
queue_work(virtblk_wq, &vblk->config_work);
|
|
}
|
|
|
|
static int init_vq(struct virtio_blk *vblk)
|
|
{
|
|
int err;
|
|
unsigned short i;
|
|
vq_callback_t **callbacks;
|
|
const char **names;
|
|
struct virtqueue **vqs;
|
|
unsigned short num_vqs;
|
|
unsigned short num_poll_vqs;
|
|
struct virtio_device *vdev = vblk->vdev;
|
|
struct irq_affinity desc = { 0, };
|
|
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_MQ,
|
|
struct virtio_blk_config, num_queues,
|
|
&num_vqs);
|
|
if (err)
|
|
num_vqs = 1;
|
|
|
|
if (!err && !num_vqs) {
|
|
dev_err(&vdev->dev, "MQ advertised but zero queues reported\n");
|
|
return -EINVAL;
|
|
}
|
|
|
|
num_vqs = min_t(unsigned int,
|
|
min_not_zero(num_request_queues, nr_cpu_ids),
|
|
num_vqs);
|
|
|
|
num_poll_vqs = min_t(unsigned int, poll_queues, num_vqs - 1);
|
|
|
|
vblk->io_queues[HCTX_TYPE_DEFAULT] = num_vqs - num_poll_vqs;
|
|
vblk->io_queues[HCTX_TYPE_READ] = 0;
|
|
vblk->io_queues[HCTX_TYPE_POLL] = num_poll_vqs;
|
|
|
|
dev_info(&vdev->dev, "%d/%d/%d default/read/poll queues\n",
|
|
vblk->io_queues[HCTX_TYPE_DEFAULT],
|
|
vblk->io_queues[HCTX_TYPE_READ],
|
|
vblk->io_queues[HCTX_TYPE_POLL]);
|
|
|
|
vblk->vqs = kmalloc_array(num_vqs, sizeof(*vblk->vqs), GFP_KERNEL);
|
|
if (!vblk->vqs)
|
|
return -ENOMEM;
|
|
|
|
names = kmalloc_array(num_vqs, sizeof(*names), GFP_KERNEL);
|
|
callbacks = kmalloc_array(num_vqs, sizeof(*callbacks), GFP_KERNEL);
|
|
vqs = kmalloc_array(num_vqs, sizeof(*vqs), GFP_KERNEL);
|
|
if (!names || !callbacks || !vqs) {
|
|
err = -ENOMEM;
|
|
goto out;
|
|
}
|
|
|
|
for (i = 0; i < num_vqs - num_poll_vqs; i++) {
|
|
callbacks[i] = virtblk_done;
|
|
snprintf(vblk->vqs[i].name, VQ_NAME_LEN, "req.%u", i);
|
|
names[i] = vblk->vqs[i].name;
|
|
}
|
|
|
|
for (; i < num_vqs; i++) {
|
|
callbacks[i] = NULL;
|
|
snprintf(vblk->vqs[i].name, VQ_NAME_LEN, "req_poll.%u", i);
|
|
names[i] = vblk->vqs[i].name;
|
|
}
|
|
|
|
/* Discover virtqueues and write information to configuration. */
|
|
err = virtio_find_vqs(vdev, num_vqs, vqs, callbacks, names, &desc);
|
|
if (err)
|
|
goto out;
|
|
|
|
for (i = 0; i < num_vqs; i++) {
|
|
spin_lock_init(&vblk->vqs[i].lock);
|
|
vblk->vqs[i].vq = vqs[i];
|
|
}
|
|
vblk->num_vqs = num_vqs;
|
|
|
|
out:
|
|
kfree(vqs);
|
|
kfree(callbacks);
|
|
kfree(names);
|
|
if (err)
|
|
kfree(vblk->vqs);
|
|
return err;
|
|
}
|
|
|
|
/*
|
|
* Legacy naming scheme used for virtio devices. We are stuck with it for
|
|
* virtio blk but don't ever use it for any new driver.
|
|
*/
|
|
static int virtblk_name_format(char *prefix, int index, char *buf, int buflen)
|
|
{
|
|
const int base = 'z' - 'a' + 1;
|
|
char *begin = buf + strlen(prefix);
|
|
char *end = buf + buflen;
|
|
char *p;
|
|
int unit;
|
|
|
|
p = end - 1;
|
|
*p = '\0';
|
|
unit = base;
|
|
do {
|
|
if (p == begin)
|
|
return -EINVAL;
|
|
*--p = 'a' + (index % unit);
|
|
index = (index / unit) - 1;
|
|
} while (index >= 0);
|
|
|
|
memmove(begin, p, end - p);
|
|
memcpy(buf, prefix, strlen(prefix));
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int virtblk_get_cache_mode(struct virtio_device *vdev)
|
|
{
|
|
u8 writeback;
|
|
int err;
|
|
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE,
|
|
struct virtio_blk_config, wce,
|
|
&writeback);
|
|
|
|
/*
|
|
* If WCE is not configurable and flush is not available,
|
|
* assume no writeback cache is in use.
|
|
*/
|
|
if (err)
|
|
writeback = virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH);
|
|
|
|
return writeback;
|
|
}
|
|
|
|
static void virtblk_update_cache_mode(struct virtio_device *vdev)
|
|
{
|
|
u8 writeback = virtblk_get_cache_mode(vdev);
|
|
struct virtio_blk *vblk = vdev->priv;
|
|
|
|
blk_queue_write_cache(vblk->disk->queue, writeback, false);
|
|
}
|
|
|
|
static const char *const virtblk_cache_types[] = {
|
|
"write through", "write back"
|
|
};
|
|
|
|
static ssize_t
|
|
cache_type_store(struct device *dev, struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
{
|
|
struct gendisk *disk = dev_to_disk(dev);
|
|
struct virtio_blk *vblk = disk->private_data;
|
|
struct virtio_device *vdev = vblk->vdev;
|
|
int i;
|
|
|
|
BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
|
|
i = sysfs_match_string(virtblk_cache_types, buf);
|
|
if (i < 0)
|
|
return i;
|
|
|
|
virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
|
|
virtblk_update_cache_mode(vdev);
|
|
return count;
|
|
}
|
|
|
|
static ssize_t
|
|
cache_type_show(struct device *dev, struct device_attribute *attr, char *buf)
|
|
{
|
|
struct gendisk *disk = dev_to_disk(dev);
|
|
struct virtio_blk *vblk = disk->private_data;
|
|
u8 writeback = virtblk_get_cache_mode(vblk->vdev);
|
|
|
|
BUG_ON(writeback >= ARRAY_SIZE(virtblk_cache_types));
|
|
return sysfs_emit(buf, "%s\n", virtblk_cache_types[writeback]);
|
|
}
|
|
|
|
static DEVICE_ATTR_RW(cache_type);
|
|
|
|
static struct attribute *virtblk_attrs[] = {
|
|
&dev_attr_serial.attr,
|
|
&dev_attr_cache_type.attr,
|
|
NULL,
|
|
};
|
|
|
|
static umode_t virtblk_attrs_are_visible(struct kobject *kobj,
|
|
struct attribute *a, int n)
|
|
{
|
|
struct device *dev = kobj_to_dev(kobj);
|
|
struct gendisk *disk = dev_to_disk(dev);
|
|
struct virtio_blk *vblk = disk->private_data;
|
|
struct virtio_device *vdev = vblk->vdev;
|
|
|
|
if (a == &dev_attr_cache_type.attr &&
|
|
!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE))
|
|
return S_IRUGO;
|
|
|
|
return a->mode;
|
|
}
|
|
|
|
static const struct attribute_group virtblk_attr_group = {
|
|
.attrs = virtblk_attrs,
|
|
.is_visible = virtblk_attrs_are_visible,
|
|
};
|
|
|
|
static const struct attribute_group *virtblk_attr_groups[] = {
|
|
&virtblk_attr_group,
|
|
NULL,
|
|
};
|
|
|
|
static void virtblk_map_queues(struct blk_mq_tag_set *set)
|
|
{
|
|
struct virtio_blk *vblk = set->driver_data;
|
|
int i, qoff;
|
|
|
|
for (i = 0, qoff = 0; i < set->nr_maps; i++) {
|
|
struct blk_mq_queue_map *map = &set->map[i];
|
|
|
|
map->nr_queues = vblk->io_queues[i];
|
|
map->queue_offset = qoff;
|
|
qoff += map->nr_queues;
|
|
|
|
if (map->nr_queues == 0)
|
|
continue;
|
|
|
|
/*
|
|
* Regular queues have interrupts and hence CPU affinity is
|
|
* defined by the core virtio code, but polling queues have
|
|
* no interrupts so we let the block layer assign CPU affinity.
|
|
*/
|
|
if (i == HCTX_TYPE_POLL)
|
|
blk_mq_map_queues(&set->map[i]);
|
|
else
|
|
blk_mq_virtio_map_queues(&set->map[i], vblk->vdev, 0);
|
|
}
|
|
}
|
|
|
|
static void virtblk_complete_batch(struct io_comp_batch *iob)
|
|
{
|
|
struct request *req;
|
|
|
|
rq_list_for_each(&iob->req_list, req) {
|
|
virtblk_unmap_data(req, blk_mq_rq_to_pdu(req));
|
|
virtblk_cleanup_cmd(req);
|
|
}
|
|
blk_mq_end_request_batch(iob);
|
|
}
|
|
|
|
static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
|
|
{
|
|
struct virtio_blk *vblk = hctx->queue->queuedata;
|
|
struct virtio_blk_vq *vq = get_virtio_blk_vq(hctx);
|
|
struct virtblk_req *vbr;
|
|
unsigned long flags;
|
|
unsigned int len;
|
|
int found = 0;
|
|
|
|
spin_lock_irqsave(&vq->lock, flags);
|
|
|
|
while ((vbr = virtqueue_get_buf(vq->vq, &len)) != NULL) {
|
|
struct request *req = blk_mq_rq_from_pdu(vbr);
|
|
|
|
found++;
|
|
if (!blk_mq_add_to_batch(req, iob, vbr->status,
|
|
virtblk_complete_batch))
|
|
blk_mq_complete_request(req);
|
|
}
|
|
|
|
if (found)
|
|
blk_mq_start_stopped_hw_queues(vblk->disk->queue, true);
|
|
|
|
spin_unlock_irqrestore(&vq->lock, flags);
|
|
|
|
return found;
|
|
}
|
|
|
|
static const struct blk_mq_ops virtio_mq_ops = {
|
|
.queue_rq = virtio_queue_rq,
|
|
.queue_rqs = virtio_queue_rqs,
|
|
.commit_rqs = virtio_commit_rqs,
|
|
.complete = virtblk_request_done,
|
|
.map_queues = virtblk_map_queues,
|
|
.poll = virtblk_poll,
|
|
};
|
|
|
|
static unsigned int virtblk_queue_depth;
|
|
module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
|
|
|
|
static int virtblk_probe(struct virtio_device *vdev)
|
|
{
|
|
struct virtio_blk *vblk;
|
|
struct request_queue *q;
|
|
int err, index;
|
|
|
|
u32 v, blk_size, max_size, sg_elems, opt_io_size;
|
|
u32 max_discard_segs = 0;
|
|
u32 discard_granularity = 0;
|
|
u16 min_io_size;
|
|
u8 physical_block_exp, alignment_offset;
|
|
unsigned int queue_depth;
|
|
size_t max_dma_size;
|
|
|
|
if (!vdev->config->get) {
|
|
dev_err(&vdev->dev, "%s failure: config access disabled\n",
|
|
__func__);
|
|
return -EINVAL;
|
|
}
|
|
|
|
err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS),
|
|
GFP_KERNEL);
|
|
if (err < 0)
|
|
goto out;
|
|
index = err;
|
|
|
|
/* We need to know how many segments before we allocate. */
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SEG_MAX,
|
|
struct virtio_blk_config, seg_max,
|
|
&sg_elems);
|
|
|
|
/* We need at least one SG element, whatever they say. */
|
|
if (err || !sg_elems)
|
|
sg_elems = 1;
|
|
|
|
/* Prevent integer overflows and honor max vq size */
|
|
sg_elems = min_t(u32, sg_elems, VIRTIO_BLK_MAX_SG_ELEMS - 2);
|
|
|
|
vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL);
|
|
if (!vblk) {
|
|
err = -ENOMEM;
|
|
goto out_free_index;
|
|
}
|
|
|
|
mutex_init(&vblk->vdev_mutex);
|
|
|
|
vblk->vdev = vdev;
|
|
|
|
INIT_WORK(&vblk->config_work, virtblk_config_changed_work);
|
|
|
|
err = init_vq(vblk);
|
|
if (err)
|
|
goto out_free_vblk;
|
|
|
|
/* Default queue sizing is to fill the ring. */
|
|
if (!virtblk_queue_depth) {
|
|
queue_depth = vblk->vqs[0].vq->num_free;
|
|
/* ... but without indirect descs, we use 2 descs per req */
|
|
if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC))
|
|
queue_depth /= 2;
|
|
} else {
|
|
queue_depth = virtblk_queue_depth;
|
|
}
|
|
|
|
memset(&vblk->tag_set, 0, sizeof(vblk->tag_set));
|
|
vblk->tag_set.ops = &virtio_mq_ops;
|
|
vblk->tag_set.queue_depth = queue_depth;
|
|
vblk->tag_set.numa_node = NUMA_NO_NODE;
|
|
vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
|
|
vblk->tag_set.cmd_size =
|
|
sizeof(struct virtblk_req) +
|
|
sizeof(struct scatterlist) * VIRTIO_BLK_INLINE_SG_CNT;
|
|
vblk->tag_set.driver_data = vblk;
|
|
vblk->tag_set.nr_hw_queues = vblk->num_vqs;
|
|
vblk->tag_set.nr_maps = 1;
|
|
if (vblk->io_queues[HCTX_TYPE_POLL])
|
|
vblk->tag_set.nr_maps = 3;
|
|
|
|
err = blk_mq_alloc_tag_set(&vblk->tag_set);
|
|
if (err)
|
|
goto out_free_vq;
|
|
|
|
vblk->disk = blk_mq_alloc_disk(&vblk->tag_set, vblk);
|
|
if (IS_ERR(vblk->disk)) {
|
|
err = PTR_ERR(vblk->disk);
|
|
goto out_free_tags;
|
|
}
|
|
q = vblk->disk->queue;
|
|
|
|
virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN);
|
|
|
|
vblk->disk->major = major;
|
|
vblk->disk->first_minor = index_to_minor(index);
|
|
vblk->disk->minors = 1 << PART_BITS;
|
|
vblk->disk->private_data = vblk;
|
|
vblk->disk->fops = &virtblk_fops;
|
|
vblk->index = index;
|
|
|
|
/* configure queue flush support */
|
|
virtblk_update_cache_mode(vdev);
|
|
|
|
/* If disk is read-only in the host, the guest should obey */
|
|
if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
|
|
set_disk_ro(vblk->disk, 1);
|
|
|
|
/* We can handle whatever the host told us to handle. */
|
|
blk_queue_max_segments(q, sg_elems);
|
|
|
|
/* No real sector limit. */
|
|
blk_queue_max_hw_sectors(q, -1U);
|
|
|
|
max_dma_size = virtio_max_dma_size(vdev);
|
|
max_size = max_dma_size > U32_MAX ? U32_MAX : max_dma_size;
|
|
|
|
/* Host can optionally specify maximum segment size and number of
|
|
* segments. */
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
|
|
struct virtio_blk_config, size_max, &v);
|
|
if (!err)
|
|
max_size = min(max_size, v);
|
|
|
|
blk_queue_max_segment_size(q, max_size);
|
|
|
|
/* Host can optionally specify the block size of the device */
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE,
|
|
struct virtio_blk_config, blk_size,
|
|
&blk_size);
|
|
if (!err) {
|
|
err = blk_validate_block_size(blk_size);
|
|
if (err) {
|
|
dev_err(&vdev->dev,
|
|
"virtio_blk: invalid block size: 0x%x\n",
|
|
blk_size);
|
|
goto out_cleanup_disk;
|
|
}
|
|
|
|
blk_queue_logical_block_size(q, blk_size);
|
|
} else
|
|
blk_size = queue_logical_block_size(q);
|
|
|
|
/* Use topology information if available */
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY,
|
|
struct virtio_blk_config, physical_block_exp,
|
|
&physical_block_exp);
|
|
if (!err && physical_block_exp)
|
|
blk_queue_physical_block_size(q,
|
|
blk_size * (1 << physical_block_exp));
|
|
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY,
|
|
struct virtio_blk_config, alignment_offset,
|
|
&alignment_offset);
|
|
if (!err && alignment_offset)
|
|
blk_queue_alignment_offset(q, blk_size * alignment_offset);
|
|
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY,
|
|
struct virtio_blk_config, min_io_size,
|
|
&min_io_size);
|
|
if (!err && min_io_size)
|
|
blk_queue_io_min(q, blk_size * min_io_size);
|
|
|
|
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY,
|
|
struct virtio_blk_config, opt_io_size,
|
|
&opt_io_size);
|
|
if (!err && opt_io_size)
|
|
blk_queue_io_opt(q, blk_size * opt_io_size);
|
|
|
|
if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
|
|
virtio_cread(vdev, struct virtio_blk_config,
|
|
discard_sector_alignment, &discard_granularity);
|
|
|
|
virtio_cread(vdev, struct virtio_blk_config,
|
|
max_discard_sectors, &v);
|
|
blk_queue_max_discard_sectors(q, v ? v : UINT_MAX);
|
|
|
|
virtio_cread(vdev, struct virtio_blk_config, max_discard_seg,
|
|
&max_discard_segs);
|
|
}
|
|
|
|
if (virtio_has_feature(vdev, VIRTIO_BLK_F_WRITE_ZEROES)) {
|
|
virtio_cread(vdev, struct virtio_blk_config,
|
|
max_write_zeroes_sectors, &v);
|
|
blk_queue_max_write_zeroes_sectors(q, v ? v : UINT_MAX);
|
|
}
|
|
|
|
/* The discard and secure erase limits are combined since the Linux
|
|
* block layer uses the same limit for both commands.
|
|
*
|
|
* If both VIRTIO_BLK_F_SECURE_ERASE and VIRTIO_BLK_F_DISCARD features
|
|
* are negotiated, we will use the minimum between the limits.
|
|
*
|
|
* discard sector alignment is set to the minimum between discard_sector_alignment
|
|
* and secure_erase_sector_alignment.
|
|
*
|
|
* max discard sectors is set to the minimum between max_discard_seg and
|
|
* max_secure_erase_seg.
|
|
*/
|
|
if (virtio_has_feature(vdev, VIRTIO_BLK_F_SECURE_ERASE)) {
|
|
|
|
virtio_cread(vdev, struct virtio_blk_config,
|
|
secure_erase_sector_alignment, &v);
|
|
|
|
/* secure_erase_sector_alignment should not be zero, the device should set a
|
|
* valid number of sectors.
|
|
*/
|
|
if (!v) {
|
|
dev_err(&vdev->dev,
|
|
"virtio_blk: secure_erase_sector_alignment can't be 0\n");
|
|
err = -EINVAL;
|
|
goto out_cleanup_disk;
|
|
}
|
|
|
|
discard_granularity = min_not_zero(discard_granularity, v);
|
|
|
|
virtio_cread(vdev, struct virtio_blk_config,
|
|
max_secure_erase_sectors, &v);
|
|
|
|
/* max_secure_erase_sectors should not be zero, the device should set a
|
|
* valid number of sectors.
|
|
*/
|
|
if (!v) {
|
|
dev_err(&vdev->dev,
|
|
"virtio_blk: max_secure_erase_sectors can't be 0\n");
|
|
err = -EINVAL;
|
|
goto out_cleanup_disk;
|
|
}
|
|
|
|
blk_queue_max_secure_erase_sectors(q, v);
|
|
|
|
virtio_cread(vdev, struct virtio_blk_config,
|
|
max_secure_erase_seg, &v);
|
|
|
|
/* max_secure_erase_seg should not be zero, the device should set a
|
|
* valid number of segments
|
|
*/
|
|
if (!v) {
|
|
dev_err(&vdev->dev,
|
|
"virtio_blk: max_secure_erase_seg can't be 0\n");
|
|
err = -EINVAL;
|
|
goto out_cleanup_disk;
|
|
}
|
|
|
|
max_discard_segs = min_not_zero(max_discard_segs, v);
|
|
}
|
|
|
|
if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD) ||
|
|
virtio_has_feature(vdev, VIRTIO_BLK_F_SECURE_ERASE)) {
|
|
/* max_discard_seg and discard_granularity will be 0 only
|
|
* if max_discard_seg and discard_sector_alignment fields in the virtio
|
|
* config are 0 and VIRTIO_BLK_F_SECURE_ERASE feature is not negotiated.
|
|
* In this case, we use default values.
|
|
*/
|
|
if (!max_discard_segs)
|
|
max_discard_segs = sg_elems;
|
|
|
|
blk_queue_max_discard_segments(q,
|
|
min(max_discard_segs, MAX_DISCARD_SEGMENTS));
|
|
|
|
if (discard_granularity)
|
|
q->limits.discard_granularity = discard_granularity << SECTOR_SHIFT;
|
|
else
|
|
q->limits.discard_granularity = blk_size;
|
|
}
|
|
|
|
virtblk_update_capacity(vblk, false);
|
|
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
if (virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_ICE_IV)) {
|
|
dev_notice(&vdev->dev, "%s\n", vblk->disk->disk_name);
|
|
/* Initilaize supported crypto capabilities*/
|
|
err = virtblk_init_crypto_qti_spec(&vblk->vdev->dev);
|
|
if (!err)
|
|
virtblk_crypto_qti_crypto_register(vblk->disk->queue);
|
|
}
|
|
#endif
|
|
virtio_device_ready(vdev);
|
|
err = device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups);
|
|
if (err)
|
|
goto out_cleanup_disk;
|
|
|
|
return 0;
|
|
|
|
out_cleanup_disk:
|
|
put_disk(vblk->disk);
|
|
out_free_tags:
|
|
blk_mq_free_tag_set(&vblk->tag_set);
|
|
out_free_vq:
|
|
vdev->config->del_vqs(vdev);
|
|
kfree(vblk->vqs);
|
|
out_free_vblk:
|
|
kfree(vblk);
|
|
out_free_index:
|
|
ida_simple_remove(&vd_index_ida, index);
|
|
out:
|
|
return err;
|
|
}
|
|
|
|
static void virtblk_remove(struct virtio_device *vdev)
|
|
{
|
|
struct virtio_blk *vblk = vdev->priv;
|
|
|
|
/* Make sure no work handler is accessing the device. */
|
|
flush_work(&vblk->config_work);
|
|
|
|
del_gendisk(vblk->disk);
|
|
blk_mq_free_tag_set(&vblk->tag_set);
|
|
|
|
mutex_lock(&vblk->vdev_mutex);
|
|
|
|
/* Stop all the virtqueues. */
|
|
virtio_reset_device(vdev);
|
|
|
|
/* Virtqueues are stopped, nothing can use vblk->vdev anymore. */
|
|
vblk->vdev = NULL;
|
|
|
|
vdev->config->del_vqs(vdev);
|
|
kfree(vblk->vqs);
|
|
|
|
mutex_unlock(&vblk->vdev_mutex);
|
|
|
|
put_disk(vblk->disk);
|
|
}
|
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
static int virtblk_freeze(struct virtio_device *vdev)
|
|
{
|
|
struct virtio_blk *vblk = vdev->priv;
|
|
|
|
/* Ensure we don't receive any more interrupts */
|
|
virtio_reset_device(vdev);
|
|
|
|
/* Make sure no work handler is accessing the device. */
|
|
flush_work(&vblk->config_work);
|
|
|
|
blk_mq_quiesce_queue(vblk->disk->queue);
|
|
|
|
vdev->config->del_vqs(vdev);
|
|
kfree(vblk->vqs);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int virtblk_restore(struct virtio_device *vdev)
|
|
{
|
|
struct virtio_blk *vblk = vdev->priv;
|
|
int ret;
|
|
|
|
ret = init_vq(vdev->priv);
|
|
if (ret)
|
|
return ret;
|
|
|
|
virtio_device_ready(vdev);
|
|
|
|
blk_mq_unquiesce_queue(vblk->disk->queue);
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
static const struct virtio_device_id id_table[] = {
|
|
{ VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID },
|
|
{ 0 },
|
|
};
|
|
|
|
static unsigned int features_legacy[] = {
|
|
VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
|
|
VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
|
|
VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
|
|
VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
|
|
VIRTIO_BLK_F_SECURE_ERASE,
|
|
}
|
|
;
|
|
static unsigned int features[] = {
|
|
VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
|
|
VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
|
|
VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
|
|
VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
|
|
VIRTIO_BLK_F_SECURE_ERASE,
|
|
#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)
|
|
VIRTIO_BLK_F_ICE, VIRTIO_BLK_F_ICE_IV,
|
|
#endif
|
|
};
|
|
|
|
static struct virtio_driver virtio_blk = {
|
|
.feature_table = features,
|
|
.feature_table_size = ARRAY_SIZE(features),
|
|
.feature_table_legacy = features_legacy,
|
|
.feature_table_size_legacy = ARRAY_SIZE(features_legacy),
|
|
.driver.name = KBUILD_MODNAME,
|
|
.driver.owner = THIS_MODULE,
|
|
.id_table = id_table,
|
|
.probe = virtblk_probe,
|
|
.remove = virtblk_remove,
|
|
.config_changed = virtblk_config_changed,
|
|
#ifdef CONFIG_PM_SLEEP
|
|
.freeze = virtblk_freeze,
|
|
.restore = virtblk_restore,
|
|
#endif
|
|
};
|
|
|
|
static int __init virtio_blk_init(void)
|
|
{
|
|
int error;
|
|
|
|
virtblk_wq = alloc_workqueue("virtio-blk", 0, 0);
|
|
if (!virtblk_wq)
|
|
return -ENOMEM;
|
|
|
|
major = register_blkdev(0, "virtblk");
|
|
if (major < 0) {
|
|
error = major;
|
|
goto out_destroy_workqueue;
|
|
}
|
|
|
|
error = register_virtio_driver(&virtio_blk);
|
|
if (error)
|
|
goto out_unregister_blkdev;
|
|
return 0;
|
|
|
|
out_unregister_blkdev:
|
|
unregister_blkdev(major, "virtblk");
|
|
out_destroy_workqueue:
|
|
destroy_workqueue(virtblk_wq);
|
|
return error;
|
|
}
|
|
|
|
static void __exit virtio_blk_fini(void)
|
|
{
|
|
unregister_virtio_driver(&virtio_blk);
|
|
unregister_blkdev(major, "virtblk");
|
|
destroy_workqueue(virtblk_wq);
|
|
}
|
|
module_init(virtio_blk_init);
|
|
module_exit(virtio_blk_fini);
|
|
|
|
MODULE_DEVICE_TABLE(virtio, id_table);
|
|
MODULE_DESCRIPTION("Virtio block driver");
|
|
MODULE_LICENSE("GPL");
|