From nobody Mon Mar 13 15:53:27 2023 X-Original-To: dev-commits-src-branches@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 4Pb1Qv5knXz3xsbR; Mon, 13 Mar 2023 15:53:27 +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 4Pb1Qv2DN3z47xl; Mon, 13 Mar 2023 15:53:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678722807; 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=PuS6LC3VNSDn16J0TgpiW9r+bCeVD0XfZSqdONzJfsk=; b=mDfoh2gCmqzpcsxpHxyVZBv4iHsrM2Je6dzACRHIID1FcJfiQRAQJ5P8rhzfJB5Z0/zAdH ZHgen/nLNbgr5Maa92rX1wlH+bDSCR3wK4/bnmSoKevWQwyTDGmoN0fIUwL+oILSf8+u23 P4qvL4DIt/UL0MTmCDiucA2KukZnlTqEpkmAovPyOswKQChECH+3a9iUC25jHcCxaoKXiP vgZwg7ZpleGF1CUf5EPYAjubWDotdGW+QMNQGVE+R3Mo3n+A7pyPesM7udV3VPrb8WLegO LMoBcTEvZl7a0C0zD12Jx4yr2UsuPxXADST105agT18thPsOoR+5iKfSVJSj7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678722807; 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=PuS6LC3VNSDn16J0TgpiW9r+bCeVD0XfZSqdONzJfsk=; b=U8d/RiZBNRsw7VUIzuBLbICCbuEBuKInhiZseRhNxHA8DPt+HbH9u2GgU8eKztYE+3+7Dq rFO08v0dONShmZoWGAA8C3UvAmQJlk3wvpCGxrYea6+bNttDXwltu7DLH8aIKvKIvMgk+B oLsmOSR1enhxmYVFTNJ2ANgk0UHOVydimJH4HHZ8Pk8uc1ewd1TGjpu7h/6SQ4noCDfMcL n0V515+r97DzCae6wwQ/utufiIAfeQa7jlADNH2xj9Ovl4TrXwo2QK9FzUve+msHoZpvSV 5jfoWHInqEkH6L1k2jcbZnifFG7Uzzai3aCaEjXa77TqQRJ3YxrWruXKXLSM5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678722807; a=rsa-sha256; cv=none; b=qskst+tAwxbXm/e6b966AK1yKLHL8lL8IOK2Mb2SWUDeta+OOhdQzbGDImHCZO4qBDsQlh HJrh88I3t7cam4CIPiog7BlNeOWcbQUauxXirSEhIJOC9NfE57FAr12cFVJllAK+0w9E/q 1fear/BoYWExMiIw7HUIXwWS5w5YPzIvLOfHBYyg+EMEGL8a+5HgMjexRNIkcr1uReF6Ce LOJgR+Npfhcb2s/RMpmcKJ6StRMdsO5Yqkhgz9QRqT4MhggI2eyvn/NjaWtxcn4tXYPGd0 9trU2xhyQJglPyz3QlNFl59adnhEzM5FLteJfaGmmv/vtpAtWszPnBAAQe+pJQ== 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 4Pb1Qv1KxHz10GZ; Mon, 13 Mar 2023 15:53:27 +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 32DFrRKq039842; Mon, 13 Mar 2023 15:53:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32DFrRa5039841; Mon, 13 Mar 2023 15:53:27 GMT (envelope-from git) Date: Mon, 13 Mar 2023 15:53:27 GMT Message-Id: <202303131553.32DFrRa5039841@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: 25766cfd83b2 - stable/13 - bhyvectl: Address compiler warnings and bump WARNS List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 25766cfd83b29c5a32e7c02501adabe754eaa255 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=25766cfd83b29c5a32e7c02501adabe754eaa255 commit 25766cfd83b29c5a32e7c02501adabe754eaa255 Author: Mark Johnston AuthorDate: 2023-03-03 14:32:48 +0000 Commit: Mark Johnston CommitDate: 2023-03-13 15:53:16 +0000 bhyvectl: Address compiler warnings and bump WARNS Avoid unaligned accesses in cpu_vendor_intel() and address a few other nits. No functional change intended. Reviewed by: corvink, rew, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38839 (cherry picked from commit 3f5d875a27318a909f23a2b7463c4b2d963085df) --- usr.sbin/bhyvectl/Makefile | 2 -- usr.sbin/bhyvectl/bhyvectl.c | 30 ++++++++++++------------------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/usr.sbin/bhyvectl/Makefile b/usr.sbin/bhyvectl/Makefile index c004d603c8db..5b1c04e8ac88 100644 --- a/usr.sbin/bhyvectl/Makefile +++ b/usr.sbin/bhyvectl/Makefile @@ -12,8 +12,6 @@ MAN= bhyvectl.8 LIBADD= vmmapi util -WARNS?= 3 - CFLAGS+= -I${SRCTOP}/sys/amd64/vmm .if ${MK_BHYVE_SNAPSHOT} != "no" diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index 14ab6c7ad33e..cab1e6d72c56 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -294,7 +294,7 @@ static int set_desc_ldtr, get_desc_ldtr; static int set_cs, set_ds, set_es, set_fs, set_gs, set_ss, set_tr, set_ldtr; static int get_cs, get_ds, get_es, get_fs, get_gs, get_ss, get_tr, get_ldtr; static int set_x2apic_state, get_x2apic_state; -enum x2apic_state x2apic_state; +static enum x2apic_state x2apic_state; static int unassign_pptdev, bus, slot, func; static int run; static int get_cpu_topology; @@ -316,7 +316,6 @@ static int get_pinbased_ctls, get_procbased_ctls, get_procbased_ctls2; static int get_eptp, get_io_bitmap, get_tsc_offset; static int get_vmcs_entry_interruption_info; static int get_vmcs_interruptibility; -uint32_t vmcs_entry_interruption_info; static int get_vmcs_gpa, get_vmcs_gla; static int get_exception_bitmap; static int get_cr0_mask, get_cr0_shadow; @@ -497,8 +496,8 @@ dump_intel_msr_pm(const char *bitmap, int vcpu) static int dump_msr_bitmap(int vcpu, uint64_t addr, bool cpu_intel) { + char *bitmap; int error, fd, map_size; - const char *bitmap; error = -1; bitmap = MAP_FAILED; @@ -648,25 +647,20 @@ print_intinfo(const char *banner, uint64_t info) static bool cpu_vendor_intel(void) { - u_int regs[4]; - char cpu_vendor[13]; + u_int regs[4], v[3]; do_cpuid(0, regs); - ((u_int *)&cpu_vendor)[0] = regs[1]; - ((u_int *)&cpu_vendor)[1] = regs[3]; - ((u_int *)&cpu_vendor)[2] = regs[2]; - cpu_vendor[12] = '\0'; + v[0] = regs[1]; + v[1] = regs[3]; + v[2] = regs[2]; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { - return (false); - } else if (strcmp(cpu_vendor, "HygonGenuine") == 0) { - return (false); - } else if (strcmp(cpu_vendor, "GenuineIntel") == 0) { + if (memcmp(v, "GenuineIntel", sizeof(v)) == 0) return (true); - } else { - fprintf(stderr, "Unknown cpu vendor \"%s\"\n", cpu_vendor); - exit(1); - } + if (memcmp(v, "AuthenticAMD", sizeof(v)) == 0 || + memcmp(v, "HygonGenuine", sizeof(v)) == 0) + return (false); + fprintf(stderr, "Unknown cpu vendor \"%s\"\n", (const char *)v); + exit(1); } static int