From: David Gibson <david@gibson.dropbear.id.au>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Paul Durrant" <paul@xen.org>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, "Huacai Chen" <chenhc@lemote.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
qemu-trivial@nongnu.org, "Helge Deller" <deller@gmx.de>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
"Anthony Perard" <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
"Richard Henderson" <rth@twiddle.net>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
Date: Tue, 13 Oct 2020 11:43:30 +1100 [thread overview]
Message-ID: <20201013004330.GI71119@yekko.fritz.box> (raw)
In-Reply-To: <20201012124506.3406909-5-philmd@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 4533 bytes --]
On Mon, Oct 12, 2020 at 02:45:05PM +0200, Philippe Mathieu-Daudé wrote:
> 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>
ppc parts
Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> 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 | 2 +-
> hw/pci-host/ppce500.c | 2 +-
> hw/ppc/ppc4xx_pci.c | 2 +-
> hw/sh4/sh_pci.c | 2 +-
> 8 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
> index 81053b5fb64..5b82c9440d1 100644
> --- a/hw/hppa/dino.c
> +++ b/hw/hppa/dino.c
> @@ -496,7 +496,7 @@ static void dino_set_irq(void *opaque, int irq, int level)
>
> static int dino_pci_map_irq(PCIDevice *d, int irq_num)
> {
> - int slot = d->devfn >> 3;
> + int slot = PCI_SLOT(d->devfn);
>
> assert(irq_num >= 0 && irq_num <= 3);
>
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index f3ababf33b6..276254e6ca9 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -140,7 +140,7 @@ typedef struct XenIOState {
>
> int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
> {
> - return irq_num + ((pci_dev->devfn >> 3) << 2);
> + return irq_num + (PCI_SLOT(pci_dev->devfn) << 2);
> }
>
> void xen_piix3_set_irq(void *opaque, int irq_num, int level)
> diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
> index 587850b8881..f46ccae25cf 100644
> --- a/hw/isa/piix3.c
> +++ b/hw/isa/piix3.c
> @@ -361,7 +361,7 @@ type_init(piix3_register_types)
> static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
> {
> int slot_addend;
> - slot_addend = (pci_dev->devfn >> 3) - 1;
> + slot_addend = PCI_SLOT(pci_dev->devfn) - 1;
> return (pci_intx + slot_addend) & 3;
> }
>
> diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
> index e091bc4ed55..588e6f99301 100644
> --- a/hw/mips/gt64xxx_pci.c
> +++ b/hw/mips/gt64xxx_pci.c
> @@ -982,7 +982,7 @@ static int gt64120_pci_map_irq(PCIDevice *pci_dev, int irq_num)
> {
> int slot;
>
> - slot = (pci_dev->devfn >> 3);
> + slot = PCI_SLOT(pci_dev->devfn);
>
> switch (slot) {
> /* PIIX4 USB */
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index b05295639a6..ee8b193e15b 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -570,7 +570,7 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
> {
> int slot;
>
> - slot = (pci_dev->devfn >> 3);
> + slot = PCI_SLOT(pci_dev->devfn);
>
> switch (slot) {
> case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
> diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
> index 9517aab913e..5ad1424b31a 100644
> --- a/hw/pci-host/ppce500.c
> +++ b/hw/pci-host/ppce500.c
> @@ -342,7 +342,7 @@ static const MemoryRegionOps e500_pci_reg_ops = {
>
> static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int pin)
> {
> - int devno = pci_dev->devfn >> 3;
> + int devno = PCI_SLOT(pci_dev->devfn);
> int ret;
>
> ret = ppce500_pci_map_irq_slot(devno, pin);
> diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
> index 28724c06f88..e8789f64e80 100644
> --- a/hw/ppc/ppc4xx_pci.c
> +++ b/hw/ppc/ppc4xx_pci.c
> @@ -243,7 +243,7 @@ static void ppc4xx_pci_reset(void *opaque)
> * may need further refactoring for other boards. */
> static int ppc4xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
> {
> - int slot = pci_dev->devfn >> 3;
> + int slot = PCI_SLOT(pci_dev->devfn);
>
> trace_ppc4xx_pci_map_irq(pci_dev->devfn, irq_num, slot);
>
> diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
> index 73d2d0bccb0..734892f47c7 100644
> --- a/hw/sh4/sh_pci.c
> +++ b/hw/sh4/sh_pci.c
> @@ -109,7 +109,7 @@ static const MemoryRegionOps sh_pci_reg_ops = {
>
> static int sh_pci_map_irq(PCIDevice *d, int irq_num)
> {
> - return (d->devfn >> 3);
> + return PCI_SLOT(d->devfn);
> }
>
> static void sh_pci_set_irq(void *opaque, int irq_num, int level)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-10-13 0:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 12:45 [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h' Philippe Mathieu-Daudé
2020-10-12 12:45 ` [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable Philippe Mathieu-Daudé
2020-10-12 13:55 ` BALATON Zoltan via
2020-10-12 14:27 ` Philippe Mathieu-Daudé
2020-10-12 12:45 ` [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h' Philippe Mathieu-Daudé
2020-10-13 0:42 ` David Gibson
2020-10-12 12:45 ` [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() " Philippe Mathieu-Daudé
2020-10-13 0:42 ` David Gibson
2020-10-12 12:45 ` [PATCH 4/5] hw: Use the PCI_SLOT() " Philippe Mathieu-Daudé
2020-10-12 12:52 ` Paul Durrant
2020-10-13 0:43 ` David Gibson [this message]
2020-10-12 12:45 ` [PATCH 5/5] hw: Use the PCI_DEVFN() " Philippe Mathieu-Daudé
2020-10-13 0:45 ` David Gibson
2021-01-03 13:04 ` [PATCH 0/5] hw: Use PCI macros " Philippe Mathieu-Daudé
2021-01-04 9:32 ` Michael S. Tsirkin
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=20201013004330.GI71119@yekko.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=anthony.perard@citrix.com \
--cc=aurelien@aurel32.net \
--cc=chenhc@lemote.com \
--cc=clg@kaod.org \
--cc=deller@gmx.de \
--cc=ehabkost@redhat.com \
--cc=f4bug@amsat.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=rth@twiddle.net \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=ysato@users.sourceforge.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).