Skip to content

Commit

Permalink
Squash tag "v6.1.66" from linux-stable
Browse files Browse the repository at this point in the history
commit 6c6a6c7e211cc02943dcb8c073919d2105054886
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Dec 8 08:51:20 2023 +0100

    Linux 6.1.66

    Link: https://lore.kernel.org/r/20231205031531.426872356@linuxfoundation.org
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20231205183248.388576393@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Allen Pais <apais@linux.microsoft.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Conor Dooley <conor.dooley@microchip.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ea574927fc0bc343016ea3337fcfc0b3fb26fe08
Author: Christoph Hellwig <hch@lst.de>
Date:   Thu Jun 1 16:58:54 2023 +0200

    iomap: update ki_pos a little later in iomap_dio_complete

    commit 936e114a245b6e38e0dbf706a67e7611fc993da1 upstream.

    Move the ki_pos update down a bit to prepare for a better common helper
    that invalidates pages based of an iocb.

    Link: https://lkml.kernel.org/r/20230601145904.1385409-3-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Andreas Gruenbacher <agruenba@redhat.com>
    Cc: Anna Schumaker <anna@kernel.org>
    Cc: Chao Yu <chao@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Ilya Dryomov <idryomov@gmail.com>
    Cc: Jaegeuk Kim <jaegeuk@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Miklos Szeredi <mszeredi@redhat.com>
    Cc: Theodore Ts'o <tytso@mit.edu>
    Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
    Cc: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20231205122122.dfhhoaswsfscuhc3@quack3
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit adf0ecebf00a2aab8b089c6f2f24d2cea983f90e
Author: Koichiro Den <den@valinux.co.jp>
Date:   Thu Oct 26 12:20:36 2023 +0900

    x86/apic/msi: Fix misconfigured non-maskable MSI quirk

    commit b56ebe7c896dc78b5865ec2c4b1dae3c93537517 upstream.

    commit ef8dd01538ea ("genirq/msi: Make interrupt allocation less
    convoluted"), reworked the code so that the x86 specific quirk for affinity
    setting of non-maskable PCI/MSI interrupts is not longer activated if
    necessary.

    This could be solved by restoring the original logic in the core MSI code,
    but after a deeper analysis it turned out that the quirk flag is not
    required at all.

    The quirk is only required when the PCI/MSI device cannot mask the MSI
    interrupts, which in turn also prevents reservation mode from being enabled
    for the affected interrupt.

    This allows ot remove the NOMASK quirk bit completely as msi_set_affinity()
    can instead check whether reservation mode is enabled for the interrupt,
    which gives exactly the same answer.

    Even in the momentary non-existing case that the reservation mode would be
    not set for a maskable MSI interrupt this would not cause any harm as it
    just would cause msi_set_affinity() to go needlessly through the
    functionaly equivalent slow path, which works perfectly fine with maskable
    interrupts as well.

    Rework msi_set_affinity() to query the reservation mode and remove all
    NOMASK quirk logic from the core code.

    [ tglx: Massaged changelog ]

    Fixes: ef8dd01538ea ("genirq/msi: Make interrupt allocation less convoluted")
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Koichiro Den <den@valinux.co.jp>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231026032036.2462428-1-den@valinux.co.jp
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b3b839fb636b0983a0064d3cb97853962a0ac59e
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Nov 24 08:48:52 2023 +0100

    x86/xen: fix percpu vcpu_info allocation

    [ Upstream commit db2832309a82b9acc4b8cc33a1831d36507ec13e ]

    Today the percpu struct vcpu_info is allocated via DEFINE_PER_CPU(),
    meaning that it could cross a page boundary. In this case registering
    it with the hypervisor will fail, resulting in a panic().

    This can easily be fixed by using DEFINE_PER_CPU_ALIGNED() instead,
    as struct vcpu_info is guaranteed to have a size of 64 bytes, matching
    the cache line size of x86 64-bit processors (Xen doesn't support
    32-bit processors).

    Fixes: 5ead97c84fa7 ("xen: Core Xen implementation")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.con>
    Link: https://lore.kernel.org/r/20231124074852.25161-1-jgross@suse.com
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 00bc8b2cf44cc59c1177a167b2551294c6ed91eb
Author: Juergen Gross <jgross@suse.com>
Date:   Thu Aug 24 17:34:21 2023 +0200

    xen: simplify evtchn_do_upcall() call maze

    [ Upstream commit 37510dd566bdbff31a769cde2fa6654bccdb8b24 ]

    There are several functions involved for performing the functionality
    of evtchn_do_upcall():

    - __xen_evtchn_do_upcall() doing the real work
    - xen_hvm_evtchn_do_upcall() just being a wrapper for
      __xen_evtchn_do_upcall(), exposed for external callers
    - xen_evtchn_do_upcall() calling __xen_evtchn_do_upcall(), too, but
      without any user

    Simplify this maze by:

    - removing the unused xen_evtchn_do_upcall()
    - removing xen_hvm_evtchn_do_upcall() as the only left caller of
      __xen_evtchn_do_upcall(), while renaming __xen_evtchn_do_upcall() to
      xen_evtchn_do_upcall()

    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Stable-dep-of: db2832309a82 ("x86/xen: fix percpu vcpu_info allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9311a0ff388aa4f05d448edb656f308122694c03
Author: David Woodhouse <dwmw@amazon.co.uk>
Date:   Wed Jan 18 12:22:38 2023 +0000

    xen: Allow platform PCI interrupt to be shared

    [ Upstream commit 3e8cd711c3da6c3d724076048038cd666bdbb2b5 ]

    When we don't use the per-CPU vector callback, we ask Xen to deliver event
    channel interrupts as INTx on the PCI platform device. As such, it can be
    shared with INTx on other PCI devices.

    Set IRQF_SHARED, and make it return IRQ_HANDLED or IRQ_NONE according to
    whether the evtchn_upcall_pending flag was actually set. Now I can share
    the interrupt:

     11:         82          0   IO-APIC  11-fasteoi   xen-platform-pci, ens4

    Drop the IRQF_TRIGGER_RISING. It has no effect when the IRQ is shared,
    and besides, the only effect it was having even beforehand was to trigger
    a debug message in both I/OAPIC and legacy PIC cases:

    [    0.915441] genirq: No set_type function for IRQ 11 (IO-APIC)
    [    0.951939] genirq: No set_type function for IRQ 11 (XT-PIC)

    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Link: https://lore.kernel.org/r/f9a29a68d05668a3636dd09acd94d970269eaec6.camel@infradead.org
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Stable-dep-of: db2832309a82 ("x86/xen: fix percpu vcpu_info allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 402b8323461caedae0588ced14e58a387bf46d8a
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Sun Nov 26 19:36:46 2023 +0100

    r8169: fix deadlock on RTL8125 in jumbo mtu mode

    [ Upstream commit 59d395ed606d8df14615712b0cdcdadb2d962175 ]

    The original change results in a deadlock if jumbo mtu mode is used.
    Reason is that the phydev lock is held when rtl_reset_work() is called
    here, and rtl_jumbo_config() calls phy_start_aneg() which also tries
    to acquire the phydev lock. Fix this by calling rtl_reset_work()
    asynchronously.

    Fixes: 621735f59064 ("r8169: fix rare issue with broken rx after link-down on RTL8125")
    Reported-by: Ian Chen <free122448@hotmail.com>
    Tested-by: Ian Chen <free122448@hotmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Link: https://lore.kernel.org/r/caf6a487-ef8c-4570-88f9-f47a659faf33@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 22ee0ddb2af7ad2adf5f43fc2321735b7ee397ac
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Tue Jan 10 23:03:18 2023 +0100

    r8169: disable ASPM in case of tx timeout

    [ Upstream commit 80c0576ef179311f624bc450fede30a89afe9792 ]

    There are still single reports of systems where ASPM incompatibilities
    cause tx timeouts. It's not clear whom to blame, so let's disable
    ASPM in case of a tx timeout.

    v2:
    - add one-time warning for informing the user

    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
    Link: https://lore.kernel.org/r/92369a92-dc32-4529-0509-11459ba0e391@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 59d395ed606d ("r8169: fix deadlock on RTL8125 in jumbo mtu mode")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 10ce6301009fa46ba264ed75b822115ec3ca6e67
Author: Ilya Bakoulin <ilya.bakoulin@amd.com>
Date:   Tue Nov 7 15:07:56 2023 -0500

    drm/amd/display: Fix MPCC 1DLUT programming

    [ Upstream commit 6f395cebdd8927fbffdc3a55a14fcacf93634359 ]

    [Why]
    Wrong function is used to translate LUT values to HW format, leading to
    visible artifacting in some cases.

    [How]
    Use the correct cm3_helper function.

    Cc: stable@vger.kernel.org # 6.1+
    Reviewed-by: Krunoslav Kovac <krunoslav.kovac@amd.com>
    Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
    Signed-off-by: Ilya Bakoulin <ilya.bakoulin@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8332cb6c63394f32117a6f46a8cf7bedb8eec0b1
Author: Harry Wentland <harry.wentland@amd.com>
Date:   Thu Apr 6 18:06:27 2023 -0400

    drm/amd/display: Fix the delta clamping for shaper LUT

    [ Upstream commit 27fc10d1095f7a7de7c917638d7134033a190dd8 ]

    The shaper LUT requires a 10-bit value of the delta between segments. We
    were using dc_fixpt_clamp_u0d10() to do that but it doesn't do what we
    want it to do. It will preserve 10-bit precision after the decimal
    point, but that's not quite what we want. We want 14-bit precision and
    discard the 4 most-significant bytes.

    To do that we'll do dc_fixpt_clamp_u0d14() & 0x3ff instead.

    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Reviewed-by: Krunoslav Kovac <krunoslav.kovac@amd.com>
    Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
    Signed-off-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Stable-dep-of: 6f395cebdd89 ("drm/amd/display: Fix MPCC 1DLUT programming")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 442a4d4d01579d5d7066d0653898ffbb4091e3be
Author: Melissa Wen <mwen@igalia.com>
Date:   Tue Feb 14 11:14:02 2023 -0100

    drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut

    [ Upstream commit 94369589e4ec13c762fe10a1fdc4463bdfee5d5f ]

    This function has many conditions and all code style issues (identation,
    missing braces, etc.) make reading it really annoying.

    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Melissa Wen <mwen@igalia.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Stable-dep-of: 6f395cebdd89 ("drm/amd/display: Fix MPCC 1DLUT programming")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6cd736272165d7a6a7d62fb0a40536ed3741ed02
Author: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Date:   Thu Oct 20 11:46:57 2022 -0400

    drm/amd/display: Expand kernel doc for DC

    [ Upstream commit 1682bd1a6b5fb094e914d9b73b711821fd84dcbd ]

    This commit adds extra documentation for elements related to FAMs.

    Tested-by: Mark Broadworth <mark.broadworth@amd.com>
    Reviewed-by: Aurabindo Pillai <Aurabindo.Pillai@amd.com>
    Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Stable-dep-of: 67e38874b85b ("drm/amd/display: Increase num voltage states to 40")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8b01195be4a98009815ffafd5bf676e3c50ebaf1
Author: Wenchao Chen <wenchao.chen@unisoc.com>
Date:   Wed Nov 15 16:34:06 2023 +0800

    mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled

    [ Upstream commit 477865af60b2117ceaa1d558e03559108c15c78c ]

    With cat regulator_summary, we found that vqmmc was not shutting
    down after the card was pulled.

    cat /sys/kernel/debug/regulator/regulator_summary
    1.before fix
    1)Insert SD card
     vddsdio		1    1  0 unknown  3500mV 0mA  1200mV  3750mV
        71100000.mmc-vqmmc  1                         0mA  3500mV  3600mV

    2)Pull out the SD card
     vddsdio                1    1  0 unknown  3500mV 0mA  1200mV  3750mV
        71100000.mmc-vqmmc  1                         0mA  3500mV  3600mV

    2.after fix
    1)Insert SD cardt
     vddsdio                1    1  0 unknown  3500mV 0mA  1200mV  3750mV
        71100000.mmc-vqmmc  1                         0mA  3500mV  3600mV

    2)Pull out the SD card
     vddsdio		0    1  0 unknown  3500mV 0mA  1200mV  3750mV
        71100000.mmc-vqmmc  0                         0mA  3500mV  3600mV

    Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
    Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231115083406.7368-1-wenchao.chen@unisoc.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 38d3216032c95a6dceb4fea829ec63e38250bef1
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Sat Mar 11 23:39:55 2023 +0100

    mmc: core: add helpers mmc_regulator_enable/disable_vqmmc

    [ Upstream commit 8d91f3f8ae57e6292142ca89f322e90fa0d6ac02 ]

    There's a number of drivers (e.g. dw_mmc, meson-gx, mmci, sunxi) using
    the same mechanism and a private flag vqmmc_enabled to deal with
    enabling/disabling the vqmmc regulator.

    Move this to the core and create new helpers mmc_regulator_enable_vqmmc
    and mmc_regulator_disable_vqmmc.

    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Link: https://lore.kernel.org/r/71586432-360f-9b92-17f6-b05a8a971bc2@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Stable-dep-of: 477865af60b2 ("mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0e0a95166882e594af4ab4f8c6f7894c2c32f6a9
Author: Dinghao Liu <dinghao.liu@zju.edu.cn>
Date:   Thu Nov 23 15:33:22 2023 +0800

    drm/amd/pm: fix a memleak in aldebaran_tables_init

    [ Upstream commit 7a88f23e768491bae653b444a96091d2aaeb0818 ]

    When kzalloc() for smu_table->ecc_table fails, we should free
    the previously allocated resources to prevent memleak.

    Fixes: edd794208555 ("drm/amd/pm: add message smu to get ecc_table v2")
    Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 59862b869275c27beb25cda2054b59a8b5d04970
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Wed Nov 22 11:26:05 2023 +0800

    iommu/vt-d: Make context clearing consistent with context mapping

    [ Upstream commit 9a16ab9d640274b20813d2d17475e18d3e99d834 ]

    In the iommu probe_device path, domain_context_mapping() allows setting
    up the context entry for a non-PCI device. However, in the iommu
    release_device path, domain_context_clear() only clears context entries
    for PCI devices.

    Make domain_context_clear() behave consistently with
    domain_context_mapping() by clearing context entries for both PCI and
    non-PCI devices.

    Fixes: 579305f75d34 ("iommu/vt-d: Update to use PCI DMA aliases")
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20231114011036.70142-4-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ee2c2247690c8bf27d4584fdebfd9b58d74495ee
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Wed Nov 22 11:26:04 2023 +0800

    iommu/vt-d: Disable PCI ATS in legacy passthrough mode

    [ Upstream commit da37dddcf4caf015c400a930301d2ee27a7a15fb ]

    When IOMMU hardware operates in legacy mode, the TT field of the context
    entry determines the translation type, with three supported types (Section
    9.3 Context Entry):

    - DMA translation without device TLB support
    - DMA translation with device TLB support
    - Passthrough mode with translated and translation requests blocked

    Device TLB support is absent when hardware is configured in passthrough
    mode.

    Disable the PCI ATS feature when IOMMU is configured for passthrough
    translation type in legacy (non-scalable) mode.

    Fixes: 0faa19a1515f ("iommu/vt-d: Decouple PASID & PRI enabling from SVA")
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20231114011036.70142-3-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8f39d297a26ab4e1f2ad60adf3aa0434c500878a
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Tue Nov 22 08:29:44 2022 +0800

    iommu/vt-d: Add device_block_translation() helper

    [ Upstream commit c7be17c2903d4acbf9aa372bfb6e2a418387fce0 ]

    If domain attaching to device fails, the IOMMU driver should bring the
    device to blocking DMA state. The upper layer is expected to recover it
    by attaching a new domain. Use device_block_translation() in the error
    path of dev_attach to make the behavior specific.

    The difference between device_block_translation() and the previous
    dmar_remove_one_dev_info() is that, in the scalable mode, it is the
    RID2PASID entry instead of context entry being cleared. As a result,
    enabling PCI capabilities is moved up.

    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20221118132451.114406-3-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Stable-dep-of: da37dddcf4ca ("iommu/vt-d: Disable PCI ATS in legacy passthrough mode")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3787b3168b6c5f74e5e411f72e19322186fa2e4b
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Tue Nov 22 08:29:43 2022 +0800

    iommu/vt-d: Allocate pasid table in device probe path

    [ Upstream commit ec62b4424174f41bdcedd08d12d7bed80088453d ]

    Whether or not a domain is attached to the device, the pasid table should
    always be valid as long as it has been probed. This moves the pasid table
    allocation from the domain attaching device path to device probe path and
    frees it in the device release path.

    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20221118132451.114406-2-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Stable-dep-of: da37dddcf4ca ("iommu/vt-d: Disable PCI ATS in legacy passthrough mode")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 681aeeda413d6a379710d750916c582d67dd6635
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Wed Nov 22 11:26:03 2023 +0800

    iommu/vt-d: Omit devTLB invalidation requests when TES=0

    [ Upstream commit 0f5432a9b839847dcfe9fa369d72e3d646102ddf ]

    The latest VT-d spec indicates that when remapping hardware is disabled
    (TES=0 in Global Status Register), upstream ATS Invalidation Completion
    requests are treated as UR (Unsupported Request).

    Consequently, the spec recommends in section 4.3 Handling of Device-TLB
    Invalidations that software refrain from submitting any Device-TLB
    invalidation requests when address remapping hardware is disabled.

    Verify address remapping hardware is enabled prior to submitting Device-
    TLB invalidation requests.

    Fixes: 792fb43ce2c9 ("iommu/vt-d: Enable Intel IOMMU scalable mode by default")
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20231114011036.70142-2-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8aaed5b81d26dd80fe043837b71e17e521ad2733
Author: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Date:   Wed Nov 22 14:41:13 2023 +0100

    cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily

    [ Upstream commit 2e4e0984c7d696cc74cf2fd7e7f62997f0e9ebe6 ]

    For a 900MHz i.MX6ULL CPU the 792MHz OPP is disabled. There is no
    convincing reason to disable this OPP. If a CPU can run at 900MHz,
    it should also be able to cope with 792MHz. Looking at the voltage
    level of 792MHz in [1] (page 24, table 10. "Operating Ranges") the
    current defined OPP is above the minimum. So the voltage level
    shouldn't be a problem. However in [2] (page 24, table 10.
    "Operating Ranges"), it is not mentioned that 792MHz OPP isn't
    allowed. Change it to only disable 792MHz OPP for i.MX6ULL types
    below 792 MHz.

    [1] https://www.nxp.com/docs/en/data-sheet/IMX6ULLIEC.pdf
    [2] https://www.nxp.com/docs/en/data-sheet/IMX6ULLCEC.pdf

    Fixes: 0aa9abd4c212 ("cpufreq: imx6q: check speed grades for i.MX6ULL")
    Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
    Reviewed-by: Marek Vasut <marex@denx.de>
    Reviewed-by: Fabio Estevam <festevam@denx.de>
    [ Viresh: Edited subject ]
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d3788f6e9d5a9c9a869d6df386119197904a55f2
Author: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Date:   Fri May 12 17:07:11 2023 +0200

    cpufreq: imx6q: don't warn for disabling a non-existing frequency

    [ Upstream commit 11a3b0ac33d95aa84be426e801f800997262a225 ]

    It is confusing if a warning is given for disabling a non-existent
    frequency of the operating performance points (OPP). In this case
    the function dev_pm_opp_disable() returns -ENODEV. Check the return
    value and avoid the output of a warning in this case. Avoid code
    duplication by using a separate function.

    Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
    [ Viresh : Updated commit subject ]
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Stable-dep-of: 2e4e0984c7d6 ("cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 195514bda626b16fb6ef9ff4172dc0433a3c105b
Author: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Date:   Wed Sep 13 16:18:44 2023 -0400

    drm/amd/display: Guard against invalid RPTR/WPTR being set

    [ Upstream commit 1ffa8602e39b89469dc703ebab7a7e44c33da0f7 ]

    [WHY]
    HW can return invalid values on register read, guard against these being
    set and causing us to access memory out of range and page fault.

    [HOW]
    Guard at sync_inbox1 and guard at pushing commands.

    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Hansen Dsouza <hansen.dsouza@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 395a63ca1ad2e0534176cac91f5715961e744529
Author: JinZe.Xu <JinZe.Xu@amd.com>
Date:   Mon Apr 10 23:23:37 2023 +0800

    drm/amd/display: Restore rptr/wptr for DMCUB as workaround

    [ Upstream commit 8f3589bb6fcea397775398cba4fbcc46829a60ed ]

    [Why]
    States may be desync after resume.

    [How]
    Sync sw state with hw state.

    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
    Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Signed-off-by: JinZe.Xu <JinZe.Xu@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Stable-dep-of: 1ffa8602e39b ("drm/amd/display: Guard against invalid RPTR/WPTR being set")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4ec4508db97502a12daee88c74782e8d35ced068
Author: Mark Hasemeyer <markhas@chromium.org>
Date:   Tue Nov 7 14:47:43 2023 -0700

    spi: Fix null dereference on suspend

    [ Upstream commit bef4a48f4ef798c4feddf045d49e53c8a97d5e37 ]

    A race condition exists where a synchronous (noqueue) transfer can be
    active during a system suspend. This can cause a null pointer
    dereference exception to occur when the system resumes.

    Example order of events leading to the exception:
    1. spi_sync() calls __spi_transfer_message_noqueue() which sets
       ctlr->cur_msg
    2. Spi transfer begins via spi_transfer_one_message()
    3. System is suspended interrupting the transfer context
    4. System is resumed
    6. spi_controller_resume() calls spi_start_queue() which resets cur_msg
       to NULL
    7. Spi transfer context resumes and spi_finalize_current_message() is
       called which dereferences cur_msg (which is now NULL)

    Wait for synchronous transfers to complete before suspending by
    acquiring the bus mutex and setting/checking a suspend flag.

    Signed-off-by: Mark Hasemeyer <markhas@chromium.org>
    Link: https://lore.kernel.org/r/20231107144743.v1.1.I7987f05f61901f567f7661763646cb7d7919b528@changeid
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b57eebfb80e81f8cc01cd038ceaabca860a22236
Author: Helge Deller <deller@gmx.de>
Date:   Fri Oct 27 13:36:48 2023 +0200

    fbdev: stifb: Make the STI next font pointer a 32-bit signed offset

    [ Upstream commit 8a32aa17c1cd48df1ddaa78e45abcb8c7a2220d6 ]

    The pointer to the next STI font is actually a signed 32-bit
    offset. With this change the 64-bit kernel will correctly subract
    the (signed 32-bit) offset instead of adding a (unsigned 32-bit)
    offset. It has no effect on 32-bit kernels.

    This fixes the stifb driver with a 64-bit kernel on qemu.

    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5bc8d96fedcea51313021d779ff977d4f2172902
Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Date:   Wed Oct 25 18:30:29 2023 +0530

    PCI: qcom-ep: Add dedicated callback for writing to DBI2 registers

    [ Upstream commit a07d2497ed657eb2efeb967af47e22f573dcd1d6 ]

    The DWC core driver exposes the write_dbi2() callback for writing to the
    DBI2 registers in a vendor-specific way.

    On the Qcom EP platforms, the DBI_CS2 bit in the ELBI region needs to be
    asserted before writing to any DBI2 registers and deasserted once done.

    So, let's implement the callback for the Qcom PCIe EP driver so that the
    DBI2 writes are correctly handled in the hardware.

    Without this callback, the DBI2 register writes like BAR size won't go
    through and as a result, the default BAR size is set for all BARs.

    [kwilczynski: commit log, renamed function to match the DWC convention]
    Fixes: f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")
    Suggested-by: Serge Semin <fancer.lancer@gmail.com>
    Link: https://lore.kernel.org/linux-pci/20231025130029.74693-2-manivannan.sadhasivam@linaro.org
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Cc: stable@vger.kernel.org # 5.16+
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 10c3d86fea040d4123e569d83a8431a71e36d3d7
Author: Suman Ghosh <sumang@marvell.com>
Date:   Thu Jul 27 22:01:01 2023 +0530

    octeontx2-af: Initialize 'cntr_val' to fix uninitialized symbol error

    commit 222a6c42e9ef131fd20463bf95d7ce7b39bee2f8 upstream.

    drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c:860
    otx2_tc_update_mcam_table_del_req()
    error: uninitialized symbol 'cntr_val'.

    Fixes: ec87f05402f5 ("octeontx2-af: Install TC filter rules in hardware based on priority")
    Signed-off-by: Suman Ghosh <sumang@marvell.com>
    Link: https://lore.kernel.org/r/20230727163101.2793453-1-sumang@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1c8f75ee92334d89f1ddada26d47f9caa955f1a4
Author: Lukas Wunner <lukas@wunner.de>
Date:   Thu Sep 21 16:23:34 2023 +0200

    PCI: Lengthen reset delay for VideoPropulsion Torrent QN16e card

    [ Upstream commit c9260693aa0c1e029ed23693cfd4d7814eee6624 ]

    Commit ac91e6980563 ("PCI: Unify delay handling for reset and resume")
    shortened an unconditional 1 sec delay after a Secondary Bus Reset to 100
    msec for PCIe (per PCIe r6.1 sec 6.6.1).  The 1 sec delay is only required
    for Conventional PCI.

    But it turns out that there are PCIe devices which require a longer delay
    than prescribed before first config space access after reset recovery or
    resume from D3cold:

    Chad reports that a "VideoPropulsion Torrent QN16e" MPEG QAM Modulator
    "raises a PCI system error (PERR), as reported by the IPMI event log, and
    the hardware itself would suffer a catastrophic event, cycling the server"
    unless the longer delay is observed.

    The card is specified to conform to PCIe r1.0 and indeed only supports Gen1
    speed (2.5 GT/s) according to lspci.  PCIe r1.0 sec 7.6 prescribes the same
    100 msec delay as PCIe r6.1 sec 6.6.1:

      To allow components to perform internal initialization, system software
      must wait for at least 100 ms from the end of a reset (cold/warm/hot)
      before it is permitted to issue Configuration Requests

    The behavior of the Torrent QN16e card thus appears to be a quirk.  Treat
    it as such and lengthen the reset delay for this specific device.

    Fixes: ac91e6980563 ("PCI: Unify delay handling for reset and resume")
    Link: https://lore.kernel.org/r/47727e792c7f0282dc144e3ec8ce8eb6e713394e.1695304512.git.lukas@wunner.de
    Reported-by: Chad Schroeder <CSchroeder@sonifi.com>
    Closes: https://lore.kernel.org/linux-pci/DM6PR16MB2844903E34CAB910082DF019B1FAA@DM6PR16MB2844.namprd16.prod.outlook.com/
    Tested-by: Chad Schroeder <CSchroeder@sonifi.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7545ddda9c98545c9c797bef89f26df44f89fb13
Author: Haitao Shan <hshan@google.com>
Date:   Tue Sep 12 16:55:45 2023 -0700

    KVM: x86: Fix lapic timer interrupt lost after loading a snapshot.

    [ Upstream commit 9cfec6d097c607e36199cf0cfbb8cf5acbd8e9b2 ]

    When running android emulator (which is based on QEMU 2.12) on
    certain Intel hosts with kernel version 6.3-rc1 or above, guest
    will freeze after loading a snapshot. This is almost 100%
    reproducible. By default, the android emulator will use snapshot
    to speed up the next launching of the same android guest. So
    this breaks the android emulator badly.

    I tested QEMU 8.0.4 from Debian 12 with an Ubuntu 22.04 guest by
    running command "loadvm" after "savevm". The same issue is
    observed. At the same time, none of our AMD platforms is impacted.
    More experiments show that loading the KVM module with
    "enable_apicv=false" can workaround it.

    The issue started to show up after commit 8e6ed96cdd50 ("KVM: x86:
    fire timer when it is migrated and expired, and in oneshot mode").
    However, as is pointed out by Sean Christopherson, it is introduced
    by commit 967235d32032 ("KVM: vmx: clear pending interrupts on
    KVM_SET_LAPIC"). commit 8e6ed96cdd50 ("KVM: x86: fire timer when
    it is migrated and expired, and in oneshot mode") just makes it
    easier to hit the issue.

    Having both commits, the oneshot lapic timer gets fired immediately
    inside the KVM_SET_LAPIC call when loading the snapshot. On Intel
    platforms with APIC virtualization and posted interrupt processing,
    this eventually leads to setting the corresponding PIR bit. However,
    the whole PIR bits get cleared later in the same KVM_SET_LAPIC call
    by apicv_post_state_restore. This leads to timer interrupt lost.

    The fix is to move vmx_apicv_post_state_restore to the beginning of
    the KVM_SET_LAPIC call and rename to vmx_apicv_pre_state_restore.
    What vmx_apicv_post_state_restore does is actually clearing any
    former apicv state and this behavior is more suitable to carry out
    in the beginning.

    Fixes: 967235d32032 ("KVM: vmx: clear pending interrupts on KVM_SET_LAPIC")
    Cc: stable@vger.kernel.org
    Suggested-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Haitao Shan <hshan@google.com>
    Link: https://lore.kernel.org/r/20230913000215.478387-1-hshan@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 21feaf558f93740404f9a6c195e99eb479d330c3
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Tue Nov 28 10:04:39 2023 +0200

    net: ravb: Keep reverse order of operations in ravb_remove()

    [ Upstream commit edf9bc396e05081ca281ffb0cd41e44db478ff26 ]

    On RZ/G3S SMARC Carrier II board having RGMII connections b/w Ethernet
    MACs and PHYs it has been discovered that doing unbind/bind for ravb
    driver in a loop leads to wrong speed and duplex for Ethernet links and
    broken connectivity (the connectivity cannot be restored even with
    bringing interface down/up). Before doing unbind/bind the Ethernet
    interfaces were configured though systemd. The sh instructions used to
    do unbind/bind were:

    $ cd /sys/bus/platform/drivers/ravb/
    $ while :; do echo 11c30000.ethernet > unbind ; \
      echo 11c30000.ethernet > bind; done

    It has been discovered that there is a race b/w IOCTLs initialized by
    systemd at the response of success binding and the
    "ravb_write(ndev, CCC_OPC_RESET, CCC)" call in ravb_remove() as
    follows:

    1/ as a result of bind success the user space open/configures the
       interfaces tough an IOCTL; the following stack trace has been
       identified on RZ/G3S:

    Call trace:
    dump_backtrace+0x9c/0x100
    show_stack+0x20/0x38
    dump_stack_lvl+0x48/0x60
    dump_stack+0x18/0x28
    ravb_open+0x70/0xa58
    __dev_open+0xf4/0x1e8
    __dev_change_flags+0x198/0x218
    dev_change_flags+0x2c/0x80
    devinet_ioctl+0x640/0x708
    inet_ioctl+0x1e4/0x200
    sock_do_ioctl+0x50/0x108
    sock_ioctl+0x240/0x358
    __arm64_sys_ioctl+0xb0/0x100
    invoke_syscall+0x50/0x128
    el0_svc_common.constprop.0+0xc8/0xf0
    do_el0_svc+0x24/0x38
    el0_svc+0x34/0xb8
    el0t_64_sync_handler+0xc0/0xc8
    el0t_64_sync+0x190/0x198

    2/ this call may execute concurrently with ravb_remove() as the
       unbind/bind operation was executed in a loop
    3/ if the operation mode is changed to RESET (through
       ravb_write(ndev, CCC_OPC_RESET, CCC) call in ravb_remove())
       while the above ravb_open() is in progress it may lead to MAC
       (or PHY, or MAC-PHY connection, the right point hasn't been identified
       at the moment) to be broken, thus the Ethernet connectivity fails to
       restore.

    The simple fix for this is to move ravb_write(ndev, CCC_OPC_RESET, CCC))
    after unregister_netdev() to avoid resetting the controller while the
    netdev interface is still registered.

    To avoid future issues in ravb_remove(), the patch follows the proper order
    of operations in ravb_remove(): reverse order compared with ravb_probe().
    This avoids described races as the IOCTLs as well as unregister_netdev()
    (called now at the beginning of ravb_remove()) calls rtnl_lock() before
    continuing and IOCTLs check (though devinet_ioctl()) if device is still
    registered just after taking the lock:

    int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr)
    {
    	// ...

            rtnl_lock();

            ret = -ENODEV;
            dev = __dev_get_by_name(net, ifr->ifr_name);
            if (!dev)
                    goto done;

    	// ...
    done:
            rtnl_unlock();
    out:
            return ret;
    }

    Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8d04278ff48b202650077cb11ee6923e7a24aaa7
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Tue Nov 28 10:04:38 2023 +0200

    net: ravb: Stop DMA in case of failures on ravb_open()

    [ Upstream commit eac16a733427ba0de2449ffc7bd3da32ddb65cb7 ]

    In case ravb_phy_start() returns with error the settings applied in
    ravb_dmac_init() are not reverted (e.g. config mode). For this call
    ravb_stop_dma() on failure path of ravb_open().

    Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 52b751686cbf2e468319bb78e4cb026e715a17eb
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Tue Nov 28 10:04:37 2023 +0200

    net: ravb: Start TX queues after HW initialization succeeded

    [ Upstream commit 6f32c086602050fc11157adeafaa1c1eb393f0af ]

    ravb_phy_start() may fail. If that happens, the TX queues will remain
    started. Thus, move the netif_tx_start_all_queues() after PHY is
    successfully initialized.

    Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e2db25d16cdd39292371c73847942ade7b8c4a2e
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Tue Nov 28 10:04:36 2023 +0200

    net: ravb: Make write access to CXR35 first before accessing other EMAC registers

    [ Upstream commit d78c0ced60d5e2f8b5a4a0468a5c400b24aeadf2 ]

    Hardware manual of RZ/G3S (and RZ/G2L) specifies the following on the
    description of CXR35 register (chapter "PHY interface select register
    (CXR35)"): "After release reset, make write-access to this register before
    making write-access to other registers (except MDIOMOD). Even if not need
    to change the value of this register, make write-access to this register
    at least one time. Because RGMII/MII MODE is recognized by accessing this
    register".

    The setup procedure for EMAC module (chapter "Setup procedure" of RZ/G3S,
    RZ/G2L manuals) specifies the E-MAC.CXR35 register is the first EMAC
    register that is to be configured.

    Note [A] from chapter "PHY interface select register (CXR35)" specifies
    the following:
    [A] The case which CXR35 SEL_XMII is used for the selection of RGMII/MII
    in APB Clock 100 MHz.
    (1) To use RGMII interface, Set ‘H’03E8_0000’ to this register.
    (2) To use MII interface, Set ‘H’03E8_0002’ to this register.

    Take into account these indication.

    Fixes: 1089877ada8d ("ravb: Add RZ/G2L MII interface support")
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f5c649ce7975ed5b0b9348e218a7e6b7840d8932
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Tue Nov 28 10:04:35 2023 +0200

    net: ravb: Use pm_runtime_resume_and_get()

    [ Upstream commit 88b74831faaee455c2af380382d979fc38e79270 ]

    pm_runtime_get_sync() may return an error. In case it returns with an error
    dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get()
    takes care of this. Thus use it.

    Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 149b2fe12acac482e43d93016a42515cc7834cde
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Tue Nov 28 10:04:34 2023 +0200

    net: ravb: Check return value of reset_control_deassert()

    [ Upstream commit d8eb6ea4b302e7ff78535c205510e359ac10a0bd ]

    reset_control_deassert() could return an error. Some devices cannot work
    if reset signal de-assert operation fails. To avoid this check the return
    code of reset_control_deassert() in ravb_probe() and take proper action.

    Along with it, the free_netdev() call from the error path was moved after
    reset_control_assert() on its own label (out_free_netdev) to free
    netdev in case reset_control_deassert() fails.

    Fixes: 0d13a1a464a0 ("ravb: Add reset support")
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7ed2e4c2d016fdb0efda0fa8bf5ac6db21c88d89
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Mon Nov 27 21:24:20 2023 +0900

    ravb: Fix races between ravb_tx_timeout_work() and net related ops

    [ Upstream commit 9870257a0a338cd8d6c1cddab74e703f490f6779 ]

    Fix races between ravb_tx_timeout_work() and functions of net_device_ops
    and ethtool_ops by using rtnl_trylock() and rtnl_unlock(). Note that
    since ravb_close() is under the rtnl lock and calls cancel_work_sync(),
    ravb_tx_timeout_work() should calls rtnl_trylock(). Otherwise, a deadlock
    may happen in ravb_tx_timeout_work() like below:

    CPU0			CPU1
    			ravb_tx_timeout()
    			schedule_work()
    ...
    __dev_close_many()
    // Under rtnl lock
    ravb_close()
    cancel_work_sync()
    // Waiting
    			ravb_tx_timeout_work()
    			rtnl_lock()
    			// This is possible to cause a deadlock

    If rtnl_trylock() fails, rescheduling the work with sleep for 1 msec.

    Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Link: https://lore.kernel.org/r/20231127122420.3706751-1-yoshihiro.shimoda.uh@renesas.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8b1d088be5f108e3ebf7541a6639fef03df3d9b1
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Sun Nov 26 23:01:02 2023 +0100

    r8169: prevent potential deadlock in rtl8169_close

    [ Upstream commit 91d3d149978ba7b238198dd80e4b823756aa7cfa ]

    ndo_stop() is RTNL-protected by net core, and the worker function takes
    RTNL as well. Therefore we will deadlock when trying to execute a
    pending work synchronously. To fix this execute any pending work
    asynchronously. This will do no harm because netif_running() is false
    in ndo_stop(), and therefore the work function is effectively a no-op.
    However we have to ensure that no task is running or pending after
    rtl_remove_one(), therefore add a call to cancel_work_sync().

    Fixes: abe5fc42f9ce ("r8169: use RTNL to protect critical sections")
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Link: https://lore.kernel.org/r/12395867-1d17-4cac-aa7d-c691938fcddf@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9c4ac2d98a48097500e09acad5efa347a86a1fa5
Author: Subbaraya Sundeep <sbhatta@marvell.com>
Date:   Sat Nov 25 22:06:57 2023 +0530

    octeontx2-pf: Restore TC ingress police rules when interface is up

    [ Upstream commit fd7f98b2e12a3d96a92bde6640657ec7116f4372 ]

    TC ingress policer rules depends on interface receive queue
    contexts since the bandwidth profiles are attached to RQ
    contexts. When an interface is brought down all the queue
    contexts are freed. This in turn frees bandwidth profiles in
    hardware causing ingress police rules non-functional after
    the interface is brought up. Fix this by applying all the ingress
    police rules config to hardware in otx2_open. Also allow
    adding ingress rules only when interface is running
    since no contexts exist for the interface when it is down.

    Fixes: 68fbff68dbea ("octeontx2-pf: Add police action for TC flower")
    Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
    Link: https://lore.kernel.org/r/1700930217-5707-1-git-send-email-sbhatta@marvell.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aef2d5b3e56e1491d4f15e7a707d3bcb0ebe2411
Author: Suman Ghosh <sumang@marvell.com>
Date:   Fri Jul 21 10:09:25 2023 +0530

    octeontx2-af: Install TC filter rules in hardware based on priority

    [ Upstream commit ec87f05402f592d27507e1aa6b2fd21c486f2cc0 ]

    As of today, hardware does not support installing tc filter
    rules based on priority. This patch adds support to install
    the hardware rules based on priority. The final hardware rules
    will not be dependent on rule installation order, it will be strictly
    priority based, same as software.

    Signed-off-by: Suman Ghosh <sumang@marvell.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Link: https://lore.kernel.org/r/20230721043925.2627806-1-sumang@marvell.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: fd7f98b2e12a ("octeontx2-pf: Restore TC ingress police rules when interface is up")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 662b88708408952dc61ff43f3931d2d223799cb2
Author: Geetha sowjanya <gakula@marvell.com>
Date:   Sat Nov 25 22:04:02 2023 +0530

    octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64

    [ Upstream commit 51597219e0cd5157401d4d0ccb5daa4d9961676f ]

    When more than 64 VFs are enabled for a PF then mbox communication
    between VF and PF is not working as mbox work queueing for few VFs
    are skipped due to wrong calculation of VF numbers.

    Fixes: d424b6c02415 ("octeontx2-pf: Enable SRIOV and added VF mbox handling")
    Signed-off-by: Geetha sowjanya <gakula@marvell.com>
    Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
    Link: https://lore.kernel.org/r/1700930042-5400-1-git-send-email-sbhatta@marvell.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5d5bcfb1ca8d2670d944f1e2899ba654f5d92eaf
Author: Furong Xu <0x1207@gmail.com>
Date:   Sat Nov 25 14:01:26 2023 +0800

    net: stmmac: xgmac: Disable FPE MMC interrupts

    [ Upstream commit e54d628a2721bfbb002c19f6e8ca6746cec7640f ]

    Commit aeb18dd07692 ("net: stmmac: xgmac: Disable MMC interrupts
    by default") tries to disable MMC interrupts to avoid a storm of
    unhandled interrupts, but leaves the FPE(Frame Preemption) MMC
    interrupts enabled, FPE MMC interrupts can cause the same problem.
    Now we mask FPE TX and RX interrupts to disable all MMC interrupts.

    Fixes: aeb18dd07692 ("net: stmmac: xgmac: Disable MMC interrupts by default")
    Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
    Signed-off-by: Furong Xu <0x1207@gmail.com>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Link: https://lore.kernel.org/r/20231125060126.2328690-1-0x1207@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 334e6378c28c2dd0584259777a76b413aaa25fb1
Author: Elena Salomatkina <elena.salomatkina.cmc@gmail.com>
Date:   Sat Nov 25 00:08:02 2023 +0300

    octeontx2-af: Fix possible buffer overflow

    [ Upstream commit ad31c629ca3c87f6d557488c1f9faaebfbcd203c ]

    A loop in rvu_mbox_handler_nix_bandprof_free() contains
    a break if (idx == MAX_BANDPROF_PER_PFFUNC),
    but if idx may reach MAX_BANDPROF_PER_PFFUNC
    buffer '(*req->prof_idx)[layer]' overflow happens before that check.

    The patch moves the break to the
    beginning of the loop.

    Found by Linux Verification Center (linuxtesting.org) with SVACE.

    Fixes: e8e095b3b370 ("octeontx2-af: cn10k: Bandwidth profiles config support").
    Signed-off-by: Elena Salomatkina <elena.salomatkina.cmc@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>
    Link: https://lore.kernel.org/r/20231124210802.109763-1-elena.salomatkina.cmc@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c3e974e9c4bba86f8126724981616a4b077aa797
Author: Willem de Bruijn <willemb@google.com>
Date:   Fri Nov 24 12:15:22 2023 -0500

    selftests/net: mptcp: fix uninitialized variable warnings

    [ Upstream commit 00a4f8fd9c750f20d8fd4535c71c9caa7ef5ff2f ]

    Same init_rng() in both tests. The function reads /dev/urandom to
    initialize srand(). In case of failure, it falls back onto the
    entropy in the uninitialized variable. Not sure if this is on purpose.
    But failure reading urandom should be rare, so just fail hard. While
    at it, convert to getrandom(). Which man 4 random suggests is simpler
    and more robust.

        mptcp_inq.c:525:6:
        mptcp_connect.c:1131:6:

        error: variable 'foo' is used uninitialized
        whenever 'if' condition is false
        [-Werror,-Wsometimes-uninitialized]

    Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
    Fixes: b51880568f20 ("selftests: mptcp: add inq test case")
    Cc: Florian Westphal <fw@strlen.de>
    Signed-off-by: Willem de Bruijn <willemb@google.com>

    ----

    When input is randomized because this is expected to meaningfully
    explore edge cases, should we also add
    1. logging the random seed to stdout and
    2. adding a command line argument to replay from a specific seed
    I can do this in net-next, if authors find it useful in this case.
    Reviewed-by: Matthieu Baerts <matttbe@kernel.org>

    Link: https://lore.kernel.org/r/20231124171645.1011043-5-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 12dd4c1bf3bdd1bfdc5fe2b0f78dcbc28bd4d0d6
Author: Willem de Bruijn <willemb@google.com>
Date:   Fri Nov 24 12:15:21 2023 -0500

    selftests/net: unix: fix unused variable compiler warning

    [ Upstream commit 59fef379d453781f0dabfa1f1a1e86e78aee919a ]

    Remove an unused variable.

        diag_uid.c:151:24:
        error: unused variable 'udr'
        [-Werror,-Wunused-variable]

    Fixes: ac011361bd4f ("af_unix: Add test for sock_diag and UDIAG_SHOW_UID.")
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Link: https://lore.kernel.org/r/20231124171645.1011043-4-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4e999af7cf8afa14c5ec548d11d2aced0f32d211
Author: Willem de Bruijn <willemb@google.com>
Date:   Fri Nov 24 12:15:20 2023 -0500

    selftests/net: fix a char signedness issue

    [ Upstream commit 7b29828c5af6841bdeb9fafa32fdfeff7ab9c407 ]

    Signedness of char is signed on x86_64, but unsigned on arm64.

    Fix the warning building cmsg_sender.c on signed platforms or
    forced with -fsigned-char:

        msg_sender.c:455:12:
        error: implicit conversion from 'int' to 'char'
        changes value from 128 to -128
        [-Werror,-Wconstant-conversion]
            buf[0] = ICMPV6_ECHO_REQUEST;

    constant ICMPV6_ECHO_REQUEST is 128.

    Link: https://lwn.net/Articles/911914
    Fixes: de17e305a810 ("selftests: net: cmsg_sender: support icmp and raw sockets")
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Link: https://lore.kernel.org/r/20231124171645.1011043-3-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 249ceee95caf3b86b995fb2d7a5b072a6fe1708a
Author: Willem de Bruijn <willemb@google.com>
Date:   Fri Nov 24 12:15:19 2023 -0500

    selftests/net: ipsec: fix constant out of range

    [ Upstream commit 088559815477c6f623a5db5993491ddd7facbec7 ]

    Fix a small compiler warning.

    nr_process must be a signed long: it is assigned a signed long by
    strtol() and is compared against LONG_MIN and LONG_MAX.

    ipsec.c:2280:65:
        error: result of comparison of constant -9223372036854775808
        with expression of type 'unsigned int' is always false
        [-Werror,-Wtautological-constant-out-of-range-compare]

      if ((errno == ERANGE && (nr_process == LONG_MAX || nr_process == LONG_MIN))

    Fixes: bc2652b7ae1e ("selftest/net/xfrm: Add test for ipsec tunnel")
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Link: https://lore.kernel.org/r/20231124171645.1011043-2-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e01249a8393903c5cdcc66355d83207296689fad
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Mon Nov 20 14:05:08 2023 +0300

    uapi: propagate __struct_group() attributes to the container union

    [ Upstream commit 4e86f32a13af1970d21be94f659cae56bbe487ee ]

    Recently the kernel test robot has reported an ARM-specific BUILD_BUG_ON()
    in an old and unmaintained wil6210 wireless driver. The problem comes from
    the structure packing rules of old ARM ABI ('-mabi=apcs-gnu'). For example,
    the following structure is packed to 18 bytes instead of 16:

    struct poorly_packed {
            unsigned int a;
            unsigned int b;
            unsigned short c;
            union {
                    struct {
                            unsigned short d;
                            unsigned int e;
                    } __attribute__((packed));
                    struct {
                            unsigned short d;
                            unsigned int e;
                    } __attribute__((packed)) inner;
            };
    } __attribute__((packed));

    To fit it into 16 bytes, it's required to add packed attribute to the
    container union as well:

    struct poorly_packed {
            unsigned int a;
            unsigned int b;
            unsigned short c;
            union {
                    struct {
                            unsigned short d;
                            unsigned int e;
                    } __attribute__((packed));
                    struct {
                            unsigned short d;
                            unsigned int e;
                    } __attribute__((packed)) inner;
            } __attribute__((packed));
    } __attribute__((packed));

    Thanks to Andrew Pinski of GCC team for sorting the things out at
    https://gcc.gnu.org/pipermail/gcc/2023-November/242888.html.

    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202311150821.cI4yciFE-lkp@intel.com
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Link: https://lore.kernel.org/r/20231120110607.98956-1-dmantipov@yandex.ru
    Fixes: 50d7bd38c3aa ("stddef: Introduce struct_group() helper macro")
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fd91b48f108d5c226b4775b2821ba4113c02374c
Author: Ioana Ciornei <ioana.ciornei@nxp.com>
Date:   Fri Nov 24 12:28:04 2023 +0200

    dpaa2-eth: increase the needed headroom to account for alignment

    [ Upstream commit f422abe3f23d483cf01f386819f26fb3fe0dbb2b ]

    Increase the needed headroom to account for a 64 byte alignment
    restriction which, with this patch, we make mandatory on the Tx path.
    The case in which the amount of headroom needed is not available is
    already handled by the driver which instead sends a S/G frame with the
    first buffer only holding the SW and HW annotation areas.

    Without this patch, we can empirically see data corruption happening
    between Tx and Tx confirmation which sometimes leads to the SW
    annotation area being overwritten.

    Since this is an old IP where the hardware team cannot help to
    understand the underlying behavior, we make the Tx alignment mandatory
    for all frames to avoid the crash on Tx conf. Also, remove the comment
    that suggested that this is just an optimization.

    This patch also sets the needed_headroom net device field to the usual
    value that the driver would need on the Tx path:
    	- 64 bytes for the software annotation area
    	- 64 bytes to account for a 64 byte aligned buffer address

    Fixes: 6e2387e8f19e ("staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver")
    Closes: https://lore.kernel.org/netdev/aa784d0c-85eb-4e5d-968b-c8f74fa86be6@gin.de/
    Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 94445d9583079e0ccc5dde1370076ff24800d86e
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Thu Nov 23 15:13:14 2023 +0800

    ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet

    [ Upstream commit e2b706c691905fe78468c361aaabc719d0a496f1 ]

    When I perform the following test operations:
    1.ip link add br0 type bridge
    2.brctl addif br0 eth0
    3.ip addr add 239.0.0.1/32 dev eth0
    4.ip addr add 239.0.0.1/32 dev br0
    5.ip addr add 224.0.0.1/32 dev br0
    6.while ((1))
        do
            ifconfig br0 up
            ifconfig br0 down
        done
    7.send IGMPv2 query packets to port eth0 continuously. For example,
    ./mausezahn ethX -c 0 "01 00 5e 00 00 01 00 72 19 88 aa 02 08 00 45 00 00
    1c 00 01 00 00 01 02 0e 7f c0 a8 0a b7 e0 00 00 01 11 64 ee 9b 00 00 00 00"

    The preceding tests may trigger the refcnt uaf issue of the mc list. The
    stack is as follows:
    	refcount_t: addition on 0; use-after-free.
    	WARNING: CPU: 21 PID: 144 at lib/refcount.c:25 refcount_warn_saturate (lib/refcount.c:25)
    	CPU: 21 PID: 144 Comm: ksoftirqd/21 Kdump: loaded Not tainted 6.7.0-rc1-next-20231117-dirty #80
    	Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
    	RIP: 0010:refcount_warn_saturate (lib/refcount.c:25)
    	RSP: 0018:ffffb68f00657910 EFLAGS: 00010286
    	RAX: 0000000000000000 RBX: ffff8a00c3bf96c0 RCX: ffff8a07b6160908
    	RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8a07b6160900
    	RBP: ffff8a00cba36862 R08: 0000000000000000 R09: 00000000ffff7fff
    	R10: ffffb68f006577c0 R11: ffffffffb0fdcdc8 R12: ffff8a00c3bf9680
    	R13: ffff8a00c3bf96f0 R14: 0000000000000000 R15: ffff8a00d8766e00
    	FS:  0000000000000000(0000) GS:ffff8a07b6140000(0000) knlGS:0000000000000000
    	CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    	CR2: 000055f10b520b28 CR3: 000000039741a000 CR4: 00000000000006f0
    	Call Trace:
    	<TASK>
    	igmp_heard_query (net/ipv4/igmp.c:1068)
    	igmp_rcv (net/ipv4/igmp.c:1132)
    	ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205)
    	ip_local_deliver_finish (net/ipv4/ip_input.c:234)
    	__netif_receive_skb_one_core (net/core/dev.c:5529)
    	netif_receive_skb_internal (net/core/dev.c:5729)
    	netif_receive_skb (net/core/dev.c:5788)
    	br_handle_frame_finish (net/bridge/br_input.c:216)
    	nf_hook_bridge_pre (net/bridge/br_input.c:294)
    	__netif_receive_skb_core (net/core/dev.c:5423)
    	__netif_receive_skb_list_core (net/core/dev.c:5606)
    	__netif_receive_skb_list (net/core/dev.c:5674)
    	netif_receive_skb_list_internal (net/core/dev.c:5764)
    	napi_gro_receive (net/core/gro.c:609)
    	e1000_clean_rx_irq (drivers/net/ethernet/intel/e1000/e1000_main.c:4467)
    	e1000_clean (drivers/net/ethernet/intel/e1000/e1000_main.c:3805)
    	__napi_poll (net/core/dev.c:6533)
    	net_rx_action (net/core/dev.c:6735)
    	__do_softirq (kernel/softirq.c:554)
    	run_ksoftirqd (kernel/softirq.c:913)
    	smpboot_thread_fn (kernel/smpboot.c:164)
    	kthread (kernel/kthread.c:388)
    	ret_from_fork (arch/x86/kernel/process.c:153)
    	ret_from_fork_asm (arch/x86/entry/entry_64.S:250)
    	</TASK>

    The root causes are as follows:
    Thread A					Thread B
    ...						netif_receive_skb
    br_dev_stop					...
        br_multicast_leave_snoopers			...
            __ip_mc_dec_group			...
                __igmp_group_dropped		igmp_rcv
                    igmp_stop_timer			    igmp_heard_query         //ref = 1
                    ip_ma_put			        igmp_mod_timer
                        refcount_dec_and_test	            igmp_start_timer //ref = 0
    			...                                     refcount_inc //ref increases from 0
    When the device receives an IGMPv2 Query message, it starts the timer
    immediately, regardless of whether the device is running. If the device is
    down and has left the multicast group, it will cause the mc list refcount
    uaf issue.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f89fef7710b2ba0f7a1e46594e530dcf2f77be91
Author: Niklas Neronin <niklas.neronin@linux.intel.com>
Date:   Wed Nov 15 14:13:25 2023 +0200

    usb: config: fix iteration issue in 'usb_get_bos_descriptor()'

    [ Upstream commit 974bba5c118f4c2baf00de0356e3e4f7928b4cbc ]

    The BOS descriptor defines a root descriptor and is the base descriptor for
    accessing a family of related descriptors.

    Function 'usb_get_bos_descriptor()' encounters an iteration issue when
    skipping the 'USB_DT_DEVICE_CAPABILITY' descriptor type. This results in
    the same descriptor being read repeatedly.

    To address this issue, a 'goto' statement is introduced to ensure that the
    pointer and the amount read is updated correctly. This ensures that the
    function iterates to the next descriptor instead of reading the same
    descriptor repeatedly.

    Cc: stable@vger.kernel.org
    Fixes: 3dd550a2d365 ("USB: usbcore: Fix slab-out-of-bounds bug during device reset")
    Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
    Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20231115121325.471454-1-niklas.neronin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9aff7c51b440cc5dab4d527c2fd5412631f99644
…
  • Loading branch information
Relms12345 committed Dec 10, 2023
1 parent b6c70e3 commit c7f5fc6
Show file tree
Hide file tree
Showing 133 changed files with 1,277 additions and 583 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 6
PATCHLEVEL = 1
SUBLEVEL = 65
SUBLEVEL = 66
EXTRAVERSION =
NAME = Curry Ramen

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void xen_power_off(void)

static irqreturn_t xen_arm_callback(int irq, void *arg)
{
xen_hvm_evtchn_do_upcall();
xen_evtchn_do_upcall();
return IRQ_HANDLED;
}

Expand Down
9 changes: 6 additions & 3 deletions arch/parisc/include/asm/alternative.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,

/* Alternative SMP implementation. */
#define ALTERNATIVE(cond, replacement) "!0:" \
".section .altinstructions, \"aw\" !" \
".section .altinstructions, \"a\" !" \
".align 4 !" \
".word (0b-4-.) !" \
".hword 1, " __stringify(cond) " !" \
".word " __stringify(replacement) " !" \
Expand All @@ -44,15 +45,17 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,

/* to replace one single instructions by a new instruction */
#define ALTERNATIVE(from, to, cond, replacement)\
.section .altinstructions, "aw" ! \
.section .altinstructions, "a" ! \
.align 4 ! \
.word (from - .) ! \
.hword (to - from)/4, cond ! \
.word replacement ! \
.previous

/* to replace multiple instructions by new code */
#define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\
.section .altinstructions, "aw" ! \
.section .altinstructions, "a" ! \
.align 4 ! \
.word (from - .) ! \
.hword -num_instructions, cond ! \
.word (new_instr_ptr - .) ! \
Expand Down
1 change: 1 addition & 0 deletions arch/parisc/include/asm/assembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@
*/
#define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \
.section __ex_table,"aw" ! \
.align 4 ! \
.word (fault_addr - .), (except_addr - .) ! \
.previous

Expand Down
30 changes: 18 additions & 12 deletions arch/parisc/include/asm/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
do { \
asm volatile("\n" \
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
"\t.pushsection __bug_table,\"aw\"\n" \
"\t.pushsection __bug_table,\"a\"\n" \
"\t.align %4\n" \
"2:\t" ASM_WORD_INSN "1b, %c0\n" \
"\t.short %c1, %c2\n" \
"\t.org 2b+%c3\n" \
"\t.short %1, %2\n" \
"\t.blockz %3-2*%4-2*2\n" \
"\t.popsection" \
: : "i" (__FILE__), "i" (__LINE__), \
"i" (0), "i" (sizeof(struct bug_entry)) ); \
"i" (0), "i" (sizeof(struct bug_entry)), \
"i" (sizeof(long)) ); \
unreachable(); \
} while(0)

Expand All @@ -51,27 +53,31 @@
do { \
asm volatile("\n" \
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
"\t.pushsection __bug_table,\"aw\"\n" \
"\t.pushsection __bug_table,\"a\"\n" \
"\t.align %4\n" \
"2:\t" ASM_WORD_INSN "1b, %c0\n" \
"\t.short %c1, %c2\n" \
"\t.org 2b+%c3\n" \
"\t.short %1, %2\n" \
"\t.blockz %3-2*%4-2*2\n" \
"\t.popsection" \
: : "i" (__FILE__), "i" (__LINE__), \
"i" (BUGFLAG_WARNING|(flags)), \
"i" (sizeof(struct bug_entry)) ); \
"i" (sizeof(struct bug_entry)), \
"i" (sizeof(long)) ); \
} while(0)
#else
#define __WARN_FLAGS(flags) \
do { \
asm volatile("\n" \
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
"\t.pushsection __bug_table,\"aw\"\n" \
"\t.pushsection __bug_table,\"a\"\n" \
"\t.align %2\n" \
"2:\t" ASM_WORD_INSN "1b\n" \
"\t.short %c0\n" \
"\t.org 2b+%c1\n" \
"\t.short %0\n" \
"\t.blockz %1-%2-2\n" \
"\t.popsection" \
: : "i" (BUGFLAG_WARNING|(flags)), \
"i" (sizeof(struct bug_entry)) ); \
"i" (sizeof(struct bug_entry)), \
"i" (sizeof(long)) ); \
} while(0)
#endif

Expand Down
8 changes: 6 additions & 2 deletions arch/parisc/include/asm/jump_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
asm_volatile_goto("1:\n\t"
"nop\n\t"
".pushsection __jump_table, \"aw\"\n\t"
".align %1\n\t"
".word 1b - ., %l[l_yes] - .\n\t"
__stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
".popsection\n\t"
: : "i" (&((char *)key)[branch]) : : l_yes);
: : "i" (&((char *)key)[branch]), "i" (sizeof(long))
: : l_yes);

return false;
l_yes:
Expand All @@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool
asm_volatile_goto("1:\n\t"
"b,n %l[l_yes]\n\t"
".pushsection __jump_table, \"aw\"\n\t"
".align %1\n\t"
".word 1b - ., %l[l_yes] - .\n\t"
__stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
".popsection\n\t"
: : "i" (&((char *)key)[branch]) : : l_yes);
: : "i" (&((char *)key)[branch]), "i" (sizeof(long))
: : l_yes);

return false;
l_yes:
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/include/asm/ldcw.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
})

#ifdef CONFIG_SMP
# define __lock_aligned __section(".data..lock_aligned")
# define __lock_aligned __section(".data..lock_aligned") __aligned(16)
#endif

#endif /* __PARISC_LDCW_H */
1 change: 1 addition & 0 deletions arch/parisc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct exception_table_entry {

#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
".section __ex_table,\"aw\"\n" \
".align 4\n" \
".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \
".previous\n"

Expand Down
2 changes: 0 additions & 2 deletions arch/parisc/include/uapi/asm/errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@

/* We now return you to your regularly scheduled HPUX. */

#define ENOSYM 215 /* symbol does not exist in executable */
#define ENOTSOCK 216 /* Socket operation on non-socket */
#define EDESTADDRREQ 217 /* Destination address required */
#define EMSGSIZE 218 /* Message too long */
Expand All @@ -101,7 +100,6 @@
#define ETIMEDOUT 238 /* Connection timed out */
#define ECONNREFUSED 239 /* Connection refused */
#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
#define EREMOTERELEASE 240 /* Remote peer released connection */
#define EHOSTDOWN 241 /* Host is down */
#define EHOSTUNREACH 242 /* No route to host */

Expand Down
1 change: 1 addition & 0 deletions arch/parisc/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ SECTIONS
RO_DATA(8)

/* unwind info */
. = ALIGN(4);
.PARISC.unwind : {
__start___unwind = .;
*(.PARISC.unwind)
Expand Down
13 changes: 13 additions & 0 deletions arch/powerpc/kernel/fpu.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
#include <asm/feature-fixups.h>

#ifdef CONFIG_VSX
#define __REST_1FPVSR(n,c,base) \
BEGIN_FTR_SECTION \
b 2f; \
END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
REST_FPR(n,base); \
b 3f; \
2: REST_VSR(n,c,base); \
3:

#define __REST_32FPVSRS(n,c,base) \
BEGIN_FTR_SECTION \
b 2f; \
Expand All @@ -41,9 +50,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
2: SAVE_32VSRS(n,c,base); \
3:
#else
#define __REST_1FPVSR(n,b,base) REST_FPR(n, base)
#define __REST_32FPVSRS(n,b,base) REST_32FPRS(n, base)
#define __SAVE_32FPVSRS(n,b,base) SAVE_32FPRS(n, base)
#endif
#define REST_1FPVSR(n,c,base) __REST_1FPVSR(n,__REG_##c,__REG_##base)
#define REST_32FPVSRS(n,c,base) __REST_32FPVSRS(n,__REG_##c,__REG_##base)
#define SAVE_32FPVSRS(n,c,base) __SAVE_32FPVSRS(n,__REG_##c,__REG_##base)

Expand All @@ -67,6 +78,7 @@ _GLOBAL(store_fp_state)
SAVE_32FPVSRS(0, R4, R3)
mffs fr0
stfd fr0,FPSTATE_FPSCR(r3)
REST_1FPVSR(0, R4, R3)
blr
EXPORT_SYMBOL(store_fp_state)

Expand Down Expand Up @@ -138,4 +150,5 @@ _GLOBAL(save_fpu)
2: SAVE_32FPVSRS(0, R4, R6)
mffs fr0
stfd fr0,FPSTATE_FPSCR(r6)
REST_1FPVSR(0, R4, R6)
blr
6 changes: 3 additions & 3 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,11 +1163,11 @@ void kvmppc_save_user_regs(void)

usermsr = current->thread.regs->msr;

/* Caller has enabled FP/VEC/VSX/TM in MSR */
if (usermsr & MSR_FP)
save_fpu(current);

__giveup_fpu(current);
if (usermsr & MSR_VEC)
save_altivec(current);
__giveup_altivec(current);

#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
if (usermsr & MSR_TM) {
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/kernel/vector.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ _GLOBAL(store_vr_state)
mfvscr v0
li r4, VRSTATE_VSCR
stvx v0, r4, r3
lvx v0, 0, r3
blr
EXPORT_SYMBOL(store_vr_state)

Expand Down Expand Up @@ -108,6 +109,7 @@ _GLOBAL(save_altivec)
mfvscr v0
li r4,VRSTATE_VSCR
stvx v0,r4,r7
lvx v0,0,r7
blr

#ifdef CONFIG_VSX
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/entry/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static void __xen_pv_evtchn_do_upcall(struct pt_regs *regs)

inc_irq_stat(irq_hv_callback_count);

xen_hvm_evtchn_do_upcall();
xen_evtchn_do_upcall();

set_irq_regs(old_regs);
}
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/kvm-x86-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ KVM_X86_OP_OPTIONAL(vcpu_blocking)
KVM_X86_OP_OPTIONAL(vcpu_unblocking)
KVM_X86_OP_OPTIONAL(pi_update_irte)
KVM_X86_OP_OPTIONAL(pi_start_assignment)
KVM_X86_OP_OPTIONAL(apicv_pre_state_restore)
KVM_X86_OP_OPTIONAL(apicv_post_state_restore)
KVM_X86_OP_OPTIONAL_RET0(dy_apicv_has_pending_interrupt)
KVM_X86_OP_OPTIONAL(set_hv_timer)
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,7 @@ struct kvm_x86_ops {
int (*pi_update_irte)(struct kvm *kvm, unsigned int host_irq,
uint32_t guest_irq, bool set);
void (*pi_start_assignment)(struct kvm *kvm);
void (*apicv_pre_state_restore)(struct kvm_vcpu *vcpu);
void (*apicv_post_state_restore)(struct kvm_vcpu *vcpu);
bool (*dy_apicv_has_pending_interrupt)(struct kvm_vcpu *vcpu);

Expand Down
8 changes: 3 additions & 5 deletions arch/x86/kernel/apic/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ msi_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force)
* caused by the non-atomic update of the address/data pair.
*
* Direct update is possible when:
* - The MSI is maskable (remapped MSI does not use this code path)).
* The quirk bit is not set in this case.
* - The MSI is maskable (remapped MSI does not use this code path).
* The reservation mode bit is set in this case.
* - The new vector is the same as the old vector
* - The old vector is MANAGED_IRQ_SHUTDOWN_VECTOR (interrupt starts up)
* - The interrupt is not yet started up
* - The new destination CPU is the same as the old destination CPU
*/
if (!irqd_msi_nomask_quirk(irqd) ||
if (!irqd_can_reserve(irqd) ||
cfg->vector == old_cfg.vector ||
old_cfg.vector == MANAGED_IRQ_SHUTDOWN_VECTOR ||
!irqd_is_started(irqd) ||
Expand Down Expand Up @@ -202,8 +202,6 @@ struct irq_domain * __init native_create_pci_msi_domain(void)
if (!d) {
irq_domain_free_fwnode(fn);
pr_warn("Failed to initialize PCI-MSI irqdomain.\n");
} else {
d->flags |= IRQ_DOMAIN_MSI_NOMASK_QUIRK;
}
return d;
}
Expand Down
4 changes: 4 additions & 0 deletions arch/x86/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,8 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
u64 msr_val;
int i;

static_call_cond(kvm_x86_apicv_pre_state_restore)(vcpu);

if (!init_event) {
msr_val = APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE;
if (kvm_vcpu_is_reset_bsp(vcpu))
Expand Down Expand Up @@ -2757,6 +2759,8 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
struct kvm_lapic *apic = vcpu->arch.apic;
int r;

static_call_cond(kvm_x86_apicv_pre_state_restore)(vcpu);

kvm_lapic_set_base(vcpu, vcpu->arch.apic_base);
/* set SPIV separately to get count of SW disabled APICs right */
apic_set_spiv(apic, *((u32 *)(s->regs + APIC_SPIV)));
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kvm/vmx/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6799,7 +6799,7 @@ static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
vmcs_write64(EOI_EXIT_BITMAP3, eoi_exit_bitmap[3]);
}

static void vmx_apicv_post_state_restore(struct kvm_vcpu *vcpu)
static void vmx_apicv_pre_state_restore(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);

Expand Down Expand Up @@ -8172,7 +8172,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = {
.set_apic_access_page_addr = vmx_set_apic_access_page_addr,
.refresh_apicv_exec_ctrl = vmx_refresh_apicv_exec_ctrl,
.load_eoi_exitmap = vmx_load_eoi_exitmap,
.apicv_post_state_restore = vmx_apicv_post_state_restore,
.apicv_pre_state_restore = vmx_apicv_pre_state_restore,
.check_apicv_inhibit_reasons = vmx_check_apicv_inhibit_reasons,
.hwapic_irr_update = vmx_hwapic_irr_update,
.hwapic_isr_update = vmx_hwapic_isr_update,
Expand Down
8 changes: 6 additions & 2 deletions arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ EXPORT_SYMBOL_GPL(hypercall_page);
* &HYPERVISOR_shared_info->vcpu_info[cpu]. See xen_hvm_init_shared_info
* and xen_vcpu_setup for details. By default it points to share_info->vcpu_info
* but during boot it is switched to point to xen_vcpu_info.
* The pointer is used in __xen_evtchn_do_upcall to acknowledge pending events.
* The pointer is used in xen_evtchn_do_upcall to acknowledge pending events.
* Make sure that xen_vcpu_info doesn't cross a page boundary by making it
* cache-line aligned (the struct is guaranteed to have a size of 64 bytes,
* which matches the cache line size of 64-bit x86 processors).
*/
DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
DEFINE_PER_CPU_ALIGNED(struct vcpu_info, xen_vcpu_info);

/* Linux <-> Xen vCPU id mapping */
DEFINE_PER_CPU(uint32_t, xen_vcpu_id);
Expand Down Expand Up @@ -160,6 +163,7 @@ void xen_vcpu_setup(int cpu)
int err;
struct vcpu_info *vcpup;

BUILD_BUG_ON(sizeof(*vcpup) > SMP_CACHE_BYTES);
BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/xen/enlighten_hvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback)

inc_irq_stat(irq_hv_callback_count);

xen_hvm_evtchn_do_upcall();
xen_evtchn_do_upcall();

set_irq_regs(old_regs);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/xen/xen-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern void *xen_initial_gdt;
struct trap_info;
void xen_copy_trap_info(struct trap_info *traps);

DECLARE_PER_CPU(struct vcpu_info, xen_vcpu_info);
DECLARE_PER_CPU_ALIGNED(struct vcpu_info, xen_vcpu_info);
DECLARE_PER_CPU(unsigned long, xen_cr3);
DECLARE_PER_CPU(unsigned long, xen_current_cr3);

Expand Down
Loading

0 comments on commit c7f5fc6

Please sign in to comment.