From owner-svn-src-all@freebsd.org Sat Feb 1 18:10:05 2020 Return-Path: Delivered-To: svn-src-all@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 CD1E31FE5B1; Sat, 1 Feb 2020 18:10:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4892Ds51zmz3M8t; Sat, 1 Feb 2020 18:10:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 8C2889968; Sat, 1 Feb 2020 18:10:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::48be:cb08:157f:a7ed] (unknown [IPv6:2001:470:7a58:0:48be:cb08:157f:a7ed]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 6AC6B3B4FE; Sat, 1 Feb 2020 19:10:03 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_3B7BCF2F-AE68-4E1C-B3D3-5C6CAAF476E5"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r357349 - in head/sys: conf modules/tpm Date: Sat, 1 Feb 2020 19:09:57 +0100 In-Reply-To: <4a87b670557d23181c3a98bc5a65c8c1a42302d3.camel@freebsd.org> Cc: cem@freebsd.org, src-committers , svn-src-all , svn-src-head To: Ian Lepore References: <202001311936.00VJaEDP056807@repo.freebsd.org> <18BC9807-4B4C-482C-AB7E-20F9C7B68F29@FreeBSD.org> <4a87b670557d23181c3a98bc5a65c8c1a42302d3.camel@freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2020 18:10:05 -0000 --Apple-Mail=_3B7BCF2F-AE68-4E1C-B3D3-5C6CAAF476E5 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 1 Feb 2020, at 18:48, Ian Lepore wrote: > > 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? Hmm, the data sheet says: Writes (0000 0001h): Cancel a command Writes (0000 0000h): Clears field when command has been cancelled It seems the other bits in the register are not used for anything. So indeed it is probably better to explicitly define these values as 0x0 and 0x1, and not use ~ or ! operators at all. > 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. There aren't many places, but they tend to use the AND4() and OR4() inline functions, which do are more usual pattern of read-modify-write. I'll fix up the code again... -Dimitry --Apple-Mail=_3B7BCF2F-AE68-4E1C-B3D3-5C6CAAF476E5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXjW+9QAKCRCwXqMKLiCW o8vlAKChYDR3Dv3pXGQLV0y1fzQB46+sewCguyLETIVjFjfRdpwcrXU2NeyTAMg= =Zhhq -----END PGP SIGNATURE----- --Apple-Mail=_3B7BCF2F-AE68-4E1C-B3D3-5C6CAAF476E5--