nfit: Fix extended status translations for ACPI DSMs
Subsystems (2)
Vishal Verma
maintainerPATCH 1/1 nfit: Fix extended status translations for ACPI DSMs
ACPI DSMs can have an 'extended' status which can be non-zero to convey additional information about the command. In the xlat_status routine, where we translate the command statuses, we were returning an error for a non-zero extended status, even if the primary status indicated success.
--- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/nfit/core.c +1 -1
@@ -169,7 +169,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status) }/* all other non-zero status results in an error */ -if (status) +if (status &0xffff )return -EIO ;return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 16 lines · Vishal Verma
ACPI DSMs can have an 'extended' status which can be non-zero to convey additional information about the command. In the
xlat_statusroutine, where we translate the command statuses, we were returning an error for a non-zero extended status, even if the primary status indicated success.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/nfit/core.c +0
-0
drivers/acpi/nfit/core.c static int xlat_status(void *buf, unsigned int cmd, u32 status) · line 173
Quoted 6 lines
drivers/acpi/nfit/core.c +1
-1@@ -169,7 +169,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status) }/* all other non-zero status results in an error */ -if (status) +if (status &0xffff )return -EIO ;
I don't think this is right, because we have no idea at this point whether extended status is fatal or not.
Each 'case' statement in that 'switch' should be returning 0 if it does not see any errors. Because that's the only part of the function with per-command knowledge of extended being benign / informational vs fatal.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Verma, Vishal L
maintainerQuoted 34 lines · Dan Williams
On Mon, Dec 5, 2016 at 1:27 PM, Vishal Verma <[email protected]
Quoted 22 lines
wrote:
ACPI DSMs can have an 'extended' status which can be non-zero to convey
additional information about the command. In thexlat_statusroutine,
where we translate the command statuses, we were returning an error for
a non-zero extended status, even if the primary status indicated success.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>---
drivers/acpi/nfit/core.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/nfit/core.c +0
-0drivers/acpi/nfit/core.c static int xlat_status(void *buf, unsigned int · line 174
Quoted 7 lines
drivers/acpi/nfit/core.c +1
-1@@ -169,7 +169,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status) } /* all other non-zero status results in an error */ - if (status) + if (status & 0xffff) return -EIO;I don't think this is right, because we have no idea at this point whether extended status is fatal or not.
Quoted 4 lines
Each 'case' statement in that 'switch' should be returning 0 if it does not see any errors. Because that's the only part of the function with per-command knowledge of extended being benign / informational vs fatal.
Good point - I was wondering just that.. I'll resend.
_______________________________________________
Linux-nvdimm mailing list [email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 35 lines · Vishal L
Quoted 34 lines · Dan Williams
On Mon, Dec 5, 2016 at 1:27 PM, Vishal Verma <[email protected]
Quoted 22 lines
wrote:
ACPI DSMs can have an 'extended' status which can be non-zero to convey
additional information about the command. In thexlat_statusroutine,
where we translate the command statuses, we were returning an error for
a non-zero extended status, even if the primary status indicated success.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/nfit/core.c +0
-0drivers/acpi/nfit/core.c static int xlat_status(void *buf, unsigned int · line 174
Quoted 7 lines
drivers/acpi/nfit/core.c +1
-1@@ -169,7 +169,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status) }/* all other non-zero status results in an error */ -if (status) +if (status &0xffff )return -EIO ;I don't think this is right, because we have no idea at this point whether extended status is fatal or not.
Quoted 6 lines
Quoted 4 lines
Each 'case' statement in that 'switch' should be returning 0 if it does not see any errors. Because that's the only part of the function with per-command knowledge of extended being benign / informational vs fatal.
Good point - I was wondering just that.. I'll resend.
But can't that function be called with the status for DSMs that aren't in switch statement?
All the DSM specs I've seen separate the status into status and extended or function-specific status, which is either defined or reserved. If the 2 bytes of status don't indicate a failure, I don't think you should return EIO just because there may be something set in a reserved bit.
-- ljk
Quoted 5 lines
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 41 lines · Linda Knippers
Quoted 40 lines · Vishal L
Quoted 38 lines · Dan Williams
On Mon, Dec 5, 2016 at 1:27 PM, Vishal Verma <[email protected]
Quoted 22 lines
wrote:
ACPI DSMs can have an 'extended' status which can be non-zero to convey
additional information about the command. In thexlat_statusroutine,
where we translate the command statuses, we were returning an error for
a non-zero extended status, even if the primary status indicated success.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/nfit/core.c +0
-0drivers/acpi/nfit/core.c static int xlat_status(void *buf, unsigned int · line 174
Quoted 7 lines
drivers/acpi/nfit/core.c +1
-1@@ -169,7 +169,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status) }/* all other non-zero status results in an error */ -if (status) +if (status &0xffff )return -EIO ;I don't think this is right, because we have no idea at this point whether extended status is fatal or not.
Each 'case' statement in that 'switch' should be returning 0 if it does not see any errors. Because that's the only part of the function with per-command knowledge of extended being benign / informational vs fatal.
Quoted 5 lines
Quoted 1 line
Good point - I was wondering just that.. I'll resend.
But can't that function be called with the status for DSMs that aren't in switch statement?
Yes, but keep in mind the only consumer of that "cmd_rc" result is in-kernel callers.
Quoted 4 lines
All the DSM specs I've seen separate the status into status and extended or function-specific status, which is either defined or reserved. If the 2 bytes of status don't indicate a failure, I don't think you should return EIO just because there may be something set in a reserved bit.
The kernel will only consume that status for ARS and label commands. In the case of ND_CMD_CALL, and other DSMs that the kernel never consumes internally, the translation to -EIO is benign.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 51 lines · Dan Williams
Quoted 41 lines · Linda Knippers
Quoted 40 lines · Vishal L
Quoted 38 lines · Dan Williams
On Mon, Dec 5, 2016 at 1:27 PM, Vishal Verma <[email protected]
Quoted 22 lines
wrote:
ACPI DSMs can have an 'extended' status which can be non-zero to convey
additional information about the command. In thexlat_statusroutine,
where we translate the command statuses, we were returning an error for
a non-zero extended status, even if the primary status indicated success.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/nfit/core.c +0
-0drivers/acpi/nfit/core.c static int xlat_status(void *buf, unsigned int · line 174
Quoted 7 lines
drivers/acpi/nfit/core.c +1
-1@@ -169,7 +169,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status) }/* all other non-zero status results in an error */ -if (status) +if (status &0xffff )return -EIO ;I don't think this is right, because we have no idea at this point whether extended status is fatal or not.
Each 'case' statement in that 'switch' should be returning 0 if it does not see any errors. Because that's the only part of the function with per-command knowledge of extended being benign / informational vs fatal.
Quoted 5 lines
Quoted 1 line
Good point - I was wondering just that.. I'll resend.
But can't that function be called with the status for DSMs that aren't in switch statement?
Yes, but keep in mind the only consumer of that "
cmd_rc" result is in-kernel callers.
Quoted 8 lines
Quoted 4 lines
All the DSM specs I've seen separate the status into status and extended or function-specific status, which is either defined or reserved. If the 2 bytes of status don't indicate a failure, I don't think you should return EIO just because there may be something set in a reserved bit.
The kernel will only consume that status for ARS and label commands. In the case of
ND_CMD_CALL, and other DSMs that the kernel never consumes internally, the translation to-EIOis benign.
Actually, it looks like -EIO won't be returned because fw_status is still 0 when xlat_status is called so there's nothing to translate. Am I reading that right? If so, you could probably avoid the call.
-- ljk
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm