[PATCH 0/3] malta: Move PCI interrupt handling from gt64xxx to piix4

Bernhard Beschow posted 3 patches 2 years, 3 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220112213629.9126-1-shentey@gmail.com
Maintainers: Aurelien Jarno <aurelien@aurel32.net>, Peter Maydell <peter.maydell@linaro.org>, Yoshinori Sato <ysato@users.sourceforge.jp>, "Hervé Poussineau" <hpoussin@reactos.org>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, BALATON Zoltan <balaton@eik.bme.hu>, Magnus Damm <magnus.damm@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>
hw/isa/piix4.c                | 62 ++++++++++++++++++++++++++++++++---
hw/mips/gt64xxx_pci.c         | 62 +++--------------------------------
hw/mips/malta.c               |  6 +---
hw/pci-host/sh_pci.c          |  6 ++--
hw/pci-host/versatile.c       |  6 ++--
hw/ppc/ppc440_pcix.c          |  6 ++--
hw/ppc/ppc4xx_pci.c           |  6 ++--
include/hw/mips/mips.h        |  2 +-
include/hw/southbridge/piix.h |  2 --
9 files changed, 77 insertions(+), 81 deletions(-)
[PATCH 0/3] malta: Move PCI interrupt handling from gt64xxx to piix4
Posted by Bernhard Beschow 2 years, 3 months ago
Hi,

first-time contributor here. Inspired by an article in LWN [1] I figured I'd
get my hands dirty with QEMU development. According to the article my goal is
to eliminate some "accidental complexity".

While studying the code I noticed some (accidental?) differences between piix3
and piix4 where the PCI interrupts are handled. Moreover, I noticed presence of
global variables in piix4 which probably constitute a limitation of QOM's idea
of configuration-driven machine creation. By applying piix3 concepts, i.e.
moving the interrupt handling from gt64xxx to piix4, it's possible to both
eliminate the differences and resolve the global variables.

The patch series is structured as follows: Patch 1 eliminates the differences,
patch 3 resolves the global variables. Patch 2 is a preparation for patch 3.
Some of my further comments regarding the patches are:

Patch 1:
* pci_slot_get_pirq() looks quite malta-specific. Neither gt64xxx nor piix4
  seem to be the perfect fit. So I moved it to piix4, analogous to piix3.
* The i8259 property moved from MaltaState to PIIX4State looks quite redundant
  to the isa property. Could isa be used instead, eliminating i8259?

Patch 2:
* Besides piix4, there were four further cases where the PIC array was passed
  as the opaque parameter to the pci_map_irq_fn's. AFAICS in all other cases
  the DeviceState is passed instead. With this patch, consistency is
  esablished.
* Passing PIIX4State to piix4_set_irq() paves the way for eliminating all
  global variables left in piix4.c (see patch 3).

Comments welcome.

Cheers
Bernhard

[1] https://lwn.net/Articles/872321/

Bernhard Beschow (3):
  malta: Move PCI interrupt handling from gt64xxx to piix4
  pci: Always pass own DeviceState to pci_map_irq_fn's
  isa/piix4: Resolve global variables

 hw/isa/piix4.c                | 62 ++++++++++++++++++++++++++++++++---
 hw/mips/gt64xxx_pci.c         | 62 +++--------------------------------
 hw/mips/malta.c               |  6 +---
 hw/pci-host/sh_pci.c          |  6 ++--
 hw/pci-host/versatile.c       |  6 ++--
 hw/ppc/ppc440_pcix.c          |  6 ++--
 hw/ppc/ppc4xx_pci.c           |  6 ++--
 include/hw/mips/mips.h        |  2 +-
 include/hw/southbridge/piix.h |  2 --
 9 files changed, 77 insertions(+), 81 deletions(-)

-- 
2.34.1


Re: [PATCH 0/3] malta: Move PCI interrupt handling from gt64xxx to piix4
Posted by Philippe Mathieu-Daudé 2 years, 3 months ago
Hi Bernhard,

On 12/1/22 22:36, Bernhard Beschow wrote:
> Hi,
> 
> first-time contributor here. Inspired by an article in LWN [1] I figured I'd
> get my hands dirty with QEMU development. According to the article my goal is
> to eliminate some "accidental complexity".
> 
> While studying the code I noticed some (accidental?) differences between piix3
> and piix4 where the PCI interrupts are handled. Moreover, I noticed presence of
> global variables in piix4 which probably constitute a limitation of QOM's idea
> of configuration-driven machine creation. By applying piix3 concepts, i.e.
> moving the interrupt handling from gt64xxx to piix4, it's possible to both
> eliminate the differences and resolve the global variables.
> 
> The patch series is structured as follows: Patch 1 eliminates the differences,
> patch 3 resolves the global variables. Patch 2 is a preparation for patch 3.
> Some of my further comments regarding the patches are:
> 
> Patch 1:
> * pci_slot_get_pirq() looks quite malta-specific. Neither gt64xxx nor piix4
>    seem to be the perfect fit. So I moved it to piix4, analogous to piix3.
> * The i8259 property moved from MaltaState to PIIX4State looks quite redundant
>    to the isa property. Could isa be used instead, eliminating i8259?
> 
> Patch 2:
> * Besides piix4, there were four further cases where the PIC array was passed
>    as the opaque parameter to the pci_map_irq_fn's. AFAICS in all other cases
>    the DeviceState is passed instead. With this patch, consistency is
>    esablished.
> * Passing PIIX4State to piix4_set_irq() paves the way for eliminating all
>    global variables left in piix4.c (see patch 3).
> 
> Comments welcome.
> 
> Cheers
> Bernhard
> 
> [1] https://lwn.net/Articles/872321/
> 
> Bernhard Beschow (3):
>    malta: Move PCI interrupt handling from gt64xxx to piix4
>    pci: Always pass own DeviceState to pci_map_irq_fn's
>    isa/piix4: Resolve global variables

Did you forget to sent the patches?

Re: [PATCH 0/3] malta: Move PCI interrupt handling from gt64xxx to piix4
Posted by Bernhard Beschow 2 years, 3 months ago
Hi Philippe,

On Thu, Jan 13, 2022 at 10:24 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> Hi Bernhard,
>
> On 12/1/22 22:36, Bernhard Beschow wrote:
> > Hi,
> >
> > first-time contributor here. Inspired by an article in LWN [1] I figured
> I'd
> > get my hands dirty with QEMU development. According to the article my
> goal is
> > to eliminate some "accidental complexity".
> >
> > While studying the code I noticed some (accidental?) differences between
> piix3
> > and piix4 where the PCI interrupts are handled. Moreover, I noticed
> presence of
> > global variables in piix4 which probably constitute a limitation of
> QOM's idea
> > of configuration-driven machine creation. By applying piix3 concepts,
> i.e.
> > moving the interrupt handling from gt64xxx to piix4, it's possible to
> both
> > eliminate the differences and resolve the global variables.
> >
> > The patch series is structured as follows: Patch 1 eliminates the
> differences,
> > patch 3 resolves the global variables. Patch 2 is a preparation for
> patch 3.
> > Some of my further comments regarding the patches are:
> >
> > Patch 1:
> > * pci_slot_get_pirq() looks quite malta-specific. Neither gt64xxx nor
> piix4
> >    seem to be the perfect fit. So I moved it to piix4, analogous to
> piix3.
> > * The i8259 property moved from MaltaState to PIIX4State looks quite
> redundant
> >    to the isa property. Could isa be used instead, eliminating i8259?
> >
> > Patch 2:
> > * Besides piix4, there were four further cases where the PIC array was
> passed
> >    as the opaque parameter to the pci_map_irq_fn's. AFAICS in all other
> cases
> >    the DeviceState is passed instead. With this patch, consistency is
> >    esablished.
> > * Passing PIIX4State to piix4_set_irq() paves the way for eliminating all
> >    global variables left in piix4.c (see patch 3).
> >
> > Comments welcome.
> >
> > Cheers
> > Bernhard
> >
> > [1] https://lwn.net/Articles/872321/
> >
> > Bernhard Beschow (3):
> >    malta: Move PCI interrupt handling from gt64xxx to piix4
> >    pci: Always pass own DeviceState to pci_map_irq_fn's
> >    isa/piix4: Resolve global variables
>
> Did you forget to sent the patches?
>

I can see my patches in-reply-to my cover letter here [1]. Do I miss
something?

[1]  https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg02786.html
Re: [PATCH 0/3] malta: Move PCI interrupt handling from gt64xxx to piix4
Posted by Philippe Mathieu-Daudé 2 years, 3 months ago
On 13/1/22 12:22, Bernhard Beschow wrote:
> Hi Philippe,
> 
> On Thu, Jan 13, 2022 at 10:24 AM Philippe Mathieu-Daudé <f4bug@amsat.org 
> <mailto:f4bug@amsat.org>> wrote:
> 
>      > Bernhard Beschow (3):
>      >    malta: Move PCI interrupt handling from gt64xxx to piix4
>      >    pci: Always pass own DeviceState to pci_map_irq_fn's
>      >    isa/piix4: Resolve global variables
> 
>     Did you forget to sent the patches?
> 
> 
> I can see my patches in-reply-to my cover letter here [1]. Do I miss 
> something?
> 
> [1] 
> https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg02786.html 
> <https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg02786.html>

I should have checked there first. I found the patches in my SPAM box,
apparently due to "SPF=SOFTFAIL" (no clue...):

Authentication-Results: mx.google.com;
        dkim=pass header.i=@gmail.com header.s=20210112 header.b="Sf/DBOt0";
        spf=softfail (google.com: domain of transitioning 
shentey@gmail.com does not designate 172.105.152.211 as permitted 
sender) smtp.mailfrom=shentey@gmail.com;
        dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com