From nobody Fri Mar 03 16:13:50 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 4PStM25hZjz3w4jD; Fri, 3 Mar 2023 16:13: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 4PStM24YQcz3QMY; Fri, 3 Mar 2023 16:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677860030; 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=sza4v0pzIqcoVo5KsAwQJaROyJVVH1DJScDhLItvuGA=; b=N6DsNGdyJK0SA6f1Ffn7QfATOBilBwePGASrBbS7cDXQVqc2grK6Nymwsi9R1xhJ8OiZnB UwzoXh6TwzCZs+ZSZ5IplKDX0lIT4fVTTGRABsFXBm+FRBjLj/J55d8xwp+oHEii7ITZJ+ VWQKlrm6mDhGgQVoDwqq6gWWbWONnStYmy4HgAdBiCCGY60FEuKDPILM2w2wJH989M2/de u9e+7fnHapjW/tNTGWSkr0fgPdaDavYyNrB/tF0tYOzZBnpCGD4HaqTZpKBGpB+ppnV3Ks gk/wDJ/KDbnpBac20ZV7u2H0JJjoZfKqC2C4lPy5yOPt8Upbz3dgXa+ObUrW3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677860030; 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=sza4v0pzIqcoVo5KsAwQJaROyJVVH1DJScDhLItvuGA=; b=dI8dv7E93wqbZOY/6jIzV0XoMnK8NgjY/nX7IFBNzBqCJmxAZ+VhqxuX9co5wLq37Q6vMP FYFMaIQyOlbGvYK5B662Ir7XLPpiE/Y7ddukqiyeaI6Zef7CEfzrm83r01hI6CzWDGPe8j MroRCy1c9LjAyEGrrOX92kCmxtk4p4gAsXVTaTRbFwoldqScjOFMnqTMM1Q8G+p/MgUP8a Ot+JYQmVcU9USuOsjh1BNLyTb81d/cEY/+r1LZbDfk11uFTtM4gvdj3e5Gl3MwQ+k9kI9K rVJ7HACIxsBXfHTM83NF0JEewvnTnD+/8DH+Aea5anWWyYdzeDd/b3NERJLgMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677860030; a=rsa-sha256; cv=none; b=aViN1SPVV0BbThoegUQXXB/h7ulmFHrJvtc3TKyEM7Vi75T3vq8I7NX6yNrL59ETJZZ15O 5uUbllr9+L5+HrLL6rW5vV5+DbgUj555QZZjikOyWTI5lSoaJC/scyvEwCMy+8eOosF1Ab mnKUXsCCXbzSCGiQGUXxiXOqYJMxx50yIUxZ5w1zpp6FWhk1VBCnNBqWlGQABWTLMNNzji RHLiRVu9qAdsskJuUQn0j2tvBuJLoPo8zN44O4bRCAIZw5hYyTdpy6jLg39NFrBKUQDb3g R8H9k8qtW+F4knRgeQLhxg2a9yyFWhF7n2WuXdDlsewG+vj2IK7Z8qkgxyfmyA== 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 4PStM23XS4z14Dk; Fri, 3 Mar 2023 16:13: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 323GDoIC000414; Fri, 3 Mar 2023 16:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 323GDoQA000413; Fri, 3 Mar 2023 16:13:50 GMT (envelope-from git) Date: Fri, 3 Mar 2023 16:13:50 GMT Message-Id: <202303031613.323GDoQA000413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3f5d875a2731 - main - bhyvectl: Address compiler warnings and bump WARNS 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f5d875a27318a909f23a2b7463c4b2d963085df Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3f5d875a27318a909f23a2b7463c4b2d963085df commit 3f5d875a27318a909f23a2b7463c4b2d963085df Author: Mark Johnston AuthorDate: 2023-03-03 14:32:48 +0000 Commit: Mark Johnston CommitDate: 2023-03-03 16:13:22 +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 --- 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