Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Feb 2020 12:29:48 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        Ian Lepore <ian@freebsd.org>, src-committers <src-committers@freebsd.org>,  svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r357349 - in head/sys: conf modules/tpm
Message-ID:  <CAG6CVpU4Dq5XsEjsOaPmdTBoUYj2RyrvH01V%2Bnp87BEQwRROOQ@mail.gmail.com>
In-Reply-To: <C4FE2F90-5022-471B-892C-D5F014797169@FreeBSD.org>
References:  <202001311936.00VJaEDP056807@repo.freebsd.org> <CAG6CVpWy%2BA3MN47GyLoL5jvdT7pMABevg-L9w0o7HpZF9Vq5oQ@mail.gmail.com> <18BC9807-4B4C-482C-AB7E-20F9C7B68F29@FreeBSD.org> <4a87b670557d23181c3a98bc5a65c8c1a42302d3.camel@freebsd.org> <C4FE2F90-5022-471B-892C-D5F014797169@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 1, 2020 at 10:10 AM Dimitry Andric <dim@freebsd.org> wrote:
>
> On 1 Feb 2020, at 18:48, Ian Lepore <ian@FreeBSD.org> wrote:
> >
> > So you're going to switch from writing 0 to writing 0xfffffffe, and
> > just assume that will work the same?
> > ... [Caustic sarcasm elided]
>
> 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.

This seems pretty typical for TPM registers (in my limited experience).

> So indeed it is probably better to explicitly define these values as 0x0
> and 0x1, and not use ~ or ! operators at all.

I would suggest using just a plain 0 for the clear-cancel register
write, unless the other bits are actually documented to have meaning,
and that meaning is not W1C.  My recollection is that many TPM
registers only have a single real valid bit, and of those that have
more than one, many are W1C.  (AND4/OR4 RMW are inappropriate for
W1C.)  We have at least one AND4/OR4 related bugfix pending in
phabricator related to this that I should go ahead and commit:
https://reviews.freebsd.org/D23081 .

I don't think the ~0x1 (0xff...fe) will actually do anything harmful
if the other bits are ignore.  But 0 is closer to the data sheet.

Please un-disable the Makefile warnings removed in r357349 earlier, too.

Thanks,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpU4Dq5XsEjsOaPmdTBoUYj2RyrvH01V%2Bnp87BEQwRROOQ>