> The number of vrings for each vdev has been fixed to 2 since the > introduction of multi-vdev support [1]; this is completely fine for the > rpmsg usecase, but can conflict with other virtio devices (CAN for > example requires 3 virtqueues, entropy only 1, network a variable number > and so on). > > Remove the static vring allocation, transforming it to a flex array that > is allocated at vdev probe time; for the existent usecases (i.e.: mainly > rpmsg) this leads to no functional change, except the additional memory > used for the counter associated to the new array. > > The maximum number of virtqueues is limited to 256 due to the uint8_t > value used inside the resource table to indicate the number of vring to > allocate; for this reason, no additional plausibility check is performed > on the number of vrings indicated by the resource table. > > As a side effect, this also fixes the single virtqueue usecase, which > was apparently supported also before but for which the remove action > caused an error (because the remove action was trying to unmap also the > second vring, which was in fact not mapped). > > [1] > https://lore.kernel.org/all/[email protected]/ > > Signed-off-by: Francesco Valla <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
