Re: [PATCH v2 5/6] vfio: selftests: Add helper to set/override a vf_token
From: David Matlack
Date: Wed Jan 14 2026 - 12:12:35 EST
On 2026-01-08 01:45 PM, Raghavendra Rao Ananta wrote:
> On Wed, Jan 7, 2026 at 2:56 PM David Matlack <dmatlack@xxxxxxxxxx> wrote:
> > On 2025-12-10 06:14 PM, Raghavendra Rao Ananta wrote:
> > > +void vfio_device_set_vf_token(int fd, const char *vf_token)
> > > +{
> > > + uuid_t token_uuid = {0};
> > > +
> > > + VFIO_ASSERT_NOT_NULL(vf_token, "vf_token is NULL");
nit: Drop the "vf_token is NULL" message. It's unnecessary.
> > > + VFIO_ASSERT_EQ(uuid_parse(vf_token, token_uuid), 0);
> > > +
> > > + vfio_device_feature_set(fd, VFIO_DEVICE_FEATURE_PCI_VF_TOKEN,
> > > + token_uuid, sizeof(uuid_t));
> > > +}
> >
> > Would it be useful to have a variant that returns an int for negative
> > testing?
> >
> I couldn't see any interesting cases where the ioctl could fail that
> would warrant a negative test.
> The 'incorrect vf token set' is validated later during device init.
> I've implemented a negative test for this.
>
> However, please let me know if you can think of anything.
I didn't have anything in mind, I was just curious.