Skip to content

i8259: improve qdev PIC modelling (and misc fixes)

Mark Cave-Ayland qemu-devel xen-devel 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/228 patches 8 repliesIn review
  2. v3 posting 1/22 of 28 patches 0 repliesSuperseded
  3. v227 patches 12 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v122 patches34 repliesSuperseded

Changes in v3 from the cover letter

- Rebase onto master

- Add R-B tags from Peter

- Introduce isa_realize() function in patch 18 and use it in patches 19 and 21 to fix refcounting for ISA devices within the PIC container device

- Don't pass input IRQ 2 from the primary PIC when implementing the cascaded PIC configuration in patch 20

Patches in v3 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28i8259_internal.h: rename PIC_COMMON to I8259_COMMONhw/i386/kvm/i8259.c hw/intc/i8259.c hw/intc/i8259_common.c +1 more+18 -180 replies
2/28i8259_internal.h: rename TYPE_I8259_COMMON to i8259-commoninclude/hw/isa/i8259_internal.h+1 -10 replies
3/28i8259_internal.h: rename PICCommonState to I8259CommonStatehw/i386/kvm/i8259.c hw/intc/i8259.c hw/intc/i8259_common.c +2 more+60 -600 replies
4/28i8259_internal.h: rename PICCommonClass to I8259CommonClasshw/i386/kvm/i8259.c hw/intc/i8259.c hw/intc/i8259_common.c +1 more+8 -80 replies
5/28i8259.c: rename PICClass to I8259Classhw/intc/i8259.c+8 -80 replies
6/28i8259.c: introduce TYPE_I8259 devicehw/intc/i8259.c include/hw/intc/i8259.h+23 -180 replies
7/28i8259.c: always use cs for I8259CommonState variableshw/intc/i8259.c+96 -960 replies
8/28kvm/i8259.c: rename KVMPICClass to KVMI8259Classhw/i386/kvm/i8259.c+7 -70 replies
9/28kvm/i8259.c: introduce TYPE_KVM_I8259 devicehw/i386/kvm/i8259.c+6 -40 replies
10/28kvm/i8259.c: always use cs for I8259CommonState variableshw/i386/kvm/i8259.c+43 -430 replies
11/28i8259_common.c: always use cs for I8259CommonState variableshw/intc/i8259_common.c include/hw/isa/i8259_internal.h+40 -400 replies
12/28i8259_common.c: use i8259/i8259_common prefix for functionshw/i386/kvm/i8259.c hw/intc/i8259.c hw/intc/i8259_common.c +1 more+31 -300 replies
13/28i8259.c: use i8259 prefix for functionshw/intc/i8259.c hw/intc/trace-events+56 -560 replies
14/28kvm/i8259.c: use kvm_i8259 prefix for functionshw/i386/kvm/i8259.c+12 -110 replies
15/28i8259_common.c: convert to use DEFINE_TYPES() macrohw/intc/i8259_common.c+13 -160 replies
16/28i8259.c: convert to use DEFINE_TYPES() macrohw/intc/i8259.c+9 -120 replies
17/28kvm/i8259.c: convert to use DEFINE_TYPES() macrohw/i386/kvm/i8259.c+9 -120 replies
18/28isa-bus.c: introduce isa_realize() functionhw/isa/isa-bus.c include/hw/isa/isa.h+6 -01 reply
19/28i8259.c: introduce TYPE_I8259_PIC devicehw/intc/i8259.c+118 -151 reply
20/28i8259.c: properly cascade secondary i8259 from primary i8259hw/intc/i8259.c+7 -11 reply
21/28kvm/i8259.c: introduce TYPE_KVM_I8259_PIC devicehw/i386/kvm/i8259.c+88 -31 reply
22/28xen-hvm.c: rename xen_interrupt_controller_init() to xen_i8259_init()hw/i386/pc.c hw/i386/xen/xen-hvm.c include/hw/xen/xen.h +1 more+4 -42 replies
23/28xen/xen-hvm.c: introduce TYPE_XEN_I8259_PIC devicehw/i386/xen/xen-hvm.c+37 -11 reply
24/28i8259_common.c: remove unused i8259_init_chip() functionhw/intc/i8259_common.c include/hw/isa/i8259_internal.h+0 -170 replies
25/28i8259: move InterruptStatsProviderClass get_statistics() from i8259 to PIChw/i386/kvm/i8259.c hw/intc/i8259.c hw/intc/i8259_common.c +2 more+38 -100 replies
26/28i8259.c: switch isa_pic from I8259State to I8259PICStatehw/intc/i8259.c include/hw/intc/i8259.h+19 -230 replies
27/28i8259_common.c: remove static irq_count and irq_level variableshw/i386/kvm/i8259.c hw/intc/i8259.c hw/intc/i8259_common.c +2 more+52 -350 replies
28/28i8259_common.c: add missing 0x prefixes to "info pic" outputhw/intc/i8259_common.c+3 -20 replies

Reviews trailers per patch

All 28 patches have a Reviewed-by or Acked-by.

PatchPeter Maydell
1/28R-b
2/28R-b
3/28R-b
4/28R-b
5/28R-b
6/28R-b
7/28R-b
8/28R-b
9/28R-b
10/28R-b
11/28R-b
12/28R-b
13/28R-b
14/28R-b
15/28R-b
16/28R-b
17/28R-b
18/28R-b
19/28R-b
20/28R-b
21/28R-b
22/28R-b
23/28R-b
24/28R-b
25/28R-b
26/28R-b
27/28R-b
28/28R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/28] i8259: improve qdev PIC modelling (and misc fixes)

This series attempts to improve the modelling of legacy x86 PICs within QEMU. The initial aim was to have a qdev device with one output gpio, and 16 input gpios representing the legacy IRQ lines, however as I went about trying to model this, I found a number of other inconsistencies/bugs: in particular there seemed to be some fuzziness around the functionality that belongs to an individual i8259 chip, and a cascaded i8259 configuration.

For the purposes of this patch an i8259 device is considered to be a single i8259 chip whilst a PIC device is considered to be either a cascaded i8259 configuration (emulated/KVM) or standalone device (Xen) representing the set of 16 legacy IRQs and a single output IRQ.

Due to the updated device names, there is currently one visible change in the HMP monitor output for "info irq" where the isa-i8259 device now appears as isa-i8259-pic and the kvm-i8259 device appears as kvm-i8259-pic (see patch 25).

[Patches still requiring review: 18-21, 23]

v3:
- Rebase onto master

- Add R-B tags from Peter

- Introduce isa_realize() function in patch 18 and use it in patches 19 and 21 to fix refcounting for ISA devices within the PIC container device

- Don't pass input IRQ 2 from the primary PIC when implementing the cascaded PIC configuration in patch 20

v2:
- Rebase onto master

- Add R-B tags from Peter

- Remove FIXME from commit message and rename trace event in patch 13

- Introduce a separate I8259State for TYPE_I8259 and KVMI8259State for TYPE_KVM_I8259 as suggested by Peter

- Keep but rename the associated classes for TYPE_I8259 and TYPE_KVM_I8259 and move the DeviceRealize function into each one, instead of keeping it in the parent class

- Add patches to make variable names consistent when accessing I8259CommonState from child objects

- Update the comment on patch 19 to reflect that implementing the cascaded secondary is actually a bugfix

Mark Cave-Ayland (28):
i8259_internal.h: rename PIC_COMMON to I8259_COMMON i8259_internal.h: rename TYPE_I8259_COMMON to i8259-common i8259_internal.h: rename PICCommonState to I8259CommonState i8259_internal.h: rename PICCommonClass to I8259CommonClass i8259.c: rename PICClass to I8259Class
i8259.c: introduce TYPE_I8259 device
i8259.c: always use cs for I8259CommonState variables kvm/i8259.c: rename KVMPICClass to KVMI8259Class kvm/i8259.c: introduce TYPE_KVM_I8259 device
kvm/i8259.c: always use cs for I8259CommonState variables i8259_common.c: always use cs for I8259CommonState variables i8259_common.c: use i8259/i8259_common prefix for functions i8259.c: use i8259 prefix for functions
kvm/i8259.c: use kvm_i8259 prefix for functions i8259_common.c: convert to use DEFINE_TYPES() macro i8259.c: convert to use DEFINE_TYPES() macro
kvm/i8259.c: convert to use DEFINE_TYPES() macro isa-bus.c: introduce isa_realize() function
i8259.c: introduce TYPE_I8259_PIC device
i8259.c: properly cascade secondary i8259 from primary i8259 kvm/i8259.c: introduce TYPE_KVM_I8259_PIC device xen-hvm.c: rename xen_interrupt_controller_init() to xen_i8259_init() xen/xen-hvm.c: introduce TYPE_XEN_I8259_PIC device i8259_common.c: remove unused i8259_init_chip() function
i8259: move InterruptStatsProviderClass get_statistics() from i8259 to
PIC
i8259.c: switch isa_pic from I8259State to I8259PICState i8259_common.c: remove static irq_count and irq_level variables i8259_common.c: add missing 0x prefixes to "info pic" output

 include/hw/intc/i8259.h         |  11 +-
 include/hw/isa/i8259_internal.h |  19 +-
 include/hw/isa/isa.h            |   1 +
 include/hw/xen/xen.h            |   2 +-
 hw/i386/kvm/i8259.c             | 250 ++++++++++++-----
 hw/i386/pc.c                    |   2 +-
 hw/i386/xen/xen-hvm.c           |  40 ++-
 hw/intc/i8259.c                 | 470 ++++++++++++++++++++------------
 hw/intc/i8259_common.c          | 225 +++++++--------
 hw/isa/isa-bus.c                |   5 +
 stubs/xen-hw-stub.c             |   2 +-
 hw/intc/trace-events            |   8 +-
 12 files changed, 648 insertions(+), 387 deletions(-)
Signature · 1 line
2.43.0