Re: [PATCH V8 03/10] PCI: Create PCI library functions in support of DOE mailboxes.

From: Ira Weiny
Date: Wed Jun 01 2022 - 16:53:48 EST


On Wed, Jun 01, 2022 at 07:56:47PM +0200, Lukas Wunner wrote:
> On Wed, Jun 01, 2022 at 10:16:15AM -0700, Ira Weiny wrote:
> > On Wed, Jun 01, 2022 at 09:18:08AM +0200, Lukas Wunner wrote:
> > > You only need to re-check the Data Object Ready bit on the last-but-one
> > > dword in case the function was reset concurrently. Per sec. 6.30.2,
> > > "An FLR to a Function must result in the aborting of any DOE transfer
> > > in progress."
> >
> > I think I disagree. Even if we do that and an FLR comes before the last read
> > the last read could be 0's.
>
> PCIe r6.0, Table 7-316 says:
>
> "If there is no additional data object ready for transfer, the
> DOE instance must clear this bit after the entire data object has been
> transferred, as indicated by software writing to the DOE Read Data
> Mailbox Register after reading the final DW of the data object."
>
> Remember that you *read* a dword from the mailbox and then acknowledge
> reception to the mailbox by *writing* a dword to the mailbox.
>
> So you check that the Data Object Ready bit is set before acknowledging
> the final dword with a register write. That's race-free.

Ok.

>
> (I realize me talking about the "last-but-one dword" above was quite
> unclear, sorry about that.)
>

Ah yes. Ok, I'll put in a check before the final write.

Ira