From 552fdfd56cc2b3a3d7ed025b3d30e07c72be8051 Mon Sep 17 00:00:00 2001 Message-Id: <552fdfd56cc2b3a3d7ed025b3d30e07c72be8051.1342460474.git.minovotn@redhat.com> From: Amit Shah Date: Thu, 14 Jun 2012 13:21:21 +0200 Subject: [PATCH] isa-bus: Remove bogus IRQ sharing check RH-Author: Amit Shah Message-id: Patchwork-id: 39970 O-Subject: [RHEL6.4 qemu PATCH] isa-bus: Remove bogus IRQ sharing check Bugzilla: 771624 RH-Acked-by: Juan Quintela RH-Acked-by: Laszlo Ersek RH-Acked-by: Gerd Hoffmann RH-Acked-by: Paolo Bonzini Nothing prevented IRQ sharing on the ISA bus in principle. Not all boards supported this, neither each and every card nor driver andOS. Still, there existed valid IRQ sharing scenarios, (at least) two of them can also be found in QEMU: >2 PC UARTs and the PREP IDE buses. So remove this artificial restriction from our ISA model. Signed-off-by: Jan Kiszka Signed-off-by: Aurelien Jarno (manually cherry-picked from ee951a37d8873bff7aa58e23222dfd984111b6cb) Bugzilla: 771624 Too many conflicts, so just manually performed s/isa_reserve_irq/isa_get_irq as there were just 4-5 instances. Signed-off-by: Amit Shah --- hw/ide/piix.c | 2 +- hw/isa-bus.c | 18 +++--------------- hw/isa.h | 2 +- hw/mips_malta.c | 4 ++-- hw/pc.c | 8 ++++---- 5 files changed, 11 insertions(+), 23 deletions(-) Signed-off-by: Michal Novotny --- hw/ide/piix.c | 2 +- hw/isa-bus.c | 18 +++--------------- hw/isa.h | 2 +- hw/mips_malta.c | 4 ++-- hw/pc.c | 8 ++++---- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 5224ae0..8779aac 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -105,7 +105,7 @@ static void pci_piix_init_ports(PCIIDEState *d) { for (i = 0; i < 2; i++) { ide_bus_new(&d->bus[i], &d->dev.qdev, i); ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2); - ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq)); + ide_init2(&d->bus[i], isa_get_irq(port_info[i].isairq)); d->bus[i].bmdma = &d->bmdma[i]; d->bmdma[i].bus = &d->bus[i]; diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 1b18ab6..acd4d46 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -25,7 +25,6 @@ struct ISABus { BusState qbus; qemu_irq *irqs; - uint32_t assigned; }; static ISABus *isabus; @@ -60,36 +59,25 @@ void isa_bus_irqs(qemu_irq *irqs) } /* - * isa_reserve_irq() reserves the ISA irq and returns the corresponding - * qemu_irq entry for the i8259. + * isa_get_irq() returns the corresponding qemu_irq entry for the i8259. * * This function is only for special cases such as the 'ferr', and * temporary use for normal devices until they are converted to qdev. */ -qemu_irq isa_reserve_irq(int isairq) +qemu_irq isa_get_irq(int isairq) { if (isairq < 0 || isairq > 15) { fprintf(stderr, "isa irq %d invalid\n", isairq); exit(1); } - if (isabus->assigned & (1 << isairq)) { - fprintf(stderr, "isa irq %d already assigned\n", isairq); - exit(1); - } - isabus->assigned |= (1 << isairq); return isabus->irqs[isairq]; } void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) { assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); - if (isabus->assigned & (1 << isairq)) { - fprintf(stderr, "isa irq %d already assigned\n", isairq); - exit(1); - } - isabus->assigned |= (1 << isairq); dev->isairq[dev->nirqs] = isairq; - *p = isabus->irqs[isairq]; + *p = isa_get_irq(isairq); dev->nirqs++; } diff --git a/hw/isa.h b/hw/isa.h index acb0d40..37129f6 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -26,7 +26,7 @@ struct ISADeviceInfo { ISABus *isa_bus_new(DeviceState *dev); void isa_bus_irqs(qemu_irq *irqs); -qemu_irq isa_reserve_irq(int isairq); +qemu_irq isa_get_irq(int isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); void isa_init_ioport(ISADevice *dev, uint16_t ioport); void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length); diff --git a/hw/mips_malta.c b/hw/mips_malta.c index b79826b..c9895d9 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -927,7 +927,7 @@ void mips_malta_init (ram_addr_t ram_size, isa_bus_irqs(i8259); pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1); usb_uhci_piix4_init(pci_bus, piix4_devfn + 2); - smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_reserve_irq(9)); + smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(9)); eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ for (i = 0; i < 8; i++) { /* TODO: Populate SPD eeprom data. */ @@ -937,7 +937,7 @@ void mips_malta_init (ram_addr_t ram_size, qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); qdev_init_nofail(eeprom); } - pit = pit_init(0x40, isa_reserve_irq(0)); + pit = pit_init(0x40, isa_get_irq(0)); DMA_init(0); /* Super I/O */ diff --git a/hw/pc.c b/hw/pc.c index 4371b38..9fbfbf0 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1217,7 +1217,7 @@ static void pc_init1(ram_addr_t ram_size, } isa_bus_irqs(isa_irq); - ferr_irq = isa_reserve_irq(13); + ferr_irq = isa_get_irq(13); /* init basic PC hardware */ register_ioport_write(0x80, 1, 1, ioport80_write, NULL); @@ -1272,10 +1272,10 @@ static void pc_init1(ram_addr_t ram_size, } #ifdef CONFIG_KVM_PIT if (kvm_enabled() && qemu_kvm_pit_in_kernel()) - pit = kvm_pit_init(0x40, isa_reserve_irq(0)); + pit = kvm_pit_init(0x40, isa_get_irq(0)); else #endif - pit = pit_init(0x40, isa_reserve_irq(0)); + pit = pit_init(0x40, isa_get_irq(0)); pcspk_init(pit); if (!no_hpet) { hpet_init(isa_irq); @@ -1343,7 +1343,7 @@ static void pc_init1(ram_addr_t ram_size, /* TODO: Populate SPD eeprom data. */ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, - isa_reserve_irq(9)); + isa_get_irq(9)); for (i = 0; i < 8; i++) { DeviceState *eeprom; eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); -- 1.7.10.4