Message ID | 20190606090146.77381-5-roger.pau@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | pci: expand usage of pci_sbdf_t | expand |
> -----Original Message----- > From: Xen-devel [mailto:xen-devel-bounces@lists.xenproject.org] On Behalf Of Roger Pau Monne > Sent: 06 June 2019 10:02 > To: xen-devel@lists.xenproject.org > Cc: Kevin Tian <kevin.tian@intel.com>; Stefano Stabellini <sstabellini@kernel.org>; Wei Liu > <wl@xen.org>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; George Dunlap > <George.Dunlap@citrix.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Ian Jackson > <Ian.Jackson@citrix.com>; Tim (Xen.org) <tim@xen.org>; Julien Grall <julien.grall@arm.com>; Jan > Beulich <jbeulich@suse.com>; Roger Pau Monne <roger.pau@citrix.com> > Subject: [Xen-devel] [PATCH v2 04/12] pci: make PCI_SBDF2 return a pci_sbdf_t > > And fix it's only caller. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > --- > Cc: Kevin Tian <kevin.tian@intel.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > Cc: George Dunlap <George.Dunlap@eu.citrix.com> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Julien Grall <julien.grall@arm.com> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Stefano Stabellini <sstabellini@kernel.org> > Cc: Tim Deegan <tim@xen.org> > Cc: Wei Liu <wl@xen.org> > --- > xen/drivers/passthrough/vtd/dmar.c | 2 +- > xen/include/xen/pci.h | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c > index 59a46cd1c6..b858fe7c80 100644 > --- a/xen/drivers/passthrough/vtd/dmar.c > +++ b/xen/drivers/passthrough/vtd/dmar.c > @@ -1047,7 +1047,7 @@ int intel_iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt) > > rc = func(PFN_DOWN(rmrr->base_address), > PFN_UP(rmrr->end_address) - PFN_DOWN(rmrr->base_address), > - PCI_SBDF2(rmrr->segment, bdf), ctxt); > + PCI_SBDF2(rmrr->segment, bdf).sbdf, ctxt); > > if ( unlikely(rc < 0) ) > return rc; > diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h > index 9ea41789d0..30afaca838 100644 > --- a/xen/include/xen/pci.h > +++ b/xen/include/xen/pci.h > @@ -36,7 +36,8 @@ > #define PCI_BDF2(b,df) ((((b) & 0xff) << 8) | ((df) & 0xff)) > #define PCI_SBDF(s,b,d,f) \ > ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | PCI_BDF(b,d,f) }) > -#define PCI_SBDF2(s,bdf) ((((s) & 0xffff) << 16) | ((bdf) & 0xffff)) > +#define PCI_SBDF2(s,bdf) \ > + ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | ((bdf) & 0xffff) }) Perhaps... ((pci_sbdf_t) { .seg = s, .bdf = bdf }) > #define PCI_SBDF3(s,b,df) ((((s) & 0xffff) << 16) | PCI_BDF2(b, df)) > > typedef union { > -- > 2.20.1 (Apple Git-117) > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xenproject.org > https://lists.xenproject.org/mailman/listinfo/xen-devel
On Thu, Jun 06, 2019 at 01:22:30PM +0200, Paul Durrant wrote: > > -----Original Message----- > > From: Xen-devel [mailto:xen-devel-bounces@lists.xenproject.org] On Behalf Of Roger Pau Monne > > Sent: 06 June 2019 10:02 > > To: xen-devel@lists.xenproject.org > > Cc: Kevin Tian <kevin.tian@intel.com>; Stefano Stabellini <sstabellini@kernel.org>; Wei Liu > > <wl@xen.org>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; George Dunlap > > <George.Dunlap@citrix.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Ian Jackson > > <Ian.Jackson@citrix.com>; Tim (Xen.org) <tim@xen.org>; Julien Grall <julien.grall@arm.com>; Jan > > Beulich <jbeulich@suse.com>; Roger Pau Monne <roger.pau@citrix.com> > > Subject: [Xen-devel] [PATCH v2 04/12] pci: make PCI_SBDF2 return a pci_sbdf_t > > > > And fix it's only caller. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > --- > > Cc: Kevin Tian <kevin.tian@intel.com> > > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > > Cc: George Dunlap <George.Dunlap@eu.citrix.com> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > > Cc: Jan Beulich <jbeulich@suse.com> > > Cc: Julien Grall <julien.grall@arm.com> > > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > Cc: Stefano Stabellini <sstabellini@kernel.org> > > Cc: Tim Deegan <tim@xen.org> > > Cc: Wei Liu <wl@xen.org> > > --- > > xen/drivers/passthrough/vtd/dmar.c | 2 +- > > xen/include/xen/pci.h | 3 ++- > > 2 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c > > index 59a46cd1c6..b858fe7c80 100644 > > --- a/xen/drivers/passthrough/vtd/dmar.c > > +++ b/xen/drivers/passthrough/vtd/dmar.c > > @@ -1047,7 +1047,7 @@ int intel_iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt) > > > > rc = func(PFN_DOWN(rmrr->base_address), > > PFN_UP(rmrr->end_address) - PFN_DOWN(rmrr->base_address), > > - PCI_SBDF2(rmrr->segment, bdf), ctxt); > > + PCI_SBDF2(rmrr->segment, bdf).sbdf, ctxt); > > > > if ( unlikely(rc < 0) ) > > return rc; > > diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h > > index 9ea41789d0..30afaca838 100644 > > --- a/xen/include/xen/pci.h > > +++ b/xen/include/xen/pci.h > > @@ -36,7 +36,8 @@ > > #define PCI_BDF2(b,df) ((((b) & 0xff) << 8) | ((df) & 0xff)) > > #define PCI_SBDF(s,b,d,f) \ > > ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | PCI_BDF(b,d,f) }) > > -#define PCI_SBDF2(s,bdf) ((((s) & 0xffff) << 16) | ((bdf) & 0xffff)) > > +#define PCI_SBDF2(s,bdf) \ > > + ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | ((bdf) & 0xffff) }) > > Perhaps... > > ((pci_sbdf_t) { .seg = s, .bdf = bdf }) That I'm afraid won't work with older versions of gcc. Thanks, Roger.
> -----Original Message----- > From: Roger Pau Monne > Sent: 06 June 2019 17:28 > To: Paul Durrant <Paul.Durrant@citrix.com> > Cc: xen-devel@lists.xenproject.org; Kevin Tian <kevin.tian@intel.com>; Stefano Stabellini > <sstabellini@kernel.org>; Wei Liu <wl@xen.org>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; George > Dunlap <George.Dunlap@citrix.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Ian Jackson > <Ian.Jackson@citrix.com>; Tim (Xen.org) <tim@xen.org>; Julien Grall <julien.grall@arm.com>; Jan > Beulich <jbeulich@suse.com> > Subject: Re: [Xen-devel] [PATCH v2 04/12] pci: make PCI_SBDF2 return a pci_sbdf_t > > On Thu, Jun 06, 2019 at 01:22:30PM +0200, Paul Durrant wrote: > > > -----Original Message----- > > > From: Xen-devel [mailto:xen-devel-bounces@lists.xenproject.org] On Behalf Of Roger Pau Monne > > > Sent: 06 June 2019 10:02 > > > To: xen-devel@lists.xenproject.org > > > Cc: Kevin Tian <kevin.tian@intel.com>; Stefano Stabellini <sstabellini@kernel.org>; Wei Liu > > > <wl@xen.org>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; George Dunlap > > > <George.Dunlap@citrix.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Ian Jackson > > > <Ian.Jackson@citrix.com>; Tim (Xen.org) <tim@xen.org>; Julien Grall <julien.grall@arm.com>; Jan > > > Beulich <jbeulich@suse.com>; Roger Pau Monne <roger.pau@citrix.com> > > > Subject: [Xen-devel] [PATCH v2 04/12] pci: make PCI_SBDF2 return a pci_sbdf_t > > > > > > And fix it's only caller. > > > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > > --- > > > Cc: Kevin Tian <kevin.tian@intel.com> > > > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > > > Cc: George Dunlap <George.Dunlap@eu.citrix.com> > > > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > > > Cc: Jan Beulich <jbeulich@suse.com> > > > Cc: Julien Grall <julien.grall@arm.com> > > > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > > Cc: Stefano Stabellini <sstabellini@kernel.org> > > > Cc: Tim Deegan <tim@xen.org> > > > Cc: Wei Liu <wl@xen.org> > > > --- > > > xen/drivers/passthrough/vtd/dmar.c | 2 +- > > > xen/include/xen/pci.h | 3 ++- > > > 2 files changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c > > > index 59a46cd1c6..b858fe7c80 100644 > > > --- a/xen/drivers/passthrough/vtd/dmar.c > > > +++ b/xen/drivers/passthrough/vtd/dmar.c > > > @@ -1047,7 +1047,7 @@ int intel_iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt) > > > > > > rc = func(PFN_DOWN(rmrr->base_address), > > > PFN_UP(rmrr->end_address) - PFN_DOWN(rmrr->base_address), > > > - PCI_SBDF2(rmrr->segment, bdf), ctxt); > > > + PCI_SBDF2(rmrr->segment, bdf).sbdf, ctxt); > > > > > > if ( unlikely(rc < 0) ) > > > return rc; > > > diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h > > > index 9ea41789d0..30afaca838 100644 > > > --- a/xen/include/xen/pci.h > > > +++ b/xen/include/xen/pci.h > > > @@ -36,7 +36,8 @@ > > > #define PCI_BDF2(b,df) ((((b) & 0xff) << 8) | ((df) & 0xff)) > > > #define PCI_SBDF(s,b,d,f) \ > > > ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | PCI_BDF(b,d,f) }) > > > -#define PCI_SBDF2(s,bdf) ((((s) & 0xffff) << 16) | ((bdf) & 0xffff)) > > > +#define PCI_SBDF2(s,bdf) \ > > > + ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | ((bdf) & 0xffff) }) > > > > Perhaps... > > > > ((pci_sbdf_t) { .seg = s, .bdf = bdf }) > > That I'm afraid won't work with older versions of gcc. > Yeah, I guessed that would be the case after Jan's reply on patch #3. Shame though. Paul > Thanks, Roger.
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 59a46cd1c6..b858fe7c80 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -1047,7 +1047,7 @@ int intel_iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt) rc = func(PFN_DOWN(rmrr->base_address), PFN_UP(rmrr->end_address) - PFN_DOWN(rmrr->base_address), - PCI_SBDF2(rmrr->segment, bdf), ctxt); + PCI_SBDF2(rmrr->segment, bdf).sbdf, ctxt); if ( unlikely(rc < 0) ) return rc; diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h index 9ea41789d0..30afaca838 100644 --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -36,7 +36,8 @@ #define PCI_BDF2(b,df) ((((b) & 0xff) << 8) | ((df) & 0xff)) #define PCI_SBDF(s,b,d,f) \ ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | PCI_BDF(b,d,f) }) -#define PCI_SBDF2(s,bdf) ((((s) & 0xffff) << 16) | ((bdf) & 0xffff)) +#define PCI_SBDF2(s,bdf) \ + ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | ((bdf) & 0xffff) }) #define PCI_SBDF3(s,b,df) ((((s) & 0xffff) << 16) | PCI_BDF2(b, df)) typedef union {
And fix it's only caller. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Kevin Tian <kevin.tian@intel.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: George Dunlap <George.Dunlap@eu.citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Julien Grall <julien.grall@arm.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Tim Deegan <tim@xen.org> Cc: Wei Liu <wl@xen.org> --- xen/drivers/passthrough/vtd/dmar.c | 2 +- xen/include/xen/pci.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)