Re: sparc64: ofwboot: support booting from softraid 1C

2022-09-02 Thread Stefan Sperling
On Thu, Sep 01, 2022 at 08:31:04PM +, Klemens Nanni wrote:
> This is practically the same diff we already landed for arm64.
> 
> The kernel already supports booting off 1C and with tech@'s
> "installboot: sparc64: fix -r on multi-chunk softraid chunk" diff the
> install process will no longer fail when installing bootstraps onto any
> softraid volume which requires at least two chunks by design.
> 
> Feedback? OK?

ok by me, diff looks fine.

> Index: boot.c
> ===
> RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/boot.c,v
> retrieving revision 1.39
> diff -u -p -r1.39 boot.c
> --- boot.c4 Aug 2022 09:16:53 -   1.39
> +++ boot.c1 Sep 2022 20:10:55 -
> @@ -366,7 +366,8 @@ srbootdev(const char *bootline)
>   return ENODEV;
>   }
>  
> - if (bv->sbv_level == 'C' && bv->sbv_keys == NULL)
> + if ((bv->sbv_level == 'C' || bv->sbv_level == 0x1C) &&
> + bv->sbv_keys == NULL)
>   if (sr_crypto_unlock_volume(bv) != 0)
>   return EPERM;
>  
> Index: softraid_sparc64.c
> ===
> RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 softraid_sparc64.c
> --- softraid_sparc64.c9 Dec 2020 18:10:19 -   1.5
> +++ softraid_sparc64.c1 Sep 2022 20:08:03 -
> @@ -290,6 +290,7 @@ srprobe(void)
>   break;
>  
>   case 1:
> + case 0x1C:
>   if (bv->sbv_chunk_no == bv->sbv_chunks_found)
>   bv->sbv_state = BIOC_SVONLINE;
>   else if (bv->sbv_chunks_found > 0)
> @@ -312,7 +313,8 @@ sr_vol_boot_chunk(struct sr_boot_volume 
>  {
>   struct sr_boot_chunk *bc = NULL;
>  
> - if (bv->sbv_level == 1 || bv->sbv_level == 'C' ) { /* RAID1 or CRYPTO */
> + if (bv->sbv_level == 1 || bv->sbv_level == 'C' ||
> + bv->sbv_level == 0x1C) {
>   /* Select first online chunk. */
>   SLIST_FOREACH(bc, >sbv_chunks, sbc_link)
>   if (bc->sbc_state == BIOC_SDONLINE)
> @@ -368,7 +370,7 @@ sr_strategy(struct sr_boot_volume *bv, i
>   err = strategy(, rw, blk, size, buf, rsize);
>   return err;
>  
> - } else if (bv->sbv_level == 'C') {
> + } else if (bv->sbv_level == 'C' || bv->sbv_level == 0x1C) {
>   /* XXX - select correct key. */
>   aes_xts_setkey(, (u_char *)bv->sbv_keys, 64);
>  
> Index: vers.c
> ===
> RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/vers.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 vers.c
> --- vers.c4 Aug 2022 09:16:53 -   1.24
> +++ vers.c20 Aug 2022 03:59:47 -
> @@ -1 +1 @@
> -const char version[] = "1.23";
> +const char version[] = "1.24";
> 



Re: sparc64: ofwboot: support booting from softraid 1C

2022-09-02 Thread Mark Kettenis
> Date: Thu,  1 Sep 2022 20:31:04 +
> From: Klemens Nanni 
> 
> This is practically the same diff we already landed for arm64.
> 
> The kernel already supports booting off 1C and with tech@'s
> "installboot: sparc64: fix -r on multi-chunk softraid chunk" diff the
> install process will no longer fail when installing bootstraps onto any
> softraid volume which requires at least two chunks by design.
> 
> Feedback? OK?

Looks reasonable in the sense that I convinced myself this can't break
booting non-softraid setups.

> Index: boot.c
> ===
> RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/boot.c,v
> retrieving revision 1.39
> diff -u -p -r1.39 boot.c
> --- boot.c4 Aug 2022 09:16:53 -   1.39
> +++ boot.c1 Sep 2022 20:10:55 -
> @@ -366,7 +366,8 @@ srbootdev(const char *bootline)
>   return ENODEV;
>   }
>  
> - if (bv->sbv_level == 'C' && bv->sbv_keys == NULL)
> + if ((bv->sbv_level == 'C' || bv->sbv_level == 0x1C) &&
> + bv->sbv_keys == NULL)
>   if (sr_crypto_unlock_volume(bv) != 0)
>   return EPERM;
>  
> Index: softraid_sparc64.c
> ===
> RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 softraid_sparc64.c
> --- softraid_sparc64.c9 Dec 2020 18:10:19 -   1.5
> +++ softraid_sparc64.c1 Sep 2022 20:08:03 -
> @@ -290,6 +290,7 @@ srprobe(void)
>   break;
>  
>   case 1:
> + case 0x1C:
>   if (bv->sbv_chunk_no == bv->sbv_chunks_found)
>   bv->sbv_state = BIOC_SVONLINE;
>   else if (bv->sbv_chunks_found > 0)
> @@ -312,7 +313,8 @@ sr_vol_boot_chunk(struct sr_boot_volume 
>  {
>   struct sr_boot_chunk *bc = NULL;
>  
> - if (bv->sbv_level == 1 || bv->sbv_level == 'C' ) { /* RAID1 or CRYPTO */
> + if (bv->sbv_level == 1 || bv->sbv_level == 'C' ||
> + bv->sbv_level == 0x1C) {
>   /* Select first online chunk. */
>   SLIST_FOREACH(bc, >sbv_chunks, sbc_link)
>   if (bc->sbc_state == BIOC_SDONLINE)
> @@ -368,7 +370,7 @@ sr_strategy(struct sr_boot_volume *bv, i
>   err = strategy(, rw, blk, size, buf, rsize);
>   return err;
>  
> - } else if (bv->sbv_level == 'C') {
> + } else if (bv->sbv_level == 'C' || bv->sbv_level == 0x1C) {
>   /* XXX - select correct key. */
>   aes_xts_setkey(, (u_char *)bv->sbv_keys, 64);
>  
> Index: vers.c
> ===
> RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/vers.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 vers.c
> --- vers.c4 Aug 2022 09:16:53 -   1.24
> +++ vers.c20 Aug 2022 03:59:47 -
> @@ -1 +1 @@
> -const char version[] = "1.23";
> +const char version[] = "1.24";
> 
> 



sparc64: ofwboot: support booting from softraid 1C

2022-09-01 Thread Klemens Nanni
This is practically the same diff we already landed for arm64.

The kernel already supports booting off 1C and with tech@'s
"installboot: sparc64: fix -r on multi-chunk softraid chunk" diff the
install process will no longer fail when installing bootstraps onto any
softraid volume which requires at least two chunks by design.

Feedback? OK?


Index: boot.c
===
RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/boot.c,v
retrieving revision 1.39
diff -u -p -r1.39 boot.c
--- boot.c  4 Aug 2022 09:16:53 -   1.39
+++ boot.c  1 Sep 2022 20:10:55 -
@@ -366,7 +366,8 @@ srbootdev(const char *bootline)
return ENODEV;
}
 
-   if (bv->sbv_level == 'C' && bv->sbv_keys == NULL)
+   if ((bv->sbv_level == 'C' || bv->sbv_level == 0x1C) &&
+   bv->sbv_keys == NULL)
if (sr_crypto_unlock_volume(bv) != 0)
return EPERM;
 
Index: softraid_sparc64.c
===
RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c,v
retrieving revision 1.5
diff -u -p -r1.5 softraid_sparc64.c
--- softraid_sparc64.c  9 Dec 2020 18:10:19 -   1.5
+++ softraid_sparc64.c  1 Sep 2022 20:08:03 -
@@ -290,6 +290,7 @@ srprobe(void)
break;
 
case 1:
+   case 0x1C:
if (bv->sbv_chunk_no == bv->sbv_chunks_found)
bv->sbv_state = BIOC_SVONLINE;
else if (bv->sbv_chunks_found > 0)
@@ -312,7 +313,8 @@ sr_vol_boot_chunk(struct sr_boot_volume 
 {
struct sr_boot_chunk *bc = NULL;
 
-   if (bv->sbv_level == 1 || bv->sbv_level == 'C' ) { /* RAID1 or CRYPTO */
+   if (bv->sbv_level == 1 || bv->sbv_level == 'C' ||
+   bv->sbv_level == 0x1C) {
/* Select first online chunk. */
SLIST_FOREACH(bc, >sbv_chunks, sbc_link)
if (bc->sbc_state == BIOC_SDONLINE)
@@ -368,7 +370,7 @@ sr_strategy(struct sr_boot_volume *bv, i
err = strategy(, rw, blk, size, buf, rsize);
return err;
 
-   } else if (bv->sbv_level == 'C') {
+   } else if (bv->sbv_level == 'C' || bv->sbv_level == 0x1C) {
/* XXX - select correct key. */
aes_xts_setkey(, (u_char *)bv->sbv_keys, 64);
 
Index: vers.c
===
RCS file: /cvs/src/sys/arch/sparc64/stand/ofwboot/vers.c,v
retrieving revision 1.24
diff -u -p -r1.24 vers.c
--- vers.c  4 Aug 2022 09:16:53 -   1.24
+++ vers.c  20 Aug 2022 03:59:47 -
@@ -1 +1 @@
-const char version[] = "1.23";
+const char version[] = "1.24";