2017-12-23 11:09:51

by Yisheng Xie

[permalink] [raw]
Subject: [PATCH v3 19/27] drm: replace devm_ioremap_nocache with devm_ioremap

Default ioremap is ioremap_nocache, so devm_ioremap has the same
function with devm_ioremap_nocache, which can just be killed to
save the size of devres.o

This patch is to use use devm_ioremap instead of devm_ioremap_nocache,
which should not have any function change but prepare for killing
devm_ioremap_nocache.

Cc: Daniel Vetter <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: David Airlie <[email protected]>
Cc: [email protected]
Signed-off-by: Yisheng Xie <[email protected]>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 2 +-
drivers/gpu/drm/msm/msm_drv.c | 2 +-
drivers/gpu/drm/sti/sti_dvo.c | 3 +--
drivers/gpu/drm/sti/sti_hda.c | 4 ++--
drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
drivers/gpu/drm/sti/sti_tvout.c | 2 +-
drivers/gpu/drm/sti/sti_vtg.c | 2 +-
7 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index d4f6f1f..242e14f 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -237,7 +237,7 @@ static int hibmc_hw_map(struct hibmc_drm_private *priv)

ioaddr = pci_resource_start(pdev, 1);
iosize = pci_resource_len(pdev, 1);
- priv->mmio = devm_ioremap_nocache(dev->dev, ioaddr, iosize);
+ priv->mmio = devm_ioremap(dev->dev, ioaddr, iosize);
if (!priv->mmio) {
DRM_ERROR("Cannot map mmio region\n");
return -ENOMEM;
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 0a3ea30..5622704 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -122,7 +122,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,

size = resource_size(res);

- ptr = devm_ioremap_nocache(&pdev->dev, res->start, size);
+ ptr = devm_ioremap(&pdev->dev, res->start, size);
if (!ptr) {
dev_err(&pdev->dev, "failed to ioremap: %s\n", name);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 83314ae..81781c5 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -532,8 +532,7 @@ static int sti_dvo_probe(struct platform_device *pdev)
DRM_ERROR("Invalid dvo resource\n");
return -ENOMEM;
}
- dvo->regs = devm_ioremap_nocache(dev, res->start,
- resource_size(res));
+ dvo->regs = devm_ioremap(dev, res->start, resource_size(res));
if (!dvo->regs)
return -ENOMEM;

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index cf65e32..a3b46c5 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -755,14 +755,14 @@ static int sti_hda_probe(struct platform_device *pdev)
DRM_ERROR("Invalid hda resource\n");
return -ENOMEM;
}
- hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
+ hda->regs = devm_ioremap(dev, res->start, resource_size(res));
if (!hda->regs)
return -ENOMEM;

res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"video-dacs-ctrl");
if (res) {
- hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start,
+ hda->video_dacs_ctrl = devm_ioremap(dev, res->start,
resource_size(res));
if (!hda->video_dacs_ctrl)
return -ENOMEM;
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 30f02d2..ca720b8 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1371,7 +1371,7 @@ static int sti_hdmi_probe(struct platform_device *pdev)
ret = -ENOMEM;
goto release_adapter;
}
- hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
+ hdmi->regs = devm_ioremap(dev, res->start, resource_size(res));
if (!hdmi->regs) {
ret = -ENOMEM;
goto release_adapter;
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 8959fcc..fa1c7a8 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -852,7 +852,7 @@ static int sti_tvout_probe(struct platform_device *pdev)
DRM_ERROR("Invalid glue resource\n");
return -ENOMEM;
}
- tvout->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
+ tvout->regs = devm_ioremap(dev, res->start, resource_size(res));
if (!tvout->regs)
return -ENOMEM;

diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 2dcba1d..996cbe38 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -406,7 +406,7 @@ static int vtg_probe(struct platform_device *pdev)
DRM_ERROR("Get memory resource failed\n");
return -ENOMEM;
}
- vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
+ vtg->regs = devm_ioremap(dev, res->start, resource_size(res));
if (!vtg->regs) {
DRM_ERROR("failed to remap I/O memory\n");
return -ENOMEM;
--
1.8.3.1


2018-01-09 09:21:31

by Benjamin Gaignard

[permalink] [raw]
Subject: Re: [PATCH v3 19/27] drm: replace devm_ioremap_nocache with devm_ioremap

2017-12-23 12:01 GMT+01:00 Yisheng Xie <[email protected]>:
> Default ioremap is ioremap_nocache, so devm_ioremap has the same
> function with devm_ioremap_nocache, which can just be killed to
> save the size of devres.o

That looks true for arm and arm64 architectures but not, for exemple, for ia64:
https://elixir.free-electrons.com/linux/v4.15-rc7/source/arch/ia64/mm/ioremap.c

If there is still one architecture doing a difference between cached
and uncached
ioremap we can't remove devm_ioremap_nocache...

This patch only concern arm chipsets so we can apply it but that will
not help you to
reduce devres size.

> This patch is to use use devm_ioremap instead of devm_ioremap_nocache,
> which should not have any function change but prepare for killing
> devm_ioremap_nocache.
>
> Cc: Daniel Vetter <[email protected]>
> Cc: Jani Nikula <[email protected]>
> Cc: Sean Paul <[email protected]>
> Cc: David Airlie <[email protected]>
> Cc: [email protected]
> Signed-off-by: Yisheng Xie <[email protected]>
> ---
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 2 +-
> drivers/gpu/drm/msm/msm_drv.c | 2 +-
> drivers/gpu/drm/sti/sti_dvo.c | 3 +--
> drivers/gpu/drm/sti/sti_hda.c | 4 ++--
> drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
> drivers/gpu/drm/sti/sti_tvout.c | 2 +-
> drivers/gpu/drm/sti/sti_vtg.c | 2 +-
> 7 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index d4f6f1f..242e14f 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -237,7 +237,7 @@ static int hibmc_hw_map(struct hibmc_drm_private *priv)
>
> ioaddr = pci_resource_start(pdev, 1);
> iosize = pci_resource_len(pdev, 1);
> - priv->mmio = devm_ioremap_nocache(dev->dev, ioaddr, iosize);
> + priv->mmio = devm_ioremap(dev->dev, ioaddr, iosize);
> if (!priv->mmio) {
> DRM_ERROR("Cannot map mmio region\n");
> return -ENOMEM;
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 0a3ea30..5622704 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -122,7 +122,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>
> size = resource_size(res);
>
> - ptr = devm_ioremap_nocache(&pdev->dev, res->start, size);
> + ptr = devm_ioremap(&pdev->dev, res->start, size);
> if (!ptr) {
> dev_err(&pdev->dev, "failed to ioremap: %s\n", name);
> return ERR_PTR(-ENOMEM);
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 83314ae..81781c5 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -532,8 +532,7 @@ static int sti_dvo_probe(struct platform_device *pdev)
> DRM_ERROR("Invalid dvo resource\n");
> return -ENOMEM;
> }
> - dvo->regs = devm_ioremap_nocache(dev, res->start,
> - resource_size(res));
> + dvo->regs = devm_ioremap(dev, res->start, resource_size(res));
> if (!dvo->regs)
> return -ENOMEM;
>
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index cf65e32..a3b46c5 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -755,14 +755,14 @@ static int sti_hda_probe(struct platform_device *pdev)
> DRM_ERROR("Invalid hda resource\n");
> return -ENOMEM;
> }
> - hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> + hda->regs = devm_ioremap(dev, res->start, resource_size(res));
> if (!hda->regs)
> return -ENOMEM;
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "video-dacs-ctrl");
> if (res) {
> - hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start,
> + hda->video_dacs_ctrl = devm_ioremap(dev, res->start,
> resource_size(res));
> if (!hda->video_dacs_ctrl)
> return -ENOMEM;
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 30f02d2..ca720b8 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -1371,7 +1371,7 @@ static int sti_hdmi_probe(struct platform_device *pdev)
> ret = -ENOMEM;
> goto release_adapter;
> }
> - hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> + hdmi->regs = devm_ioremap(dev, res->start, resource_size(res));
> if (!hdmi->regs) {
> ret = -ENOMEM;
> goto release_adapter;
> diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
> index 8959fcc..fa1c7a8 100644
> --- a/drivers/gpu/drm/sti/sti_tvout.c
> +++ b/drivers/gpu/drm/sti/sti_tvout.c
> @@ -852,7 +852,7 @@ static int sti_tvout_probe(struct platform_device *pdev)
> DRM_ERROR("Invalid glue resource\n");
> return -ENOMEM;
> }
> - tvout->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> + tvout->regs = devm_ioremap(dev, res->start, resource_size(res));
> if (!tvout->regs)
> return -ENOMEM;
>
> diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
> index 2dcba1d..996cbe38 100644
> --- a/drivers/gpu/drm/sti/sti_vtg.c
> +++ b/drivers/gpu/drm/sti/sti_vtg.c
> @@ -406,7 +406,7 @@ static int vtg_probe(struct platform_device *pdev)
> DRM_ERROR("Get memory resource failed\n");
> return -ENOMEM;
> }
> - vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> + vtg->regs = devm_ioremap(dev, res->start, resource_size(res));
> if (!vtg->regs) {
> DRM_ERROR("failed to remap I/O memory\n");
> return -ENOMEM;
> --
> 1.8.3.1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

2018-01-12 09:37:26

by Yisheng Xie

[permalink] [raw]
Subject: Re: [PATCH v3 19/27] drm: replace devm_ioremap_nocache with devm_ioremap

Hi Benjamin ,

On 2018/1/9 17:21, Benjamin Gaignard wrote:
> 2017-12-23 12:01 GMT+01:00 Yisheng Xie <[email protected]>:
>> > Default ioremap is ioremap_nocache, so devm_ioremap has the same
>> > function with devm_ioremap_nocache, which can just be killed to
>> > save the size of devres.o
> That looks true for arm and arm64 architectures but not, for exemple, for ia64:
> https://elixir.free-electrons.com/linux/v4.15-rc7/source/arch/ia64/mm/ioremap.c
>
> If there is still one architecture doing a difference between cached
> and uncached
> ioremap we can't remove devm_ioremap_nocache...

Right.

>
> This patch only concern arm chipsets so we can apply it but that will
> not help you to
> reduce devres size.

Yes, And sorry for disturb. Please ignore about this patch.

Thanks
Yisheng
>