Patch "PCI: apple: Initialize pcie->nvecs before use" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PCI: apple: Initialize pcie->nvecs before use

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-apple-initialize-pcie-nvecs-before-use.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bf1aaa0f17de58335fd8705b1b4158a1bd7323fd
Author: Sven Peter <sven@xxxxxxxxxxxxx>
Date:   Sat Mar 11 14:34:53 2023 +0100

    PCI: apple: Initialize pcie->nvecs before use
    
    [ Upstream commit d8650c0c2aa2e413594e4cb0faafa9958c1d7782 ]
    
    The apple_pcie_setup_port() function computes ilog2(pcie->nvecs) to set
    up the number of MSIs available for each port. However, it's called
    before apple_msi_init(), which initializes pcie->nvecs.
    
    Luckily, pcie->nvecs is part of kzalloc()-ed structure and, as such,
    initialized as zero. ilog2(0) happens to be 0xffffffff which then simply
    configures more MSIs in hardware than we have. This doesn't break
    anything because we never hand out those vectors.
    
    Thus, swap the order of the two calls so that the correctly initialized
    value is then used.
    
    [kwilczynski: commit log]
    Link: https://lore.kernel.org/linux-pci/20230311133453.63246-1-sven@xxxxxxxxxxxxx
    Fixes: 476c41ed4597 ("PCI: apple: Implement MSI support")
    Signed-off-by: Sven Peter <sven@xxxxxxxxxxxxx>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@xxxxxxxxxx>
    Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx>
    Reviewed-by: Alyssa Rosenzweig <alyssa@xxxxxxxxxxxxx>
    Reviewed-by: Eric Curtin <ecurtin@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index 66f37e403a09c..2340dab6cd5bd 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -783,6 +783,10 @@ static int apple_pcie_init(struct pci_config_window *cfg)
 	cfg->priv = pcie;
 	INIT_LIST_HEAD(&pcie->ports);
 
+	ret = apple_msi_init(pcie);
+	if (ret)
+		return ret;
+
 	for_each_child_of_node(dev->of_node, of_port) {
 		ret = apple_pcie_setup_port(pcie, of_port);
 		if (ret) {
@@ -792,7 +796,7 @@ static int apple_pcie_init(struct pci_config_window *cfg)
 		}
 	}
 
-	return apple_msi_init(pcie);
+	return 0;
 }
 
 static int apple_pcie_probe(struct platform_device *pdev)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux