From nobody Tue Nov 18 10:37:46 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) client-ip=209.85.128.48; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f48.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609707040; cv=none; d=zohomail.com; s=zohoarc; b=f1Z9RKnCvpMoLqs4iS9/CWI1RWuJESpn3fluCvyfJSsx1IeYH1YQj+9LvesEfI3IHy+8XTl8PFdy7nHHM+E5KS04rlWLw+PnZ9PJ68qVE6+JqbF3B0ZOd9P4DlwpFVGi3GIxpE+0w/D1/RjYtzTsNSyvEm1OUB3FabmtKt1/6BU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609707040; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C4EjkfX/EFxfnrsxvvCHO1MOBBNeBx+9lsiUXY0oxBY=; b=Pdr95da2OHXA8Lga9y+ozeYXfQFcGYWtpCQcEYn7lA6IcUGJk48Z2HDn4S17/MKKWHHvsB1/shTAyxt+hagFoJf6CLhsre4sjhGm5z0jdGoM8/aGugJlgObgaVbvaNIRfdi73GOk4lOaD6yyfXBwgdgFLPwTVn1V/j2KOi6L+6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.zohomail.com with SMTPS id 1609707040721137.59553229825144; Sun, 3 Jan 2021 12:50:40 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id a6so15937530wmc.2 for ; Sun, 03 Jan 2021 12:50:40 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (194.red-83-57-172.dynamicip.rima-tde.net. [83.57.172.194]) by smtp.gmail.com with ESMTPSA id o74sm34756208wme.36.2021.01.03.12.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 12:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C4EjkfX/EFxfnrsxvvCHO1MOBBNeBx+9lsiUXY0oxBY=; b=M9ielLvxhirQLv/Y+w5NRoGlA6GkIftoHkwjhM9lnm/Qbd2uG7nBBvZ8Z4NZzmY+NK EBsiMH2CwudKA58g9b7Fdc5BWnn5qNZHYK58qsPzjfq3XeabHIQ08SoA+Tr5d11N7zSZ +M6VfT8hCi84wF7wYlmNPJoguY2GZ/s3MT0Ed7F9AIW9HCnX20b18cimfyCP2O5b7r9v erYdBLhaGejPd4rh/soc+zOTdvn9N5a7CFMbvrmhQmbsXhjeb9wiuwnIJZwHA4Z3Lfff b3uequalRsiZ6D6z/phw9kh/+FI+w0r4dWI4kAKJfpfv/nWvQnd0LmRQYGk1uSPhynWl EYTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=C4EjkfX/EFxfnrsxvvCHO1MOBBNeBx+9lsiUXY0oxBY=; b=EnPse05H75X87nTk6D6jcyaspiNM59H9bEH7ccH5+Apx9ED6eSJzujhbka0PSTpkah 0r8RvTvN24CgHZPW9vMfjQqRyprRN9UkMRrd04j3wIvbhnftABYUOIiMMTcZC6kGbA3E rNpWVpkvTGUlJ7J7JnUIauvlj3V5O0jK0A6Sq3/SaebD2RIXdYVcEdg5x286wEDWbdbg gndG5ZoZm6HrAkdiRUPxzmJZT4yaU3Ch/a1nBY29dtSryZELbNDcN4KFOO1cD1tvq1dd qONfDv9YM9IWmetEquVQw+x5DIt3cK2rMVMM6GoBeNV4kla76eo1ZW3n3T+JiruWLt43 JyRA== X-Gm-Message-State: AOAM533ON0QvZWM/cqfM0r87gzkHkK0SN1d5ap25PUOqemzwB0GR+2Zh 9mi07XpAQGs8cHpY8AoSLsJYKmzkKkw= X-Google-Smtp-Source: ABdhPJyxNdP6016x9Nm1dEXqiSpyXJpsbPhedFqdJ5qhWY57Udekz+W9Y6dnSunuedHDG4stxxyBWQ== X-Received: by 2002:a1c:6654:: with SMTP id a81mr23525748wmc.113.1609707038899; Sun, 03 Jan 2021 12:50:38 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Huacai Chen , Jiaxun Yang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paul Durrant , David Gibson Subject: [PULL 03/35] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' Date: Sun, 3 Jan 2021 21:49:49 +0100 Message-Id: <20210103205021.2837760-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210103205021.2837760-1-f4bug@amsat.org> References: <20210103205021.2837760-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) 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=C3=A9 Acked-by: Paul Durrant Acked-by: David Gibson Message-Id: <20201012124506.3406909-5-philmd@redhat.com> --- 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 lev= el) =20 static int dino_pci_map_irq(PCIDevice *d, int irq_num) { - int slot =3D d->devfn >> 3; + int slot =3D PCI_SLOT(d->devfn); =20 assert(irq_num >=3D 0 && irq_num <=3D 3); =20 diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 096c46fef15..68821d90f52 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -140,7 +140,7 @@ typedef struct XenIOState { =20 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); } =20 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 =3D (pci_dev->devfn >> 3) - 1; + slot_addend =3D PCI_SLOT(pci_dev->devfn) - 1; return (pci_intx + slot_addend) & 3; } =20 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; =20 - slot =3D (pci_dev->devfn >> 3); + slot =3D PCI_SLOT(pci_dev->devfn); =20 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 i= rq_num) { int slot; =20 - slot =3D (pci_dev->devfn >> 3); + slot =3D PCI_SLOT(pci_dev->devfn); =20 switch (slot) { case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC= 97 */ 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 =3D { =20 static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int pin) { - int devno =3D pci_dev->devfn >> 3; + int devno =3D PCI_SLOT(pci_dev->devfn); int ret; =20 ret =3D 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 =3D pci_dev->devfn >> 3; + int slot =3D PCI_SLOT(pci_dev->devfn); =20 trace_ppc4xx_pci_map_irq(pci_dev->devfn, irq_num, slot); =20 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 =3D { =20 static int sh_pci_map_irq(PCIDevice *d, int irq_num) { - return (d->devfn >> 3); + return PCI_SLOT(d->devfn); } =20 static void sh_pci_set_irq(void *opaque, int irq_num, int level) --=20 2.26.2