From nobody Fri Feb 03 15:50:52 2023 X-Original-To: dev-commits-src-main@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 4P7g9T1BsJz3kRpY; Fri, 3 Feb 2023 15:50:53 +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 4P7g9S72RHz3JWh; Fri, 3 Feb 2023 15:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675439453; 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=afgiPF/uVBzBZEKD/Lr5XQ3HLEBFrhPdPBBB5RkTCAY=; b=w0o7AMLdIoh60Wsq/wDgzzJpGpxWl3Nv5f+O+1mc0+E/llNdBf+WFEAdLQGz/Y8421EbZy VwaSWOsrPVg5v085SIAgicmScbaF9n667yb2ZaThauQ7/kHq9bBvSGAvGsWgiQo9jElnUy EhazotISI/OcD5NSYaW3nuTkzJbICQbJoGu8eMG1FFynxFIMR8VULMhXft7/RUefkOf9k9 ae5/CkbMMNj/DD1PSrqMoGaxhczK+vEDu2QzJDJC2Ju4ZXu5lRpoiMOZrYX1PfBnLf9Gtk CvdKNrCYYfaVUdGudQKdQlExzBOmpphXDdSVeIku4EZOs2GjnbVCZwVT9vkuBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675439453; 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=afgiPF/uVBzBZEKD/Lr5XQ3HLEBFrhPdPBBB5RkTCAY=; b=rBOj8nynOp1MppNdqSbaDqs0qs9Ln5BZuTVpl+XmbNIsWeH7i/iRLsV+bbWmyz112LlTcT ZYjzRSmQyF1qPnRpMVCR/q81V6hcIq/HViXXiJfmXBJ/1GOj09VfFtjvyciPjNH1vrr2j5 0OVXh/2ttY+mYsAEaOkq+w/sv8AyQUsMW5z5TQxPBDQqBC5dTEDGRKmRyjkmsKaczTcgay wiaq75i/aExZG9uzE1QkS9qsvxxEbBGdKjD/fml0BRZRQvR0jLIKiqKBeIt9AS7pCl7Vr3 pDj9d0wuT54mpDjmRLMzj65FJ6crDZReUZVahEbOB4yyZy8/ZxvYObD3VQmARQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675439453; a=rsa-sha256; cv=none; b=sdEKVK6fg21pMw0o0ZMKlLhDMlFUOmqB5mcJKfrJu2vg0owRxqOzWRsK6ORSg0gFbeEDon 13Emhx0cixZDQpKZKCqMkKWqN2UTo9ZUTZXo89mbFr7ikPtj46hXFiS5nKoLXrAPy0QH9L Akb1XnPysmiDpt94zAqNrDlBJWdYyslVtvDHq1GrParhpZE2fw806EDMiEHjVus6dRvrXu dE5ryiBo0MS6Bn1xx34Fh6nuOjBnhMQB3hfLUVyeB36CAX3N1Hi2443snqAVnvXQOT6kno v0/4zD/nKcFZteGdp7+1MOuhbcOBeZxwDfYedgSMk5zf8lCSYfwK1k58iUWgKA== 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 4P7g9S61PczgTD; Fri, 3 Feb 2023 15:50:52 +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 313FoqFC024108; Fri, 3 Feb 2023 15:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 313FoqrE024107; Fri, 3 Feb 2023 15:50:52 GMT (envelope-from git) Date: Fri, 3 Feb 2023 15:50:52 GMT Message-Id: <202302031550.313FoqrE024107@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: 2b5179105359 - main - kboot: Don't need an arch pointer to get segments List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 2b5179105359537be52c7081f491a4c476aaaff4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2b5179105359537be52c7081f491a4c476aaaff4 commit 2b5179105359537be52c7081f491a4c476aaaff4 Author: Warner Losh AuthorDate: 2023-02-03 15:40:30 +0000 Commit: Warner Losh CommitDate: 2023-02-03 15:41:40 +0000 kboot: Don't need an arch pointer to get segments There's no need for an arch pointer to get segments. We can call the routine directly since we don't need this code to be called from different context where a pointer is needed. Sponsored by: Netflix Reviewed by: kevans, andrew Differential Revision: https://reviews.freebsd.org/D38266 --- stand/common/bootstrap.h | 3 --- stand/kboot/arch/aarch64/exec.c | 4 +--- stand/kboot/arch/amd64/elf64_freebsd.c | 4 +--- stand/kboot/arch/powerpc64/ppc64_elf_freebsd.c | 5 ++--- stand/kboot/kboot.h | 3 +++ stand/kboot/main.c | 4 +--- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index cc22cbcb729d..80c1a2352b3c 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -372,9 +372,6 @@ struct arch_switch /* Return the hypervisor name/type or NULL if not virtualized. */ const char *(*arch_hypervisor)(void); - - /* For kexec-type loaders, get ksegment structure */ - void (*arch_kexec_kseg_get)(int *nseg, void **kseg); }; extern struct arch_switch archsw; diff --git a/stand/kboot/arch/aarch64/exec.c b/stand/kboot/arch/aarch64/exec.c index b0cb2fcbb531..521e28beb562 100644 --- a/stand/kboot/arch/aarch64/exec.c +++ b/stand/kboot/arch/aarch64/exec.c @@ -275,9 +275,7 @@ elf64_exec(struct preloaded_file *fp) archsw.arch_copyin((void *)trampcode, kernendp, tramp_size); printf("Trampoline bouncing to %#llx\n", (long long)trampoline_data->entry); - if (archsw.arch_kexec_kseg_get == NULL) - panic("architecture did not provide kexec segment mapping"); - archsw.arch_kexec_kseg_get(&nseg, &kseg); + kboot_kseg_get(&nseg, &kseg); error = host_kexec_load(trampolinebase, nseg, kseg, HOST_KEXEC_ARCH_AARCH64); if (error != 0) panic("kexec_load returned error: %d", error); diff --git a/stand/kboot/arch/amd64/elf64_freebsd.c b/stand/kboot/arch/amd64/elf64_freebsd.c index 68588c0f2f02..0d950fb61eb6 100644 --- a/stand/kboot/arch/amd64/elf64_freebsd.c +++ b/stand/kboot/arch/amd64/elf64_freebsd.c @@ -446,9 +446,7 @@ elf64_exec(struct preloaded_file *fp) /* Copy the page table to the ksegs */ archsw.arch_copyin(PT4, trampoline_data->pt4 - staging, 9 * LOADER_PAGE_SIZE); - if (archsw.arch_kexec_kseg_get == NULL) - panic("architecture did not provide kexec segment mapping"); - archsw.arch_kexec_kseg_get(&nseg, &kseg); + kboot_kseg_get(&nseg, &kseg); error = host_kexec_load(trampolinebase, nseg, kseg, HOST_KEXEC_ARCH_X86_64); if (error != 0) panic("kexec_load returned error: %d", error); diff --git a/stand/kboot/arch/powerpc64/ppc64_elf_freebsd.c b/stand/kboot/arch/powerpc64/ppc64_elf_freebsd.c index 3341771be09a..613186ab19cb 100644 --- a/stand/kboot/arch/powerpc64/ppc64_elf_freebsd.c +++ b/stand/kboot/arch/powerpc64/ppc64_elf_freebsd.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "syscall_nr.h" #include "host_syscall.h" #include "modinfo.h" +#include "kboot.h" extern char end[]; extern void *kerneltramp; @@ -148,9 +149,7 @@ ppc64_elf_exec(struct preloaded_file *fp) archsw.arch_copyin(trampoline, trampolinebase, szkerneltramp); free(trampoline); - if (archsw.arch_kexec_kseg_get == NULL) - panic("architecture did not provide kexec segment mapping"); - archsw.arch_kexec_kseg_get(&nseg, &kseg); + kboot_kseg_get(&nseg, &kseg); error = host_kexec_load(trampolinebase, nseg, kseg, HOST_KEXEC_ARCH_PPC64); if (error != 0) diff --git a/stand/kboot/kboot.h b/stand/kboot/kboot.h index 4211f21adcb6..49e5dea25b12 100644 --- a/stand/kboot/kboot.h +++ b/stand/kboot/kboot.h @@ -31,6 +31,9 @@ void fdt_arch_fixups(void *fdtp); uint64_t kboot_get_phys_load_segment(void); uint8_t kboot_get_kernel_machine_bits(void); +/* main.c */ +void kboot_kseg_get(int *nseg, void **ptr); + /* hostdisk.c */ extern const char *hostfs_root; const char *hostdisk_gen_probe(void); diff --git a/stand/kboot/main.c b/stand/kboot/main.c index 6631cb38ae22..75c2d55c3f39 100644 --- a/stand/kboot/main.c +++ b/stand/kboot/main.c @@ -45,7 +45,6 @@ ssize_t kboot_copyin(const void *src, vm_offset_t dest, const size_t len); ssize_t kboot_copyout(vm_offset_t src, void *dest, const size_t len); ssize_t kboot_readin(readin_handle_t fd, vm_offset_t dest, const size_t len); int kboot_autoload(void); -static void kboot_kseg_get(int *nseg, void **ptr); static void kboot_zfs_probe(void); extern int command_fdt_internal(int argc, char *argv[]); @@ -203,7 +202,6 @@ main(int argc, const char **argv) archsw.arch_copyout = kboot_copyout; archsw.arch_readin = kboot_readin; archsw.arch_autoload = kboot_autoload; - 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 */ @@ -433,7 +431,7 @@ kboot_autoload(void) return (0); } -static void +void kboot_kseg_get(int *nseg, void **ptr) { int a;