From nobody Fri Jan 13 21:24:50 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NtvZV61gJz2qkkq; Fri, 13 Jan 2023 21:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NtvZV4vhYz40m6; Fri, 13 Jan 2023 21:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/kcwFsr5WPRB4sqIWMjUMnMSQVsCih9vBOLY32fqKqE=; b=phnIzZHXmkBMNT49b9f+luC8NTiUAJZJldbYS/7wb/RLoIpN7BHzIjyBHhchR2R/BX4pkY XASLLnhpfnn4b7EiEMU4vUScuVHho8Nh8HCnK013npOBishRZdlYLLIhjZgNuw907tZmQM hrImk4AgiPPaxdGPAj+e3sV/H36/SDncwohkNRsT5psDnzy0DxQxHomUu723FhbIGayZnD TJoSs6vhTso9MaYR2RMA39Veh481b2f5oKwoO1zsoWEe60/DPuExJaytZKYZwbzwR1Nh1A I/cOzcUHVPYeNbGRHdPQHVkYhYCugaJLLTAoO/x3PI3oRFBuWPoY0hC3iEUkOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/kcwFsr5WPRB4sqIWMjUMnMSQVsCih9vBOLY32fqKqE=; b=kxTKovvqJhNd7/tSaF/AayNWUI7re6/eHJYgqG2RVIA0y0XX1v6kUpYDaIDksuOpdQ6GI8 M1REpZfs9ULStqZVOzhdrmyHBo6ePNSIyHGQhf84AWYmPbAEeQn+p2I0M0sE1GTZIQBvaI zWXzXjQXRrQqBVV9n75ctle3Yi04EMUNyEPcez2oDPcwNpMYLClEltgfxDdln6Oq6S13mA 12WfJzbZYBmkCcBe2f7ZDaDJYhu+6gGgWUjfiI3/m6Cm8+a955BlwMWh5v/fO8lfKisZ0s M0onUvpJLdJ9MjBpG52p6S/o6nEOIEy/GRtoqlNJWkCcswTZpRpzu+NZahCUVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673645090; a=rsa-sha256; cv=none; b=ymNQmxZSDAooPC/wbpr7klrOfPBJ0dYVoDBUDAuDfV/+jgnUlmOwEzIhNtFapmzkkiywKk sACUDF4X5RbYjo+tTJQL0842RRs9HxtLSV/udatuaqOllQB/Og1yOajmtKnRMyDRK3kpx5 HvjipX4hHZbbNsosTJccWwr6dmDKsa+J1d3LKkfkC7Hg02CYzceJzLcHTBSbqlReH8Nmvm C2J9KPMVwC+nCNFDVhthVsfGc+v/8/cyJt/Rq9jkp7n3LZ4PMzpbNjStXtIKVzsM8yYe48 H4clDLpp2GjmR/xG2lCQSRtcH3p3O0xHfBWPezXxF81OFurCu0/NURk6dxyB0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NtvZV3MhlzMrS; Fri, 13 Jan 2023 21:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30DLOocR040827; Fri, 13 Jan 2023 21:24:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DLOohc040826; Fri, 13 Jan 2023 21:24:50 GMT (envelope-from git) Date: Fri, 13 Jan 2023 21:24:50 GMT Message-Id: <202301132124.30DLOohc040826@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f20ecce33a2a - main - kboot: Add support for ZFS volumes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f20ecce33a2a9a992fb267edf02edaa6eb9178b3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f20ecce33a2a9a992fb267edf02edaa6eb9178b3 commit f20ecce33a2a9a992fb267edf02edaa6eb9178b3 Author: Warner Losh AuthorDate: 2023-01-13 21:20:40 +0000 Commit: Warner Losh CommitDate: 2023-01-13 21:22:39 +0000 kboot: Add support for ZFS volumes Add the zfs device and filesystem to config and write the hook we need to probe zfs since there's not a generic mechanism in place to do that when ZFS is configured. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38008 --- stand/kboot/conf.c | 9 +++++++++ stand/kboot/main.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/stand/kboot/conf.c b/stand/kboot/conf.c index ba6031b52783..160cd0ad9554 100644 --- a/stand/kboot/conf.c +++ b/stand/kboot/conf.c @@ -33,6 +33,9 @@ __FBSDID("$FreeBSD$"); #if defined(LOADER_NET_SUPPORT) #include "dev_net.h" #endif +#ifdef LOADER_ZFS_SUPPORT +#include "libzfs.h" +#endif extern struct devsw hostdisk; extern struct devsw host_dev; @@ -55,6 +58,9 @@ struct devsw *devsw[] = { &netdev, #endif &host_dev, +#if defined(LOADER_ZFS_SUPPORT) + &zfs_dev, /* Must be last */ +#endif NULL }; @@ -84,6 +90,9 @@ struct fs_ops *file_system[] = { #endif #if defined(LOADER_MSDOS_SUPPORT) &dosfs_fsops, +#endif +#if defined(LOADER_ZFS_SUPPORT) + &zfs_fsops, #endif &hostfs_fsops, NULL diff --git a/stand/kboot/main.c b/stand/kboot/main.c index 2e85121b7b12..d333737e164a 100644 --- a/stand/kboot/main.c +++ b/stand/kboot/main.c @@ -46,6 +46,7 @@ ssize_t kboot_readin(readin_handle_t fd, vm_offset_t dest, const size_t len); int kboot_autoload(void); uint64_t kboot_loadaddr(u_int type, void *data, uint64_t addr); static void kboot_kseg_get(int *nseg, void **ptr); +static void kboot_zfs_probe(void); extern int command_fdt_internal(int argc, char *argv[]); @@ -160,6 +161,7 @@ main(int argc, const char **argv) archsw.arch_autoload = kboot_autoload; archsw.arch_loadaddr = kboot_loadaddr; archsw.arch_kexec_kseg_get = kboot_kseg_get; + archsw.arch_zfs_probe = kboot_zfs_probe; /* Give us a sane world if we're running as init */ do_init(); @@ -380,6 +382,18 @@ kboot_kseg_get(int *nseg, void **ptr) *ptr = &loaded_segments[0]; } +static void +kboot_zfs_probe(void) +{ +#if defined(LOADER_ZFS_SUPPORT) + /* + * Open all the disks and partitions we can find to see if there are ZFS + * pools on them. + */ + hostdisk_zfs_probe(); +#endif +} + /* * Since proper fdt command handling function is defined in fdt_loader_cmd.c, * and declaring it as extern is in contradiction with COMMAND_SET() macro