svn commit: r357349 - in head/sys: conf modules/tpm

Conrad Meyer cem at freebsd.org
Sat Feb 1 20:30:01 UTC 2020


On Sat, Feb 1, 2020 at 10:10 AM Dimitry Andric <dim at freebsd.org> wrote:
>
> On 1 Feb 2020, at 18:48, Ian Lepore <ian at 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


More information about the svn-src-all mailing list