All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Vivek Gautam <vivek.gautam@arm.com>,
	julien.thierry.kdev@gmail.com, kvm@vger.kernel.org,
	alexandru.elisei@arm.com, lorenzo.pieralisi@arm.com,
	jean-philippe@linaro.org, eric.auger@redhat.com
Subject: Re: [PATCH] vfio/pci: Add support for PCIe extended capabilities
Date: Wed, 1 Sep 2021 11:44:52 +0100	[thread overview]
Message-ID: <20210901104451.GA1023@willie-the-truck> (raw)
In-Reply-To: <4f5307cf-0cea-461a-838f-85e82805c499@arm.com>

On Wed, Sep 01, 2021 at 11:27:21AM +0100, Andre Przywara wrote:
> On 8/31/21 3:54 PM, Will Deacon wrote:
> 
> Hi Will,
> 
> > On Tue, Aug 10, 2021 at 11:55:14AM +0530, Vivek Gautam wrote:
> > > Add support to parse extended configuration space for vfio based
> > > assigned PCIe devices and add extended capabilities for the device
> > > in the guest. This allows the guest to see and work on extended
> > > capabilities, for example to toggle PRI extended cap to enable and
> > > disable Shared virtual addressing (SVA) support.
> > > PCIe extended capability header that is the first DWORD of all
> > > extended caps is shown below -
> > > 
> > >     31               20  19   16  15                 0
> > >     ____________________|_______|_____________________
> > >    |    Next cap off    |  1h   |     Cap ID          |
> > >    |____________________|_______|_____________________|
> > > 
> > > Out of the two upper bytes of extended cap header, the
> > > lower nibble is actually cap version - 0x1.
> > > 'next cap offset' if present at bits [31:20], should be
> > > right shifted by 4 bits to calculate the position of next
> > > capability.
> > > This change supports parsing and adding ATS, PRI and PASID caps.
> > > 
> > > Signed-off-by: Vivek Gautam <vivek.gautam@arm.com>
> > > ---
> > >   include/kvm/pci.h |   6 +++
> > >   vfio/pci.c        | 104 ++++++++++++++++++++++++++++++++++++++++++----
> > >   2 files changed, 103 insertions(+), 7 deletions(-)
> > 
> > Does this work correctly for architectures which don't define ARCH_HAS_PCI_EXP?
> 
> I think it does: the code compiles fine, and the whole functionality is
> guarded by:
> +	/* Extended cap only for PCIe devices */
> +	if (!arch_has_pci_exp())
> +		return 0;
> 
> A clever compiler might even decide to not include this code at all.
> 
> Did you see any particular problem?

The part I was worried about is that PCI_DEV_CFG_MASK (which is used by
the cfg space dispatch code) is derived from PCI_DEV_CFG_SIZE, but actually
I think this patch might _fix_ that problem because it removes the explicit
usage of PCI_DEV_CFG_SIZE_LEGACY!

Will

  reply	other threads:[~2021-09-01 10:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  6:25 [PATCH] vfio/pci: Add support for PCIe extended capabilities Vivek Gautam
2021-08-31 14:54 ` Will Deacon
2021-09-01 10:27   ` Andre Przywara
2021-09-01 10:44     ` Will Deacon [this message]
2021-09-02 10:28       ` Vivek Kumar Gautam
2021-08-31 17:14 ` Andre Przywara
2021-09-02 10:42   ` Vivek Kumar Gautam
2021-09-02  9:59 ` Alexandru Elisei
2021-09-02 10:48   ` Vivek Kumar Gautam
2021-09-03 15:15     ` Alexandru Elisei
2021-09-08  9:32       ` Vivek Kumar Gautam
2021-09-08  9:36         ` Vivek Kumar Gautam
2021-09-08 16:20           ` Alexandru Elisei
2021-09-08 16:18         ` Alexandru Elisei
2021-10-04  9:47         ` Will Deacon

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=20210901104451.GA1023@willie-the-truck \
    --to=will@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=eric.auger@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=vivek.gautam@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.