Re: [PATCH v8] vfio/pci: Add OpRegion 2.0+ Extended VBT support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 13, 2021 at 1:12 AM Alex Williamson
<alex.williamson@xxxxxxxxxx> wrote:
>
> On Tue, 12 Oct 2021 20:48:55 +0800
> Colin Xu <colin.xu@xxxxxxxxx> wrote:
>
> > From: Colin Xu <colin.xu@xxxxxxxxx>
> >
> > Due to historical reason, some legacy shipped system doesn't follow
> > OpRegion 2.1 spec but still stick to OpRegion 2.0, in which the extended
> > VBT is not contiguous after OpRegion in physical address, but any
> > location pointed by RVDA via absolute address. Also although current
> > OpRegion 2.1+ systems appears that the extended VBT follows OpRegion,
> > RVDA is the relative address to OpRegion head, the extended VBT location
> > may change to non-contiguous to OpRegion. In both cases, it's impossible
> > to map a contiguous range to hold both OpRegion and the extended VBT and
> > expose via one vfio region.
> >
> > The only difference between OpRegion 2.0 and 2.1 is where extended
> > VBT is stored: For 2.0, RVDA is the absolute address of extended VBT
> > while for 2.1, RVDA is the relative address of extended VBT to OpRegion
> > baes, and there is no other difference between OpRegion 2.0 and 2.1.
> > To support the non-contiguous region case as described, the updated read
> > op will patch OpRegion version and RVDA on-the-fly accordingly. So that
> > from vfio igd OpRegion view, only 2.1+ with contiguous extended VBT
> > after OpRegion is exposed, regardless the underneath host OpRegion is
> > 2.0 or 2.1+. The mechanism makes it possible to support legacy OpRegion
> > 2.0 extended VBT systems with on the market, and support OpRegion 2.1+
> > where the extended VBT isn't contiguous after OpRegion.
> >
> > V2:
> > Validate RVDA for 2.1+ before increasing total size. (Alex)
> >
> > V3: (Alex)
> > Split read and write ops.
> > On-the-fly modify OpRegion version and RVDA.
> > Fix sparse error on assign value to casted pointer.
> >
> > V4: (Alex)
> > No need support write op.
> > Direct copy to user buffer with several shift instead of shadow.
> > Copy helper to copy to user buffer and shift offset.
> >
> > V5: (Alex)
> > Simplify copy help to only cover common shift case.
> > Don't cache patched version and rvda. Patch on copy if necessary.
> >
> > V6:
> > Fix comment typo and max line width.
> >
> > V7:
> > Keep bytes to copy/remain as size_t.
> > Proper shift byte address on copy source.
> > Rebase to linux-next.
> >
> > V8:
> > Replace min() with min_t() to avoid type cast.
> > Wrap long lines.
> >
> > Cc: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx>
> > Cc: Hang Yuan <hang.yuan@xxxxxxxxxxxxxxx>
> > Cc: Swee Yee Fonn <swee.yee.fonn@xxxxxxxxx>
> > Cc: Fred Gao <fred.gao@xxxxxxxxx>
> > Signed-off-by: Colin Xu <colin.xu@xxxxxxxxx>
> > ---
> >  drivers/vfio/pci/vfio_pci_igd.c | 234 ++++++++++++++++++++++++--------
> >  1 file changed, 175 insertions(+), 59 deletions(-)
>
> Looks good, applied to vfio next branch for v5.16.  Thanks,
>
> Alex
>
Thanks Alex for the help plugging the hole due to the special OpRegion 2.0 case.

Colin



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux