* [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
@ 2023-07-17 8:38 Guanghui Feng
2023-07-17 8:48 ` Marc Zyngier
0 siblings, 1 reply; 7+ messages in thread
From: Guanghui Feng @ 2023-07-17 8:38 UTC (permalink / raw)
To: lpieralisi, guohanjun, sudeep.holla, lenb, linux-arm-kernel; +Cc: baolin.wang
In the ARM IORT specifications DEN 0049E.d, the recommended ID mapping format:
Field Note Description
--------------------------------
Input base The lowest value in the input range
Number of IDs The number of IDs in the range "minus" one
When there is only one id mapping in the Reserved Memory Range
(RMR) node, the node filed: "Number of IDs" is zero and
iort_node_get_rmr_info will not analyse id mapping. This is
not in compliance with the regulations.
Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
---
drivers/acpi/arm64/iort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 3631230..8427cc3 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct acpi_iort_node *node,
for (i = 0; i < node->mapping_count; i++, map++) {
struct acpi_iort_node *parent;
- if (!map->id_count)
+ if (!(map->id_count + 1))
continue;
parent = ACPI_ADD_PTR(struct acpi_iort_node, iort_table,
--
1.8.3.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
2023-07-17 8:38 [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error Guanghui Feng
@ 2023-07-17 8:48 ` Marc Zyngier
2023-07-17 9:03 ` guanghuifeng
2023-07-17 9:07 ` guanghui.fgh
0 siblings, 2 replies; 7+ messages in thread
From: Marc Zyngier @ 2023-07-17 8:48 UTC (permalink / raw)
To: Guanghui Feng
Cc: lpieralisi, guohanjun, sudeep.holla, lenb, linux-arm-kernel,
baolin.wang
On 2023-07-17 09:38, Guanghui Feng wrote:
> In the ARM IORT specifications DEN 0049E.d, the recommended ID mapping
> format:
> Field Note Description
> --------------------------------
> Input base The lowest value in the input range
> Number of IDs The number of IDs in the range "minus" one
>
> When there is only one id mapping in the Reserved Memory Range
> (RMR) node, the node filed: "Number of IDs" is zero and
> iort_node_get_rmr_info will not analyse id mapping. This is
> not in compliance with the regulations.
>
> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> ---
> drivers/acpi/arm64/iort.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 3631230..8427cc3 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct
> acpi_iort_node *node,
> for (i = 0; i < node->mapping_count; i++, map++) {
> struct acpi_iort_node *parent;
>
> - if (!map->id_count)
> + if (!(map->id_count + 1))
> continue;
struct acpi_iort_id_mapping {
[...]
u32 id_count; /* Number of IDs */
[...]
};
So the only way for id_count+1 to be 0 is when id_count==~0,
making the check even more buggy than it currently is.
M.
--
Who you jivin' with that Cosmik Debris?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
2023-07-17 8:48 ` Marc Zyngier
@ 2023-07-17 9:03 ` guanghuifeng
2023-07-17 9:07 ` guanghui.fgh
1 sibling, 0 replies; 7+ messages in thread
From: guanghuifeng @ 2023-07-17 9:03 UTC (permalink / raw)
To: Marc Zyngier, lpieralisi, guohanjun, sudeep.holla, lenb,
linux-arm-kernel, baolin.wang
On 2023/7/17 16:48, Marc Zyngier <maz@misterjones.org> wrote:
> On 2023-07-17 09:38, Guanghui Feng wrote:
> > In the ARM IORT specifications DEN 0049E.d, the recommended ID mapping
> > format:
> > Field Note Description
> > --------------------------------
> > Input base The lowest value in the input range
> > Number of IDs The number of IDs in the range "minus" one
> >
> > When there is only one id mapping in the Reserved Memory Range
> > (RMR) node, the node filed: "Number of IDs" is zero and
> > iort_node_get_rmr_info will not analyse id mapping. This is
> > not in compliance with the regulations.
> >
> > Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> > ---
> > drivers/acpi/arm64/iort.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> > index 3631230..8427cc3 100644
> > --- a/drivers/acpi/arm64/iort.c
> > +++ b/drivers/acpi/arm64/iort.c
> > @@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct
> > acpi_iort_node *node,
> > for (i = 0; i < node->mapping_count; i++, map++) {
> > struct acpi_iort_node *parent;
> >
> > - if (!map->id_count)
> > + if (!(map->id_count + 1))
> > continue;
>
> struct acpi_iort_id_mapping {
> [...]
> u32 id_count; /* Number of IDs */
> [...]
> };
>
> So the only way for id_count+1 to be 0 is when id_count==~0,
> making the check even more buggy than it currently is.
>
> M.
>
This is true. Maybe we should use (id_count == 0xffffffff) or (id_count == u32(-1))
to check the mapping count. How about this?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
2023-07-17 8:48 ` Marc Zyngier
2023-07-17 9:03 ` guanghuifeng
@ 2023-07-17 9:07 ` guanghui.fgh
2023-07-17 9:25 ` Marc Zyngier
1 sibling, 1 reply; 7+ messages in thread
From: guanghui.fgh @ 2023-07-17 9:07 UTC (permalink / raw)
To: Marc Zyngier
Cc: lpieralisi, guohanjun, sudeep.holla, linux-arm-kernel,
baolin.wang
在 2023/7/17 16:48, Marc Zyngier 写道:
> On 2023-07-17 09:38, Guanghui Feng wrote:
>> In the ARM IORT specifications DEN 0049E.d, the recommended ID mapping
>> format:
>> Field Note Description
>> --------------------------------
>> Input base The lowest value in the input range
>> Number of IDs The number of IDs in the range "minus" one
>>
>> When there is only one id mapping in the Reserved Memory Range
>> (RMR) node, the node filed: "Number of IDs" is zero and
>> iort_node_get_rmr_info will not analyse id mapping. This is
>> not in compliance with the regulations.
>>
>> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
>> ---
>> drivers/acpi/arm64/iort.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
>> index 3631230..8427cc3 100644
>> --- a/drivers/acpi/arm64/iort.c
>> +++ b/drivers/acpi/arm64/iort.c
>> @@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct
>> acpi_iort_node *node,
>> for (i = 0; i < node->mapping_count; i++, map++) {
>> struct acpi_iort_node *parent;
>>
>> - if (!map->id_count)
>> + if (!(map->id_count + 1))
>> continue;
>
> struct acpi_iort_id_mapping {
> [...]
> u32 id_count; /* Number of IDs */
> [...]
> };
>
> So the only way for id_count+1 to be 0 is when id_count==~0,
> making the check even more buggy than it currently is.
>
> M.
Thanks for your response.
It's true. Maybe we should use (id_count == 0xffffffff) or
(id_count == u32(-1)) to check the mapping count.
How about this?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
2023-07-17 9:07 ` guanghui.fgh
@ 2023-07-17 9:25 ` Marc Zyngier
0 siblings, 0 replies; 7+ messages in thread
From: Marc Zyngier @ 2023-07-17 9:25 UTC (permalink / raw)
To: guanghui.fgh
Cc: lpieralisi, guohanjun, sudeep.holla, linux-arm-kernel,
baolin.wang
On 2023-07-17 10:07, guanghui.fgh wrote:
> 在 2023/7/17 16:48, Marc Zyngier 写道:
>> On 2023-07-17 09:38, Guanghui Feng wrote:
>>> In the ARM IORT specifications DEN 0049E.d, the recommended ID
>>> mapping format:
>>> Field Note Description
>>> --------------------------------
>>> Input base The lowest value in the input range
>>> Number of IDs The number of IDs in the range "minus" one
>>>
>>> When there is only one id mapping in the Reserved Memory Range
>>> (RMR) node, the node filed: "Number of IDs" is zero and
>>> iort_node_get_rmr_info will not analyse id mapping. This is
>>> not in compliance with the regulations.
>>>
>>> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
>>> ---
>>> drivers/acpi/arm64/iort.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
>>> index 3631230..8427cc3 100644
>>> --- a/drivers/acpi/arm64/iort.c
>>> +++ b/drivers/acpi/arm64/iort.c
>>> @@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct
>>> acpi_iort_node *node,
>>> for (i = 0; i < node->mapping_count; i++, map++) {
>>> struct acpi_iort_node *parent;
>>>
>>> - if (!map->id_count)
>>> + if (!(map->id_count + 1))
>>> continue;
>>
>> struct acpi_iort_id_mapping {
>> [...]
>> u32 id_count; /* Number of IDs */
>> [...]
>> };
>>
>> So the only way for id_count+1 to be 0 is when id_count==~0,
>> making the check even more buggy than it currently is.
>>
>> M.
> Thanks for your response.
>
> It's true. Maybe we should use (id_count == 0xffffffff) or
> (id_count == u32(-1)) to check the mapping count.
> How about this?
That's even worse. Why do you want to check *anything*?
The correct fix is to *drop* this check altogether, and
may fix the type of num_sids as it can overflow (but that's
a separate patch).
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
@ 2023-07-17 8:42 Guanghui Feng
0 siblings, 0 replies; 7+ messages in thread
From: Guanghui Feng @ 2023-07-17 8:42 UTC (permalink / raw)
To: lpieralisi, guohanjun, sudeep.holla, linux-arm-kernel; +Cc: baolin.wang
In the ARM IORT specifications DEN 0049E.d, the recommended ID mapping format:
Field Note Description
--------------------------------
Input base The lowest value in the input range
Number of IDs The number of IDs in the range "minus" one
When there is only one id mapping in the Reserved Memory Range
(RMR) node, the node filed: "Number of IDs" is zero and
iort_node_get_rmr_info will not analyse id mapping. This is
not in compliance with the regulations.
Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
---
drivers/acpi/arm64/iort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 3631230..8427cc3 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct acpi_iort_node *node,
for (i = 0; i < node->mapping_count; i++, map++) {
struct acpi_iort_node *parent;
- if (!map->id_count)
+ if (!(map->id_count + 1))
continue;
parent = ACPI_ADD_PTR(struct acpi_iort_node, iort_table,
--
1.8.3.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error
@ 2023-07-17 7:57 Guanghui Feng
0 siblings, 0 replies; 7+ messages in thread
From: Guanghui Feng @ 2023-07-17 7:57 UTC (permalink / raw)
To: lpieralisi, guohanjun, sudeep.holla, rafael, lenb,
linux-arm-kernel
Cc: baolin.wang, alikernel-developer
In the ARM IORT specifications DEN 0049E.d, the recommended ID mapping format:
Field Note Description
--------------------------------
Input base The lowest value in the input range
Number of IDs The number of IDs in the range "minus" one
When there is only one id mapping in the Reserved Memory Range
(RMR) node, the node filed: "Number of IDs" is zero and
iort_node_get_rmr_info will not analyse id mapping. This is
not in compliance with the regulations.
Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
---
drivers/acpi/arm64/iort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 3631230..8427cc3 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1007,7 +1007,7 @@ static void iort_node_get_rmr_info(struct acpi_iort_node *node,
for (i = 0; i < node->mapping_count; i++, map++) {
struct acpi_iort_node *parent;
- if (!map->id_count)
+ if (!(map->id_count + 1))
continue;
parent = ACPI_ADD_PTR(struct acpi_iort_node, iort_table,
--
1.8.3.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-17 9:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 8:38 [PATCH] ACPI/IORT: fix IORT Reserved Memory Range node mapping error Guanghui Feng
2023-07-17 8:48 ` Marc Zyngier
2023-07-17 9:03 ` guanghuifeng
2023-07-17 9:07 ` guanghui.fgh
2023-07-17 9:25 ` Marc Zyngier
-- strict thread matches above, loose matches on Subject: below --
2023-07-17 8:42 Guanghui Feng
2023-07-17 7:57 Guanghui Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).