[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 01/13] pci: rename func field to fn



> -----Original Message-----
> From: Roger Pau Monne [mailto:roger.pau@xxxxxxxxxx]
> Sent: 07 June 2019 10:22
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>; Paul Durrant 
> <Paul.Durrant@xxxxxxxxxx>; Jan Beulich
> <jbeulich@xxxxxxxx>; Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; George Dunlap
> <George.Dunlap@xxxxxxxxxx>; Ian Jackson <Ian.Jackson@xxxxxxxxxx>; Julien 
> Grall <julien.grall@xxxxxxx>;
> Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>; Stefano Stabellini 
> <sstabellini@xxxxxxxxxx>; Tim
> (Xen.org) <tim@xxxxxxx>; Wei Liu <wl@xxxxxxx>
> Subject: [PATCH v3 01/13] pci: rename func field to fn
> 
> In preparation for adding a devfn field. This makes the naming more
> consistent, as the devfn field encloses both the dev and the fn
> fields.
> 
> No functional change intended.
> 
> Requested-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Julien Grall <julien.grall@xxxxxxx>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Tim Deegan <tim@xxxxxxx>
> Cc: Wei Liu <wl@xxxxxxx>
> ---
> Changes since v2:
>  - New in this version.
> ---
>  xen/drivers/passthrough/pci.c | 18 +++++++++---------
>  xen/drivers/vpci/vpci.c       | 28 ++++++++++++++--------------
>  xen/include/xen/pci.h         |  2 +-
>  3 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 20bfa971a9..535c7e511b 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -644,7 +644,7 @@ unsigned int pci_size_mem_bar(pci_sbdf_t sbdf, unsigned 
> int pos,
>                                unsigned int flags)
>  {
>      uint32_t hi = 0, bar = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev,
> -                                           sbdf.func, pos);
> +                                           sbdf.fn, pos);
>      uint64_t size;
>      bool is64bits = !(flags & PCI_BAR_ROM) &&
>          (bar & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == 
> PCI_BASE_ADDRESS_MEM_TYPE_64;
> @@ -654,7 +654,7 @@ unsigned int pci_size_mem_bar(pci_sbdf_t sbdf, unsigned 
> int pos,
>      ASSERT(!((flags & PCI_BAR_VF) && (flags & PCI_BAR_ROM)));
>      ASSERT((flags & PCI_BAR_ROM) ||
>             (bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY);
> -    pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, pos, ~0);
> +    pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, pos, ~0);
>      if ( is64bits )
>      {
>          if ( flags & PCI_BAR_LAST )
> @@ -662,24 +662,24 @@ unsigned int pci_size_mem_bar(pci_sbdf_t sbdf, unsigned 
> int pos,
>              printk(XENLOG_WARNING
>                     "%sdevice %04x:%02x:%02x.%u with 64-bit %sBAR in last 
> slot\n",
>                     (flags & PCI_BAR_VF) ? "SR-IOV " : "", sbdf.seg, sbdf.bus,
> -                   sbdf.dev, sbdf.func, (flags & PCI_BAR_VF) ? "vf " : "");
> +                   sbdf.dev, sbdf.fn, (flags & PCI_BAR_VF) ? "vf " : "");
>              *psize = 0;
>              return 1;
>          }
> -        hi = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, pos + 
> 4);
> -        pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, pos + 4, 
> ~0);
> +        hi = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, pos + 4);
> +        pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, pos + 4, ~0);
>      }
> -    size = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func,
> +    size = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn,
>                             pos) & mask;
>      if ( is64bits )
>      {
>          size |= (uint64_t)pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev,
> -                                          sbdf.func, pos + 4) << 32;
> -        pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, pos + 4, 
> hi);
> +                                          sbdf.fn, pos + 4) << 32;
> +        pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, pos + 4, hi);
>      }
>      else if ( size )
>          size |= (uint64_t)~0 << 32;
> -    pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, pos, bar);
> +    pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, pos, bar);
>      size = -size;
> 
>      if ( paddr )
> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
> index 82607bdb9a..b03232fe30 100644
> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -212,7 +212,7 @@ static uint32_t vpci_read_hw(pci_sbdf_t sbdf, unsigned 
> int reg,
>      switch ( size )
>      {
>      case 4:
> -        data = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg);
> +        data = pci_conf_read32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg);
>          break;
> 
>      case 3:
> @@ -222,26 +222,26 @@ static uint32_t vpci_read_hw(pci_sbdf_t sbdf, unsigned 
> int reg,
>           */
>          if ( reg & 1 )
>          {
> -            data = pci_conf_read8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func,
> +            data = pci_conf_read8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn,
>                                    reg);
> -            data |= pci_conf_read16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func,
> +            data |= pci_conf_read16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn,
>                                      reg + 1) << 8;
>          }
>          else
>          {
> -            data = pci_conf_read16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func,
> +            data = pci_conf_read16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn,
>                                     reg);
> -            data |= pci_conf_read8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func,
> +            data |= pci_conf_read8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn,
>                                     reg + 2) << 16;
>          }
>          break;
> 
>      case 2:
> -        data = pci_conf_read16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg);
> +        data = pci_conf_read16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg);
>          break;
> 
>      case 1:
> -        data = pci_conf_read8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg);
> +        data = pci_conf_read8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg);
>          break;
> 
>      default:
> @@ -259,7 +259,7 @@ static void vpci_write_hw(pci_sbdf_t sbdf, unsigned int 
> reg, unsigned int size,
>      switch ( size )
>      {
>      case 4:
> -        pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg, data);
> +        pci_conf_write32(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg, data);
>          break;
> 
>      case 3:
> @@ -269,26 +269,26 @@ static void vpci_write_hw(pci_sbdf_t sbdf, unsigned int 
> reg, unsigned int size,
>           */
>          if ( reg & 1 )
>          {
> -            pci_conf_write8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg,
> +            pci_conf_write8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg,
>                              data);
> -            pci_conf_write16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg + 
> 1,
> +            pci_conf_write16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg + 1,
>                               data >> 8);
>          }
>          else
>          {
> -            pci_conf_write16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg,
> +            pci_conf_write16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg,
>                               data);
> -            pci_conf_write8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg + 2,
> +            pci_conf_write8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg + 2,
>                              data >> 16);
>          }
>          break;
> 
>      case 2:
> -        pci_conf_write16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg, data);
> +        pci_conf_write16(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg, data);
>          break;
> 
>      case 1:
> -        pci_conf_write8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.func, reg, data);
> +        pci_conf_write8(sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn, reg, data);
>          break;
> 
>      default:
> diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
> index 53f50d89e7..dab1a86dd4 100644
> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -46,7 +46,7 @@ typedef union {
>              struct {
>                  union {
>                      struct {
> -                        uint8_t func : 3,
> +                        uint8_t fn   : 3,
>                                  dev  : 5;
>                      };
>                      uint8_t     extfunc;
> --
> 2.20.1 (Apple Git-117)

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.