NTB: send DB event when driver is loaded or un-loaded
authorArindam Nath <arindam.nath@amd.com>
Wed, 5 Feb 2020 15:54:31 +0000 (21:24 +0530)
committerJon Mason <jdmason@kudzu.us>
Fri, 13 Mar 2020 14:04:20 +0000 (10:04 -0400)
commitac10d4f6c2a8247de21655f4564b0e209c3c1dd4
treedb6d4d02b30cc98e9b12e8b7bbdb803f6eb14249
parent41dfc3f79650504f5047f20a4faacaff217ce37b
NTB: send DB event when driver is loaded or un-loaded

When the driver on the local side is loaded, it sets
SIDE_READY bit in SIDE_INFO register. Likewise, when
it is un-loaded, it clears the bit.

Also just after being loaded, the driver polls for
peer SIDE_READY bit to be set. Since that bit is set
when the peer side driver has loaded, the polling on
local side breaks as soon as this condition is met.

But the situation is different when the driver is
un-loaded. Since the polling has already been stopped
as mentioned before, if the peer side driver gets
un-loaded, the driver on the local side is not notified
implicitly.

So, we improvise using existing doorbell mechanism.
We reserve the highest order bit of the DB register to
send a notification to peer when the driver on local
side is un-loaded. This also means that now we are one
short of 16 DB events and that is taken care of in the
valid DB mask.

Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
drivers/ntb/hw/amd/ntb_hw_amd.c
drivers/ntb/hw/amd/ntb_hw_amd.h