[PATCH v2 03/19] ppc/pnv: Use the chip class to check the index of PHB3 devices

Cédric Le Goater posted 19 patches 4 years, 1 month ago
[PATCH v2 03/19] ppc/pnv: Use the chip class to check the index of PHB3 devices
Posted by Cédric Le Goater 4 years, 1 month ago
The maximum number of PHB3 devices per chip can be different depending
on the POWER8 processor model.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/pci-host/pnv_phb3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index 3aa42ef9d4b9..9c4451ca0d1c 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -993,7 +993,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
     PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
     int i;
 
-    if (phb->phb_id >= PNV8_CHIP_PHB3_MAX) {
+    if (phb->phb_id >= PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) {
         error_setg(errp, "invalid PHB index: %d", phb->phb_id);
         return;
     }
-- 
2.31.1


Re: [PATCH v2 03/19] ppc/pnv: Use the chip class to check the index of PHB3 devices
Posted by Daniel Henrique Barboza 4 years, 1 month ago

On 12/13/21 10:28, Cédric Le Goater wrote:
> The maximum number of PHB3 devices per chip can be different depending
> on the POWER8 processor model.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   hw/pci-host/pnv_phb3.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
> index 3aa42ef9d4b9..9c4451ca0d1c 100644
> --- a/hw/pci-host/pnv_phb3.c
> +++ b/hw/pci-host/pnv_phb3.c
> @@ -993,7 +993,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
>       PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>       int i;
>   
> -    if (phb->phb_id >= PNV8_CHIP_PHB3_MAX) {
> +    if (phb->phb_id >= PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) {
>           error_setg(errp, "invalid PHB index: %d", phb->phb_id);
>           return;
>       }
>