From owner-svn-src-head@freebsd.org Sat Feb 1 17:48:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F3D11FDC2A for ; Sat, 1 Feb 2020 17:48:27 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4891lt5bmhz3L1y for ; Sat, 1 Feb 2020 17:48:26 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1580579305; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=Yhn2WkVJ7eWTUpqoLKIMdfSu7IpUbn3f/r9dNV8RlTeKPg67DgEQDYvGTNMCNgN5xNMBOmearAU19 ma8ISSZL2W+5pDKx3l07zdq5uaXYy10wFLpHx0n+TtvLHbNo0rseUNLPQViYG7sB6gcfMouWaTNqbm fdu/Ow8S2KjjN8sd/oOQqJ0j1S5OVVUMvK7/iB5tONw7asAD54A5a+jybEQCCxEi9lZMuci9Fu2DnA 1L84xDsMIHdxFOw2TIrA3uk749DcWYf0ywyIwjdGVj0Xrek8gnXq6GUTss0Re/0YX9qbqWJc2pc0c0 N9zsN6vrdvmwIC3AEv0qmZCyul7kuoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=SL4Mj5v9XpV85pI6m8BA5k5SAXZn2LctXtg4yoxNnRk=; b=ORsdQZuNQ0R5V79PDmbEnCUXdTe9+EtigwftsY+3glBYUZe01EFI2XveD1c4oSypFvUWzoGU0xw0O VIO+snm28jZHiezNOq5f+7ajGM781fShS449hnGaeO2g4rZQqlcRpW2/w1rolBgV85b3LK6F5GXno4 fh/4JxN18jVIUzJyyf/CMuieSYFLdD3EnRQVlsua/zllXSGhTsOFGHToob5g3xuVKFit+hrdMsCgB/ wWc7qx3UVX/eUNstTHFnBia+ESTt6/peuFqeRX9+K7n0ZRWqQnbjEV74S+wPft6eoF9bUFnyVqedt0 xSMXYpkIYlfrOxCFegrOkiS8SB8SiYw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=SL4Mj5v9XpV85pI6m8BA5k5SAXZn2LctXtg4yoxNnRk=; b=oSg/hXB3hDBOrP+7r1v9y3xi5DwHfu/uymfbm/xr4WcWtZw7i2bsUo76mLOXkmuLOgnrdgUVuj43o J3/RYq2MS9rY/PA5OhFPTu/DoIXm3duQLsuttmFZEqG18+nub8hmLIFPq1vC+184Je/sYXlaWbc7zo JHZ4PN+pkyK9nISsac0Q2Ql0tRzlVF3g4OGXeZCCekJfXJe3ZQN8EMAc6DokfXymWh6cJ2br1J7TR3 SzYjui3fWVkY+hGH3fj6hQwXs/smovzZV9BtaxOSAtnQ3e0uMZ9wC03FtL7tRcZdw/nIpli418cuek jR5T1PP6n9ylfCsPq4M3tFWvET2lqnw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 082d6bbb-451b-11ea-b80d-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 082d6bbb-451b-11ea-b80d-052b4a66b6b2; Sat, 01 Feb 2020 17:48:23 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 011HmIXI029918; Sat, 1 Feb 2020 10:48:18 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <4a87b670557d23181c3a98bc5a65c8c1a42302d3.camel@freebsd.org> Subject: Re: svn commit: r357349 - in head/sys: conf modules/tpm From: Ian Lepore To: Dimitry Andric , cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head Date: Sat, 01 Feb 2020 10:48:18 -0700 In-Reply-To: <18BC9807-4B4C-482C-AB7E-20F9C7B68F29@FreeBSD.org> References: <202001311936.00VJaEDP056807@repo.freebsd.org> <18BC9807-4B4C-482C-AB7E-20F9C7B68F29@FreeBSD.org> Content-Type: text/plain; charset="windows-1251" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4891lt5bmhz3L1y X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.95 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.972,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-0.98)[-0.980,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2020 17:48:27 -0000 On Fri, 2020-01-31 at 23:36 +0100, Dimitry Andric wrote: > Hmm yes, you are quite right. Other parts of the code also seem to > use ~TPM_XXX, and the WR4() inline function called takes a > uint32_t. I'll revert my change and apply the tilde version instead! > > -Dimitry > So you're going to switch from writing 0 to writing 0xfffffffe, and just assume that will work the same? Like, without looking at the datasheet or TRM for the device? Surely those other 31 bits you're turning on in a control register can't do anything important, can they? I haven't looked at the code, but I'll bet the other places that are using ~SYMBOLNAME are doing so in the context of read-modify-write in a way that preserves existing bits, which is completely different than just turning on 31 bits as a side effect of turning one bit off. -- Ian > > On 31 Jan 2020, at 22:13, Conrad Meyer wrote: > > > > Hi Dimitry, > > > > Do you think maybe the intent is to use ~TPM_CRB_CTRL_CANCEL_CMD > > instead? Plain "0" might also make sense. But I think the > > compiler > > is right here and the warning should not be disabled — !BIT(foo) > > doesn't really make sense for a register. It happens to affect the > > right bit only because CANCEL_CMD is BIT(0). > > > > Thanks, > > Conrad > > > > On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric > > wrote: > > > > > > Author: dim > > > Date: Fri Jan 31 19:36:14 2020 > > > New Revision: 357349 > > > URL: https://svnweb.freebsd.org/changeset/base/357349 > > > > > > Log: > > > Merge r357348 from the clang 10.0.0 import branch: > > > > > > Disable new clang 10.0.0 warnings about converting the result of > > > shift > > > operations to a boolean in tpm(4): > > > > > > sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of > > > '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,- > > > Wint-in-bool-context] > > > WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD); > > > ^ > > > sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro > > > 'TPM_CRB_CTRL_CANCEL_CMD' > > > #define TPM_CRB_CTRL_CANCEL_CMD BIT(0) > > > ^ > > > sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT' > > > #define BIT(x) (1 << (x)) > > > ^ > > > > > > Such warnings can be useful in C++ contexts, but not so much in > > > kernel > > > drivers, where this type of bit twiddling is commonplace. So > > > disable it > > > for this case. > > > > > > MFC after: 3 days > > > > > > Modified: > > > head/sys/conf/files.amd64 > > > head/sys/conf/kern.mk > > > head/sys/modules/tpm/Makefile > > > Directory Properties: > > > head/ (props changed) > > > > > > Modified: head/sys/conf/files.amd64 > > > ================================================================= > > > ============= > > > --- head/sys/conf/files.amd64 Fri Jan 31 19:35:21 > > > 2020 (r357348) > > > +++ head/sys/conf/files.amd64 Fri Jan 31 19:36:14 > > > 2020 (r357349) > > > @@ -323,7 +323,8 @@ > > > dev/syscons/scvesactl.c optional sc vga vesa > > > dev/syscons/scvgarndr.c optional sc vga > > > dev/tpm/tpm.c optional tpm > > > dev/tpm/tpm20.c optional tpm > > > -dev/tpm/tpm_crb.c optional tpm acpi > > > +dev/tpm/tpm_crb.c optional tpm acpi \ > > > + compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}" > > > dev/tpm/tpm_tis.c optional tpm acpi > > > dev/tpm/tpm_acpi.c optional tpm acpi > > > dev/tpm/tpm_isa.c optional tpm isa > > > > > > Modified: head/sys/conf/kern.mk > > > ================================================================= > > > ============= > > > --- head/sys/conf/kern.mk Fri Jan 31 19:35:21 > > > 2020 (r357348) > > > +++ head/sys/conf/kern.mk Fri Jan 31 19:36:14 > > > 2020 (r357349) > > > @@ -37,6 +37,9 @@ CWARNEXTRA+= -Wno-error-shift-negative-value > > > .if ${COMPILER_VERSION} >= 40000 > > > CWARNEXTRA+= -Wno-address-of-packed-member > > > .endif > > > +.if ${COMPILER_VERSION} >= 100000 > > > +NO_WINT_IN_BOOL_CONTEXT= -Wno-int-in-bool-context > > > +.endif > > > .endif > > > > > > .if ${COMPILER_TYPE} == "gcc" > > > > > > Modified: head/sys/modules/tpm/Makefile > > > ================================================================= > > > ============= > > > --- head/sys/modules/tpm/Makefile Fri Jan 31 19:35:21 > > > 2020 (r357348) > > > +++ head/sys/modules/tpm/Makefile Fri Jan 31 19:36:14 > > > 2020 (r357349) > > > @@ -11,3 +11,5 @@ SRCS+= tpm_isa.c tpm_acpi.c isa_if.h > > > opt_acpi.h acpi_i > > > SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h > > > > > > .include > > > + > > > +CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT} > >