6.12.64-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 552/567 PCI: brcmstb: Reuse pcie_cfg_data structure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanimir Varbanov <[email protected]>
[ Upstream commit 10dbedad3c8188ce8b68559d43b7aaee7dafba25 ]
Instead of copying fields from the pcie_cfg_data structure to brcm_pcie, reference it directly.
Stable-dep-of: 9583f9d22991 ("PCI: brcmstb: Fix disabling L0s capability")
--- drivers/pci/controller/pcie-brcmstb.c | 72 +++++++++++++++------------------- 1 file changed, 32 insertions(+), 40 deletions(-)
drivers/pci/controller/pcie-brcmstb.c +32 -40
@@ -191,11 +191,11 @@#define SSC_STATUS_PLL_LOCK_MASK 0x800#define PCIE_BRCM_MAX_MEMC 3 -#define IDX_ADDR (pcie) ((pcie)->reg_offsets[EXT_CFG_INDEX]) -#define DATA_ADDR (pcie) ((pcie)->reg_offsets[EXT_CFG_DATA]) -#define PCIE_RGR1_SW_INIT_1 (pcie) ((pcie)->reg_offsets[RGR1_SW_INIT_1]) -#define HARD_DEBUG (pcie) ((pcie)->reg_offsets[PCIE_HARD_DEBUG]) -#define INTR2_CPU_BASE (pcie) ((pcie)->reg_offsets[PCIE_INTR2_CPU_BASE]) +#define IDX_ADDR (pcie) ((pcie)->cfg->offsets[EXT_CFG_INDEX]) +#define DATA_ADDR (pcie) ((pcie)->cfg->offsets[EXT_CFG_DATA]) +#define PCIE_RGR1_SW_INIT_1 (pcie) ((pcie)->cfg->offsets[RGR1_SW_INIT_1]) +#define HARD_DEBUG (pcie) ((pcie)->cfg->offsets[PCIE_HARD_DEBUG]) +#define INTR2_CPU_BASE (pcie) ((pcie)->cfg->offsets[PCIE_INTR2_CPU_BASE])/* Rescal registers */ #define PCIE_DVT_PMU_PCIE_PHY_CTRL 0xc700
@@ -276,8 +276,6 @@ struct brcm_pcie {int gen;u64 msi_target_addr;struct brcm_msi *msi; -const int *reg_offsets; -enum pcie_soc_base soc_base;struct reset_control *rescal;struct reset_control *perst_reset;struct reset_control *bridge_reset;
@@ -285,17 +283,14 @@ struct brcm_pcie {int num_memc;u64 memc_size[PCIE_BRCM_MAX_MEMC ];u32 hw_rev; -int (*perst_set)(struct brcm_pcie *pcie,u32 val); -int (*bridge_sw_init_set)(struct brcm_pcie *pcie,u32 val);struct subdev_regulators *sr;bool ep_wakeup_capable; -bool has_phy; -u8 num_inbound_wins; +const struct pcie_cfg_data *cfg; };static inline bool is_bmips (const struct brcm_pcie *pcie) { -return pcie->soc_base ==BCM7435 || pcie->soc_base ==BCM7425 ; +return pcie->cfg->soc_base ==BCM7435 || pcie->cfg->soc_base ==BCM7425 ; }/*
@@ -855,7 +850,7 @@ static int brcm_pcie_get_inbound_wins(st* security considerations, and is not implemented in our modern * SoCs. */ -if (pcie->soc_base !=BCM7712 ) +if (pcie->cfg->soc_base !=BCM7712 )add_inbound_win (b++, &n,0 ,0 ,0 );resource_list_for_each_entry (entry, &bridge->dma_ranges) {
@@ -872,10 +867,10 @@ static int brcm_pcie_get_inbound_wins(st* That being said, each BARs size must still be a power of * two. */ -if (pcie->soc_base ==BCM7712 ) +if (pcie->cfg->soc_base ==BCM7712 )add_inbound_win (b++, &n, size, cpu_start, pcie_start); -if (n > pcie->num_inbound_wins) +if (n > pcie->cfg->num_inbound_wins)break ; }
@@ -889,7 +884,7 @@ static int brcm_pcie_get_inbound_wins(st* that enables multiple memory controllers. As such, it can return * now w/o doing special configuration. */ -if (pcie->soc_base ==BCM7712 ) +if (pcie->cfg->soc_base ==BCM7712 )return n; ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1,
@@ -1012,7 +1007,7 @@ static void set_inbound_win_registers(st* 7712: * All of their BARs need to be set. */ -if (pcie->soc_base ==BCM7712 ) { +if (pcie->cfg->soc_base ==BCM7712 ) {/* BUS remap register settings */ reg_offset =brcm_ubus_reg_offset (i); tmp =lower_32_bits (cpu_addr) & ~0xfff ;
@@ -1036,15 +1031,15 @@ static int brcm_pcie_setup(struct brcm_pint memc, ret;/* Reset the bridge */ - ret = pcie->bridge_sw_init_set (pcie,1 ); + ret = pcie->cfg->bridge_sw_init_set (pcie,1 );if (ret)return ret;/* Ensure that PERST# is asserted; some bootloaders may deassert it. */ -if (pcie->soc_base ==BCM2711 ) { - ret = pcie->perst_set (pcie,1 ); +if (pcie->cfg->soc_base ==BCM2711 ) { + ret = pcie->cfg->perst_set (pcie,1 );if (ret) { - pcie->bridge_sw_init_set (pcie,0 ); + pcie->cfg->bridge_sw_init_set (pcie,0 );return ret; } }
@@ -1052,7 +1047,7 @@ static int brcm_pcie_setup(struct brcm_pusleep_range (100 ,200 );/* Take the bridge out of reset */ - ret = pcie->bridge_sw_init_set (pcie,0 ); + ret = pcie->cfg->bridge_sw_init_set (pcie,0 );if (ret)return ret;
@@ -1072,9 +1067,9 @@ static int brcm_pcie_setup(struct brcm_p*/ if (is_bmips (pcie)) burst =0x1 ;/* 256 bytes */ -else if (pcie->soc_base ==BCM2711 ) +else if (pcie->cfg->soc_base ==BCM2711 ) burst =0x0 ;/* 128 bytes */ -else if (pcie->soc_base ==BCM7278 ) +else if (pcie->cfg->soc_base ==BCM7278 ) burst =0x3 ;/* 512 bytes */ else burst =0x2 ;/* 512 bytes */
@@ -1199,7 +1194,7 @@ static void brcm_extend_rbus_timeout(stru32 timeout_us =4000000 ;/* 4 seconds, our setting for L1SS */ /* 7712 does not have this (RGR1) timer */ -if (pcie->soc_base ==BCM7712 ) +if (pcie->cfg->soc_base ==BCM7712 )return ;/* Each unit in timeout register is 1/216,000,000 seconds */
@@ -1281,7 +1276,7 @@ static int brcm_pcie_start_link(struct bbrcm_pcie_set_gen (pcie, pcie->gen);/* Unassert the fundamental reset */ - ret = pcie->perst_set (pcie,0 ); + ret = pcie->cfg->perst_set (pcie,0 );if (ret)return ret;
@@ -1465,12 +1460,12 @@ static int brcm_phy_cntl(struct brcm_pcistatic inline int brcm_phy_start (struct brcm_pcie *pcie) { -return pcie->has_phy ?brcm_phy_cntl (pcie,1 ) :0 ; +return pcie->cfg->has_phy ?brcm_phy_cntl (pcie,1 ) :0 ; }static inline int brcm_phy_stop (struct brcm_pcie *pcie) { -return pcie->has_phy ?brcm_phy_cntl (pcie,0 ) :0 ; +return pcie->cfg->has_phy ?brcm_phy_cntl (pcie,0 ) :0 ; }static int brcm_pcie_turn_off (struct brcm_pcie *pcie)
@@ -1481,7 +1476,7 @@ static int brcm_pcie_turn_off(struct brcif (brcm_pcie_link_up (pcie))brcm_pcie_enter_l23 (pcie);/* Assert fundamental reset */ - ret = pcie->perst_set (pcie,1 ); + ret = pcie->cfg->perst_set (pcie,1 );if (ret)return ret;
@@ -1496,7 +1491,7 @@ static int brcm_pcie_turn_off(struct brcwritel (tmp, base +HARD_DEBUG (pcie));/* Shutdown PCIe bridge */ - ret = pcie->bridge_sw_init_set (pcie,1 ); + ret = pcie->cfg->bridge_sw_init_set (pcie,1 );return ret; }
@@ -1584,7 +1579,7 @@ static int brcm_pcie_resume_noirq(struct goto err_reset;/* Take bridge out of reset so we can access the SERDES reg */ - pcie->bridge_sw_init_set (pcie,0 ); + pcie->cfg->bridge_sw_init_set (pcie,0 );/* SERDES_IDDQ = 0 */ tmp =readl (base +HARD_DEBUG (pcie));
@@ -1805,12 +1800,7 @@ static int brcm_pcie_probe(struct platfo pcie =pci_host_bridge_priv (bridge); pcie->dev = &pdev->dev; pcie->np = np; - pcie->reg_offsets = data->offsets; - pcie->soc_base = data->soc_base; - pcie->perst_set = data->perst_set; - pcie->bridge_sw_init_set = data->bridge_sw_init_set; - pcie->has_phy = data->has_phy; - pcie->num_inbound_wins = data->num_inbound_wins; + pcie->cfg = data; pcie->base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (pcie->base))
@@ -1845,7 +1835,7 @@ static int brcm_pcie_probe(struct platfoif (ret)return dev_err_probe (&pdev->dev, ret,"could not enable clock\n" ); - pcie->bridge_sw_init_set (pcie,0 ); + pcie->cfg->bridge_sw_init_set (pcie,0 );if (pcie->swinit_reset) { ret =reset_control_assert (pcie->swinit_reset);
@@ -1884,7 +1874,8 @@ static int brcm_pcie_probe(struct platfo goto fail; pcie->hw_rev =readl (pcie->base +PCIE_MISC_REVISION ); -if (pcie->soc_base ==BCM4908 && pcie->hw_rev >=BRCM_PCIE_HW_REV_3_20 ) { +if (pcie->cfg->soc_base ==BCM4908 && + pcie->hw_rev >=BRCM_PCIE_HW_REV_3_20 ) {dev_err (pcie->dev,"hardware revision with unsupported PERST# setup\n" ); ret = -ENODEV ; goto fail;
@@ -1904,7 +1895,8 @@ static int brcm_pcie_probe(struct platfo } } - bridge->ops = pcie->soc_base ==BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; + bridge->ops = pcie->cfg->soc_base ==BCM7425 ? + &brcm7425_pcie_ops : &brcm_pcie_ops; bridge->sysdata = pcie;platform_set_drvdata (pdev, pcie);
Greg Kroah-Hartman
maintainerPATCH 553/567 PCI: brcmstb: Set MLW based on "num-lanes" DT property if present
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Quinlan <[email protected]>
[ Upstream commit a364d10ffe361fb34c3838d33604da493045de1e ]
By default, the driver relies on the default hardware defined value for the Max Link Width (MLW) capability. But if the "num-lanes" DT property is present, assume that the chip's default capability information is incorrect or undesired, and use the specified value instead.
Stable-dep-of: 9583f9d22991 ("PCI: brcmstb: Fix disabling L0s capability")
--- drivers/pci/controller/pcie-brcmstb.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +26 -1
@@ -46,6 +46,7 @@#define PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK 0xffffff#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc +#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK 0x1f0#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00#define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8
@@ -55,6 +56,9 @@#define PCIE_RC_DL_MDIO_WR_DATA 0x1104#define PCIE_RC_DL_MDIO_RD_DATA 0x1108 +#define PCIE_RC_PL_REG_PHY_CTL_1 0x1804 +#define PCIE_RC_PL_REG_PHY_CTL_1_REG_P2_POWERDOWN_ENA_NOSYNC_MASK 0x8 +#define PCIE_MISC_MISC_CTRL 0x4008#define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80#define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400
@@ -1025,7 +1029,7 @@ static int brcm_pcie_setup(struct brcm_pvoid __iomem *base = pcie->base;struct pci_host_bridge *bridge;struct resource_entry *entry; -u32 tmp, burst, aspm_support; +u32 tmp, burst, aspm_support, num_lanes, num_lanes_cap;u8 num_out_wins =0 ;int num_inbound_wins =0 ;int memc, ret;
@@ -1133,6 +1137,27 @@ static int brcm_pcie_setup(struct brcm_p PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);writel (tmp, base +PCIE_RC_CFG_PRIV1_LINK_CAPABILITY ); +/* 'tmp' still holds the contents of PRIV1_LINK_CAPABILITY */ + num_lanes_cap =u32_get_bits (tmp,PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK ); + num_lanes =0 ; + +/* +* Use hardware negotiated Max Link Width value by default. If the +* "num-lanes" DT property is present, assume that the chip's default +* link width capability information is incorrect/undesired and use the +* specified value instead. +*/ +if (!of_property_read_u32 (pcie->np,"num-lanes" , &num_lanes) && + num_lanes && num_lanes <=4 && num_lanes_cap != num_lanes) { +u32p_replace_bits (&tmp, num_lanes, +PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK ); +writel (tmp, base +PCIE_RC_CFG_PRIV1_LINK_CAPABILITY ); + tmp =readl (base +PCIE_RC_PL_REG_PHY_CTL_1 ); +u32p_replace_bits (&tmp,1 , +PCIE_RC_PL_REG_PHY_CTL_1_REG_P2_POWERDOWN_ENA_NOSYNC_MASK ); +writel (tmp, base +PCIE_RC_PL_REG_PHY_CTL_1 ); + } +/* * For config space accesses on the RC, show the right class for * a PCIe-PCIe bridge (the default setting is to be EP mode).
Greg Kroah-Hartman
maintainerPATCH 554/567 PCI: brcmstb: Fix disabling L0s capability
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Quinlan <[email protected]>
[ Upstream commit 9583f9d22991d2cfb5cc59a2552040c4ae98d998 ]
caab002d5069 ("PCI: brcmstb: Disable L0s component of ASPM if requested") set PCI_EXP_LNKCAP_ASPM_L1 and (optionally) PCI_EXP_LNKCAP_ASPM_L0S in PCI_EXP_LNKCAP (aka PCIE_RC_CFG_PRIV1_LINK_CAPABILITY in brcmstb).
But instead of using PCI_EXP_LNKCAP_ASPM_L1 and PCI_EXP_LNKCAP_ASPM_L0S directly, it used PCIE_LINK_STATE_L1 and PCIE_LINK_STATE_L0S, which are Linux-created values that only coincidentally matched the PCIe spec. b478e162f227 ("PCI/ASPM: Consolidate link state defines") later changed them so they no longer matched the PCIe spec, so the bits ended up in the wrong place in PCI_EXP_LNKCAP.
Use PCI_EXP_LNKCAP_ASPM_L0S to clear L0s support when there's an 'aspm-no-l0s' property. Rely on brcmstb hardware to advertise L0s and/or L1 support otherwise.
--- drivers/pci/controller/pcie-brcmstb.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/pci/controller/pcie-brcmstb.c +3 -7
@@ -47,7 +47,6 @@#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK 0x1f0 -#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00#define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8#define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8
@@ -1029,7 +1028,7 @@ static int brcm_pcie_setup(struct brcm_pvoid __iomem *base = pcie->base;struct pci_host_bridge *bridge;struct resource_entry *entry; -u32 tmp, burst, aspm_support, num_lanes, num_lanes_cap; +u32 tmp, burst, num_lanes, num_lanes_cap;u8 num_out_wins =0 ;int num_inbound_wins =0 ;int memc, ret;
@@ -1129,12 +1128,9 @@ static int brcm_pcie_setup(struct brcm_p/* Don't advertise L0s capability if 'aspm-no-l0s' */ - aspm_support =PCIE_LINK_STATE_L1 ; -if (!of_property_read_bool (pcie->np,"aspm-no-l0s" )) - aspm_support |=PCIE_LINK_STATE_L0S ; tmp =readl (base +PCIE_RC_CFG_PRIV1_LINK_CAPABILITY ); -u32p_replace_bits (&tmp, aspm_support, -PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK ); +if (of_property_read_bool (pcie->np,"aspm-no-l0s" )) + tmp &= ~PCI_EXP_LNKCAP_ASPM_L0S ;writel (tmp, base +PCIE_RC_CFG_PRIV1_LINK_CAPABILITY );/* 'tmp' still holds the contents of PRIV1_LINK_CAPABILITY */
Greg Kroah-Hartman
maintainerPATCH 555/567 mm/balloon_compaction: we cannot have isolated pages in the balloon list
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit fb05f992b6bbb4702307d96f00703ee637b24dbf ]
Patch series "mm/migration: rework movable_ops page migration (part 1)", v2.
In the future, as we decouple "struct page" from "struct folio", pages that support "non-lru page migration" -- movable_ops page migration such as memory balloons and zsmalloc -- will no longer be folios. They will not have ->mapping, ->lru, and likely no refcount and no page lock. But they will have a type and flags 🙂
This is the first part (other parts not written yet) of decoupling movable_ops page migration from folio migration.
In this series, we get rid of the ->mapping usage, and start cleaning up the code + separating it from folio migration.
Migration core will have to be further reworked to not treat movable_ops pages like folios. This is the first step into that direction.
This patch (of 29):
The core will set PG_isolated only after mops->isolate_page() was called. In case of the balloon, that is where we will remove it from the balloon list. So we cannot have isolated pages in the balloon list.
Let's drop this unnecessary check.
Stable-dep-of: 0da2ba35c0d5 ("powerpc/pseries/cmm: adjust BALLOON_MIGRATE when migrating pages")
--- mm/balloon_compaction.c | 6 ------ 1 file changed, 6 deletions(-)
mm/balloon_compaction.c +0 -6
@@ -93,12 +93,6 @@ size_t balloon_page_list_dequeue(structif (!trylock_page (page))continue ; -if (IS_ENABLED (CONFIG_BALLOON_COMPACTION ) && -PageIsolated (page)) { -/* raced with isolation */ -unlock_page (page); -continue ; - }balloon_page_delete (page);__count_vm_event (BALLOON_DEFLATE );list_add (&page->lru, pages);
Greg Kroah-Hartman
maintainerPATCH 556/567 mm/balloon_compaction: convert balloon_page_delete() to balloon_page_finalize()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 15504b1163007bbfbd9a63460d5c14737c16e96d ]
Let's move the removal of the page from the balloon list into the single caller, to remove the dependency on the PG_isolated flag and clarify locking requirements.
Note that for now, balloon_page_delete() was used on two paths:
(1) Removing a page from the balloon for deflation through balloon_page_list_dequeue()
(2) Removing an isolated page from the balloon for migration in the per-driver migration handlers. Isolated pages were already removed from the balloon list during isolation.
So instead of relying on the flag, we can just distinguish both cases directly and handle it accordingly in the caller.
We'll shuffle the operations a bit such that they logically make more sense (e.g., remove from the list before clearing flags).
In balloon migration functions we can now move the balloon_page_finalize() out of the balloon lock and perform the finalization just before dropping the balloon reference.
Document that the page lock is currently required when modifying the movability aspects of a page; hopefully we can soon decouple this from the page lock.
Stable-dep-of: 0da2ba35c0d5 ("powerpc/pseries/cmm: adjust BALLOON_MIGRATE when migrating pages")
--- arch/powerpc/platforms/pseries/cmm.c | 2 - drivers/misc/vmw_balloon.c | 3 -- drivers/virtio/virtio_balloon.c | 4 --- include/linux/balloon_compaction.h | 43 +++++++++++++---------------------- mm/balloon_compaction.c | 3 +- 5 files changed, 21 insertions(+), 34 deletions(-)
arch/powerpc/platforms/pseries/cmm.c +1 -1
@@ -532,7 +532,6 @@ static int cmm_migratepage(struct balloospin_lock_irqsave (&b_dev_info->pages_lock, flags);balloon_page_insert (b_dev_info, newpage); -balloon_page_delete (page); b_dev_info->isolated_pages--;spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);
@@ -542,6 +541,7 @@ static int cmm_migratepage(struct balloo*/ plpar_page_set_active (page); +balloon_page_finalize (page);/* balloon page list reference */ put_page (page);
drivers/misc/vmw_balloon.c +1 -2
@@ -1778,8 +1778,7 @@ static int vmballoon_migratepage(struct* @pages_lock . We keep holding @comm_lock since we will need it in a * second. */ -balloon_page_delete (page); - +balloon_page_finalize (page);put_page (page);/* Inflate */
drivers/virtio/virtio_balloon.c +1 -3
@@ -866,15 +866,13 @@ static int virtballoon_migratepage(structell_host (vb, vb->inflate_vq);/* balloon's page migration 2nd step -- deflate "page" */ -spin_lock_irqsave (&vb_dev_info->pages_lock, flags); -balloon_page_delete (page); -spin_unlock_irqrestore (&vb_dev_info->pages_lock, flags); vb->num_pfns =VIRTIO_BALLOON_PAGES_PER_PAGE ;set_page_pfns (vb, vb->pfns, page);tell_host (vb, vb->deflate_vq);mutex_unlock (&vb->balloon_lock); +balloon_page_finalize (page);put_page (page);/* balloon reference */ return MIGRATEPAGE_SUCCESS ;
include/linux/balloon_compaction.h +16 -27
61 lines not on this page · raw message
mm/balloon_compaction.c +2 -1
@@ -93,7 +93,8 @@ size_t balloon_page_list_dequeue(structif (!trylock_page (page))continue ; -balloon_page_delete (page); +list_del (&page->lru); +balloon_page_finalize (page);__count_vm_event (BALLOON_DEFLATE );list_add (&page->lru, pages);unlock_page (page);
Greg Kroah-Hartman
maintainerPATCH 557/567 powerpc/pseries/cmm: adjust BALLOON_MIGRATE when migrating pages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 0da2ba35c0d532ca0fe7af698b17d74c4d084b9a ]
Let's properly adjust BALLOON_MIGRATE like the other drivers.
Note that the INFLATE/DEFLATE events are triggered from the core when enqueueing/dequeueing pages.
This was found by code inspection.
--- arch/powerpc/platforms/pseries/cmm.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/pseries/cmm.c +1 -0
@@ -532,6 +532,7 @@ static int cmm_migratepage(struct balloospin_lock_irqsave (&b_dev_info->pages_lock, flags);balloon_page_insert (b_dev_info, newpage); +__count_vm_event (BALLOON_MIGRATE ); b_dev_info->isolated_pages--;spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 558/567 media: mediatek: vcodec: Use spinlock for context list protection lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit a5844227e0f030d2af2d85d4aed10c5eca6ca176 ]
Previously a mutex was added to protect the encoder and decoder context lists from unexpected changes originating from the SCP IP block, causing the context pointer to go invalid, resulting in a NULL pointer dereference in the IPI handler.
Turns out on the MT8173, the VPU IPI handler is called from hard IRQ context. This causes a big warning from the scheduler. This was first reported downstream on the ChromeOS kernels, but is also reproducible on mainline using Fluster with the FFmpeg v4l2m2m decoders. Even though the actual capture format is not supported, the affected code paths are triggered.
Since this lock just protects the context list and operations on it are very fast, it should be OK to switch to a spinlock.
--- drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c | 10 +++++--- drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 12 +++++----- drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h | 2 - drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c | 5 ++-- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 12 +++++----- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h | 2 - drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c | 5 ++-- 7 files changed, 28 insertions(+), 20 deletions(-)
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c +6 -4
@@ -47,30 +47,32 @@ static void mtk_vcodec_vpu_reset_dec_han {struct mtk_vcodec_dec_dev *dev = priv;struct mtk_vcodec_dec_ctx *ctx; +unsigned long flags;dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" ); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &dev->ctx_list, list) { ctx->state =MTK_STATE_ABORT ;mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); } -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags); }static void mtk_vcodec_vpu_reset_enc_handler (void *priv) {struct mtk_vcodec_enc_dev *dev = priv;struct mtk_vcodec_enc_ctx *ctx; +unsigned long flags;dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" ); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &dev->ctx_list, list) { ctx->state =MTK_STATE_ABORT ;mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); } -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags); }static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = {
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +7 -5
@@ -198,6 +198,7 @@ static int fops_vcodec_open(struct filestruct mtk_vcodec_dec_ctx *ctx =NULL ;int ret =0 , i, hw_count;struct vb2_queue *src_vq; +unsigned long flags; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)
@@ -268,9 +269,9 @@ static int fops_vcodec_open(struct file ctx->dev->vdec_pdata->init_vdec_params (ctx); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_add (&ctx->list, &dev->ctx_list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);mtk_vcodec_dbgfs_create (ctx);mutex_unlock (&dev->dev_mutex);
@@ -295,6 +296,7 @@ static int fops_vcodec_release(struct fi {struct mtk_vcodec_dec_dev *dev =video_drvdata (file);struct mtk_vcodec_dec_ctx *ctx =fh_to_dec_ctx (file->private_data); +unsigned long flags;mtk_v4l2_vdec_dbg (0 , ctx,"[%d] decoder" , ctx->id);mutex_lock (&dev->dev_mutex);
@@ -313,9 +315,9 @@ static int fops_vcodec_release(struct fiv4l2_ctrl_handler_free (&ctx->ctrl_hdl);mtk_vcodec_dbgfs_remove (dev, ctx->id); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_del_init (&ctx->list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);kfree (ctx);mutex_unlock (&dev->dev_mutex);return 0 ;
@@ -408,7 +410,7 @@ static int mtk_vcodec_probe(struct platffor (i =0 ; i <MTK_VDEC_HW_MAX ; i++)mutex_init (&dev->dec_mutex[i]);mutex_init (&dev->dev_mutex); -mutex_init (&dev->dev_ctx_lock); +spin_lock_init (&dev->dev_ctx_lock);spin_lock_init (&dev->irqlock); snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s",
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h +1 -1
@@ -283,7 +283,7 @@ struct mtk_vcodec_dec_dev {/* decoder hardware mutex lock */ struct mutex dec_mutex[MTK_VDEC_HW_MAX ];struct mutex dev_mutex; -struct mutex dev_ctx_lock; +spinlock_t dev_ctx_lock;struct workqueue_struct *decode_workqueue;spinlock_t irqlock;
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +3 -2
@@ -75,16 +75,17 @@ static void handle_get_param_msg_ack(constatic bool vpu_dec_check_ap_inst (struct mtk_vcodec_dec_dev *dec_dev,struct vdec_vpu_inst *vpu) {struct mtk_vcodec_dec_ctx *ctx; +unsigned long flags;int ret = false; -mutex_lock (&dec_dev->dev_ctx_lock); +spin_lock_irqsave (&dec_dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &dec_dev->ctx_list, list) {if (!IS_ERR_OR_NULL (ctx) && ctx->vpu_inst == vpu) { ret = true;break ; } } -mutex_unlock (&dec_dev->dev_ctx_lock); +spin_unlock_irqrestore (&dec_dev->dev_ctx_lock, flags);return ret; }
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +7 -5
@@ -117,6 +117,7 @@ static int fops_vcodec_open(struct filestruct mtk_vcodec_enc_ctx *ctx =NULL ;int ret =0 ;struct vb2_queue *src_vq; +unsigned long flags; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)
@@ -177,9 +178,9 @@ static int fops_vcodec_open(struct filemtk_v4l2_venc_dbg (2 , ctx,"Create instance [%d]@%p m2m_ctx=%p " , ctx->id, ctx, ctx->m2m_ctx); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_add (&ctx->list, &dev->ctx_list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);mutex_unlock (&dev->dev_mutex); mtk_v4l2_venc_dbg(0, ctx, "%s encoder [%d]", dev_name(&dev->plat_dev->dev),
@@ -204,6 +205,7 @@ static int fops_vcodec_release(struct fi {struct mtk_vcodec_enc_dev *dev =video_drvdata (file);struct mtk_vcodec_enc_ctx *ctx =fh_to_enc_ctx (file->private_data); +unsigned long flags;mtk_v4l2_venc_dbg (1 , ctx,"[%d] encoder" , ctx->id);mutex_lock (&dev->dev_mutex);
@@ -214,9 +216,9 @@ static int fops_vcodec_release(struct fiv4l2_fh_exit (&ctx->fh);v4l2_ctrl_handler_free (&ctx->ctrl_hdl); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_del_init (&ctx->list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);kfree (ctx);mutex_unlock (&dev->dev_mutex);return 0 ;
@@ -298,7 +300,7 @@ static int mtk_vcodec_probe(struct platfmutex_init (&dev->enc_mutex);mutex_init (&dev->dev_mutex); -mutex_init (&dev->dev_ctx_lock); +spin_lock_init (&dev->dev_ctx_lock);spin_lock_init (&dev->irqlock); snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s",
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +1 -1
@@ -206,7 +206,7 @@ struct mtk_vcodec_enc_dev {/* encoder hardware mutex lock */ struct mutex enc_mutex;struct mutex dev_mutex; -struct mutex dev_ctx_lock; +spinlock_t dev_ctx_lock;struct workqueue_struct *encode_workqueue;int enc_irq;
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c +3 -2
@@ -45,16 +45,17 @@ static void handle_enc_encode_msg(structstatic bool vpu_enc_check_ap_inst (struct mtk_vcodec_enc_dev *enc_dev,struct venc_vpu_inst *vpu) {struct mtk_vcodec_enc_ctx *ctx; +unsigned long flags;int ret = false; -mutex_lock (&enc_dev->dev_ctx_lock); +spin_lock_irqsave (&enc_dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &enc_dev->ctx_list, list) {if (!IS_ERR_OR_NULL (ctx) && ctx->vpu_inst == vpu) { ret = true;break ; } } -mutex_unlock (&enc_dev->dev_ctx_lock); +spin_unlock_irqrestore (&enc_dev->dev_ctx_lock, flags);return ret; }
Greg Kroah-Hartman
maintainerPATCH 559/567 media: amphion: Add a frame flush mode for decoder
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Qian <[email protected]>
[ Upstream commit 9ea16ba6eaf93f25f61855751f71e2e701709ddf ]
By default the amphion decoder will pre-parse 3 frames before starting to decode the first frame. Alternatively, a block of flush padding data can be appended to the frame, which will ensure that the decoder can start decoding immediately after parsing the flush padding data, thus potentially reducing decoding latency.
This mode was previously only enabled, when the display delay was set to
0. Allow the user to manually toggle the use of that mode via a module parameter called low_latency, which enables the mode without changing the display order.
Stable-dep-of: 634c2cd17bd0 ("media: amphion: Remove vpu_vb_is_codecconfig")
--- drivers/media/platform/amphion/vpu_malone.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/media/platform/amphion/vpu_malone.c +13 -1
@@ -25,6 +25,10 @@#include "vpu_imx8q.h" #include "vpu_malone.h" +static bool low_latency; +module_param (low_latency, bool,0644 ); +MODULE_PARM_DESC (low_latency,"Set low latency frame flush mode: 0 (disable) or 1 (enable)" ); +#define CMD_SIZE 25600#define MSG_SIZE 25600#define CODEC_SIZE 0x1000
@@ -1562,7 +1566,15 @@ static int vpu_malone_input_frame_data(svpu_malone_update_wptr (str_buf, wptr); -if (disp_imm && !vpu_vb_is_codecconfig (vbuf)) { +/* +* Enable the low latency flush mode if display delay is set to 0 +* or the low latency frame flush mode if it is set to 1. +* The low latency flush mode requires some padding data to be appended to each frame, +* but there must not be any padding data between the sequence header and the frame. +* This module is currently only supported for the H264 and HEVC formats, +* for other formats, vpu_malone_add_scode() will return 0. +*/ +if ((disp_imm || low_latency) && !vpu_vb_is_codecconfig (vbuf)) { ret = vpu_malone_add_scode(inst->core->iface, inst->id, &inst->stream_buffer,
Greg Kroah-Hartman
maintainerPATCH 560/567 media: amphion: Make some vpu_v4l2 functions static
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit 5d1e54bb4dc6741284a3ed587e994308ddee2f16 ]
Some functions defined in vpu_v4l2.c are never used outside of that compilation unit. Make them static.
Stable-dep-of: 634c2cd17bd0 ("media: amphion: Remove vpu_vb_is_codecconfig")
--- drivers/media/platform/amphion/vpu_v4l2.c | 12 +++++++++--- drivers/media/platform/amphion/vpu_v4l2.h | 8 -------- 2 files changed, 9 insertions(+), 11 deletions(-)
drivers/media/platform/amphion/vpu_v4l2.c +9 -3
@@ -24,6 +24,11 @@#include "vpu_msgs.h" #include "vpu_helpers.h" +static char *vpu_type_name (u32 type) +{ +return V4L2_TYPE_IS_OUTPUT (type) ?"output" :"capture" ; +} +void vpu_inst_lock (struct vpu_inst *inst) {mutex_lock (&inst->lock);
@@ -42,7 +47,7 @@ dma_addr_t vpu_get_vb_phy_addr(struct vb vb->planes[plane_no].data_offset; } -unsigned int vpu_get_vb_length (struct vb2_buffer *vb,u32 plane_no) +static unsigned int vpu_get_vb_length (struct vb2_buffer *vb,u32 plane_no) {if (plane_no >= vb->num_planes)return 0 ;
@@ -81,7 +86,7 @@ void vpu_v4l2_set_error(struct vpu_instvpu_inst_unlock (inst); } -int vpu_notify_eos (struct vpu_inst *inst) +static int vpu_notify_eos (struct vpu_inst *inst) {static const struct v4l2_event ev = { .id =0 ,
@@ -562,7 +567,8 @@ static void vpu_vb2_buf_finish(struct vbcall_void_vop (inst, on_queue_empty, q->type); } -void vpu_vb2_buffers_return (struct vpu_inst *inst,unsigned int type,enum vb2_buffer_state state) +static void vpu_vb2_buffers_return (struct vpu_inst *inst,unsigned int type, +enum vb2_buffer_state state) {struct vb2_v4l2_buffer *buf;
drivers/media/platform/amphion/vpu_v4l2.h +0 -8
@@ -26,15 +26,12 @@ void vpu_skip_frame(struct vpu_inst *insstruct vb2_v4l2_buffer *vpu_find_buf_by_sequence (struct vpu_inst *inst,u32 type,u32 sequence);struct vb2_v4l2_buffer *vpu_find_buf_by_idx (struct vpu_inst *inst,u32 type,u32 idx);void vpu_v4l2_set_error (struct vpu_inst *inst); -int vpu_notify_eos (struct vpu_inst *inst);int vpu_notify_source_change (struct vpu_inst *inst);int vpu_set_last_buffer_dequeued (struct vpu_inst *inst,bool eos); -void vpu_vb2_buffers_return (struct vpu_inst *inst,unsigned int type,enum vb2_buffer_state state);int vpu_get_num_buffers (struct vpu_inst *inst,u32 type);bool vpu_is_source_empty (struct vpu_inst *inst);dma_addr_t vpu_get_vb_phy_addr (struct vb2_buffer *vb,u32 plane_no); -unsigned int vpu_get_vb_length (struct vb2_buffer *vb,u32 plane_no);static inline struct vpu_format *vpu_get_format (struct vpu_inst *inst,u32 type) {if (V4L2_TYPE_IS_OUTPUT (type))
@@ -43,11 +40,6 @@ static inline struct vpu_format *vpu_getreturn &inst->cap_format; } -static inline char *vpu_type_name (u32 type) -{ -return V4L2_TYPE_IS_OUTPUT (type) ?"output" :"capture" ; -} -static inline int vpu_vb_is_codecconfig (struct vb2_v4l2_buffer *vbuf) {#ifdef V4L2_BUF_FLAG_CODECCONFIG
Greg Kroah-Hartman
maintainerPATCH 561/567 media: amphion: Remove vpu_vb_is_codecconfig
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Qian <[email protected]>
[ Upstream commit 634c2cd17bd021487c57b95973bddb14be8002ff ]
Currently the function vpu_vb_is_codecconfig() always returns 0. Delete it and its related code.
--- drivers/media/platform/amphion/vpu_malone.c | 23 +++-------------------- drivers/media/platform/amphion/vpu_v4l2.c | 10 ---------- drivers/media/platform/amphion/vpu_v4l2.h | 10 ---------- 3 files changed, 3 insertions(+), 40 deletions(-)
drivers/media/platform/amphion/vpu_malone.c +3 -20
@@ -1315,22 +1315,18 @@ static int vpu_malone_insert_scode_vc1_g {if (!scode->inst->total_input_count)return 0 ; -if (vpu_vb_is_codecconfig (to_vb2_v4l2_buffer (scode->vb))) - scode->need_data =0 ;return 0 ; }static int vpu_malone_insert_scode_vc1_g_pic (struct malone_scode_t *scode) { -struct vb2_v4l2_buffer *vbuf;u8 nal_hdr[MALONE_VC1_NAL_HEADER_LEN ];u32 *data =NULL ;int ret; - vbuf =to_vb2_v4l2_buffer (scode->vb); data =vb2_plane_vaddr (scode->vb,0 ); -if (scode->inst->total_input_count ==0 ||vpu_vb_is_codecconfig (vbuf)) +if (scode->inst->total_input_count ==0 )return 0 ;if (MALONE_VC1_CONTAIN_NAL (*data))return 0 ;
@@ -1351,8 +1347,6 @@ static int vpu_malone_insert_scode_vc1_lint size =0 ;u8 rcv_seqhdr[MALONE_VC1_RCV_SEQ_HEADER_LEN ]; -if (vpu_vb_is_codecconfig (to_vb2_v4l2_buffer (scode->vb))) - scode->need_data =0 ;if (scode->inst->total_input_count)return 0 ; scode->need_data =0 ;
@@ -1538,7 +1532,7 @@ static int vpu_malone_input_frame_data(s scode.vb = vb; scode.wptr = wptr; scode.need_data =1 ; -if (vbuf->sequence ==0 ||vpu_vb_is_codecconfig (vbuf)) +if (vbuf->sequence ==0 ) ret =vpu_malone_insert_scode (&scode,SCODE_SEQUENCE );if (ret <0 )
@@ -1574,7 +1568,7 @@ static int vpu_malone_input_frame_data(s* This module is currently only supported for the H264 and HEVC formats, * for other formats, vpu_malone_add_scode() will return 0. */ -if ((disp_imm || low_latency) && !vpu_vb_is_codecconfig (vbuf)) { +if (disp_imm || low_latency) { ret = vpu_malone_add_scode(inst->core->iface, inst->id, &inst->stream_buffer,
@@ -1621,7 +1615,6 @@ int vpu_malone_input_frame(struct vpu_sh struct vpu_inst *inst, struct vb2_buffer *vb) { struct vpu_dec_ctrl *hc = shared->priv; -struct vb2_v4l2_buffer *vbuf;struct vpu_malone_str_buffer __iomem *str_buf = hc->str_buf[inst->id];u32 disp_imm = hc->codec_param[inst->id].disp_imm;u32 size;
@@ -1635,16 +1628,6 @@ int vpu_malone_input_frame(struct vpu_shreturn ret; size = ret; -/* -* if buffer only contain codec data, and the timestamp is invalid, -* don't put the invalid timestamp to resync -* merge the data to next frame -*/ - vbuf =to_vb2_v4l2_buffer (vb); -if (vpu_vb_is_codecconfig (vbuf)) { - inst->extra_size += size; -return 0 ; - }if (inst->extra_size) { size += inst->extra_size; inst->extra_size =0 ;
drivers/media/platform/amphion/vpu_v4l2.c +0 -10
@@ -349,16 +349,6 @@ struct vb2_v4l2_buffer *vpu_next_src_bufif (!src_buf ||vpu_get_buffer_state (src_buf) ==VPU_BUF_STATE_IDLE )return NULL ; -while (vpu_vb_is_codecconfig (src_buf)) { -v4l2_m2m_src_buf_remove (inst->fh.m2m_ctx); -vpu_set_buffer_state (src_buf,VPU_BUF_STATE_IDLE ); -v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_DONE ); - - src_buf =v4l2_m2m_next_src_buf (inst->fh.m2m_ctx); -if (!src_buf ||vpu_get_buffer_state (src_buf) ==VPU_BUF_STATE_IDLE ) -return NULL ; - } -return src_buf; }
drivers/media/platform/amphion/vpu_v4l2.h +0 -10
@@ -39,14 +39,4 @@ static inline struct vpu_format *vpu_get else return &inst->cap_format; } - -static inline int vpu_vb_is_codecconfig (struct vb2_v4l2_buffer *vbuf) -{ -#ifdef V4L2_BUF_FLAG_CODECCONFIG -return (vbuf->flags &V4L2_BUF_FLAG_CODECCONFIG ) ?1 :0 ; -#else -return 0 ; -#endif -} -#endif
Greg Kroah-Hartman
maintainerPATCH 562/567 vfio/pci: Disable qword access to the PCI ROM bar
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Tian <[email protected]>
[ Upstream commit dc85a46928c41423ad89869baf05a589e2975575 ]
Commit 2b938e3db335 ("vfio/pci: Enable iowrite64 and ioread64 for vfio pci") enables qword access to the PCI bar resources. However certain devices (e.g. Intel X710) are observed with problem upon qword accesses to the rom bar, e.g. triggering PCI aer errors.
This is triggered by Qemu which caches the rom content by simply does a pread() of the remaining size until it gets the full contents. The other bars would only perform operations at the same access width as their guest drivers.
Instead of trying to identify all broken devices, universally disable qword access to the rom bar i.e. going back to the old way which worked reliably for years.
--- drivers/vfio/pci/nvgrace-gpu/main.c | 4 ++-- drivers/vfio/pci/vfio_pci_rdwr.c | 24 ++++++++++++++++++------ include/linux/vfio_pci_core.h | 10 +++++++++- 3 files changed, 29 insertions(+), 9 deletions(-)
drivers/vfio/pci/nvgrace-gpu/main.c +2 -2
@@ -482,7 +482,7 @@ nvgrace_gpu_map_and_read(struct nvgrace_ ret =vfio_pci_core_do_io_rw (&nvdev->core_device, false, nvdev->resmem.ioaddr, buf, offset, mem_count, -0 ,0 , false); +0 ,0 , false,VFIO_PCI_IO_WIDTH_8 ); }return ret;
@@ -600,7 +600,7 @@ nvgrace_gpu_map_and_write(struct nvgrace ret =vfio_pci_core_do_io_rw (&nvdev->core_device, false, nvdev->resmem.ioaddr, (char __user *)buf, pos, mem_count, -0 ,0 , true); +0 ,0 , true,VFIO_PCI_IO_WIDTH_8 ); }return ret;
drivers/vfio/pci/vfio_pci_rdwr.c +18 -6
@@ -141,7 +141,8 @@ VFIO_IORDWR(64)ssize_t vfio_pci_core_do_io_rw (struct vfio_pci_core_device *vdev,bool test_mem,void __iomem *io,char __user *buf,loff_t off,size_t count,size_t x_start, -size_t x_end,bool iswrite) +size_t x_end,bool iswrite, +enum vfio_pci_io_width max_width) {ssize_t done =0 ;int ret;
@@ -157,7 +158,7 @@ ssize_t vfio_pci_core_do_io_rw(struct vf fillable =0 ;#if defined(ioread64) && defined(iowrite64) -if (fillable >=8 && !(off %8 )) { +if (fillable >=8 && !(off %8 ) && max_width >=8 ) { ret =vfio_pci_iordwr64 (vdev, iswrite, test_mem, io, buf, off, &filled);if (ret)
@@ -165,13 +166,13 @@ ssize_t vfio_pci_core_do_io_rw(struct vf } else#endif -if (fillable >=4 && !(off %4 )) { +if (fillable >=4 && !(off %4 ) && max_width >=4 ) { ret =vfio_pci_iordwr32 (vdev, iswrite, test_mem, io, buf, off, &filled);if (ret)return ret; - }else if (fillable >=2 && !(off %2 )) { + }else if (fillable >=2 && !(off %2 ) && max_width >=2 ) { ret =vfio_pci_iordwr16 (vdev, iswrite, test_mem, io, buf, off, &filled);if (ret)
@@ -242,6 +243,7 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_void __iomem *io;struct resource *res = &vdev->pdev->resource[bar];ssize_t done; +enum vfio_pci_io_width max_width =VFIO_PCI_IO_WIDTH_8 ;if (pci_resource_start (pdev, bar)) end =pci_resource_len (pdev, bar);
@@ -268,6 +270,16 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_ goto out; } x_end = end; + +/* +* Certain devices (e.g. Intel X710) don't support qword +* access to the ROM bar. Otherwise PCI AER errors might be +* triggered. +* +* Disable qword access to the ROM bar universally, which +* worked reliably for years before qword access is enabled. +*/ + max_width =VFIO_PCI_IO_WIDTH_4 ; }else {int ret =vfio_pci_core_setup_barmap (vdev, bar);if (ret) {
@@ -284,7 +296,7 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_ } done =vfio_pci_core_do_io_rw (vdev, res->flags &IORESOURCE_MEM , io, buf, pos, - count, x_start, x_end, iswrite); + count, x_start, x_end, iswrite, max_width);if (done >=0 ) *ppos += done;
@@ -353,7 +365,7 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_* to the memory enable bit in the command register. */ done =vfio_pci_core_do_io_rw (vdev, false, iomem, buf, off, count, -0 ,0 , iswrite); +0 ,0 , iswrite,VFIO_PCI_IO_WIDTH_8 );vga_put (vdev->pdev, rsrc);
include/linux/vfio_pci_core.h +9 -1
@@ -102,6 +102,13 @@ struct vfio_pci_core_device {struct rw_semaphore memory_lock; }; +enum vfio_pci_io_width { +VFIO_PCI_IO_WIDTH_1 =1 , +VFIO_PCI_IO_WIDTH_2 =2 , +VFIO_PCI_IO_WIDTH_4 =4 , +VFIO_PCI_IO_WIDTH_8 =8 , +}; +/* Will be exported for vfio pci drivers usage */ int vfio_pci_core_register_dev_region(struct vfio_pci_core_device *vdev, unsigned int type, unsigned int subtype,
@@ -137,7 +144,8 @@ pci_ers_result_t vfio_pci_core_aer_err_dssize_t vfio_pci_core_do_io_rw (struct vfio_pci_core_device *vdev,bool test_mem,void __iomem *io,char __user *buf,loff_t off,size_t count,size_t x_start, -size_t x_end,bool iswrite); +size_t x_end,bool iswrite, +enum vfio_pci_io_width max_width); bool vfio_pci_core_range_intersect_range(loff_t buf_start, size_t buf_cnt, loff_t reg_start, size_t reg_cnt, loff_t *buf_offset,
Greg Kroah-Hartman
maintainerPATCH 563/567 mm/damon/tests/core-kunit: handle alloc failures on damon_test_split_regions_of()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit eded254cb69044bd4abde87394ea44909708d7c0 upstream.
damon_test_split_regions_of() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/tests/core-kunit.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
mm/damon/tests/core-kunit.h +20 -0
@@ -278,15 +278,35 @@ static void damon_test_split_regions_of(struct damon_target *t;struct damon_region *r; +if (!c) +kunit_skip (test,"ctx alloc fail" ); t =damon_new_target (); +if (!t) { +damon_destroy_ctx (c); +kunit_skip (test,"target alloc fail" ); + } r =damon_new_region (0 ,22 ); +if (!r) { +damon_destroy_ctx (c); +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t);damon_split_regions_of (t,2 );KUNIT_EXPECT_LE (test,damon_nr_regions (t),2u );damon_free_target (t); t =damon_new_target (); +if (!t) { +damon_destroy_ctx (c); +kunit_skip (test,"second target alloc fail" ); + } r =damon_new_region (0 ,220 ); +if (!r) { +damon_destroy_ctx (c); +damon_free_target (t); +kunit_skip (test,"second region alloc fail" ); + }damon_add_region (r, t);damon_split_regions_of (t,4 );KUNIT_EXPECT_LE (test,damon_nr_regions (t),4u );
Greg Kroah-Hartman
maintainerPATCH 564/567 mm/damon/tests/core-kunit: handle alloc failres in damon_test_new_filter()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 28ab2265e9422ccd81e4beafc0ace90f78de04c4 upstream.
damon_test_new_filter() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/tests/core-kunit.h | 2 ++ 1 file changed, 2 insertions(+)
mm/damon/tests/core-kunit.h +2 -0
@@ -505,6 +505,8 @@ static void damos_test_new_filter(structstruct damos_filter *filter; filter =damos_new_filter (DAMOS_FILTER_TYPE_ANON , true); +if (!filter) +kunit_skip (test,"filter alloc fail" );KUNIT_EXPECT_EQ (test, filter->type,DAMOS_FILTER_TYPE_ANON );KUNIT_EXPECT_EQ (test, filter->matching, true);KUNIT_EXPECT_PTR_EQ (test, filter->list.prev, &filter->list);
Greg Kroah-Hartman
maintainerPATCH 565/567 mm/damon/tests/vaddr-kunit: handle alloc failures on damon_do_test_apply_three_regions()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 2b22d0fcc6320ba29b2122434c1d2f0785fb0a25 upstream.
damon_do_test_apply_three_regions() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/tests/vaddr-kunit.h | 6 ++++++ 1 file changed, 6 insertions(+)
mm/damon/tests/vaddr-kunit.h +6 -0
@@ -136,8 +136,14 @@ static void damon_do_test_apply_three_reint i; t =damon_new_target (); +if (!t) +kunit_skip (test,"target alloc fail" );for (i =0 ; i < nr_regions /2 ; i++) { r =damon_new_region (regions[i *2 ], regions[i *2 +1 ]); +if (!r) { +damon_destroy_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t); }
Greg Kroah-Hartman
maintainerPATCH 566/567 iomap: allocate s_dio_done_wq for async reads as well
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 7fd8720dff2d9c70cf5a1a13b7513af01952ec02 upstream.
Since commit 222f2c7c6d14 ("iomap: always run error completions in user context"), read error completions are deferred to s_dio_done_wq. This means the workqueue also needs to be allocated for async reads.
--- fs/iomap/direct-io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/iomap/direct-io.c +5 -5
@@ -674,12 +674,12 @@ __iomap_dio_rw(struct kiocb *iocb, struc } goto out_free_dio; } + } -if (!wait_for_completion && !inode->i_sb->s_dio_done_wq) { - ret =sb_init_dio_done_wq (inode->i_sb); -if (ret <0 ) - goto out_free_dio; - } +if (!wait_for_completion && !inode->i_sb->s_dio_done_wq) { + ret =sb_init_dio_done_wq (inode->i_sb); +if (ret <0 ) + goto out_free_dio; }inode_dio_begin (inode);
Greg Kroah-Hartman
maintainerPATCH 567/567 block: fix NULL pointer dereference in blk_zone_reset_all_bio_endio()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit c2b8d20628ca789640f64074a642f9440eefc623 upstream.
For zoned block devices that do not need zone write plugs (e.g. most device mapper devices that support zones), the disk hash table of zone write plugs is NULL. For such devices, blk_zone_reset_all_bio_endio() should not attempt to scan this has table as that causes a NULL pointer dereference.
Fix this by checking that the disk does have zone write plugs using the atomic counter. This is equivalent to checking for a non-NULL hash table but has the advantage to also speed up the execution of blk_zone_reset_all_bio_endio() for devices that do use zone write plugs but do not have any plug in the hash table (e.g. a disk with only full zones).
--- block/blk-zoned.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
block/blk-zoned.c +12 -9
@@ -746,17 +746,20 @@ static void blk_zone_reset_all_bio_endiounsigned long flags;unsigned int i; -/* Update the condition of all zone write plugs. */ -rcu_read_lock (); -for (i =0 ; i <disk_zone_wplugs_hash_size (disk); i++) { -hlist_for_each_entry_rcu (zwplug, &disk->zone_wplugs_hash[i], - node) { -spin_lock_irqsave (&zwplug->lock, flags); -disk_zone_wplug_set_wp_offset (disk, zwplug,0 ); -spin_unlock_irqrestore (&zwplug->lock, flags); +if (atomic_read (&disk->nr_zone_wplugs)) { +/* Update the condition of all zone write plugs. */ +rcu_read_lock (); +for (i =0 ; i <disk_zone_wplugs_hash_size (disk); i++) { +hlist_for_each_entry_rcu (zwplug, + &disk->zone_wplugs_hash[i], + node) { +spin_lock_irqsave (&zwplug->lock, flags); +disk_zone_wplug_set_wp_offset (disk, zwplug,0 ); +spin_unlock_irqrestore (&zwplug->lock, flags); + } } +rcu_read_unlock (); } -rcu_read_unlock (); }static void blk_zone_finish_bio_endio (struct bio *bio)
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.12.64-rc1-g98ddcf2ac4d1 #1 SMP PREEMPT_DYNAMIC Tue Jan 6 19:09:11 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Hi1
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Could you update my email address? I'd like to keep testing and @denx.de address is no longer suitable.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.12.y
Thanks and best regards,
Pavel
Signature · 1 line
In cooperation with Nabla.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.64-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Am 06.01.2026 um 17:56 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.64-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.64-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Compiled and tested on
- Verdin AM62
- Verdin iMX8MP
- Toradex SMARC iMX8MP
Francesco
hello
Compiled and booted 6.12.64-rc1+
No typical new regressions from dmesg.
As per the dmidecode command.
Version: AMD Ryzen 3 3250U with Radeon Graphics
Processor Information
Socket Designation: FP5
Type: Central Processor
Family: Zen
Manufacturer: Advanced Micro Devices, Inc.
ID: 81 0F 81 00 FF FB 8B 17
Signature: Family 23, Model 24, Stepping 1
--
software engineer
rajagiri school of engineering and technology
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 8 lines · On Tue, 06 Jan 2026 17:56:22 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64:
Thanks!
Cheers,
Miguel
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.64-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Builds successfully. Boots and works on qemu and Intel Core i7-10810U
Thanks,
Brett
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.64 release. There are 567 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 08 Jan 2026 17:03:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.64-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
120 tests: 120 pass, 0 failLinux version: 6.12.64-rc1-g98ddcf2ac4d1
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
The kernel, bpf tool, perf tool, and kselftest builds fine for v6.12.64-rc1 on x86 and arm64 Azure VM.
Thanks,
Hardik