7.3.6-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 944/2651 ASoC: amd: acp3x-es83xx: Keep an owned codec device reference
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yibo Tan <[email protected]>
[ Upstream commit 095025078dc3a1b4f0fcdc8b8d9dcb4d192a2a14 ]
acpi_get_first_physical_node() returns a borrowed device pointer. The private data allocation failure path in acp3x_es83xx_probe() puts that pointer despite not owning a reference. The successful path also saves the borrowed pointer for later card operations.
This was reproduced on current mainline with failslab restricted to the real static callback. The rejected devm_kzalloc() returned -ENOMEM, and normal codec platform-device unregister then produced a KASAN slab-use-after-free in device_del(), with allocation in acpi_create_platform_device() and release in acpi_unbind_one().
Use acpi_bus_get_primary_device() to acquire the reference while the physical-node lock is held. After allocating private data, register a devres put action before publishing the pointer. This balances action allocation and later probe failures, keeps the saved pointer alive during card use, and drops the reference after ASoC card unregister during successful teardown. The existing OOM put now correctly balances the owned lookup.
The same filtered KASAN guest with this change reached the same -ENOMEM and unregister path without KASAN, WARNING, Oops or panic. The test directly invoked the production callback and did not emulate a complete ACP/ASoC card or physical Huawei hardware.
--- sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +12 -0
@@ -10,6 +10,7 @@#include <sound/soc-dapm.h> #include <sound/jack.h> #include <sound/soc-acpi.h> +#include <acpi/acpi_bus.h> #include <linux/clk.h> #include <linux/gpio/consumer.h> #include <linux/module.h>
@@ -41,6 +42,11 @@ struct acp3x_es83xx_private {struct snd_soc_dapm_route mic_map[2 ]; }; +static void acp3x_es83xx_put_codec_device (void *data) +{ +put_device (data); +} +static const unsigned int channels[] = {DUAL_CHANNEL , };
@@ -441,6 +447,12 @@ static int acp3x_es83xx_probe(struct snd_soc_card *card)return -ENOMEM ; } + ret =devm_add_action_or_reset (dev, + acp3x_es83xx_put_codec_device, + codec_dev); +if (ret) +return ret; + priv->codec_dev = codec_dev; priv->quirk = (unsigned long )dmi_id->driver_data; acp_drvdata->mach_priv = priv;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 945/2651 ALSA: oxygen: use helper to activate the SPDIF PCM control
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit 5bdc232c3094304a7e17df5ddb66dcdacbead6bf ]
oxygen_open() and oxygen_close() modify the SPDIF PCM control access flags while holding chip->mutex. Direct access changes bypass the control core locking and notification path.
Move the access transition outside the driver mutex and use snd_ctl_activate_id(), which serializes the control update with the control core.
--- sound/pci/oxygen/oxygen_pcm.c | 37 +++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
sound/pci/oxygen/oxygen_pcm.c +16 -21
@@ -171,16 +171,14 @@ static int oxygen_open(struct snd_pcm_substream *substream,snd_pcm_set_sync (substream); chip->streams[channel] = substream; -guard (mutex)(&chip->mutex); - chip->pcm_active |=1 << channel; -if (channel ==PCM_SPDIF ) { - chip->spdif_pcm_bits = chip->spdif_bits; - chip->controls[CONTROL_SPDIF_PCM ]->vd[0 ].access &= - ~SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_VALUE | -SNDRV_CTL_EVENT_MASK_INFO , - &chip->controls[CONTROL_SPDIF_PCM ]->id); + scoped_guard(mutex, &chip->mutex) { + chip->pcm_active |=1 << channel; +if (channel ==PCM_SPDIF ) + chip->spdif_pcm_bits = chip->spdif_bits; } +if (channel ==PCM_SPDIF ) +snd_ctl_activate_id (chip->card, + &chip->controls[CONTROL_SPDIF_PCM ]->id,1 );return 0 ; }
@@ -220,19 +218,16 @@ static int oxygen_close(struct snd_pcm_substream *substream)struct oxygen *chip =snd_pcm_substream_chip (substream);unsigned int channel =oxygen_substream_channel (substream); -guard (mutex)(&chip->mutex); - chip->pcm_active &= ~(1 << channel); -if (channel ==PCM_SPDIF ) { - chip->controls[CONTROL_SPDIF_PCM ]->vd[0 ].access |= -SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_VALUE | -SNDRV_CTL_EVENT_MASK_INFO , - &chip->controls[CONTROL_SPDIF_PCM ]->id); - } -if (channel ==PCM_SPDIF || channel ==PCM_MULTICH ) -oxygen_update_spdif_source (chip); + scoped_guard(mutex, &chip->mutex) { + chip->pcm_active &= ~(1 << channel); +if (channel ==PCM_SPDIF || channel ==PCM_MULTICH ) +oxygen_update_spdif_source (chip); - chip->streams[channel] =NULL ; + chip->streams[channel] =NULL ; + } +if (channel ==PCM_SPDIF ) +snd_ctl_activate_id (chip->card, + &chip->controls[CONTROL_SPDIF_PCM ]->id,0 );return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 946/2651 ALSA: via82xx: use helper to activate DXS controls
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit aee7c43126e3184d7eefde6545b3b88628e5591a ]
The VIA DXS playback callbacks modify control access flags directly when a stream opens or closes. This bypasses the control core locking and notification path.
Use snd_ctl_activate_id() for both transitions so access changes are serialized by the control core and reported with the expected info event.
--- sound/pci/via82xx.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
sound/pci/via82xx.c +2 -9
@@ -1242,11 +1242,7 @@ static int snd_via8233_playback_open(struct snd_pcm_substream *substream)VIA_DXS_MAX_VOLUME - (dxs_init_volume &31 ); chip->playback_volume[stream][1 ] =VIA_DXS_MAX_VOLUME - (dxs_init_volume &31 ); - chip->dxs_controls[stream]->vd[0 ].access &= - ~SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_VALUE | -SNDRV_CTL_EVENT_MASK_INFO , - &chip->dxs_controls[stream]->id); +snd_ctl_activate_id (chip->card, &chip->dxs_controls[stream]->id,1 ); }return 0 ; }
@@ -1333,10 +1329,7 @@ static int snd_via8233_playback_close(struct snd_pcm_substream *substream) stream = viadev->reg_offset /0x10 ;if (chip->dxs_controls[stream]) { - chip->dxs_controls[stream]->vd[0 ].access |= -SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_INFO , - &chip->dxs_controls[stream]->id); +snd_ctl_activate_id (chip->card, &chip->dxs_controls[stream]->id,0 ); }return snd_via82xx_pcm_close (substream); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 947/2651 drm/exynos/fimd: fix register offset type in fimd_trigger()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit f901c9b986b6355716822d5c6ad34ae5edd71085 ]
Sparse reports:
exynos_drm_fimd.c:992:39: warning: incorrect type in initializer (different address spaces)
exynos_drm_fimd.c:992:39: expected void *timing_base
exynos_drm_fimd.c:992:39: got void [noderef] __iomem *
exynos_drm_fimd.c:1005:33: warning: incorrect type in argument 1 (different address spaces)
exynos_drm_fimd.c:1005:33: expected void const volatile [noderef] __iomem *addr
exynos_drm_fimd.c:1005:33: got void *
exynos_drm_fimd.c:1007:33: warning: incorrect type in argument 2 (different address spaces)
exynos_drm_fimd.c:1007:33: expected void volatile [noderef] __iomem *addr
exynos_drm_fimd.c:1007:33: got void *
Add "__iomem" to *timing_base to fix its type.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -989,7 +989,7 @@ static void fimd_trigger(struct device *dev) {struct fimd_context *ctx =dev_get_drvdata (dev);const struct fimd_driver_data *driver_data = ctx->driver_data; -void *timing_base = ctx->regs + driver_data->timing_base; +void __iomem *timing_base = ctx->regs + driver_data->timing_base;u32 reg;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 948/2651 of/irq: Fix device node refcount leak in of_check_msi_parent()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <[email protected]>
[ Upstream commit cbe0f79dcab1c121d767927b53a61eadf2c5b518 ]
of_msi_xlate() documents @msi_np as a filter when it points at a node on entry, handing back a reference only when it points at NULL. The msi-map branch does that. of_check_msi_parent() keeps the reference from the 1:1 msi-parent match either way.
pci_msi_domain_get_msi_rid() is the only caller that passes a node in, from irq_domain_get_of_node(), and it puts nothing, so a 1:1 match there leaks the MSI controller node.
--- drivers/of/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/irq.c +1 -1
@@ -787,7 +787,7 @@ static int of_check_msi_parent(struct device_node *dev_node, struct device_nodeif ((*msi_node && *msi_node != msi_spec.np) || msi_spec.args_count !=0 ) ret = -EINVAL ; -if (!ret) { +if (!ret && !*msi_node) {/* Return with a node reference held */ *msi_node = msi_spec.np;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 949/2651 rust: configfs: require thread-safe callback data
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yilin Chen <[email protected]>
[ Upstream commit ec27f3b700010d2ebae1cde2df0246197689d159 ]
The Rust configfs abstractions do not fully constrain callback data for cross-thread use. Add the missing Send and Sync requirements.
Specifically, make the following changes:
1. Require Data: Send when implementing Send for Subsystem<Data>, since the subsystem stores its data by value.
2. Make GroupOperations a Sync supertrait because make_group and drop_item receive &self from foreign threads. Require Child: Send because configfs may release child groups on an arbitrary thread.
3. Require AttributeOperations::Data: Sync because its callbacks receive &Data from foreign threads.
4. Update the safety comments in FFI callbacks that call get_group_data to cite these bounds as justification for sharing the returned references with the callback thread.
5. Remove redundant Child: 'static bounds from GroupOperationsVTable and new_with_child_ctor.
[ Andreas: Add Send/Sync bounds for Group<Data>, add Send bounds to GroupOperationsVTable, ItemOperationsVTable and ItemType macro implementation. ]
--- rust/kernel/configfs.rs | 63 ++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 19 deletions(-)
rust/kernel/configfs.rs +44 -19
@@ -135,8 +135,9 @@ pub struct Subsystem<Data> {// SAFETY: We do not provide any operations on `Subsystem`. unsafe impl <Data >Sync for Subsystem <Data > {} -// SAFETY: Ownership of `Subsystem` can safely be transferred to other threads. -unsafe impl <Data >Send for Subsystem <Data > {} +// SAFETY: Ownership of `Subsystem` can safely be transferred to other threads +// if its data can be transferred as well. +unsafe impl <Data :Send >Send for Subsystem <Data > {}impl <Data >Subsystem <Data > {/// Create an initializer for a [`Subsystem`].
@@ -249,6 +250,13 @@ pub struct Group<Data> { data: Data, } +// SAFETY: We do not provide any operations on `Group`. +unsafe impl <Data >Sync for Group <Data > {} + +// SAFETY: Ownership of `Group` can safely be transferred to other threads if +// its data can be transferred as well. +unsafe impl <Data :Send >Send for Group <Data > {} +impl <Data >Group <Data > {/// Create an initializer for a new group. ///
@@ -338,7 +346,9 @@ unsafe fn get_group_data<'a, Parent>(this: *mut bindings::config_group) -> &'a Pimpl <Parent ,Child >GroupOperationsVTable <Parent ,Child >where Parent :GroupOperations <Child =Child >, -Child : 'static, +// We transfer `Arc<Group<Data>>` across a thread boundary in `make_group` +// and `drop_item`. +Arc <Group <Child >>:Send , {/// # Safety ///
@@ -357,8 +367,9 @@ impl<Parent, Child> GroupOperationsVTable<Parent, Child> this: *mut bindings::config_group, name: *const kernel::ffi::c_char, ) -> *mut bindings::config_group { - // SAFETY: By function safety requirements of this function, this call - // is safe. + // SAFETY: By function safety requirements, `this` points to a configfs + // group containing `Parent`. The `GroupOperations` bound guarantees + // that `Parent: Sync`, so it is safe to share it with this thread. let parent_data = unsafe { get_group_data(this) }; let group_init = match Parent::make_group(
@@ -403,8 +414,9 @@ impl<Parent, Child> GroupOperationsVTable<Parent, Child> this: *mut bindings::config_group, item: *mut bindings::config_item, ) { -// SAFETY: By function safety requirements of this function, this call -// is safe. +// SAFETY: By function safety requirements, `this` points to a configfs +// group containing `Parent`. The `GroupOperations` bound guarantees +// that `Parent: Sync`, so it is safe to share it with this thread. let parent_data =unsafe {get_group_data (this) };// SAFETY: By function safety requirements, `item` is embedded in a
@@ -416,7 +428,9 @@ impl<Parent, Child> GroupOperationsVTable<Parent, Child>if Parent ::HAS_DROP_ITEM {// SAFETY: We called `into_raw` to produce `r_child_group_ptr` in -// `make_group`. +// `make_group`. This function may be executing on a different +// thread than `into_raw`. As `Arc<Group<Child>>: Send` this +// ownership transfer is safe. let arc:Arc <Group <Child >> =unsafe {Arc ::from_raw (r_child_group_ptr.cast_mut ()) };Parent ::drop_item (parent_data, arc.as_arc_borrow ());
@@ -447,6 +461,8 @@ const fn vtable_ptr() -> *const bindings::configfs_group_operations {impl <Data >ItemOperationsVTable <Group <Data >,Data >where Data : 'static, +// We transfer `Arc<Group<Data>>` across a thread boundary in `release`. +Arc <Group <Data >>:Send , {/// # Safety ///
@@ -463,8 +479,9 @@ impl<Data> ItemOperationsVTable<Group<Data>, Data>// embedded within a `Group<Data>`. let r_group_ptr =unsafe {Group ::<Data >::container_of (c_group_ptr) }; -// SAFETY: We called `into_raw` on `r_group_ptr` in -// `make_group`. +// SAFETY: We called `into_raw` on `r_group_ptr` in `make_group`. This +// function may be running on a different thread than the thread that +// called `into_raw`. As `Arc<Group<Data>>: Send`, this is safe. let pin_self:Arc <Group <Data >> =unsafe {Arc ::from_raw (r_group_ptr.cast_mut ()) };drop (pin_self); }
@@ -496,12 +513,12 @@ const fn vtable_ptr() -> *const bindings::configfs_item_operations {/// /// Implement this trait on structs that embed a [`Subsystem`] or a [`Group`]. #[vtable] -pub trait GroupOperations { +pub trait GroupOperations :Sync {/// The child data object type. /// /// This group will create subgroups (subdirectories) backed by this kind of /// object. -type Child : 'static; +type Child : 'static +Send ;/// Creates a new subgroup. ///
@@ -568,8 +585,10 @@ impl<const ID: u64, O, Data> Attribute<ID, O, Data>// `config_group`. unsafe {container_of! (item, bindings::config_group, cg_item) }; -// SAFETY: The function safety requirements for this function satisfy -// the conditions for this call. +// SAFETY: By function safety requirements, `c_group` points to a +// configfs group containing `Data`. The `AttributeOperations` bound +// guarantees that `Data: Sync`, so it is safe to share it with this +// thread. let data: &Data =unsafe {get_group_data (c_group) };// SAFETY: By function safety requirements, `page` is writable for `PAGE_SIZE`.
@@ -602,8 +621,10 @@ impl<const ID: u64, O, Data> Attribute<ID, O, Data>// `config_group`. unsafe {container_of! (item, bindings::config_group, cg_item) }; -// SAFETY: The function safety requirements for this function satisfy -// the conditions for this call. +// SAFETY: By function safety requirements, `c_group` points to a +// configfs group containing `Data`. The `AttributeOperations` bound +// guarantees that `Data: Sync`, so it is safe to share it with this +// thread. let data: &Data =unsafe {get_group_data (c_group) }; let ret = O::store(
@@ -656,7 +677,7 @@ pub const fn new(name: &'static CStr) -> Self {pub trait AttributeOperations <const ID :u64 =0 > {/// The type of the object that contains the field that is backing the /// attribute for this operation. -type Data ; +type Data :Sync ;/// Renders the value of an attribute. ///
@@ -762,7 +783,8 @@ pub const fn new_with_child_ctor<const N: usize, Child>( ) -> Selfwhere Data :GroupOperations <Child =Child >, -Child : 'static, +Arc <Group <Child >>:Send , +Arc <Group <Data >>:Send , {Self { item_type:Opaque ::new (bindings::config_item_type {
@@ -780,7 +802,10 @@ pub const fn new_with_child_ctor<const N: usize, Child>(pub const fn new <const N :usize >( owner: &'staticThisModule , attributes: &'staticAttributeList <N ,Data >, - ) ->Self { + ) ->Self +where +Arc <Group <Data >>:Send , + {Self { item_type:Opaque ::new (bindings::config_item_type { ct_owner: owner.as_ptr (),
Signature · 1 line
2.53.0
Re: [PATCH 7.3 0949/2651] rust: configfs: require thread-safe callback data
Quoted 13 lines · Greg Kroah-Hartman
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yilin Chen <[email protected]>
[ Upstream commit
ec27f3b700010d2ebae1cde2df0246197689d159]The Rust configfs abstractions do not fully constrain callback data for cross-thread use. Add the missing
SendandSyncrequirements.Specifically, make the following changes:
Quoted 12 lines
1. Require
Data: Sendwhen implementingSendforSubsystem<Data>, since the subsystem stores its data by value.
2. MakeGroupOperationsaSyncsupertrait becausemake_groupanddrop_itemreceive&selffrom foreign threads. RequireChild: Sendbecause configfs may release child groups on an arbitrary thread.
3. RequireAttributeOperations::Data: Syncbecause its callbacks receive&Datafrom foreign threads.
4. Update the safety comments in FFI callbacks that callget_group_datato cite these bounds as justification for sharing the returned references with the callback thread.
5. Remove redundantChild: 'staticbounds fromGroupOperationsVTableandnew_with_child_ctor.
This errors out too:
[ 494s] error[E0277]: `UnsafeCell<MaybeUninit<blk_mq_tag_set>>` cannot be shared between threads safely [ 494s] --> ../drivers/block/rnull/configfs.rs:45:18 [ 494s] | [ 494s] 45 | type Child = DeviceConfig; [ 494s] | ^^^^^^^^^^^^ `UnsafeCell<MaybeUninit<blk_mq_tag_set>>` cannot be shared between threads safely [ 494s] | [ 494s] = help: within `TagSet<NullBlkDevice>`, the trait `Sync` is not implemented for `UnsafeCell<MaybeUninit<blk_mq_tag_set>>` [ 494s] note: required because it appears within the type `Opaque<blk_mq_tag_set>` [ 494s] --> ../rust/kernel/types.rs:332:12
Quoted 10 lines
Fixes 446cafc295bf ("rust: configfs: introduce rust support for configfs")Assisted-by Gpt-5.6 SolSigned-off-by Yilin Chen <[email protected]>[ Andreas: Add Send/Sync bounds for
Group<Data>, addSendbounds toGroupOperationsVTable,ItemOperationsVTableandItemTypemacro implementation. ]Signed-off-by Andreas Hindborg <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Signature · 2 lines
js suse labs
Re: [PATCH 7.3 0949/2651] rust: configfs: require thread-safe callback data
Quoted 2 lines
Quoted 1 line
This errors out too:
[ 494s] error[E0277]:
UnsafeCell<MaybeUninit<blk_mq_tag_set>>cannot be shared between threads safely
Queued the missing prerequisite for 7.3 and 6.18, thanks.
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 950/2651 dt-bindings: iio: adc: renesas,r9a09g077-adc: Drop unwired interrupts
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 1182148719cffb5ea7a4610dac34deac9a70cf89 ]
Remove the compare match and compare mismatch interrupts from the binding, as these interrupts are not wired to the GIC on RZ/T2H and RZ/N2H SoCs according to the hardware manual Rev. 1.30.
While this change introduces an ABI break, the expected impact on existing users is minimal, if any, since the interrupts are not wired to the GIC and are not used by the driver.
--- .../bindings/iio/adc/renesas,r9a09g077-adc.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/iio/adc/renesas,r9a09g077-adc.yaml +2 -8
@@ -34,8 +34,6 @@ properties: - description: A/D scan end interrupt for Group C - description: Window A compare match - description: Window B compare match - - description: Compare match - - description: Compare mismatch interrupt-names: items:
@@ -44,8 +42,6 @@ properties: - const: gcadi - const: cmpai - const: cmpbi - - const: wcmpm - - const: wcmpum clocks: items:
@@ -107,11 +103,9 @@ examples: <GIC_SPI 709 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 710 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 711 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 712 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 855 IRQ_TYPE_EDGE_RISING>, - <GIC_SPI 856 IRQ_TYPE_EDGE_RISING>; + <GIC_SPI 712 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "adi", "gbadi", "gcadi", - "cmpai", "cmpbi", "wcmpm", "wcmpum"; + "cmpai", "cmpbi"; clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>, <&cpg CPG_MOD 225>; clock-names = "adclk", "pclk";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 951/2651 iio: dac: mcp47feb02: protect EEPROM store sequence with mutex
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ariana Lazar <[email protected]>
[ Upstream commit 55b0514c2863d01e9b168d8a6ad0040d628fb534 ]
Move the mutex lock into store_eeprom_store() to prevent race conditions when reading volatile registers and writing them to the EEPROM.
--- drivers/iio/dac/mcp47feb02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/mcp47feb02.c +2 -2
@@ -442,8 +442,6 @@ static int mcp47feb02_write_to_eeprom(struct mcp47feb02_data *data, unsigned int* Wait until the currently occurring EEPROM Write Cycle is completed. * Only serial commands to the volatile memory are allowed. */ -guard (mutex)(&data->lock); - ret = regmap_read_poll_timeout(data->regmap, MCP47FEB02_GAIN_CTRL_STATUS_REG_ADDR, eewa_val, !(eewa_val & MCP47FEB02_GAIN_BIT_STATUS_EEWA_MASK),
@@ -469,6 +467,8 @@ static ssize_t store_eeprom_store(struct device *dev, struct device_attribute *aif (!state)return len; +guard (mutex)(&data->lock); +/* * Verify DAC Wiper and DAC Configuration are unlocked. If both are disabled, * writing to EEPROM is available.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 952/2651 staging: iio: adc: ad7816: Sort headers alphabetically
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdelnasser Hussein <[email protected]>
[ Upstream commit 8c7b99ff159d64679c9b3b4d5878e44459f7272a ]
Sort the include directives alphabetically to improve readability and maintainability. This is a precursor cleanup patch to prepare for the addition of new headers in subsequent changes.
Stable-dep-of: b96187644664 ("staging: iio: adc: ad7816: Protect sysfs attributes with mutex")
--- drivers/staging/iio/adc/ad7816.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/iio/adc/ad7816.c +6 -6
@@ -5,19 +5,19 @@* Copyright 2010 Analog Devices Inc. */ -#include <linux/interrupt.h> -#include <linux/gpio/consumer.h> #include <linux/device.h> +#include <linux/gpio/consumer.h> +#include <linux/interrupt.h> #include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/sysfs.h> #include <linux/list.h> -#include <linux/spi/spi.h> #include <linux/module.h> +#include <linux/slab.h> +#include <linux/spi/spi.h> +#include <linux/sysfs.h> +#include <linux/iio/events.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> -#include <linux/iio/events.h> /* * AD7816 config masks
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 953/2651 staging: iio: adc: ad7816: Serialize SPI operations
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdelnasser Hussein <[email protected]>
[ Upstream commit 8f99c766605a484663764b52da56a0b160f9d9c3 ]
The ad7816_spi_read() and ad7816_spi_write() functions perform a sequence of GPIO state changes followed by an SPI transfer. If multiple operations occur simultaneously, the GPIO state could be changed by one thread while another is in the middle of a transfer, leading to a race condition.
Introduce a mutex to serialize the operations, ensuring that the GPIO toggling and the SPI transfer are treated as a single atomic operation. The mutex is placed right after the pointers in the device state structure to avoid padding holes.
Stable-dep-of: b96187644664 ("staging: iio: adc: ad7816: Protect sysfs attributes with mutex")
--- drivers/staging/iio/adc/ad7816.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/staging/iio/adc/ad7816.c +11 -0
@@ -5,12 +5,14 @@* Copyright 2010 Analog Devices Inc. */ +#include <linux/cleanup.h> #include <linux/device.h> #include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/slab.h> #include <linux/spi/spi.h> #include <linux/sysfs.h>
@@ -47,6 +49,7 @@ struct ad7816_chip_info {struct gpio_desc *rdwr_pin;struct gpio_desc *convert_pin;struct gpio_desc *busy_pin; +struct mutex lock;/* protect device state during SPI transfers */ u8 oti_data[AD7816_CS_MAX +1 ];u8 channel_id;/* 0 always be temperature */ u8 mode;
@@ -67,6 +70,8 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)int ret;__be16 buf; +guard (mutex)(&chip->lock); +gpiod_set_value (chip->rdwr_pin,1 );gpiod_set_value (chip->rdwr_pin,0 ); ret =spi_write_then_read (spi_dev, &chip->channel_id,sizeof (chip->channel_id),NULL ,0 );
@@ -107,6 +112,8 @@ static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data)struct spi_device *spi_dev = chip->spi_dev;int ret; +guard (mutex)(&chip->lock); +gpiod_set_value (chip->rdwr_pin,1 );gpiod_set_value (chip->rdwr_pin,0 ); ret =spi_write_then_read (spi_dev, &data,sizeof (data),NULL ,0 );
@@ -360,6 +367,10 @@ static int ad7816_probe(struct spi_device *spi_dev)return -ENOMEM ; chip =iio_priv (indio_dev); + ret =devm_mutex_init (&spi_dev->dev, &chip->lock); +if (ret) +return ret; + chip->spi_dev = spi_dev;for (i =0 ; i <=AD7816_CS_MAX ; i++) chip->oti_data[i] =203 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 954/2651 staging: iio: adc: ad7816: Protect sysfs attributes with mutex
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdelnasser Hussein <[email protected]>
[ Upstream commit b96187644664d10b641dddeb7ca2eeef97a77c41 ]
The sysfs store functions modify driver state that is critical during SPI transactions. ad7816_store_mode toggles hardware GPIO pins, while ad7816_store_channel updates the internal software state (chip->channel_id).
If these are modified concurrently by userspace while an SPI transfer is in progress, it could corrupt the hardware transaction or cause the driver to communicate with the wrong channel.
Add the existing chip->lock guard to these functions to serialize access and prevent these race conditions.
--- drivers/staging/iio/adc/ad7816.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/iio/adc/ad7816.c +4 -0
@@ -143,6 +143,8 @@ static ssize_t ad7816_store_mode(struct device *dev,struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad7816_chip_info *chip =iio_priv (indio_dev); +guard (mutex)(&chip->lock); +if (strcmp (buf,"full" ) ==0 ) {gpiod_set_value (chip->rdwr_pin,1 ); chip->mode =AD7816_FULL ;
@@ -207,6 +209,8 @@ static ssize_t ad7816_store_channel(struct device *dev,return -EINVAL ; } +guard (mutex)(&chip->lock); + chip->channel_id = data;return len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 955/2651 iio: dac: ad5758: Fix alignment for DMA safety
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arka Mondal <[email protected]>
[ Upstream commit 465bdce79a9fe140a4b46b95f6bdfd880d197148 ]
ad5758_spi_reg_read() reads into st->d32[2] with spi_sync_transfer(), but d32 is not marked __aligned(IIO_DMA_MINALIGN), so it can share a cacheline with the fields before it. When DMA is not cache coherent, the cache invalidation after the read can discard CPU writes to those fields.
Mark d32 __aligned(IIO_DMA_MINALIGN). It is the last member of the struct, so nothing comes after it.
--- drivers/iio/dac/ad5758.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5758.c +1 -1
@@ -117,7 +117,7 @@ struct ad5758_state {unsigned int dc_dc_ilim;unsigned int slew_time;bool pwr_down; -__be32 d32[3 ]; +__be32 d32[3 ]__aligned(IIO_DMA_MINALIGN) ; };/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 956/2651 iio: dac: ad5758: Reject out-of-range raw values
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arka Mondal <[email protected]>
[ Upstream commit ebc026be1b719e47bd7f2f1e72fabc875b590f87 ]
ad5758_write_raw() passes the value from userspace straight to ad5758_spi_reg_write(), which keeps only the low 16 bits. Writing -1 to the raw attribute gives full-scale output, and 65536 gives code 0.
Return -EINVAL for values outside 0 to U16_MAX, as ad5755 does.
--- drivers/iio/dac/ad5758.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/dac/ad5758.c +3 -0
@@ -556,6 +556,9 @@ static int ad5758_write_raw(struct iio_dev *indio_dev,switch (info) {case IIO_CHAN_INFO_RAW : +if (val <0 || val >U16_MAX ) +return -EINVAL ; +mutex_lock (&st->lock); ret =ad5758_spi_reg_write (st,AD5758_DAC_INPUT , val);mutex_unlock (&st->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 957/2651 iio: dac: ad5758: Fix the offset calculation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arka Mondal <[email protected]>
[ Upstream commit a3b3580713f3ac5a32dc2874ee546828977a1d68 ]
The offset is a count of DAC codes, so the microamp or microvolt units of min and max cancel out and the final division by 1000 is wrong. For the +-20 mA range the driver reports -32 instead of -32768. For the +-5 V and +-10 V ranges min * (1 << 16) also overflows int, and the reported offset is 0.
Drop the division and do the multiplication in 64 bits.
--- drivers/iio/dac/ad5758.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/dac/ad5758.c +2 -1
@@ -9,6 +9,7 @@#include <linux/bsearch.h> #include <linux/delay.h> #include <linux/kernel.h> +#include <linux/math64.h> #include <linux/module.h> #include <linux/property.h> #include <linux/spi/spi.h>
@@ -540,7 +541,7 @@ static int ad5758_read_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_OFFSET : min = st->out_range.min; max = st->out_range.max; - *val = ((min * (1 <<16 )) / (max - min)) /1000 ; + *val =div_s64 ((s64 )min * (1 <<16 ), max - min);return IIO_VAL_INT ;default :return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 958/2651 ALSA: caiaq: Serialize access to the EP1 command buffer
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niko Huuskonen <[email protected]>
[ Upstream commit a718fd03e1e00211cf4662f5ab82d33f4c18e2a7 ]
snd_usb_caiaq_send_command() and snd_usb_caiaq_send_command_bank() copy the command into cdev->ep1_out_buf and send it with a synchronous bulk transfer. Nothing serializes their callers. An ALSA control write, which sets the LEDs on the Kore controllers and several other devices, can run at the same time as a PCM prepare, which sends the audio parameters through the same buffer. One caller can then overwrite the buffer while the transfer of the other is still in flight, and the device receives a mix of both commands.
Protect the buffer with a mutex. All callers run in process context and already sleep in usb_bulk_msg().
The problem was found by code review while adding another user of the buffer, the Kore LCD support later in this series. It has not been observed or reproduced.
--- sound/usb/caiaq/device.c | 5 +++++ sound/usb/caiaq/device.h | 3 +++ 2 files changed, 8 insertions(+)
sound/usb/caiaq/device.c +5 -0
@@ -212,6 +212,8 @@ int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev,if (len >EP1_BUFSIZE -1 ) len =EP1_BUFSIZE -1 ; +guard (mutex)(&cdev->ep1_out_mutex); +if (buffer && len >0 )memcpy (cdev->ep1_out_buf+1 , buffer, len);
@@ -235,6 +237,8 @@ int snd_usb_caiaq_send_command_bank(struct snd_usb_caiaqdev *cdev,if (len >EP1_BUFSIZE -2 ) len =EP1_BUFSIZE -2 ; +guard (mutex)(&cdev->ep1_out_mutex); +if (buffer && len >0 )memcpy (cdev->ep1_out_buf+2 , buffer, len);
@@ -443,6 +447,7 @@ static int create_card(struct usb_device *usb_dev, cdev->chip.usb_id =USB_ID (le16_to_cpu (usb_dev->descriptor.idVendor),le16_to_cpu (usb_dev->descriptor.idProduct));spin_lock_init (&cdev->spinlock); +mutex_init (&cdev->ep1_out_mutex); *cardp = card;return 0 ;
sound/usb/caiaq/device.h +3 -0
@@ -2,6 +2,8 @@#ifndef CAIAQ_DEVICE_H #define CAIAQ_DEVICE_H +#include <linux/mutex.h> +#include "../usbaudio.h" #define USB_VID_NATIVEINSTRUMENTS 0x17cc
@@ -68,6 +70,7 @@ struct snd_usb_caiaqdev {unsigned char ep1_in_buf[EP1_BUFSIZE ];unsigned char ep1_out_buf[EP1_BUFSIZE ]; +struct mutex ep1_out_mutex;/* protects ep1_out_buf */ unsigned char midi_out_buf[EP1_BUFSIZE ];struct caiaq_device_spec spec;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 959/2651 ALSA: caiaq: Fix the Kore controller key map
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niko Huuskonen <[email protected]>
[ Upstream commit c0508fc6895137f9e2dd43c1a09cc834254cc149 ]
keycode_kore does not match the hardware in two places:
- Softkeys 5 to 8 are listed in reverse order, so pressing the fifth softkey reports BTN_8, the sixth BTN_7 and so on. Softkeys 1 to 4 are correct. The OpenKoreBridge project, which drives a Kore 2 through this driver, works around the same reversal in userspace.
- On the first Kore controller the touch sensors of the eight knobs are
scrambled: touching knob 1 reports KEY_BRL_DOT6, knob 2 KEY_BRL_DOT8, knob 3 KEY_BRL_DOT2, knob 6 KEY_BRL_DOT7, knob 7 KEY_BRL_DOT1 and knob 8 KEY_BRL_DOT3. Only knobs 4 and 5 are right.
Put the softkeys in order for both controllers, and give the first Kore controller its own touch sensor order, so that BTN_n and KEY_BRL_DOTn belong to the n-th knob. The touch sensor order of the Kore 2 is left alone, as it could not be checked.
Userspace that compensates for the old order needs to follow. It can read the key map with EVIOCGKEYCODE, which also makes it possible to support kernels with and without this change.
Tested on a Kore controller (USB ID 17cc:4711).
--- sound/usb/caiaq/input.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
sound/usb/caiaq/input.c +25 -4
@@ -41,11 +41,11 @@ static const unsigned short keycode_kore[] = {BTN_3 ,BTN_2 ,BTN_1 , -BTN_8 , -BTN_7 , -BTN_6 ,BTN_5 , -KEY_BRL_DOT4 ,/* touch sensitive knobs */ +BTN_6 , +BTN_7 , +BTN_8 , +KEY_BRL_DOT4 ,/* touch sensitive knobs (Kore 2 order) */ KEY_BRL_DOT3 ,KEY_BRL_DOT2 , KEY_BRL_DOT1,
@@ -55,6 +55,21 @@ static const unsigned short keycode_kore[] = { KEY_BRL_DOT5 }; +/* index of the first touch sensor in keycode_kore */ +#define KORE_TOUCH_KEYS 24 + +/* the first Kore controller reports its touch sensors in this order */ +static const unsigned short keycode_kore1_touch[] = { +KEY_BRL_DOT4 , +KEY_BRL_DOT8 , +KEY_BRL_DOT3 , +KEY_BRL_DOT7 , +KEY_BRL_DOT2 , +KEY_BRL_DOT6 , +KEY_BRL_DOT1 , +KEY_BRL_DOT5 +}; +#define MASCHINE_BUTTONS (42)#define MASCHINE_BUTTON (X ) ((X) + BTN_MISC)#define MASCHINE_PADS (16)
@@ -666,6 +681,12 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev) input->absbit[BIT_WORD (ABS_MISC )] |=BIT_MASK (ABS_MISC );BUILD_BUG_ON (sizeof (cdev->keycode) <sizeof (keycode_kore));memcpy (cdev->keycode, keycode_kore,sizeof (keycode_kore)); +BUILD_BUG_ON (KORE_TOUCH_KEYS +ARRAY_SIZE (keycode_kore1_touch) > +ARRAY_SIZE (keycode_kore)); +if (cdev->chip.usb_id == +USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_KORECONTROLLER )) +memcpy (cdev->keycode +KORE_TOUCH_KEYS , keycode_kore1_touch, +sizeof (keycode_kore1_touch)); input->keycodemax =ARRAY_SIZE (keycode_kore);input_set_abs_params (input,ABS_HAT0X ,0 ,999 ,0 ,10 );input_set_abs_params (input,ABS_HAT0Y ,0 ,999 ,0 ,10 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 960/2651 perf test: Record kcore for the CoreSight callchain test
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 5dd1a045e576323a10d0c7ca6dbc0f0b81ed9b5c ]
The CoreSight callchain test traces both userspace and kernel execution and checks the callchain across a syscall.
Add --kcore to perf record to save the running kernel image alongside the trace data so perf script can use it to decode the kernel trace. If kcore is not available, the test will be skipped.
Add a Fixes tag so the change can be backported to stable kernels and improve the test reliability.
--- tools/perf/tests/shell/coresight/callchain.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/tests/shell/coresight/callchain.sh +6 -1
@@ -30,6 +30,11 @@ skip_if_system_is_not_ready() return 2 } + [ -e /proc/kcore ] || { + echo "[Skip] /proc/kcore is not available" >&2 + return 2 + } + return 0 }
@@ -43,7 +48,7 @@ record_trace() mkfifo "$cf" "$af" - perf record -o "$data" -e cs_etm// --per-thread -D -1 --control fifo:"$cf","$af" -- \ + perf record --kcore -o "$data" -e cs_etm// --per-thread -D -1 --control fifo:"$cf","$af" -- \ perf test --record-ctl fifo:"$cf","$af" -w callchain >/dev/null 2>&1 && # It is safe to use 'i3i' with a three-instruction interval, since the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 961/2651 spi: rspi: Fix DMA mode when the DMA controller is built as a module
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit 7b85114d47f693b709b2e8e22e44cdf58c04b111 ]
On the Renesas RZ/G2L platform, the RSPI driver falls back to PIO mode instead of using DMA when the DMA controller driver is built as a module (CONFIG_RZ_DMAC=m):
renesas_spi 1004b000.spi: dma_request_slave_channel_compat failed renesas_spi 1004b000.spi: DMA not available, using PIO
The driver requests DMA channels through dma_request_slave_channel_compat() which returns either a valid pointer or NULL and cannot handle -EPROBE_DEFER. If the DMA controller has not probed yet, the driver falls back to PIO directly.
Fix this by replacing the dma_request_slave_channel_compat() call with a regular dma_request_chan() call. dma_request_slave_channel_compat() is always passed a NULL fn_param in all code paths, so it actually behaves like a plain dma_request_chan() call.
--- drivers/spi/spi-rspi.c | 49 ++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 30 deletions(-)
drivers/spi/spi-rspi.c +19 -30
@@ -22,7 +22,6 @@#include <linux/of.h> #include <linux/pm_runtime.h> #include <linux/reset.h> -#include <linux/sh_dma.h> #include <linux/spi/spi.h> #include <linux/spinlock.h>
@@ -1091,24 +1090,15 @@ static irqreturn_t rspi_irq_tx(int irq, void *_sr)static struct dma_chan *rspi_request_dma_chan (struct device *dev,enum dma_transfer_direction dir, -unsigned int id,dma_addr_t port_addr) { -dma_cap_mask_t mask;struct dma_chan *chan;struct dma_slave_config cfg;int ret; -dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - chan =dma_request_slave_channel_compat (mask, shdma_chan_filter, - (void *)(unsigned long )id, dev, - dir ==DMA_MEM_TO_DEV ?"tx" :"rx" ); -if (!chan) { -dev_warn (dev,"dma_request_slave_channel_compat failed\n" ); -return NULL ; - } + chan =dma_request_chan (dev, dir ==DMA_MEM_TO_DEV ?"tx" :"rx" ); +if (IS_ERR (chan)) +return chan;memset (&cfg,0 ,sizeof (cfg)); cfg.dst_addr = port_addr +RSPI_SPDR ;
@@ -1121,7 +1111,7 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev,if (ret) {dev_warn (dev,"dmaengine_slave_config failed %d\n" , ret);dma_release_channel (chan); -return NULL ; +return ERR_PTR (ret); }return chan;
@@ -1130,29 +1120,23 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev,static int rspi_request_dma (struct device *dev,struct spi_controller *ctlr,const struct resource *res) { -unsigned int dma_tx_id, dma_rx_id; +struct dma_chan *chan; -if (dev->of_node) { -/* In the OF case we will get the slave IDs from the DT */ - dma_tx_id =0 ; - dma_rx_id =0 ; - }else { -/* The driver assumes no error. */ +if (!dev->of_node)return 0 ; - } - ctlr->dma_tx =rspi_request_dma_chan (dev,DMA_MEM_TO_DEV , dma_tx_id, - res->start); -if (!ctlr->dma_tx) -return -ENODEV ; + chan =rspi_request_dma_chan (dev,DMA_MEM_TO_DEV , res->start); +if (IS_ERR (chan)) +return PTR_ERR (chan); + ctlr->dma_tx = chan; - ctlr->dma_rx =rspi_request_dma_chan (dev,DMA_DEV_TO_MEM , dma_rx_id, - res->start); -if (!ctlr->dma_rx) { + chan =rspi_request_dma_chan (dev,DMA_DEV_TO_MEM , res->start); +if (IS_ERR (chan)) {dma_release_channel (ctlr->dma_tx); ctlr->dma_tx =NULL ; -return -ENODEV ; +return PTR_ERR (chan); } + ctlr->dma_rx = chan; ctlr->can_dma = rspi_can_dma;dev_info (dev,"DMA available" );
@@ -1355,6 +1339,11 @@ static int rspi_probe(struct platform_device *pdev) } ret =rspi_request_dma (&pdev->dev, ctlr, res); +if (ret == -EPROBE_DEFER ) { +dev_err_probe (&pdev->dev, ret, +"failed to request DMA channels\n" ); + goto error2; + }if (ret <0 )dev_warn (&pdev->dev,"DMA not available, using PIO\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 962/2651 ASoC: mediatek: mt8192: fix APLL mux error handling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit e8c263e0ef957fd8286e299b2be9266b902cec16 ]
Propagate errors from clock operations in the enable path and clean up previously enabled clocks when a later operation fails.
For the disable path, continue disabling all clocks even if a clock operation fails. Log the error without returning it, so the disable path can perform as much cleanup as possible.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 54 +++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +32 -22
@@ -87,7 +87,7 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], ret); - goto EXIT; +return ret; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_1 ], afe_priv->clk[CLK_TOP_APLL1_CK ]);
@@ -95,7 +95,7 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], aud_clks[CLK_TOP_APLL1_CK ], ret); - goto EXIT; + goto err_disable_mux_aud_1; }/* 180.6336 / 4 = 45.1584MHz */
@@ -103,7 +103,7 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], ret); - goto EXIT; + goto err_set_parent_mux_aud_1; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ], afe_priv->clk[CLK_TOP_APLL1_D4 ]);
@@ -111,31 +111,36 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], aud_clks[CLK_TOP_APLL1_D4 ], ret); - goto EXIT; + goto err_disable_mux_aud_eng1; } }else { ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ]); ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_1 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_1 ]); } -EXIT: +return 0 ; + +err_disable_mux_aud_eng1: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ]); +err_set_parent_mux_aud_1: +clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_1 ], + afe_priv->clk[CLK_CLK26M ]); +err_disable_mux_aud_1: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_1 ]); +return ret; }
@@ -149,7 +154,7 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], ret); - goto EXIT; +return ret; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_2 ], afe_priv->clk[CLK_TOP_APLL2_CK ]);
@@ -157,7 +162,7 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], aud_clks[CLK_TOP_APLL2_CK ], ret); - goto EXIT; + goto err_disable_mux_aud_2; }/* 196.608 / 4 = 49.152MHz */
@@ -165,7 +170,7 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], ret); - goto EXIT; + goto err_set_parent_mux_aud_2; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ], afe_priv->clk[CLK_TOP_APLL2_D4 ]);
@@ -173,31 +178,36 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], aud_clks[CLK_TOP_APLL2_D4 ], ret); - goto EXIT; + goto err_disable_mux_aud_eng2; } }else { ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ]); ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_2 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_2 ]); } -EXIT: +return 0 ; + +err_disable_mux_aud_eng2: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ]); +err_set_parent_mux_aud_2: +clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_2 ], + afe_priv->clk[CLK_CLK26M ]); +err_disable_mux_aud_2: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_2 ]); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 963/2651 ASoC: mediatek: mt8192: fix AFE clock error handling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 7c54781e6e60681af8d0858148d613becb582328 ]
If a clock operation fails in mt8192_afe_enable_clock(), the function returns immediately via the EXIT label without disabling the clocks that were successfully enabled earlier in the sequence. This leaves unneeded clocks running and causes a resource leak.
Properly unwind clocks enabled before an error by jumping to appropriate cleanup labels on failure.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +19 -9
@@ -220,21 +220,21 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_INFRA_SYS_AUDIO ], ret); - goto EXIT; +return ret; } ret =clk_prepare_enable (afe_priv->clk[CLK_INFRA_AUDIO_26M ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_INFRA_AUDIO_26M ], ret); - goto EXIT; + goto err_disable_infra_sys_audio; } ret =clk_prepare_enable (afe_priv->clk[CLK_MUX_AUDIO ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIO ], ret); - goto EXIT; + goto err_disable_infra_audio_26m; } ret =clk_set_parent (afe_priv->clk[CLK_MUX_AUDIO ], afe_priv->clk[CLK_CLK26M ]);
@@ -242,14 +242,14 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIO ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; + goto err_disable_mux_audio; } ret =clk_prepare_enable (afe_priv->clk[CLK_MUX_AUDIOINTBUS ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIOINTBUS ], ret); - goto EXIT; + goto err_disable_mux_audio; } ret =mt8192_set_audio_int_bus_parent (afe,CLK_CLK26M );
@@ -257,7 +257,7 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIOINTBUS ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; + goto err_disable_mux_audiointbus; } ret = clk_set_parent(afe_priv->clk[CLK_TOP_MUX_AUDIO_H],
@@ -266,17 +266,27 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUDIO_H ], aud_clks[CLK_TOP_APLL2_CK ], ret); - goto EXIT; + goto err_disable_mux_audiointbus; } ret =clk_prepare_enable (afe_priv->clk[CLK_AFE ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_AFE ], ret); - goto EXIT; + goto err_disable_mux_audiointbus; } -EXIT: +return 0 ; + +err_disable_mux_audiointbus: +clk_disable_unprepare (afe_priv->clk[CLK_MUX_AUDIOINTBUS ]); +err_disable_mux_audio: +clk_disable_unprepare (afe_priv->clk[CLK_MUX_AUDIO ]); +err_disable_infra_audio_26m: +clk_disable_unprepare (afe_priv->clk[CLK_INFRA_AUDIO_26M ]); +err_disable_infra_sys_audio: +clk_disable_unprepare (afe_priv->clk[CLK_INFRA_SYS_AUDIO ]); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 964/2651 ASoC: mediatek: mt8192: fix error handling in APLL enable functions
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 88760524ca995acd229c30ec69ced7d883a90a72 ]
If a clock operation fails in mt8192_apll1_enable() or apll2_enable(), the functions return without checking the return value of mux settings or unwinding previously enabled clocks and MUX configurations.
Fix this by checking the return value of apll1_mux_setting() and apll2_mux_setting(), and adding proper unwind handling on failure.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +24 -8
@@ -308,20 +308,22 @@ int mt8192_apll1_enable(struct mtk_base_afe *afe)int ret;/* setting for APLL */ -apll1_mux_setting (afe, true); + ret =apll1_mux_setting (afe, true); +if (ret) +return ret; ret =clk_prepare_enable (afe_priv->clk[CLK_APLL22M ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL22M ], ret); - goto EXIT; + goto err_disable_mux_setting; } ret =clk_prepare_enable (afe_priv->clk[CLK_APLL1_TUNER ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL1_TUNER ], ret); - goto EXIT; + goto err_disable_apll22m; } regmap_update_bits(afe->regmap, AFE_APLL1_TUNER_CFG,
@@ -332,7 +334,13 @@ int mt8192_apll1_enable(struct mtk_base_afe *afe)AFE_22M_ON_MASK_SFT , 0x1 << AFE_22M_ON_SFT); -EXIT: +return 0 ; + +err_disable_apll22m: +clk_disable_unprepare (afe_priv->clk[CLK_APLL22M ]); +err_disable_mux_setting: +apll1_mux_setting (afe, false); +return ret; }
@@ -358,20 +366,22 @@ int mt8192_apll2_enable(struct mtk_base_afe *afe)int ret;/* setting for APLL */ -apll2_mux_setting (afe, true); + ret =apll2_mux_setting (afe, true); +if (ret) +return ret; ret =clk_prepare_enable (afe_priv->clk[CLK_APLL24M ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL24M ], ret); - goto EXIT; + goto err_disable_mux_setting; } ret =clk_prepare_enable (afe_priv->clk[CLK_APLL2_TUNER ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL2_TUNER ], ret); - goto EXIT; + goto err_disable_apll24m; } regmap_update_bits(afe->regmap, AFE_APLL2_TUNER_CFG,
@@ -382,7 +392,13 @@ int mt8192_apll2_enable(struct mtk_base_afe *afe)AFE_24M_ON_MASK_SFT , 0x1 << AFE_24M_ON_SFT); -EXIT: +return 0 ; + +err_disable_apll24m: +clk_disable_unprepare (afe_priv->clk[CLK_APLL24M ]); +err_disable_mux_setting: +apll2_mux_setting (afe, false); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 965/2651 ASoC: mediatek: mt8192: fix MCK clock error handling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 4a0ab266cb1594f8c6aef3c79726476ad99618c5 ]
If an error occurs after enabling 'm_sel_id' or 'div_clk_id' in mt8192_mck_enable(), the function returns directly without disabling the previously enabled clocks, leading to a resource leak.
Fix this by jumping to proper cleanup labels to unwind enabled clocks on failure paths.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +11 -3
@@ -619,7 +619,7 @@ int mt8192_mck_enable(struct mtk_base_afe *afe, int mck_id, int rate)dev_err (afe->dev,"%s(), clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[m_sel_id], aud_clks[apll_clk_id], ret); -return ret; + goto err_disable_m_sel; } }
@@ -628,17 +628,25 @@ int mt8192_mck_enable(struct mtk_base_afe *afe, int mck_id, int rate)if (ret) {dev_err (afe->dev,"%s(), clk_prepare_enable %s fail %d\n" , __func__, aud_clks[div_clk_id], ret); -return ret; + goto err_disable_m_sel; } ret =clk_set_rate (afe_priv->clk[div_clk_id], rate);if (ret) {dev_err (afe->dev,"%s(), clk_set_rate %s, rate %d, fail %d\n" , __func__, aud_clks[div_clk_id], rate, ret); -return ret; + goto err_disable_div_clk; }return 0 ; + +err_disable_div_clk: +clk_disable_unprepare (afe_priv->clk[div_clk_id]); +err_disable_m_sel: +if (m_sel_id >=0 ) +clk_disable_unprepare (afe_priv->clk[m_sel_id]); + +return ret; }void mt8192_mck_disable (struct mtk_base_afe *afe,int mck_id)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 966/2651 ASoC: mediatek: mt8192: switch to devm_clk_get_optional()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 6f4edfdce0099dc0c346c78c85f58a23d4ee646e ]
Switch from devm_clk_get() to devm_clk_get_optional() when requesting clocks, as optional clocks automatically return NULL when not present instead of requiring manual check and NULL assignment.
Additionally, handle clock errors properly using dev_err_probe() to propagate error codes (such as -EPROBE_DEFER) on failure instead of just printing a warning and continuing with NULL pointers.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +4 -7
@@ -672,13 +672,10 @@ int mt8192_init_clock(struct mtk_base_afe *afe)return -ENOMEM ;for (i =0 ; i <CLK_NUM ; i++) { - afe_priv->clk[i] =devm_clk_get (afe->dev, aud_clks[i]); -if (IS_ERR (afe_priv->clk[i])) { -dev_warn (afe->dev,"%s devm_clk_get %s fail, ret %ld\n" , - __func__, - aud_clks[i],PTR_ERR (afe_priv->clk[i])); - afe_priv->clk[i] =NULL ; - } + afe_priv->clk[i] =devm_clk_get_optional (afe->dev, aud_clks[i]); +if (IS_ERR (afe_priv->clk[i])) +return dev_err_probe (afe->dev,PTR_ERR (afe_priv->clk[i]), +"failed to get clock %s\n" , aud_clks[i]); } afe_priv->apmixedsys = syscon_regmap_lookup_by_phandle(of_node,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 967/2651 ASoC: mediatek: mt8192: Propagate errors in mt8192_afe_gpio_request()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 411be3902fa8f879db6f2f55d0c15507efe09c92 ]
Currently, mt8192_afe_gpio_request() ignores the return values from mt8192_afe_gpio_select() and other helper functions. If configuring a GPIO state fails, the function still returns 0, hiding the failure from callers.
Fix this by capturing and returning the error codes properly.
--- sound/soc/mediatek/mt8192/mt8192-afe-gpio.c | 74 +++++++++++---------- 1 file changed, 40 insertions(+), 34 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-gpio.c +40 -34
@@ -208,98 +208,104 @@ static int mt8192_afe_gpio_adda_ch34_ul(struct device *dev, bool enable)int mt8192_afe_gpio_request (struct device *dev,bool enable,int dai,int uplink) { +int ret; +guard (mutex)(&gpio_request_mutex);switch (dai) {case MT8192_DAI_ADDA :if (uplink) -mt8192_afe_gpio_adda_ul (dev, enable); + ret =mt8192_afe_gpio_adda_ul (dev, enable);else -mt8192_afe_gpio_adda_dl (dev, enable); + ret =mt8192_afe_gpio_adda_dl (dev, enable);break ;case MT8192_DAI_ADDA_CH34 :if (uplink) -mt8192_afe_gpio_adda_ch34_ul (dev, enable); + ret =mt8192_afe_gpio_adda_ch34_ul (dev, enable);else -mt8192_afe_gpio_adda_ch34_dl (dev, enable); + ret =mt8192_afe_gpio_adda_ch34_dl (dev, enable);break ;case MT8192_DAI_I2S_0 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_OFF );break ;case MT8192_DAI_I2S_1 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_OFF );break ;case MT8192_DAI_I2S_2 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_OFF );break ;case MT8192_DAI_I2S_3 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_OFF );break ;case MT8192_DAI_I2S_5 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_OFF );break ;case MT8192_DAI_I2S_6 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_OFF );break ;case MT8192_DAI_I2S_7 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_OFF );break ;case MT8192_DAI_I2S_8 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_OFF );break ;case MT8192_DAI_I2S_9 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_OFF );break ;case MT8192_DAI_TDM :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_OFF );break ;case MT8192_DAI_VOW :if (enable) { -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_CLK_ON ); -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_DAT_ON ); + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_CLK_ON ); +if (ret) +break ; + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_DAT_ON ); }else { -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_CLK_OFF ); -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_DAT_OFF ); + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_CLK_OFF ); +if (ret) +break ; + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_DAT_OFF ); }break ;default :dev_warn (dev,"%s(), invalid dai %d\n" , __func__, dai); -return -EINVAL ; + ret = -EINVAL ; } -return 0 ; +return ret; }EXPORT_SYMBOL (mt8192_afe_gpio_request);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 968/2651 ASoC: mediatek: mt8192: check return values in mt8192_afe_gpio_init()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 7cca184ad434436e8f4648f71756bab0c3593ed9 ]
Currently, mt8192_afe_gpio_init() ignores the return values of mt8192_afe_gpio_select() and mt8192_afe_gpio_request(). If configuring GPIO states or requesting GPIOs fails during initialization, the function still proceeds and returns 0, masking the initialization failure.
Fix this by checking and propagating the return values properly.
--- sound/soc/mediatek/mt8192/mt8192-afe-gpio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-gpio.c +8 -4
@@ -151,13 +151,17 @@ int mt8192_afe_gpio_init(struct device *dev) } } -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_CLK_MOSI_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_CLK_MOSI_ON ); +if (ret) +return ret;/* gpio status init */ -mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,0 ); -mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,1 ); + ret =mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,0 ); +if (ret) +return ret; + ret =mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,1 ); -return 0 ; +return ret; }EXPORT_SYMBOL (mt8192_afe_gpio_init);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 969/2651 ASoC: mediatek: mt8192: Handle regcache_sync() failure in runtime resume
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit d9e264741b041fc9dffc555bc1ab68708658cefd ]
Currently, the return value of regcache_sync() in mt8192_afe_runtime_resume() is ignored. If regcache_sync() fails, the function continues execution with clocks enabled and regcache out of sync.
Fix this by checking the return value of regcache_sync(). On failure, restore regcache to cache-only mode and disable the clocks enabled earlier in the function.
--- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +5 -1
@@ -2104,7 +2104,11 @@ static int mt8192_afe_runtime_resume(struct device *dev) goto skip_regmap;regcache_cache_only (afe->regmap, false); -regcache_sync (afe->regmap); + ret =regcache_sync (afe->regmap); +if (ret) { +regcache_cache_only (afe->regmap, true); +mt8192_afe_disable_clock (afe); + }/* enable audio sys DCM for power saving */ regmap_update_bits(afe_priv->infracfg,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 970/2651 ASoC: mediatek: mt8192: Propagate mt8192_afe_gpio_request() errors in ADDA DAI
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit eed9414a1b075e2df308e7222e3786981bd42b32 ]
Currently, DAPM event handlers in mt8192-dai-adda.c ignore the return value of mt8192_afe_gpio_request(). If GPIO configuration fails during PRE_PMU or POST_PMD events, the error is silently ignored.
Fix this by checking and propagating error codes from mt8192_afe_gpio_request() in all ADDA DAPM event handlers.
--- sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 44 +++++++++++++++------ 1 file changed, 32 insertions(+), 12 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-adda.c +32 -12
@@ -218,10 +218,13 @@ static int mtk_adda_ul_event(struct snd_soc_dapm_widget *w,struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt);struct mt8192_afe_private *afe_priv = afe->platform_priv;int mtkaif_dmic = afe_priv->mtkaif_dmic; +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); +if (ret) +return ret;/* update setting to dmic */ if (mtkaif_dmic) {
@@ -239,7 +242,9 @@ static int mtk_adda_ul_event(struct snd_soc_dapm_widget *w,case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); +if (ret) +return ret;break ;default :break ;
@@ -257,11 +262,14 @@ static int mtk_adda_ch34_ul_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int mtkaif_dmic = afe_priv->mtkaif_dmic_ch34;int mtkaif_adda6_only = afe_priv->mtkaif_adda6_only; +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , -1 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , +1 ); +if (ret) +return ret;/* update setting to dmic */ if (mtkaif_dmic) {
@@ -291,8 +299,10 @@ static int mtk_adda_ch34_ul_event(struct snd_soc_dapm_widget *w,case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , -1 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , +1 ); +if (ret) +return ret;/* reset dmic */ afe_priv->mtkaif_dmic_ch34 =0 ;
@@ -446,15 +456,20 @@ static int mtk_adda_dl_event(struct snd_soc_dapm_widget *w, {struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt); +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); +if (ret) +return ret;break ;default :break ;
@@ -469,17 +484,22 @@ static int mtk_adda_ch34_dl_event(struct snd_soc_dapm_widget *w, {struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt); +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , -0 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , +0 ); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , -0 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , +0 ); +if (ret) +return ret;break ;default :break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 971/2651 ASoC: mediatek: mt8192: Propagate errors in TDM DAI DAPM event handlers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit d0bc9613bc2d9e20a7e4f3e447cd9427c95d194a ]
Currently, DAPM event handlers in mt8192-dai-tdm.c ignore return values from mt8192_afe_gpio_request() and mt8192_mck_enable().
If GPIO configuration or master clock setup fails during DAPM events, the error is silently ignored.
Fix this by checking and propagating error codes properly in all TDM DAI DAPM event handlers.
--- sound/soc/mediatek/mt8192/mt8192-dai-tdm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +13 -5
@@ -250,6 +250,7 @@ static int mtk_tdm_en_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int dai_id =get_tdm_id_by_name (w->name);struct mtk_afe_tdm_priv *tdm_priv = afe_priv->dai_priv[dai_id]; +int ret;if (!tdm_priv) {dev_warn (afe->dev,"%s(), tdm_priv == NULL" , __func__);
@@ -261,16 +262,17 @@ static int mtk_tdm_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true, tdm_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, true, tdm_priv->id,0 );break ;case SND_SOC_DAPM_POST_PMD : -mt8192_afe_gpio_request (afe->dev, false, tdm_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, false, tdm_priv->id,0 );break ;default : + ret =0 ;break ; } -return 0 ; +return ret; } static int mtk_tdm_bck_en_event(struct snd_soc_dapm_widget *w,
@@ -282,6 +284,7 @@ static int mtk_tdm_bck_en_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int dai_id =get_tdm_id_by_name (w->name);struct mtk_afe_tdm_priv *tdm_priv = afe_priv->dai_priv[dai_id]; +int ret;if (!tdm_priv) {dev_warn (afe->dev,"%s(), tdm_priv == NULL" , __func__);
@@ -293,7 +296,9 @@ static int mtk_tdm_bck_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_mck_enable (afe, tdm_priv->bck_id, tdm_priv->bck_rate); + ret =mt8192_mck_enable (afe, tdm_priv->bck_id, tdm_priv->bck_rate); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :mt8192_mck_disable (afe, tdm_priv->bck_id);
@@ -314,6 +319,7 @@ static int mtk_tdm_mck_en_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int dai_id =get_tdm_id_by_name (w->name);struct mtk_afe_tdm_priv *tdm_priv = afe_priv->dai_priv[dai_id]; +int ret;if (!tdm_priv) {dev_warn (afe->dev,"%s(), tdm_priv == NULL" , __func__);
@@ -325,7 +331,9 @@ static int mtk_tdm_mck_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_mck_enable (afe, tdm_priv->mclk_id, tdm_priv->mclk_rate); + ret =mt8192_mck_enable (afe, tdm_priv->mclk_id, tdm_priv->mclk_rate); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD : tdm_priv->mclk_rate =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 972/2651 ASoC: mediatek: mt8192: Propagate errors in I2S DAI DAPM event handlers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 49aeb628d10ef3d5694c39b7a3427d34bde06bb2 ]
Currently, DAPM event handlers in mt8192-dai-i2s.c ignore return values from mt8192_afe_gpio_request(), mt8192_apll1_enable(), mt8192_apll2_enable(), and mt8192_mck_enable(). If GPIO configuration or clock setup fails during DAPM events, the error is silently ignored.
Fix this by checking and propagating error codes properly in all I2S DAI DAPM event handlers.
--- sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-i2s.c +14 -6
@@ -586,6 +586,7 @@ static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt);struct mtk_afe_i2s_priv *i2s_priv; +int ret; i2s_priv =get_i2s_priv_by_name (afe, w->name);
@@ -599,16 +600,17 @@ static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true, i2s_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, true, i2s_priv->id,0 );break ;case SND_SOC_DAPM_POST_PMD : -mt8192_afe_gpio_request (afe->dev, false, i2s_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, false, i2s_priv->id,0 );break ;default : + ret =0 ;break ; } -return 0 ; +return ret; } static int mtk_apll_event(struct snd_soc_dapm_widget *w,
@@ -617,6 +619,7 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w, {struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt); +int ret;dev_dbg (cmpnt->dev,"%s(), name %s, event 0x%x\n" , __func__, w->name, event);
@@ -624,9 +627,11 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU :if (snd_soc_dapm_widget_name_cmp (w,APLL1_W_NAME ) ==0 ) -mt8192_apll1_enable (afe); + ret =mt8192_apll1_enable (afe);else -mt8192_apll2_enable (afe); + ret =mt8192_apll2_enable (afe); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :if (snd_soc_dapm_widget_name_cmp (w,APLL1_W_NAME ) ==0 )
@@ -704,6 +709,7 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt);struct mtk_afe_i2s_priv *i2s_priv; +int ret;dev_dbg (cmpnt->dev,"%s(), name %s, event 0x%x\n" , __func__, w->name, event);
@@ -716,7 +722,9 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_mck_enable (afe, i2s_priv->mclk_id, i2s_priv->mclk_rate); + ret =mt8192_mck_enable (afe, i2s_priv->mclk_id, i2s_priv->mclk_rate); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD : i2s_priv->mclk_rate =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 973/2651 ASoC: mediatek: mt8192-mt6359: Fix error handling in MTKAIF calibration
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit d6c8a0b5bf696d89350e43bf554362de8929f801 ]
mt8192_mt6359_mtkaif_calibration() ignored the return values of pm_runtime_get_sync() and mt8192_afe_gpio_request(), which could leave PM runtime references or GPIO state unbalanced on failure.
Switch to pm_runtime_resume_and_get(), check each GPIO request, and unwind on error.
--- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-)
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +25 -12
@@ -163,12 +163,23 @@ static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)int chosen_phase_1, chosen_phase_2, chosen_phase_3;int counter;int mtkaif_calib_ok; +int ret =0 ; -pm_runtime_get_sync (afe->dev); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,1 ); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,0 ); + ret =pm_runtime_resume_and_get (afe->dev); +if (ret <0 ) +return ret; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); +if (ret) + goto err_pm_put; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); +if (ret) + goto err_disable_adda_1; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,1 ); +if (ret) + goto err_disable_adda_0; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,0 ); +if (ret) + goto err_disable_adda_ch34_1;mt6359_mtkaif_calibration_enable (cmpnt_codec);
@@ -289,10 +300,14 @@ static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)mt6359_mtkaif_calibration_disable (cmpnt_codec); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 ,1 );mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 ,0 ); +err_disable_adda_ch34_1: +mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 ,1 ); +err_disable_adda_0: +mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); +err_disable_adda_1: +mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); +err_pm_put:pm_runtime_put (afe->dev); dev_dbg(afe->dev, "%s(), mtkaif_chosen_phase[0/1/2]:%d/%d/%d\n",
@@ -301,7 +316,7 @@ static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd) afe_priv->mtkaif_chosen_phase[1 ], afe_priv->mtkaif_chosen_phase[2]); -return 0 ; +return ret; }static int mt8192_mt6359_init (struct snd_soc_pcm_runtime *rtd)
@@ -319,9 +334,7 @@ static int mt8192_mt6359_init(struct snd_soc_pcm_runtime *rtd) afe_priv->mtkaif_protocol =MTKAIF_PROTOCOL_2_CLK_P2 ;/* mtkaif calibration */ -mt8192_mt6359_mtkaif_calibration (rtd); - -return 0 ; +return mt8192_mt6359_mtkaif_calibration (rtd); }static int mt8192_rt5682_init (struct snd_soc_pcm_runtime *rtd)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 974/2651 perf build: Improve fix for "argument list too long" error
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoît Monin <[email protected]>
[ Upstream commit ea2058a975c549bc2cae3ae42490c3f5a846ad81 ]
The orphaned pmu-events JSON files are passed to the shell via echo "$^", which puts the whole list into a single argument. With a long enough output directory path and enough files, exec'ing /bin/sh fails with:
make[5]: /bin/sh: Argument list too long
make[5]: *** [pmu-events/Build:228: prune_orphans] Error 127
This only happens with out-of-tree builds, when setting O= to a relatively long path.
To reproduce, build once with JEVENTS_ARCH=all, then rebuild with a smaller JEVENTS_ARCH without cleaning first, so the leftover files become orphans. Using nds32 (which leaves ~1100 orphans), an output path of only ~70 characters is already enough to trigger it:
OUT=/any/long/path (at least 70 characters) make -C tools/perf JEVENTS_ARCH=all O=$OUT -j$(nproc) make -C tools/perf JEVENTS_ARCH=nds32 O=$OUT -j$(nproc)
Express the orphan file list as paths relative to $(OUT_DIR) by stripping the common prefix and restoring it with printf, the same approach used in scripts/Makefile.clean, so the shell arguments stay short.
--- tools/perf/pmu-events/Build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/pmu-events/Build +4 -2
@@ -223,9 +223,11 @@ ifneq ($(strip $(ORPHAN_FILES)),) # of a build step. quiet_cmd_rm = RM ...$(words $^) orphan file(s)... -# The list of files can be long. Use xargs to prevent issues. +# The list of files can be long. Remove the $(OUT_DIR)/ prefix, and +# restore it with printf, to prevent "Argument list too long" +# (see scripts/Makefile.clean). prune_orphans: $(ORPHAN_FILES) - $(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f + $(Q)$(call echo-cmd,rm)printf '$(OUT_DIR)/%s ' $(patsubst $(OUT_DIR)/%,%,$(ORPHAN_FILES)) | xargs rm -f JEVENTS_DEPS += prune_orphans endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 975/2651 perf test code-reading: Fix duplicate kernel maps and machine leak
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 58bf7b7af359d4c6f1af29fd8d2067bbcff1d8c7 ]
In do_test_code_reading(), machine__new_host(&host_env) already calls machine__create_kernel_maps(machine). Calling machine__create_kernel_maps(machine) a second time immediately afterwards duplicates all kernel module maps in machine->kmaps, causing dso__load_kcore()'s module validation (do_validate_kcore_modules()) to fail and fall back to /proc/kallsyms.
Furthermore, when try_kcore is true and !have_kcore, returning TEST_CODE_READING_NO_KCORE directly bypasses out_err, leaking the entire struct machine, its kernel/module maps and DSOs, all kallsyms symbols, and host_env.
Remove the redundant machine__create_kernel_maps() call, check for !machine after machine__new_host(), and jump to out_err when returning TEST_CODE_READING_NO_KCORE.
--- tools/perf/tests/code-reading.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/perf/tests/code-reading.c +6 -6
@@ -716,10 +716,8 @@ static int do_test_code_reading(bool try_kcore)perf_env__init (&host_env); machine =machine__new_host (&host_env); - - ret =machine__create_kernel_maps (machine); -if (ret <0 ) { -pr_debug ("machine__create_kernel_maps failed\n" ); +if (!machine) { +pr_debug ("machine__new_host failed\n" ); goto out_err; }
@@ -739,8 +737,10 @@ static int do_test_code_reading(bool try_kcore) have_kcore =dso__is_kcore (dso);/* 2nd time through we just try kcore */ -if (try_kcore && !have_kcore) -return TEST_CODE_READING_NO_KCORE ; +if (try_kcore && !have_kcore) { + err =TEST_CODE_READING_NO_KCORE ; + goto out_err; + }/* No point getting kernel events if there is no kernel object */ if (!have_vmlinux && !have_kcore)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 976/2651 perf build: Clean libperf-gtk.so in make clean
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit fb0da4af899ab1d6a66d29b21189bda3c68c2ce0 ]
When GTK support was made opt-in (first via GTK2=1 and recently ported to GTK4=1), $(OUTPUT)libperf-gtk.so is only added to ALL_PROGRAMS when GTK4 is defined. As a result, running 'make clean' without GTK4=1 does not remove $(OUTPUT)libperf-gtk.so.
Add $(OUTPUT)libperf-gtk.so explicitly to the core-progs clean list so it is always removed by 'make clean'.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -948,7 +948,7 @@ clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $( -name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete $(Q)$(RM) $(OUTPUT).config-detected $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 \ - perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so + perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so $(OUTPUT)libperf-gtk.so $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo \ TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE \ $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 977/2651 arm64: dts: ti: k3-am62-verdin-ivy: Fix main_gpio0/main_gpio1 line names size
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Dolcini <[email protected]>
[ Upstream commit a74db73609d6e307bfcb6ef8073be2c47fb5bd9e ]
ivy redefines gpio-line-names for main_gpio0/main_gpio1, sized 87/88 entries instead of the SoC's actual 92/52 ti,ngpio. Resize both arrays to match, keeping every existing label at its original index.
--- .../arm64/boot/dts/ti/k3-am62-verdin-ivy.dtsi | 41 +++---------------- 1 file changed, 5 insertions(+), 36 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-verdin-ivy.dtsi +5 -36
@@ -367,6 +367,11 @@ &main_gpio0 { "", "", "", + "", + "", + "", + "", + "", /* 90 */ ""; };
@@ -425,42 +430,6 @@ &main_gpio1 { "", "", "", /* 50 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 60 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 70 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 80 */ - "", - "", - "", - "", - "", - "", ""; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 978/2651 arm64: dts: ti: k3-am62-verdin-zinnia: Fix main_gpio0/main_gpio1 line names size
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Dolcini <[email protected]>
[ Upstream commit 9dd7a67b29e0d49c66c4785014ac3befb086fbfc ]
zinnia redefines gpio-line-names for main_gpio0/main_gpio1, sized 87/88 entries instead of the SoC's actual 92/52 ti,ngpio. Resize both arrays to match, keeping every existing label at its original index.
--- .../boot/dts/ti/k3-am62-verdin-zinnia.dtsi | 41 +++---------------- 1 file changed, 5 insertions(+), 36 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-verdin-zinnia.dtsi +5 -36
@@ -274,6 +274,11 @@ &main_gpio0 { "", "", "", + "", + "", + "", + "", + "", /* 90 */ ""; };
@@ -330,42 +335,6 @@ &main_gpio1 { "", "", "", /* 50 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 60 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 70 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 80 */ - "", - "", - "", - "", - "", - "", ""; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 979/2651 perf vendor events intel: Fix clearwaterforest umask encoding.
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit b26183fade24530141a2c7a22ca47e1ab0f7989e ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- .../perf/pmu-events/arch/x86/clearwaterforest/pipeline.json | 3 ++- .../pmu-events/arch/x86/clearwaterforest/uncore-cache.json | 5 +++++ .../arch/x86/clearwaterforest/uncore-interconnect.json | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)
tools/perf/pmu-events/arch/x86/clearwaterforest/pipeline.json +2 -1
@@ -934,6 +934,7 @@ "Counter": "0,1,2,3,4,5,6,7", "EventCode": "0xc2", "EventName": "UOPS_RETIRED.X87", - "SampleAfterValue": "1000003" + "SampleAfterValue": "1000003", + "UMask": "0x100" } ]
tools/perf/pmu-events/arch/x86/clearwaterforest/uncore-cache.json +5 -0
@@ -700,6 +700,7 @@ "EventName": "UNC_CHA_REMOTE_SF.DIRBACKED_ONLY", "Experimental": "1", "PerPkg": "1", + "UMask": "0x4000", "Unit": "CHA" }, {
@@ -729,6 +730,7 @@ "EventName": "UNC_CHA_REMOTE_SF.INCLUSIVE_ONLY", "Experimental": "1", "PerPkg": "1", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -747,6 +749,7 @@ "EventName": "UNC_CHA_REMOTE_SF.UPDATE_EXCLUSIVE", "Experimental": "1", "PerPkg": "1", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -766,6 +769,7 @@ "EventName": "UNC_CHA_REMOTE_SF.VICTIM_EXCLUSIVE", "Experimental": "1", "PerPkg": "1", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -775,6 +779,7 @@ "EventName": "UNC_CHA_REMOTE_SF.VICTIM_SHARED", "Experimental": "1", "PerPkg": "1", + "UMask": "0x200", "Unit": "CHA" }, {
tools/perf/pmu-events/arch/x86/clearwaterforest/uncore-interconnect.json +2 -0
@@ -515,6 +515,7 @@ "EventName": "UNC_B2CMI_IMC_WRITES.NI", "Experimental": "1", "PerPkg": "1", + "UMask": "0x300", "Unit": "B2CMI" }, {
@@ -524,6 +525,7 @@ "EventName": "UNC_B2CMI_IMC_WRITES.NI_MISS", "Experimental": "1", "PerPkg": "1", + "UMask": "0x500", "Unit": "B2CMI" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 980/2651 perf vendor events intel: Fix lunarlake umask encoding.
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit f2844acc9dfc330b6e4b4731c18ddafe10b2f99c ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- tools/perf/pmu-events/arch/x86/lunarlake/cache.json | 3 +++ tools/perf/pmu-events/arch/x86/lunarlake/pipeline.json | 2 ++ 2 files changed, 5 insertions(+)
tools/perf/pmu-events/arch/x86/lunarlake/cache.json +3 -0
@@ -848,6 +848,7 @@ "EventName": "MEM_LOAD_L3_MISS_RETIRED.MEMSIDE_CACHE", "PublicDescription": "Retired load instructions which data source is memory side cache. Available PDIST counters: 0,1", "SampleAfterValue": "100007", + "UMask": "0x100", "Unit": "cpu_core" }, {
@@ -901,6 +902,7 @@ "EventName": "MEM_LOAD_RETIRED.L1_HIT_L1", "PublicDescription": "Counts retired load instructions with at least one uop that hit in the Level 1 of the L1 data cache. Available PDIST counters: 0,1", "SampleAfterValue": "1000003", + "UMask": "0x100", "Unit": "cpu_core" }, {
@@ -1093,6 +1095,7 @@ "EventCode": "0x44", "EventName": "MEM_STORE_RETIRED.MEMSIDE_CACHE", "SampleAfterValue": "100021", + "UMask": "0x400", "Unit": "cpu_core" }, {
tools/perf/pmu-events/arch/x86/lunarlake/pipeline.json +2 -0
@@ -190,6 +190,7 @@ "EventName": "BR_INST_RETIRED.COND_TAKEN_FWD", "PublicDescription": "Counts taken forward conditional branch instructions retired. Available PDIST counters: 0,1", "SampleAfterValue": "400009", + "UMask": "0x100", "Unit": "cpu_core" }, {
@@ -474,6 +475,7 @@ "EventName": "BR_MISP_RETIRED.COND_TAKEN_FWD", "PublicDescription": "Counts taken forward conditional mispredicted branch instructions retired. Available PDIST counters: 0,1", "SampleAfterValue": "400009", + "UMask": "0x100", "Unit": "cpu_core" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 981/2651 perf vendor events intel: Fix sierraforest umask encoding.
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit a86bd28b6e71101a1b11b7768f9bbc648b7b14d3 ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- .../perf/pmu-events/arch/x86/sierraforest/uncore-cache.json | 5 +++++ .../arch/x86/sierraforest/uncore-interconnect.json | 2 ++ 2 files changed, 7 insertions(+)
tools/perf/pmu-events/arch/x86/sierraforest/uncore-cache.json +5 -0
@@ -701,6 +701,7 @@ "EventName": "UNC_CHA_REMOTE_SF.DIRBACKED_ONLY", "Experimental": "1", "PerPkg": "1", + "UMask": "0x4000", "Unit": "CHA" }, {
@@ -730,6 +731,7 @@ "EventName": "UNC_CHA_REMOTE_SF.INCLUSIVE_ONLY", "Experimental": "1", "PerPkg": "1", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -748,6 +750,7 @@ "EventName": "UNC_CHA_REMOTE_SF.UPDATE_EXCLUSIVE", "Experimental": "1", "PerPkg": "1", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -767,6 +770,7 @@ "EventName": "UNC_CHA_REMOTE_SF.VICTIM_EXCLUSIVE", "Experimental": "1", "PerPkg": "1", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -776,6 +780,7 @@ "EventName": "UNC_CHA_REMOTE_SF.VICTIM_SHARED", "Experimental": "1", "PerPkg": "1", + "UMask": "0x200", "Unit": "CHA" }, {
tools/perf/pmu-events/arch/x86/sierraforest/uncore-interconnect.json +2 -0
@@ -515,6 +515,7 @@ "EventName": "UNC_B2CMI_IMC_WRITES.NI", "Experimental": "1", "PerPkg": "1", + "UMask": "0x300", "Unit": "B2CMI" }, {
@@ -524,6 +525,7 @@ "EventName": "UNC_B2CMI_IMC_WRITES.NI_MISS", "Experimental": "1", "PerPkg": "1", + "UMask": "0x500", "Unit": "B2CMI" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 982/2651 perf vendor events intel: Fix skylakex umask encoding.
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit f37e7dfbd34c4e48d2bea4c5e0e64c398671e87b ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- .../pmu-events/arch/x86/skylakex/uncore-interconnect.json | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/pmu-events/arch/x86/skylakex/uncore-interconnect.json +6 -0
@@ -13462,6 +13462,7 @@ "EventName": "UNC_UPI_TxL_HDR_MATCH.DATA_HDR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x800", "Unit": "UPI" }, {
@@ -13472,6 +13473,7 @@ "EventName": "UNC_UPI_TxL_HDR_MATCH.DUAL_SLOT_HDR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x2000", "Unit": "UPI" }, {
@@ -13482,6 +13484,7 @@ "EventName": "UNC_UPI_TxL_HDR_MATCH.LOC", "Experimental": "1", "PerPkg": "1", + "UMask": "0x200", "Unit": "UPI" }, {
@@ -13514,6 +13517,7 @@ "EventName": "UNC_UPI_TxL_HDR_MATCH.NON_DATA_HDR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x1000", "Unit": "UPI" }, {
@@ -13524,6 +13528,7 @@ "EventName": "UNC_UPI_TxL_HDR_MATCH.REM", "Experimental": "1", "PerPkg": "1", + "UMask": "0x400", "Unit": "UPI" }, {
@@ -13567,6 +13572,7 @@ "EventName": "UNC_UPI_TxL_HDR_MATCH.SGL_SLOT_HDR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x4000", "Unit": "UPI" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 983/2651 perf vendor events intel: Fix snowridgex umask encoding.
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 8a0b9c9ff582258aafc6d6c8fe3fb104d9686a7b ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- .../arch/x86/snowridgex/uncore-cache.json | 68 +++++++++++++++++++ .../x86/snowridgex/uncore-interconnect.json | 10 +++ 2 files changed, 78 insertions(+)
tools/perf/pmu-events/arch/x86/snowridgex/uncore-cache.json +68 -0
@@ -1592,6 +1592,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : All Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Any local or remote transaction to the LLC, including prefetch.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -1624,6 +1625,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : CRd Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Local or remote CRd transactions to the LLC. This includes CRd prefetch.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -1645,6 +1647,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : Local request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Any local transaction to the LLC, including prefetches from the Core", + "UMask": "0x4000", "Unit": "CHA" }, {
@@ -1687,6 +1690,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : Data Read Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Read transactions.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -1752,6 +1756,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : Flush or Invalidate Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -1773,6 +1778,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : Transactions homed locally Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Transaction whose address resides in the local MC.", + "UMask": "0x80000", "Unit": "CHA" }, {
@@ -1805,6 +1811,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : Write Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Writeback transactions to the LLC This includes all write transactions -- both Cacheable and UC.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -1925,6 +1932,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Cache Lookups : RFO Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Local or remote RFO transactions to the LLC. This includes RFO prefetch.", + "UMask": "0x800", "Unit": "CHA" }, {
@@ -2077,6 +2085,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Lines Victimized : Local Only : Counts the number of lines that were victimized on a fill. This can be filtered by the state that the line was in.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -2195,6 +2204,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x10000000", "Unit": "CHA" }, {
@@ -2205,6 +2215,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x20000000", "Unit": "CHA" }, {
@@ -2215,6 +2226,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x80000", "Unit": "CHA" }, {
@@ -2225,6 +2237,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x8000000", "Unit": "CHA" }, {
@@ -2235,6 +2248,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -2289,6 +2303,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x40000000", "Unit": "CHA" }, {
@@ -2299,6 +2314,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x10000", "Unit": "CHA" }, {
@@ -2309,6 +2325,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -2319,6 +2336,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -2329,6 +2347,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x200000", "Unit": "CHA" }, {
@@ -2339,6 +2358,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x4000000", "Unit": "CHA" }, {
@@ -2349,6 +2369,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x800000", "Unit": "CHA" }, {
@@ -2359,6 +2380,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x1000000", "Unit": "CHA" }, {
@@ -2369,6 +2391,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -2379,6 +2402,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x8000", "Unit": "CHA" }, {
@@ -2411,6 +2435,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x100000", "Unit": "CHA" }, {
@@ -2421,6 +2446,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x20000", "Unit": "CHA" }, {
@@ -2431,6 +2457,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x400000", "Unit": "CHA" }, {
@@ -2441,6 +2468,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x2000000", "Unit": "CHA" }, {
@@ -2451,6 +2479,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -2461,6 +2490,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x80000000", "Unit": "CHA" }, {
@@ -2471,6 +2501,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x100000000", "Unit": "CHA" }, {
@@ -2481,6 +2512,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x200000000", "Unit": "CHA" }, {
@@ -2491,6 +2523,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x4000", "Unit": "CHA" }, {
@@ -2523,6 +2556,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC10 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 10 only.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -2533,6 +2567,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC11 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 11 only.", + "UMask": "0x800", "Unit": "CHA" }, {
@@ -2543,6 +2578,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC12 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 12 only.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -2553,6 +2589,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC13 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 13 only.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -2629,6 +2666,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC8 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 8 only.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -2639,6 +2677,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC9 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 9 only.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -5047,6 +5086,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : DDR4 Access : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -5057,6 +5097,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.DDR4", "Experimental": "1", "PerPkg": "1", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -5078,6 +5119,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just Hits : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -5687,6 +5729,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just ISOC : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200000000", "Unit": "CHA" }, {
@@ -5697,6 +5740,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just Local Targets : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x8000", "Unit": "CHA" }, {
@@ -5740,6 +5784,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Match the Opcode in b[29:19] of the extended umask field : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x20000", "Unit": "CHA" }, {
@@ -5750,6 +5795,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just Misses : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -5760,6 +5806,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : MMCFG Access : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -5770,6 +5817,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just NearMem : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000000", "Unit": "CHA" }, {
@@ -5780,6 +5828,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just NonCoherent : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100000000", "Unit": "CHA" }, {
@@ -5790,6 +5839,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just NotNearMem : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x80000000", "Unit": "CHA" }, {
@@ -5800,6 +5850,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Inserts : Match the PreMorphed Opcode in b[29:19] of the extended umask field : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000", "Unit": "CHA" }, {
@@ -5832,6 +5883,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : DDR4 Access : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -5853,6 +5905,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just Hits : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -6440,6 +6493,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just ISOC : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200000000", "Unit": "CHA" }, {
@@ -6450,6 +6504,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just Local Targets : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x8000", "Unit": "CHA" }, {
@@ -6493,6 +6548,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Match the Opcode in b[29:19] of the extended umask field : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x20000", "Unit": "CHA" }, {
@@ -6503,6 +6559,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just Misses : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -6513,6 +6570,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : MMCFG Access : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -6523,6 +6581,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just NearMem : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000000", "Unit": "CHA" }, {
@@ -6533,6 +6592,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just NonCoherent : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100000000", "Unit": "CHA" }, {
@@ -6543,6 +6603,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just NotNearMem : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x80000000", "Unit": "CHA" }, {
@@ -6553,6 +6614,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Match the PreMorphed Opcode in b[29:19] of the extended umask field : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000", "Unit": "CHA" }, {
@@ -8356,6 +8418,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC10 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 10 only.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -8366,6 +8429,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC11 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 11 only.", + "UMask": "0x800", "Unit": "CHA" }, {
@@ -8376,6 +8440,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC12 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 12 only.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -8386,6 +8451,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC13 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 13 only.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -8462,6 +8528,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC8 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 8 only.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -8472,6 +8539,7 @@ "Experimental": "1", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC9 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 9 only.", + "UMask": "0x200", "Unit": "CHA" }, {
tools/perf/pmu-events/arch/x86/snowridgex/uncore-interconnect.json +10 -0
@@ -2210,6 +2210,7 @@ "EventName": "UNC_M2M_IMC_WRITES.CH0_FROM_TGR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x500", "Unit": "M2M" }, {
@@ -2239,6 +2240,7 @@ "EventName": "UNC_M2M_IMC_WRITES.CH0_NI_MISS", "Experimental": "1", "PerPkg": "1", + "UMask": "0x2000", "Unit": "M2M" }, {
@@ -2278,6 +2280,7 @@ "EventName": "UNC_M2M_IMC_WRITES.CH1_FROM_TGR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x900", "Unit": "M2M" }, {
@@ -2307,6 +2310,7 @@ "EventName": "UNC_M2M_IMC_WRITES.CH1_NI_MISS", "Experimental": "1", "PerPkg": "1", + "UMask": "0xc00", "Unit": "M2M" }, {
@@ -2336,6 +2340,7 @@ "EventName": "UNC_M2M_IMC_WRITES.FROM_TGR", "Experimental": "1", "PerPkg": "1", + "UMask": "0x1d00", "Unit": "M2M" }, {
@@ -2365,6 +2370,7 @@ "EventName": "UNC_M2M_IMC_WRITES.NI_MISS", "Experimental": "1", "PerPkg": "1", + "UMask": "0x1c00", "Unit": "M2M" }, {
@@ -2837,6 +2843,7 @@ "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH0.RPQ_PROXY", "Experimental": "1", "PerPkg": "1", + "UMask": "0x100", "Unit": "M2M" }, {
@@ -2866,6 +2873,7 @@ "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH0.XPT_THRESH", "Experimental": "1", "PerPkg": "1", + "UMask": "0x200", "Unit": "M2M" }, {
@@ -2935,6 +2943,7 @@ "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH1.RPQ_PROXY", "Experimental": "1", "PerPkg": "1", + "UMask": "0x100", "Unit": "M2M" }, {
@@ -2964,6 +2973,7 @@ "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH1.XPT_THRESH", "Experimental": "1", "PerPkg": "1", + "UMask": "0x200", "Unit": "M2M" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 984/2651 soc: ti: k3-ringacc: Correct ring API kernel-doc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 45ea6911ad16859d4ce4f25780b0ebcf5660e43a ]
The ring accelerator header labels k3_ring_cfg as an enum, uses propname instead of property, and gives the DMA reset helper the ordinary reset helper's name. The DMA reset comment also omits occ, including the convention that zero requests a hardware occupancy read.
The proxy flag is parsed as a separate parameter, and the pop helpers describe pushing elements. Proxy access is supported in Message mode; the listed Credentials and Queue modes are not implemented. The phandle lookup returns encoded error pointers rather than integer error values.
Match the declarations and document these argument and operation roles.
--- include/linux/soc/ti/k3-ringacc.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
include/linux/soc/ti/k3-ringacc.h +12 -14
@@ -57,13 +57,13 @@ struct k3_ringacc;struct k3_ring ;/** -* enum k3_ring_cfg - RA ring configuration structure +* struct k3_ring_cfg - RA ring configuration structure * * @size: Ring size, number of elements * @elm_size: Ring element size * @mode: Ring operational mode * @flags: Ring configuration flags. Possible values: -* @K3_RINGACC_RING_SHARED: when set allows to request the same ring +* %K3_RINGACC_RING_SHARED: when set allows to request the same ring * few times. It's usable when the same ring is used as Free Host PD ring * for different flows, for example. * Note: Locking should be done by consumer if required
@@ -88,11 +88,10 @@ struct k3_ring_cfg {/** * of_k3_ringacc_get_by_phandle - find a RA by phandle property * @np: device node -* @propname: property name containing phandle on RA node +* @property: property name containing phandle on RA node * -* Returns pointer on the RA - struct k3_ringacc -* or -ENODEV if not found, -* or -EPROBE_DEFER if not yet registered +* Return: Pointer to the RA, or ERR_PTR(-ENODEV) if the phandle cannot +* be resolved, or ERR_PTR(-EPROBE_DEFER) if the RA is not yet registered. */ struct k3_ringacc *of_k3_ringacc_get_by_phandle (struct device_node *np,const char *property);
@@ -103,10 +102,8 @@ struct k3_ringacc *of_k3_ringacc_get_by_phandle(struct device_node *np,* k3_ringacc_request_ring - request ring from ringacc * @ringacc: pointer on ringacc * @id: ring id or K3_RINGACC_RING_ID_ANY for any general purpose ring -* @flags: -* @K3_RINGACC_RING_USE_PROXY: if set - proxy will be allocated and -* used to access ring memory. Sopported only for rings in -* Message/Credentials/Queue mode. +* @flags: Set %K3_RINGACC_RING_USE_PROXY to allocate a proxy for +* accessing ring memory in Message mode. * * Returns pointer on the Ring - struct k3_ring * or NULL in case of failure.
@@ -126,8 +123,9 @@ int k3_ringacc_request_rings_pair(struct k3_ringacc *ringacc,*/ void k3_ringacc_ring_reset (struct k3_ring *ring);/** -* k3_ringacc_ring_reset - ring reset for DMA rings +* k3_ringacc_ring_reset_dma - ring reset for DMA rings * @ring: pointer on Ring +* @occ: occupancy used by the DMA reset quirk, or zero to read it from hardware * * Resets ring internal state ((hw)occ, (hw)idx). Should be used for rings * which are read by K3 UDMA, like TX or Free Host PD rings.
@@ -217,8 +215,8 @@ int k3_ringacc_ring_push(struct k3_ring *ring, void *elem);* @ring: pointer on ring * @elem: pointer on ring element buffer * -* Push one ring element from the ring head. Size of the ring element is -* determined by ring configuration &struct k3_ring_cfg elm_size.. +* Pop one ring element from the ring head. Size of the ring element is +* determined by ring configuration &struct k3_ring_cfg elm_size. * * Returns 0 on success, errno otherwise. */
@@ -242,7 +240,7 @@ int k3_ringacc_ring_push_head(struct k3_ring *ring, void *elem);* @ring: pointer on ring * @elem: pointer on ring element buffer * -* Push one ring element from the ring tail. Size of the ring element is +* Pop one ring element from the ring tail. Size of the ring element is * determined by ring configuration &struct k3_ring_cfg elm_size. * * Returns 0 on success, errno otherwise.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 985/2651 soc: ti: k3-ringacc: Fix DMA ring initialization kernel-doc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 6c4e6e8f5cf95f7e0d4f04928a9ae70e20c73d4b ]
The heading for k3_ringacc_init_data repeats struct, so kernel-doc cannot match it to the declaration. Its three fields are also missing descriptions.
Use the structure name and describe the firmware handle, device ID, and total number of available rings used during DMA ring initialization.
--- include/linux/soc/ti/k3-ringacc.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/soc/ti/k3-ringacc.h +4 -1
@@ -254,7 +254,10 @@ u32 k3_ringacc_get_tisci_dev_id(struct k3_ring *ring);struct ti_sci_handle ;/** -* struct struct k3_ringacc_init_data - Initialization data for DMA rings +* struct k3_ringacc_init_data - Initialization data for DMA rings +* @tisci: TI SCI firmware handle +* @tisci_dev_id: TI SCI device ID of the DMA controller +* @num_rings: Total number of available rings */ struct k3_ringacc_init_data {const struct ti_sci_handle *tisci;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 986/2651 fs/ntfs3: fix slab-out-of-bounds write in attr_insert_range()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei (Microsoft) <[email protected]>
[ Upstream commit bf9a6578e03b065335836e025356b4b9170b9449 ]
When fallocate(FALLOC_FL_INSERT_RANGE) grows a still-resident ntfs3 attribute, attr_insert_range() shifts the inline data using the insert length 'bytes' as both the destination offset and the copy size:
memmove(data + bytes, data, bytes);
Both are wrong: the shift must start at the insertion point 'vbo' and move only the data past it (data_size - vbo). When bytes > data_size the memmove runs off the end of the data_size + bytes buffer and overflows the adjacent slab object.
Since vbo < data_size is already enforced above, the reworked offsets stay within the data_size + bytes buffer and cannot under/overflow.
BUG: KASAN: slab-out-of-bounds in attr_insert_range (fs/ntfs3/attrib.c:2581) Write of size 512 at addr ffff8880135e8b10 by task exploit/142 ... __asan_memmove (mm/kasan/shadow.c:95) attr_insert_range (fs/ntfs3/attrib.c:2581) ntfs_fallocate (fs/ntfs3/file.c:618) vfs_fallocate (fs/open.c:338) __x64_sys_fallocate (fs/open.c:362) ...
--- fs/ntfs3/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/attrib.c +2 -2
@@ -2625,8 +2625,8 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)char *data =Add2Ptr (attr_b,le16_to_cpu (attr_b->res.data_off)); -memmove (data + bytes, data, bytes); -memset (data,0 , bytes); +memmove (data + vbo + bytes, data + vbo, data_size - vbo); +memset (data + vbo,0 , bytes); goto done; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 987/2651 cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 8a1c0f5c82843104d9bef2bc3726c89da70a9b91 ]
Commit f82f80426f7a ("sched/deadline: Ensure that updates to exclusive cpusets don't break AC") adds a check in validate_change() to make sure that there is enough bandwidth for SCHED_DEADLINE tasks if we shrink a v1 exclusive cpuset that has CS_CPU_EXCLUSIVE flag set.
With the introduction of cpuset partition in cgroup v2, we keep setting the CS_CPU_EXCLUSIVE flag for a partition root so that the SCHED_DEADLINE check will continue to work as intended. However it turns out that the current code isn't perfect and there are cases where a cpuset isn't a valid partition root, but the exclusive flag is still incorrectly set. This can leads to SCHED_DEADLINE check being incorrectly triggered when there are deadline tasks in the system. This can result in unexpected -EBUSY failure when making changes to cpuset control files. Fix that by checking for a valid partition root for v2 and is_cpu_exclusive() for v1. It is far easier and less cumbersome than to make sure that the exclusive flag is only set for valid partition roots.
Even though commit a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") is marked as a commit to be fixed, the problem may exist before that.
--- kernel/cgroup/cpuset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/cgroup/cpuset.c +4 -3
@@ -792,8 +792,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)* For v1, effective_cpus == cpus_allowed & user_xcpus() returns * cpus_allowed. * -* For v2, is_cpu_exclusive() & is_sched_load_balance() are true only -* for non-isolated partition root. At this point, the target +* For v2, is_partition_valid(cur) & is_sched_load_balance() are true +* only for non-isolated partition root. At this point, the target * effective_cpus isn't computed yet. user_xcpus() is the best * approximation. *
@@ -802,7 +802,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)* becomes an issue. */ ret = -EBUSY ; -if (is_cpu_exclusive (cur) &&is_sched_load_balance (cur) && +if ((is_partition_valid (cur) || (!cpuset_v2 () &&is_cpu_exclusive (cur))) && +is_sched_load_balance (cur) && !cpuset_cpumask_can_shrink (cur->effective_cpus,user_xcpus (trial))) goto out;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 988/2651 spi: spi-qpic-snand: fix read location register usage in qcom_spi_config_cw_read()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
[ Upstream commit f3c0a2b557ea87cbd802b278783c32484a063ded ]
While configuring a codeword read, the com_spi_config_cw_read() function unconditionally schedules writing of the regular read location registers. However these registers should be written only if the actual codeword is not the last one.
Change the function to schedule writing of the registers corresponding to the acual codeword only.
While at it, also drop the single-use 'reg' and 'num_cw' local variables and use the respective values directly in order to make the code easier to understand.
--- drivers/spi/spi-qpic-snand.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/spi/spi-qpic-snand.c +7 -8
@@ -506,15 +506,14 @@ static void qcom_spi_set_read_loc(struct qcom_nand_controller *snandc, int cw, istatic void qcom_spi_config_cw_read (struct qcom_nand_controller *snandc,bool use_ecc,int cw) { -__le32 *reg = &snandc->regs->read_location0; -int num_cw = snandc->qspi->num_cw; - -qcom_write_reg_dma (snandc, reg,NAND_READ_LOCATION_0 ,4 ,NAND_BAM_NEXT_SGL ); -if (cw == (num_cw -1 )) { - reg = &snandc->regs->read_location_last0; -qcom_write_reg_dma (snandc, reg,NAND_READ_LOCATION_LAST_CW_0 ,4 , +if (cw == (snandc->qspi->num_cw -1 )) +qcom_write_reg_dma (snandc, &snandc->regs->read_location_last0, +NAND_READ_LOCATION_LAST_CW_0 ,4 , +NAND_BAM_NEXT_SGL ); +else +qcom_write_reg_dma (snandc, &snandc->regs->read_location0, +NAND_READ_LOCATION_0 ,4 ,NAND_BAM_NEXT_SGL ); - }qcom_write_reg_dma (snandc, &snandc->regs->cmd,NAND_FLASH_CMD ,1 ,NAND_BAM_NEXT_SGL );qcom_write_reg_dma (snandc, &snandc->regs->exec,NAND_EXEC_CMD ,1 ,NAND_BAM_NEXT_SGL );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 989/2651 RDMA/mlx5: Restore mr->pi_mr after temporary stack-local assignment
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 9728effe43d8fc4d58e12b697d0d6127355abdd5 ]
In handle_reg_mr_integrity, when mr->pi_mr is NULL (physical-address optimization path), the code points mr->pi_mr at a stack-local pa_pi_mr so set_pi_umr_wr can read it during this call. The pointer is never restored, so after the function returns mr->pi_mr dangles at a freed stack frame. A second IB_WR_REG_MR_INTEGRITY posted on the same MR without remapping reads the stale pointer and dereferences it.
Save the original pi_mr (captured at function entry) and restore it on the out path.
--- drivers/infiniband/hw/mlx5/wr.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/wr.c +1 -0
@@ -927,6 +927,7 @@ static noinline_for_stack int handle_reg_mr_integrity(struct mlx5_ib_dev *dev, qp->next_fence =MLX5_FENCE_MODE_INITIATOR_SMALL ; out: + mr->pi_mr = pi_mr;return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 990/2651 IB/isert: Dont share drop_cmd_list across concurrent connection teardowns
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit d30e9b1bc47bd9be4b2fc97b0e4074bc02c4203a ]
isert_put_unsol_pending_cmds() declares drop_cmd_list as a static LIST_HEAD, so the list is shared across all invocations of the function. It is called from isert_wait_conn(), the per-connection .iscsit_wait_conn transport callback, which runs independently for each connection during teardown.
conn->cmd_lock only protects each connection's own conn_cmd_list, not the shared drop_cmd_list. If two connections tear down at the same time, both threads list_move_tail() commands into the same drop_cmd_list without any mutual exclusion, and then both iterate and list_del/put it concurrently. This corrupts the linked list and can double-free iscsit_cmd structures.
Make drop_cmd_list a stack-local list, matching the pattern already used in isert_free_np().
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
@@ -2583,7 +2583,7 @@ static void isert_put_unsol_pending_cmds(struct iscsit_conn *conn) {struct iscsit_cmd *cmd, *tmp; -static LIST_HEAD (drop_cmd_list); +LIST_HEAD (drop_cmd_list);spin_lock_bh (&conn->cmd_lock);list_for_each_entry_safe (cmd, tmp, &conn->conn_cmd_list, i_conn_node) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 991/2651 arm64: dts: imx8dxl-evk: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit c4e5f1a143799651aba2c4f66860b63b56786306 ]
The imx_rproc driver uses node names to identify reserved memory regions. It checks for "vdev0buffer" to skip mapping, "rsc-table" to locate the resource table, and "vdev" prefix to filter vdev regions.
Rename the reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx8dxl-evk.dts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/freescale/imx8dxl-evk.dts +7 -7
@@ -29,7 +29,7 @@ imx8dxl-cm4 { clocks = <&clk_dummy>; mbox-names = "tx", "rx", "rxdb"; mboxes = <&lsio_mu5 0 1 &lsio_mu5 1 1 &lsio_mu5 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; power-domains = <&pd IMX_SC_R_M4_0_PID0>, <&pd IMX_SC_R_M4_0_MU_1A>; fsl,resource-id = <IMX_SC_R_M4_0_PID0>;
@@ -65,32 +65,32 @@ linux,cma { linux,cma-default; }; - vdev0vring0: memory0@90000000 { + vdev0vring0: vdev0vring0@90000000 { reg = <0 0x90000000 0 0x8000>; no-map; }; - vdev0vring1: memory@90008000 { + vdev0vring1: vdev0vring1@90008000 { reg = <0 0x90008000 0 0x8000>; no-map; }; - vdev1vring0: memory@90010000 { + vdev1vring0: vdev1vring0@90010000 { reg = <0 0x90010000 0 0x8000>; no-map; }; - vdev1vring1: memory@90018000 { + vdev1vring1: vdev1vring1@90018000 { reg = <0 0x90018000 0 0x8000>; no-map; }; - rsc_table: memory-rsc-table@900ff000 { + rsc_table: rsc-table@900ff000 { reg = <0 0x900ff000 0 0x1000>; no-map; }; - vdevbuffer: memory-vdevbuffer@90400000 { + vdev0buffer: vdev0buffer@90400000 { compatible = "shared-dma-pool"; reg = <0 0x90400000 0 0x100000>; no-map;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 992/2651 arm64: dts: imx8qm-mek: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit c712a46c10d38ce7869a9d81d7986e844a4e9f24 ]
The imx_rproc driver uses node names to identify reserved memory regions. It checks for "vdev0buffer" to skip mapping, "rsc-table" to locate the resource table, and "vdev" prefix to filter vdev regions.
Rename the reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx8qm-mek.dts | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
arch/arm64/boot/dts/freescale/imx8qm-mek.dts +13 -13
@@ -44,57 +44,57 @@ reserved-memory { #size-cells = <2>; ranges; - vdev0vring0: memory@90000000 { + vdev0vring0: vdev0vring0@90000000 { reg = <0 0x90000000 0 0x8000>; no-map; }; - vdev0vring1: memory@90008000 { + vdev0vring1: vdev0vring1@90008000 { reg = <0 0x90008000 0 0x8000>; no-map; }; - vdev1vring0: memory@90010000 { + vdev1vring0: vdev1vring0@90010000 { reg = <0 0x90010000 0 0x8000>; no-map; }; - vdev1vring1: memory@90018000 { + vdev1vring1: vdev1vring1@90018000 { reg = <0 0x90018000 0 0x8000>; no-map; }; - rsc_table0: memory@900ff000 { + rsc_table0: rsc-table@900ff000 { reg = <0 0x900ff000 0 0x1000>; no-map; }; - vdev2vring0: memory@90100000 { + vdev2vring0: vdev2vring0@90100000 { reg = <0 0x90100000 0 0x8000>; no-map; }; - vdev2vring1: memory@90108000 { + vdev2vring1: vdev2vring1@90108000 { reg = <0 0x90108000 0 0x8000>; no-map; }; - vdev3vring0: memory@90110000 { + vdev3vring0: vdev3vring0@90110000 { reg = <0 0x90110000 0 0x8000>; no-map; }; - vdev3vring1: memory@90118000 { + vdev3vring1: vdev3vring1@90118000 { reg = <0 0x90118000 0 0x8000>; no-map; }; - rsc_table1: memory@901ff000 { + rsc_table1: rsc-table@901ff000 { reg = <0 0x901ff000 0 0x1000>; no-map; }; - vdevbuffer: memory@90400000 { + vdev0buffer: vdev0buffer@90400000 { compatible = "shared-dma-pool"; reg = <0 0x90400000 0 0x100000>; no-map;
@@ -456,7 +456,7 @@ imx8qm-cm4-0 { mboxes = <&lsio_mu5 0 1 &lsio_mu5 1 1 &lsio_mu5 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table0>; power-domains = <&pd IMX_SC_R_M4_0_PID0>, <&pd IMX_SC_R_M4_0_MU_1A>;
@@ -471,7 +471,7 @@ imx8qm-cm4-1 { mboxes = <&lsio_mu6 0 1 &lsio_mu6 1 1 &lsio_mu6 3 1>; - memory-region = <&vdevbuffer>, <&vdev2vring0>, <&vdev2vring1>, + memory-region = <&vdev0buffer>, <&vdev2vring0>, <&vdev2vring1>, <&vdev3vring0>, <&vdev3vring1>, <&rsc_table1>; power-domains = <&pd IMX_SC_R_M4_1_PID0>, <&pd IMX_SC_R_M4_1_MU_1A>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 993/2651 arm64: dts: imx8qm-mek: fix dsp reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 2cd565bde7e872409fa468fb9410e539fb5969e4 ]
The imx_dsp_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "memory", the check fails and the region gets unnecessarily mapped.
Rename the DSP reserved memory nodes to use proper names for consistency with other remoteproc reserved memory regions and to ensure the vdev0buffer check works correctly.
Rename the DSP reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx8qm-mek.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/freescale/imx8qm-mek.dts +3 -3
@@ -105,17 +105,17 @@ dsp_reserved: memory@92400000 { no-map; }; - dsp_vdev0vring0: memory@942f0000 { + dsp_vdev0vring0: vdev0vring0@942f0000 { reg = <0 0x942f0000 0 0x8000>; no-map; }; - dsp_vdev0vring1: memory@942f8000 { + dsp_vdev0vring1: vdev0vring1@942f8000 { reg = <0 0x942f8000 0 0x8000>; no-map; }; - dsp_vdev0buffer: memory@94300000 { + dsp_vdev0buffer: vdev0buffer@94300000 { compatible = "shared-dma-pool"; reg = <0 0x94300000 0 0x100000>; no-map;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 994/2651 arm64: dts: imx8qxp-mek: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit a9f3cf4354022ca0b4a0d12eab7af9858f71c9f7 ]
The imx_rproc driver uses node names to identify reserved memory regions. It checks for "vdev0buffer" to skip mapping, "rsc-table" to locate the resource table, and "vdev" prefix to filter vdev regions.
Rename the reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/freescale/imx8qxp-mek.dts +7 -7
@@ -27,7 +27,7 @@ imx8x_cm4: imx8x-cm4 { mboxes = <&lsio_mu5 0 1 &lsio_mu5 1 1 &lsio_mu5 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; power-domains = <&pd IMX_SC_R_M4_0_PID0>, <&pd IMX_SC_R_M4_0_MU_1A>;
@@ -242,32 +242,32 @@ reserved-memory { #size-cells = <2>; ranges; - vdev0vring0: memory@90000000 { + vdev0vring0: vdev0vring0@90000000 { reg = <0 0x90000000 0 0x8000>; no-map; }; - vdev0vring1: memory@90008000 { + vdev0vring1: vdev0vring1@90008000 { reg = <0 0x90008000 0 0x8000>; no-map; }; - vdev1vring0: memory@90010000 { + vdev1vring0: vdev1vring0@90010000 { reg = <0 0x90010000 0 0x8000>; no-map; }; - vdev1vring1: memory@90018000 { + vdev1vring1: vdev1vring1@90018000 { reg = <0 0x90018000 0 0x8000>; no-map; }; - rsc_table: memory@900ff000 { + rsc_table: rsc-table@900ff000 { reg = <0 0x900ff000 0 0x1000>; no-map; }; - vdevbuffer: memory@90400000 { + vdev0buffer: vdev0buffer@90400000 { compatible = "shared-dma-pool"; reg = <0 0x90400000 0 0x100000>; no-map;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 995/2651 arm64: dts: imx8qxp-mek: fix dsp reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 715f8f8877d03025a2af98b4128c83441617eb74 ]
The imx_dsp_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "memory", the check fails and the region gets unnecessarily mapped.
Rename the DSP reserved memory nodes to use proper names for consistency with other remoteproc reserved memory regions and to ensure the vdev0buffer check works correctly.
Rename the DSP reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/freescale/imx8qxp-mek.dts +3 -3
@@ -273,17 +273,17 @@ vdev0buffer: vdev0buffer@90400000 { no-map; }; - dsp_vdev0vring0: memory@942f0000 { + dsp_vdev0vring0: vdev0vring0@942f0000 { reg = <0 0x942f0000 0 0x8000>; no-map; }; - dsp_vdev0vring1: memory@942f8000 { + dsp_vdev0vring1: vdev0vring1@942f8000 { reg = <0 0x942f8000 0 0x8000>; no-map; }; - dsp_vdev0buffer: memory@94300000 { + dsp_vdev0buffer: vdev0buffer@94300000 { compatible = "shared-dma-pool"; reg = <0 0x94300000 0 0x100000>; no-map;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 996/2651 arm64: dts: imx8ulp-evk: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit f55e49b75c65c3e38e7bbe1d735f79128a50126e ]
The imx_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "vdevbuffer", the check fails and the region gets unnecessarily mapped. Rename it to "vdev0buffer" to match what the driver expects.
--- arch/arm64/boot/dts/freescale/imx8ulp-evk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8ulp-evk.dts +2 -2
@@ -80,7 +80,7 @@ vdev1vring1: vdev1vring1@aff18000 { no-map; }; - vdevbuffer: vdevbuffer@a8400000 { + vdev0buffer: vdev0buffer@a8400000 { compatible = "shared-dma-pool"; reg = <0 0xa8400000 0 0x100000>; no-map;
@@ -139,7 +139,7 @@ &cm33 { mboxes = <&mu 0 1>, <&mu 1 1>, <&mu 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 997/2651 arm64: dts: imx93-11x11-frdm: factor out common parts into dtsi
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Guo <[email protected]>
[ Upstream commit 264480ac044bd4d51489ccb7b17b7b50e2e5bf3f ]
The i.MX93 Wireless FRDM board reuses most of the i.MX93 FRDM board. To avoid duplication and DTS-to-DTS includes, extract common hardware definitions from imx93-11x11-frdm.dts into imx93-11x11-frdm-common.dtsi to allow the common description shared by both boards.
The FRDM-IMX93 board-specific .dts now includes the common dtsi and only contains board-specific overrides.
Stable-dep-of: ab6fc27a020a ("arm64: dts: imx93-11x11-frdm: fix reserved memory node names for remoteproc")
--- .../freescale/imx93-11x11-frdm-common.dtsi | 680 ++++++++++++++++++ .../boot/dts/freescale/imx93-11x11-frdm.dts | 679 +---------------- 2 files changed, 686 insertions(+), 673 deletions(-) create mode 100644 arch/arm64/boot/dts/freescale/imx93-11x11-frdm-common.dtsi
arch/arm64/boot/dts/freescale/imx93-11x11-frdm-common.dtsi new file +680 -0
@@ -0,0 +1,680 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +#include <dt-bindings/usb/pd.h> + +/ { + aliases { + can0 = &flexcan2; + ethernet0 = &fec; + ethernet1 = &eqos; + i2c0 = &lpi2c1; + i2c1 = &lpi2c2; + i2c2 = &lpi2c3; + mmc0 = &usdhc1; /* EMMC */ + mmc1 = &usdhc2; /* uSD */ + rtc0 = &pcf2131; + serial0 = &lpuart1; + serial4 = &lpuart5; + }; + + chosen { + stdout-path = &lpuart1; + }; + + flexcan2_phy: can-phy { + compatible = "nxp,tja1051"; + #phy-cells = <0>; + max-bitrate = <5000000>; + silent-gpios = <&pcal6524 23 GPIO_ACTIVE_HIGH>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-k2 { + label = "Button K2"; + linux,code = <BTN_1>; + gpios = <&pcal6524 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + interrupt-parent = <&pcal6524>; + interrupts = <5 IRQ_TYPE_EDGE_FALLING>; + }; + + button-k3 { + label = "Button K3"; + linux,code = <BTN_2>; + gpios = <&pcal6524 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + interrupt-parent = <&pcal6524>; + interrupts = <6 IRQ_TYPE_EDGE_FALLING>; + }; + }; + + reg_usdhc2_vmmc: regulator-usdhc2 { + compatible = "regulator-fixed"; + off-on-delay-us = <12000>; + pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>; + pinctrl-names = "default"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "VSD_3V3"; + vin-supply = <&buck4>; + gpio = <&gpio3 7 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + reserved-memory { + ranges; + #address-cells = <2>; + #size-cells = <2>; + + linux,cma { + compatible = "shared-dma-pool"; + alloc-ranges = <0 0x80000000 0 0x30000000>; + reusable; + size = <0 0x10000000>; + linux,cma-default; + }; + + rsc_table: rsc-table@2021e000 { + reg = <0 0x2021e000 0 0x1000>; + no-map; + }; + + vdev0vring0: vdev0vring0@a4000000 { + reg = <0 0xa4000000 0 0x8000>; + no-map; + }; + + vdev0vring1: vdev0vring1@a4008000 { + reg = <0 0xa4008000 0 0x8000>; + no-map; + }; + + vdev1vring0: vdev1vring0@a4010000 { + reg = <0 0xa4010000 0 0x8000>; + no-map; + }; + + vdev1vring1: vdev1vring1@a4018000 { + reg = <0 0xa4018000 0 0x8000>; + no-map; + }; + + vdevbuffer: vdevbuffer@a4020000 { + compatible = "shared-dma-pool"; + reg = <0 0xa4020000 0 0x100000>; + no-map; + }; + }; +}; + +&adc1 { + vref-supply = <&buck5>; + status = "okay"; +}; + +&mu1 { + status = "okay"; +}; + +&cm33 { + mboxes = <&mu1 0 1>, + <&mu1 1 1>, + <&mu1 3 1>; + mbox-names = "tx", "rx", "rxdb"; + memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; + status = "okay"; +}; + +&eqos { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_eqos>; + pinctrl-1 = <&pinctrl_eqos_sleep>; + phy-handle = <ðphy1>; + phy-mode = "rgmii-id"; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <5000000>; + + ethphy1: ethernet-phy@1 { + reg = <1>; + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&pcal6524 15 GPIO_ACTIVE_LOW>; + realtek,clkout-disable; + }; + }; +}; + +&fec { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_fec>; + pinctrl-1 = <&pinctrl_fec_sleep>; + phy-mode = "rgmii-id"; + phy-handle = <ðphy2>; + fsl,magic-packet; + status = "okay"; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <5000000>; + + ethphy2: ethernet-phy@2 { + reg = <2>; + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&pcal6524 16 GPIO_ACTIVE_LOW>; + realtek,clkout-disable; + }; + }; +}; + +&flexcan2 { + phys = <&flexcan2_phy>; + pinctrl-0 = <&pinctrl_flexcan2>; + pinctrl-1 = <&pinctrl_flexcan2_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; +}; + +&lpi2c1 { + clock-frequency = <400000>; + pinctrl-0 = <&pinctrl_lpi2c1>; + pinctrl-names = "default"; + status = "okay"; +}; + +&lpi2c2 { + clock-frequency = <400000>; + pinctrl-0 = <&pinctrl_lpi2c2>; + pinctrl-names = "default"; + status = "okay"; + + pcal6524: gpio@22 { + compatible = "nxp,pcal6524"; + reg = <0x22>; + #interrupt-cells = <2>; + interrupt-controller; + interrupt-parent = <&gpio3>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + #gpio-cells = <2>; + gpio-controller; + pinctrl-0 = <&pinctrl_pcal6524>; + pinctrl-names = "default"; + /* does not boot with supplier set, because it is the bucks interrupt parent */ + /* vcc-supply = <&buck4>; */ + }; + + pmic@25 { + compatible = "nxp,pca9451a"; + reg = <0x25>; + interrupt-parent = <&pcal6524>; + interrupts = <11 IRQ_TYPE_EDGE_FALLING>; + + regulators { + + buck1: BUCK1 { + regulator-name = "VDD_SOC_0V8"; + regulator-min-microvolt = <610000>; + regulator-max-microvolt = <950000>; + regulator-always-on; + regulator-boot-on; + regulator-ramp-delay = <3125>; + }; + + buck2: BUCK2 { + regulator-name = "LPD4_x_VDDQ_0V6"; + regulator-min-microvolt = <600000>; + regulator-max-microvolt = <670000>; + regulator-always-on; + regulator-boot-on; + regulator-ramp-delay = <3125>; + }; + + buck4: BUCK4 { + regulator-name = "VDD_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + }; + + buck5: BUCK5 { + regulator-name = "VDD_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + buck6: BUCK6 { + regulator-name = "LPD4_x_VDD2_1V1"; + regulator-min-microvolt = <1060000>; + regulator-max-microvolt = <1140000>; + regulator-always-on; + regulator-boot-on; + }; + + ldo1: LDO1 { + regulator-name = "NVCC_BBSM_1V8"; + regulator-min-microvolt = <1620000>; + regulator-max-microvolt = <1980000>; + regulator-always-on; + regulator-boot-on; + }; + + ldo4: LDO4 { + regulator-name = "VDD_ANA_0V8"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <840000>; + regulator-always-on; + regulator-boot-on; + }; + + ldo5: LDO5 { + regulator-name = "NVCC_SD"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + }; + }; + }; + + eeprom: eeprom@50 { + compatible = "atmel,24c256"; + reg = <0x50>; + pagesize = <64>; + vcc-supply = <&buck4>; + }; +}; + +&lpi2c3 { + clock-frequency = <400000>; + pinctrl-0 = <&pinctrl_lpi2c3>; + pinctrl-names = "default"; + status = "okay"; + + ptn5110: tcpc@50 { + compatible = "nxp,ptn5110", "tcpci"; + reg = <0x50>; + interrupt-parent = <&gpio3>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + + typec1_con: connector { + compatible = "usb-c-connector"; + data-role = "dual"; + label = "USB-C"; + op-sink-microwatt = <15000000>; + power-role = "dual"; + self-powered; + sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM) + PDO_VAR(5000, 20000, 3000)>; + source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>; + try-power-role = "sink"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + typec1_dr_sw: endpoint { + remote-endpoint = <&usb1_drd_sw>; + }; + }; + }; + }; + }; + + pcf2131: rtc@53 { + compatible = "nxp,pcf2131"; + reg = <0x53>; + interrupt-parent = <&pcal6524>; + interrupts = <1 IRQ_TYPE_EDGE_FALLING>; + }; +}; + +&lpuart1 { /* console */ + pinctrl-0 = <&pinctrl_uart1>; + pinctrl-names = "default"; + status = "okay"; +}; + +&lpuart5 { + pinctrl-0 = <&pinctrl_uart5>; + pinctrl-names = "default"; + status = "okay"; + + uart-has-rtscts; + + bluetooth: bluetooth { + compatible = "nxp,88w8987-bt"; + }; +}; + +&usbotg1 { + adp-disable; + disable-over-current; + dr_mode = "otg"; + hnp-disable; + srp-disable; + usb-role-switch; + samsung,picophy-dc-vol-level-adjust = <7>; + samsung,picophy-pre-emp-curr-control = <3>; + status = "okay"; + + port { + usb1_drd_sw: endpoint { + remote-endpoint = <&typec1_dr_sw>; + }; + }; +}; + +&usbotg2 { + disable-over-current; + dr_mode = "host"; + samsung,picophy-dc-vol-level-adjust = <7>; + samsung,picophy-pre-emp-curr-control = <3>; + status = "okay"; +}; + +&usdhc1 { + bus-width = <8>; + non-removable; + pinctrl-0 = <&pinctrl_usdhc1>; + pinctrl-1 = <&pinctrl_usdhc1_100mhz>; + pinctrl-2 = <&pinctrl_usdhc1_200mhz>; + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + vmmc-supply = <&buck4>; + status = "okay"; +}; + +&usdhc2 { + bus-width = <4>; + cd-gpios = <&gpio3 00 GPIO_ACTIVE_LOW>; + no-mmc; + no-sdio; + pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; + pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; + pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; + pinctrl-3 = <&pinctrl_usdhc2_sleep>, <&pinctrl_usdhc2_gpio_sleep>; + pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep"; + vmmc-supply = <®_usdhc2_vmmc>; + status = "okay"; +}; + +&wdog3 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_wdog>; + fsl,ext-reset-output; + status = "okay"; +}; + +&iomuxc { + + pinctrl_eqos: eqosgrp { + fsl,pins = < + MX93_PAD_ENET1_MDC__ENET_QOS_MDC 0x57e + MX93_PAD_ENET1_MDIO__ENET_QOS_MDIO 0x57e + MX93_PAD_ENET1_RD0__ENET_QOS_RGMII_RD0 0x57e + MX93_PAD_ENET1_RD1__ENET_QOS_RGMII_RD1 0x57e + MX93_PAD_ENET1_RD2__ENET_QOS_RGMII_RD2 0x57e + MX93_PAD_ENET1_RD3__ENET_QOS_RGMII_RD3 0x57e + MX93_PAD_ENET1_RXC__CCM_ENET_QOS_CLOCK_GENERATE_RX_CLK 0x58e + MX93_PAD_ENET1_RX_CTL__ENET_QOS_RGMII_RX_CTL 0x57e + MX93_PAD_ENET1_TD0__ENET_QOS_RGMII_TD0 0x57e + MX93_PAD_ENET1_TD1__ENET_QOS_RGMII_TD1 0x57e + MX93_PAD_ENET1_TD2__ENET_QOS_RGMII_TD2 0x57e + MX93_PAD_ENET1_TD3__ENET_QOS_RGMII_TD3 0x57e + MX93_PAD_ENET1_TXC__CCM_ENET_QOS_CLOCK_GENERATE_TX_CLK 0x58e + MX93_PAD_ENET1_TX_CTL__ENET_QOS_RGMII_TX_CTL 0x57e + >; + }; + + pinctrl_eqos_sleep: eqossleepgrp { + fsl,pins = < + MX93_PAD_ENET1_MDC__GPIO4_IO00 0x31e + MX93_PAD_ENET1_MDIO__GPIO4_IO01 0x31e + MX93_PAD_ENET1_RD0__GPIO4_IO10 0x31e + MX93_PAD_ENET1_RD1__GPIO4_IO11 0x31e + MX93_PAD_ENET1_RD2__GPIO4_IO12 0x31e + MX93_PAD_ENET1_RD3__GPIO4_IO13 0x31e + MX93_PAD_ENET1_RXC__GPIO4_IO09 0x31e + MX93_PAD_ENET1_RX_CTL__GPIO4_IO08 0x31e + MX93_PAD_ENET1_TD0__GPIO4_IO05 0x31e + MX93_PAD_ENET1_TD1__GPIO4_IO04 0x31e + MX93_PAD_ENET1_TD2__GPIO4_IO03 0x31e + MX93_PAD_ENET1_TD3__GPIO4_IO02 0x31e + MX93_PAD_ENET1_TXC__GPIO4_IO07 0x31e + MX93_PAD_ENET1_TX_CTL__GPIO4_IO06 0x31e + >; + }; + + pinctrl_fec: fecgrp { + fsl,pins = < + MX93_PAD_ENET2_MDC__ENET1_MDC 0x57e + MX93_PAD_ENET2_MDIO__ENET1_MDIO 0x57e + MX93_PAD_ENET2_RD0__ENET1_RGMII_RD0 0x57e + MX93_PAD_ENET2_RD1__ENET1_RGMII_RD1 0x57e + MX93_PAD_ENET2_RD2__ENET1_RGMII_RD2 0x57e + MX93_PAD_ENET2_RD3__ENET1_RGMII_RD3 0x57e + MX93_PAD_ENET2_RXC__ENET1_RGMII_RXC 0x58e + MX93_PAD_ENET2_RX_CTL__ENET1_RGMII_RX_CTL 0x57e + MX93_PAD_ENET2_TD0__ENET1_RGMII_TD0 0x57e + MX93_PAD_ENET2_TD1__ENET1_RGMII_TD1 0x57e + MX93_PAD_ENET2_TD2__ENET1_RGMII_TD2 0x57e + MX93_PAD_ENET2_TD3__ENET1_RGMII_TD3 0x57e + MX93_PAD_ENET2_TXC__ENET1_RGMII_TXC 0x58e + MX93_PAD_ENET2_TX_CTL__ENET1_RGMII_TX_CTL 0x57e + >; + }; + + pinctrl_fec_sleep: fecsleepgrp { + fsl,pins = < + MX93_PAD_ENET2_MDC__GPIO4_IO14 0x51e + MX93_PAD_ENET2_MDIO__GPIO4_IO15 0x51e + MX93_PAD_ENET2_RD0__GPIO4_IO24 0x51e + MX93_PAD_ENET2_RD1__GPIO4_IO25 0x51e + MX93_PAD_ENET2_RD2__GPIO4_IO26 0x51e + MX93_PAD_ENET2_RD3__GPIO4_IO27 0x51e + MX93_PAD_ENET2_RXC__GPIO4_IO23 0x51e + MX93_PAD_ENET2_RX_CTL__GPIO4_IO22 0x51e + MX93_PAD_ENET2_TD0__GPIO4_IO19 0x51e + MX93_PAD_ENET2_TD1__GPIO4_IO18 0x51e + MX93_PAD_ENET2_TD2__GPIO4_IO17 0x51e + MX93_PAD_ENET2_TD3__GPIO4_IO16 0x51e + MX93_PAD_ENET2_TXC__GPIO4_IO21 0x51e + MX93_PAD_ENET2_TX_CTL__GPIO4_IO20 0x51e + >; + }; + + pinctrl_flexcan2: flexcan2grp { + fsl,pins = < + MX93_PAD_GPIO_IO25__CAN2_TX 0x139e + MX93_PAD_GPIO_IO27__CAN2_RX 0x139e + >; + }; + + pinctrl_flexcan2_sleep: flexcan2sleepgrp { + fsl,pins = < + MX93_PAD_GPIO_IO25__GPIO2_IO25 0x31e + MX93_PAD_GPIO_IO27__GPIO2_IO27 0x31e + >; + }; + + pinctrl_lpi2c1: lpi2c1grp { + fsl,pins = < + MX93_PAD_I2C1_SCL__LPI2C1_SCL 0x40000b9e + MX93_PAD_I2C1_SDA__LPI2C1_SDA 0x40000b9e + >; + }; + + pinctrl_lpi2c2: lpi2c2grp { + fsl,pins = < + MX93_PAD_I2C2_SCL__LPI2C2_SCL 0x40000b9e + MX93_PAD_I2C2_SDA__LPI2C2_SDA 0x40000b9e + >; + }; + + pinctrl_lpi2c3: lpi2c3grp { + fsl,pins = < + MX93_PAD_GPIO_IO28__LPI2C3_SDA 0x40000b9e + MX93_PAD_GPIO_IO29__LPI2C3_SCL 0x40000b9e + >; + }; + + pinctrl_pcal6524: pcal6524grp { + fsl,pins = < + MX93_PAD_CCM_CLKO2__GPIO3_IO27 0x31e + >; + }; + + pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp { + fsl,pins = < + MX93_PAD_SD2_RESET_B__GPIO3_IO07 0x31e + >; + }; + + pinctrl_uart1: uart1grp { + fsl,pins = < + MX93_PAD_UART1_RXD__LPUART1_RX 0x31e + MX93_PAD_UART1_TXD__LPUART1_TX 0x31e + >; + }; + + pinctrl_uart5: uart5grp { + fsl,pins = < + MX93_PAD_DAP_TDO_TRACESWO__LPUART5_TX 0x31e + MX93_PAD_DAP_TDI__LPUART5_RX 0x31e + MX93_PAD_DAP_TMS_SWDIO__LPUART5_RTS_B 0x31e + MX93_PAD_DAP_TCLK_SWCLK__LPUART5_CTS_B 0x31e + >; + }; + + /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_usdhc1: usdhc1grp { + fsl,pins = < + MX93_PAD_SD1_CLK__USDHC1_CLK 0x1582 + MX93_PAD_SD1_CMD__USDHC1_CMD 0x40001382 + MX93_PAD_SD1_DATA0__USDHC1_DATA0 0x40001382 + MX93_PAD_SD1_DATA1__USDHC1_DATA1 0x40001382 + MX93_PAD_SD1_DATA2__USDHC1_DATA2 0x40001382 + MX93_PAD_SD1_DATA3__USDHC1_DATA3 0x40001382 + MX93_PAD_SD1_DATA4__USDHC1_DATA4 0x40001382 + MX93_PAD_SD1_DATA5__USDHC1_DATA5 0x40001382 + MX93_PAD_SD1_DATA6__USDHC1_DATA6 0x40001382 + MX93_PAD_SD1_DATA7__USDHC1_DATA7 0x40001382 + MX93_PAD_SD1_STROBE__USDHC1_STROBE 0x1582 + >; + }; + + /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp { + fsl,pins = < + MX93_PAD_SD1_CLK__USDHC1_CLK 0x158e + MX93_PAD_SD1_CMD__USDHC1_CMD 0x4000138e + MX93_PAD_SD1_DATA0__USDHC1_DATA0 0x4000138e + MX93_PAD_SD1_DATA1__USDHC1_DATA1 0x4000138e + MX93_PAD_SD1_DATA2__USDHC1_DATA2 0x4000138e + MX93_PAD_SD1_DATA3__USDHC1_DATA3 0x4000138e + MX93_PAD_SD1_DATA4__USDHC1_DATA4 0x4000138e + MX93_PAD_SD1_DATA5__USDHC1_DATA5 0x4000138e + MX93_PAD_SD1_DATA6__USDHC1_DATA6 0x4000138e + MX93_PAD_SD1_DATA7__USDHC1_DATA7 0x4000138e + MX93_PAD_SD1_STROBE__USDHC1_STROBE 0x158e + >; + }; + + /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp { + fsl,pins = < + MX93_PAD_SD1_CLK__USDHC1_CLK 0x15fe + MX93_PAD_SD1_CMD__USDHC1_CMD 0x400013fe + MX93_PAD_SD1_DATA0__USDHC1_DATA0 0x400013fe + MX93_PAD_SD1_DATA1__USDHC1_DATA1 0x400013fe + MX93_PAD_SD1_DATA2__USDHC1_DATA2 0x400013fe + MX93_PAD_SD1_DATA3__USDHC1_DATA3 0x400013fe + MX93_PAD_SD1_DATA4__USDHC1_DATA4 0x400013fe + MX93_PAD_SD1_DATA5__USDHC1_DATA5 0x400013fe + MX93_PAD_SD1_DATA6__USDHC1_DATA6 0x400013fe + MX93_PAD_SD1_DATA7__USDHC1_DATA7 0x400013fe + MX93_PAD_SD1_STROBE__USDHC1_STROBE 0x15fe + >; + }; + + pinctrl_usdhc2_gpio: usdhc2gpiogrp { + fsl,pins = < + MX93_PAD_SD2_CD_B__GPIO3_IO00 0x31e + >; + }; + + pinctrl_usdhc2_gpio_sleep: usdhc2gpiosleepgrp { + fsl,pins = < + MX93_PAD_SD2_CD_B__GPIO3_IO00 0x51e + >; + }; + + /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_usdhc2: usdhc2grp { + fsl,pins = < + MX93_PAD_SD2_CLK__USDHC2_CLK 0x1582 + MX93_PAD_SD2_CMD__USDHC2_CMD 0x40001382 + MX93_PAD_SD2_DATA0__USDHC2_DATA0 0x40001382 + MX93_PAD_SD2_DATA1__USDHC2_DATA1 0x40001382 + MX93_PAD_SD2_DATA2__USDHC2_DATA2 0x40001382 + MX93_PAD_SD2_DATA3__USDHC2_DATA3 0x40001382 + MX93_PAD_SD2_VSELECT__USDHC2_VSELECT 0x51e + >; + }; + + /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { + fsl,pins = < + MX93_PAD_SD2_CLK__USDHC2_CLK 0x158e + MX93_PAD_SD2_CMD__USDHC2_CMD 0x4000138e + MX93_PAD_SD2_DATA0__USDHC2_DATA0 0x4000138e + MX93_PAD_SD2_DATA1__USDHC2_DATA1 0x4000138e + MX93_PAD_SD2_DATA2__USDHC2_DATA2 0x4000138e + MX93_PAD_SD2_DATA3__USDHC2_DATA3 0x4000138e + MX93_PAD_SD2_VSELECT__USDHC2_VSELECT 0x51e + >; + }; + + /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { + fsl,pins = < + MX93_PAD_SD2_CLK__USDHC2_CLK 0x15fe + MX93_PAD_SD2_CMD__USDHC2_CMD 0x400013fe + MX93_PAD_SD2_DATA0__USDHC2_DATA0 0x400013fe + MX93_PAD_SD2_DATA1__USDHC2_DATA1 0x400013fe + MX93_PAD_SD2_DATA2__USDHC2_DATA2 0x400013fe + MX93_PAD_SD2_DATA3__USDHC2_DATA3 0x400013fe + MX93_PAD_SD2_VSELECT__USDHC2_VSELECT 0x51e + >; + }; + + pinctrl_usdhc2_sleep: usdhc2-sleepgrp { + fsl,pins = < + MX93_PAD_SD2_CLK__GPIO3_IO01 0x51e + MX93_PAD_SD2_CMD__GPIO3_IO02 0x51e + MX93_PAD_SD2_DATA0__GPIO3_IO03 0x51e + MX93_PAD_SD2_DATA1__GPIO3_IO04 0x51e + MX93_PAD_SD2_DATA2__GPIO3_IO05 0x51e + MX93_PAD_SD2_DATA3__GPIO3_IO06 0x51e + MX93_PAD_SD2_VSELECT__GPIO3_IO19 0x51e + >; + }; + + pinctrl_wdog: wdoggrp { + fsl,pins = < + MX93_PAD_WDOG_ANY__WDOG1_WDOG_ANY 0x31e + >; + }; +};
arch/arm64/boot/dts/freescale/imx93-11x11-frdm.dts +6 -673
736 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 998/2651 arm64: dts: imx93-11x11-frdm: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit ab6fc27a020a18a765e17bc445b64ee18b6244de ]
The imx_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "vdevbuffer", the check fails and the region gets unnecessarily mapped. Rename it to "vdev0buffer" to match what the driver expects.
--- arch/arm64/boot/dts/freescale/imx93-11x11-frdm-common.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx93-11x11-frdm-common.dtsi +2 -2
@@ -99,7 +99,7 @@ vdev1vring1: vdev1vring1@a4018000 { no-map; }; - vdevbuffer: vdevbuffer@a4020000 { + vdev0buffer: vdev0buffer@a4020000 { compatible = "shared-dma-pool"; reg = <0 0xa4020000 0 0x100000>; no-map;
@@ -121,7 +121,7 @@ &cm33 { <&mu1 1 1>, <&mu1 3 1>; mbox-names = "tx", "rx", "rxdb"; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 999/2651 arm64: dts: imx93-14x14-evk: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit e62f7ef5320d05361ee7f665568d05361b0c59d9 ]
The imx_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "vdevbuffer", the check fails and the region gets unnecessarily mapped. Rename it to "vdev0buffer" to match what the driver expects.
--- arch/arm64/boot/dts/freescale/imx93-14x14-evk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx93-14x14-evk.dts +2 -2
@@ -75,7 +75,7 @@ rsc_table: rsc-table@2021e000 { no-map; }; - vdevbuffer: vdevbuffer@a4020000 { + vdev0buffer: vdev0buffer@a4020000 { compatible = "shared-dma-pool"; reg = <0 0xa4020000 0 0x100000>; no-map;
@@ -222,7 +222,7 @@ &cm33 { mboxes = <&mu1 0 1>, <&mu1 1 1>, <&mu1 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1000/2651 arm64: dts: imx93-9x9-qsb: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 475a58b82921cc89805b31e0bc1df91681124a3d ]
The imx_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "vdevbuffer", the check fails and the region gets unnecessarily mapped. Rename it to "vdev0buffer" to match what the driver expects.
--- arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts +2 -2
@@ -76,7 +76,7 @@ rsc_table: rsc-table@2021e000 { no-map; }; - vdevbuffer: vdevbuffer@a4020000 { + vdev0buffer: vdev0buffer@a4020000 { compatible = "shared-dma-pool"; reg = <0 0xa4020000 0 0x100000>; no-map;
@@ -212,7 +212,7 @@ &cm33 { mboxes = <&mu1 0 1>, <&mu1 1 1>, <&mu1 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1001/2651 arm64: dts: imx8dxl-sr-som: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit d8aa7355f91ed71502f588d33200a211f24f58ef ]
The imx_rproc driver uses node names to identify reserved memory regions. It checks for "vdev0buffer" to skip mapping, "rsc-table" to locate the resource table, and "vdev" prefix to filter vdev regions.
Rename the reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx8dxl-sr-som.dtsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/freescale/imx8dxl-sr-som.dtsi +7 -7
@@ -26,7 +26,7 @@ imx8dxl-cm4 { clocks = <&clk_dummy>; mboxes = <&lsio_mu5 0 1 &lsio_mu5 1 1 &lsio_mu5 3 1>; mbox-names = "tx", "rx", "rxdb"; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; power-domains = <&pd IMX_SC_R_M4_0_PID0>, <&pd IMX_SC_R_M4_0_MU_1A>; fsl,entry-address = <0x34fe0000>;
@@ -103,32 +103,32 @@ linux,cma { linux,cma-default; }; - vdev0vring0: memory0@90000000 { + vdev0vring0: vdev0vring0@90000000 { reg = <0 0x90000000 0 0x8000>; no-map; }; - vdev0vring1: memory@90008000 { + vdev0vring1: vdev0vring1@90008000 { reg = <0 0x90008000 0 0x8000>; no-map; }; - vdev1vring0: memory@90010000 { + vdev1vring0: vdev1vring0@90010000 { reg = <0 0x90010000 0 0x8000>; no-map; }; - vdev1vring1: memory@90018000 { + vdev1vring1: vdev1vring1@90018000 { reg = <0 0x90018000 0 0x8000>; no-map; }; - rsc_table: memory-rsc-table@900ff000 { + rsc_table: rsc-table@900ff000 { reg = <0 0x900ff000 0 0x1000>; no-map; }; - vdevbuffer: memory-vdevbuffer@90400000 { + vdev0buffer: vdev0buffer@90400000 { compatible = "shared-dma-pool"; reg = <0 0x90400000 0 0x100000>; no-map;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1002/2651 arm64: dts: imx93-11x11-evk: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 7e92e62246c472418230b48c05e9296835b26b07 ]
The imx_rproc driver checks for the name "vdev0buffer" to skip mapping the vdev buffer region, as it is handled by rproc_add_virtio_dev. With the node named "vdevbuffer", the check fails and the region gets unnecessarily mapped. Rename it to "vdev0buffer" to match what the driver expects.
--- arch/arm64/boot/dts/freescale/imx93-11x11-evk-common.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx93-11x11-evk-common.dtsi +2 -2
@@ -67,7 +67,7 @@ rsc_table: rsc-table@2021e000 { no-map; }; - vdevbuffer: vdevbuffer@a4020000 { + vdev0buffer: vdev0buffer@a4020000 { compatible = "shared-dma-pool"; reg = <0 0xa4020000 0 0x100000>; no-map;
@@ -170,7 +170,7 @@ &cm33 { mboxes = <&mu1 0 1>, <&mu1 1 1>, <&mu1 3 1>; - memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, + memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1003/2651 arm64: dts: imx95-15x15-frdm: fix reserved memory node names for remoteproc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 5cae743b988da033a709bfa10739b1d34fe57e71 ]
The imx_rproc driver uses node names to identify reserved memory regions. It checks for "vdev0buffer" to skip mapping, "rsc-table" to locate the resource table, and "vdev" prefix to filter vdev regions.
Rename the reserved memory nodes to use the expected names so the driver can correctly identify and handle each region.
--- arch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts +6 -6
@@ -188,33 +188,33 @@ linux_cma: linux,cma { linux,cma-default; }; - vdev0vring0: memory@88000000 { + vdev0vring0: vdev0vring0@88000000 { reg = <0 0x88000000 0 0x8000>; no-map; }; - vdev0vring1: memory@88008000 { + vdev0vring1: vdev0vring1@88008000 { reg = <0 0x88008000 0 0x8000>; no-map; }; - vdev1vring0: memory@88010000 { + vdev1vring0: vdev1vring0@88010000 { reg = <0 0x88010000 0 0x8000>; no-map; }; - vdev1vring1: memory@88018000 { + vdev1vring1: vdev1vring1@88018000 { reg = <0 0x88018000 0 0x8000>; no-map; }; - vdevbuffer: memory@88020000 { + vdev0buffer: vdev0buffer@88020000 { compatible = "shared-dma-pool"; reg = <0 0x88020000 0 0x100000>; no-map; }; - rsc_table: memory@88220000 { + rsc_table: rsc-table@88220000 { reg = <0 0x88220000 0 0x1000>; no-map; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1004/2651 PCI/IOV: Read VF config values that need not match PF
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Logan Odell <[email protected]>
[ Upstream commit ae43799529c480510dcc14bd0ed141a1d85b9259 ]
Per PCIe r7.0, sec 7.5.1.1.5 and 7.5.1.2.3, VF Revision IDs and Subsystem IDs may differ from the PF's. Read these values from VF config space instead of using cached values from VF 0.
Per 7.5.1.1.6 and 7.5.1.2.3, VF Class Codes and Subsystem Vendor IDs must be the same as the PF's. Use the PF's value instead of reading from VF config space.
Per 7.5.1.1.9, the Header Type for a VF must be 0, so hardcode that assignment.
--- drivers/pci/iov.c | 25 ------------------------- drivers/pci/pci.h | 4 ---- drivers/pci/probe.c | 15 ++++++++++----- 3 files changed, 10 insertions(+), 34 deletions(-)
drivers/pci/iov.c +0 -25
@@ -179,29 +179,6 @@ bool pci_iov_is_memory_decoding_enabled(struct pci_dev *dev)return cmd &PCI_SRIOV_CTRL_MSE ; } -static void pci_read_vf_config_common (struct pci_dev *virtfn) -{ -struct pci_dev *physfn = virtfn->physfn; - -/* -* Some config registers are the same across all associated VFs. -* Read them once from VF0 so we can skip reading them from the -* other VFs. -* -* PCIe r4.0, sec 9.3.4.1, technically doesn't require all VFs to -* have the same Revision ID and Subsystem ID, but we assume they -* do. -*/ -pci_read_config_dword (virtfn,PCI_CLASS_REVISION , - &physfn->sriov->class); -pci_read_config_byte (virtfn,PCI_HEADER_TYPE , - &physfn->sriov->hdr_type); -pci_read_config_word (virtfn,PCI_SUBSYSTEM_VENDOR_ID , - &physfn->sriov->subsystem_vendor); -pci_read_config_word (virtfn,PCI_SUBSYSTEM_ID , - &physfn->sriov->subsystem_device); -} -int pci_iov_sysfs_link (struct pci_dev *dev,struct pci_dev *virtfn,int id) {
@@ -329,8 +306,6 @@ static struct pci_dev *pci_iov_scan_device(struct pci_dev *dev, int id, virtfn->physfn =pci_dev_get (dev); virtfn->no_command_memory =1 ; -if (id ==0 ) -pci_read_vf_config_common (virtfn); rc =pci_setup_device (virtfn);if (rc) {
drivers/pci/pci.h +0 -4
@@ -711,10 +711,6 @@ struct pci_sriov {u16 driver_max_VFs;/* Max num VFs driver supports */ struct pci_dev *dev;/* Lowest numbered PF */ struct pci_dev *self;/* This PF */ -u32 class;/* VF device */ -u8 hdr_type;/* VF header type */ -u16 subsystem_vendor;/* VF subsystem vendor */ -u16 subsystem_device;/* VF subsystem device */ resource_size_t barsz[PCI_SRIOV_NUM_BARS ];/* VF BAR size */ u16 vf_rebar_cap;/* VF Resizable BAR capability offset */ bool drivers_autoprobe;/* Auto probing of VFs by driver */
drivers/pci/probe.c +10 -5
@@ -1892,8 +1892,13 @@ static u32 pci_class(struct pci_dev *dev)u32 class;#ifdef CONFIG_PCI_IOV -if (dev->is_virtfn) -return dev->physfn->sriov->class; +if (dev->is_virtfn) { +u8 rev; + +if (pci_read_config_byte (dev,PCI_REVISION_ID , &rev)) + rev =0 ; +return (dev->physfn->class <<8 ) | rev; + }#endif pci_read_config_dword (dev,PCI_CLASS_REVISION , &class);return class;
@@ -1903,8 +1908,8 @@ static void pci_subsystem_ids(struct pci_dev *dev, u16 *vendor, u16 *device) {#ifdef CONFIG_PCI_IOV if (dev->is_virtfn) { - *vendor = dev->physfn->sriov->subsystem_vendor; - *device = dev->physfn->sriov->subsystem_device; + *vendor = dev->physfn->subsystem_vendor; +pci_read_config_word (dev,PCI_SUBSYSTEM_ID , device);return ; }#endif
@@ -1918,7 +1923,7 @@ static u8 pci_hdr_type(struct pci_dev *dev)#ifdef CONFIG_PCI_IOV if (dev->is_virtfn) -return dev->physfn->sriov->hdr_type; +return 0 ;#endif pci_read_config_byte (dev,PCI_HEADER_TYPE , &hdr_type);return hdr_type;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1005/2651 swim: Return -EROFS when opened with BLK_OPEN_WRITE flag
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit d8fe777978a12a96cb5d10d6d888720fcba2da2b ]
Write requests are not supported by the driver and produce IO errors as shown below. Avoid this by returning -EROFS when opened for writing.
[ 4111.690000] I/O error, dev fd0, sector 2 op 0x1:(WRITE) flags 0x800800 phys_seg 1 prio class 2 [ 4111.700000] Buffer I/O error on dev fd0, logical block 2, lost async page write
--- drivers/block/swim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/swim.c +2 -1
@@ -630,7 +630,8 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)if (mode & (BLK_OPEN_READ |BLK_OPEN_WRITE )) {if (disk_check_media_change (disk) && fs->disk_in) fs->ejected =0 ; -if ((mode &BLK_OPEN_WRITE ) && fs->write_protected) { +if (mode &BLK_OPEN_WRITE ) { +/* Write support isn't implemented. */ err = -EROFS ; goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1006/2651 swim: Fix FDEJECT ioctl for exclusive open
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit c76b93df9ae61d8ddebf6aa3bc218252f85e80c6 ]
The eject command from the util-linux package does not work with the swim
driver: the drive doesn't eject anything and the command fails. Apparently, ioctl(fd, FDEJECT) returns -EBUSY when fd is opened O_EXCL. Fix this by checking ref_count for either 1 or -1. Either value means that the caller is the sole user of the disk.
--- drivers/block/swim.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/block/swim.c +4 -3
@@ -691,10 +691,11 @@ static int floppy_ioctl(struct block_device *bdev, blk_mode_t mode,switch (cmd) {case FDEJECT : -if (fs->ref_count !=1 ) -return -EBUSY ;mutex_lock (&swim_mutex); - err =floppy_eject (fs); +if (fs->ref_count ==-1 || fs->ref_count ==1 ) + err =floppy_eject (fs); +else + err = -EBUSY ;mutex_unlock (&swim_mutex);return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1007/2651 swim3: Fix FDEJECT ioctl for exclusive open
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit ce054fbe9a4bf4ffefef0f8e2504ea54da058ed2 ]
The eject command from the util-linux package does not work with the swim3 driver: the drive doesn't eject anything and the command fails. Apparently, ioctl(fd, FDEJECT) returns -EBUSY after fd was opened O_EXCL. Fix this by checking ref_count for either 1 or -1. Either value means that the caller is the sole user of the disk.
--- drivers/block/swim3.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/block/swim3.c +3 -5
@@ -887,7 +887,6 @@ static int floppy_locked_ioctl(struct block_device *bdev, blk_mode_t mode, unsigned int cmd, unsigned long param) {struct floppy_state *fs = bdev->bd_disk->private_data; -int err;if ((cmd &0x80 ) && !capable (CAP_SYS_ADMIN ))return -EPERM ;
@@ -898,10 +897,9 @@ static int floppy_locked_ioctl(struct block_device *bdev, blk_mode_t mode,switch (cmd) {case FDEJECT : -if (fs->ref_count !=1 ) -return -EBUSY ; - err =fd_eject (fs); -return err; +if (fs->ref_count ==-1 || fs->ref_count ==1 ) +return fd_eject (fs); +return -EBUSY ;case FDGETPRM :if (copy_to_user ((void __user *) param, &floppy_type,sizeof (struct floppy_struct )))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1008/2651 wifi: nxpwifi: fix return value check in change_vif_to_sta/ap
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Chen <[email protected]>
[ Upstream commit f833415e49981bee131841e805da3f24b90a7524 ]
nxpwifi_change_vif_to_sta() and nxpwifi_change_vif_to_ap() both call nxpwifi_set_bss_mode() without storing the return value, then check 'if (ret)' which tests the stale value from the previous call. The 'if (ret) goto done' is therefore dead code, and errors from nxpwifi_set_bss_mode() are silently ignored.
Fix this by assigning the return value to ret, so the existing error path works correctly.
--- drivers/net/wireless/nxp/nxpwifi/cfg80211.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/nxp/nxpwifi/cfg80211.c +2 -4
@@ -844,8 +844,7 @@ nxpwifi_change_vif_to_sta(struct net_device *dev,update_vif_type_counter (adapter, type,1 ); dev->ieee80211_ptr->iftype = type; -if (nxpwifi_set_bss_mode (priv)) -return -1 ; + ret =nxpwifi_set_bss_mode (priv);if (ret) goto done;
@@ -888,8 +887,7 @@ nxpwifi_change_vif_to_ap(struct net_device *dev,update_vif_type_counter (adapter, type,1 ); dev->ieee80211_ptr->iftype = type; -if (nxpwifi_set_bss_mode (priv)) -return -1 ; + ret =nxpwifi_set_bss_mode (priv);if (ret) goto done;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1009/2651 RDMA/bnxt_re: Fix integer overflow in send payload size computation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 3483cbbd7487163345b4b4d5eb8cad8540d1c3ba ]
bnxt_re_build_sgl() summed SGE lengths into a signed int, which could overflow. Make it return u32, and have bnxt_re_copy_wr_payload() report the size via a u32 out-parameter with the return value carrying only the error status, instead of overloading a signed int with both.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 44 +++++++++++++----------- 1 file changed, 24 insertions(+), 20 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +24 -20
@@ -165,10 +165,11 @@ static void bnxt_re_check_and_set_relaxed_ordering(struct bnxt_re_dev *rdev, qplib_mr->flags |=CMDQ_REGISTER_MR_FLAGS_ENABLE_RO ; } -static int bnxt_re_build_sgl (struct ib_sge *ib_sg_list, +static u32 bnxt_re_build_sgl (struct ib_sge *ib_sg_list,struct bnxt_qplib_sge *sg_list,int num) { -int i, total =0 ; +u32 total =0 ; +int i;for (i =0 ; i < num; i++) { sg_list[i].addr = ib_sg_list[i].addr;
@@ -3185,17 +3186,22 @@ static int bnxt_re_copy_inline_data(struct bnxt_re_dev *rdev,static int bnxt_re_copy_wr_payload (struct bnxt_re_dev *rdev,const struct ib_send_wr *wr, -struct bnxt_qplib_swqe *wqe) +struct bnxt_qplib_swqe *wqe, +u32 *payload_sz) { -int payload_sz =0 ; +int rc; -if (wr->send_flags &IB_SEND_INLINE ) - payload_sz =bnxt_re_copy_inline_data (rdev, wr, wqe); -else - payload_sz =bnxt_re_build_sgl (wr->sg_list, wqe->sg_list, - wqe->num_sge); +if (wr->send_flags &IB_SEND_INLINE ) { + rc =bnxt_re_copy_inline_data (rdev, wr, wqe); +if (rc <0 ) +return rc; + *payload_sz = rc; + }else { + *payload_sz =bnxt_re_build_sgl (wr->sg_list, wqe->sg_list, + wqe->num_sge); + } -return payload_sz; +return 0 ; }static void bnxt_ud_qp_hw_stall_workaround (struct bnxt_re_qp *qp)
@@ -3218,7 +3224,8 @@ static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp, const struct ib_send_wr *wr) { - int rc = 0, payload_sz = 0; + int rc = 0; +u32 payload_sz =0 ;unsigned long flags;spin_lock_irqsave (&qp->sq_lock, flags);
@@ -3234,11 +3241,9 @@ static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev, goto bad; } - payload_sz =bnxt_re_copy_wr_payload (qp->rdev, wr, &wqe); -if (payload_sz <0 ) { - rc = -EINVAL ; + rc =bnxt_re_copy_wr_payload (qp->rdev, wr, &wqe, &payload_sz); +if (rc) goto bad; - } wqe.wr_id = wr->wr_id; wqe.type =BNXT_QPLIB_SWQE_TYPE_SEND ;
@@ -3279,7 +3284,8 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr, { struct bnxt_re_qp *qp = container_of(ib_qp, struct bnxt_re_qp, ib_qp);struct bnxt_qplib_swqe wqe; -int rc =0 , payload_sz =0 ; +int rc =0 ; +u32 payload_sz =0 ;unsigned long flags;spin_lock_irqsave (&qp->sq_lock, flags);
@@ -3296,11 +3302,9 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr, goto bad; } - payload_sz =bnxt_re_copy_wr_payload (qp->rdev, wr, &wqe); -if (payload_sz <0 ) { - rc = -EINVAL ; + rc =bnxt_re_copy_wr_payload (qp->rdev, wr, &wqe, &payload_sz); +if (rc) goto bad; - } wqe.wr_id = wr->wr_id;switch (wr->opcode) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1010/2651 RDMA/bnxt_re: Detect wrong sge_len passed for inline
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 81551ece0864c346080d241719d458c93f0e7fc9 ]
Avoid handling wrong sge_len by adding extra check to see if the passed length is more than the inline size supported.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 -2
@@ -3169,8 +3169,9 @@ static int bnxt_re_copy_inline_data(struct bnxt_re_dev *rdev, wr->sg_list[i].addr; sge_len = wr->sg_list[i].length; -if ((sge_len + wqe->inline_len) > -BNXT_QPLIB_SWQE_MAX_INLINE_LENGTH ) { +if (sge_len >BNXT_QPLIB_SWQE_MAX_INLINE_LENGTH || + ((sge_len + wqe->inline_len) > +BNXT_QPLIB_SWQE_MAX_INLINE_LENGTH )) {ibdev_err (&rdev->ibdev,"Inline data size requested > supported value" );return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1011/2651 RDMA/bnxt_re: Validate SRQ max_sge at create time
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 1894ed9a664d19c190ce1bd2146759efbae77e4b ]
bnxt_re_create_srq() stored attr.max_sge into srq->qplib_srq.max_sge unvalidated, which defeats the num_sge check in bnxt_re_post_srq_recv() since that check compares against this same attacker-chosen value. Reject max_sge > dev_attr->max_srq_sges at create time, and clamp dev_attr->max_srq_sges to BNXT_STATIC_MAX_SGE since SRQ WQEs use the fixed-size SGE array.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 ++++++++ drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +8 -0
@@ -2236,6 +2236,14 @@ int bnxt_re_create_srq(struct ib_srq *ib_srq, goto exit; } +if (srq_init_attr->attr.max_sge > dev_attr->max_srq_sges) { +ibdev_err (&rdev->ibdev, +"Create SRQ failed - max_sge %d exceeds supported %d" , + srq_init_attr->attr.max_sge, dev_attr->max_srq_sges); + rc = -EINVAL ; + goto exit; + } +if (srq_init_attr->srq_type !=IB_SRQT_BASIC ) { rc = -EOPNOTSUPP ; goto exit;
drivers/infiniband/hw/bnxt_re/qplib_sp.c +1 -1
@@ -160,7 +160,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw) attr->max_srq =le16_to_cpu (sb->max_srq); attr->max_srq_wqes =le32_to_cpu (sb->max_srq_wr) -1 ; - attr->max_srq_sges = sb->max_srq_sge; + attr->max_srq_sges =min_t (u32, sb->max_srq_sge,BNXT_STATIC_MAX_SGE ); attr->max_pkey =1 ; attr->max_inline_data = attr->max_qp_sges *sizeof (struct sq_sge );if (!bnxt_qplib_is_chip_gen_p7 (rcfw->res->cctx))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1012/2651 RDMA/bnxt_re: Initialize wqe.flags in bnxt_re_post_srq_recv()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 4d8168a3b7c93385c11dc836df569d337089b218 ]
wqe is declared once above the WR loop and never zeroed, so wqe.flags holds indeterminate stack contents on the first WR and the previous WR's stale value thereafter. This propagates straight into the hardware-visible srqe->flags in bnxt_qplib_post_srq_recv().
Most values of the wqe struct is set except flags. So initialize flags also.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -0
@@ -2397,6 +2397,7 @@ int bnxt_re_post_srq_recv(struct ib_srq *ib_srq, const struct ib_recv_wr *wr,spin_lock_irqsave (&srq->lock, flags);while (wr) {/* Transcribe each ib_recv_wr to qplib_swqe */ + wqe.flags =0 ; wqe.num_sge = wr->num_sge;bnxt_re_build_sgl (wr->sg_list, wqe.sg_list, wr->num_sge); wqe.wr_id = wr->wr_id;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1013/2651 RDMA/bnxt_re: Serialize dcb_wq access against async notifier
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 81caf9240dfb082c0eb2b24feef8266268fd152f ]
bnxt_re_async_notifier() runs in NAPI/softirq context via bnxt_en's RCU-protected ULP ops dispatch, never under rtnl_lock, so it isn't serialized against bnxt_re_uninit_dcb_wq() destroying rdev->dcb_wq. A concurrent notifier call can queue_work() on a workqueue that is being, or has just been, destroyed.
Add a spinlock scoped to dcb_wq: the notifier takes it before checking dcb_wq and queuing work, and bnxt_re_uninit_dcb_wq() takes it to atomically clear dcb_wq before destroying it. Initialize the lock at rdev allocation so it is valid on every teardown path, including bnxt_re_dev_init()'s early failure labels.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 4 ++++ drivers/infiniband/hw/bnxt_re/main.c | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +4 -0
@@ -216,6 +216,10 @@ struct bnxt_re_dev {unsigned long event_bitmap;struct bnxt_qplib_cc_param cc_param;struct workqueue_struct *dcb_wq; +/* Protects dcb_wq against bnxt_re_uninit_dcb_wq() destroying it +* concurrently with bnxt_re_async_notifier() queuing work on it. +*/ +spinlock_t dcb_lock;struct dentry *cc_config;struct bnxt_re_dbg_cc_config_params *cc_config_params;struct dentry *cq_coal_cfg;
drivers/infiniband/hw/bnxt_re/main.c +20 -4
@@ -367,9 +367,15 @@ static int bnxt_re_init_dcb_wq(struct bnxt_re_dev *rdev)static void bnxt_re_uninit_dcb_wq (struct bnxt_re_dev *rdev) { -if (!rdev->dcb_wq) -return ; -destroy_workqueue (rdev->dcb_wq); +struct workqueue_struct *dcb_wq; + +spin_lock_bh (&rdev->dcb_lock); + dcb_wq = rdev->dcb_wq; + rdev->dcb_wq =NULL ; +spin_unlock_bh (&rdev->dcb_lock); + +if (dcb_wq) +destroy_workqueue (dcb_wq); }static void bnxt_re_dcb_wq_task (struct work_struct *work)
@@ -424,14 +430,23 @@ static void bnxt_re_async_notifier(void *handle, struct hwrm_async_event_cmpl *cswitch (event_id) {case ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE : +spin_lock (&rdev->dcb_lock); +if (!rdev->dcb_wq) { +spin_unlock (&rdev->dcb_lock); +break ; + } + dcb_work =kzalloc_obj (*dcb_work,GFP_ATOMIC ); -if (!dcb_work) +if (!dcb_work) { +spin_unlock (&rdev->dcb_lock);break ; + } dcb_work->rdev = rdev;memcpy (&dcb_work->cmpl, cmpl,sizeof (*cmpl));INIT_WORK (&dcb_work->work, bnxt_re_dcb_wq_task);queue_work (rdev->dcb_wq, &dcb_work->work); +spin_unlock (&rdev->dcb_lock);break ;default :break ;
@@ -1448,6 +1463,7 @@ static struct bnxt_re_dev *bnxt_re_dev_add(struct auxiliary_device *adev,INIT_LIST_HEAD (&rdev->qp_list);mutex_init (&rdev->qp_lock);mutex_init (&rdev->pacing.dbq_lock); +spin_lock_init (&rdev->dcb_lock);atomic_set (&rdev->stats.res.qp_count,0 );atomic_set (&rdev->stats.res.cq_count,0 );atomic_set (&rdev->stats.res.srq_count,0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1014/2651 RDMA/bnxt_re: Fix the PD and DPI table size
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit aa6c2ef821a6ba7f3fd58cfcc031b2d16f3811c6 ]
The PD and DPI bitmaps were sized as max >> 3 (bytes), but bitmap ops (set_bit(), clear_bit(), find_first_bit(), test_and_set_bit()) operate on whole unsigned long words, so whenever max isn't a multiple of BITS_PER_LONG,
the buffer under-allocates and the top word's bitops read/write past the end of the kmalloc()'d buffer. Most exposed on the DPI table, since dpit->max comes from the firmware-reported dev_attr->max_dpi with no alignment guarantee.
Fix the size of both allocations withBITS_TO_LONGS(max) * sizeof(unsigned long).
--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_res.c +5 -4
@@ -45,6 +45,7 @@#include <linux/dma-mapping.h> #include <linux/if_vlan.h> #include <linux/vmalloc.h> +#include <linux/bitops.h> #include <rdma/ib_verbs.h> #include <rdma/iter.h>
@@ -668,9 +669,9 @@ static int bnxt_qplib_alloc_pd_tbl(struct bnxt_qplib_res *res, {u32 bytes; - bytes = max >>3 ; + bytes =BITS_TO_LONGS (max) *sizeof (unsigned long );if (!bytes) - bytes =1 ; + bytes =sizeof (unsigned long ); pdt->tbl =kmalloc (bytes,GFP_KERNEL );if (!pdt->tbl)return -ENOMEM ;
@@ -848,9 +849,9 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,if (!dpit->app_tbl)return -ENOMEM ; - bytes = dpit->max >>3 ; + bytes =BITS_TO_LONGS (dpit->max) *sizeof (unsigned long );if (!bytes) - bytes =1 ; + bytes =sizeof (unsigned long ); dpit->tbl =kmalloc (bytes,GFP_KERNEL );if (!dpit->tbl) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1015/2651 RDMA/bnxt_re: Use bnxt_ext_stats_supported for counter count selection
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 7cc8ccb157a4769c8fbce8296532dcb8a8ea0d5e ]
Selecting between BNXT_RE_NUM_EXT_COUNTERS and BNXT_RE_NUM_STD_COUNTERS relied only on bnxt_qplib_is_chip_gen_p5_p7(), which doesn't account for the extended stats capability flag or the PF/VF restriction. Use bnxt_ext_stats_supported() instead, matching the check already used to populate the extended stats, so the counter count stays consistent with what gets filled in.
--- drivers/infiniband/hw/bnxt_re/hw_counters.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/hw_counters.c +4 -2
@@ -413,7 +413,8 @@ int bnxt_re_ib_get_hw_stats(struct ib_device *ibdev, } done: -return bnxt_qplib_is_chip_gen_p5_p7 (rdev->chip_ctx) ? +return bnxt_ext_stats_supported (rdev->chip_ctx, rdev->dev_attr->dev_cap_flags, + rdev->is_virtfn) ?BNXT_RE_NUM_EXT_COUNTERS :BNXT_RE_NUM_STD_COUNTERS ; }
@@ -423,7 +424,8 @@ struct rdma_hw_stats *bnxt_re_ib_alloc_hw_port_stats(struct ib_device *ibdev,struct bnxt_re_dev *rdev =to_bnxt_re_dev (ibdev, ibdev);int num_counters =0 ; -if (bnxt_qplib_is_chip_gen_p5_p7 (rdev->chip_ctx)) +if (bnxt_ext_stats_supported (rdev->chip_ctx, rdev->dev_attr->dev_cap_flags, + rdev->is_virtfn)) num_counters =BNXT_RE_NUM_EXT_COUNTERS ;else num_counters =BNXT_RE_NUM_STD_COUNTERS ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1016/2651 media: venus: Drop session events without an instance
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 8921f6da06fd869b6f1aa8d02e40a4e2e2a45fe4 ]
hfi_process_msg_packet() intentionally allows HFI_MSG_EVENT_NOTIFY packets without a matching session instance because HFI_EVENT_SYS_ERROR is a system event and has no session attached.
That exception currently applies to every event-notify packet. If the firmware reports a late or otherwise invalid session event after to_instance() fails, hfi_event_notify() can dispatch it to session-only handlers such as event_seq_changed() or event_release_buffer_ref(), which dereference inst.
Only system errors are valid without a session instance. Drop other event notifications before the session event handlers can dereference a NULL inst.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/media/platform/qcom/venus/hfi_msgs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/qcom/venus/hfi_msgs.c +3 -0
@@ -230,6 +230,9 @@ static void hfi_event_notify(struct venus_core *core, struct venus_inst *inst,if (!packet)return ; +if (!inst && pkt->event_id !=HFI_EVENT_SYS_ERROR ) +return ; +switch (pkt->event_id) {case HFI_EVENT_SYS_ERROR :event_sys_error (core,EVT_SYS_ERROR , pkt);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1017/2651 media: iris: cancel sys error work on driver removal
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <[email protected]>
[ Upstream commit 4524809316482b64ff092afb7e7b0525ce137c75 ]
Cancel sys_error_handler before tearing down the driver.
The delayed work may still be pending when iris_remove() runs. Since iris_core is allocated with devm_kzalloc(), allowing the work to execute after driver removal could result in accessing freed memory.
--- drivers/media/platform/qcom/iris/iris_probe.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/qcom/iris/iris_probe.c +2 -0
@@ -251,6 +251,8 @@ static void iris_remove(struct platform_device *pdev)if (!core)return ; +cancel_delayed_work_sync (&core->sys_error_handler); +iris_core_deinit (core);video_unregister_device (core->vdev_dec);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1018/2651 rnull: configfs: add power to configfs features
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malte Wechter <[email protected]>
[ Upstream commit 0cd698e89375d0dfc257f9ae978420aa7fe5359d ]
features displayed by configfs for rnull was inconsistent with the actual features available. This correctly exposes power as a feature, which is also consistent with the C null_blk driver.
--- drivers/block/rnull/configfs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rnull/configfs.rs +1 -1
@@ -35,7 +35,7 @@ impl AttributeOperations<0> for Config {fn show (_this: &Config , page: &mut [u8 ;PAGE_SIZE ]) ->Result <usize > {let mut writer = kernel::str::Formatter ::new (page); - writer.write_str ("blocksize,size,rotational,irqmode\n" )?; + writer.write_str ("blocksize,size,rotational,irqmode,power\n" )?;Ok (writer.bytes_written ()) } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1019/2651 Revert "media: iris: Add Gen2 firmware autodetect and fallback"
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 6f4eb91fa27644ed57cbb43fa44ce8eea02bce0c ]
The commit 412a2e5955e0 ("media: iris: Add Gen2 firmware autodetect and fallback") added support for detecting the firmware HFI interface based on the firmware contents, but it has issues with the MDT split files and with synchronisation / locking. Revert the commit, it will be replaced by the better version.
--- .../media/platform/qcom/iris/iris_firmware.c | 119 +++--------------- .../platform/qcom/iris/iris_platform_common.h | 6 +- .../platform/qcom/iris/iris_platform_vpu2.c | 13 +- .../platform/qcom/iris/iris_platform_vpu3x.c | 10 +- drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_vidc.c | 3 - 6 files changed, 34 insertions(+), 121 deletions(-)
drivers/media/platform/qcom/iris/iris_firmware.c +17 -102
@@ -17,109 +17,20 @@#define MAX_FIRMWARE_NAME_SIZE 128 -/* Detect Gen2 firmware by scanning the blob for: -* QC_IMAGE_VERSION_STRING=<version> -* and then checking: -* - version starts with "vfw", OR -* - version matches "video-firmware.N.M" with N >= 2 -*/ - -static bool iris_detect_gen2_from_fwdata (const u8 *data,size_t size) -{ -static const char *marker ="QC_IMAGE_VERSION_STRING=" ; -const size_t mlen =strlen (marker); -static const char *vfw ="vfw" ; -const size_t vfwlen =strlen (vfw); -static const char *vf ="video-firmware." ; -const size_t vflen =strlen (vf); - -for (size_t i =0 ; i + mlen < size; i++) { -const char *found; - -if (memcmp (data + i, marker, mlen)) -continue ; - - found = data + i + mlen; - size -= i + mlen; - -/* vfw => Gen2 */ -if (size > vfwlen && !memcmp (found, vfw, vfwlen)) -return true; - -if (size < vflen || -memcmp (found, vf, vflen)) -return false; - - found += vflen; - size -= vflen; - -/* -* video-firmware.1.x is Gen1. -* video-firmware.2.x and video-firmware.10.x are Gen2. -*/ -return size >=2 && - (*found >='2' || (*found =='1' && found[1 ] !='.' )); - } - -return false; -} - -static const struct firmware *iris_detect_firmware (struct iris_core *core, -const char **fw_name) -{ -const struct firmware *firmware; -bool has_both_gens; -int ret; - - *fw_name =NULL ; -if (core->iris_platform_data->firmware_desc_gen2) - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen2; -else if (core->iris_platform_data->firmware_desc_gen1) - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen1; -else -return ERR_PTR (-EINVAL ); - - has_both_gens = core->iris_platform_data->firmware_desc_gen2 && - core->iris_platform_data->firmware_desc_gen1; - - ret =of_property_read_string_index (dev_of_node (core->dev),"firmware-name" ,0 , fw_name); -if (ret) { - *fw_name = core->iris_firmware_desc->fwname; - ret =request_firmware (&firmware, *fw_name, core->dev); -if (ret && has_both_gens) { - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen1; - *fw_name = core->iris_firmware_desc->fwname; - ret =request_firmware (&firmware, *fw_name, core->dev); - } - -return ret ?ERR_PTR (ret) : firmware; - } - - ret =request_firmware (&firmware, *fw_name, core->dev); -if (ret) -return ERR_PTR (ret); - -if (has_both_gens && - !iris_detect_gen2_from_fwdata ((const u8 *)firmware->data, firmware->size)) { -dev_info (core->dev,"Gen1 FW detected in %s\n" , *fw_name); - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen1; - } - -return firmware; -} - -static int iris_load_fw_to_memory (struct iris_core *core) +static int iris_load_fw_to_memory (struct iris_core *core,const char *fw_name) {const struct firmware *firmware =NULL ;struct device *dev = core->dev;struct resource res;phys_addr_t mem_phys; -const char *fw_name;size_t res_size;ssize_t fw_size;void *mem_virt;int ret; +if (strlen (fw_name) >=MAX_FIRMWARE_NAME_SIZE -4 ) +return -EINVAL ; + ret =of_reserved_mem_region_to_resource (dev->of_node,0 , &res);if (ret)return ret;
@@ -127,11 +38,9 @@ static int iris_load_fw_to_memory(struct iris_core *core) mem_phys = res.start; res_size =resource_size (&res); - firmware =iris_detect_firmware (core, &fw_name); -if (IS_ERR (firmware)) -return PTR_ERR (firmware); - - core->iris_firmware_data = core->iris_firmware_desc->firmware_data; + ret =request_firmware (&firmware, fw_name, dev); +if (ret) +return ret; fw_size =qcom_mdt_get_size (firmware);if (fw_size <0 || res_size < (size_t )fw_size) {
@@ -158,12 +67,18 @@ static int iris_load_fw_to_memory(struct iris_core *core)int iris_fw_load (struct iris_core *core) {const struct tz_cp_config *cp_config; +const char *fwpath =NULL ;int i, ret; - ret =iris_load_fw_to_memory (core); + ret =of_property_read_string_index (core->dev->of_node,"firmware-name" ,0 , + &fwpath); +if (ret) + fwpath = core->iris_firmware_desc->fwname; + + ret =iris_load_fw_to_memory (core, fwpath);if (ret) { -dev_err (core->dev,"firmware download failed %d\n" , ret); -return ret; +dev_err (core->dev,"firmware download failed\n" ); +return -ENOMEM ; } ret =qcom_pas_auth_and_reset (IRIS_PAS_ID );
@@ -185,7 +100,7 @@ int iris_fw_load(struct iris_core *core) } } -return 0 ; +return ret; }int iris_fw_unload (struct iris_core *core)
drivers/media/platform/qcom/iris/iris_platform_common.h +5 -1
@@ -292,7 +292,11 @@ struct iris_firmware_desc { };struct iris_platform_data { -const struct iris_firmware_desc *firmware_desc_gen1, *firmware_desc_gen2; +/* +* XXX: replace with gen1 / gen2 pointers once we have platforms +* supporting both firmware kinds. +*/ +const struct iris_firmware_desc *firmware_desc;const struct vpu_ops *vpu_ops;const struct icc_info *icc_tbl;
drivers/media/platform/qcom/iris/iris_platform_vpu2.c +3 -10
@@ -29,12 +29,6 @@ static const struct iris_firmware_desc iris_vpu20_p1_gen1_desc = { .fwname = "qcom/vpu/vpu20_p1.mbn", }; -static const struct iris_firmware_desc iris_vpu20_p1_gen2_s6_desc = { - .firmware_data = &iris_hfi_gen2_data, - .get_vpu_buffer_size = iris_vpu33_buf_size, - .fwname ="qcom/vpu/vpu20_p1_gen2_s6.mbn" , -}; -static const struct iris_firmware_desc iris_vpu20_p4_gen1_desc = { .firmware_data = &iris_hfi_gen1_data, .get_vpu_buffer_size = iris_vpu_buf_size,
@@ -78,7 +72,7 @@ static const struct tz_cp_config tz_cp_config_vpu2[] = { };const struct iris_platform_data milos_data = { - .firmware_desc_gen1 = &iris_milos_desc, + .firmware_desc = &iris_milos_desc, .vpu_ops = &iris_vpu2_ops, .icc_tbl = iris_icc_info_milos, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_milos),
@@ -106,8 +100,7 @@ const struct iris_platform_data milos_data = { };const struct iris_platform_data sc7280_data = { - .firmware_desc_gen1 = &iris_vpu20_p1_gen1_desc, - .firmware_desc_gen2 = &iris_vpu20_p1_gen2_s6_desc, + .firmware_desc = &iris_vpu20_p1_gen1_desc, .vpu_ops = &iris_vpu2_ops, .icc_tbl = iris_icc_info_vpu2, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu2),
@@ -136,7 +129,7 @@ const struct iris_platform_data sc7280_data = { };const struct iris_platform_data sm8250_data = { - .firmware_desc_gen1 = &iris_vpu20_p4_gen1_desc, + .firmware_desc = &iris_vpu20_p4_gen1_desc, .vpu_ops = &iris_vpu2_ops, .icc_tbl = iris_icc_info_vpu2, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu2),
drivers/media/platform/qcom/iris/iris_platform_vpu3x.c +5 -5
@@ -90,7 +90,7 @@ static const struct tz_cp_config tz_cp_config_vpu3[] = {* - inst_caps to platform_inst_cap_qcs8300 */ const struct iris_platform_data qcs8300_data = { - .firmware_desc_gen2 = &iris_vpu30_p4_s6_gen2_desc, + .firmware_desc = &iris_vpu30_p4_s6_gen2_desc, .vpu_ops = &iris_vpu3_ops, .icc_tbl = iris_icc_info_vpu3x, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu3x),
@@ -119,7 +119,7 @@ const struct iris_platform_data qcs8300_data = { };const struct iris_platform_data sm8550_data = { - .firmware_desc_gen2 = &iris_vpu30_p4_gen2_desc, + .firmware_desc = &iris_vpu30_p4_gen2_desc, .vpu_ops = &iris_vpu3_ops, .icc_tbl = iris_icc_info_vpu3x, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu3x),
@@ -154,7 +154,7 @@ const struct iris_platform_data sm8550_data = {* - controller_rst_tbl to sm8650_controller_reset_table */ const struct iris_platform_data sm8650_data = { - .firmware_desc_gen2 = &iris_vpu33_p4_gen2_desc, + .firmware_desc = &iris_vpu33_p4_gen2_desc, .vpu_ops = &iris_vpu33_ops, .icc_tbl = iris_icc_info_vpu3x, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu3x),
@@ -185,7 +185,7 @@ const struct iris_platform_data sm8650_data = { };const struct iris_platform_data sm8750_data = { - .firmware_desc_gen2 = &iris_vpu35_p4_gen2_desc, + .firmware_desc = &iris_vpu35_p4_gen2_desc, .vpu_ops = &iris_vpu35_ops, .icc_tbl = iris_icc_info_vpu3x, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu3x),
@@ -220,7 +220,7 @@ const struct iris_platform_data sm8750_data = {* - different num_vpp_pipe */ const struct iris_platform_data x1p42100_data = { - .firmware_desc_gen2 = &iris_vpu30_p1_gen2_desc, + .firmware_desc = &iris_vpu30_p1_gen2_desc, .vpu_ops = &iris_vpu3_ops, .icc_tbl = iris_icc_info_vpu3x, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_vpu3x),
drivers/media/platform/qcom/iris/iris_probe.c +4 -0
@@ -306,6 +306,8 @@ static int iris_probe(struct platform_device *pdev)return core->irq; core->iris_platform_data =of_device_get_match_data (core->dev); + core->iris_firmware_desc = core->iris_platform_data->firmware_desc; + core->iris_firmware_data = core->iris_firmware_desc->firmware_data; core->ubwc_cfg =qcom_ubwc_config_get_data ();if (IS_ERR (core->ubwc_cfg))
@@ -329,6 +331,8 @@ static int iris_probe(struct platform_device *pdev)if (ret)return ret; +iris_session_init_caps (core); + ret =v4l2_device_register (dev, &core->v4l2_dev);if (ret) goto err_unresv_iova_region;
drivers/media/platform/qcom/iris/iris_vidc.c +0 -3
@@ -9,7 +9,6 @@#include <media/v4l2-mem2mem.h> #include <media/videobuf2-dma-contig.h> -#include "iris_ctrls.h" #include "iris_vidc.h" #include "iris_instance.h" #include "iris_vdec.h"
@@ -197,8 +196,6 @@ int iris_open(struct file *filp) goto fail_m2m_release; } -iris_session_init_caps (core); -if (inst->domain ==DECODER ) ret =iris_vdec_inst_init (inst);else if (inst->domain ==ENCODER )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1020/2651 media: iris: fail firmware boot on invalid uc_region
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit f301102c17f22f4a140bd9a50281473e6b782f0c ]
iris_vpu_boot_firmware() polls CTRL_STATUS while the firmware boots. When the hardware reports an invalid uc_region setting, the poll loop breaks early with count still below max_tries. The following timeout check (count >= max_tries) is therefore false, so the function skips the error return and falls through to return 0, reporting a successful boot. The caller then enables host interrupts and proceeds to use firmware that never came up, which can lead to unhandled timeouts or hardware hangs.
Return an error directly from the uc_region error path instead of breaking out of the loop and reporting success.
--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_vpu_common.c +1 -1
@@ -84,7 +84,7 @@ int iris_vpu_boot_firmware(struct iris_core *core) ctrl_status =readl (core->reg_base +CTRL_STATUS );if ((ctrl_status &CTRL_ERROR_STATUS__M ) ==0x4 ) {dev_err (core->dev,"invalid setting for uc_region\n" ); -break ; +return -EINVAL ; }usleep_range (50 ,100 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1021/2651 media: iris: take core lock when scanning the instance list
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 428e6f95e685a06a73868aee95dd94dca7b3a027 ]
iris_check_session_supported() walks core->instances to confirm the current instance is registered, but does so without holding core->lock. A concurrent iris_close() takes core->lock and removes a (possibly different) instance from the list via list_del_init() before freeing it, so the lockless traversal can follow a freed pointer and dereference it, resulting in a use-after-free.
Hold core->lock across the list traversal, matching the other iterators over core->instances such as iris_check_core_mbpf(). The lock is dropped before iris_check_core_mbpf() is called so the nesting is unchanged.
--- drivers/media/platform/qcom/iris/iris_vb2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_vb2.c +5 -1
@@ -56,10 +56,14 @@ static int iris_check_session_supported(struct iris_inst *inst)bool found = false;int ret; +mutex_lock (&core->lock);list_for_each_entry (instance, &core->instances, list) { -if (instance == inst) +if (instance == inst) { found = true; +break ; + } } +mutex_unlock (&core->lock);if (!found) { ret = -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1022/2651 media: iris: guard against a NULL hfi_sys_ops in the interrupt handler
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 95f9e9fc9336ca4e8fb4ff0a76ddbde2f60bdb09 ]
core->hfi_sys_ops is populated only during core bring-up, once the firmware generation has been detected. iris_vpu_power_on() enables interrupts earlier than that, so an interrupt (for instance a spurious one) that fires in this window makes iris_hfi_isr_handler() unconditionally dereference a NULL core->hfi_sys_ops and panic.
Skip the response handler when hfi_sys_ops has not been set up yet; the interrupt is still acknowledged and the line re-enabled.
--- drivers/media/platform/qcom/iris/iris_hfi_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_hfi_common.c +2 -1
@@ -109,7 +109,8 @@ irqreturn_t iris_hfi_isr_handler(int irq, void *data)iris_vpu_clear_interrupt (core);mutex_unlock (&core->lock); - core->hfi_sys_ops->sys_hfi_response_handler (core); +if (core->hfi_sys_ops) + core->hfi_sys_ops->sys_hfi_response_handler (core);if (!iris_vpu_watchdog (core, core->intr_status))enable_irq (irq);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1023/2651 media: iris: reject open() when the session limit is reached
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 397ebadcbc219f6c20d11c0378d8cb7695d015c2 ]
iris_add_session() silently skips adding the instance to core->instances once max_session_count is reached, but returns void, so iris_open() continues as if it succeeded and hands a file descriptor back to userspace. As the instance is not on core->instances, firmware responses for it are dropped and every subsequent ioctl times out.
Make iris_add_session() return an error when the limit is reached and fail iris_open() accordingly, freeing the partially initialised instance.
--- drivers/media/platform/qcom/iris/iris_vidc.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/media/platform/qcom/iris/iris_vidc.c +13 -6
@@ -39,21 +39,23 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)v4l2_fh_exit (&inst->fh); } -static void iris_add_session (struct iris_inst *inst) +static int iris_add_session (struct iris_inst *inst) {struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; -mutex_lock (&core->lock); +guard (mutex)(&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) -list_add_tail (&inst->list, &core->instances); +if (count >= core->iris_platform_data->max_session_count) +return -EBUSY ; -mutex_unlock (&core->lock); +list_add_tail (&inst->list, &core->instances); + +return 0 ; }static void iris_remove_session (struct iris_inst *inst)
@@ -203,12 +205,17 @@ int iris_open(struct file *filp)if (ret) goto fail_m2m_ctx_release; -iris_add_session (inst); + ret =iris_add_session (inst); +if (ret) + goto fail_inst_deinit; inst->fh.m2m_ctx = inst->m2m_ctx;return 0 ; +fail_inst_deinit: +kfree (inst->fmt_src); +kfree (inst->fmt_dst); fail_m2m_ctx_release:v4l2_m2m_ctx_release (inst->m2m_ctx); fail_m2m_release:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1024/2651 media: iris: reference count video instances
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit af5f7df6c8b33bed714ec0aea15a0a2f48900c0a ]
iris_get_instance() looks up an instance on core->instances and returns it after dropping core->lock, without taking any reference. The threaded interrupt handler uses this to find the instance a firmware response belongs to and then takes inst->lock. Meanwhile userspace may close the same file descriptor: iris_close() removes the instance from the list, destroys inst->lock and frees the instance. The interrupt handler then operates on freed memory and a destroyed mutex, a use-after-free.
Add a kref to struct iris_inst. iris_get_instance() takes a reference under core->lock, so an instance it returns cannot be freed until the caller drops that reference with iris_inst_put(). The instance is released (mutexes destroyed, memory freed) only when the last reference goes away, whether that is held by the closing thread or the interrupt handler.
--- .../qcom/iris/iris_hfi_gen1_response.c | 2 ++ .../qcom/iris/iris_hfi_gen2_response.c | 1 + .../media/platform/qcom/iris/iris_instance.h | 4 ++++ drivers/media/platform/qcom/iris/iris_utils.c | 6 +++++ drivers/media/platform/qcom/iris/iris_utils.h | 1 + drivers/media/platform/qcom/iris/iris_vidc.c | 23 +++++++++++++++---- 6 files changed, 32 insertions(+), 5 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +2 -0
@@ -632,6 +632,7 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *responsemutex_lock (&inst->lock);iris_hfi_gen1_session_event_notify (inst, hdr);mutex_unlock (&inst->lock); +iris_inst_put (inst); }else {iris_hfi_gen1_sys_event_notify (core, hdr); }
@@ -667,6 +668,7 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response } }mutex_unlock (&inst->lock); +iris_inst_put (inst);break ; }
drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c +1 -0
@@ -969,6 +969,7 @@ static int iris_hfi_gen2_handle_session_response(struct iris_core *core,iris_hfi_gen2_handle_dequeue_buffers (inst);mutex_unlock (&inst->lock); +iris_inst_put (inst);return ret; }
drivers/media/platform/qcom/iris/iris_instance.h +4 -0
@@ -6,6 +6,8 @@#ifndef __IRIS_INSTANCE_H__#define __IRIS_INSTANCE_H__ +#include <linux/kref.h> +#include <media/v4l2-ctrls.h> #include "iris_buffer.h"
@@ -35,6 +37,7 @@ enum iris_fmt_type_cap {* struct iris_inst - holds per video instance parameters * * @list: used for attach an instance to the core +* @kref: reference count, keeps the instance alive while the IRQ thread uses it * @core: pointer to core structure * @session_id: id of current video session * @hfi_session_ops: iris HFI session ops
@@ -82,6 +85,7 @@ enum iris_fmt_type_cap {struct iris_inst {struct list_head list; +struct kref kref;struct iris_core *core;u32 session_id;const struct iris_hfi_session_ops *hfi_session_ops;
drivers/media/platform/qcom/iris/iris_utils.c +6 -0
@@ -92,6 +92,12 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)mutex_lock (&core->lock);list_for_each_entry (inst, &core->instances, list) {if (inst->session_id == session_id) { +/* +* Take a reference under core->lock, paired with +* iris_inst_put() once the caller is done, so the +* instance cannot be freed by a concurrent close(). +*/ +kref_get (&inst->kref);mutex_unlock (&core->lock);return inst; }
drivers/media/platform/qcom/iris/iris_utils.h +1 -0
@@ -48,6 +48,7 @@ bool iris_split_mode_enabled(struct iris_inst *inst);bool iris_fmt_is_8bit (u32 pixelformat);bool iris_fmt_is_10bit (u32 pixelformat);struct iris_inst *iris_get_instance (struct iris_core *core,u32 session_id); +void iris_inst_put (struct iris_inst *inst);void iris_helper_buffers_done (struct iris_inst *inst,unsigned int type,enum vb2_buffer_state state);int iris_wait_for_session_response (struct iris_inst *inst,bool is_flush);
drivers/media/platform/qcom/iris/iris_vidc.c +18 -5
@@ -39,6 +39,22 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)v4l2_fh_exit (&inst->fh); } +static void iris_inst_release (struct kref *kref) +{ + struct iris_inst *inst = container_of(kref, struct iris_inst, kref); + +mutex_destroy (&inst->ctx_q_lock); +mutex_destroy (&inst->lock); +kfree (inst->fmt_src); +kfree (inst->fmt_dst); +kfree (inst); +} + +void iris_inst_put (struct iris_inst *inst) +{ +kref_put (&inst->kref, iris_inst_release); +} +static int iris_add_session (struct iris_inst *inst) {struct iris_core *core = inst->core;
@@ -166,6 +182,7 @@ int iris_open(struct file *filp) inst->domain = session_type; inst->session_id =hash32_ptr (inst); inst->state =IRIS_INST_DEINIT ; +kref_init (&inst->kref);mutex_init (&inst->lock);mutex_init (&inst->ctx_q_lock);
@@ -305,11 +322,7 @@ int iris_close(struct file *filp)iris_check_num_queued_internal_buffers (inst,V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );iris_remove_session (inst);mutex_unlock (&inst->lock); -mutex_destroy (&inst->ctx_q_lock); -mutex_destroy (&inst->lock); -kfree (inst->fmt_src); -kfree (inst->fmt_dst); -kfree (inst); +iris_inst_put (inst);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1025/2651 media: iris: cache work mode after computing it in iris_set_stage
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Kumar Garg <[email protected]>
[ Upstream commit 1237888922a71897326495f848766412fb74307c ]
iris_set_stage() computes work_mode and sends it to firmware but never updates inst->fw_caps[STAGE].value, leaving the cached STAGE value stale. iris_vpu_enc_bin_size() and iris_vpu3x_vpu4x_calculate_frequency() read this cached value, so a stale default causes them to miscalculate buffer size and clock frequency for sessions actually running in a different stage than the cached one.
Update inst->fw_caps[cap_id].value with the computed work_mode before sending it to firmware, keeping the cache consistent with what is actually configured.
--- drivers/media/platform/qcom/iris/iris_ctrls.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/qcom/iris/iris_ctrls.c +2 -0
@@ -525,6 +525,8 @@ int iris_set_stage(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id work_mode =STAGE_1 ; } + inst->fw_caps[cap_id].value = work_mode; + return hfi_ops->session_set_property(inst, hfi_id, HFI_HOST_FLAGS_NONE, iris_get_port_info(inst, cap_id),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1026/2651 IB/mad: fix UAF and double-free in RMPP receive reassembly
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dairui Zhang <[email protected]>
[ Upstream commit 90e9b6357bec75f627cde1a85b5887215c80aad8 ]
mad_rmpp_recv.state is protected by two locks that do not exclude each other: recv_timeout_handler() (port workqueue) uses agent->lock, continue_rmpp() (CQ softirq) uses rmpp_recv->lock. Nothing serializes the check-then-set sequence on the state word:
T1 (CQ softirq) T2 (port workqueue)
continue_rmpp()
lock(rmpp_recv->lock)
state == ACTIVE [passes]
recv_timeout_handler()
lock(agent->lock)
state = TIMEOUT
list_del(&rmpp_recv->list)
unlock(agent->lock)
destroy_rmpp_recv()
wait_for_completion()
[blocks on T1's ref]
state = COMPLETE
unlock(rmpp_recv->lock)
complete_rmpp()
queue cleanup_work (+10s)
deref()
[unblocks]
kfree(rmpp_recv)
ib_free_recv_mad(done_wc) +10s: recv_cleanup_handler() runs lock/list_del/destroy on the
freed rmpp_recv -> UAF write and double free; nothing can
cancel that cleanup_work anymore, the entry is already off
agent->rmpp_list. done_wc is also returned to
ib_mad_complete_recv() and freed again -> UAF read and
double free.Reaching this requires sending MADs to a kernel RMPP agent from the InfiniBand/RoCE fabric: the per-port sa_query agent accepts subnet manager responses whose SLID/GID/TID are not authenticated on the fabric, and legacy user_mad agents registered without IB_USER_MAD_USER_RMPP start reassembly on any incoming RMPP DATA MAD with an attacker-chosen TID, no in-flight send required. The attacker controls segment timing and can run many transactions in parallel (agent->rmpp_list has no cap), so landing the microseconds-wide receive critical section on the 40-second timeout boundary is a matter of patience, not luck.
Unify state transitions under rmpp_recv->lock in recv_timeout_handler(), keeping list manipulation under agent->lock (which preserves the agent->lock -> rmpp_recv->lock ordering used by continue_rmpp()). State check/set in both paths is then serialized, so the loser of the race always observes the final state and bails out. recv_cleanup_handler() needs no change: with transitions serialized, a cleanup_work can only be pending after COMPLETE, in which case the timeout handler exits early.
The race is as old as the RMPP implementation itself.
--- drivers/infiniband/core/mad_rmpp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/core/mad_rmpp.c +5 -2
@@ -245,12 +245,15 @@ static void recv_timeout_handler(struct work_struct *work)struct ib_mad_recv_wc *rmpp_wc;unsigned long flags; -spin_lock_irqsave (&rmpp_recv->agent->lock, flags); +spin_lock_irqsave (&rmpp_recv->lock, flags);if (rmpp_recv->state !=RMPP_STATE_ACTIVE ) { -spin_unlock_irqrestore (&rmpp_recv->agent->lock, flags); +spin_unlock_irqrestore (&rmpp_recv->lock, flags);return ; } rmpp_recv->state =RMPP_STATE_TIMEOUT ; +spin_unlock_irqrestore (&rmpp_recv->lock, flags); + +spin_lock_irqsave (&rmpp_recv->agent->lock, flags);list_del (&rmpp_recv->list);spin_unlock_irqrestore (&rmpp_recv->agent->lock, flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1027/2651 pwm: Allow 32-bit tasks to use the character device
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <[email protected]>
[ Upstream commit 45c3d07e3f18cff2b3ea8b797387451a3df9d421 ]
pwm_cdev_fileops has no .compat_ioctl, so every ioctl on /dev/pwmchipN fails with -ENOTTY for 32-bit tasks on a 64-bit kernel, e.g. armhf userspace on arm64.
struct pwmchip_waveform has the same layout for 32-bit and 64-bit tasks, so compat_ptr_ioctl() is enough. PWM_IOCTL_REQUEST and PWM_IOCTL_FREE take an integer rather than a pointer, which is fine too: compat_ptr() only changed the value on s390, which dropped compat support in v6.19.
--- drivers/pwm/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/pwm/core.c +1 -0
@@ -2389,6 +2389,7 @@ static const struct file_operations pwm_cdev_fileops = { .release = pwm_cdev_release, .owner = THIS_MODULE, .unlocked_ioctl = pwm_cdev_ioctl, + .compat_ioctl = compat_ptr_ioctl, };static dev_t pwm_devt;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1028/2651 clk: ti: adpll: unregister OF clock provider on remove
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 4c943ddfc24340f1b899762b1ff35c38306b7a35 ]
ti_adpll_probe() registers the driver's onecell clock provider with of_clk_add_provider(). The remove path only frees the clock resources, leaving the provider registered after the backing data has been torn down.
Unregister the OF clock provider before freeing the ADPLL resources so the provider no longer points at released driver data after device removal.
--- drivers/clk/ti/adpll.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/ti/adpll.c +1 -0
@@ -925,6 +925,7 @@ static void ti_adpll_remove(struct platform_device *pdev) {struct ti_adpll_data *d =dev_get_drvdata (&pdev->dev); +of_clk_del_provider (d->np);ti_adpll_free_resources (d); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1029/2651 powerpc64/bpf: fix compare instruction emitted for tailcall
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhishek Dubey <[email protected]>
[ Upstream commit 3ebf4ae6d8afac11fe6732418dd378e031f8f4ed ]
The tail_call_info field can contain either a scalar counter value or a 64-bit pointer to the counter, using a 32-bit compare (cmplwi) only checks the lower 32 bits, which can lead to incorrect comparisions when location of counter is near 4GB boundary. Use instruction cmpldi/cmplwi for accurate comparision in corresponding cases.
--- arch/powerpc/net/bpf_jit.h | 6 ++++++ arch/powerpc/net/bpf_jit_comp.c | 2 +- arch/powerpc/net/bpf_jit_comp64.c | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/net/bpf_jit.h +6 -0
@@ -195,6 +195,12 @@ struct codegen_context {#define bpf_to_ppc (r) (ctx->b2p[r]) +#ifdef CONFIG_PPC64 +#define PPC_RAW_CMPLLI (a, i) PPC_RAW_CMPLDI(a, i) +#else +#define PPC_RAW_CMPLLI (a, i) PPC_RAW_CMPLWI(a, i) +#endif +#ifdef CONFIG_PPC32 #define BPF_FIXUP_LEN 3/* Three instructions => 12 bytes */ #else
arch/powerpc/net/bpf_jit_comp.c +1 -1
@@ -791,7 +791,7 @@ static void bpf_trampoline_setup_tail_call_info(u32 *image, struct codegen_conte* Setting the tail_call_info in trampoline's frame * depending on if previous frame had value or reference. */ -EMIT (PPC_RAW_CMPLWI (_R3,MAX_TAIL_CALL_CNT )); +EMIT (PPC_RAW_CMPLLI (_R3,MAX_TAIL_CALL_CNT ));PPC_BCC_CONST_SHORT (COND_GT ,8 );EMIT (PPC_RAW_ADDI (_R3, _R4, -BPF_PPC_TAILCALL ));
arch/powerpc/net/bpf_jit_comp64.c +4 -4
@@ -276,7 +276,7 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx)*/ EMIT (PPC_RAW_LD (bpf_to_ppc (TMP_REG_2 ), _R1,0 ));EMIT (PPC_RAW_LD (bpf_to_ppc (TMP_REG_1 ),bpf_to_ppc (TMP_REG_2 ), -(BPF_PPC_TAILCALL ))); -EMIT (PPC_RAW_CMPLWI (bpf_to_ppc (TMP_REG_1 ),MAX_TAIL_CALL_CNT )); +EMIT (PPC_RAW_CMPLDI (bpf_to_ppc (TMP_REG_1 ),MAX_TAIL_CALL_CNT ));PPC_BCC_CONST_SHORT (COND_GT ,8 );EMIT (PPC_RAW_ADDI (bpf_to_ppc (TMP_REG_1 ),bpf_to_ppc (TMP_REG_2 ), -(BPF_PPC_TAILCALL )));
@@ -662,7 +662,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 oPPC_BCC_SHORT (COND_GE , out);EMIT (PPC_RAW_LD (bpf_to_ppc (TMP_REG_1 ), _R1,bpf_jit_stack_tailcallinfo_offset (ctx))); -EMIT (PPC_RAW_CMPLWI (bpf_to_ppc (TMP_REG_1 ),MAX_TAIL_CALL_CNT )); +EMIT (PPC_RAW_CMPLDI (bpf_to_ppc (TMP_REG_1 ),MAX_TAIL_CALL_CNT ));PPC_BCC_CONST_SHORT (COND_LE ,8 );/* dereference TMP_REG_1 */
@@ -672,7 +672,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o* if (tail_call_info == MAX_TAIL_CALL_CNT) * goto out; */ -EMIT (PPC_RAW_CMPLWI (bpf_to_ppc (TMP_REG_1 ),MAX_TAIL_CALL_CNT )); +EMIT (PPC_RAW_CMPLDI (bpf_to_ppc (TMP_REG_1 ),MAX_TAIL_CALL_CNT ));PPC_BCC_SHORT (COND_EQ , out);/*
@@ -707,7 +707,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o* tail_call_info. */ EMIT (PPC_RAW_LD (bpf_to_ppc (TMP_REG_2 ), _R1,bpf_jit_stack_tailcallinfo_offset (ctx))); -EMIT (PPC_RAW_CMPLWI (bpf_to_ppc (TMP_REG_2 ),MAX_TAIL_CALL_CNT )); +EMIT (PPC_RAW_CMPLDI (bpf_to_ppc (TMP_REG_2 ),MAX_TAIL_CALL_CNT ));PPC_BCC_CONST_SHORT (COND_GT ,8 );/* First get address of tail_call_info */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1030/2651 powerpc/bpf: Move out dummy_tramp_addr after Long branch stub
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhishek Dubey <[email protected]>
[ Upstream commit 6652b9941a6c9b6814ca6d2eb153dbf162b89a02 ]
Move the long branch address field to the bottom of the long branch stub. This allows uninterrupted disassembly until the last 4/8 bytes. The last bytes exclusion is logically necessary to prevent disassembly failure, otherwise the actual program layout is never altered. Hence no effect on overall program size. Also, align dummy_tramp_addr field with 8-byte boundary.
Following is disassembler output for test program with moved down dummy_tramp_addr field:
.....
.....
pc:68 left:44 a6 03 08 7c : mtlr 0 pc:72 left:40 bc ff ff 4b : b .-68 pc:76 left:36 a6 02 68 7d : mflr 11 pc:80 left:32 05 00 9f 42 : bcl 20, 31, .+4 pc:84 left:28 a6 02 88 7d : mflr 12 pc:88 left:24 14 00 8c e9 : ld 12, 20(12) pc:92 left:20 a6 03 89 7d : mtctr 12 pc:96 left:16 a6 03 68 7d : mtlr 11 pc:100 left:12 20 04 80 4e : bctr pc:104 left:8 c0 34 1d 00 :
Failure log:
Can't disasm instruction at offset 104: c0 34 1d 00 00 00 00 c0 Disassembly logic can truncate at 104, ignoring last 8 bytes.
Update the dummy_tramp_addr field offset calculation from the end of the program to reflect its new location, for bpf_arch_text_poke() to update the actual trampoline's address in this field.
All BPF trampoline selftests continue to pass with this patch applied.
--- arch/powerpc/net/bpf_jit_comp.c | 44 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-)
arch/powerpc/net/bpf_jit_comp.c +24 -20
@@ -52,19 +52,19 @@ asm (void bpf_jit_build_fentry_stubs (u32 *image,u32 *fimage,struct codegen_context *ctx) {int ool_stub_idx, long_branch_stub_idx; -int ool_stub_sz; +int stub_sz;/* +* The dummy_tramp_addr field is placed at bottom of Long branch stub. * Align the mis-aligned dummy_tramp_addr field in the fimage. * The alignment NOP must appear before OOL stub, to make * ool_stub_idx & long_branch_stub_idx constant from end. * * The fimage can be non 8-byte aligned, so final alignment depends -* on start of fimage and the stub's instruction count offset. The -* OOL stub size is 4 instructions (with CONFIG_PPC_FTRACE_OUT_OF_LINE) -* or 3 instructions (without) before dummy_tramp_addr. -* -* Emit a NOP here if address is not SZL aligned. +* on start of fimage and the stub's instruction count. The +* stubs block has 11 instructions (with CONFIG_PPC_FTRACE_OUT_OF_LINE) +* or 10 instructions (without) before dummy_tramp_addr field. Emit a +* NOP if the address of dummy_tramp_addr is non aligned. * * In pass=0 when image==NULL, conservatively account for space * required to accommodate alignment NOP. In case final pass skips
@@ -72,8 +72,8 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context* jited_len signifies correct program size. */ - ool_stub_sz =IS_ENABLED (CONFIG_PPC_FTRACE_OUT_OF_LINE ) ?16 :12 ; -if (!image || !IS_ALIGNED ((unsigned long )fimage + ctx->idx*4 + ool_stub_sz,SZL )) + stub_sz =IS_ENABLED (CONFIG_PPC_FTRACE_OUT_OF_LINE ) ?44 :40 ; +if (!image || !IS_ALIGNED ((unsigned long )fimage + ctx->idx*4 + stub_sz,SZL ))EMIT (PPC_RAW_NOP ());/*
@@ -94,28 +94,29 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context/* * Long branch stub: -* .long <dummy_tramp_addr> // 8-byte aligned * mflr r11 * bcl 20,31,$+4 -* mflr r12 -* ld r12, -8-SZL(r12) +* mflr r12 // lr/r12 stores pc of current(this) inst. +* ld r12, 20(r12) // offset(dummy_tramp_addr) from prev inst. is 20 * mtctr r12 -* mtlr r11 // needed to retain ftrace ABI +* mtlr r11 // needed to retain ftrace ABI * bctr +* .long <dummy_tramp_addr> // SZL bytes aligned */ -if (image) - *((unsigned long *)&image[ctx->idx]) = (unsigned long )dummy_tramp; - - ctx->idx +=SZL /4 ; long_branch_stub_idx = ctx->idx;EMIT (PPC_RAW_MFLR (_R11));EMIT (PPC_RAW_BCL4 ());EMIT (PPC_RAW_MFLR (_R12)); -EMIT (PPC_RAW_LL (_R12, _R12,-8 -SZL )); +EMIT (PPC_RAW_LL (_R12, _R12,20 ));EMIT (PPC_RAW_MTCTR (_R12));EMIT (PPC_RAW_MTLR (_R11));EMIT (PPC_RAW_BCTR ()); +if (image) + *((unsigned long *)&image[ctx->idx]) = (unsigned long )dummy_tramp; + + ctx->idx +=SZL /4 ; +if (!bpf_jit_ool_stub) { bpf_jit_ool_stub = (ctx->idx - ool_stub_idx) *4 ; bpf_jit_long_branch_stub = (ctx->idx - long_branch_stub_idx) *4 ;
@@ -1310,6 +1311,7 @@ static void do_isync(void *info __maybe_unused)* bpf_func: * [nop|b] ool_stub * 2. Out-of-line stub: +* nop // optional nop for alignment * ool_stub: * mflr r0 * [b|bl] <bpf_prog>/<long_branch_stub>
@@ -1317,14 +1319,14 @@ static void do_isync(void *info __maybe_unused)* b bpf_func + 4 * 3. Long branch stub: * long_branch_stub: -* .long <branch_addr>/<dummy_tramp> * mflr r11 * bcl 20,31,$+4 * mflr r12 -* ld r12, -16(r12) +* ld r12, 20(r12) * mtctr r12 * mtlr r11 // needed to retain ftrace ABI * bctr +* .long <branch_addr>/<dummy_tramp> * * dummy_tramp is used to reduce synchronization requirements. *
@@ -1426,10 +1428,12 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,* 1. Update the address in the long branch stub: * If new_addr is out of range, we will have to use the long branch stub, so patch new_addr * here. Otherwise, revert to dummy_tramp, but only if we had patched old_addr here. +* +* dummy_tramp_addr moved to bottom of long branch stub. */ if ((new_addr && !is_offset_in_branch_range (new_addr - ip)) || (old_addr && !is_offset_in_branch_range (old_addr - ip))) - ret =patch_ulong ((void *)(bpf_func_end - bpf_jit_long_branch_stub -SZL ), + ret =patch_ulong ((void *)(bpf_func_end -SZL ),/* SZL: dummy_tramp_addr offset */ (new_addr && !is_offset_in_branch_range (new_addr - ip)) ? (unsigned long )new_addr : (unsigned long )dummy_tramp);if (ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1031/2651 powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Venkat Rao Bagalkote <[email protected]>
[ Upstream commit 644ffb02746690c0ebfe143e066f81c9bde2975e ]
radix_enabled() uses a jump label which is only valid after setup_feature_keys() is called. Before that point, on a pSeries hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in cur_cpu_spec->mmu_features, but the jump label has not yet been patched, so radix_enabled() incorrectly returns true.
The dangerous usage window where it goes wrong in early_setup():
early_setup:
configure_exceptions();
<exceptions can happen now, and handler enter/exit can be invoked> <those could use radix_enabled(), which returns stale true> setup_feature_keys();
<jump labels set up; post this it is safe to use radix_enabled()>
If an NMI occurs in this window, !radix_enabled() evaluates to false in DEFINE_INTERRUPT_HANDLER_NMI. The handler fails to skip NMI entry in real mode and attempts to access memory outside the Real Mode Area (RMA), hanging the boot.
Since common interrupt wrappers do not have the context of early or late, using early_radix_enabled() is the safer option. It does a plain bitmask check against cur_cpu_spec->mmu_features and is correct at all times.
Console logs from a pSeries HASH guest showing values across boot stages:
[ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=0 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!) [ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=0 radix_enabled=1 [ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=0 radix_enabled=0 (should now match!) [ 0.057124] DEBUG: post secondary CPU bringup: early_radix_enabled=0 radix_enabled=0 (should match!)
Console logs from a RADIX guest showing values across boot stages:
[ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=1 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!) [ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=1 radix_enabled=1 [ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=1 radix_enabled=1 (should now match!) [ 0.057016] DEBUG: post secondary CPU bringup: early_radix_enabled=1 radix_enabled=1 (should match!)
Add the missing #include <asm/mmu.h> in alphabetical order since early_radix_enabled() is declared there.
--- arch/powerpc/include/asm/interrupt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/interrupt.h +3 -2
@@ -70,6 +70,7 @@#include <linux/irq-entry-common.h> #include <asm/kprobes.h> +#include <asm/mmu.h> #include <asm/runlatch.h> #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
@@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs *regs) \ state =irqentry_nmi_enter (regs); \ }else if (IS_ENABLED (CONFIG_PPC_BOOK3S_64 ) && \firmware_has_feature (FW_FEATURE_LPAR ) && \ - !radix_enabled ()) { \ + !early_radix_enabled ()) { \/* no nmi_entry for a pseries hash guest \ * taking a real mode exception */ \ }else if (IS_ENABLED (CONFIG_KASAN )) { \
@@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs *regs) \irqentry_nmi_exit (regs, state); \ }else if (IS_ENABLED (CONFIG_PPC_BOOK3S_64 ) && \firmware_has_feature (FW_FEATURE_LPAR ) && \ - !radix_enabled ()) { \ + !early_radix_enabled ()) { \/* no nmi_exit for a pseries hash guest \ * taking a real mode exception */ \ }else if (IS_ENABLED (CONFIG_KASAN )) { \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1032/2651 clk: validate spread spectrum configuration
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dario Binacchi <[email protected]>
[ Upstream commit 109124b8ff43fb911d5b8790bb5e4c5684f72d88 ]
The spread spectrum configuration is passed to the provider's set_spread_spectrum() callback without any validation, as clk-conf.c only skips all-zero triplets from "assigned-clock-sscs". An invalid device tree can hand providers a zero modulation frequency or a spread ratio above 100%, and each provider would have to add the same checks to protect e.g. divisions in its rate computations.
The KUnit test data for assigned-clock-sscs uses spread values of 30000 and 40000 permyriad (300% and 400%), which the new check rejects, as reported by Sashiko, so fix them to 300 and 400 (3% and 4%). Also use a realistic 6% value for the initial settings of the skip tests, for consistency.
--- drivers/clk/clk.c | 14 ++++++++++++++ drivers/clk/clk_test.c | 12 ++++++------ drivers/clk/kunit_clk_assigned_rates.h | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-)
drivers/clk/clk.c +14 -0
@@ -2852,6 +2852,20 @@ int clk_hw_set_spread_spectrum(struct clk_hw *hw, const struct clk_spread_spectrif (!hw)return 0 ; +switch (ss_conf->method) { +case CLK_SPREAD_NO : +break ; +case CLK_SPREAD_CENTER : +case CLK_SPREAD_UP : +case CLK_SPREAD_DOWN : +if (!ss_conf->modfreq_hz || !ss_conf->spread_bp || + ss_conf->spread_bp >10000 ) +return -EINVAL ; +break ; +default : +return -EINVAL ; + } + core = hw->core;clk_prepare_lock ();
drivers/clk/clk_test.c +6 -6
@@ -3526,7 +3526,7 @@ static const struct clk_assigned_rates_test_param clk_assigned_sscs_skips_test_p*/ .desc = "provider missing assigned-clocks",TEST_PARAM_OVERLAY (kunit_clk_assigned_sscs_without), - .sscs = {50000, 60000, 3}, + .sscs = {50000, 600, 3}, }, {/*
@@ -3535,7 +3535,7 @@ static const struct clk_assigned_rates_test_param clk_assigned_sscs_skips_test_p*/ .desc = "consumer missing assigned-clocks",TEST_PARAM_OVERLAY (kunit_clk_assigned_sscs_without_consumer), - .sscs = {50000, 60000, 3}, + .sscs = {50000, 600, 3}, .consumer_test = true, }, {
@@ -3545,7 +3545,7 @@ static const struct clk_assigned_rates_test_param clk_assigned_sscs_skips_test_p*/ .desc = "provider assigned-clock-sscs of zero",TEST_PARAM_OVERLAY (kunit_clk_assigned_sscs_zero), - .sscs = {50000, 60000, 3}, + .sscs = {50000, 600, 3}, }, {/*
@@ -3554,7 +3554,7 @@ static const struct clk_assigned_rates_test_param clk_assigned_sscs_skips_test_p*/ .desc = "consumer assigned-clock-sscs of zero",TEST_PARAM_OVERLAY (kunit_clk_assigned_sscs_zero_consumer), - .sscs = {50000, 60000, 3}, + .sscs = {50000, 600, 3}, .consumer_test = true, }, {
@@ -3564,7 +3564,7 @@ static const struct clk_assigned_rates_test_param clk_assigned_sscs_skips_test_p*/ .desc = "provider assigned-clocks null phandle",TEST_PARAM_OVERLAY (kunit_clk_assigned_sscs_null), - .sscs = {50000, 60000, 3}, + .sscs = {50000, 600, 3}, }, {/*
@@ -3573,7 +3573,7 @@ static const struct clk_assigned_rates_test_param clk_assigned_sscs_skips_test_p*/ .desc = "consumer assigned-clocks null phandle",TEST_PARAM_OVERLAY (kunit_clk_assigned_sscs_null_consumer), - .sscs = {50000, 60000, 3}, + .sscs = {50000, 600, 3}, .consumer_test = true, }, };
drivers/clk/kunit_clk_assigned_rates.h +2 -2
@@ -9,10 +9,10 @@#define ASSIGNED_RATES_1_RATE 9700000#define ASSIGNED_SSCS_0_MODFREQ 10000 -#define ASSIGNED_SSCS_0_SPREAD 30000 +#define ASSIGNED_SSCS_0_SPREAD 300#define ASSIGNED_SSCS_0_METHOD CLK_SSC_CENTER_SPREAD#define ASSIGNED_SSCS_1_MODFREQ 20000 -#define ASSIGNED_SSCS_1_SPREAD 40000 +#define ASSIGNED_SSCS_1_SPREAD 400#define ASSIGNED_SSCS_1_METHOD CLK_SSC_UP_SPREAD#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1033/2651 clk: si5351: fail prepare when PLL reset times out
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit b6685c30d15cd7f28c40b2daaeacc00f21b2f12a ]
The clock prepare path requests a PLL reset when the platform data requires a deterministic output phase. The reset helper logs polling errors but returns no status, so prepare still enables the output and reports success when the reset did not complete.
Return the poll result to prepare, restore the output power-down bit on failure, and leave the output disabled. XTAL and CLKIN inputs continue to bypass PLL reset successfully.
The issue was found by our static-analysis tool.
--- drivers/clk/clk-si5351.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/clk/clk-si5351.c +16 -4
@@ -907,7 +907,7 @@ static int _si5351_clkout_set_disable_state(return 0 ; } -static void _si5351_clkout_reset_pll (struct si5351_driver_data *drvdata,int num) +static int _si5351_clkout_reset_pll (struct si5351_driver_data *drvdata,int num) {u8 val =si5351_reg_read (drvdata,SI5351_CLK0_CTRL + num); u8 mask = val & SI5351_CLK_PLL_SELECT ? SI5351_PLL_RESET_B :
@@ -918,7 +918,7 @@ static void _si5351_clkout_reset_pll(struct si5351_driver_data *drvdata, int numswitch (val &SI5351_CLK_INPUT_MASK ) {case SI5351_CLK_INPUT_XTAL :case SI5351_CLK_INPUT_CLKIN : -return ;/* pll not used, no need to reset */ +return 0 ;/* pll not used, no need to reset */ }si5351_reg_write (drvdata,SI5351_PLL_RESET , mask);
@@ -931,6 +931,8 @@ static void _si5351_clkout_reset_pll(struct si5351_driver_data *drvdata, int numdev_dbg (&drvdata->client->dev,"%s - %s: pll = %d\n" , __func__,clk_hw_get_name (&drvdata->clkout[num].hw), (val &SI5351_CLK_PLL_SELECT ) ?1 :0 ); + +return err; }static int si5351_clkout_prepare (struct clk_hw *hw)
@@ -947,8 +949,18 @@ static int si5351_clkout_prepare(struct clk_hw *hw)* Do a pll soft reset on the parent pll -- needed to get a * deterministic phase relationship between the output clocks. */ -if (pdata->clkout[hwdata->num].pll_reset) -_si5351_clkout_reset_pll (hwdata->drvdata, hwdata->num); +if (pdata->clkout[hwdata->num].pll_reset) { +int ret; + + ret =_si5351_clkout_reset_pll (hwdata->drvdata, hwdata->num); +if (ret) { +si5351_set_bits (hwdata->drvdata, +SI5351_CLK0_CTRL + hwdata->num, +SI5351_CLK_POWERDOWN , +SI5351_CLK_POWERDOWN ); +return ret; + } + }si5351_set_bits (hwdata->drvdata,SI5351_OUTPUT_ENABLE_CTRL , (1 << hwdata->num),0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1034/2651 RDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVER_FAILURE
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yili Zhang <[email protected]>
[ Upstream commit 9f4c322be27bf617cad2f4a15f6c6024a69e220c ]
fill_res_cq_entry() dereferences cq->uobject->uevent.uobject.context->res.id unconditionally for user resources.
This is normally safe by ordering: destroy_hw() removes the resource from the restrack before uverbs_destroy_uobject() clears ->context, and the XA_ZERO_ENTRY marker set by rdma_restrack_begin_del() hides the entry from concurrent netlink dumps.
The ordering breaks when a driver keeps failing to destroy an object during ucontext teardown. uverbs_destroy_ufile_hw() then falls back to __uverbs_cleanup_ufile(RDMA_REMOVE_DRIVER_FAILURE), which abandons the object in place: the HW object and its restrack entry are intentionally leaked, while the uobject bookkeeping is torn down and ->context is explicitly set to NULL by uverbs_destroy_uobject(). rdma_restrack_del() is never reached, so the orphaned entry stays in the device restrack with a valid kref, reachable by any subsequent netlink dump.
Observed on 6.1.52 with MLNX_OFED 24.10, after an mlx5 FW failure left a process unable to tear down its CQ (destroy_cq FW command failing during FD close):
WARNING: ... uverbs_destroy_ufile_hw+0xe3/0x100
BUG: kernel NULL pointer dereference, address: 0000000000000058 RIP: 0010:fill_res_cq_entry+0x15e/0x180 [ib_core] res_get_common_dumpit+0x304/0x530 [ib_core] nldev_res_get_cq_dumpit+0x1a/0x20 [ib_core]
The faulting chain maps to the source (CR2 = 0x58):
cq->uobject (struct ib_cq +0x08, res at +0x98) uobject->context (struct ib_uobject +0x10, NULL after abandon) context->res.id (struct ib_ucontext +0x58)
The recent restrack rework (8d186210677c and its series) moved the restrack deletion to the start of the destroy flow and thus fences concurrent dumps from an object being destroyed, but it does not cover this case: when destroy fails, rdma_restrack_abort_del() restores the entry, and the RDMA_REMOVE_DRIVER_FAILURE sweep still never removes it from the restrack.
Quoted 1 line
From the fallback until the device is unregistered, any "rdma res
show cq" deterministically takes the NULL pointer dereference; this is a long-lived state, NOT A RACE. The dump path holds neither the restrack lock (dropped before the fill callback runs) nor ufile->hw_destroy_rwsem, and rdma_restrack_get() only guarantees that the res memory stays alive, not that ->context is still valid.
Fix the dump side: check the uobject context directly instead of the rdma_is_kernel_res() marker. A non-NULL uobject already implies a user resource, so kernel resources keep being skipped, and the additional ->context check skips the RES_CTXN attribute for orphaned entries instead of crashing the dump. The orphaned resource itself remains visible in "rdma res show" (cqn/cqe/usecnt/pid), which is what an operator needs after the accompanying uverbs WARN to diagnose the driver destroy failure.
fill_res_pd_entry() has the same pattern (pd->uobject->context->res.id) and is fixed the same way; a PD can even reach the fallback without its own driver callback failing, e.g. uverbs_free_pd() returns -EBUSY while another object that failed to destroy still holds the PD usecnt.
--- drivers/infiniband/core/nldev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/core/nldev.c +3 -2
@@ -700,7 +700,8 @@ static int fill_res_cq_entry(struct sk_buff *msg, bool has_cap_net_admin,if (nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_CQN , res->id))return -EMSGSIZE ; -if (!rdma_is_kernel_res (res) && + +if (cq->uobject && cq->uobject->uevent.uobject.context &&nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_CTXN , cq->uobject->uevent.uobject.context->res.id))return -EMSGSIZE ;
@@ -790,7 +791,7 @@ static int fill_res_pd_entry(struct sk_buff *msg, bool has_cap_net_admin,if (nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_PDN , res->id)) goto err; -if (!rdma_is_kernel_res (res) && +if (pd->uobject && pd->uobject->context &&nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_CTXN , pd->uobject->context->res.id)) goto err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1035/2651 RDMA/rtrs-clt: Reject invalid queue_depth from the peer
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quanye Yang <[email protected]>
[ Upstream commit 724cd362162ca7ca5a250bec65efd74f7dad9f5c ]
queue_depth is taken from the server's CM private_data and later used as a session invariant. A peer can send 0, which the client stores and then trips WARN_ON() in create_con_cq_qp() when the next connection is set up.
Reject a zero queue_depth on ESTABLISHED, same as a bad magic or version, and fail the handshake with -ECONNRESET.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +4 -0
@@ -1853,6 +1853,10 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, }if (con->c.cid ==0 ) { queue_depth =le16_to_cpu (msg->queue_depth); +if (!queue_depth) { +rtrs_err (clt,"Invalid queue depth %u\n" , queue_depth); +return -ECONNRESET ; + }if (clt_path->queue_depth >0 && queue_depth != clt_path->queue_depth) {rtrs_err (clt,"Error: queue depth changed\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1036/2651 RDMA/rxe: unpublish the per-net tunnel socket before
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <[email protected]>
[ Upstream commit 4af07308d8227affa1710b392ba79af7e878073e ]
KASAN reports a slab-use-after-free in ip6_route_output_flags() reached from rxe_find_route(), with the free in __sk_destruct() after rxe_sock_put(), and a user with CAP_NET_ADMIN can remove the device with "rdma link del rxe0" while RoCE v2 over IPv6 traffic keeps looking the socket up.
BUG: KASAN: slab-use-after-free in ip6_route_output_flags+0x300/0x360 Read of size 4 at addr ffff888115ddd794 by task kworker/u32:6/309 Call Trace: <TASK> dump_stack_lvl+0x53/0x70 print_report+0xd0/0x630 ? __pfx__raw_spin_lock_irqsave+0x10/0x10 ? ip6_route_output_flags+0x300/0x360 kasan_report+0xce/0x100 ? ip6_route_output_flags+0x300/0x360 ip6_route_output_flags+0x300/0x360 ip6_dst_lookup_tail.constprop.0+0x76c/0xcc0 ? ct_nmi_exit+0xc3/0xf0 ip6_dst_lookup_flow+0xf5/0x1e0 ? __pfx_ip6_dst_lookup_flow+0x10/0x10 rxe_find_route+0x426/0xa30 ? __kasan_slab_alloc+0x6e/0x70 ? __pfx_rxe_find_route+0x10/0x10 ? kmem_cache_alloc_node_noprof+0x141/0x370 ? kmalloc_reserve+0x103/0x2b0 ? rxe_icrc_generate+0x229/0x330 ? __pfx___alloc_skb+0x10/0x10 rxe_prepare+0x9e8/0x18b0 ? rxe_init_packet+0x3c7/0x4f0 rxe_requester+0x1a0f/0x51f0 ? rxe_completer+0x1de9/0x38c0 ? __pfx_rxe_completer+0x10/0x10 ? __queue_work+0x43e/0x11f0 ? __pfx_rxe_requester+0x10/0x10 ? irqentry_exit+0xd2/0x640 ? _raw_spin_lock_irqsave+0x85/0xe0 ? __pfx__raw_spin_lock_irqsave+0x10/0x10 ? __pfx_rxe_sender+0x10/0x10 rxe_sender+0xe/0x30 do_work+0x144/0x470 process_one_work+0x633/0x1030 ? assign_work+0x11d/0x370 worker_thread+0x45b/0xd10 ? __pfx_worker_thread+0x10/0x10 kthread+0x2c6/0x3b0 ? recalc_sigpending+0x15c/0x1e0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x36e/0x5a0 ? __pfx_ret_from_fork+0x10/0x10 ? __switch_to+0x572/0xdd0 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Allocated by task 146020: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 __kasan_slab_alloc+0x6e/0x70 kmem_cache_alloc_noprof+0x130/0x360 sk_prot_alloc+0x56/0x210
Fix by clearing the per-net pointer before the last reference is dropped.
--- drivers/infiniband/sw/rxe/rxe_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_net.c +1 -2
@@ -638,9 +638,8 @@ static void rxe_sock_put(struct sock *sk,if (refcount_read (&sk->sk_refcnt) >SK_REF_FOR_TUNNEL ) {__sock_put (sk); }else { +set_sk (net,NULL );rxe_release_udp_tunnel (sk); - sk =NULL ; -set_sk (net, sk); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1037/2651 RDMA/rxe: Reject prefetch of a non-ODP MR
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Norbert Szetei <[email protected]>
[ Upstream commit 66f18a749a3eeeb19f0b7812ecbe8b1ac18d73ec ]
rxe_ib_advise_mr_prefetch() and rxe_ib_prefetch_sg_list() look up the MR by lkey and hand it to rxe_odp_do_pagefault_and_lock() without checking that it is an ODP MR. That path runs to_ib_umem_odp() on mr->umem, and for a non-ODP MR mr->umem is a plain struct ib_umem from ib_umem_get(), so the container_of() in to_ib_umem_odp() lands past the end of the object and ib_umem_odp_map_dma_and_lock() reads its ib_umem_odp fields out of bounds.
lookup_mr() validates the lkey, PD, access and state but not the MR type, and IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH is accepted for any MR.
BUG: KASAN: slab-out-of-bounds in ib_umem_odp_map_dma_and_lock+0x884/0x8a0 Read of size 8 at addr ffff88810a3ebcf0 by task advi/921 ib_umem_odp_map_dma_and_lock+0x884/0x8a0 rxe_ib_advise_mr+0x543/0xad0 ib_uverbs_handler_UVERBS_METHOD_ADVISE_MR+0x446/0x530 ib_uverbs_cmd_verbs+0x2b3c/0x3b20 ib_uverbs_ioctl+0x1e3/0x310 Allocated by task 921: __ib_umem_get_va+0x13e/0xae0 rxe_mr_init_user+0x2ae/0xb00 rxe_reg_user_mr+0x337/0x510 The buggy address belongs to the object at ffff88810a3ebc80 which belongs to the cache kmalloc-96 of size 96
Ask lookup_mr() for IB_ACCESS_ON_DEMAND in both the synchronous and the asynchronous prefetch arm. mr->access carries that flag only for an MR registered as ODP, so the existing
(access & mr->access) != access test rejects a plain MR and the prefetch fails with -EINVAL.
--- drivers/infiniband/sw/rxe/rxe_odp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_odp.c +2 -2
@@ -469,7 +469,7 @@ static int rxe_ib_prefetch_sg_list(struct ib_pd *ibpd,struct rxe_mr *mr;struct ib_umem_odp *umem_odp; - mr =lookup_mr (pd,IB_ACCESS_LOCAL_WRITE , + mr =lookup_mr (pd,IB_ACCESS_LOCAL_WRITE |IB_ACCESS_ON_DEMAND , sg_list[i].lkey,RXE_LOOKUP_LOCAL );if (!mr) {
@@ -535,7 +535,7 @@ static int rxe_ib_advise_mr_prefetch(struct ib_pd *ibpd,for (i =0 ; i < num_sge; ++i) {/* Takes a reference, which will be released in the queued work */ - mr =lookup_mr (pd,IB_ACCESS_LOCAL_WRITE , + mr =lookup_mr (pd,IB_ACCESS_LOCAL_WRITE |IB_ACCESS_ON_DEMAND , sg_list[i].lkey,RXE_LOOKUP_LOCAL );if (!mr) { mr =ERR_PTR (-EINVAL );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1038/2651 RDMA/ionic: Fix XArray initialization to use XArray flags
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhijit Gangurde <[email protected]>
[ Upstream commit 2eca9c14e66a1f71c089fe5c3afb2d339da3023a ]
xa_init_flags() takes XArray flags (XA_FLAGS_*), not gfp flags, even though the parameter is typed gfp_t. Passing GFP_ATOMIC leaves both lock-type bits clear, so xa_lock_type() resolves to XA_LOCK_NORMAL for qp_tbl and cq_tbl.
Both tables are used with the IRQ-safe accessors: xa_store_irq() with GFP_KERNEL from process context, and xa_lock_irqsave() from the event queue path. When a store needs to grow the tree, __xas_nomem() drops the lock using the recorded lock type before allocating:
if (gfpflags_allow_blocking(gfp)) {
xas_unlock_type(xas, lock_type);
xas->xa_alloc = kmem_cache_alloc_lru(...);
xas_lock_type(xas, lock_type);
}With XA_LOCK_NORMAL that is a plain spin_unlock(), so the sleeping GFP_KERNEL allocation runs with interrupts still disabled by xa_store_irq(), and lockdep annotates the lock with the wrong class.
GFP_ATOMIC also happens to set __GFP_HIGH (0x20), which collides with XA_FLAGS_ACCOUNT (32U) and silently enables memcg accounting of the XArray nodes.
Use XA_FLAGS_LOCK_IRQ so the lock type matches how the tables are actually accessed.
--- drivers/infiniband/hw/ionic/ionic_ibdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/ionic/ionic_ibdev.c +2 -2
@@ -320,8 +320,8 @@ static struct ionic_ibdev *ionic_create_ibdev(struct ionic_aux_dev *ionic_adev)ionic_fill_lif_cfg (ionic_adev->lif, &dev->lif_cfg); -xa_init_flags (&dev->qp_tbl,GFP_ATOMIC ); -xa_init_flags (&dev->cq_tbl,GFP_ATOMIC ); +xa_init_flags (&dev->qp_tbl,XA_FLAGS_LOCK_IRQ ); +xa_init_flags (&dev->cq_tbl,XA_FLAGS_LOCK_IRQ );ionic_init_resids (dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1039/2651 RDMA/ionic: Fix double removal of CMB mmap entries in create QP error path
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhijit Gangurde <[email protected]>
[ Upstream commit 485effd117d0310a7f589defb4f442fa3bb52ae2 ]
The error unwind in ionic_create_qp() removes the SQ and RQ CMB mmap entries explicitly, and then falls through to ionic_qp_rq_destroy() and ionic_qp_sq_destroy(), whose ionic_qp_{rq,sq}_destroy_cmb() helpers remove the very same entries a second time.
Drop the explicit removals and leave ionic_qp_{rq,sq}_destroy_cmb() as the single owner on the ionic_destroy_qp() path.
--- drivers/infiniband/hw/ionic/ionic_controlpath.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/infiniband/hw/ionic/ionic_controlpath.c +5 -11
@@ -2336,7 +2336,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, &resp.sq_cmb_offset);if (!qp->mmap_sq_cmb) { rc = -ENOMEM ; - goto err_mmap_sq; + goto err_qp_cmd; } resp.sq_cmb = qp->sq_cmb;
@@ -2373,7 +2373,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, &resp.rq_cmb_offset);if (!qp->mmap_rq_cmb) { rc = -ENOMEM ; - goto err_mmap_rq; + goto err_qp_cmd; } resp.rq_cmb = qp->rq_cmb;
@@ -2381,7 +2381,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, rc =ib_respond_udata (udata, resp);if (rc) - goto err_resp; + goto err_qp_cmd; }ionic_pgtbl_unbuf (dev, &rq_buf);
@@ -2399,7 +2399,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,else rc =xa_err (entry); - goto err_resp; + goto err_qp_cmd; }if (qp->has_sq) {
@@ -2430,13 +2430,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,return 0 ; -err_resp: -if (udata && (qp->rq_cmb &IONIC_CMB_ENABLE )) -rdma_user_mmap_entry_remove (qp->mmap_rq_cmb); -err_mmap_rq: -if (udata && (qp->sq_cmb &IONIC_CMB_ENABLE )) -rdma_user_mmap_entry_remove (qp->mmap_sq_cmb); -err_mmap_sq: +err_qp_cmd:ionic_destroy_qp_cmd (dev, qp->qpid); err_cmd:ionic_pgtbl_unbuf (dev, &rq_buf);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1040/2651 perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 7c89ea1bd4c612eb5cc2e6c01f77ebfc21d5c95d ]
On kernels without the fix ("perf/core: Restore header fields in sideband output callbacks") to restore event_id.header.size in perf_event_ksymbol_output(), perf_event_bpf_output(), and perf_event_text_poke_output(), concurrent perf sessions cause those sideband records to be emitted with header.size inflated by multiple id_header_size increments while the single id_sample is written immediately after the event payload. Indexing backwards from event->header.size reads uninitialized ring-buffer bytes at the end of the record, causing evlist__event2evsel() to fail with -EFAULT.
Add evsel__event_size() to clamp the effective size used to locate the trailing id_sample for PERF_RECORD_KSYMBOL, PERF_RECORD_BPF_EVENT, and PERF_RECORD_TEXT_POKE to payload + id_hdr_size while leaving event->header.size intact for advancing the ring-buffer/file stream.
--- tools/perf/util/evlist.c | 6 ++-- tools/perf/util/evsel.c | 59 +++++++++++++++++++++++++++++++++++++++- tools/perf/util/evsel.h | 1 + 3 files changed, 63 insertions(+), 3 deletions(-)
tools/perf/util/evlist.c +4 -2
@@ -773,13 +773,15 @@ static int evlist__event2id(struct evlist *evlist, union perf_event *event, u64const __u64 *array = event->sample.array;ssize_t n; - n = (event->header.size -sizeof (event->header)) >>3 ; -if (event->header.type ==PERF_RECORD_SAMPLE ) { + n = (event->header.size -sizeof (event->header)) >>3 ;if (evlist__id_pos (evlist) >= n)return -1 ; *id = array[evlist__id_pos (evlist)]; }else { +u16 size =evsel__event_size (evlist__first (evlist), event); + + n = (size -sizeof (event->header)) >>3 ;if (evlist__is_pos (evlist) > n)return -1 ; n -=evlist__is_pos (evlist);
tools/perf/util/evsel.c +58 -1
71 lines not on this page · raw message
tools/perf/util/evsel.h +1 -0
@@ -468,6 +468,7 @@ int evsel__parse_sample_timestamp(struct evsel *evsel, union perf_event *event, u64 *timestamp);u16 evsel__id_hdr_size (const struct evsel *evsel); +u16 evsel__event_size (const struct evsel *evsel,const union perf_event *event);static inline struct evsel *evsel__next (struct evsel *evsel) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1041/2651 perf python: Initialize debug output on module load
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 3d13b3f1f3a7cd33d1847a4b87c3198089b6c4a7 ]
Unlike the perf binary's main(), PyInit_perf() does not call perf_debug_setup(). As a result, the first warning or error printed from the perf Python C extension hits debug_file() with _debug_file == NULL and emits 'debug_file not set' without a trailing newline before the actual diagnostic message.
Call perf_debug_setup() in PyInit_perf() and add the missing trailing newline to the fallback warning in debug_file().
--- tools/perf/util/debug.c | 2 +- tools/perf/util/python.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/debug.c +1 -1
@@ -55,7 +55,7 @@ FILE *debug_file(void) {if (!_debug_file) {debug_set_file (stderr); -pr_warning_once ("debug_file not set" ); +pr_warning_once ("%s not set\n" , __func__); }return _debug_file; }
tools/perf/util/python.c +1 -0
@@ -4245,6 +4245,7 @@ PyMODINIT_FUNC PyInit_perf(void)/* The page_size is placed in util object. */ page_size =sysconf (_SC_PAGE_SIZE); +perf_debug_setup ();Py_INCREF (&pyrf_evlist__type);PyModule_AddObject (module,"evlist" , (PyObject *)&pyrf_evlist__type);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1042/2651 perf pmu: Fix race with concurrent tracepoint creation and removal in perf list
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit ab20a3090d338c4f161cb1a68e64a7f8914569ea ]
perf_pmus__print_pmu_events() first counts events via perf_pmu__num_events() to allocate the aliases array, then populates it via perf_pmu__for_each_event(). When dynamic tracepoints (such as kprobes or uprobes during 'perf test' runs) are concurrently created or removed between the two passes:
- If an event is removed, state.index is smaller than the allocated len, leaving trailing zeroed entries in aliases[] with name == NULL and pmu == NULL, which causes qsort(cmp_sevent) or the print loop to crash with SIGSEGV.
- If a dynamic tracepoint subsystem directory is removed while scanning /sys/kernel/tracing/events, tp_pmu__for_each_tp_event() returns -ENOENT and aborts enumeration of all remaining tracepoint subsystems.
- If an event is added, perf_pmus__print_pmu_events__callback() aborts enumeration when state->index reaches state->aliases_len.
Grow state->aliases dynamically via realloc() when needed, use state.index as the actual populated length for sorting and printing, and ignore -ENOENT when a tracepoint subsystem directory disappears during enumeration.
--- tools/perf/util/pmus.c | 21 +++++++++++++++++---- tools/perf/util/tp_pmu.c | 8 ++++++-- 2 files changed, 23 insertions(+), 6 deletions(-)
tools/perf/util/pmus.c +17 -4
@@ -8,6 +8,7 @@#include <sys/types.h> #include <ctype.h> #include <pthread.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include "cpumap.h"
@@ -571,7 +572,7 @@ static int cmp_sevent(const void *a, const void *b) }/* Order by event name. */ -return strcmp (as->name, bs->name); +return strcmp (as->name ?:"" , bs->name ?:"" ); }static bool pmu_alias_is_duplicate (struct sevent *a,struct sevent *b)
@@ -581,7 +582,7 @@ static bool pmu_alias_is_duplicate(struct sevent *a, struct sevent *b)return false;/* Don't remove duplicates for different PMUs */ -return strcmp (a->pmu_name, b->pmu_name) ==0 ; +return strcmp (a->pmu_name ?:"" , b->pmu_name ?:"" ) ==0 ; }struct events_callback_state {
@@ -597,8 +598,18 @@ static int perf_pmus__print_pmu_events__callback(void *vstate,struct sevent *s;if (state->index >= state->aliases_len) { -pr_err ("Unexpected event %s/%s/\n" , info->pmu->name, info->name); -return 1 ; +size_t new_len =max_t (size_t,16 , state->aliases_len *2 ); +struct sevent *new_aliases; + + new_aliases =realloc (state->aliases, new_len *sizeof (struct sevent )); +if (!new_aliases) { +pr_err ("Unexpected event %s/%s/\n" , info->pmu->name, info->name); +return 1 ; + } +memset (&new_aliases[state->aliases_len],0 , + (new_len - state->aliases_len) *sizeof (struct sevent )); + state->aliases = new_aliases; + state->aliases_len = new_len; }assert (info->pmu !=NULL || info->name !=NULL ); s = &state->aliases[state->index];
@@ -654,6 +665,8 @@ void perf_pmus__print_pmu_events(const struct print_callbacks *print_cb, void *pperf_pmu__for_each_event (pmu, skip_duplicate_pmus, &state, perf_pmus__print_pmu_events__callback); } + aliases = state.aliases; + len = state.index;qsort (aliases, len,sizeof (struct sevent ), cmp_sevent);for (int j =0 ; j < len; j++) {/* Skip duplicates */
tools/perf/util/tp_pmu.c +6 -2
@@ -151,7 +151,9 @@ static int for_each_event_cb(void *state, const char *sys_name, const char *evt_static int for_each_event_sys_cb (void *state,const char *sys_name) { -return tp_pmu__for_each_tp_event (sys_name, state, for_each_event_cb); +int ret =tp_pmu__for_each_tp_event (sys_name, state, for_each_event_cb); + +return ret == -ENOENT ?0 : ret; }int tp_pmu__for_each_event (struct perf_pmu *pmu,void *state,pmu_event_callback cb)
@@ -176,7 +178,9 @@ static int num_events_cb(void *state, const char *sys_name __maybe_unused,static int num_events_sys_cb (void *state,const char *sys_name) { -return tp_pmu__for_each_tp_event (sys_name, state, num_events_cb); +int ret =tp_pmu__for_each_tp_event (sys_name, state, num_events_cb); + +return ret == -ENOENT ?0 : ret; }size_t tp_pmu__num_events (struct perf_pmu *pmu__maybe_unused )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1043/2651 RDMA/mad: Reject receive completions shorter than GRH
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 2dc2126e690203d6adbddc7675927a242d810e43 ]
ib_mad_recv_done() derives the OPA MAD length by subtracting the GRH size from wc->byte_len without ensuring the receive completion covers the GRH. If it is shorter, the subtraction wraps before the result is stored in mad_len and an invalid length can be passed downstream.
Reject receive completions shorter than the GRH before inspecting the MAD header or deriving the MAD length.
--- drivers/infiniband/core/mad.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/mad.c +2 -0
@@ -2342,6 +2342,8 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) recv->header.mapping,mad_priv_dma_size (recv), DMA_FROM_DEVICE); +if (unlikely (wc->byte_len <sizeof (struct ib_grh ))) + goto out;/* Setup MAD receive work completion from "normal" work completion */ recv->header.wc = *wc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1044/2651 RDMA/mlx4: Do not allow the user to write to the clock page
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 33db1d9683b8fb00bc233d0bea093e694ed9afc5 ]
mlx4_ib_mmap() maps the internal clock page to userspace through rdma_user_mmap_io(), which does not restrict write access. Userspace can request PROT_WRITE directly, or upgrade a read-only mapping later with mprotect() because VM_MAYWRITE remains set.
Reject VM_WRITE, VM_EXEC and clear VM_MAYWRITE, applying the same read-only policy as commit c660133c339f ("RDMA/mlx5: Do not allow the user to write to the clock page"). The rdma-core mlx4 provider requests this mapping with PROT_READ, so its existing behavior is unchanged.
--- drivers/infiniband/hw/mlx4/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/mlx4/main.c +4 -0
@@ -1169,6 +1169,10 @@ static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)struct mlx4_clock_params params;int ret; +if (vma->vm_flags & (VM_WRITE |VM_EXEC )) +return -EPERM ; +vm_flags_clear (vma,VM_MAYWRITE ); + ret =mlx4_get_internal_clock_params (dev->dev, ¶ms);if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1045/2651 RDMA/cxgb4: Do not allow userspace to write the status page
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 1c5335a6902639596a795705349da7f76027e103 ]
The device status page is shared by all userspace contexts and contains db_off, which the driver updates to control doorbell flow. The rdma-core provider maps it with PROT_READ, but c4iw_mmap() passes the requested page protection through when handling CXGB4_MMAP_CONTIG.
A process can therefore request PROT_WRITE directly or later upgrade a read-only mapping with mprotect() because VM_MAYWRITE remains set. This lets userspace alter device-wide flow-control state seen by the kernel and other contexts.
Reject initially writable mappings and clear VM_MAYWRITE before mapping the page. This preserves the existing read-only userspace ABI.
--- drivers/infiniband/hw/cxgb4/provider.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/hw/cxgb4/provider.c +5 -0
@@ -171,6 +171,11 @@ static int c4iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) len, t4_pgprot_wc(vma->vm_page_prot));break ;case CXGB4_MMAP_CONTIG : +if (vma->vm_flags & (VM_WRITE |VM_EXEC )) { + ret = -EPERM ; +break ; + } +vm_flags_clear (vma,VM_MAYWRITE ); ret =io_remap_pfn_range (vma, vma->vm_start, addr >>PAGE_SHIFT , len, vma->vm_page_prot);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1046/2651 time: Prevent time64_to_tm() day truncation on 32-bit
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 2927f7ca78448781e11a4623d347cd653c28adf6 ]
time64_to_tm() accepts a 64-bit seconds value, but stores the quotient in long. On a 32-bit kernel the day count therefore wraps when it reaches 2^31, even though the corresponding year remains representable in struct tm.
This is reachable when formatting externally supplied timestamps. For example, NILFS recovery copies the little-endian 64-bit ss_create field from an on-disk segment summary into time64_t. Its sysfs attributes then print that value with %ptTs, whose formatter calls time64_to_tm(). A corrupted image can consequently produce an architecture-dependent printed date.
Keep the day quotient in s64 while leaving the seconds-within-day remainder as long. Use div_s64_rem() for the weekday calculation so 32-bit builds do not require compiler runtime division helpers.
--- kernel/time/timeconv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/timeconv.c +4 -2
@@ -49,8 +49,9 @@ void time64_to_tm(time64_t totalsecs, int offset, struct tm *result)u32 u32tmp, day_of_century, year_of_century, day_of_year, month, day;u64 u64tmp, udays, century, year;bool is_Jan_or_Feb, is_leap_year; -long days, rem;int remainder; +long rem; +s64 days; days =div_s64_rem (totalsecs,SECS_PER_DAY , &remainder); rem = remainder;
@@ -70,7 +71,8 @@ void time64_to_tm(time64_t totalsecs, int offset, struct tm *result) result->tm_sec = rem %60 ;/* January 1, 1970 was a Thursday. */ - result->tm_wday = (4 + days) %7 ; +div_s64_rem (days +4 ,7 , &remainder); + result->tm_wday = remainder;if (result->tm_wday <0 ) result->tm_wday +=7 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1047/2651 RDMA/rtrs-clt: Dont WARN on unexpected info-response opcode
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quanye Yang <[email protected]>
[ Upstream commit 49c5691ad76f000e66c4f2635d5f196db5d038f9 ]
The info-response receive is posted for a SEND. The completion opcode comes from the peer, so RDMA WRITE with Immediate is a legal WC on that WQE even though it violates the RTRS handshake.
WARN_ON(wc->opcode != IB_WC_RECV) treats that peer-controlled field as an internal invariant and panics with panic_on_warn. Treat a non-SEND completion as a handshake failure: log it and keep the existing CONNECTING_ERR cleanup.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +6 -1
@@ -2518,7 +2518,12 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) ib_wc_status_msg(wc->status)); goto out; } -WARN_ON (wc->opcode !=IB_WC_RECV ); +if (wc->opcode !=IB_WC_RECV ) { +rtrs_err (clt_path->clt, +"Path info response has unexpected opcode %d\n" , + wc->opcode); + goto out; + }if (wc->byte_len <sizeof (*msg)) { rtrs_err(clt_path->clt, "Path info response is malformed: size %d\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1048/2651 vfio/platform: prevent read-only region mappings from becoming writable
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdifatah Suruur <[email protected]>
[ Upstream commit 420bed9131dbbe37abe9d6b32af51219875811e0 ]
vfio_platform_mmap() rejects writable mappings of regions without the WRITE flag, but leaves VM_MAYWRITE set. Userspace can map such a region read-only and then upgrade the mapping to writable with mprotect().
Clear VM_MAYWRITE for regions without the WRITE flag, as i915 does for its read-only objects and as fixed in drm/vc4 (CVE-2026-68445), drm/panthor (CVE-2024-53071) and commit a5edadbae57e ("ptp: vmclock:
prevent read-only mappings from becoming writable").
Note this is defensive hardening: no in-tree platform driver currently publishes a region without the WRITE flag. The guard costs nothing and keeps the mmap() interface honest if a read-only region ever appears.
--- drivers/vfio/platform/vfio_platform_common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/vfio/platform/vfio_platform_common.c +7 -3
@@ -591,9 +591,13 @@ int vfio_platform_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma && (vma->vm_flags & VM_READ))return -EINVAL ; -if (!(vdev->regions[index].flags &VFIO_REGION_INFO_FLAG_WRITE ) - && (vma->vm_flags &VM_WRITE )) -return -EINVAL ; +/* Prevent read-only region mappings from being upgraded with mprotect() */ +if (!(vdev->regions[index].flags &VFIO_REGION_INFO_FLAG_WRITE )) { +if (vma->vm_flags &VM_WRITE ) +return -EINVAL ; + +vm_flags_clear (vma,VM_MAYWRITE ); + } vma->vm_private_data = vdev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1049/2651 vfio/fsl-mc: prevent read-only region mappings from becoming writable
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdifatah Suruur <[email protected]>
[ Upstream commit 25fd8b27ee8d4f59cc2ad99cf67aef4570b82096 ]
vfio_fsl_mc_mmap() rejects writable mappings of regions without the WRITE flag, but leaves VM_MAYWRITE set. Userspace can map such a region read-only and then upgrade the mapping to writable with mprotect().
Clear VM_MAYWRITE for regions without the WRITE flag, as i915 does for its read-only objects and as fixed in drm/vc4 (CVE-2026-68445), drm/panthor (CVE-2024-53071) and commit a5edadbae57e ("ptp: vmclock:
prevent read-only mappings from becoming writable").
Note this is defensive hardening: the fsl-mc bus publishes all device regions with the WRITE flag set, so no device can currently reach the read-only path. The guard costs nothing and keeps the mmap() interface honest if a read-only region ever appears.
--- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/vfio/fsl-mc/vfio_fsl_mc.c +7 -3
@@ -403,9 +403,13 @@ static int vfio_fsl_mc_mmap(struct vfio_device *core_vdev, && (vma->vm_flags & VM_READ))return -EINVAL ; -if (!(vdev->regions[index].flags &VFIO_REGION_INFO_FLAG_WRITE ) - && (vma->vm_flags &VM_WRITE )) -return -EINVAL ; +/* Prevent read-only region mappings from being upgraded with mprotect() */ +if (!(vdev->regions[index].flags &VFIO_REGION_INFO_FLAG_WRITE )) { +if (vma->vm_flags &VM_WRITE ) +return -EINVAL ; + +vm_flags_clear (vma,VM_MAYWRITE ); + } vma->vm_private_data = mc_dev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1050/2651 vfio/cdx: prevent read-only region mappings from becoming writable
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdifatah Suruur <[email protected]>
[ Upstream commit 9c5cd385d295fa8621dff0e9f6063e3f6ff24159 ]
vfio_cdx_mmap() rejects writable mappings of regions without the WRITE flag, but leaves VM_MAYWRITE set. Userspace can map such a region read-only and then upgrade the mapping to writable with mprotect(), writing to MMIO regions the device marks read-only.
Clear VM_MAYWRITE for regions without the WRITE flag, as i915 does for its read-only objects and as fixed in drm/vc4 (CVE-2026-68445), drm/panthor (CVE-2024-53071) and commit a5edadbae57e ("ptp: vmclock:
prevent read-only mappings from becoming writable").
Note this is defensive hardening: no in-tree cdx device currently publishes a region without the WRITE flag. The guard costs nothing and keeps the mmap() interface honest if a read-only region ever appears.
--- drivers/vfio/cdx/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/vfio/cdx/main.c +7 -3
@@ -281,9 +281,13 @@ static int vfio_cdx_mmap(struct vfio_device *core_vdev, (vma->vm_flags & VM_READ))return -EPERM ; -if (!(vdev->regions[index].flags &VFIO_REGION_INFO_FLAG_WRITE ) && - (vma->vm_flags &VM_WRITE )) -return -EPERM ; +/* Prevent read-only region mappings from being upgraded with mprotect() */ +if (!(vdev->regions[index].flags &VFIO_REGION_INFO_FLAG_WRITE )) { +if (vma->vm_flags &VM_WRITE ) +return -EPERM ; + +vm_flags_clear (vma,VM_MAYWRITE ); + }return vfio_cdx_mmap_mmio (vdev->regions[index], vma); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1051/2651 selftests/timers: clocksource-switch: Fix unchecked open()/read()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingshuang Fu <[email protected]>
[ Upstream commit 348f54c435bf3177baa78201952810b255d44b30 ]
get_clocksources() and get_cur_clocksource() open and read the clocksource sysfs files without checking the return values and without NUL-terminating the buffer.
If open() fails, read() is called on fd -1 and returns -1, which is stored in a size_t as SIZE_MAX. The token-scanning loop in get_clocksources() then walks past the uninitialized stack buffer, reading and writing out of bounds. Even on success the buffer is not NUL-terminated, so a fully read buffer makes the inner scan run past the data, and get_cur_clocksource() lets change_clocksource() call strlen() on a non-terminated buffer.
Check the open()/read() results, use ssize_t for the read length, NUL-terminate the buffer, and close the fd in get_cur_clocksource().
--- .../selftests/timers/clocksource-switch.c | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
tools/testing/selftests/timers/clocksource-switch.c +20 -3
@@ -40,16 +40,23 @@int get_clocksources (char list[][30 ]) {int fd, i; -size_t size; +ssize_t size;char buf[512 ];char *head, *tmp; fd =open ("/sys/devices/system/clocksource/clocksource0/available_clocksource" ,O_RDONLY ); +if (fd <0 ) +return 0 ; - size =read (fd, buf,512 ); + size =read (fd, buf,sizeof (buf) -1 );close (fd); +if (size <=0 ) +return 0 ; + + buf[size] ='\0' ; +for (i =0 ; i <10 ; i++) list[i][0 ] ='\0' ;
@@ -74,11 +81,21 @@ int get_clocksources(char list[][30])int get_cur_clocksource (char *buf,size_t size) { +ssize_t len;int fd; fd =open ("/sys/devices/system/clocksource/clocksource0/current_clocksource" ,O_RDONLY ); +if (fd <0 ) +return -1 ; + + len =read (fd, buf, size -1 ); + +close (fd); + +if (len <=0 ) +return -1 ; - size =read (fd, buf, size); + buf[len] ='\0' ;return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1052/2651 kbuild: Mark usr_gen_init_cpio as no-dot-config-target
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Schier <[email protected]>
[ Upstream commit 14e2c1f5431a03478ed4bbf2e72298c769f375ac ]
Let usr/gen_init_cpio be built also if there is no kernel configuration.
Askar Safin reported that gen_init_cpio may be of use before any kernel configuration is available. Add usr_gen_init_cpio to list of targets that do not require a .config file.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -298,6 +298,7 @@ no-dot-config-targets := $(clean-targets) \ %asm-generic kernelversion %src-pkg dt_binding_check \ dt_style_selftest \ outputmakefile rustavailable rustfmt rustfmtcheck \ + usr_gen_init_cpio \ run-command no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \ image_name
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1053/2651 perf symbols: Dont let a modules last symbol overlap the next module
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alireza Haghdoost <[email protected]>
[ Upstream commit 45d15e89a783a0a279b7a54f9018c230127380d7 ]
symbols__fixup_end() extends a zero-size symbol that is the last one in the kernel or in a module to the end of the next page. On x86 the next module can start in that page, so the stretched symbol overlaps it, and a lookup can return the wrong symbol. For example:
ffffffffc0c4aa50 t dca_sysfs_exit [dca]
ffffffffc0c4b000 t __nft_trace_packet [nf_tables]
ffffffffc0c4b0b0 t nft_do_chain [nf_tables]
dca_sysfs_exit gets end 0xffffffffc0c4c000, and samples in nft_do_chain are reported as dca_sysfs_exit.
This patch clamps the end to the next symbol's start. The ARM case this code was added for, where the next module is far away, is unchanged.
Add a "Kallsyms symbol ends" test case to the Symbols suite that covers the kernel/module boundary, adjacent modules and a distant module.
--- tools/perf/tests/symbols.c | 96 +++++++++++++++++++++++++++++++++++++- tools/perf/util/symbol.c | 4 ++ 2 files changed, 99 insertions(+), 1 deletion(-)
tools/perf/tests/symbols.c +95 -1
@@ -2,6 +2,7 @@#include <linux/compiler.h> #include <linux/string.h> #include <sys/mman.h> +#include <inttypes.h> #include <limits.h> #include "debug.h" #include "dso.h"
@@ -223,4 +224,97 @@ static int test__symbols(struct test_suite *test __maybe_unused, int subtest __mreturn ret; } -DEFINE_SUITE ("Symbols" , symbols); +struct kallsyms_sym { +u64 start; +const char *name; +}; + +/* +* kallsyms from an x86 host where nf_tables was loaded in the page right +* after the last symbol of dca, plus a kernel symbol followed closely by a +* module and a module far away from the others. +*/ +static const struct kallsyms_sym kallsyms_syms[] = { + {0xffffffff81000000 ,"_stext" }, + {0xffffffff81000ff0 ,"last_kernel_symbol" }, + {0xffffffff81001000 ,"near_module_symbol\t[near]" }, + {0xffffffffc0c4aa40 ,"dca_exit\t[dca]" }, + {0xffffffffc0c4aa50 ,"dca_sysfs_exit\t[dca]" }, + {0xffffffffc0c4b000 ,"__nft_trace_packet\t[nf_tables]" }, + {0xffffffffc0c4b0b0 ,"nft_do_chain\t[nf_tables]" }, + {0xffffffffc0c4b4e0 ,"nf_tables_core_module_exit\t[nf_tables]" }, + {0xffffffffc2000000 ,"far_module_symbol\t[far]" }, +}; + +static int check_symbol (struct dso *dso,u64 addr,const char *name,u64 end) +{ +struct symbol *sym =dso__find_symbol_nocache (dso, addr); + +if (!sym ||strcmp (sym->name, name)) { +pr_debug ("%#" PRIx64": expected %s, got %s\n" , addr, name, + sym ? sym->name :"no symbol" ); +return TEST_FAIL ; + } +if (sym->end != end) { +pr_debug ("%s: expected end %#" PRIx64", got %#" PRIx64"\n" , + name, end, sym->end); +return TEST_FAIL ; + } +return TEST_OK ; +} + +static int test__kallsyms_fixup_end (struct test_suite *test__maybe_unused , +int subtest__maybe_unused ) +{ +struct dso *dso =dso__new ("[kernel.kallsyms]" ); +int ret =TEST_FAIL ; + +if (!dso) +return TEST_FAIL ; + +for (unsigned int i =0 ; i <ARRAY_SIZE (kallsyms_syms); i++) { +struct symbol *sym =symbol__new (kallsyms_syms[i].start,0 ,0 ,0 , + kallsyms_syms[i].name); + +if (!sym) + goto out; +symbols__insert (dso__symbols (dso), sym); + } + +symbols__fixup_end (dso__symbols (dso), true); + + ret =TEST_OK ; +/* The next symbol is too close for the end of the page. */ +if (check_symbol (dso,0xffffffff81000ff8 ,"last_kernel_symbol" , +0xffffffff81001000 )) + ret =TEST_FAIL ; +if (check_symbol (dso,0xffffffffc0c4aa58 ,"dca_sysfs_exit\t[dca]" , +0xffffffffc0c4b000 )) + ret =TEST_FAIL ; +if (check_symbol (dso,0xffffffffc0c4b280 ,"nft_do_chain\t[nf_tables]" , +0xffffffffc0c4b4e0 )) + ret =TEST_FAIL ; + +/* Far from the next module, the end of the page is still used. */ +if (check_symbol (dso,0xffffffffc0c4b4f0 , +"nf_tables_core_module_exit\t[nf_tables]" , +0xffffffffc0c4d000 )) + ret =TEST_FAIL ; +if (check_symbol (dso,0xffffffff81001008 ,"near_module_symbol\t[near]" , +0xffffffff81002000 )) + ret =TEST_FAIL ; +out: +dso__put (dso); +return ret; +} + +static struct test_case tests__symbols[] = { +TEST_CASE ("Symbols" , symbols), +TEST_CASE ("Kallsyms symbol ends" , kallsyms_fixup_end), + { .name =NULL , } +}; + +struct test_suite suite__symbols = { + .desc ="Symbols" , + .test_cases = tests__symbols, +};
tools/perf/util/symbol.c +4 -0
@@ -301,6 +301,10 @@ void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kallsyms)else prev->end = curr->start; +/* The next module can start within that page */ +if (prev->end > curr->start) + prev->end = curr->start; +pr_debug4 ("%s sym:%s end:%#" PRIx64"\n" , __func__, prev->name, prev->end); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1054/2651 RDMA/rtrs-clt: Validate peer-supplied IO completion msg_id
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quanye Yang <[email protected]>
[ Upstream commit c1fcde82f7b68181553af7efb4410df04109a9a8 ]
process_io_rsp() indexes clt_path->reqs[] with the 19-bit msg_id taken from a WRITE_WITH_IMM immediate. That value is chosen by the peer. The only check was WARN_ON(msg_id >= queue_depth), which still lets a completion run after free_path_reqs() has set reqs to NULL, or against a slot whose FRWR is already gone. Either path dereferences req->mr and can GPF; KASAN reports a null-ptr-deref at offsetof(struct rtrs_clt_io_req, mr).
Treat a missing reqs array, an out-of-range msg_id, or a req without an MR as a protocol error and recover the connection.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +16 -5
@@ -489,18 +489,22 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *con, imm, flags, wr, NULL); } -static void process_io_rsp (struct rtrs_clt_path *clt_path,u32 msg_id, +static bool process_io_rsp (struct rtrs_clt_path *clt_path,u32 msg_id,s16 errno,bool w_inval) {struct rtrs_clt_io_req *req; -if (WARN_ON (msg_id >= clt_path->queue_depth)) -return ; +if (!clt_path->reqs || msg_id >= clt_path->queue_depth) +return false; req = &clt_path->reqs[msg_id]; +if (!req->mr) +return false; +/* Drop need_inv if server responded with send with invalidation */ req->mr->need_inval &= !w_inval;complete_rdma_req (req, errno, true, false); +return true; }static void rtrs_clt_recv_done (struct rtrs_clt_con *con,struct ib_wc *wc)
@@ -562,7 +566,8 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con *con, struct ib_wc *wc)if (WARN_ON (buf_id != msg_id)) goto out; clt_path->rbufs[buf_id].rkey =le32_to_cpu (msg->rkey); -process_io_rsp (clt_path, msg_id, err, w_inval); +if (!process_io_rsp (clt_path, msg_id, err, w_inval)) + goto out; }ib_dma_sync_single_for_device (clt_path->s.dev->ib_dev, iu->dma_addr, iu->size,DMA_FROM_DEVICE );
@@ -634,7 +639,13 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc) w_inval = (imm_type ==RTRS_IO_RSP_W_INV_IMM );rtrs_from_io_rsp_imm (imm_payload, &msg_id, &err); -process_io_rsp (clt_path, msg_id, err, w_inval); +if (!process_io_rsp (clt_path, msg_id, err, w_inval)) { +rtrs_err (clt_path->clt, +"Invalid IO rsp: msg_id %u queue_depth %zu\n" , + msg_id, clt_path->queue_depth); +rtrs_rdma_error_recovery (con); +return ; + } }else if (imm_type ==RTRS_HB_MSG_IMM ) {WARN_ON (con->c.cid);rtrs_send_hb_ack (&clt_path->s);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1055/2651 RDMA/siw: Fix length of first chunk in siw_try_1seg()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Serhat Kumral <[email protected]>
[ Upstream commit aac27aa8c5cfe3c3c6029b9c0f1113e0a53329de ]
When a short-single SGE payload crosses a page boundary, siw_try_1seg() computes the length of the first chunk as the amount that spills into the second page instead of the amount left in the first page
part = bytes - (PAGE_SIZE - off);
Use the remaining length of the first page as the first chunk.
--- drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_qp_tx.c +1 -1
@@ -85,7 +85,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)if (likely (PAGE_SIZE - off >= bytes)) {memcpy (paddr, buffer + off, bytes); }else { -unsigned long part = bytes - (PAGE_SIZE - off); +unsigned long part =PAGE_SIZE - off;memcpy (paddr, buffer + off, part);kunmap_local (buffer);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1056/2651 RDMA/selftests: Fix the kernel config fragment
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f5d4cc88371feb9c5f96b6fb7fce5e8cb08ecb6a ]
The config fragment lists bare option names with no values:
CONFIG_TUN
CONFIG_VETH
CONFIG_DUMMY
CONFIG_NET_NS
CONFIG_RDMA_RXE
which is not valid Kconfig syntax. When the fragment is merged, for example by "make kselftest-merge" or by CI systems, the lines are rejected:
.config:5514:warning: unexpected data: CONFIG_TUN .config:5515:warning: unexpected data: CONFIG_VETH .config:5516:warning: unexpected data: CONFIG_DUMMY
and none of the options gets enabled, so the rxe tests skip or fail for lack of the modules they load.
Give each option a value. The scripts load and unload tun, veth, dummy and rdma_rxe with modprobe, so build those as modules. RDMA_RXE also depends on INFINIBAND, and rxe_rping_between_netns.sh runs rping, which needs the RDMA CM userspace interface provided by INFINIBAND_USER_ACCESS, so add both.
Found by KernelCI kselftest builds.
--- tools/testing/selftests/rdma/config | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tools/testing/selftests/rdma/config +7 -5
@@ -1,5 +1,7 @@ -CONFIG_TUN -CONFIG_VETH -CONFIG_DUMMY -CONFIG_NET_NS -CONFIG_RDMA_RXE +CONFIG_TUN=m +CONFIG_VETH=m +CONFIG_DUMMY=m +CONFIG_NET_NS=y +CONFIG_INFINIBAND=m +CONFIG_INFINIBAND_USER_ACCESS=m +CONFIG_RDMA_RXE=m
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1057/2651 rtla/tests: Use absolute path for $RTLA
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Crystal Wood <[email protected]>
[ Upstream commit 7a5e8f91516d739c833e87591fbceac56a38628d ]
When running the tests directly instead of from the makefile, RTLA is likely to be unset. The default "./rtla" no longer works, due to having changed the current diretory.
--- tools/tracing/rtla/tests/engine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/tests/engine.sh +1 -1
@@ -7,7 +7,7 @@ test_begin() { # Set test directory to the directory of the script scriptfile=$(realpath "$0") testdir=$(dirname "$scriptfile") - [ -z "$RTLA" ] && RTLA="./rtla" + [ -z "$RTLA" ] && RTLA="$(pwd)/rtla" [ -n "$TEST_COUNT" ] && echo "1..$TEST_COUNT" }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1058/2651 RDMA/hfi1: shut down the trap timer before unregistering
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyan Xu <[email protected]>
[ Upstream commit a1c9d476c2316685f85fffb6450ad88d01836357 ]
MAD processing arms a trap timer embedded in each hfi1_ibport. Device unregistration does not stop the timer, so its callback can run after the port and its containing hfi1_devdata have been released.
Shut down every port timer before unregistering the IB device. The shutdown form also prevents a concurrent path from rearming the timer.
--- drivers/infiniband/hw/hfi1/verbs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/hfi1/verbs.c +4 -0
@@ -1888,6 +1888,10 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)void hfi1_unregister_ib_device (struct hfi1_devdata *dd) {struct hfi1_ibdev *dev = &dd->verbs_dev; +int i; + +for (i =0 ; i < dd->num_pports; i++) +timer_shutdown_sync (&dd->pport[i].ibport_data.rvp.trap_timer);hfi1_verbs_unregister_sysfs (dd);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1059/2651 RDMA/hfi1: quiesce SDMA asynchronous cleanup on exit
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyan Xu <[email protected]>
[ Upstream commit e95d076bc1fca7cc36fc8f2f0e9687f79fd314bd ]
The SDMA state reference and completion cover the software cleanup tasklet, but not the hardware cleanup tasklet, err_halt_worker, or flush_worker. Queued instances can therefore access an SDMA engine after per_sdma is released.
After the state machine has stopped, cancel err_halt_worker first because it can publish the hardware cleanup tasklet. Then kill that tasklet and drain the remaining flush work.
--- drivers/infiniband/hw/hfi1/sdma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hfi1/sdma.c +3 -0
@@ -1569,6 +1569,9 @@ void sdma_exit(struct hfi1_devdata *dd)* it is not running. */ sdma_finalput (&sde->state); +cancel_work_sync (&sde->err_halt_worker); +tasklet_kill (&sde->sdma_hw_clean_up_task); +cancel_work_sync (&sde->flush_worker); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1060/2651 pinctrl: nuvoton: Fix clock reference leak in ma35_get_bank_data()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit a854aa8e550502ef05c2836a4b426141d735bed1 ]
ma35_get_bank_data() obtains the bank clock with of_clk_get() and stores it in bank->clk, but returns clk_prepare_enable() directly. If that call fails, the reference taken by of_clk_get() is never dropped, and the driver has no other clk_put() for it.
Drop the reference when clk_prepare_enable() fails.
--- drivers/pinctrl/nuvoton/pinctrl-ma35.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/pinctrl/nuvoton/pinctrl-ma35.c +7 -1
@@ -557,6 +557,8 @@ static int ma35_gpiolib_register(struct platform_device *pdev, struct ma35_pinctstatic int ma35_get_bank_data (struct ma35_pin_bank *bank) { +int ret; + bank->reg_base =fwnode_iomap (bank->fwnode,0 );if (!bank->reg_base)return -ENOMEM ;
@@ -569,7 +571,11 @@ static int ma35_get_bank_data(struct ma35_pin_bank *bank)if (IS_ERR (bank->clk))return PTR_ERR (bank->clk); -return clk_prepare_enable (bank->clk); + ret =clk_prepare_enable (bank->clk); +if (ret) +clk_put (bank->clk); + +return ret; }static int ma35_pinctrl_get_soc_data (struct ma35_pinctrl *pctl,struct platform_device *pdev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1061/2651 pinctrl: stm32: Fix clock reference leak in stm32_pctl_probe()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit dfd8259507c53a3c7eb0dd11c1152c88e12aa316 ]
stm32_pctl_probe() obtains one clock per bank with of_clk_get_by_name(), but none of the error paths drop those
references: the loop returns directly when a later clock lookup fails, and both the clk_bulk_prepare_enable() failure and the err_register path return without calling clk_bulk_put(). clk_bulk_disable_unprepare() only disables the clocks, it does not release them.
Release the references on these paths; the success path keeps them as the driver needs them for suspend/resume.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pinctrl/stm32/pinctrl-stm32.c +3 -0
@@ -1980,6 +1980,7 @@ int stm32_pctl_probe(struct platform_device *pdev) pctl->clks[i].clk =of_clk_get_by_name (np,NULL );if (IS_ERR (pctl->clks[i].clk)) {fwnode_handle_put (child); +clk_bulk_put (i, pctl->clks);return dev_err_probe (dev,PTR_ERR (pctl->clks[i].clk),"failed to get clk\n" ); }
@@ -1990,6 +1991,7 @@ int stm32_pctl_probe(struct platform_device *pdev) ret =clk_bulk_prepare_enable (banks, pctl->clks);if (ret) {dev_err (dev,"failed to prepare_enable clk (%d)\n" , ret); +clk_bulk_put (banks, pctl->clks);return ret; }
@@ -2014,6 +2016,7 @@ int stm32_pctl_probe(struct platform_device *pdev) }clk_bulk_disable_unprepare (banks, pctl->clks); +clk_bulk_put (banks, pctl->clks);return ret; }EXPORT_SYMBOL (stm32_pctl_probe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1062/2651 kconfig: tests: Reset all KCONFIG_* env variables by default
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Schier <[email protected]>
[ Upstream commit 8688f0b29d021cad8188b11d5664b4a1f595691b ]
Reset all environment variables with names starting with 'KCONFIG_' from the user-provided environment.
This fixes the 'warn_changed_input' test on systems with KCONFIG_WARN_CHANGED_INPUT=1 and ensures a cleaner test environment.
--- scripts/kconfig/tests/conftest.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
scripts/kconfig/tests/conftest.py +7 -4
@@ -57,9 +57,12 @@ class Conf: # Override 'srctree' environment to make the test as the top directory extra_env['srctree'] = self._test_dir - # Clear KCONFIG_DEFCONFIG_LIST to keep unit tests from being affected - # by the user's environment. - extra_env['KCONFIG_DEFCONFIG_LIST'] = '' + # Clear all KCONFIG_* environment variables + env = { + varname: os.environ[varname] + for varname in os.environ.keys() + if not varname.startswith("KCONFIG_") + } # Run Kconfig in a temporary directory. # This directory is automatically removed when done.
@@ -75,7 +78,7 @@ class Conf: stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=temp_dir, - env=dict(os.environ, **extra_env)) + env=dict(env, **extra_env)) # If input key sequence is given, feed it to stdin. if in_keys:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1063/2651 kconfig: tests: Provide defconfig outfile for savedefconfig
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Schier <[email protected]>
[ Upstream commit 09bd92ba15bd00d937deea38a10a439458393043 ]
Let kconfig test framework's 'savedefconfig' forward the requested output 'defconfig' filename to 'conf'.
The original implementation was calling 'conf' with '--savedefconfig' but missed the mandatory filename for the defconfig output file.
While at it, honour the 'dot_config' argument which points to the input config file.
--- scripts/kconfig/tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/tests/conftest.py +2 -1
@@ -235,7 +235,8 @@ class Conf: dot_config: .config file for input returncode: exit status of the Kconfig executable """ - return self._run_conf('--savedefconfig', out_file='defconfig') + return self._run_conf('--savedefconfig={}'.format(out_file), + dot_config=dot_config, out_file='defconfig') def listnewconfig(self, dot_config=None): """Run listnewconfig.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1064/2651 RDMA/irdma: Do not move a fresh RoCE QP to ERROR on RESET
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyễn Văn Cao Nguyên <[email protected]>
[ Upstream commit 6de34bfb56ad8c24bf63b243b5f32b345d9cdd4d ]
irdma_modify_qp_roce() handles IB_QPS_RESET like IB_QPS_ERR and moves the QP to ERROR. On a QP that was never moved to INIT, this makes the following RESET->INIT fail with -EINVAL, while ibv_query_qp() still reports RESET.
RESET->RESET is a valid transition. The Mooncake transfer engine resets every new QP before INIT, so it cannot connect over an E810, while mlx5 accepts the same sequence:
ibv_create_qp(RC) -> RESET
ibv_modify_qp(RESET) -> 0
ibv_modify_qp(INIT, ...) -> -EINVAL
Skip the hardware modify when the QP has not been moved to INIT yet (iwarp_state is IRDMA_QP_STATE_INVALID), as there is nothing to flush. RESET after INIT still goes to ERROR.
--- drivers/infiniband/hw/irdma/verbs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/verbs.c +9 -1
@@ -1576,9 +1576,17 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, issue_modify_qp =1 ; iwqp->suspend_pending = true;break ; +case IB_QPS_RESET : +/* +* A QP that was never moved to INIT has nothing to +* flush, so skip the hardware modify. Moving it to +* ERROR would make the following INIT fail. +*/ +if (iwqp->iwarp_state ==IRDMA_QP_STATE_INVALID ) +break ; + fallthrough;case IB_QPS_SQE :case IB_QPS_ERR : -case IB_QPS_RESET :if (iwqp->iwarp_state ==IRDMA_QP_STATE_ERROR ) { iwqp->ibqp_state = attr->qp_state;spin_unlock_irqrestore (&iwqp->lock, flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1065/2651 rtc: bd70528: properly enable wakeup
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
[ Upstream commit cb8a6249236fd970fc3418d5d2b27dc37376f3ff ]
Wakeup on RTC alarm now only accidentially works when wakeup for the power button connected to the same PMIC is also enabled. Fix that by properly specifying the wakeup irq.
--- drivers/rtc/rtc-bd70528.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/rtc/rtc-bd70528.c +5 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> #include <linux/regmap.h> #include <linux/rtc.h>
@@ -321,6 +322,10 @@ static int bd70528_probe(struct platform_device *pdev)device_set_wakeup_capable (&pdev->dev, true);device_wakeup_enable (&pdev->dev); + ret =devm_pm_set_wake_irq (&pdev->dev, irq); +if (ret) +return ret; + rtc =devm_rtc_allocate_device (&pdev->dev);if (IS_ERR (rtc)) {dev_err (&pdev->dev,"RTC device creation failed\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1066/2651 ALSA: usb-audio: Fix UAC2 mixer unit request handling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 0458d97859840506c3688a963dcd4f72b4a23083 ]
For a request for a Mixer Unit on UAC2 (also UAC3), the wValue is different from UAC1 and an incompatible value must be passed. Namely, UAC1 takes a word consisting of 1-based input channel in the high byte and 1-based output channel in the low byte. Meanwhile, UAC2/3 takes UAC2_MU_MIXER in the high byte and a MCN (0-based bit position of input/output channels) in the low byte. The current driver implementation blindly assumes the UAC1 way, hence it would cause a firmware error.
This patch attempts to implement the conversion to UAC2 MCN at get_ctl_value_v2() and snd_usb_mixer_set_ctl_value() for mixer units. At the points above, the old wValue containing ICN and OCN is converted to the corresponding MCN, and it's used as the proper wValue.
--- sound/usb/mixer.c | 23 +++++++++++++++++++++++ sound/usb/mixer.h | 2 ++ 2 files changed, 25 insertions(+)
sound/usb/mixer.c +23 -0
@@ -335,6 +335,17 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,return -EINVAL ; } +/* convert the given UAC1 wValue (ICN|OCN) to UAC2 MCN */ +static unsigned char to_mcn (const struct usb_mixer_elem_info *cval, +unsigned int validx) +{ +unsigned char m = (validx >>8 ) &0xff ;/* 1-based input channel */ +unsigned char v = validx &0xff ;/* 1-based output channel */ + +/* num_inputs * num_outputs is guaranteed to be < 256 */ +return (m -1 ) * cval->num_outputs + (v -1 ); +} +static int get_ctl_value_v2 (struct usb_mixer_elem_info *cval,int request,int validx,int *value_ret) {
@@ -347,6 +358,10 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, val_size =uac2_ctl_value_size (cval->val_type); +/* correct wValue for UAC2 mixer control with MCN */ +if (cval->v2_mixer) + validx = (UAC2_MU_MIXER <<8 ) |to_mcn (cval, validx); +if (request ==UAC_GET_CUR ) { bRequest =UAC2_CS_CUR ; size = val_size;
@@ -478,6 +493,10 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, } request =UAC2_CS_CUR ; + +/* correct wValue for UAC2 mixer control with MCN */ +if (cval->v2_mixer) + validx = (UAC2_MU_MIXER <<8 ) |to_mcn (cval, validx); } value_set =convert_bytes_value (cval, value_set);
@@ -2345,6 +2364,10 @@ static void build_mixer_unit_ctl(struct mixer_build *state,snd_usb_mixer_elem_init_std (&cval->head, state->mixer, unitid); cval->control = in_ch +1 ;/* based on 1 */ +if (state->mixer->protocol ==UAC_VERSION_2 || + state->mixer->protocol ==UAC_VERSION_3 ) + cval->v2_mixer = true; + cval->num_outputs = num_outs; cval->val_type =USB_MIXER_S16 ;for (i =0 ; i < num_outs; i++) {__u8 *c =uac_mixer_unit_bmControls (desc, state->mixer->protocol);
sound/usb/mixer.h +2 -0
@@ -97,6 +97,8 @@ struct usb_mixer_elem_info {u8 initialized;u8 min_mute;u8 get_cur_broken; +u8 num_outputs; +bool v2_mixer;void *private_data; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1067/2651 spi: spi-qpic-snand: set qpic_version2 flag
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
[ Upstream commit 52efc89ccf664dcfa331fbdf2f5c8d3acd45a863 ]
The kerneldoc of 'struct qcom_nandc_props' says this about the 'qpic_version2' member of the structure:
"flag to indicate QPIC IP version 2"
Since the SNAND controller is based on QPIC v2, set the flag in the device specific properties.
--- drivers/spi/spi-qpic-snand.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-qpic-snand.c +1 -0
@@ -1701,6 +1701,7 @@ static void qcom_spi_remove(struct platform_device *pdev)static const struct qcom_nandc_props ipq9574_snandc_props = { .dev_cmd_reg_start =0x7000 , .bam_offset =0x30000 , + .qpic_version2 = true, .supports_bam = true, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1068/2651 f2fs: quota: fix unused-label warning
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 4faeea625cf730bb20f609f061ff81c9b6852931 ]
The newly added label causes a warning when QUOTA is turned off:
fs/f2fs/super.c: In function '__f2fs_remount':fs/f2fs/super.c:3142:1: error: label 'restore_holder' defined but not used [-Werror=unused-label]
3142 | restore_holder:
| ^~~~~~~~~~~~~~
--- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/super.c +2 -0
@@ -3126,7 +3126,9 @@ static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) sbi->mount_opt = org_mount_opt; sb->s_flags = old_sb_flags; +#ifdef CONFIG_QUOTA restore_holder: +#endif sbi->umount_lock_holder =NULL ;return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1069/2651 f2fs: reject device aliasing without a multi-device configuration
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seongjae Jeong <[email protected]>
[ Upstream commit 7566fec606d233f803e61f5ce37c54fbcdb00010 ]
A malformed F2FS image can enable F2FS_FEATURE_DEVICE_ALIAS without providing a multi-device configuration. For a regular single-device filesystem, f2fs_scan_devices() returns without allocating sbi->devs.
In this state, f2fs_dev_is_alloc_blocked() passes the device alias feature check and dereferences FDEV(0), resulting in a NULL pointer dereference during segment allocation.
Device aliasing requires at least one secondary device. Reject superblocks that enable device aliasing without entries for both the main and secondary devices in sanity_check_raw_super().
--- fs/f2fs/super.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/f2fs/super.c +6 -0
@@ -4178,6 +4178,12 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,return -EFSCORRUPTED ; } +if (__F2FS_HAS_FEATURE (raw_super,F2FS_FEATURE_DEVICE_ALIAS ) && + (!RDEV (0 ).path[0 ] || !RDEV (1 ).path[0 ])) { +f2fs_info (sbi,"Device aliasing requires a multi-device configuration" ); +return -EFSCORRUPTED ; + } +if (RDEV (0 ).path[0 ]) {block_t dev_seg_count =le32_to_cpu (RDEV (0 ).total_segments);int i =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1070/2651 perf test demangle: Fail when demangling fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pluta <[email protected]>
[ Upstream commit 0568396eac41b56874d6ac0c552df91262e2ccf6 ]
The Rust and Java demangle tests only log a NULL result from dso__demangle_sym() and carry on, so a symbol that fails to demangle doesn't fail the test. Set TEST_FAIL.
--- tools/perf/tests/demangle-java-test.c | 1 + tools/perf/tests/demangle-rust-v0-test.c | 1 + 2 files changed, 2 insertions(+)
tools/perf/tests/demangle-java-test.c +1 -0
@@ -33,6 +33,7 @@ static int test__demangle_java(struct test_suite *test __maybe_unused, int subteif (!buf) {pr_debug ("FAILED to demangle: \"%s\"\n \"%s\"\n" , test_cases[i].mangled, test_cases[i].demangled); + ret =TEST_FAIL ;continue ; }if (strcmp (buf, test_cases[i].demangled)) {
tools/perf/tests/demangle-rust-v0-test.c +1 -0
@@ -58,6 +58,7 @@ static int test__demangle_rust(struct test_suite *test __maybe_unused, int subteif (!buf) {pr_debug ("FAILED to demangle: \"%s\"\n \"%s\"\n" , test_cases[i].mangled, test_cases[i].demangled); + ret =TEST_FAIL ;continue ; }if (strcmp (buf, test_cases[i].demangled)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1071/2651 perf symbol: Dont return an unterminated Rust demangle buffer
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pluta <[email protected]>
[ Upstream commit 0b0752e8a493634915e16456df609c08c0595e85 ]
When dso__demangle_sym() runs out of retries or fails to grow the output buffer for a Rust v0 symbol, it returns the buffer and callers blindly use it as the demangled symbol name. However, rust_demangle_display_demangle() doesn't NUL terminate its output when it reports OverflowOverflow, so the buffer isn't a string.
Free the buffer and return NULL in both cases. Callers already fall back to the mangled name when no demangled name is returned.
--- tools/perf/util/symbol.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
tools/perf/util/symbol.c +5 -6
@@ -2765,17 +2765,16 @@ char *dso__demangle_sym(struct dso *dso, int kmodule, const char *elf_name) buf_len < 1024 * 1024; buf_len += 32) {char *tmp =realloc (demangled, buf_len); -if (!tmp) { -/* Failure to grow output buffer, return what is there. */ -return demangled; - } +if (!tmp) +break ; demangled = tmp;if (rust_demangle_display_demangle (&rust_demangle, demangled, buf_len,/*alternate=*/ true) == OverflowOk)return demangled; } -/* Buffer exceeded sensible bounds, return what is there. */ -return demangled; +/* Failure to grow output buffer or buffer exceeded sensible bounds. */ +free (demangled); +return NULL ; } demangled =cxx_demangle_sym (elf_name, verbose >0 , verbose >0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1072/2651 cgroup/cpuset: Use cpuset_v2() in cpuset_num_cpus()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 5ffe20411787dd9947a35669ef8cb9484053efcf ]
The cpuset code has 2 different helpers for determining if it is in a v1 or v2 working environment - cpuset_v2() and is_in_v2_mode().
cpuset_v2() checks the binding of the cpuset subsystem is on a v1 or v2 hierarchy. It can also help to optimize out v1 specific code if CONFIG_CPUSETS_V1 isn't defined.
is_in_v2_mode() layers on top of cpuset_v2() and returns true if it is in a v2 hierarchy or in a v1 hierarchy with "cpuset_v2_mode" mount option enabled to make "cpuset.cpus" and "cpuset.mems" behave in a way similar to their v2 counterparts. However the cpuset hierarchy may still be a standalone one separated from the other cgroup hierarchies.
Commit 90ac22ffef48 ("sched/fair: Add cgroup_mode: max") adds a new cpuset_num_cpus() helper to return the number of effective CPUs in a given cgroup. It is part of the "sched: Flatten the pick" patch series to help flatten the cpu cgroup runqueue hierarchies. cpuset_num_cpus() currently uses is_in_v2_mode() to determine if it is in a v2 environment. However is_in_v2_mode() can be true in a v1 environment where the cpuset and cpu cgroup subsystems can be in two separate hierarchies. The current use case [1] for cpuset_num_cpus() assumes that it can return the number of effective CPUs present in the current cpu cgroup which may not be the case.
Fix that by switching to use cpuset_v2() which signifies that it is in a unified hierarchy where both cpuset and cpu cgroup subsystems share the same cgroup hierarchy if it returns true.
[1] https://lore.kernel.org/lkml/[email protected]
--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cpuset.c +1 -1
@@ -4337,7 +4337,7 @@ int cpuset_num_cpus(struct cgroup *cgrp)int nr =num_online_cpus ();struct cpuset *cs; -if (is_in_v2_mode ()) { +if (cpuset_v2 ()) {guard (rcu)(); cs =css_cs (cgroup_e_css (cgrp, &cpuset_cgrp_subsys));if (cs)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1073/2651 perf build: Build the Python extension before pylint consumers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 179c2413bb601c94e144c7a84cd34ae3bee3b586 ]
Pylint checks for tests and standalone Python scripts can run before the perf Python extension is available. On a clean parallel build, an import error can stop make before the extension is built.
Run the script and test pylint checks in separate sub-makes after the language bindings are built. Keep their rules in the respective Build files so the perf and perf-test C sub-makes can compile concurrently with util and the Python extension. An isolated make perf does not need to build the extension just for these checks.
--- tools/perf/Build | 4 +++- tools/perf/Makefile.perf | 15 +++++++++++++++ tools/perf/tests/Build | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-)
tools/perf/Build +3 -1
@@ -103,4 +103,6 @@ $(OUTPUT)%.pylint_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(PYLINT_TEST_LOGS) +.PHONY: pylint +pylint: $(addprefix $(OUTPUT),$(PYLINT_TEST_LOGS)) + @:
tools/perf/Makefile.perf +15 -0
@@ -534,6 +534,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf PERF_IN := $(OUTPUT)perf-in.o + export NO_JEVENTS build := -f $(srctree)/tools/build/Makefile.build dir=. obj
@@ -589,6 +590,20 @@ $(SCRIPTS) : $(OUTPUT)% : %.sh $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) +ifdef PYLINT +# Run Python checks after the extension is ready, independently of C builds. +all: pylint-perf pylint-tests +.PHONY: pylint-perf pylint-tests + +pylint-perf pylint-tests: | $(LANG_BINDINGS) + +pylint-perf: + $(Q)$(MAKE) $(build)=perf pylint + +pylint-tests: + $(Q)$(MAKE) $(build)=perf-test dir=tests pylint +endif + # These can record PERF_VERSION perf.spec $(SCRIPTS) \ : $(OUTPUT)PERF-VERSION-FILE
tools/perf/tests/Build +3 -1
@@ -118,4 +118,6 @@ $(OUTPUT)%.pylint_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false) -perf-test-y += $(PYLINT_TEST_LOGS) +.PHONY: pylint +pylint: $(addprefix $(OUTPUT)tests/,$(PYLINT_TEST_LOGS)) + @:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1074/2651 perf sched stats: Reject mismatched or incomplete snapshots
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianyi Chen <[email protected]>
[ Upstream commit 9910ee15c9fc024e713b66403edf23976d33a857 ]
The before and after records are paired by list position. If a CPU or domain disappears, counters can be subtracted from a different record or left as absolute values. An extra record can also advance the cursor past the list.
Identify the second snapshot by its timestamp or CPU ordering, and require matching CPU/domain IDs and versions before subtracting. Check that every record has a counterpart before printing, and propagate errors from either input of diff.
Add a shell test with synthetic snapshots, including equal timestamps, CPU filtering, and missing or reordered CPU/domain records.
--- tools/perf/Documentation/perf-sched.txt | 6 +- tools/perf/builtin-sched.c | 189 ++++++++++++------ tools/perf/tests/shell/schedstat_snapshots.sh | 155 ++++++++++++++ 3 files changed, 283 insertions(+), 67 deletions(-) create mode 100755 tools/perf/tests/shell/schedstat_snapshots.sh
tools/perf/Documentation/perf-sched.txt +4 -2
@@ -95,8 +95,10 @@ There are several variants of 'perf sched': events, ``try_to_wakeup()`` call among others. This is useful in understanding the scheduler behavior for the workload. - Note: The tool will not give correct results if there is topological reordering or - online/offline of cpus in between capturing snapshots of `/proc/schedstat`. + Note: Reports reject incomplete snapshots and mismatched CPU or domain IDs. + Topology changes that retain the same IDs, including CPUs going offline + and returning online between snapshots, cannot be detected and may still + produce incorrect results. Example usage: perf sched stats record -- sleep 1
tools/perf/builtin-sched.c +124 -65
263 lines not on this page · raw message
tools/perf/tests/shell/schedstat_snapshots.sh new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1075/2651 tools/nolibc: stop rounding malloc() sizes up to 4096 bytes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <[email protected]>
[ Upstream commit b7db3ba9434cbad3d15f62500104525bfa28a304 ]
malloc() rounds the size of each mapping up to a multiple of 4096, presumably to align it to a page boundary. But the page size is not 4096 on all architectures, and mmap() and munmap() round the length up to the page size themselves.
Drop the rounding. As heap->len is no longer rounded up, growing a block with realloc() now always creates a new mapping.
Stable-dep-of: 2111eb4273e7 ("tools/nolibc: check for overflow in malloc()")
--- tools/include/nolibc/stdlib.h | 2 -- 1 file changed, 2 deletions(-)
tools/include/nolibc/stdlib.h +0 -2
@@ -130,9 +130,7 @@ void *malloc(size_t len) {struct nolibc_heap *heap; -/* Always allocate memory with size multiple of 4096. */ len =sizeof (*heap) + len; - len = (len +4095UL ) &-4096UL ; heap =mmap (NULL , len,PROT_READ |PROT_WRITE ,MAP_ANONYMOUS |MAP_PRIVATE ,-1 ,0 );if (__builtin_expect (heap ==MAP_FAILED ,0 ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1076/2651 tools/nolibc: check for overflow in malloc()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <[email protected]>
[ Upstream commit 2111eb4273e7fda0815de85319653104f323c441 ]
malloc() adds the size of its header to the requested size without checking for overflow. For a size within the header size of SIZE_MAX, the sum wraps around to a few bytes, and malloc() returns a single page instead of NULL.
calloc() checks its multiplication for overflow, but then passes the product to malloc(), so calloc(SIZE_MAX, 1) returns a single page too. So does realloc(ptr, SIZE_MAX).
Such a size is usually a bug in the caller, for instance a length of -1 used as a size_t, and returning a page instead of NULL can turn it into a heap overflow.
Fail with ENOMEM when adding the header overflows, as glibc does for sizes this large.
--- tools/include/nolibc/stdlib.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/include/nolibc/stdlib.h +5 -1
@@ -130,7 +130,11 @@ void *malloc(size_t len) {struct nolibc_heap *heap; - len =sizeof (*heap) + len; +if (__builtin_expect (__builtin_add_overflow (len,sizeof (*heap), &len),0 )) { +SET_ERRNO (ENOMEM ); +return NULL ; + } + heap =mmap (NULL , len,PROT_READ |PROT_WRITE ,MAP_ANONYMOUS |MAP_PRIVATE ,-1 ,0 );if (__builtin_expect (heap ==MAP_FAILED ,0 ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1077/2651 dt-bindings: vendor-prefixes: Add Sophos
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolo Giuliani <[email protected]>
[ Upstream commit 538f8ec6b9c711833c5217a8bd8207a282265303 ]
Add the "sophos" vendor prefix for Sophos Ltd., a vendor of network security appliances.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1609,6 +1609,8 @@ patternProperties: description: Sony Corporation "^sophgo,.*": description: Sophgo Technology Inc. + "^sophos,.*": + description: Sophos Ltd. "^sourceparts,.*": description: Source Parts Inc. "^spacemit,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1078/2651 x86/hibernate: Ignore page-zero RAM in E820 checksum
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Goergens <[email protected]>
[ Upstream commit 29671cabfc09afb1ee2426b21173cdde276a95ac ]
The legacy kexec_load path reconstructs the E820 map exported through sysfs. kexec-tools leaves the first 1 KiB unavailable for the real-mode transition, so a kernel entered through kexec_load can see conventional RAM starting at 0x400. A subsequent firmware boot reports the same RAM range starting at zero.
The hibernation E820 checksum compares those byte representations and rejects the image, even though the maps agree from page one onwards. A QEMU guest showed this transition:
firmware: RAM [0-0x9fbff] kexec_load: gap [0-0x3ff], RAM [0x400-0x9fbff] firmware: RAM [0-0x9fbff]
The checksum covers e820_table_firmware, which trim_bios_range() leaves alone. The nosave regions come from e820_table instead, where trim_bios_range() has already turned conventional RAM in page zero into reserved memory, so page zero never occurs in the image, whatever the firmware map says about it.
Canonicalise only the conventional-RAM portion below PAGE_SIZE before calculating the checksum. Preserve RESERVED, ACPI, NVS, UNUSABLE, PMEM and all other E820 types so that changes to exceptional mappings remain detectable.
This is deliberately narrower than Marco Scardovi's June proposal to checksum only RAM and its opt-in relaxed_memmap successor. Rafael noted that ignoring non-RAM changes could hide moved ACPI or UEFI regions still used by the resumed kernel. This patch preserves every non-RAM entry and ignores only RAM within page zero, which common setup already reserves and excludes from the image.
Bump RESTORE_MAGIC, since the checksum semantics change, so that an image written by a kernel without this change is refused by the magic check instead of being compared under different rules.
In the same guest, with the page-zero difference kept, hibernation and resume now work after both a direct boot and a kexec_load boot. An image written by an unpatched kernel is refused at resume with "Unrecognized hibernate image header format!", and the firmware-booted kernel carries on.
--- arch/x86/power/hibernate.c | 51 +++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-)
arch/x86/power/hibernate.c +45 -6
@@ -63,6 +63,25 @@ struct restore_data_record {unsigned long e820_checksum; }; +static bool trim_e820_page_zero_ram (struct e820_entry *entry) +{ +u64 lowmem_size; + +/* +* Page zero is BIOS-owned and registered as nosave. Boot loaders may +* therefore omit part of its conventional RAM entry without changing +* any memory available to the image. Preserve all other E820 types. +*/ +if (entry->type !=E820_TYPE_RAM || entry->addr >=PAGE_SIZE ) +return true; + + lowmem_size =min_t (u64, entry->size,PAGE_SIZE - entry->addr); + entry->addr += lowmem_size; + entry->size -= lowmem_size; + +return entry->size; +} +/** * compute_e820_crc32 - calculate crc32 of a given e820 table *
@@ -70,18 +89,38 @@ struct restore_data_record {* * Return: the resulting checksum */ -static inline u32 compute_e820_crc32 (struct e820_table *table) +static u32 compute_e820_crc32 (struct e820_table *table) { -int size = offsetof(struct e820_table , entries) + -sizeof (struct e820_entry ) * table->nr_entries; +struct e820_entry entry; +u32 crc = ~0 ; +u32 nr_entries =0 ; +u32 i; + +for (i =0 ; i < table->nr_entries; i++) { + entry = table->entries[i]; +if (trim_e820_page_zero_ram (&entry)) + nr_entries++; + } + + crc =crc32_le (crc, (unsigned char const *)&nr_entries, +sizeof (nr_entries)); + +for (i =0 ; i < table->nr_entries; i++) { + entry = table->entries[i]; +if (!trim_e820_page_zero_ram (&entry)) +continue ; + + crc =crc32_le (crc, (unsigned char const *)&entry, +sizeof (entry)); + } -return ~crc32_le (~0 , (unsigned char const *)table, size); +return ~crc; }#ifdef CONFIG_X86_64 -#define RESTORE_MAGIC 0x23456789ABCDEF02UL +#define RESTORE_MAGIC 0x23456789ABCDEF03UL#else -#define RESTORE_MAGIC 0x12345679UL +#define RESTORE_MAGIC 0x1234567AUL#endif /**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1079/2651 ARM: mvebu: fix Cortex-A9 errata selection for Armada 38x
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <[email protected]>
[ Upstream commit 76e67df8bc1cb72157368c3669119e64cdb0a6a6 ]
Armada 38x uses Cortex-A9 r4p1, but MACH_ARMADA_38X selects the workaround for erratum 720789, which was fixed in r2p0, and omits workarounds for errata that still affect r4p1.
Drop ARM_ERRATA_720789 and select ARM_ERRATA_754322 for faulty MMU translations following an ASID switch and ARM_ERRATA_764319 for unexpected undefined instruction exceptions when reading debug registers. Also select ARM_ERRATA_764369 when SMP is enabled to work around cache maintenance by MVA failing to reach other agents.
The Cortex-A9 r4 Software Developers Errata Notice (ARM UAN 0009D) lists these errata in sections 2.3.3, 2.5.10 and 2.3.4, respectively.
--- arch/arm/mach-mvebu/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +3 -1
@@ -55,7 +55,9 @@ config MACH_ARMADA_375 config MACH_ARMADA_38X bool "Marvell Armada 380/385 boards" depends on ARCH_MULTI_V7 - select ARM_ERRATA_720789 + select ARM_ERRATA_754322 + select ARM_ERRATA_764319 + select ARM_ERRATA_764369 if SMP select PL310_ERRATA_753970 select ARM_GIC select ARM_GLOBAL_TIMER
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1080/2651 drm/amd/display: Fix wrong plane index in dcn6 writeback latency loop
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Yao <[email protected]>
[ Upstream commit 2c3ed158087d2971cad00faab24e2143eef49944 ]
Use plane_descriptors[k] for the loop bound, matching the loop body.
--- .../dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c +1 -1
@@ -1252,7 +1252,7 @@ void dcn6_calculate_watermarks_and_dram_speed_change_support(DML_LOG_VERBOSE ("DML::%s: k=%u, VActiveLatencyHidingUs = %f\n" , __func__, k, p->VActiveLatencyHidingUs[k]); } -for (unsigned int j =0 ; j < p->display_cfg->stream_descriptors[p->display_cfg->plane_descriptors[j].stream_index].writeback.active_writebacks_per_stream; ++j) { +for (unsigned int j =0 ; j < p->display_cfg->stream_descriptors[p->display_cfg->plane_descriptors[k].stream_index].writeback.active_writebacks_per_stream; ++j) {double byte_per_pixel_luma_in_buffer =1.0 ;double buffer_for_luma = (double )p->WritebackInterfaceBufferSize *1024.0 /2.0 ;if (p->display_cfg->stream_descriptors[p->display_cfg->plane_descriptors[k].stream_index].writeback.writeback_stream[j].pixel_format == dml2_444_64) {
Signature · 1 line
2.53.0