All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Brian Woods <brian.woods@amd.com>
Subject: Re: [PATCH 1/5] pci: use pci_sbdf_t in pci_dev
Date: Thu, 23 May 2019 09:29:44 -0600	[thread overview]
Message-ID: <5CE6BC680200007800231C8F@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <20190510161056.48648-2-roger.pau@citrix.com>

>>> On 10.05.19 at 18:10, <roger.pau@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/vmsi.c
> +++ b/xen/arch/x86/hvm/vmsi.c
> @@ -688,8 +688,8 @@ static int vpci_msi_update(const struct pci_dev *pdev, uint32_t data,
>          {
>              gdprintk(XENLOG_ERR,
>                       "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
> -                     pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
> -                     PCI_FUNC(pdev->devfn), pirq + i, rc);
> +                     pdev->sbdf.seg, pdev->sbdf.bus, pdev->sbdf.dev,
> +                     pdev->sbdf.func, pirq + i, rc);

I assume patch 4 could have been quite a bit smaller, and you could have
avoided touching the same places twice if that one came before the one
here.

> --- a/xen/drivers/passthrough/amd/iommu_cmd.c
> +++ b/xen/drivers/passthrough/amd/iommu_cmd.c
> @@ -289,23 +289,23 @@ void amd_iommu_flush_iotlb(u8 devfn, const struct pci_dev *pdev,
>      if ( !ats_enabled )
>          return;
>  
> -    if ( !pci_ats_enabled(pdev->seg, pdev->bus, pdev->devfn) )
> +    if ( !pci_ats_enabled(pdev->sbdf.seg, pdev->sbdf.bus, pdev->sbdf.extfunc) )

Why extfunc and not (as it was before) devfn (same elsewhere)?
There should have been a devfn field from the beginning, even if
it's similarly uint8_t as extfunc is. As the meaning of both is different,
the correct (given context) one should be used. Existing uses of
extfunc should also be inspected and changed if necessary.

> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -80,9 +80,8 @@ struct pci_dev {
>      struct arch_msix *msix;
>  
>      struct domain *domain;
> -    const u16 seg;
> -    const u8 bus;
> -    const u8 devfn;
> +
> +    const pci_sbdf_t sbdf;

To help the transition, did you consider first making this a union of
the existing fields and the new one, next replacing used in a per
component manner (so that individual maintainers would have to
look at smaller patches each only), and finally dropping the union
and its old fields?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Jan Beulich" <JBeulich@suse.com>
To: "Roger Pau Monne" <roger.pau@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Brian Woods <brian.woods@amd.com>
Subject: Re: [Xen-devel] [PATCH 1/5] pci: use pci_sbdf_t in pci_dev
Date: Thu, 23 May 2019 09:29:44 -0600	[thread overview]
Message-ID: <5CE6BC680200007800231C8F@prv1-mh.provo.novell.com> (raw)
Message-ID: <20190523152944.bgtJa_lFqr446ixtRbscLYPLcabbyVX9M2P3JOFhscI@z> (raw)
In-Reply-To: <20190510161056.48648-2-roger.pau@citrix.com>

>>> On 10.05.19 at 18:10, <roger.pau@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/vmsi.c
> +++ b/xen/arch/x86/hvm/vmsi.c
> @@ -688,8 +688,8 @@ static int vpci_msi_update(const struct pci_dev *pdev, uint32_t data,
>          {
>              gdprintk(XENLOG_ERR,
>                       "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
> -                     pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
> -                     PCI_FUNC(pdev->devfn), pirq + i, rc);
> +                     pdev->sbdf.seg, pdev->sbdf.bus, pdev->sbdf.dev,
> +                     pdev->sbdf.func, pirq + i, rc);

I assume patch 4 could have been quite a bit smaller, and you could have
avoided touching the same places twice if that one came before the one
here.

> --- a/xen/drivers/passthrough/amd/iommu_cmd.c
> +++ b/xen/drivers/passthrough/amd/iommu_cmd.c
> @@ -289,23 +289,23 @@ void amd_iommu_flush_iotlb(u8 devfn, const struct pci_dev *pdev,
>      if ( !ats_enabled )
>          return;
>  
> -    if ( !pci_ats_enabled(pdev->seg, pdev->bus, pdev->devfn) )
> +    if ( !pci_ats_enabled(pdev->sbdf.seg, pdev->sbdf.bus, pdev->sbdf.extfunc) )

Why extfunc and not (as it was before) devfn (same elsewhere)?
There should have been a devfn field from the beginning, even if
it's similarly uint8_t as extfunc is. As the meaning of both is different,
the correct (given context) one should be used. Existing uses of
extfunc should also be inspected and changed if necessary.

> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -80,9 +80,8 @@ struct pci_dev {
>      struct arch_msix *msix;
>  
>      struct domain *domain;
> -    const u16 seg;
> -    const u8 bus;
> -    const u8 devfn;
> +
> +    const pci_sbdf_t sbdf;

To help the transition, did you consider first making this a union of
the existing fields and the new one, next replacing used in a per
component manner (so that individual maintainers would have to
look at smaller patches each only), and finally dropping the union
and its old fields?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-05-23 15:43 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 16:10 [PATCH 0/5] pci: expand usage of pci_sbdf_t Roger Pau Monne
2019-05-10 16:10 ` [Xen-devel] " Roger Pau Monne
2019-05-10 16:10 ` [PATCH 1/5] pci: use pci_sbdf_t in pci_dev Roger Pau Monne
2019-05-10 16:10   ` [Xen-devel] " Roger Pau Monne
2019-05-10 16:16   ` Andrew Cooper
2019-05-10 16:16     ` [Xen-devel] " Andrew Cooper
2019-05-13  6:25     ` Jan Beulich
2019-05-13  6:25       ` [Xen-devel] " Jan Beulich
2019-05-13  7:53       ` Roger Pau Monné
2019-05-13  7:53         ` [Xen-devel] " Roger Pau Monné
2019-05-23 15:29   ` Jan Beulich [this message]
2019-05-23 15:29     ` Jan Beulich
2019-05-27 15:51     ` Roger Pau Monné
2019-05-27 15:51       ` [Xen-devel] " Roger Pau Monné
2019-05-10 16:10 ` [PATCH 2/5] pci: use function generation macros for pci_config_{write, read}<size> Roger Pau Monne
2019-05-10 16:10   ` [Xen-devel] " Roger Pau Monne
2019-05-24  9:10   ` Jan Beulich
2019-05-24  9:10     ` [Xen-devel] " Jan Beulich
2019-05-24  9:29   ` Andrew Cooper
2019-05-24  9:29     ` [Xen-devel] " Andrew Cooper
2019-05-27 16:08     ` Roger Pau Monné
2019-05-27 16:08       ` [Xen-devel] " Roger Pau Monné
2019-05-28  8:54       ` Jan Beulich
2019-05-28  8:54         ` [Xen-devel] " Jan Beulich
2019-05-10 16:10 ` [PATCH 3/5] pci: switch pci_conf_{read/write} to use pci_sbdf_t Roger Pau Monne
2019-05-10 16:10   ` [Xen-devel] " Roger Pau Monne
2019-05-24  9:40   ` Andrew Cooper
2019-05-24  9:40     ` [Xen-devel] " Andrew Cooper
2019-05-24 10:01   ` Jan Beulich
2019-05-24 10:01     ` [Xen-devel] " Jan Beulich
2019-05-27 16:44     ` Roger Pau Monné
2019-05-27 16:44       ` [Xen-devel] " Roger Pau Monné
2019-05-28  8:51       ` Jan Beulich
2019-05-28  8:51         ` [Xen-devel] " Jan Beulich
2019-05-28 10:05         ` Roger Pau Monné
2019-05-28 10:05           ` [Xen-devel] " Roger Pau Monné
2019-05-28 10:38           ` Jan Beulich
2019-05-28 10:38             ` [Xen-devel] " Jan Beulich
2019-05-10 16:10 ` [PATCH 4/5] print: introduce a format specifier for pci_sbdf_t Roger Pau Monne
2019-05-10 16:10   ` [Xen-devel] " Roger Pau Monne
2019-05-24 10:36   ` Jan Beulich
2019-05-24 10:36     ` [Xen-devel] " Jan Beulich
2019-05-24 10:59     ` Andrew Cooper
2019-05-24 10:59       ` [Xen-devel] " Andrew Cooper
2019-05-24 11:16       ` Jan Beulich
2019-05-24 11:16         ` [Xen-devel] " Jan Beulich
2019-05-27 15:48     ` Roger Pau Monné
2019-05-27 15:48       ` [Xen-devel] " Roger Pau Monné
2019-05-27 15:58       ` Jan Beulich
2019-05-27 15:58         ` [Xen-devel] " Jan Beulich
2019-05-10 16:10 ` [PATCH 5/5] pci: switch PCI capabilities related functions to use pci_sbdf_t Roger Pau Monne
2019-05-10 16:10   ` [Xen-devel] " Roger Pau Monne
2019-05-24 10:52   ` Jan Beulich
2019-05-24 10:52     ` [Xen-devel] " Jan Beulich

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=5CE6BC680200007800231C8F@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=brian.woods@amd.com \
    --cc=julien.grall@arm.com \
    --cc=kevin.tian@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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.