PCI: apple: Dynamically allocate RID-to_SID bitmap
authorMarc Zyngier <maz@kernel.org>
Tue, 1 Apr 2025 09:17:06 +0000 (10:17 +0100)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 23 Apr 2025 07:22:48 +0000 (12:52 +0530)
As we move towards supporting SoCs with varying RID-to-SID mapping
capabilities, turn the static SID tracking bitmap into a dynamically
allocated one. The current allocation size is still the same, but
that's about to change.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Tested-by: Janne Grunau <j@jannau.net>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Link: https://patch.msgid.link/20250401091713.2765724-7-maz@kernel.org
drivers/pci/controller/pcie-apple.c

index 6d7a95ab8b14617d947b59add9cfca0529865d89..8ac21d46c031dccbd3debd7f5742392f4e625621 100644 (file)
@@ -147,7 +147,7 @@ struct apple_pcie_port {
        void __iomem            *base;
        struct irq_domain       *domain;
        struct list_head        entry;
-       DECLARE_BITMAP(sid_map, MAX_RID2SID);
+       unsigned long           *sid_map;
        int                     sid_map_sz;
        int                     idx;
 };
@@ -524,6 +524,10 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
        if (!port)
                return -ENOMEM;
 
+       port->sid_map = devm_bitmap_zalloc(pcie->dev, MAX_RID2SID, GFP_KERNEL);
+       if (!port->sid_map)
+               return -ENOMEM;
+
        ret = of_property_read_u32_index(np, "reg", 0, &idx);
        if (ret)
                return ret;