summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2026-08-05ACPI: CPPC: Avoid locking standalone full-width registersChristian Loehle1-13/+84
cpc_write() serializes every SystemMemory write with the per-CPU rmw_lock. The lock is required for read-modify-write fields and for registers whose access units overlap, but not for a full-width register in a standalone access unit. The _CPC layout is immutable after it has been parsed. Classify each SystemMemory register at probe time and retain locking for partial fields, invalid access widths, and overlapping access units. Allow standalone full-width registers to bypass the descriptor lookup and spinlock. Store the classification in existing structure padding so that struct cpc_register_resource does not grow. Signed-off-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/20260803210527.1285229-3-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-08-05ACPI: CPPC: Avoid unnecessary reads for full-width writesChristian Loehle1-17/+26
SystemMemory GAS entries may describe a field within a wider access unit, so cpc_write() reads the access unit before updating the field to preserve the surrounding bits. It also does this when the field covers the complete access unit. When the bit offset is zero and the register bit width equals the resolved access width, the previous value cannot affect the result. Skip the MMIO read and mask operation in that case. Retain rmw_lock because another entry in the same _CPC package may share the access unit. Signed-off-by: Christian Loehle <christian.loehle@arm.com> Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com> Link: https://patch.msgid.link/20260803210527.1285229-2-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-08-05ACPI: CPPC: Stop reading desired_perf in cppc_get_perf()Christian Loehle1-15/+7
cppc_get_perf() has one in-tree caller, cppc_cpufreq_get_cpu_data(). It uses the function to preserve existing controls before writing them, but overwrites desired_perf with highest_perf before the first cppc_set_perf(). Consequently, the current Desired Performance value is not consumed. Remove the Desired Performance read from this aggregate getter and document that the field is returned as zero. Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com> Signed-off-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/20260803203531.1268651-4-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-08-05ACPI: CPPC: Skip desired_perf read in cppc_get_perf()Christian Loehle1-2/+5
ACPI 6.5 defines _CPC revision 3 and lists Read/Write as the Optional Attribute of Desired Performance. ACPI 6.6 advances _CPC to revision 4 and lists only Write. cppc_get_perf() nevertheless reads the register when initializing performance controls, even though cppc-cpufreq overwrites the value before using it. Use the _CPC revision check from cppc_get_desired_perf() and leave desired_perf zero instead of reading it for _CPC revision 4 or later. Also exclude the register from PCC read-command detection so it cannot trigger an otherwise unnecessary read command. Fixes: 658fa7b1c47a ("ACPI: CPPC: Add cppc_get_perf() API to read performance controls") Cc: stable@vger.kernel.org Suggested-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com> Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com> Signed-off-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/20260803203531.1268651-3-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-08-05ACPI: CPPC: Reject desired_perf reads on _CPC revision 4+Christian Loehle2-2/+17
When CPPC feedback counters cannot provide a usable sample, cppc-cpufreq calls cppc_get_desired_perf() because some platforms repurpose Desired Performance to report actual delivered performance. ACPI 6.5 defines _CPC revision 3 and lists Read/Write as the Optional Attribute of Desired Performance. ACPI 6.6 advances _CPC to revision 4 and lists only Write, so invoking that workaround for revision 4 or later would require a register read that the interface no longer specifies. Make cppc_get_desired_perf() return -EOPNOTSUPP for _CPC revision 4 or later. Use the revision retained in the per-CPU CPC descriptor rather than the platform-wide FADT revision. The _CPC revision may still not accurately describe the implemented register semantics. If a nominally revision 3 platform implements a non-readable Desired Performance register, a read may return zero and make cppc_cpufreq_get_rate() report 0 kHz. Treat a zero read as unusable and fall back to the cached OSPM request, just as for a failed read. Fixes: c47195631960 ("cppc_cpufreq: Use desired perf if feedback ctrs are 0 or unchanged") Cc: stable@vger.kernel.org Suggested-by: Sumit Gupta <sumitg@nvidia.com> Signed-off-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/20260803203531.1268651-2-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-08-05ASoC: cs35l41/cs35l45/cs4265: sort the reg_defaults tablesMark Brown263-1452/+3510
Peter Ujfalusi <peter.ujfalusi@linux.intel.com> says: reg_defaults must be sorted by ascending register address as regcache_lookup_reg() locates the entries in it with bsearch(), see commit fd80df352ba1 ("regcache: Add support for sorting defaults arrays"). These three tables have entries which are out of order, so the binary search does not find part of them. For those registers regcache_reg_needs_sync() cannot compare the cached value against the default and reports that a sync is needed, so they are written to the device on every regcache_sync() even when they were never touched. The patches only reorder the existing entries, the text of every entry is kept verbatim and no default value is changed. Each table was verified by evaluating the register addresses and replaying lib/bsearch.c on them. Entries not reachable by the binary search, per table: cs35l41_reg 2 (of 47) cs35l45_defaults 36 (of 73) cs4265_reg_defaults 3 (of 16) For cs35l45 this is nearly half of the table: the DSP1_RX*_RATE and DSP1_TX*_RATE registers sit in the middle of it while their addresses are far above everything else, which cuts the search off from the whole 0x4c40 - 0xf010 range. Found by an audit of all reg_defaults tables under sound/, the SoundWire codec drivers are fixed by a separate series. Link: https://patch.msgid.link/20260805082413.26174-1-peter.ujfalusi@linux.intel.com
2026-08-05s390/dasd: Read cached unit address and LSS in the CCW build pathStefan Haberland2-10/+24
The CCW build path (prefix_LRE, the full-track prefix and dso_ras) read the base address and LSS straight from conf.ned. That buffer is freed and reallocated by the reload worker (do_reload_device - dasd_eckd_read_conf - dasd_eckd_clear_conf_data), so a configuration change concurrent with I/O can free conf.ned while a request is being built. Use-after-free reported by KASAN in prefix_LRE. Read the cached copies instead. The unit address is already kept in uid.real_unit_addr, and the LSS is now cached in ned_lss. Both are refreshed under the ccwdev lock in dasd_eckd_generate_uid whenever the configuration is (re)read. Also fix for prepare for read subsystem data (prssd) users. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-20-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Re-enable discard support for ESE volumesStefan Haberland3-43/+166
Re-enable block-layer discard for ESE ECKD volumes, releasing thin space via release allocated space (RAS). This is based on commit 7e64db1597fe ("s390/dasd: Add discard support for ESE volumes") but adapted to the current code and fixed. REQ_OP_DISCARD is routed to a RAS release over the request's track range, and discard requests run on the base device only. Discard limits use extent granularity via the disc_limits discipline hook so the block layer only issues extent-aligned discards. Discard is gated on the DASD_FEATURE_DISCARD device feature rather than a per-discipline flag: the driver sets the feature when the volume is on ESE hardware (i.e. RAS is available), and the block-layer setup enables discard limits for a device that has it. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-19-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Report ESE capability and format mode at device onlineStefan Haberland1-3/+18
Extend the device information line logged when a volume comes online with the ESE hardware capability and the on-disk format mode. The format mode (full or on demand) is derived from the on-disk format label alone, so a volume that is not backed by ESE hardware but was still formatted on demand is reported correctly. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-18-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Detect ESE volumes from the on-disk format labelStefan Haberland4-15/+175
Read the format label from track 0 record 4 at device bring-up and cache it. When a valid label is present, is_ese() is derived from it instead of the hardware volume field. A volume copied off ESE storage onto other hardware is thus still handled as thin. Without a label (older format) is_ese() falls back to the hardware field as before. The cache is refreshed after a format so is_ese() stays coherent without an offline/online cycle. The label F_ESE bit is stamped from the hardware capability rather than is_ese(), and space release (quick format) is gated on the hardware capability, so a copied label cannot enable it on non-ESE hardware. The ese sysfs attribute, and with this lsdasd, shows the hardware capability and not the internal handling. This is in line with the view from storage server interface. To reflect the specific internal handling an additional attribute on_demand_formatting is added to show that a device is handled like an ESE device internally based on the disk label. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-17-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Stamp a format label into newly formatted volumesStefan Haberland2-5/+114
When a CDL volume is formatted, write a small on-disk label so the format can later be recognised by the kernel. The next patch will use this for ESE detection. The label records a magic, a version, whether the volume is ESE, and whether it was formatted quick (space released, thin) or full. It lives in track 0, head 0, record 4 (the first non-special CDL record). R4 is written by the same channel program that formats track 0 - its WRITE_CKD transfers count + the label data instead of count-only - so label and track format reach the disk atomically; a valid magic then marks a completed format without a separate, racy write. Quick vs full is derived from a full space release (RAS) preceding the format: dasd_eckd_release_space_full() sets a per-device flag the next format consumes. Non-ESE volumes and formats without a preceding full release are recorded as full. struct dasd_format_label is exactly 512 bytes (the smallest block size) so it fits one record; larger blocks zero-pad the rest. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-16-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Derive adaptive ESE fulltrack heuristic from ft_biasStefan Haberland3-6/+223
Turn the middle of the ft_bias range (1..99) into an adaptive heuristic that switches between fulltrack write (ft1) and plain write ft0 depending on how sparse the device still is. A sparse device benefits from fulltrack writes (it avoids the format/retry cycle); once enough tracks are formatted the per-write overhead of ft1 outweighs that. An state machine measures the NRF rate in short ft0 probe windows and flips back to ft1 when it is high (FT1_ACTIVE -> PROBING -> FT0_STABLE, with a backing-off reprobe interval). The four parameters are derived from ft_bias by linear interpolation, anchored so ft_bias == 50 derives the following values: ese_heu_start_interval - 2000 - IOs in ft1, before first ft0-Probe starts ese_heu_probe_window - 100 - IOs in probe window ese_heu_nrf_high - 10 ‰ (= 1 %) - TRACK_FORMAT rate that leads to ft1 ese_heu_max_interval - 500000 - Backoff-Cap: max. IOs between two probes Higher is more eager to use ft1, and 0/100 skips the heuristic. The NRF counter is bumped in dasd_eckd_ese_format() for both the classic NRF sense and the HPF INV_TRACK_FORMAT equivalent. The state machine resets to ft1 on check_characteristics, full format, and release-space. A read-only ese_heuristic_state sysfs attribute exposes the current mode. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-15-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Add full_track_bias to control fulltrack write modeStefan Haberland3-5/+88
Add a single per-device 'full_track_bias' sysfs attribute (0..100) that gates the full-track write path. 0 disables it, 100 routes every aligned, full-track write through dasd_eckd_build_cp_tpm_writefulltrack(). Values in between are reserved for the adaptive heuristic added in the next patch. For now any non-zero value simply enables full-track writes. Internally the value is kept in the per-device 'ft_bias' field. This will control the default IO path only. In case we get an unformatted track error it will always be used to format and write the track in one go. The WRITE_FULL_TRACK command has an advantage on sparse formatted ESE devices but it has an overall penalty for maximum throughput compared to usual track based IO. The attribute lives at /sys/bus/ccw/devices/<devid>/full_track_bias and accepts 0..100. The default is DASD_FT_BIAS_DEFAULT; together with the adaptive heuristic added in the next patch it uses full-track writes only where they pay off, avoiding the ESE format penalty out of the box while keeping the throughput cost off already-formatted volumes. A 'full_track_bias' module parameter sets the initial value applied to every device at online time; individual volumes can still be re-tuned through their sysfs attribute afterwards. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-14-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Use WRITE_FULL_TRACK in ESE format handlerStefan Haberland5-80/+193
Wire dasd_eckd_build_cp_tpm_writefulltrack() into the ESE unformated track handler. dasd_eckd_ese_format() now returns void (matching the revised discipline hook): it computes the failing track/record range, trims a partially covered last track when several tracks are involved (the block layer re-issues the remainder), claims the range with test_and_set_format_track(), builds a writefulltrack CQR, copies callback_data/proc_bytes from the origin, and stages it on block->ese_staging. The origin CQR is set to DASD_CQR_ABORT so __dasd_process_cqr() retires it without the normal completion. Drop dasd_eckd_ese_format_cb(); the format-entry slot is now released by dasd_eckd_free_alias_cp() via clear_format_track() when the CQR is freed. dasd_int_handler() calls the void hook directly and, for writefulltrack CQRs (cqr->filldata set), returns DASD_CQR_ERROR instead of looping on the NRF. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-13-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Add dasd_eckd_build_cp_tpm_writefulltrack()Stefan Haberland1-1/+343
Add the channel program builder for WRITE_FULL_TRACK requests, used by dasd_eckd_ese_format() (next patch) to format and write a set of tracks atomically and avoid the format cycle on ESE devices. The program is an ITCW with a TIDAW list. Per track it emits an eckd_r0 header, an eckd_count + data pair for every record (pad records before and after the caller's data window use device->nulldata, records in the window point into the bio payload), and a terminating 0xFF pseudo-count with TIDAW_FLAGS_INSERT_CBC. The descriptors come from the per-device fill_chunks pool so they can be freed in bulk in __dasd_cleanup_cqr(). Add inline helpers crosses_page() and reserve_nocross(), to keep each descriptor within one page since TIDAW addressing must not cross a page boundary. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-12-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Extend prepare_itcw() to support WRITE_FULL_TRACKStefan Haberland1-13/+51
prepare_itcw() builds the FCX prefix block (PFX + LRE) for track-mode I/O. Extend it to handle DASD_ECKD_CCW_WRITE_FULL_TRACK. WRITE_FULL_TRACK needs two extra bytes appended to the LRE for that bitmask. The prefix block is a scratch buffer copied into the TCCB by itcw_add_dcw(), so keep it on the stack (sized for the two extra bytes) rather than allocating it: this runs in the writeback path and must not depend on an allocation that can fail under memory pressure. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-11-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Add range-based format-track collision detectionStefan Haberland3-29/+81
Replace the single per-device format_entry slot with an array of 16 slots so multiple format requests can be in flight at once, and extend struct dasd_format_entry with a start_trk/end_trk/cqr range (replacing the single track field). Rewrite test_and_set_format_track() to scan the array for range overlaps instead of a trkcount snapshot, honour the early-collision flag, and return the allocated slot to the caller. Add dasd_req_conflict() and extend dasd_return_cqr_cb() to mark in-flight data CQRs that overlap a just-completed format range, so the next test_and_set_format_track() detects the conflict early. Remove the now-obsolete trkcount snapshot in dasd_start_IO(). The detection added here only becomes active together with the WRITE_FULL_TRACK ESE format handler later in the series: that patch routes the format request through dasd_return_cqr_cb() (so completion runs the overlap hook with cqr->format set) and records each request's start_trk/end_trk range. Until then the array and the conflict check are in place but dormant. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-10-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Add infrastructure for ESE full-track writeStefan Haberland4-15/+120
Add the driver internals to build WRITE_FULL_TRACK FCX channel programs in response to unformatted tracks on ESE devices. struct dasd_ccw_req: filldata, a pointer to the per-track metadata (an R0 record and the count records) that the WRITE_FULL_TRACK TIDAWs point at, and format/start_trk/end_trk/collision that link a request to its format-track guard entry so an overlapping format request can be detected. struct dasd_device: fill_mem/fill_chunks pool for those buffers and a zeroed nulldata page used as the data source for pad records. struct dasd_block: ese_staging/ese_lock, a hardirq-safe staging list. An ESE format CQR is created in the interrupt handler but has to be enqueued on ccw_queue under queue_lock; taking queue_lock while the ccwdev_lock is held there would invert the lock order, so the CQR is staged under ese_lock and dasd_block_tasklet splices it onto ccw_queue. Existing locking is unchanged. Add CQR states DASD_CQR_ABORT/ABORTED to retire the origin CQR of a replaced write without completing it to the block layer, and struct eckd_r0 for the track header record. The CCW and ESE format pools are enlarged (a full-track ITCW is roughly twice a plain track-mode one) to keep two maximum-size requests in flight. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-9-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Add defines for the Extended Address Volume track addressStefan Haberland2-2/+10
The track address of an Extended Address Volume (more than 65520 cylinders) carries the high cylinder bits that do not fit the 16-bit cyl field in the upper part of the head field. set_ch_t() open-codes the corresponding shifts; name them so the encoding is explicit and can be reused. No functional change. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-8-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Use GFP_KERNEL in dasd_alloc_device()Stefan Haberland1-4/+4
dasd_alloc_device() runs in process context (device set_online), so its pool allocations do not need GFP_ATOMIC. Use GFP_KERNEL instead, which is more reliable, especially for the larger DMA allocations that later ESE full-track work adds here. No functional change intended. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-7-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Optimize max blocks per request for track alignmentStefan Haberland1-1/+1
With 4096-byte blocks a full ECKD track holds exactly 12 records. Lower DASD_ECKD_MAX_BLOCKS from 190 to 180 so requests align to track boundaries (15 full tracks); full-track I/O is more efficient than partial-track writes, and 190 had no alignment significance and could let a request cross a track boundary. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-6-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Snapshot intrc before freeing the request blockStefan Haberland1-2/+8
__dasd_cleanup_cqr() maps the completion result to a block status by reading cqr->intrc, but only after discipline->free_cp() has returned the request block to its memory pool (dasd_eckd_free_cp() ends in dasd_sfree_request()). On SMP another CPU can reallocate that block and overwrite cqr->intrc before it is read, completing the request with the wrong error. proc_bytes is already snapshotted before free_cp() for the same reason; do the same for intrc. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-5-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Guard sysfs discipline callbacks against unallocated private dataStefan Haberland1-2/+38
Several sysfs show/store handlers call a discipline callback that dereferences device->private, either directly or through the DASD_DEFINE_ATTR() macro. During dasd_generic_set_online() the discipline is assigned before check_device() allocates device->private, so an unprivileged read of one of these world-readable attributes in that window dereferences a NULL pointer and panics. Guard the dereference inside each callback that actually touches device->private. Fixes: c729696bcf8b ("s390/dasd: Recognise data for ESE volumes") Cc: stable@vger.kernel.org Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-4-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Propagate partial completion length across ERP recoveryStefan Haberland1-0/+3
dasd_default_erp_postaction() copies the timing and device state from the finished ERP request back to the original request but drops proc_bytes. A request that was partially completed, an ESE read of a not-yet-allocated track returns fewer bytes than requested, and then recovered through the ERP chain loses its partial-completion length. __dasd_cleanup_cqr() then sees proc_bytes == 0 and completes the whole request instead of requeueing the remainder, silently returning zeroed data for the part that was never read. Carry proc_bytes over to the original request like the other per-request state. Fixes: 5e6bdd37c552 ("s390/dasd: fix data corruption for thin provisioned devices") Cc: stable@vger.kernel.org Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-3-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05s390/dasd: Do not complete a failed ESE read as successfulStefan Haberland1-2/+4
dasd_int_handler() completes an NRF read of an unallocated ESE track by calling ese_read() and unconditionally marking the request DASD_CQR_SUCCESS. dasd_eckd_ese_read() can return an error before it has zeroed the destination buffer: a failed sense-data parse or a current track outside the requested range both return early, leaving the destination pages untouched. The request is still completed successfully, so the block layer is handed stale / uninitialized memory instead of zeros. Check the ese_read() return value and fail the request through the normal error path instead of forcing DASD_CQR_SUCCESS. Fixes: 5e6bdd37c552 ("s390/dasd: fix data corruption for thin provisioned devices") Cc: stable@vger.kernel.org Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260805111612.1285190-2-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-08-05intel_idle: Avoid using deep idle states during initializationRafael J. Wysocki1-0/+23
Commit c0f691388992 ("intel_idle: Use subsys_initcall_sync() for initialization") effectively made intel_idle initialize earlier which turns out to interfere with USB EHCI probing on some platforms [1]. Investigation led to the conclusion that this was related to allowing package idle states to be used earlier than before. Work around that issue by making intel_idle set a CPU latency QoS request to prevent package idle states from being used on all platforms supported by it for the duration of the device_initcall() initialization phase. Fixes: c0f691388992 ("intel_idle: Use subsys_initcall_sync() for initialization") Reported-by: Julian Silver <mendaxca@gmail.com> Tested-by: Julian Silver <mendaxca@gmail.com> Closes: https://lore.kernel.org/linux-acpi/3353bdf3-4f33-44b1-809b-b0378bee5816@gmail.com/ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/5120454.31r3eYUQgx@rafael.j.wysocki
2026-08-05firmware: cs_dsp: Fix mock register default typo in KUnit testRichard Fitzgerald1-1/+1
Correct the address of the HALO_SCRATCH4 entry in halo_register_defaults[]. This doesn't affect the validity of the KUnit testing because none of the tests rely on this value. It's only defaulted because cs_dsp will read it when the DSP state changes from running to stopped - this would only have logged a warning about failure to read the register but it doesn't cause anything to fail. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20260805105223.956785-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-05x86/xen: fix init of balloon stats againRoger Pau Monne1-10/+19
The handling of extra memory regions done in balloon_add_regions() is not correct for PV guests, since the initial target is set to reflect the real memory the system has, not what's described on the memory map, which can be higher if memory != maxmem. Introduce separate logic for addition vs subtraction in balloon_add_regions() and handle extra regions correctly by adding them to the total amount of pages, instead of subtracting from the current and target pages amounts. In the common case PV domU/dom0 and PVH dom0 will use the addition path, since the initial target reflects the real assigned memory. HVM and PVH domUs use the subtraction path, since the target is set based on the amount of memory reported in the memory map, without accounting for released regions. Fixes: 87af633689ce ("x86/xen: fix balloon target initialization for PVH dom0") Fixes: 0949c646d646 ("Partial revert "x86/xen: fix balloon target initialization for PVH dom0"") Signed-off-by: Roger Pau Monné <roger@xenproject.org> Cc: stable@vger.kernel.org Reviewed-by: Juergen Gross <jgross@suse.com> Tested-by: Matthias Goergens <matthias.goergens@gmail.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20260805094008.95778-1-roger@xenproject.org>
2026-08-05xen/xenbus: check otherend_id only after it has been initializedMarek Marczykowski-Górecki1-1/+2
When device just got initialized (for example on module load), the otherend_id field is initialized only after xenbus_read_otherend_details() gets called. If xenstore watch triggers xenbus_dev_changed() before that, it might consider still zeroed otherend_id field (not matching actual xenstore content) as a sign of device state reset. It can happen because xenstore watch are handled in another thread (xenwatch), which can run in parallel to the initial device probe running at module load. In that case, it would call device_unregister(), which would deadlock against device probe from module init. Fix this by considering dev->otherend_id change only after dev->otherend is set (which happen after otherend_id is initialized). Fixes: e2dcf9065536 "xen/xenbus: better handle backend crash" Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20260803030822.4104093-2-marmarek@invisiblethingslab.com>
2026-08-05xen/xenbus: log more information when device state got resetMarek Marczykowski-Górecki1-1/+2
Ease diagnosing what actually changed. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20260803030822.4104093-1-marmarek@invisiblethingslab.com>
2026-08-05thermal: hwmon: Remove hwmon class device along with its parentRafael J. Wysocki1-53/+34
The current code creates one hwmon device per thermal zone type and that device is registered under the first thermal zone of the given type. That turns out to be problematic when the thermal zone holding the hwmon device is removed. For example, say that there are two ACPI thermal zones on a system /sys/devices/virtual/thermal/thermal_zone0/ /sys/devices/virtual/thermal/thermal_zone1/ The current code registers a hwmon class device for thermal_zone0 only: /sys/devices/virtual/thermal/thermal_zone0/hwmon0/ because the type is "acpitz" for both of them, but it adds a sysfs attribute that belongs to thermal_zone1 under it: /sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp2_input There is also /sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input which belongs to thermal_zone0. When thermal_zone0 is removed, say because the ACPI thermal driver is unbound from the underlying platform device, thermal_remove_hwmon_sysfs() skips the removal of hwmon0 because of the temp2_input attribute belonging to thermal_zone1 which effectively prevents thermal_zone0 removal from making progress. Address this by making thermal_remove_hwmon_sysfs() remove the entire hwmon class device interface for the given thermal zone type when the thermal zone device holding it is removed. To prevent races with thermal_add_hwmon_sysfs() that may interfere with this, carry out the entire addition and removal of hwmon sysfs interfaces for thermal zones under thermal_hwmon_list_lock. Also adjust the layout of the labels in thermal_add_hwmon_sysfs() to the current kernel coding style to align with the new "unlock" label. Link: https://lore.kernel.org/linux-pm/20260402021828.16556-1-liujia6264@gmail.com/ Fixes: f6b6b52ef7a5 ("thermal_hwmon: Pass the originating device down to hwmon_device_register_with_info") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/5094738.GXAFRqVoOG@rafael.j.wysocki
2026-08-05Revert "thermal/drivers/hwmon: Cleanup coding style a bit"Rafael J. Wysocki1-1/+2
Revert commit 030a48b0f6ce ("thermal/drivers/hwmon: Cleanup coding style a bit") that introduced a use-after-free into the error path of thermal_add_hwmon_sysfs() by removing a valid check from it. Link: https://lore.kernel.org/linux-hwmon/20260803183915.4ED7D1F000E9@smtp.kernel.org/ Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/5123895.31r3eYUQgx@rafael.j.wysocki
2026-08-05rust: treewide: replace `__pinned_init` with `raw_[try_]init`Gary Guo1-2/+2
The `__init` method is not designed to be a public API (existence of "__" is a hint for this); replace users with `pin_init::raw_[try_]init` which does the same thing. There are a few users of `__init` which are replaced as well. Acked-by: Miguel Ojeda <ojeda@kernel.org> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260729-merge-init-v2-4-26adf47109e7@garyguo.net Signed-off-by: Gary Guo <gary@garyguo.net>
2026-08-05drm/ttm: Use common ancestor of evictor and evictee as limit poolNatalie Vock1-3/+40
When checking whether to skip certain buffers because they're protected by dmem.low, we're checking the effective protection of the evictee's cgroup, but depending on how the evictor's cgroup relates to the evictee's, the semantics of effective protection values change. When testing against cgroups from different subtrees, page_counter's recursive protection propagates memory protection afforded to a parent down to the child cgroups, even if the children were not explicitly protected. This prevents cgroups whose parents were afforded no protection from stealing memory from cgroups whose parents were afforded more protection, without users having to explicitly propagate this protection. However, if we always calculate protection from the root cgroup, this breaks prioritization of sibling cgroups: If one cgroup was explicitly protected and its siblings were not, the protected cgroup should get higher priority, i.e. the protected cgroup should be able to steal from unprotected siblings. This only works if we restrict the protection calculation to the subtree shared by evictor and evictee. Reviewed-by: Maarten Lankhorst <dev@lankhorst.se> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Natalie Vock <natalie.vock@gmx.de> Link: https://patch.msgid.link/20260804-dmemcg-aggressive-protect-v8-6-07af96681bf8@gmx.de
2026-08-05drm/ttm: Be more aggressive when allocating below protection limitNatalie Vock1-3/+50
When the cgroup's memory usage is below the low/min limit and allocation fails, try evicting some unprotected buffers to make space. Otherwise, application buffers may be forced to go into GTT even though usage is below the corresponding low/min limit, if other applications filled VRAM with their allocations first. Reviewed-by: Maarten Lankhorst <dev@lankhorst.se> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Natalie Vock <natalie.vock@gmx.de> Link: https://patch.msgid.link/20260804-dmemcg-aggressive-protect-v8-5-07af96681bf8@gmx.de
2026-08-05drm/ttm: Split cgroup charge and resource allocationNatalie Vock2-27/+81
Coupling resource allocation and cgroup charging is racy when charging succeeds, but subsequent resource allocation fails. Certain eviction decisions are made on the basis of whether the allocating cgroup is protected, i.e. within its min/low limits, but with the charge being tied to resource allocation (and uncharged when the resource allocation fails), this check is done at a point where the allocation is not actually charged to the cgroup. This is subtly wrong if the allocation were to cause the cgroup to exceed the min/low protection, but it's even more wrong if the same cgroup tries allocating multiple buffers concurrently: In this case, the min/low protection may pass for all allocation attempts when the real min/low protection covers only some, or potentially none of the allocated buffers. Instead, charge the allocation to the cgroup once and keep the charge for as long as we try to allocate a ttm_resource, and only undo the charge if allocating the resource is ultimately unsuccessful and we move on to a different ttm_place. Reviewed-by: Maarten Lankhorst <dev@lankhorst.se> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Natalie Vock <natalie.vock@gmx.de> Link: https://patch.msgid.link/20260804-dmemcg-aggressive-protect-v8-4-07af96681bf8@gmx.de
2026-08-05drm/ttm: Extract code for attempting allocation in a placeNatalie Vock1-22/+68
Move all code for attempting allocation for a specific place to ttm_bo_alloc_place. With subsequent patches, this logic is going to get more complicated, so it helps readability to have this separate. ttm_bo_alloc_at_place takes a pointer to a struct ttm_bo_alloc_state. This struct holds various state produced by the allocation (e.g. cgroup resource associated with the allocation) that the caller needs to keep track of (and potentially dispose of). This is just the limiting cgroup pool for now, but future patches will add more state needing to be tracked. ttm_bo_alloc_at_place also communicates via return codes if eviction using ttm_bo_evict_alloc should be attempted. This is preparation for attempting eviction in more cases than just force_space being set. No functional change intended. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Maarten Lankhorst <dev@lankhorst.se> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Natalie Vock <natalie.vock@gmx.de> Link: https://patch.msgid.link/20260804-dmemcg-aggressive-protect-v8-3-07af96681bf8@gmx.de
2026-08-05drm/bridge: remove unneeded 'fast_io' parameter in regmap_configWolfram Sang2-2/+0
When using MMIO with regmap, fast_io is implied. No need to set it again. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Link: https://patch.msgid.link/20260705163536.1850-6-wsa+renesas@sang-engineering.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
2026-08-05gpu: nova-core: pass WPR metadata ownership to FmcBootArgsEliot Courtney2-5/+5
`FmcBootArgs` logically owns this, so pass ownership to it instead of storing a reference. Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260804-blackwell-fixes-v4-5-ac858b6a1935@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
2026-08-05gpu: nova-core: split FbLayout into FSP and non-FSP versionsEliot Courtney7-90/+170
`FbLayout` is currently used for both pre and post FSP architectures. It contains ranges for each region of framebuffer, but on post FSP architectures, only the size is actually used. The region locations are decided by ACR, which runs as part of the GSP-FMC, not by the driver. The driver only provides the sizes. So, for post FSP architectures `FbLayout` contains essentially guesses for the offsets. Instead, make separate types so that we only store the information that's actually needed, rather than keeping around offsets that may not be correct. Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260804-blackwell-fixes-v4-4-ac858b6a1935@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
2026-08-05gpu: nova-core: return non-WPR heap size as u64 from HALsEliot Courtney8-13/+13
This is always immediately widened to u64, so just return it as a u64 from the beginning. Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260804-blackwell-fixes-v4-3-ac858b6a1935@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
2026-08-05gpu: nova-core: rename heap size fieldEliot Courtney2-8/+8
This field is called non_wpr_heap_size everywhere else. Unify the name to make it more obvious which heap it is. Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260804-blackwell-fixes-v4-2-ac858b6a1935@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
2026-08-05gpu: nova-core: correct FRTS vidmem offset calculationEliot Courtney7-10/+48
Currently, the frts vidmem offset is calculated based on the non-wpr heap size and pmu reservation size, but this is not right. The layout actually looks like this: | non-wpr heap | WPR2 .. FRTS | PMU reserved | ... | VGA workspace | It's just by coincidence + generous alignment that the values happened to match. Instead, define a per-architecture reserved size at the end of the framebuffer and use this plus the PMU reserved size to calculate the frts vidmem offset. Fixes: d317e4585fa3 ("gpu: nova-core: Hopper/Blackwell: add FSP Chain of Trust boot") Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260804-blackwell-fixes-v4-1-ac858b6a1935@nvidia.com [acourbot: add comment clarifying reason for testing pmu_reserved_size.] [acourbot: make fb_end_reserved_size() return u64.] Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
2026-08-04Input: synaptics_i2c - return 0 explicitly on successSang-Heon Jeon1-1/+1
error is always zero at the last return in synaptics_i2c_reg_set(). Explicitly return 0 on the success path instead of returning error, which is the preferred way when there are multiple failure points. No functional change. Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com> Link: https://patch.msgid.link/20260729171001.260698-4-ekffu200098@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-08-04Input: rmi_smbus - remove conditional return with no effectSang-Heon Jeon1-6/+1
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly. This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci. Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com> Link: https://patch.msgid.link/20260729171001.260698-3-ekffu200098@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-08-04Input: pmic8xxx-keypad - remove conditional return with no effectSang-Heon Jeon1-7/+1
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly. This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci. Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com> Link: https://patch.msgid.link/20260729171001.260698-2-ekffu200098@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-08-04Input: synaptics-rmi4 - block s_input when F54 queue is busyDmitry Torokhov1-1/+6
Changing the input (diagnostic report type) mid-stream changes the report size. Since V4L2 buffers are allocated based on the size at stream start, changing the input while streaming could lead to a heap buffer overflow if the new size is larger than the allocated buffers. Prevent this by blocking VIDIOC_S_INPUT with -EBUSY if the V4L2 queue is busy (streaming). Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics") Cc: stable@vger.kernel.org Assisted-by: Antigravity:gemini-3.5-flash Reviewed-by: Hans Verkuil <hverkuil+cisco@kernel.org> Link: https://patch.msgid.link/20260626051802.4033172-5-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-08-04Input: synaptics-rmi4 - bound the F54 report size to the allocated bufferBryam Vargas1-2/+10
rmi_f54_work() reads a diagnostics report from the device into f54->report_data, sizing the transfer with rmi_f54_get_report_size(): report_size = rmi_f54_get_report_size(f54); ... for (i = 0; i < report_size; i += F54_REPORT_DATA_SIZE) { int size = min(F54_REPORT_DATA_SIZE, report_size - i); ... rmi_read_block(.., f54->report_data + i, size); } report_data is allocated once at probe from F54's own electrode counts (array3_size(f54->num_tx_electrodes, f54->num_rx_electrodes, sizeof(u16))), but rmi_f54_get_report_size() computes the size from drv_data->num_*_electrodes when those are set, i.e. from the F55 function's electrode counts. Both counts come straight from device queries (F54 and F55 each report up to 255 electrodes) and nothing constrains the F55 counts to the F54 ones. A malicious or malfunctioning RMI4 device that reports larger F55 electrode counts than its F54 counts makes report_size exceed the allocation, so the read loop writes past report_data (and the V4L2 dequeue memcpy() then reads past it). On conforming hardware the F55 configured electrodes are a subset of the F54 physical electrodes, so report_size never exceeds the buffer and well-behaved devices are unaffected. Record the allocation size and reject a report that does not fit, mirroring the existing zero-size check. Fixes: c762cc68b6a1 ("Input: synaptics-rmi4 - propagate correct number of rx and tx electrodes to F54") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me> Assisted-by: Antigravity:gemini-3.5-flash Link: https://patch.msgid.link/20260626051802.4033172-3-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-08-04Input: synaptics-rmi4 - zero report size on F54 work errorDmitry Torokhov1-8/+8
In rmi_f54_work(), if an error occurs during report request or command verification, the code jumped directly to the 'error' label, bypassing the 'abort' label where f54->report_size was normally zeroed out. This left f54->report_size containing its previous successful payload size. If a user then altered the V4L2 format to a smaller size, and a subsequent run failed, rmi_f54_buffer_queue() would copy the stale, larger payload size into the shrunken V4L2 buffer, causing a heap buffer overflow. Fix this by merging the 'abort' and 'error' labels into a single 'out' exit path, and ensuring that f54->report_size is always set to 0 on failure by checking for error and zeroing the local report_size first. Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics") Cc: stable@vger.kernel.org Reported-by: sashiko-bot@kernel.org Assisted-by: Antigravity:gemini-3.5-flash Link: https://patch.msgid.link/20260626051802.4033172-2-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-08-04Input: synaptics-rmi4 - fix F55 transmitter electrode count typoDmitry Torokhov1-2/+2
During F55 sensor detection, the transmitter (TX) electrode count was incorrectly assigned the value of the receiver (RX) electrode count due to copy-paste typos. This incorrect value was then propagated to the driver data and used by F54 to determine the diagnostics report size. On devices with more RX than TX electrodes, this inflated the perceived TX count, leading to incorrect report size calculations and potential out-of-bounds buffer accesses. Fix the typos by correctly assigning the TX electrode counts. Fixes: 6adba43fd222 ("Input: synaptics-rmi4 - add support for F55 sensor tuning") Fixes: c762cc68b6a1 ("Input: synaptics-rmi4 - propagate correct number of rx and tx electrodes to F54") Reported-by: sashiko-bot@kernel.org Cc: stable@vger.kernel.org Assisted-by: Antigravity:gemini-3.5-flash Link: https://patch.msgid.link/20260626051802.4033172-1-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>