All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h'
@ 2020-10-12 12:45 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Philippe Mathieu-Daudé,
	Aleksandar Rikalo, Eduardo Habkost, qemu-arm,
	Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

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




^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h'
@ 2020-10-12 12:45 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, David Gibson, Stefano Stabellini,
	Helge Deller, Anthony Perard, Richard Henderson,
	Aleksandar Markovic, xen-devel, Aleksandar Rikalo,
	Marcel Apfelbaum, Mark Cave-Ayland, Paolo Bonzini, Huacai Chen,
	Philippe Mathieu-Daudé

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




^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
  2020-10-12 12:45 ` Philippe Mathieu-Daudé
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
Rewrite it extracting the shift operation one layer.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index a99eced0657..abb3ee86769 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
-    (((funno) << 8) & 0x700) + (regno))
+    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
+    (((funno) & 0x7) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, David Gibson, Stefano Stabellini,
	Helge Deller, Anthony Perard, Richard Henderson,
	Aleksandar Markovic, xen-devel, Aleksandar Rikalo,
	Marcel Apfelbaum, Mark Cave-Ayland, Paolo Bonzini, Huacai Chen

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
Rewrite it extracting the shift operation one layer.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index a99eced0657..abb3ee86769 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
-    (((funno) << 8) & 0x700) + (regno))
+    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
+    (((funno) & 0x7) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'
  2020-10-12 12:45 ` Philippe Mathieu-Daudé
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We already have a generic PCI_BUILD_BDF() macro in "hw/pci/pci.h"
to pack these values, use it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c   | 3 +--
 hw/pci-host/pnv_phb4.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index abb3ee86769..b05295639a6 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,7 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
-    (((funno) & 0x7) << 8) + (regno))
+    ((PCI_BUILD_BDF(busno, PCI_DEVFN(devno , funno)) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 03daf40a237..6328e985f81 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -889,7 +889,7 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds)
     /* Read RTE */
     bus_num = pci_bus_num(ds->bus);
     addr = rtt & PHB_RTT_BASE_ADDRESS_MASK;
-    addr += 2 * ((bus_num << 8) | ds->devfn);
+    addr += 2 * PCI_BUILD_BDF(bus_num, ds->devfn);
     if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) {
         phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr);
         /* Set error bits ? fence ? ... */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, David Gibson, Stefano Stabellini,
	Helge Deller, Anthony Perard, Richard Henderson,
	Aleksandar Markovic, xen-devel, Aleksandar Rikalo,
	Marcel Apfelbaum, Mark Cave-Ayland, Paolo Bonzini, Huacai Chen

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We already have a generic PCI_BUILD_BDF() macro in "hw/pci/pci.h"
to pack these values, use it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c   | 3 +--
 hw/pci-host/pnv_phb4.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index abb3ee86769..b05295639a6 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,7 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
-    (((funno) & 0x7) << 8) + (regno))
+    ((PCI_BUILD_BDF(busno, PCI_DEVFN(devno , funno)) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 03daf40a237..6328e985f81 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -889,7 +889,7 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds)
     /* Read RTE */
     bus_num = pci_bus_num(ds->bus);
     addr = rtt & PHB_RTT_BASE_ADDRESS_MASK;
-    addr += 2 * ((bus_num << 8) | ds->devfn);
+    addr += 2 * PCI_BUILD_BDF(bus_num, ds->devfn);
     if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) {
         phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr);
         /* Set error bits ? fence ? ... */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'
  2020-10-12 12:45 ` Philippe Mathieu-Daudé
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We already have a generic PCI_FUNC() macro in "hw/pci/pci.h" to
extract the PCI function identifier, use it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/uninorth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 1ed1072eeb5..c21de0ab805 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -65,7 +65,7 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
         if (slot == 32) {
             slot = -1; /* XXX: should this be 0? */
         }
-        func = (reg >> 8) & 7;
+        func = PCI_FUNC(reg >> 8);
 
         /* ... and then convert them to x86 format */
         /* config pointer */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, David Gibson, Stefano Stabellini,
	Helge Deller, Anthony Perard, Richard Henderson,
	Aleksandar Markovic, xen-devel, Aleksandar Rikalo,
	Marcel Apfelbaum, Mark Cave-Ayland, Paolo Bonzini, Huacai Chen

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We already have a generic PCI_FUNC() macro in "hw/pci/pci.h" to
extract the PCI function identifier, use it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/uninorth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 1ed1072eeb5..c21de0ab805 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -65,7 +65,7 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
         if (slot == 32) {
             slot = -1; /* XXX: should this be 0? */
         }
-        func = (reg >> 8) & 7;
+        func = PCI_FUNC(reg >> 8);
 
         /* ... and then convert them to x86 format */
         /* config pointer */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
  2020-10-12 12:45 ` Philippe Mathieu-Daudé
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

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>
---
 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)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, David Gibson, Stefano Stabellini,
	Helge Deller, Anthony Perard, Richard Henderson,
	Aleksandar Markovic, xen-devel, Aleksandar Rikalo,
	Marcel Apfelbaum, Mark Cave-Ayland, Paolo Bonzini, Huacai Chen

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>
---
 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)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 5/5] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'
  2020-10-12 12:45 ` Philippe Mathieu-Daudé
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

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>
---
 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);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 5/5] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'
@ 2020-10-12 12:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, David Gibson, Stefano Stabellini,
	Helge Deller, Anthony Perard, Richard Henderson,
	Aleksandar Markovic, xen-devel, Aleksandar Rikalo,
	Marcel Apfelbaum, Mark Cave-Ayland, Paolo Bonzini, Huacai Chen

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>
---
 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);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* RE: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
  2020-10-12 12:45   ` Philippe Mathieu-Daudé
@ 2020-10-12 12:52     ` Paul Durrant
  -1 siblings, 0 replies; 30+ messages in thread
From: Paul Durrant @ 2020-10-12 12:52 UTC (permalink / raw)
  To: 'Philippe Mathieu-Daudé', qemu-devel
  Cc: 'Peter Maydell', 'Michael S. Tsirkin',
	'Mark Cave-Ayland', 'Huacai Chen',
	'Stefano Stabellini', 'Yoshinori Sato',
	qemu-trivial, 'Helge Deller',
	'Aleksandar Markovic', 'Anthony Perard',
	xen-devel, 'David Gibson', 'Aleksandar Rikalo',
	'Eduardo Habkost',
	qemu-arm, 'Cédric Le Goater',
	'Richard Henderson',
	'Philippe Mathieu-Daudé',
	qemu-ppc, 'Paolo Bonzini', 'Aurelien Jarno'

> -----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>



^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
@ 2020-10-12 12:52     ` Paul Durrant
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Durrant @ 2020-10-12 12:52 UTC (permalink / raw)
  To: 'Philippe Mathieu-Daudé', qemu-devel
  Cc: 'Peter Maydell',
	qemu-ppc, qemu-trivial, 'Aurelien Jarno',
	qemu-arm, 'Philippe Mathieu-Daudé',
	'Michael S. Tsirkin', 'Eduardo Habkost',
	'Jiaxun Yang', 'Yoshinori Sato',
	'Cédric Le Goater', 'David Gibson',
	'Stefano Stabellini', 'Helge Deller',
	'Anthony Perard', 'Richard Henderson',
	'Aleksandar Markovic',
	xen-devel, 'Aleksandar Rikalo',
	'Marcel Apfelbaum', 'Mark Cave-Ayland',
	'Paolo Bonzini', 'Huacai Chen'

> -----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>



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
  2020-10-12 12:45   ` Philippe Mathieu-Daudé
@ 2020-10-12 13:55     ` BALATON Zoltan
  -1 siblings, 0 replies; 30+ messages in thread
From: BALATON Zoltan via @ 2020-10-12 13:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Paul Durrant, qemu-devel, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]

On Mon, 12 Oct 2020, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
> Rewrite it extracting the shift operation one layer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/pci-host/bonito.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index a99eced0657..abb3ee86769 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
> #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
>
> #define PCI_ADDR(busno , devno , funno , regno)  \
> -    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
> -    (((funno) << 8) & 0x700) + (regno))
> +    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
> +    (((funno) & 0x7) << 8) + (regno))

Are you missing a << 8 somewhere before + (regno) or both of these are 
equally unreadable and I've missed something? This seems to be completely 
replaced by next patch so what's the point of this change?

Regards,
BALATON Zoltan

>
> typedef struct BonitoState BonitoState;
>
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
@ 2020-10-12 13:55     ` BALATON Zoltan
  0 siblings, 0 replies; 30+ messages in thread
From: BALATON Zoltan @ 2020-10-12 13:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, Paul Durrant, Jiaxun Yang,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Michael S. Tsirkin, Aleksandar Markovic,
	Marcel Apfelbaum, Anthony Perard, xen-devel, David Gibson,
	Aleksandar Rikalo, Eduardo Habkost, qemu-arm,
	Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]

On Mon, 12 Oct 2020, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
> Rewrite it extracting the shift operation one layer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/pci-host/bonito.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index a99eced0657..abb3ee86769 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
> #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
>
> #define PCI_ADDR(busno , devno , funno , regno)  \
> -    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
> -    (((funno) << 8) & 0x700) + (regno))
> +    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
> +    (((funno) & 0x7) << 8) + (regno))

Are you missing a << 8 somewhere before + (regno) or both of these are 
equally unreadable and I've missed something? This seems to be completely 
replaced by next patch so what's the point of this change?

Regards,
BALATON Zoltan

>
> typedef struct BonitoState BonitoState;
>
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
  2020-10-12 13:55     ` BALATON Zoltan
@ 2020-10-12 14:27       ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 14:27 UTC (permalink / raw)
  To: BALATON Zoltan
  Cc: Peter Maydell, Paul Durrant, qemu-devel, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

On 10/12/20 3:55 PM, BALATON Zoltan wrote:
> On Mon, 12 Oct 2020, Philippe Mathieu-Daudé wrote:
>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
>> Rewrite it extracting the shift operation one layer.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> hw/pci-host/bonito.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
>> index a99eced0657..abb3ee86769 100644
>> --- a/hw/pci-host/bonito.c
>> +++ b/hw/pci-host/bonito.c
>> @@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
>> #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
>>
>> #define PCI_ADDR(busno , devno , funno , regno)  \
>> -    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
>> -    (((funno) << 8) & 0x700) + (regno))
>> +    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
>> +    (((funno) & 0x7) << 8) + (regno))
> 
> Are you missing a << 8 somewhere before + (regno) or both of these are 
> equally unreadable and I've missed something? This seems to be 
> completely replaced by next patch so what's the point of this change?

I might have missed a parenthesis somewhere indeed =)

I'm happy to merge it in the next patch, I thought it would
be easier to review but it isn't.

Thanks for reviewing!

> 
> Regards,
> BALATON Zoltan
> 
>>
>> typedef struct BonitoState BonitoState;
>>
>>



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
@ 2020-10-12 14:27       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-12 14:27 UTC (permalink / raw)
  To: BALATON Zoltan
  Cc: qemu-devel, Peter Maydell, Paul Durrant, Jiaxun Yang,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Michael S. Tsirkin, Aleksandar Markovic,
	Marcel Apfelbaum, Anthony Perard, xen-devel, David Gibson,
	Aleksandar Rikalo, Eduardo Habkost, qemu-arm,
	Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

On 10/12/20 3:55 PM, BALATON Zoltan wrote:
> On Mon, 12 Oct 2020, Philippe Mathieu-Daudé wrote:
>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
>> Rewrite it extracting the shift operation one layer.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> hw/pci-host/bonito.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
>> index a99eced0657..abb3ee86769 100644
>> --- a/hw/pci-host/bonito.c
>> +++ b/hw/pci-host/bonito.c
>> @@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
>> #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
>>
>> #define PCI_ADDR(busno , devno , funno , regno)  \
>> -    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
>> -    (((funno) << 8) & 0x700) + (regno))
>> +    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
>> +    (((funno) & 0x7) << 8) + (regno))
> 
> Are you missing a << 8 somewhere before + (regno) or both of these are 
> equally unreadable and I've missed something? This seems to be 
> completely replaced by next patch so what's the point of this change?

I might have missed a parenthesis somewhere indeed =)

I'm happy to merge it in the next patch, I thought it would
be easier to review but it isn't.

Thanks for reviewing!

> 
> Regards,
> BALATON Zoltan
> 
>>
>> typedef struct BonitoState BonitoState;
>>
>>



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'
  2020-10-12 12:45   ` Philippe Mathieu-Daudé
@ 2020-10-13  0:42     ` David Gibson
  -1 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:42 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, qemu-devel,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Michael S. Tsirkin, Aleksandar Markovic,
	Anthony Perard, xen-devel, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

On Mon, Oct 12, 2020 at 02:45:03PM +0200, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> We already have a generic PCI_BUILD_BDF() macro in "hw/pci/pci.h"
> to pack these values, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

pnv part

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

> ---
>  hw/pci-host/bonito.c   | 3 +--
>  hw/pci-host/pnv_phb4.c | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index abb3ee86769..b05295639a6 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -196,8 +196,7 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
>  #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
>  
>  #define PCI_ADDR(busno , devno , funno , regno)  \
> -    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
> -    (((funno) & 0x7) << 8) + (regno))
> +    ((PCI_BUILD_BDF(busno, PCI_DEVFN(devno , funno)) << 8) + (regno))
>  
>  typedef struct BonitoState BonitoState;
>  
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 03daf40a237..6328e985f81 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -889,7 +889,7 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds)
>      /* Read RTE */
>      bus_num = pci_bus_num(ds->bus);
>      addr = rtt & PHB_RTT_BASE_ADDRESS_MASK;
> -    addr += 2 * ((bus_num << 8) | ds->devfn);
> +    addr += 2 * PCI_BUILD_BDF(bus_num, ds->devfn);
>      if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) {
>          phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr);
>          /* Set error bits ? fence ? ... */

-- 
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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h'
@ 2020-10-13  0:42     ` David Gibson
  0 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:42 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, Stefano Stabellini, Helge Deller,
	Anthony Perard, Richard Henderson, Aleksandar Markovic,
	xen-devel, Aleksandar Rikalo, Marcel Apfelbaum, Mark Cave-Ayland,
	Paolo Bonzini, Huacai Chen

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

On Mon, Oct 12, 2020 at 02:45:03PM +0200, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> We already have a generic PCI_BUILD_BDF() macro in "hw/pci/pci.h"
> to pack these values, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

pnv part

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

> ---
>  hw/pci-host/bonito.c   | 3 +--
>  hw/pci-host/pnv_phb4.c | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index abb3ee86769..b05295639a6 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -196,8 +196,7 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
>  #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
>  
>  #define PCI_ADDR(busno , devno , funno , regno)  \
> -    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
> -    (((funno) & 0x7) << 8) + (regno))
> +    ((PCI_BUILD_BDF(busno, PCI_DEVFN(devno , funno)) << 8) + (regno))
>  
>  typedef struct BonitoState BonitoState;
>  
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 03daf40a237..6328e985f81 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -889,7 +889,7 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds)
>      /* Read RTE */
>      bus_num = pci_bus_num(ds->bus);
>      addr = rtt & PHB_RTT_BASE_ADDRESS_MASK;
> -    addr += 2 * ((bus_num << 8) | ds->devfn);
> +    addr += 2 * PCI_BUILD_BDF(bus_num, ds->devfn);
>      if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) {
>          phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr);
>          /* Set error bits ? fence ? ... */

-- 
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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'
  2020-10-12 12:45   ` Philippe Mathieu-Daudé
@ 2020-10-13  0:42     ` David Gibson
  -1 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:42 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, qemu-devel,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Michael S. Tsirkin, Aleksandar Markovic,
	Anthony Perard, xen-devel, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]

On Mon, Oct 12, 2020 at 02:45:04PM +0200, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> We already have a generic PCI_FUNC() macro in "hw/pci/pci.h" to
> extract the PCI function identifier, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

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

> ---
>  hw/pci-host/uninorth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
> index 1ed1072eeb5..c21de0ab805 100644
> --- a/hw/pci-host/uninorth.c
> +++ b/hw/pci-host/uninorth.c
> @@ -65,7 +65,7 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
>          if (slot == 32) {
>              slot = -1; /* XXX: should this be 0? */
>          }
> -        func = (reg >> 8) & 7;
> +        func = PCI_FUNC(reg >> 8);
>  
>          /* ... and then convert them to x86 format */
>          /* config pointer */

-- 
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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h'
@ 2020-10-13  0:42     ` David Gibson
  0 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:42 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, Stefano Stabellini, Helge Deller,
	Anthony Perard, Richard Henderson, Aleksandar Markovic,
	xen-devel, Aleksandar Rikalo, Marcel Apfelbaum, Mark Cave-Ayland,
	Paolo Bonzini, Huacai Chen

[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]

On Mon, Oct 12, 2020 at 02:45:04PM +0200, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> We already have a generic PCI_FUNC() macro in "hw/pci/pci.h" to
> extract the PCI function identifier, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

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

> ---
>  hw/pci-host/uninorth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
> index 1ed1072eeb5..c21de0ab805 100644
> --- a/hw/pci-host/uninorth.c
> +++ b/hw/pci-host/uninorth.c
> @@ -65,7 +65,7 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
>          if (slot == 32) {
>              slot = -1; /* XXX: should this be 0? */
>          }
> -        func = (reg >> 8) & 7;
> +        func = PCI_FUNC(reg >> 8);
>  
>          /* ... and then convert them to x86 format */
>          /* config pointer */

-- 
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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
  2020-10-12 12:45   ` Philippe Mathieu-Daudé
@ 2020-10-13  0:43     ` David Gibson
  -1 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, qemu-devel,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Michael S. Tsirkin, Aleksandar Markovic,
	Anthony Perard, xen-devel, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

[-- 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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h'
@ 2020-10-13  0:43     ` David Gibson
  0 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, Stefano Stabellini, Helge Deller,
	Anthony Perard, Richard Henderson, Aleksandar Markovic,
	xen-devel, Aleksandar Rikalo, Marcel Apfelbaum, Mark Cave-Ayland,
	Paolo Bonzini, Huacai Chen

[-- 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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 5/5] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'
  2020-10-12 12:45   ` Philippe Mathieu-Daudé
@ 2020-10-13  0:45     ` David Gibson
  -1 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, qemu-devel,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Michael S. Tsirkin, Aleksandar Markovic,
	Anthony Perard, xen-devel, Aleksandar Rikalo, Eduardo Habkost,
	qemu-arm, Cédric Le Goater, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-ppc, Paolo Bonzini, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]

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);

-- 
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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 5/5] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h'
@ 2020-10-13  0:45     ` David Gibson
  0 siblings, 0 replies; 30+ messages in thread
From: David Gibson @ 2020-10-13  0:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Eduardo Habkost, Jiaxun Yang, Yoshinori Sato,
	Cédric Le Goater, Stefano Stabellini, Helge Deller,
	Anthony Perard, Richard Henderson, Aleksandar Markovic,
	xen-devel, Aleksandar Rikalo, Marcel Apfelbaum, Mark Cave-Ayland,
	Paolo Bonzini, Huacai Chen

[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]

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);

-- 
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 --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h'
  2020-10-12 12:45 ` Philippe Mathieu-Daudé
@ 2021-01-03 13:04   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-03 13:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, Huacai Chen,
	Stefano Stabellini, Yoshinori Sato, qemu-trivial, Helge Deller,
	Michael S. Tsirkin, Aleksandar Markovic, Anthony Perard,
	xen-devel, David Gibson, Philippe Mathieu-Daudé,
	Aleksandar Rikalo, Eduardo Habkost, qemu-arm,
	Cédric Le Goater, Richard Henderson, qemu-ppc,
	Paolo Bonzini, Aurelien Jarno

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.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h'
@ 2021-01-03 13:04   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-03 13:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Michael S. Tsirkin, Eduardo Habkost,
	Jiaxun Yang, Yoshinori Sato, Cédric Le Goater, David Gibson,
	Stefano Stabellini, Helge Deller, Anthony Perard,
	Richard Henderson, Aleksandar Markovic, xen-devel,
	Aleksandar Rikalo, Marcel Apfelbaum, Mark Cave-Ayland,
	Paolo Bonzini, Huacai Chen, Philippe Mathieu-Daudé

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.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h'
  2021-01-03 13:04   ` Philippe Mathieu-Daudé
@ 2021-01-04  9:32     ` Michael S. Tsirkin
  -1 siblings, 0 replies; 30+ messages in thread
From: Michael S. Tsirkin @ 2021-01-04  9:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Paul Durrant, Mark Cave-Ayland, qemu-devel,
	Huacai Chen, Stefano Stabellini, Yoshinori Sato, qemu-trivial,
	Helge Deller, Aleksandar Markovic, Anthony Perard, xen-devel,
	David Gibson, Philippe Mathieu-Daudé,
	Aleksandar Rikalo, Eduardo Habkost, qemu-arm,
	Cédric Le Goater, Richard Henderson, qemu-ppc,
	Paolo Bonzini, Aurelien Jarno

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>



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h'
@ 2021-01-04  9:32     ` Michael S. Tsirkin
  0 siblings, 0 replies; 30+ messages in thread
From: Michael S. Tsirkin @ 2021-01-04  9:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, qemu-ppc, qemu-trivial, Paul Durrant,
	Aurelien Jarno, qemu-arm, Eduardo Habkost, Jiaxun Yang,
	Yoshinori Sato, Cédric Le Goater, David Gibson,
	Stefano Stabellini, Helge Deller, Anthony Perard,
	Richard Henderson, Aleksandar Markovic, xen-devel,
	Aleksandar Rikalo, Marcel Apfelbaum, Mark Cave-Ayland,
	Paolo Bonzini, Huacai Chen, Philippe Mathieu-Daudé

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>



^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2021-01-04  9:34 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` 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 12:45   ` Philippe Mathieu-Daudé
2020-10-12 13:55   ` BALATON Zoltan via
2020-10-12 13:55     ` BALATON Zoltan
2020-10-12 14:27     ` Philippe Mathieu-Daudé
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-12 12:45   ` Philippe Mathieu-Daudé
2020-10-13  0:42   ` David Gibson
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-12 12:45   ` Philippe Mathieu-Daudé
2020-10-13  0:42   ` David Gibson
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:45   ` Philippe Mathieu-Daudé
2020-10-12 12:52   ` Paul Durrant
2020-10-12 12:52     ` Paul Durrant
2020-10-13  0:43   ` David Gibson
2020-10-13  0:43     ` David Gibson
2020-10-12 12:45 ` [PATCH 5/5] hw: Use the PCI_DEVFN() " Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-13  0:45   ` David Gibson
2020-10-13  0:45     ` David Gibson
2021-01-03 13:04 ` [PATCH 0/5] hw: Use PCI macros " Philippe Mathieu-Daudé
2021-01-03 13:04   ` Philippe Mathieu-Daudé
2021-01-04  9:32   ` Michael S. Tsirkin
2021-01-04  9:32     ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.