Patch "media: iommu/mediatek-v1: Free the existed fwspec if the master dev already has" has been added to the 5.15-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

    media: iommu/mediatek-v1: Free the existed fwspec if the master dev already has

to the 5.15-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:
     media-iommu-mediatek-v1-free-the-existed-fwspec-if-t.patch
and it can be found in the queue-5.15 subdirectory.

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



commit b6134445fdba24f5219a41bc7a6f7bb5f9b01d4c
Author: Yong Wu <yong.wu@xxxxxxxxxxxx>
Date:   Mon Jan 17 08:04:59 2022 +0100

    media: iommu/mediatek-v1: Free the existed fwspec if the master dev already has
    
    [ Upstream commit 822a2ed8c606caf6a11b1a180b8e46292bd77d71 ]
    
    When the iommu master device enters of_iommu_xlate, the ops may be
    NULL(iommu dev is defered), then it will initialize the fwspec here:
    
    [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
    (iommu_fwspec_init+0xbc/0xd4)
    [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
    (of_iommu_xlate+0x7c/0x12c)
    [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
    (of_iommu_configure+0x144/0x1e8)
    
    BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
    weird. We always expect create the fwspec internally. otherwise it will
    enter here and return fail.
    
    static int mtk_iommu_create_mapping(struct device *dev,
                                        struct of_phandle_args *args)
    {
            ...
            if (!fwspec) {
                    ....
            } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
                    >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
                    return -EINVAL;
            }
            ...
    }
    
    Thus, Free the existed fwspec if the master device already has fwspec.
    
    This issue is reported at:
    https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
    
    Reported-by: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>
    Tested-by: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx> # BPI-R2/MT7623
    Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
    Acked-by: Joerg Roedel <jroedel@xxxxxxx>
    Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index be22fcf988ce..1467ba1e4417 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct mtk_iommu_data *data;
 	int err, idx = 0;
 
+	/*
+	 * In the deferred case, free the existed fwspec.
+	 * Always initialize the fwspec internally.
+	 */
+	if (fwspec) {
+		iommu_fwspec_free(dev);
+		fwspec = dev_iommu_fwspec_get(dev);
+	}
+
 	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
 					   "#iommu-cells",
 					   idx, &iommu_spec)) {



[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