[PATCH 16/16] block: sed-opal: rename next to execute_steps

2019-02-15 Thread David Kozub
As the function is responsible for executing the individual steps supplied in the steps argument, execute_steps is a more descriptive name than the rather generic next. Signed-off-by: David Kozub Reviewed-by: Scott Bauer Reviewed-by: Christoph Hellwig Reviewed-by: Jon Derrick --- block/sed

[PATCH 05/16] block: sed-opal: close parameter list in cmd_finalize

2019-02-13 Thread David Kozub
Every step ends by calling cmd_finalize (via finalize_and_send) yet every step adds the token OPAL_ENDLIST on its own. Moving this into cmd_finalize decreases code duplication. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer

[PATCH 09/16] block: sed-opal: print failed function address

2019-02-13 Thread David Kozub
From: Jonas Rabenstein Add function address (and if available its symbol) to the message if a step function fails. Signed-off-by: Jonas Rabenstein Signed-off-by: David Kozub Reviewed-by: Scott Bauer Reviewed-by: Christoph Hellwig Reviewed-by: Jon Derrick fn(dev, step->d

[PATCH 13/16] block: sed-opal: use named Opal tokens instead of integer literals

2019-02-13 Thread David Kozub
Replace integer literals by Opal tokens defined in opal_proto.h where possible. Signed-off-by: David Kozub --- block/sed-opal.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index 5395ab1c5248..be0d633783c8 100644

[PATCH 10/16] block: sed-opal: split generation of bytestring header and content

2019-02-13 Thread David Kozub
Signed-off-by: David Kozub Reviewed-by: Scott Bauer Reviewed-by: Christoph Hellwig Reviewed-by: Jon Derrick --- block/sed-opal.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index 1f246200b574..ad66d1dc725a

[PATCH 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-02-13 Thread David Kozub
Originally each of the opal functions that call next include opal_discovery0 in the array of steps. This is superfluous and can be done always inside next. Signed-off-by: David Kozub --- block/sed-opal.c | 75 +++- 1 file changed, 42 insertions(+), 33

[PATCH 11/16] block: sed-opal: add token for OPAL_LIFECYCLE

2019-02-13 Thread David Kozub
Define OPAL_LIFECYCLE token and use it instead of literals in get_lsp_lifecycle. Signed-off-by: David Kozub --- block/opal_proto.h | 2 ++ block/sed-opal.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/block/opal_proto.h b/block/opal_proto.h index e20be8258854

[PATCH 14/16] block: sed-opal: pass steps via argument rather than via opal_dev

2019-02-13 Thread David Kozub
before return it would become a dangling pointer. When the steps are passed as argument this becomes easier to see and more difficult to misuse. Signed-off-by: David Kozub --- block/sed-opal.c | 158 +-- 1 file changed, 69 insertions(+), 89 deletions

[PATCH 12/16] block: sed-opal: unify retrieval of table columns

2019-02-13 Thread David Kozub
Instead of having multiple places defining the same argument list to get a specific column of a sed-opal table, provide a generic version and call it from those functions. Co-authored-by: David Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David Kozub Reviewed-by: Scott Bauer Reviewed

[PATCH 08/16] block: sed-opal: reuse response_get_token to decrease code duplication

2019-02-13 Thread David Kozub
response_get_token had already been in place, its functionality had been duplicated within response_get_{u64,bytestring} with the same error handling. Unify the handling by reusing response_get_token within the other functions. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed

[PATCH 01/16] block: sed-opal: fix IOC_OPAL_ENABLE_DISABLE_MBR

2019-02-13 Thread David Kozub
IOC_OPAL_ENABLE_DISABLE_MBR but this is typically used only once when setting up an Opal drive. Signed-off-by: David Kozub Acked-by: Jon Derrick --- block/sed-opal.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index e0de4dd448b3

[PATCH 07/16] block: sed-opal: unify error handling of responses

2019-02-13 Thread David Kozub
response_get_{string,u64} include error handling for argument resp being NULL but response_get_token does not handle this. Make all three of response_get_{string,u64,token} handle NULL resp in the same way. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas

[PATCH 00/16] sed-opal: fix shadow MBR enable/disable and clean up code

2019-02-13 Thread David Kozub
ps://lore.kernel.org/lkml/20190204150415.go31...@infradead.org/ [3] https://lore.kernel.org/lkml/alpine.lrh.2.21.1902072247060.29...@linux.fjfi.cvut.cz/ [4] https://lore.kernel.org/lkml/20190204145244.gj31...@infradead.org/ David Kozub (12): block: sed-opal: fix IOC_OPAL_ENABLE_DISABLE_MBR block

[PATCH 02/16] block: sed-opal: fix typos and formatting

2019-02-13 Thread David Kozub
This should make no change in functionality. The formatting changes were triggered by checkpatch.pl. Signed-off-by: David Kozub Reviewed-by: Scott Bauer Reviewed-by: Jon Derrick --- block/sed-opal.c | 18 ++ include/uapi/linux/sed-opal.h | 2 +- 2 files changed

[PATCH 06/16] block: sed-opal: unify cmd start

2019-02-13 Thread David Kozub
cmd_start and cmd_finalize respectively and thus must not be additionally added. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer Reviewed-by: Christoph Hellwig Acked-by: Jon Derrick --- block/sed-opal.c | 228

[PATCH 03/16] block: sed-opal: use correct macro for method length

2019-02-13 Thread David Kozub
From: Jonas Rabenstein Also the values of OPAL_UID_LENGTH and OPAL_METHOD_LENGTH are the same, it is weird to use OPAL_UID_LENGTH for the definition of the methods. Signed-off-by: Jonas Rabenstein Signed-off-by: David Kozub Reviewed-by: Scott Bauer Reviewed-by: Christoph Hellwig Reviewed-by

[PATCH 04/16] block: sed-opal: unify space check in add_token_*

2019-02-13 Thread David Kozub
From: Jonas Rabenstein All add_token_* functions have a common set of conditions that have to be checked. Use a common function for those checks in order to avoid different behaviour as well as code duplication. Co-authored-by: David Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David

Re: [PATCH v4 10/16] block: sed-opal: add ioctl for done-mark of shadow mbr

2019-02-10 Thread David Kozub
On Sun, 10 Feb 2019, Scott Bauer wrote: On Fri, Feb 08, 2019 at 12:44:14AM +, Derrick, Jonathan wrote: On Thu, 2019-02-07 at 23:56 +0100, David Kozub wrote: On Mon, 4 Feb 2019, Christoph Hellwig wrote: static int opal_enable_disable_shadow_mbr(struct opal_dev *dev

Re: [PATCH v4 13/16] block: sed-opal: check size of shadow mbr

2019-02-10 Thread David Kozub
On Fri, 8 Feb 2019, Derrick, Jonathan wrote: On Fri, 2019-02-01 at 21:50 +0100, David Kozub wrote: From: Jonas Rabenstein Check whether the shadow mbr does fit in the provided space on the target. Also a proper firmware should handle this case and return an error we may prevent problems or

Re: [PATCH v4 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-02-10 Thread David Kozub
On Fri, 8 Feb 2019, Derrick, Jonathan wrote: On Mon, 2019-02-04 at 23:44 +0100, David Kozub wrote: On Mon, 4 Feb 2019, Christoph Hellwig wrote: + /* first do a discovery0 */ + error = opal_discovery0_step(dev); + for (state = 0; !error && state < n_s

Re: [PATCH v4 10/16] block: sed-opal: add ioctl for done-mark of shadow mbr

2019-02-07 Thread David Kozub
On Mon, 4 Feb 2019, Christoph Hellwig wrote: On Fri, Feb 01, 2019 at 09:50:17PM +0100, David Kozub wrote: From: Jonas Rabenstein Enable users to mark the shadow mbr as done without completely deactivating the shadow mbr feature. This may be useful on reboots, when the power to the disk is

Re: [PATCH v4 00/16] block: sed-opal: support shadow MBR done flag and write

2019-02-04 Thread David Kozub
On Mon, 4 Feb 2019, Christoph Hellwig wrote: On Fri, Feb 01, 2019 at 09:50:07PM +0100, David Kozub wrote: This patch series extends SED OPAL support: it adds IOCTL for setting the shadow MBR done flag which can be useful for unlocking an OPAL disk on boot and it adds IOCTL for writing to the

Re: [PATCH v4 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-02-04 Thread David Kozub
On Mon, 4 Feb 2019, Christoph Hellwig wrote: + /* first do a discovery0 */ + error = opal_discovery0_step(dev); + for (state = 0; !error && state < n_steps; state++) + error = execute_step(dev, &steps[state], state); + + /* +* For each OPAL command

Re: [PATCH v4 03/16] block: sed-opal: unify space check in add_token_*

2019-02-04 Thread David Kozub
On Mon, 4 Feb 2019, Christoph Hellwig wrote: On Fri, Feb 01, 2019 at 09:50:10PM +0100, David Kozub wrote: From: Jonas Rabenstein All add_token_* functions have a common set of conditions that have to be checked. Use a common function for those checks in order to avoid different behaviour as

Re: [PATCH v4 01/16] block: sed-opal: fix typos and formatting

2019-02-04 Thread David Kozub
On Mon, 4 Feb 2019, Christoph Hellwig wrote: On Fri, Feb 01, 2019 at 09:50:08PM +0100, David Kozub wrote: This should make no change in functionality. The formatting changes were triggered by checkpatch.pl. Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 19

[PATCH v4 16/16] block: sed-opal: rename next to execute_steps

2019-02-04 Thread David Kozub
As the function is responsible for executing the individual steps supplied in the steps argument, execute_steps is a more descriptive name than the rather generic next. Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 37 +++-- 1 file

Re: [PATCH v4 00/16] block: sed-opal: support shadow MBR done flag and write

2019-02-04 Thread David Kozub
On Fri, 1 Feb 2019, David Kozub wrote: This patch series extends SED OPAL support: it adds IOCTL for setting the shadow MBR done flag which can be useful for unlocking an OPAL disk on boot and it adds IOCTL for writing to the shadow MBR. Also included are some minor fixes and improvements

[PATCH v4 16/16] block: sed-opal: rename next to execute_steps

2019-02-04 Thread David Kozub
As the function is responsible for executing the individual steps supplied in the steps argument, execute_steps is a more descriptive name than the rather generic next. Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 37 +++-- 1 file

[PATCH v4 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-02-01 Thread David Kozub
Originally each of the opal functions that call next include opal_discovery0 in the array of steps. This is superfluous and can be done always inside next. Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 89 +++- 1 file

[PATCH v4 13/16] block: sed-opal: check size of shadow mbr

2019-02-01 Thread David Kozub
From: Jonas Rabenstein Check whether the shadow mbr does fit in the provided space on the target. Also a proper firmware should handle this case and return an error we may prevent problems or even damage with crappy firmwares. Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer --- block

[PATCH v4 08/16] block: sed-opal: print failed function address

2019-02-01 Thread David Kozub
From: Jonas Rabenstein Add function address (and if available its symbol) to the message if a step function fails. Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer --- block/sed-opal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/sed-opal.c b/block/sed

[PATCH v4 03/16] block: sed-opal: unify space check in add_token_*

2019-02-01 Thread David Kozub
From: Jonas Rabenstein All add_token_* functions have a common set of conditions that have to be checked. Use a common function for those checks in order to avoid different behaviour as well as code duplication. Co-authored-by: David Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David

[PATCH v4 09/16] block: sed-opal: split generation of bytestring header and content

2019-02-01 Thread David Kozub
From: Jonas Rabenstein Split the header generation from the (normal) memcpy part if a bytestring is copied into the command buffer. This allows in-place generation of the bytestring content. For example, copy_from_user may be used without an intermediate buffer. Signed-off-by: Jonas Rabenstein

[PATCH v4 14/16] block: sed-opal: pass steps via argument rather than via opal_dev

2019-02-01 Thread David Kozub
before return it would become a dangling pointer. When the steps are passed as argument this becomes easier to see and more difficult to misuse. Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 142 --- 1 file changed, 61

[PATCH v4 12/16] block: sed-opal: unify retrieval of table columns

2019-02-01 Thread David Kozub
From: Jonas Rabenstein Instead of having multiple places defining the same argument list to get a specific column of a sed-opal table, provide a generic version and call it from those functions. Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer --- block/opal_proto.h | 2 + block/sed

[PATCH v4 10/16] block: sed-opal: add ioctl for done-mark of shadow mbr

2019-02-01 Thread David Kozub
From: Jonas Rabenstein Enable users to mark the shadow mbr as done without completely deactivating the shadow mbr feature. This may be useful on reboots, when the power to the disk is not disconnected in between and the shadow mbr stores the required boot files. Of course, this saves also the (fe

[PATCH v4 11/16] block: sed-opal: ioctl for writing to shadow mbr

2019-02-01 Thread David Kozub
Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 89 ++- include/linux/sed-opal.h | 1 + include/uapi/linux/sed-opal.h | 8 3 files changed, 97 insertions(+), 1 deletion(-) diff

[PATCH v4 05/16] block: sed-opal: unify cmd start

2019-02-01 Thread David Kozub
cmd_start and cmd_finalize respectively and thus must not be additionally added. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer --- block/sed-opal.c | 228 ++- 1 file changed, 69

[PATCH v4 06/16] block: sed-opal: unify error handling of responses

2019-02-01 Thread David Kozub
response_get_{string,u64} include error handling for argument resp being NULL but response_get_token does not handle this. Make all three of response_get_{string,u64,token} handle NULL resp in the same way. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas

[PATCH v4 07/16] block: sed-opal: reuse response_get_token to decrease code duplication

2019-02-01 Thread David Kozub
response_get_token had already been in place, its functionality had been duplicated within response_get_{u64,bytestring} with the same error handling. Unify the handling by reusing response_get_token within the other functions. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed

[PATCH v4 04/16] block: sed-opal: close parameter list in cmd_finalize

2019-02-01 Thread David Kozub
Every step ends by calling cmd_finalize (via finalize_and_send) yet every step adds the token OPAL_ENDLIST on its own. Moving this into cmd_finalize decreases code duplication. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer

[PATCH v4 02/16] block: sed-opal: use correct macro for method length

2019-02-01 Thread David Kozub
From: Jonas Rabenstein Also the values of OPAL_UID_LENGTH and OPAL_METHOD_LENGTH are the same, it is weird to use OPAL_UID_LENGTH for the definition of the methods. Signed-off-by: Jonas Rabenstein Reviewed-by: Scott Bauer --- block/sed-opal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v4 01/16] block: sed-opal: fix typos and formatting

2019-02-01 Thread David Kozub
This should make no change in functionality. The formatting changes were triggered by checkpatch.pl. Signed-off-by: David Kozub Reviewed-by: Scott Bauer --- block/sed-opal.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/block/sed-opal.c b/block/sed

[PATCH v4 00/16] block: sed-opal: support shadow MBR done flag and write

2019-02-01 Thread David Kozub
21149@hacktheplanet/ David Kozub (8): block: sed-opal: fix typos and formatting block: sed-opal: close parameter list in cmd_finalize block: sed-opal: unify cmd start block: sed-opal: unify error handling of responses block: sed-opal: reuse response_get_token to decrease code duplication

Re: [PATCH v3 00/16] block: sed-opal: support shadow MBR done flag and write

2019-01-28 Thread David Kozub
On Sun, 27 Jan 2019, Scott Bauer wrote: On Tue, Jan 22, 2019 at 11:31:31PM +0100, David Kozub wrote: David Kozub (8): block: sed-opal: fix typos and formatting block: sed-opal: close parameter list in cmd_finalize block: sed-opal: unify cmd start block: sed-opal: unify error handling

[PATCH 16/16] block: sed-opal: rename next to execute_steps

2019-01-24 Thread David Kozub
As the function is responsible for executing the individual steps supplied in the steps argument, execute_steps is a more descriptive name than the rather generic next. Signed-off-by: David Kozub --- block/sed-opal.c | 37 +++-- 1 file changed, 19 insertions

[PATCH v3 16/16] block: sed-opal: rename next to execute_steps

2019-01-24 Thread David Kozub
As the function is responsible for executing the individual steps supplied in the steps argument, execute_steps is a more descriptive name than the rather generic next. Signed-off-by: David Kozub --- block/sed-opal.c | 37 +++-- 1 file changed, 19 insertions

[PATCH v3 06/16] block: sed-opal: unify error handling of responses

2019-01-22 Thread David Kozub
response_get_{string,u64} include error handling for argument resp being NULL but response_get_token does not handle this. Make all three of response_get_{string,u64,token} handle NULL resp in the same way. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas

[PATCH v3 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-01-22 Thread David Kozub
Originally each of the opal functions that call next include opal_discovery0 in the array of steps. This is superfluous and can be done always inside next. Signed-off-by: David Kozub --- block/sed-opal.c | 89 +++- 1 file changed, 43 insertions(+), 46

[PATCH v3 01/16] block: sed-opal: fix typos and formatting

2019-01-22 Thread David Kozub
This should make no change in functionality. The formatting changes were triggered by checkpatch.pl. Signed-off-by: David Kozub --- block/sed-opal.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index e0de4dd448b3

[PATCH v3 09/16] block: sed-opal: split generation of bytestring header and content

2019-01-22 Thread David Kozub
From: Jonas Rabenstein Split the header generation from the (normal) memcpy part if a bytestring is copied into the command buffer. This allows in-place generation of the bytestring content. For example, copy_from_user may be used without an intermediate buffer. Signed-off-by: Jonas Rabenstein

[PATCH v3 14/16] block: sed-opal: pass steps via argument rather than via opal_dev

2019-01-22 Thread David Kozub
before return it would become a dangling pointer. When the steps are passed as argument this becomes easier to see and more difficult to misuse. Signed-off-by: David Kozub --- block/sed-opal.c | 142 --- 1 file changed, 61 insertions(+), 81 deletions

[PATCH v3 08/16] block: sed-opal: print failed function address

2019-01-22 Thread David Kozub
From: Jonas Rabenstein Add function address (and if available its symbol) to the message if a step function fails. Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index 1332547e5a99

[PATCH v3 10/16] block: sed-opal: add ioctl for done-mark of shadow mbr

2019-01-22 Thread David Kozub
From: Jonas Rabenstein Enable users to mark the shadow mbr as done without completely deactivating the shadow mbr feature. This may be useful on reboots, when the power to the disk is not disconnected in between and the shadow mbr stores the required boot files. Of course, this saves also the (fe

[PATCH v3 04/16] block: sed-opal: close parameter list in cmd_finalize

2019-01-22 Thread David Kozub
Every step ends by calling cmd_finalize (via finalize_and_send) yet every step adds the token OPAL_ENDLIST on its own. Moving this into cmd_finalize decreases code duplication. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein --- block/sed-opal.c

[PATCH v3 07/16] block: sed-opal: reuse response_get_token to decrease code duplication

2019-01-22 Thread David Kozub
response_get_token had already been in place, its functionality had been duplicated within response_get_{u64,bytestring} with the same error handling. Unify the handling by reusing response_get_token within the other functions. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed

[PATCH v3 12/16] block: sed-opal: unify retrieval of table columns

2019-01-22 Thread David Kozub
From: Jonas Rabenstein Instead of having multiple places defining the same argument list to get a specific column of a sed-opal table, provide a generic version and call it from those functions. Signed-off-by: Jonas Rabenstein --- block/opal_proto.h | 2 + block/sed-opal.c | 132 ++

[PATCH v3 05/16] block: sed-opal: unify cmd start

2019-01-22 Thread David Kozub
cmd_start and cmd_finalize respectively and thus must not be additionally added. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 228 ++- 1 file changed, 69 insertions(+), 159 deletions

[PATCH v3 11/16] block: sed-opal: ioctl for writing to shadow mbr

2019-01-22 Thread David Kozub
Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David Kozub --- block/sed-opal.c | 89 ++- include/linux/sed-opal.h | 1 + include/uapi/linux/sed-opal.h | 8 3 files changed, 97 insertions(+), 1 deletion(-) diff --git a/block/sed-opal.c

[PATCH v3 13/16] block: sed-opal: check size of shadow mbr

2019-01-22 Thread David Kozub
From: Jonas Rabenstein Check whether the shadow mbr does fit in the provided space on the target. Also a proper firmware should handle this case and return an error we may prevent problems or even damage with crappy firmwares. Signed-off-by: Jonas Rabenstein --- block/opal_proto.h | 16 +++

[PATCH v3 03/16] block: sed-opal: unify space check in add_token_*

2019-01-22 Thread David Kozub
From: Jonas Rabenstein All add_token_* functions have a common set of conditions that have to be checked. Use a common function for those checks in order to avoid different behaviour as well as code duplication. Co-authored-by: David Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David

[PATCH v3 02/16] block: sed-opal: use correct macro for method length

2019-01-22 Thread David Kozub
From: Jonas Rabenstein Also the values of OPAL_UID_LENGTH and OPAL_METHOD_LENGTH are the same, it is weird to use OPAL_UID_LENGTH for the definition of the methods. Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/se

[PATCH v3 00/16] block: sed-opal: support shadow MBR done flag and write

2019-01-22 Thread David Kozub
tried to do a more thorough testing, esp. with things like wrong passwords/invalid values. I did not observe any crash or unexpected behavior. David Kozub (8): block: sed-opal: fix typos and formatting block: sed-opal: close parameter list in cmd_finalize block: sed-opal: unify cmd start

Re: [PATCH v2 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-01-21 Thread David Kozub
On Sat, 19 Jan 2019, Scott Bauer wrote: On Thu, Jan 17, 2019 at 09:31:55PM +, David Kozub wrote: - for (state = 0; !error && state < n_steps; state++) { - step = &steps[state]; - - error = step->fn(dev, step->data); -

Re: [PATCH v2 11/16] block: sed-opal: ioctl for writing to shadow mbr

2019-01-20 Thread David Kozub
On Sat, 19 Jan 2019, Scott Bauer wrote: On Thu, Jan 17, 2019 at 09:31:51PM +, David Kozub wrote: +static int write_shadow_mbr(struct opal_dev *dev, void *data) +{ + struct opal_shadow_mbr *shadow = data; + const u8 __user *src; + u8 *dst; + size_t off = 0

[PATCH v2 09/16] block: sed-opal: split generation of bytestring header and content

2019-01-17 Thread David Kozub
From: Jonas Rabenstein Split the header generation from the (normal) memcpy part if a bytestring is copied into the command buffer. This allows in-place generation of the bytestring content. For example, copy_from_user may be used without an intermediate buffer. Signed-off-by: Jonas Rabenstein

[PATCH v2 06/16] block: sed-opal: unify error handling of responses

2019-01-17 Thread David Kozub
response_get_{string,u64} include error handling for argument resp being NULL but response_get_token does not handle this. Make all three of response_get_{string,u64,token} handle NULL resp in the same way. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas

[PATCH v2 10/16] block: sed-opal: add ioctl for done-mark of shadow mbr

2019-01-17 Thread David Kozub
From: Jonas Rabenstein Enable users to mark the shadow mbr as done without completely deactivating the shadow mbr feature. This may be useful on reboots, when the power to the disk is not disconnected in between and the shadow mbr stores the required boot files. Of course, this saves also the (fe

[PATCH v2 13/16] block: sed-opal: check size of shadow mbr

2019-01-17 Thread David Kozub
From: Jonas Rabenstein Check whether the shadow mbr does fit in the provided space on the target. Also a proper firmware should handle this case and return an error we may prevent problems or even damage with crappy firmwares. Signed-off-by: Jonas Rabenstein --- block/opal_proto.h | 16 +++

[PATCH v2 12/16] block: sed-opal: unify retrieval of table columns

2019-01-17 Thread David Kozub
From: Jonas Rabenstein Instead of having multiple places defining the same argument list to get a specific column of a sed-opal table, provide a generic version and call it from those functions. Signed-off-by: Jonas Rabenstein --- block/opal_proto.h | 2 + block/sed-opal.c | 132 ++

[PATCH v2 16/16] block: sed-opal: rename next to execute_steps

2019-01-17 Thread David Kozub
As the function is responsible for executing the individual steps supplied in the steps argument, execute_steps is a more descriptive name than the rather generic next. Signed-off-by: David Kozub --- block/sed-opal.c | 37 +++-- 1 file changed, 19 insertions

[PATCH v2 14/16] block: sed-opal: pass steps via argument rather than via opal_dev

2019-01-17 Thread David Kozub
before return it would become a dangling pointer. When the steps are passed as argument this becomes easier to see and more difficult to misuse. Signed-off-by: David Kozub --- block/sed-opal.c | 142 --- 1 file changed, 61 insertions(+), 81 deletions

[PATCH v2 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-01-17 Thread David Kozub
Originally each of the opal functions that call next include opal_discovery0 in the array of steps. This is superfluous and can be done always inside next. Signed-off-by: David Kozub --- block/sed-opal.c | 88 +++- 1 file changed, 42 insertions(+), 46

[PATCH v2 11/16] block: sed-opal: ioctl for writing to shadow mbr

2019-01-17 Thread David Kozub
Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David Kozub --- block/sed-opal.c | 88 ++- include/linux/sed-opal.h | 1 + include/uapi/linux/sed-opal.h | 8 3 files changed, 96 insertions(+), 1 deletion(-) diff --git a/block/sed-opal.c

[PATCH v2 08/16] block: sed-opal: print failed function address

2019-01-17 Thread David Kozub
From: Jonas Rabenstein Add function address (and if available its symbol) to the message if a step function fails. Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index 1332547e5a99

[PATCH v2 07/16] block: sed-opal: reuse response_get_token to decrease code duplication

2019-01-17 Thread David Kozub
response_get_token had already been in place, its functionality had been duplicated within response_get_{u64,bytestring} with the same error handling. Unify the handling by reusing response_get_token within the other functions. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed

[PATCH v2 05/16] block: sed-opal: unify cmd start

2019-01-17 Thread David Kozub
cmd_start and cmd_finalize respectively and thus must not be additionally added. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 228 ++- 1 file changed, 69 insertions(+), 159 deletions

[PATCH v2 03/16] block: sed-opal: unify space check in add_token_*

2019-01-17 Thread David Kozub
From: Jonas Rabenstein All add_token_* functions have a common set of conditions that have to be checked. Use a common function for those checks in order to avoid different behaviour as well as code duplication. Co-authored-by: David Kozub Signed-off-by: Jonas Rabenstein Signed-off-by: David

[PATCH v2 02/16] block: sed-opal: use correct macro for method length

2019-01-17 Thread David Kozub
From: Jonas Rabenstein Also the values of OPAL_UID_LENGTH and OPAL_METHOD_LENGTH are the same, it is weird to use OPAL_UID_LENGTH for the definition of the methods. Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/se

[PATCH v2 01/16] block: sed-opal: fix typos and formatting

2019-01-17 Thread David Kozub
This should make no change in functionality. The formatting changes were triggered by checkpatch.pl. Signed-off-by: David Kozub --- block/sed-opal.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index e0de4dd448b3

[PATCH v2 04/16] block: sed-opal: close parameter list in cmd_finalize

2019-01-17 Thread David Kozub
Every step ends by calling cmd_finalize (via finalize_and_send) yet every step adds the token OPAL_ENDLIST on its own. Moving this into cmd_finalize decreases code duplication. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein --- block/sed-opal.c

[PATCH v2 00/16] block: sed-opal: support shadow MBR done flag and write

2019-01-17 Thread David Kozub
logize for the noise. [1] https://lore.kernel.org/lkml/cover.1521482295.git.jonas.rabenst...@studium.uni-erlangen.de/ [2] https://lore.kernel.org/lkml/20180405203443.ye4gnw5aey2exlkn@sbauer-Z170X-UD5/ [3] https://github.com/ghostav/sed-opal-temp David Kozub (8): block: sed-opal: fix typos and

Re: [PATCH 00/16] block: sed-opal: support shadow MBR done flag and write

2019-01-17 Thread David Kozub
On Thu, 17 Jan 2019, Christoph Hellwig wrote: the way the series appear looks odd, because it wasn't threaded or even ordered, and the patches from Jonas seem to have been sent out by you under his name. Can you resend them carefully threaded, all mails from you with the additional from header

[PATCH 04/16] block: sed-opal: close parameter list in cmd_finalize

2019-01-16 Thread David Kozub
Every step ends by calling cmd_finalize (via finalize_and_send) yet every step adds the token OPAL_ENDLIST on its own. Moving this into cmd_finalize decreases code duplication. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein --- block/sed-opal.c

[PATCH 06/16] block: sed-opal: unify error handling of responses

2019-01-16 Thread David Kozub
response_get_{string,u64} include error handling for argument resp being NULL but response_get_token does not handle this. Make all three of response_get_{string,u64,token} handle NULL resp in the same way. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas

[PATCH 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array

2019-01-16 Thread David Kozub
Originally each of the opal functions that call next include opal_discovery0 in the array of steps. This is superfluous and can be done always inside next. Signed-off-by: David Kozub --- block/sed-opal.c | 88 +++- 1 file changed, 42 insertions(+), 46

[PATCH 01/16] block: sed-opal: fix typos and formatting

2019-01-16 Thread David Kozub
This should make no change in functionality. The formatting changes were triggered by checkpatch.pl. Signed-off-by: David Kozub --- block/sed-opal.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index e0de4dd448b3

[PATCH 05/16] block: sed-opal: unify cmd start

2019-01-16 Thread David Kozub
cmd_start and cmd_finalize respectively and thus must not be additionally added. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed-off-by: Jonas Rabenstein --- block/sed-opal.c | 228 ++- 1 file changed, 69 insertions(+), 159 deletions

[PATCH 00/16] block: sed-opal: support shadow MBR done flag and write

2019-01-16 Thread David Kozub
m.uni-erlangen.de/ [2] https://lore.kernel.org/lkml/20180405203443.ye4gnw5aey2exlkn@sbauer-Z170X-UD5/ [3] https://github.com/ghostav/sed-opal-temp David Kozub (8): block: sed-opal: fix typos and formatting block: sed-opal: close parameter list in cmd_finalize block: sed-opal: unify cmd start

[PATCH 07/16] block: sed-opal: reuse response_get_token to decrease code duplication

2019-01-16 Thread David Kozub
response_get_token had already been in place, its functionality had been duplicated within response_get_{u64,bytestring} with the same error handling. Unify the handling by reusing response_get_token within the other functions. Co-authored-by: Jonas Rabenstein Signed-off-by: David Kozub Signed

[PATCH 14/16] block: sed-opal: pass steps via argument rather than via opal_dev

2019-01-16 Thread David Kozub
before return it would become a dangling pointer. When the steps are passed as argument this becomes easier to see and more difficult to misuse. Signed-off-by: David Kozub --- block/sed-opal.c | 142 --- 1 file changed, 61 insertions(+), 81 deletions

Re: [PATCH] clockevents/drivers/cs5535: improve resilience to spurious interrupts

2017-10-20 Thread David Kozub
On Fri, 20 Oct 2017, Daniel Lezcano wrote: On 20/10/2017 09:49, David Kozub wrote: On Fri, 20 Oct 2017, Daniel Lezcano wrote: On 20/10/2017 00:25, Thomas Gleixner wrote: On Fri, 20 Oct 2017, Daniel Lezcano wrote: On 19/10/2017 22:57, David Kozub wrote: This solves a BUG on ALIX 2c3 where

[tip:timers/urgent] clockevents/drivers/cs5535: Improve resilience to spurious interrupts

2017-10-20 Thread tip-bot for David Kozub
Commit-ID: eb39a7c0355393c5a8d930f342ad7a6231b552c4 Gitweb: https://git.kernel.org/tip/eb39a7c0355393c5a8d930f342ad7a6231b552c4 Author: David Kozub AuthorDate: Thu, 19 Oct 2017 22:57:02 +0200 Committer: Thomas Gleixner CommitDate: Fri, 20 Oct 2017 13:41:52 +0200 clockevents/drivers

[PATCH v2] clockevents/drivers/cs5535: improve resilience to spurious interrupts

2017-10-20 Thread David Kozub
detached state. If the interrupt hits while the device is in detached state it passes the safe guard and dereferences the event handler call back which is NULL. Add the missing state check. Suggested-by: Thomas Gleixner Signed-off-by: David Kozub --- Changes in v2: - Use commit message suggested by

Re: [PATCH] clockevents/drivers/cs5535: improve resilience to spurious interrupts

2017-10-20 Thread David Kozub
On Fri, 20 Oct 2017, Daniel Lezcano wrote: On 20/10/2017 00:25, Thomas Gleixner wrote: On Fri, 20 Oct 2017, Daniel Lezcano wrote: On 19/10/2017 22:57, David Kozub wrote: This solves a BUG on ALIX 2c3 where mfgpt_tick is called before clockevents_config_and_register returns. This caused

Re: [PATCH] clockevents/drivers/cs5535: improve resilience to spurious interrupts

2017-10-20 Thread David Kozub
On Fri, 20 Oct 2017, Thomas Gleixner wrote: On Thu, 19 Oct 2017, David Kozub wrote: This solves a BUG on ALIX 2c3 where mfgpt_tick is called before clockevents_config_and_register returns. This caused mfgpt_tick to call a null function pointer. Thanks to Daniel Lezcano and Thomas Gleixner

[PATCH] clockevents/drivers/cs5535: improve resilience to spurious interrupts

2017-10-19 Thread David Kozub
Signed-off-by: David Kozub --- drivers/clocksource/cs5535-clockevt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c index a1df588343f2..56100506b933 100644 --- a/drivers/clocksource/cs5535-clockevt.c

Re: PROBLEM: Kernel BUG in mfgpt_tick (cs5535-clockevt.c) on ALIX 2c3 - null call

2017-10-16 Thread David Kozub
On Mon, 16 Oct 2017, Thomas Gleixner wrote: On Thu, 12 Oct 2017, David Kozub wrote: On Thu, 12 Oct 2017, Thomas Gleixner wrote: On Thu, 12 Oct 2017, Daniel Lezcano wrote: The real question is why /* Set the clock scale and enable the event mode for CMP2 */ val = MFGPT_SCALE

Re: PROBLEM: Kernel BUG in mfgpt_tick (cs5535-clockevt.c) on ALIX 2c3 - null call

2017-10-12 Thread David Kozub
On Thu, 12 Oct 2017, Thomas Gleixner wrote: On Thu, 12 Oct 2017, Daniel Lezcano wrote: On 11/10/2017 22:48, David Kozub wrote: [ ... ] +   disable_timer(timer); +   cs5535_mfgpt_write(timer, MFGPT_REG_COUNTER, 0); +    /* Set up the IRQ on the MFGPT side */    if

Re: PROBLEM: Kernel BUG in mfgpt_tick (cs5535-clockevt.c) on ALIX 2c3 - null call

2017-10-11 Thread David Kozub
On Wed, 11 Oct 2017, Daniel Lezcano wrote: On 10/10/2017 23:19, David Kozub wrote: On Tue, 10 Oct 2017, Daniel Lezcano wrote: On 09/10/2017 21:33, David Kozub wrote: On Mon, 9 Oct 2017, Daniel Lezcano wrote: On 07/10/2017 23:26, David Kozub wrote: Hi all, booting up kernel 4.14-rc3 with

  1   2   >