public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: bhelgaas@google.com, schnelle@linux.ibm.com,
	pmorel@linux.ibm.com, mpe@ellerman.id.au, oohall@gmail.com,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2] PCI: Introduce flag for detached virtual functions
Date: Thu, 13 Aug 2020 09:09:45 -0400	[thread overview]
Message-ID: <d2237715-298c-30a9-a05d-2b1c72476441@linux.ibm.com> (raw)
In-Reply-To: <20200812143254.2f080c38@x1.home>

On 8/12/20 4:32 PM, Alex Williamson wrote:
> On Wed, 12 Aug 2020 15:21:11 -0400
> Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> 
>> s390x has the notion of providing VFs to the kernel in a manner
>> where the associated PF is inaccessible other than via firmware.
>> These are not treated as typical VFs and access to them is emulated
>> by underlying firmware which can still access the PF.  After
>> abafbc55 however these detached VFs were no longer able to work
>> with vfio-pci as the firmware does not provide emulation of the
>> PCI_COMMAND_MEMORY bit.  In this case, let's explicitly recognize
>> these detached VFs so that vfio-pci can allow memory access to
>> them again.
>>
> 
> Might as well include a fixes tag too.
> 
> Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
> 
> You might also extend the sha1 in the log to 12 chars as well, or
> replace it with a reference to the fixes tag.
> 
Sure.

>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
>> ---
..snip..
>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>> index 8355306..23a6972 100644
>> --- a/include/linux/pci.h
>> +++ b/include/linux/pci.h
>> @@ -445,6 +445,7 @@ struct pci_dev {
>>   	unsigned int	is_probed:1;		/* Device probing in progress */
>>   	unsigned int	link_active_reporting:1;/* Device capable of reporting link active */
>>   	unsigned int	no_vf_scan:1;		/* Don't scan for VFs after IOV enablement */
>> +	unsigned int	detached_vf:1;		/* VF without local PF access */
> 
> Is there too much implicit knowledge in defining a "detached VF"?  For
> example, why do we know that we can skip the portion of
> vfio_config_init() that copies the vendor and device IDs from the
> struct pci_dev into the virtual config space?  It's true on s390x, but
> I think that's because we know that firmware emulates those registers
> for us.  We also skip the INTx pin register sanity checking.  Do we do
> that because we haven't installed the broken device into an s390x
> system?  Because we know firmware manages that for us too?  Or simply
> because s390x doesn't support INTx anyway, and therefore it's another
> architecture implicit decision?

That's a fair point.  This was also discussed (overnight for me) in 
another thread that this patch is very s390-specific.  It doesn't have 
to be, we could also emulate these additional pieces to make things more 
general-purpose here.

> 
> If detached_vf is really equivalent to is_virtfn for all cases that
> don't care about referencing physfn on the pci_dev, then we should
> probably have a macro to that effect.  Otherwise, if we're just trying
> to describe that the memory bit of the command register is
> unimplemented but always enabled, like a VF, should we specifically
> describe that attribute instead?  If so, should we instead do that with
> pci_dev_flags_t?  Thanks,

Well, that's the particular issue that got us looking at this but I'm 
not so sure we wouldn't find further oddities later, hence the desire 
for a more general-purpose bit.

> 
> Alex
> 
>>   	pci_dev_flags_t dev_flags;
>>   	atomic_t	enable_cnt;	/* pci_enable_device has been called */
>>   
> 

  parent reply	other threads:[~2020-08-13 13:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 19:21 [PATCH v2] PCI: Identifying detached virtual functions Matthew Rosato
2020-08-12 19:21 ` [PATCH v2] PCI: Introduce flag for " Matthew Rosato
2020-08-12 20:32   ` Alex Williamson
2020-08-13  1:59     ` Oliver O'Halloran
2020-08-13  7:54       ` Niklas Schnelle
2020-08-13 13:09     ` Matthew Rosato [this message]
2020-08-13  1:55   ` Oliver O'Halloran
2020-08-13  9:00     ` Niklas Schnelle
2020-08-13  9:59       ` Oliver O'Halloran
2020-08-13 10:40         ` Niklas Schnelle
2020-08-13 12:34           ` Niklas Schnelle
2020-08-13 13:11             ` Matthew Rosato
2020-08-13 13:28               ` Niklas Schnelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2237715-298c-30a9-a05d-2b1c72476441@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=oohall@gmail.com \
    --cc=pmorel@linux.ibm.com \
    --cc=schnelle@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox