* [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
@ 2021-05-18 11:28 ` Dong Aisheng
0 siblings, 0 replies; 10+ messages in thread
From: Dong Aisheng @ 2021-05-18 11:28 UTC (permalink / raw)
To: iommu
Cc: linux-kernel, dongas86, Dong Aisheng, Christoph Hellwig,
Marek Szyprowski, Robin Murphy
dma_contiguous_reserve() aims to support cmdline case for CMA memory
reserve. But if users define reserved memory in DT,
'dma_contiguous_default_area' will not be 0, then it's meaningless
to continue to run dma_contiguous_reserve(). So we return early
if detect 'dma_contiguous_default_area' is unzero.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
kernel/dma/contiguous.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 3d63d91cba5c..ebade9f43eff 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
phys_addr_t selected_limit = limit;
bool fixed = false;
+ if (dma_contiguous_default_area)
+ return;
+
pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
if (size_cmdline != -1) {
@@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
#endif
}
- if (selected_size && !dma_contiguous_default_area) {
+ if (selected_size) {
pr_debug("%s: reserving %ld MiB for global area\n", __func__,
(unsigned long)selected_size / SZ_1M);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
@ 2021-05-18 11:28 ` Dong Aisheng
0 siblings, 0 replies; 10+ messages in thread
From: Dong Aisheng @ 2021-05-18 11:28 UTC (permalink / raw)
To: iommu
Cc: Dong Aisheng, dongas86, linux-kernel, Robin Murphy, Christoph Hellwig
dma_contiguous_reserve() aims to support cmdline case for CMA memory
reserve. But if users define reserved memory in DT,
'dma_contiguous_default_area' will not be 0, then it's meaningless
to continue to run dma_contiguous_reserve(). So we return early
if detect 'dma_contiguous_default_area' is unzero.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
kernel/dma/contiguous.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 3d63d91cba5c..ebade9f43eff 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
phys_addr_t selected_limit = limit;
bool fixed = false;
+ if (dma_contiguous_default_area)
+ return;
+
pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
if (size_cmdline != -1) {
@@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
#endif
}
- if (selected_size && !dma_contiguous_default_area) {
+ if (selected_size) {
pr_debug("%s: reserving %ld MiB for global area\n", __func__,
(unsigned long)selected_size / SZ_1M);
--
2.25.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
2021-05-18 11:28 ` Dong Aisheng
@ 2021-05-18 18:51 ` Robin Murphy
-1 siblings, 0 replies; 10+ messages in thread
From: Robin Murphy @ 2021-05-18 18:51 UTC (permalink / raw)
To: Dong Aisheng, iommu; +Cc: dongas86, linux-kernel, Christoph Hellwig
On 2021-05-18 12:28, Dong Aisheng wrote:
> dma_contiguous_reserve() aims to support cmdline case for CMA memory
> reserve. But if users define reserved memory in DT,
> 'dma_contiguous_default_area' will not be 0, then it's meaningless
> to continue to run dma_contiguous_reserve(). So we return early
> if detect 'dma_contiguous_default_area' is unzero.
But dma_contiguous_default_area *shouldn't* be set if the command-line
argument is present - see the "if (size_cmdline != -1 && default_cma)"
part of rmem_cma_setup(). Are you seeing something different in practice?
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
> kernel/dma/contiguous.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 3d63d91cba5c..ebade9f43eff 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> phys_addr_t selected_limit = limit;
> bool fixed = false;
>
> + if (dma_contiguous_default_area)
> + return;
> +
> pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
>
> if (size_cmdline != -1) {
> @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> #endif
> }
>
> - if (selected_size && !dma_contiguous_default_area) {
> + if (selected_size) {
Either way, does skipping a handful of trivial calculations and a
debugging message really matter even when it is redundant? I can't
imagine it has any measurable effect on boot times...
Robin.
> pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> (unsigned long)selected_size / SZ_1M);
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
@ 2021-05-18 18:51 ` Robin Murphy
0 siblings, 0 replies; 10+ messages in thread
From: Robin Murphy @ 2021-05-18 18:51 UTC (permalink / raw)
To: Dong Aisheng, iommu; +Cc: Christoph Hellwig, dongas86, linux-kernel
On 2021-05-18 12:28, Dong Aisheng wrote:
> dma_contiguous_reserve() aims to support cmdline case for CMA memory
> reserve. But if users define reserved memory in DT,
> 'dma_contiguous_default_area' will not be 0, then it's meaningless
> to continue to run dma_contiguous_reserve(). So we return early
> if detect 'dma_contiguous_default_area' is unzero.
But dma_contiguous_default_area *shouldn't* be set if the command-line
argument is present - see the "if (size_cmdline != -1 && default_cma)"
part of rmem_cma_setup(). Are you seeing something different in practice?
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
> kernel/dma/contiguous.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 3d63d91cba5c..ebade9f43eff 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> phys_addr_t selected_limit = limit;
> bool fixed = false;
>
> + if (dma_contiguous_default_area)
> + return;
> +
> pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
>
> if (size_cmdline != -1) {
> @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> #endif
> }
>
> - if (selected_size && !dma_contiguous_default_area) {
> + if (selected_size) {
Either way, does skipping a handful of trivial calculations and a
debugging message really matter even when it is redundant? I can't
imagine it has any measurable effect on boot times...
Robin.
> pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> (unsigned long)selected_size / SZ_1M);
>
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
2021-05-18 18:51 ` Robin Murphy
@ 2021-05-19 3:54 ` Dong Aisheng
-1 siblings, 0 replies; 10+ messages in thread
From: Dong Aisheng @ 2021-05-19 3:54 UTC (permalink / raw)
To: Robin Murphy; +Cc: Dong Aisheng, iommu, open list, Christoph Hellwig
On Wed, May 19, 2021 at 2:51 AM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2021-05-18 12:28, Dong Aisheng wrote:
> > dma_contiguous_reserve() aims to support cmdline case for CMA memory
> > reserve. But if users define reserved memory in DT,
> > 'dma_contiguous_default_area' will not be 0, then it's meaningless
> > to continue to run dma_contiguous_reserve(). So we return early
> > if detect 'dma_contiguous_default_area' is unzero.
>
> But dma_contiguous_default_area *shouldn't* be set if the command-line
> argument is present - see the "if (size_cmdline != -1 && default_cma)"
> part of rmem_cma_setup(). Are you seeing something different in practice?
>
yes, you're right.
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> > ---
> > kernel/dma/contiguous.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> > index 3d63d91cba5c..ebade9f43eff 100644
> > --- a/kernel/dma/contiguous.c
> > +++ b/kernel/dma/contiguous.c
> > @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> > phys_addr_t selected_limit = limit;
> > bool fixed = false;
> >
> > + if (dma_contiguous_default_area)
> > + return;
> > +
> > pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
> >
> > if (size_cmdline != -1) {
> > @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> > #endif
> > }
> >
> > - if (selected_size && !dma_contiguous_default_area) {
> > + if (selected_size) {
>
> Either way, does skipping a handful of trivial calculations and a
> debugging message really matter even when it is redundant? I can't
> imagine it has any measurable effect on boot times...
>
I think it's not about performance.
It aims to improve the code readability as it's meaningless to continue to
execute cmdline CMA reserve logic once DT is used successfully which is
a bit confusing when people first read this part of code.
Does it make sense to you?
Regards
Aisheng
> Robin.
>
> > pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> > (unsigned long)selected_size / SZ_1M);
> >
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
@ 2021-05-19 3:54 ` Dong Aisheng
0 siblings, 0 replies; 10+ messages in thread
From: Dong Aisheng @ 2021-05-19 3:54 UTC (permalink / raw)
To: Robin Murphy; +Cc: Dong Aisheng, iommu, open list, Christoph Hellwig
On Wed, May 19, 2021 at 2:51 AM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2021-05-18 12:28, Dong Aisheng wrote:
> > dma_contiguous_reserve() aims to support cmdline case for CMA memory
> > reserve. But if users define reserved memory in DT,
> > 'dma_contiguous_default_area' will not be 0, then it's meaningless
> > to continue to run dma_contiguous_reserve(). So we return early
> > if detect 'dma_contiguous_default_area' is unzero.
>
> But dma_contiguous_default_area *shouldn't* be set if the command-line
> argument is present - see the "if (size_cmdline != -1 && default_cma)"
> part of rmem_cma_setup(). Are you seeing something different in practice?
>
yes, you're right.
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> > ---
> > kernel/dma/contiguous.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> > index 3d63d91cba5c..ebade9f43eff 100644
> > --- a/kernel/dma/contiguous.c
> > +++ b/kernel/dma/contiguous.c
> > @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> > phys_addr_t selected_limit = limit;
> > bool fixed = false;
> >
> > + if (dma_contiguous_default_area)
> > + return;
> > +
> > pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
> >
> > if (size_cmdline != -1) {
> > @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> > #endif
> > }
> >
> > - if (selected_size && !dma_contiguous_default_area) {
> > + if (selected_size) {
>
> Either way, does skipping a handful of trivial calculations and a
> debugging message really matter even when it is redundant? I can't
> imagine it has any measurable effect on boot times...
>
I think it's not about performance.
It aims to improve the code readability as it's meaningless to continue to
execute cmdline CMA reserve logic once DT is used successfully which is
a bit confusing when people first read this part of code.
Does it make sense to you?
Regards
Aisheng
> Robin.
>
> > pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> > (unsigned long)selected_size / SZ_1M);
> >
> >
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
2021-05-18 11:28 ` Dong Aisheng
@ 2021-05-31 9:21 ` Dong Aisheng
-1 siblings, 0 replies; 10+ messages in thread
From: Dong Aisheng @ 2021-05-31 9:21 UTC (permalink / raw)
To: Dong Aisheng
Cc: iommu, open list, Christoph Hellwig, Marek Szyprowski, Robin Murphy
On Tue, May 18, 2021 at 7:29 PM Dong Aisheng <aisheng.dong@nxp.com> wrote:
>
> dma_contiguous_reserve() aims to support cmdline case for CMA memory
> reserve. But if users define reserved memory in DT,
> 'dma_contiguous_default_area' will not be 0, then it's meaningless
> to continue to run dma_contiguous_reserve(). So we return early
> if detect 'dma_contiguous_default_area' is unzero.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Gently ping
Regards
Aisheng
> ---
> kernel/dma/contiguous.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 3d63d91cba5c..ebade9f43eff 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> phys_addr_t selected_limit = limit;
> bool fixed = false;
>
> + if (dma_contiguous_default_area)
> + return;
> +
> pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
>
> if (size_cmdline != -1) {
> @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> #endif
> }
>
> - if (selected_size && !dma_contiguous_default_area) {
> + if (selected_size) {
> pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> (unsigned long)selected_size / SZ_1M);
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
@ 2021-05-31 9:21 ` Dong Aisheng
0 siblings, 0 replies; 10+ messages in thread
From: Dong Aisheng @ 2021-05-31 9:21 UTC (permalink / raw)
To: Dong Aisheng; +Cc: iommu, Robin Murphy, open list, Christoph Hellwig
On Tue, May 18, 2021 at 7:29 PM Dong Aisheng <aisheng.dong@nxp.com> wrote:
>
> dma_contiguous_reserve() aims to support cmdline case for CMA memory
> reserve. But if users define reserved memory in DT,
> 'dma_contiguous_default_area' will not be 0, then it's meaningless
> to continue to run dma_contiguous_reserve(). So we return early
> if detect 'dma_contiguous_default_area' is unzero.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Gently ping
Regards
Aisheng
> ---
> kernel/dma/contiguous.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 3d63d91cba5c..ebade9f43eff 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> phys_addr_t selected_limit = limit;
> bool fixed = false;
>
> + if (dma_contiguous_default_area)
> + return;
> +
> pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
>
> if (size_cmdline != -1) {
> @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> #endif
> }
>
> - if (selected_size && !dma_contiguous_default_area) {
> + if (selected_size) {
> pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> (unsigned long)selected_size / SZ_1M);
>
> --
> 2.25.1
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
2021-05-31 9:21 ` Dong Aisheng
@ 2021-06-01 18:46 ` Robin Murphy
-1 siblings, 0 replies; 10+ messages in thread
From: Robin Murphy @ 2021-06-01 18:46 UTC (permalink / raw)
To: Dong Aisheng, Dong Aisheng
Cc: iommu, open list, Christoph Hellwig, Marek Szyprowski
On 2021-05-31 10:21, Dong Aisheng wrote:
> On Tue, May 18, 2021 at 7:29 PM Dong Aisheng <aisheng.dong@nxp.com> wrote:
>>
>> dma_contiguous_reserve() aims to support cmdline case for CMA memory
>> reserve. But if users define reserved memory in DT,
>> 'dma_contiguous_default_area' will not be 0, then it's meaningless
>> to continue to run dma_contiguous_reserve(). So we return early
>> if detect 'dma_contiguous_default_area' is unzero.
>>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
>> Cc: Robin Murphy <robin.murphy@arm.com>
>> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
>
> Gently ping
The commit message is still wrong, and I still think the change doesn't
achieve anything meaningful. This code is hard to make sense of either
way because the crucial interplay between size_cmdline and
dma_contiguous_default_area is hidden somewhere else entirely, and it
would take a much more significant refactoring to clear that up.
Robin.
>
> Regards
> Aisheng
>
>> ---
>> kernel/dma/contiguous.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
>> index 3d63d91cba5c..ebade9f43eff 100644
>> --- a/kernel/dma/contiguous.c
>> +++ b/kernel/dma/contiguous.c
>> @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
>> phys_addr_t selected_limit = limit;
>> bool fixed = false;
>>
>> + if (dma_contiguous_default_area)
>> + return;
>> +
>> pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
>>
>> if (size_cmdline != -1) {
>> @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
>> #endif
>> }
>>
>> - if (selected_size && !dma_contiguous_default_area) {
>> + if (selected_size) {
>> pr_debug("%s: reserving %ld MiB for global area\n", __func__,
>> (unsigned long)selected_size / SZ_1M);
>>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve
@ 2021-06-01 18:46 ` Robin Murphy
0 siblings, 0 replies; 10+ messages in thread
From: Robin Murphy @ 2021-06-01 18:46 UTC (permalink / raw)
To: Dong Aisheng, Dong Aisheng; +Cc: iommu, open list, Christoph Hellwig
On 2021-05-31 10:21, Dong Aisheng wrote:
> On Tue, May 18, 2021 at 7:29 PM Dong Aisheng <aisheng.dong@nxp.com> wrote:
>>
>> dma_contiguous_reserve() aims to support cmdline case for CMA memory
>> reserve. But if users define reserved memory in DT,
>> 'dma_contiguous_default_area' will not be 0, then it's meaningless
>> to continue to run dma_contiguous_reserve(). So we return early
>> if detect 'dma_contiguous_default_area' is unzero.
>>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
>> Cc: Robin Murphy <robin.murphy@arm.com>
>> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
>
> Gently ping
The commit message is still wrong, and I still think the change doesn't
achieve anything meaningful. This code is hard to make sense of either
way because the crucial interplay between size_cmdline and
dma_contiguous_default_area is hidden somewhere else entirely, and it
would take a much more significant refactoring to clear that up.
Robin.
>
> Regards
> Aisheng
>
>> ---
>> kernel/dma/contiguous.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
>> index 3d63d91cba5c..ebade9f43eff 100644
>> --- a/kernel/dma/contiguous.c
>> +++ b/kernel/dma/contiguous.c
>> @@ -171,6 +171,9 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
>> phys_addr_t selected_limit = limit;
>> bool fixed = false;
>>
>> + if (dma_contiguous_default_area)
>> + return;
>> +
>> pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
>>
>> if (size_cmdline != -1) {
>> @@ -191,7 +194,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
>> #endif
>> }
>>
>> - if (selected_size && !dma_contiguous_default_area) {
>> + if (selected_size) {
>> pr_debug("%s: reserving %ld MiB for global area\n", __func__,
>> (unsigned long)selected_size / SZ_1M);
>>
>> --
>> 2.25.1
>>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-06-01 18:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 11:28 [PATCH 1/1] dma-contiguous: return early for dt case in dma_contiguous_reserve Dong Aisheng
2021-05-18 11:28 ` Dong Aisheng
2021-05-18 18:51 ` Robin Murphy
2021-05-18 18:51 ` Robin Murphy
2021-05-19 3:54 ` Dong Aisheng
2021-05-19 3:54 ` Dong Aisheng
2021-05-31 9:21 ` Dong Aisheng
2021-05-31 9:21 ` Dong Aisheng
2021-06-01 18:46 ` Robin Murphy
2021-06-01 18:46 ` Robin Murphy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.