diff mbox series

[2/4] hw/pci-host/prep: Remove legacy PReP machine temporary workaround

Message ID 20201012071906.3301481-3-f4bug@amsat.org
State New
Headers show
Series hw/pci-host/prep: Fix PCI swizzling in map_irq() | expand

Commit Message

Philippe Mathieu-Daudé Oct. 12, 2020, 7:19 a.m. UTC
The legacy PReP machine has been removed in commit b2ce76a0730
("hw/ppc/prep: Remove the deprecated "prep" machine and the
OpenHackware BIOS"). This temporary workaround is no more
required, remove it.

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

Comments

Thomas Huth Oct. 12, 2020, 7:28 a.m. UTC | #1
On 12/10/2020 09.19, Philippe Mathieu-Daudé wrote:
> The legacy PReP machine has been removed in commit b2ce76a0730

> ("hw/ppc/prep: Remove the deprecated "prep" machine and the

> OpenHackware BIOS"). This temporary workaround is no more

> required, remove it.

> 

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

>  hw/pci-host/prep.c | 32 +++++++++++---------------------

>  1 file changed, 11 insertions(+), 21 deletions(-)

> 

> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c

> index 80dfb67da43..064593d1e52 100644

> --- a/hw/pci-host/prep.c

> +++ b/hw/pci-host/prep.c

> @@ -75,7 +75,6 @@ struct PRePPCIState {

>      RavenPCIState pci_dev;

>  

>      int contiguous_map;

> -    bool is_legacy_prep;

>  };

>  

>  #define BIOS_SIZE (1 * MiB)

> @@ -229,24 +228,18 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)

>      MemoryRegion *address_space_mem = get_system_memory();

>      int i;

>  

> -    if (s->is_legacy_prep) {

> -        for (i = 0; i < PCI_NUM_PINS; i++) {

> -            sysbus_init_irq(dev, &s->pci_irqs[i]);

> -        }

> -    } else {

> -        /*

> -         * According to PReP specification section 6.1.6 "System Interrupt

> -         * Assignments", all PCI interrupts are routed via IRQ 15

> -         */

> -        s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

> -        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

> -                                &error_fatal);

> -        qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

> -        sysbus_init_irq(dev, &s->or_irq->out_irq);

> +    /*

> +     * According to PReP specification section 6.1.6 "System Interrupt

> +     * Assignments", all PCI interrupts are routed via IRQ 15.

> +     */


Since you're changing the indentation of these lines anyway, I think you
could also simply squash patch 1 into this one here (just a matter of taste,
though).

> +    s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

> +    object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

> +                            &error_fatal);

> +    qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

> +    sysbus_init_irq(dev, &s->or_irq->out_irq);

>  

> -        for (i = 0; i < PCI_NUM_PINS; i++) {

> -            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

> -        }

> +    for (i = 0; i < PCI_NUM_PINS; i++) {

> +        s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

>      }

>  

>      qdev_init_gpio_in(d, raven_change_gpio, 1);

> @@ -403,9 +396,6 @@ static Property raven_pcihost_properties[] = {

>      DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,

>                         EM_NONE),

>      DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),

> -    /* Temporary workaround until legacy prep machine is removed */

> -    DEFINE_PROP_BOOL("is-legacy-prep", PREPPCIState, is_legacy_prep,

> -                     false),

>      DEFINE_PROP_END_OF_LIST()

>  };

>  

> 


Reviewed-by: Thomas Huth <thuth@redhat.com>
Philippe Mathieu-Daudé Oct. 12, 2020, 8:19 a.m. UTC | #2
On 10/12/20 9:28 AM, Thomas Huth wrote:
> On 12/10/2020 09.19, Philippe Mathieu-Daudé wrote:

>> The legacy PReP machine has been removed in commit b2ce76a0730

>> ("hw/ppc/prep: Remove the deprecated "prep" machine and the

>> OpenHackware BIOS"). This temporary workaround is no more

>> required, remove it.

>>

>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>> ---

>>   hw/pci-host/prep.c | 32 +++++++++++---------------------

>>   1 file changed, 11 insertions(+), 21 deletions(-)

>>

>> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c

>> index 80dfb67da43..064593d1e52 100644

>> --- a/hw/pci-host/prep.c

>> +++ b/hw/pci-host/prep.c

>> @@ -75,7 +75,6 @@ struct PRePPCIState {

>>       RavenPCIState pci_dev;

>>   

>>       int contiguous_map;

>> -    bool is_legacy_prep;

>>   };

>>   

>>   #define BIOS_SIZE (1 * MiB)

>> @@ -229,24 +228,18 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)

>>       MemoryRegion *address_space_mem = get_system_memory();

>>       int i;

>>   

>> -    if (s->is_legacy_prep) {

>> -        for (i = 0; i < PCI_NUM_PINS; i++) {

>> -            sysbus_init_irq(dev, &s->pci_irqs[i]);

>> -        }

>> -    } else {

>> -        /*

>> -         * According to PReP specification section 6.1.6 "System Interrupt

>> -         * Assignments", all PCI interrupts are routed via IRQ 15

>> -         */

>> -        s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

>> -        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

>> -                                &error_fatal);

>> -        qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

>> -        sysbus_init_irq(dev, &s->or_irq->out_irq);

>> +    /*

>> +     * According to PReP specification section 6.1.6 "System Interrupt

>> +     * Assignments", all PCI interrupts are routed via IRQ 15.

>> +     */

> 

> Since you're changing the indentation of these lines anyway, I think you

> could also simply squash patch 1 into this one here (just a matter of taste,

> though).


Then the diff is not trivial to review :/

> 

>> +    s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

>> +    object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

>> +                            &error_fatal);

>> +    qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

>> +    sysbus_init_irq(dev, &s->or_irq->out_irq);

>>   

>> -        for (i = 0; i < PCI_NUM_PINS; i++) {

>> -            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

>> -        }

>> +    for (i = 0; i < PCI_NUM_PINS; i++) {

>> +        s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

>>       }

>>   

>>       qdev_init_gpio_in(d, raven_change_gpio, 1);

>> @@ -403,9 +396,6 @@ static Property raven_pcihost_properties[] = {

>>       DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,

>>                          EM_NONE),

>>       DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),

>> -    /* Temporary workaround until legacy prep machine is removed */

>> -    DEFINE_PROP_BOOL("is-legacy-prep", PREPPCIState, is_legacy_prep,

>> -                     false),

>>       DEFINE_PROP_END_OF_LIST()

>>   };

>>   

>>

> 

> Reviewed-by: Thomas Huth <thuth@redhat.com>


Thanks!
Mark Cave-Ayland Oct. 12, 2020, 9:29 a.m. UTC | #3
On 12/10/2020 08:19, Philippe Mathieu-Daudé wrote:

> The legacy PReP machine has been removed in commit b2ce76a0730

> ("hw/ppc/prep: Remove the deprecated "prep" machine and the

> OpenHackware BIOS"). This temporary workaround is no more

> required, remove it.

> 

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

>  hw/pci-host/prep.c | 32 +++++++++++---------------------

>  1 file changed, 11 insertions(+), 21 deletions(-)

> 

> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c

> index 80dfb67da43..064593d1e52 100644

> --- a/hw/pci-host/prep.c

> +++ b/hw/pci-host/prep.c

> @@ -75,7 +75,6 @@ struct PRePPCIState {

>      RavenPCIState pci_dev;

>  

>      int contiguous_map;

> -    bool is_legacy_prep;

>  };

>  

>  #define BIOS_SIZE (1 * MiB)

> @@ -229,24 +228,18 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)

>      MemoryRegion *address_space_mem = get_system_memory();

>      int i;

>  

> -    if (s->is_legacy_prep) {

> -        for (i = 0; i < PCI_NUM_PINS; i++) {

> -            sysbus_init_irq(dev, &s->pci_irqs[i]);

> -        }

> -    } else {

> -        /*

> -         * According to PReP specification section 6.1.6 "System Interrupt

> -         * Assignments", all PCI interrupts are routed via IRQ 15

> -         */

> -        s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

> -        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

> -                                &error_fatal);

> -        qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

> -        sysbus_init_irq(dev, &s->or_irq->out_irq);

> +    /*

> +     * According to PReP specification section 6.1.6 "System Interrupt

> +     * Assignments", all PCI interrupts are routed via IRQ 15.

> +     */

> +    s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

> +    object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

> +                            &error_fatal);

> +    qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

> +    sysbus_init_irq(dev, &s->or_irq->out_irq);

>  

> -        for (i = 0; i < PCI_NUM_PINS; i++) {

> -            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

> -        }

> +    for (i = 0; i < PCI_NUM_PINS; i++) {

> +        s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

>      }

>  

>      qdev_init_gpio_in(d, raven_change_gpio, 1);

> @@ -403,9 +396,6 @@ static Property raven_pcihost_properties[] = {

>      DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,

>                         EM_NONE),

>      DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),

> -    /* Temporary workaround until legacy prep machine is removed */

> -    DEFINE_PROP_BOOL("is-legacy-prep", PREPPCIState, is_legacy_prep,

> -                     false),

>      DEFINE_PROP_END_OF_LIST()

>  };


Yes indeed, this workaround is certainly no longer needed.

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>



ATB,

Mark.
David Gibson Nov. 2, 2020, 1:52 a.m. UTC | #4
On Mon, Oct 12, 2020 at 09:19:04AM +0200, Philippe Mathieu-Daudé wrote:
> The legacy PReP machine has been removed in commit b2ce76a0730

> ("hw/ppc/prep: Remove the deprecated "prep" machine and the

> OpenHackware BIOS"). This temporary workaround is no more

> required, remove it.

> 

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


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


> ---

>  hw/pci-host/prep.c | 32 +++++++++++---------------------

>  1 file changed, 11 insertions(+), 21 deletions(-)

> 

> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c

> index 80dfb67da43..064593d1e52 100644

> --- a/hw/pci-host/prep.c

> +++ b/hw/pci-host/prep.c

> @@ -75,7 +75,6 @@ struct PRePPCIState {

>      RavenPCIState pci_dev;

>  

>      int contiguous_map;

> -    bool is_legacy_prep;

>  };

>  

>  #define BIOS_SIZE (1 * MiB)

> @@ -229,24 +228,18 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)

>      MemoryRegion *address_space_mem = get_system_memory();

>      int i;

>  

> -    if (s->is_legacy_prep) {

> -        for (i = 0; i < PCI_NUM_PINS; i++) {

> -            sysbus_init_irq(dev, &s->pci_irqs[i]);

> -        }

> -    } else {

> -        /*

> -         * According to PReP specification section 6.1.6 "System Interrupt

> -         * Assignments", all PCI interrupts are routed via IRQ 15

> -         */

> -        s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

> -        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

> -                                &error_fatal);

> -        qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

> -        sysbus_init_irq(dev, &s->or_irq->out_irq);

> +    /*

> +     * According to PReP specification section 6.1.6 "System Interrupt

> +     * Assignments", all PCI interrupts are routed via IRQ 15.

> +     */

> +    s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));

> +    object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,

> +                            &error_fatal);

> +    qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);

> +    sysbus_init_irq(dev, &s->or_irq->out_irq);

>  

> -        for (i = 0; i < PCI_NUM_PINS; i++) {

> -            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

> -        }

> +    for (i = 0; i < PCI_NUM_PINS; i++) {

> +        s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);

>      }

>  

>      qdev_init_gpio_in(d, raven_change_gpio, 1);

> @@ -403,9 +396,6 @@ static Property raven_pcihost_properties[] = {

>      DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,

>                         EM_NONE),

>      DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),

> -    /* Temporary workaround until legacy prep machine is removed */

> -    DEFINE_PROP_BOOL("is-legacy-prep", PREPPCIState, is_legacy_prep,

> -                     false),

>      DEFINE_PROP_END_OF_LIST()

>  };

>  


-- 
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
diff mbox series

Patch

diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 80dfb67da43..064593d1e52 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -75,7 +75,6 @@  struct PRePPCIState {
     RavenPCIState pci_dev;
 
     int contiguous_map;
-    bool is_legacy_prep;
 };
 
 #define BIOS_SIZE (1 * MiB)
@@ -229,24 +228,18 @@  static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
     MemoryRegion *address_space_mem = get_system_memory();
     int i;
 
-    if (s->is_legacy_prep) {
-        for (i = 0; i < PCI_NUM_PINS; i++) {
-            sysbus_init_irq(dev, &s->pci_irqs[i]);
-        }
-    } else {
-        /*
-         * According to PReP specification section 6.1.6 "System Interrupt
-         * Assignments", all PCI interrupts are routed via IRQ 15
-         */
-        s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));
-        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,
-                                &error_fatal);
-        qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);
-        sysbus_init_irq(dev, &s->or_irq->out_irq);
+    /*
+     * According to PReP specification section 6.1.6 "System Interrupt
+     * Assignments", all PCI interrupts are routed via IRQ 15.
+     */
+    s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));
+    object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,
+                            &error_fatal);
+    qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);
+    sysbus_init_irq(dev, &s->or_irq->out_irq);
 
-        for (i = 0; i < PCI_NUM_PINS; i++) {
-            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);
-        }
+    for (i = 0; i < PCI_NUM_PINS; i++) {
+        s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);
     }
 
     qdev_init_gpio_in(d, raven_change_gpio, 1);
@@ -403,9 +396,6 @@  static Property raven_pcihost_properties[] = {
     DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,
                        EM_NONE),
     DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),
-    /* Temporary workaround until legacy prep machine is removed */
-    DEFINE_PROP_BOOL("is-legacy-prep", PREPPCIState, is_legacy_prep,
-                     false),
     DEFINE_PROP_END_OF_LIST()
 };