mbox series

[0/5] hw: Use PCI macros from 'hw/pci/pci.h'

Message ID 20201012124506.3406909-1-philmd@redhat.com
Headers show
Series hw: Use PCI macros from 'hw/pci/pci.h' | expand

Message

Philippe Mathieu-Daudé Oct. 12, 2020, 12:45 p.m. UTC
Trivial patches using the generic PCI macros from "hw/pci/pci.h".

Philippe Mathieu-Daudé (5):
  hw/pci-host/bonito: Make PCI_ADDR() macro more readable
  hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'
  hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'
  hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
  hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'

 hw/arm/virt.c          | 3 ++-
 hw/hppa/dino.c         | 2 +-
 hw/i386/xen/xen-hvm.c  | 2 +-
 hw/isa/piix3.c         | 2 +-
 hw/mips/gt64xxx_pci.c  | 2 +-
 hw/pci-host/bonito.c   | 5 ++---
 hw/pci-host/pnv_phb4.c | 2 +-
 hw/pci-host/ppce500.c  | 2 +-
 hw/pci-host/uninorth.c | 8 +++-----
 hw/ppc/ppc4xx_pci.c    | 2 +-
 hw/sh4/sh_pci.c        | 2 +-
 11 files changed, 15 insertions(+), 17 deletions(-)

-- 
2.26.2

Comments

Paul Durrant Oct. 12, 2020, 12:52 p.m. UTC | #1
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> Sent: 12 October 2020 13:45
> To: qemu-devel@nongnu.org
> Cc: Peter Maydell <peter.maydell@linaro.org>; qemu-ppc@nongnu.org; qemu-trivial@nongnu.org; Paul
> Durrant <paul@xen.org>; Aurelien Jarno <aurelien@aurel32.net>; qemu-arm@nongnu.org; Philippe Mathieu-
> Daudé <f4bug@amsat.org>; Michael S. Tsirkin <mst@redhat.com>; Eduardo Habkost <ehabkost@redhat.com>;
> Jiaxun Yang <jiaxun.yang@flygoat.com>; Yoshinori Sato <ysato@users.sourceforge.jp>; Cédric Le Goater
> <clg@kaod.org>; David Gibson <david@gibson.dropbear.id.au>; Stefano Stabellini
> <sstabellini@kernel.org>; Helge Deller <deller@gmx.de>; Anthony Perard <anthony.perard@citrix.com>;
> Richard Henderson <rth@twiddle.net>; Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>; xen-
> devel@lists.xenproject.org; Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>; Marcel Apfelbaum
> <marcel.apfelbaum@gmail.com>; Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>; Paolo Bonzini
> <pbonzini@redhat.com>; Huacai Chen <chenhc@lemote.com>
> Subject: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
> 
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> We already have a generic PCI_SLOT() macro in "hw/pci/pci.h"
> to extract the PCI slot identifier, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

xen-hvm change...

Acked-by: Paul Durrant <paul@xen.org>
David Gibson Oct. 13, 2020, 12:45 a.m. UTC | #2
On Mon, Oct 12, 2020 at 02:45:06PM +0200, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> We already have a generic PCI_DEVFN() macro in "hw/pci/pci.h"
> to pack the PCI slot/function identifiers, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

ppc part

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/arm/virt.c          | 3 ++-
>  hw/pci-host/uninorth.c | 6 ++----
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index e465a988d68..f601ef0798c 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1144,7 +1144,8 @@ static void create_pcie_irq_map(const VirtMachineState *vms,
>                       full_irq_map, sizeof(full_irq_map));
>  
>      qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupt-map-mask",
> -                           0x1800, 0, 0, /* devfn (PCI_SLOT(3)) */
> +                           cpu_to_be16(PCI_DEVFN(3, 0)), /* Slot 3 */
> +                           0, 0,
>                             0x7           /* PCI irq */);
>  }
>  
> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
> index c21de0ab805..f73d452bdce 100644
> --- a/hw/pci-host/uninorth.c
> +++ b/hw/pci-host/uninorth.c
> @@ -70,10 +70,8 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
>          /* ... and then convert them to x86 format */
>          /* config pointer */
>          retval = (reg & (0xff - 7)) | (addr & 7);
> -        /* slot */
> -        retval |= slot << 11;
> -        /* fn */
> -        retval |= func << 8;
> +        /* slot, fn */
> +        retval |= PCI_DEVFN(slot, func) << 8;
>      }
>  
>      trace_unin_get_config_reg(reg, addr, retval);
Philippe Mathieu-Daudé Jan. 3, 2021, 1:04 p.m. UTC | #3
On 10/12/20 2:45 PM, Philippe Mathieu-Daudé wrote:
> Trivial patches using the generic PCI macros from "hw/pci/pci.h".

> 

> Philippe Mathieu-Daudé (5):

>   hw/pci-host/bonito: Make PCI_ADDR() macro more readable

>   hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'

>   hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'

>   hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'

>   hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'


As this series are trivial and Acked, I'm going to queue
it via the mips-tree, as other reviewed patches depend
on it.

Thanks,

Phil.
Michael S. Tsirkin Jan. 4, 2021, 9:32 a.m. UTC | #4
On Sun, Jan 03, 2021 at 02:04:53PM +0100, Philippe Mathieu-Daudé wrote:
> On 10/12/20 2:45 PM, Philippe Mathieu-Daudé wrote:

> > Trivial patches using the generic PCI macros from "hw/pci/pci.h".

> > 

> > Philippe Mathieu-Daudé (5):

> >   hw/pci-host/bonito: Make PCI_ADDR() macro more readable

> >   hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'

> >   hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'

> >   hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'

> >   hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'

> 

> As this series are trivial and Acked, I'm going to queue

> it via the mips-tree, as other reviewed patches depend

> on it.

> 

> Thanks,

> 

> Phil.


Fine.
Acked-by: Michael S. Tsirkin <mst@redhat.com>