firmware: arm_scmi: Add a virtio channel refcount
authorCristian Marussi <cristian.marussi@arm.com>
Thu, 17 Feb 2022 13:12:27 +0000 (13:12 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 21 Feb 2022 10:36:48 +0000 (10:36 +0000)
commit42e90eb53bf3f6fc43c667dd377779e3ebeb748a
tree08c77122a75508f58ba921618180416e653dc5c7
parentcdf157faaafe36c0823148587a78147200898e87
firmware: arm_scmi: Add a virtio channel refcount

Currently SCMI VirtIO channels are marked with a ready flag and related
lock to track channel lifetime and support proper synchronization at
shutdown when virtqueues have to be stopped.

This leads to some extended spinlocked sections with IRQs off on the RX
path to keep hold of the ready flag and does not scale well especially when
SCMI VirtIO polling mode will be introduced.

Add an SCMI VirtIO channel dedicated refcount to track active users on both
the TX and the RX path and properly enforce synchronization and cleanup at
shutdown, inhibiting further usage of the channel once freed.

Link: https://lore.kernel.org/r/20220217131234.50328-2-cristian.marussi@arm.com
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Skalkin <igor.skalkin@opensynergy.com>
Cc: Peter Hilber <peter.hilber@opensynergy.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/virtio.c