Re: [PATCH v4 1/3] PCI/IOV: Mark VFs as not implementing MSE bit

From: Bjorn Helgaas
Date: Wed Sep 09 2020 - 22:40:08 EST


On Thu, Sep 03, 2020 at 01:10:02PM -0400, Matthew Rosato wrote:
> On 9/3/20 12:41 PM, Bjorn Helgaas wrote:

> > - How do we decide whether to use dev_flags vs a bitfield like
> > dev->is_virtfn? The latter seems simpler unless there's a reason
> > to use dev_flags. If there's a reason, maybe we could add a
> > comment at pci_dev_flags for future reference.
>
> Something like:
>
> /*
> * Device does not implement PCI_COMMAND_MEMORY - this is true for any
> * device marked is_virtfn, but is also true for any VF passed-through
> * a lower-level hypervisor where emulation of the Memory Space Enable
> * bit was not provided.
> */
> PCI_DEV_FLAGS_NO_COMMAND_MEMORY = (__force pci_dev_flags_t) (1 << 12),

Sorry, I wasn't clear about this. I was trying to suggest that if
there are some situations where we need to use pci_dev_flags instead
of a bitfield, it would be useful to have a generic comment to help
decide between them.

I don't know that there *is* a good reason, and unless somebody can
think of one, I'd like to get rid of pci_dev_flags completely and
convert them all to bitfields.

Given that, my preference would be to just add a new bitfield,
something like this:

struct pci_dev {
...
unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */