On Thu, Aug 04, 2022 at 07:26:23PM +0200, Stefan Sperling wrote:
> This adds support for booting from RAID 1C volumes on amd64.
> Only boot-loader changes are needed. Both installboot(8) and
> the kernel already do what is required to make this work.
>
> I have tested with biosboot in vmm. The changes involved are trivial,
> and I am modifying copies of the same code across all bootloaders.
> So I would assume that all boot methods work with this patch.
> Additional testing to verify this would be welcome, of course.
>
> In my testing, a fresh install onto a RAID 1C volume succeeds and
> the resulting system can be booted as usual. I have tried this on
> a volume locked with a keydisk, and a volume locked with a passphrase.
>
> I have also tested booting with one of two disks missing and as
> expected the system came up with a degraded volume:
>
> softraid0: not all chunks were provided; attempting to bring volume 0 online
> softraid0: trying to bring up sd3 degraded
> sd2 at scsibus4 targ 1 lun 0: <OPENBSD, SR RAID 1C, 006>
> sd2: 8191MB, 512 bytes/sector, 16776624 sectors
> softraid0: volume sd2 is roaming, it used to be sd3, updating metadata
> softraid0: roaming device sd1a -> sd0a
> root on sd2a (3ee0bf348da5ea75.a) swap on sd2b dump on sd2b
>
> The volume could successfully be rebuilt with bioctl -R, once the
> missing disk was added back in.
>
> ok?
Here's the adapted diff for arm64 minus manual bits to avoid churn for
now.
installboot(8) needs softraid(4) support (see my diff on tech@), but
besides that, root on passphrase 1C softraid on arm64 works as expected:
# df /
Filesystem 512-blocks Used Avail Capacity Mounted on
/dev/sd4a 2331356 161952 2052840 7% /
# bioctl sd4
Volume Status Size Device
softraid0 0 Online 10741585920 sd4 RAID1C
0 Online 10741585920 0:0.0 noencl <sd1a>
1 Online 10741585920 0:1.0 noencl <sd3a>
Index: conf.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/conf.c,v
retrieving revision 1.39
diff -u -p -r1.39 conf.c
--- conf.c 30 Jul 2022 21:06:54 -0000 1.39
+++ conf.c 11 Aug 2022 14:42:01 -0000
@@ -46,7 +46,7 @@
#include "efipxe.h"
#include "softraid_arm64.h"
-const char version[] = "1.11";
+const char version[] = "1.12";
int debug = 0;
struct fs_ops file_system[] = {
Index: softraid_arm64.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/softraid_arm64.c,v
retrieving revision 1.3
diff -u -p -r1.3 softraid_arm64.c
--- softraid_arm64.c 2 Jun 2021 22:44:27 -0000 1.3
+++ softraid_arm64.c 11 Aug 2022 14:43:52 -0000
@@ -285,6 +285,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)
@@ -341,7 +342,7 @@ sr_strategy(struct sr_boot_volume *bv, i
/* XXX - If I/O failed we should try another chunk... */
return dip->strategy(dip, rw, blk, size, buf, rsize);
- } else if (bv->sbv_level == 'C') {
+ } else if (bv->sbv_level == 'C' || bv->sbv_level == 0x1C) {
/* Select first online chunk. */
SLIST_FOREACH(bc, &bv->sbv_chunks, sbc_link)
@@ -604,7 +605,8 @@ sropen(struct open_file *f, ...)
return EADAPT;
}
- 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;