From nobody Wed Oct 11 13:25:18 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 4S5D674XHvz4xNpg; Wed, 11 Oct 2023 13:25:19 +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 4S5D671MfPz3H1T; Wed, 11 Oct 2023 13:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697030719; 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=yRw/87xnBIkOknkfqt5IQafEmlsLFueEBtg9kEkAwn8=; b=PW33WYcx6GqB9GtLAjBqAIcHSP17RLeeQeLk3nkVLRByyT9ZXme7NM+5n1SD3L7W784oPO FsrMMYQUoANdxYKF0M3Gnasv49em0eFSMCGy1pKd43wizXRAcUUjJzRkKlUsyuYenH2Xej qW5tJth8bKV+UJvRfcc/epgICPijVxFlIjvMUViE3ePrD3yVo2G9RA62G4Y9WtHapOv7+Q idNpV5RLgnTk3OSQGVaKrm13ntoXwu2+HTaKgU/tRedRkXzgdZTFf6rN7OKCf66NTFvsxo 0IU/bkejNb9WdL6iVTXbeezBNvw9osan9Gx3ps3hFfCjSnk91RUYyVQlWpvBfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697030719; a=rsa-sha256; cv=none; b=YOa5p+xafNl4MltXBLCdH5pKlVbem/7581owbEEApQwK55z4wOEKVl5oT5GddBtY3Q7YuR G8DbPn2VAeeCuPI2A5PhYxFdRhbTrSsJYJwj5gH3DEJR3jrND1sKa2eiYSN2pXbap7i4bx K2cRSF1Njwdb46Q5zFxhkgsTZ2akxnSzXTXfDGnBWkFgi8XEHtbfkkKeHgs9Uu05ft5FAj bUMHYGOnyUwB/33hP6BiZDSB1VMXNfDKtb9kyFii1fddsR4xIyvfvRdz/Dp6OKsv/snFGk ee5Crys6+40Ppz4m4svHMYaCfHGYsS1XO4Pkf40siyRmwh42W572up47TyKoqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697030719; 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=yRw/87xnBIkOknkfqt5IQafEmlsLFueEBtg9kEkAwn8=; b=iFEEnMKJcbXDeCobKmpHrVRjMOll9qKtiktryklC/vfDoocjLBnKRb+BwXo+F0hXrCT2oK pjqThw2kJRJ+iqA9MPFTA6Ux4et6XSWeSJSR4zIkdtwBLlYkUMp7w1CntNXWvagUxq+o2V Z/YM3OuE1MHHo4i7ZbN6IIj04XXIfkBwnI5IfjCaLTLHKqlVFCWTP2tqFcFzuVevEozCSk efs9BUPSS3LtebFLQfECE/gTJxhPhZU6jLQN05PLVXLyZTHMbSgvydEdi4SRqC5Ysl+C3e WDv0wDhQUu3MeE1rxH12nHb4vG8tBWL/obMLZjgnW+uc1hFxR0z0xrPcZVOLVA== 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 4S5D670QKVz7ML; Wed, 11 Oct 2023 13:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39BDPIhU090554; Wed, 11 Oct 2023 13:25:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39BDPIdk090551; Wed, 11 Oct 2023 13:25:18 GMT (envelope-from git) Date: Wed, 11 Oct 2023 13:25:18 GMT Message-Id: <202310111325.39BDPIdk090551@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 7ed39a5ad79f - stable/14 - bhyve: Make gdb support optional 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7ed39a5ad79f6faf64a72644b9827e5b4f9464e4 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7ed39a5ad79f6faf64a72644b9827e5b4f9464e4 commit 7ed39a5ad79f6faf64a72644b9827e5b4f9464e4 Author: Mark Johnston AuthorDate: 2023-10-04 16:26:36 +0000 Commit: Mark Johnston CommitDate: 2023-10-11 13:22:08 +0000 bhyve: Make gdb support optional Add a BHYVE_GDB_SUPPORT make variable that can be set by per-arch makefiles. When set, BHYVE_GDB is defined and can be used as a preprocessor predicate. Use it to guard gdb stub calls in MI code. The arm64 bhyve port currently does not have a functional gdb stub, but that's not critical to landing the port, so this mechanism slightly reduces the friction of adding support for a new platform. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40986 (cherry picked from commit ca2cda98d265ef5d80b7cd0705697a1af27fb808) --- usr.sbin/bhyve/Makefile | 13 ++++++++----- usr.sbin/bhyve/amd64/Makefile.inc | 2 ++ usr.sbin/bhyve/bhyverun.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 7c0750fae7d7..1a8191f9fd3f 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -28,7 +28,6 @@ SRCS= \ crc16.c \ ctl_scsi_all.c \ ctl_util.c \ - gdb.c \ hda_codec.c \ iov.c \ mem.c \ @@ -67,6 +66,14 @@ SRCS+= snapshot.c .include "${MACHINE_CPUARCH}/Makefile.inc" +.if defined(BHYVE_GDB_SUPPORT) +SRCS+= gdb.c +CFLAGS+= -DBHYVE_GDB +.ifdef GDB_LOG +CFLAGS+=-DGDB_LOG +.endif +.endif + CFLAGS+=-I${.CURDIR} \ -I${.CURDIR}/../../contrib/lib9p \ -I${SRCTOP}/sys @@ -102,10 +109,6 @@ CFLAGS+= -I${SRCTOP}/contrib/libucl/include CFLAGS+= -DBHYVE_SNAPSHOT .endif -.ifdef GDB_LOG -CFLAGS+=-DGDB_LOG -.endif - # Disable thread safety analysis since it only finds very simple bugs and # yields many false positives. NO_WTHREAD_SAFETY= diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 96aaecafae4c..bc0ffa720d31 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -1,3 +1,5 @@ +BHYVE_GDB_SUPPORT= + SRCS+= \ atkbdc.c \ e820.c \ diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 2da4e198344a..b38c53da63eb 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -86,7 +86,9 @@ #include "amd64/e820.h" #include "amd64/fwctl.h" #endif +#ifdef BHYVE_GDB #include "gdb.h" +#endif #ifdef __amd64__ #include "amd64/ioapic.h" #include "amd64/kernemu_dev.h" @@ -463,7 +465,9 @@ fbsdrun_start_thread(void *param) #ifdef BHYVE_SNAPSHOT checkpoint_cpu_add(vi->vcpuid); #endif +#ifdef BHYVE_GDB gdb_cpu_add(vi->vcpu); +#endif vm_loop(vi->ctx, vi->vcpu); @@ -757,6 +761,7 @@ parse_simple_config_file(const char *path) fclose(fp); } +#ifdef BHYVE_GDB static void parse_gdb_options(const char *opt) { @@ -780,6 +785,7 @@ parse_gdb_options(const char *opt) set_config_value("gdb.port", sport); } +#endif static void set_defaults(void) @@ -848,9 +854,11 @@ main(int argc, char *argv[]) errx(EX_USAGE, "invalid fwcfg item '%s'", optarg); } break; +#ifdef BHYVE_GDB case 'G': parse_gdb_options(optarg); break; +#endif case 'k': parse_simple_config_file(optarg); break; @@ -1087,7 +1095,9 @@ main(int argc, char *argv[]) if (get_config_bool("acpi_tables")) vmgenc_init(ctx); +#ifdef BHYVE_GDB init_gdb(ctx); +#endif #ifdef __amd64__ if (lpc_bootrom()) {