diff options
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/adlib.c | 5 | ||||
| -rw-r--r-- | hw/cirrus_vga.c | 4 | ||||
| -rw-r--r-- | hw/e1000.c | 2 | ||||
| -rw-r--r-- | hw/irq.c | 14 | ||||
| -rw-r--r-- | hw/irq.h | 5 | ||||
| -rw-r--r-- | hw/pc.c | 8 | ||||
| -rw-r--r-- | hw/pc.h | 2 | ||||
| -rw-r--r-- | hw/pc_piix.c | 14 | ||||
| -rw-r--r-- | hw/qdev-properties.c | 2 | ||||
| -rw-r--r-- | hw/vga-isa.c | 1 | ||||
| -rw-r--r-- | hw/virtio.c | 14 |
11 files changed, 45 insertions, 26 deletions
diff --git a/hw/adlib.c b/hw/adlib.c index c1c46e3573..e4bfcc6420 100644 --- a/hw/adlib.c +++ b/hw/adlib.c @@ -119,7 +119,6 @@ static IO_WRITE_PROTO (adlib_write) { AdlibState *s = opaque; int a = nport & 3; - int status; s->active = 1; AUD_set_active_out (s->voice, 1); @@ -127,9 +126,9 @@ static IO_WRITE_PROTO (adlib_write) adlib_kill_timers (s); #ifdef HAS_YMF262 - status = YMF262Write (0, a, val); + YMF262Write (0, a, val); #else - status = OPLWrite (s->opl, a, val); + OPLWrite (s->opl, a, val); #endif } diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index ec7ea8207b..c7e365b2a6 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -2401,7 +2401,7 @@ static void map_linear_vram_bank(CirrusVGAState *s, unsigned bank) static void map_linear_vram(CirrusVGAState *s) { - if (!s->linear_vram) { + if (s->bustype == CIRRUS_BUSTYPE_PCI && !s->linear_vram) { s->linear_vram = true; memory_region_add_subregion_overlap(&s->pci_bar, 0, &s->vga.vram, 1); } @@ -2411,7 +2411,7 @@ static void map_linear_vram(CirrusVGAState *s) static void unmap_linear_vram(CirrusVGAState *s) { - if (s->linear_vram) { + if (s->bustype == CIRRUS_BUSTYPE_PCI && s->linear_vram) { s->linear_vram = false; memory_region_del_subregion(&s->pci_bar, &s->vga.vram); } diff --git a/hw/e1000.c b/hw/e1000.c index 6a3a941488..ce8fc8b510 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -1151,8 +1151,6 @@ static int pci_e1000_init(PCIDevice *pci_dev) pci_conf = d->dev.config; - /* TODO: we have no capabilities, so why is this bit set? */ - pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST); /* TODO: RST# value should be 0, PCI spec 6.2.4 */ pci_conf[PCI_CACHE_LINE_SIZE] = 0x10; diff --git a/hw/irq.c b/hw/irq.c index 60eabe8901..62f766eb6f 100644 --- a/hw/irq.c +++ b/hw/irq.c @@ -90,3 +90,17 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2) s[1] = irq2; return qemu_allocate_irqs(qemu_splitirq, s, 1)[0]; } + +static void proxy_irq_handler(void *opaque, int n, int level) +{ + qemu_irq **target = opaque; + + if (*target) { + qemu_set_irq((*target)[n], level); + } +} + +qemu_irq *qemu_irq_proxy(qemu_irq **target, int n) +{ + return qemu_allocate_irqs(proxy_irq_handler, target, n); +} diff --git a/hw/irq.h b/hw/irq.h index 389ed7a506..64da2fd601 100644 --- a/hw/irq.h +++ b/hw/irq.h @@ -33,4 +33,9 @@ qemu_irq qemu_irq_invert(qemu_irq irq); /* Returns a new IRQ which feeds into both the passed IRQs */ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); +/* Returns a new IRQ set which connects 1:1 to another IRQ set, which + * may be set later. + */ +qemu_irq *qemu_irq_proxy(qemu_irq **target, int n); + #endif diff --git a/hw/pc.c b/hw/pc.c index 5bc845aaea..203627d46e 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -965,7 +965,7 @@ void pc_memory_init(MemoryRegion *system_memory, const char *initrd_filename, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, - MemoryRegion *pci_memory, + MemoryRegion *rom_memory, MemoryRegion **ram_memory) { char *filename; @@ -1029,7 +1029,7 @@ void pc_memory_init(MemoryRegion *system_memory, isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_alias(isa_bios, "isa-bios", bios, bios_size - isa_bios_size, isa_bios_size); - memory_region_add_subregion_overlap(pci_memory, + memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); @@ -1037,13 +1037,13 @@ void pc_memory_init(MemoryRegion *system_memory, option_rom_mr = g_malloc(sizeof(*option_rom_mr)); memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE); - memory_region_add_subregion_overlap(pci_memory, + memory_region_add_subregion_overlap(rom_memory, PC_ROM_MIN_VGA, option_rom_mr, 1); /* map all the bios at the top of memory */ - memory_region_add_subregion(pci_memory, + memory_region_add_subregion(rom_memory, (uint32_t)(-bios_size), bios); diff --git a/hw/pc.h b/hw/pc.h index dae736e7e4..8e75c71cf7 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -137,7 +137,7 @@ void pc_memory_init(MemoryRegion *system_memory, const char *initrd_filename, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, - MemoryRegion *pci_memory, + MemoryRegion *rom_memory, MemoryRegion **ram_memory); qemu_irq *pc_allocate_cpu_irq(void); void pc_vga_init(PCIBus *pci_bus); diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 75d96d97c6..0144534e82 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -97,6 +97,7 @@ static void pc_init1(MemoryRegion *system_memory, ISADevice *rtc_state; MemoryRegion *ram_memory; MemoryRegion *pci_memory; + MemoryRegion *rom_memory; pc_cpus_init(cpu_model); @@ -112,15 +113,21 @@ static void pc_init1(MemoryRegion *system_memory, below_4g_mem_size = ram_size; } - pci_memory = g_new(MemoryRegion, 1); - memory_region_init(pci_memory, "pci", INT64_MAX); + if (pci_enabled) { + pci_memory = g_new(MemoryRegion, 1); + memory_region_init(pci_memory, "pci", INT64_MAX); + rom_memory = pci_memory; + } else { + pci_memory = NULL; + rom_memory = system_memory; + } /* allocate ram and load rom/bios */ if (!xen_enabled()) { pc_memory_init(system_memory, kernel_filename, kernel_cmdline, initrd_filename, below_4g_mem_size, above_4g_mem_size, - pci_memory, &ram_memory); + pci_enabled ? rom_memory : system_memory, &ram_memory); } if (!xen_enabled()) { @@ -150,6 +157,7 @@ static void pc_init1(MemoryRegion *system_memory, pci_bus = NULL; i440fx_state = NULL; isa_bus_new(NULL); + no_hpet = 1; } isa_bus_irqs(isa_irq); diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 7ce95b679c..e0e54aa857 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -524,6 +524,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str) return -EINVAL; if (fn > 7) return -EINVAL; + if (slot > 31) + return -EINVAL; *ptr = slot << 3 | fn; return 0; } diff --git a/hw/vga-isa.c b/hw/vga-isa.c index 0d199015d7..6b5c8ed970 100644 --- a/hw/vga-isa.c +++ b/hw/vga-isa.c @@ -49,6 +49,7 @@ static int vga_initfn(ISADevice *dev) MemoryRegion *vga_io_memory; vga_common_init(s, VGA_RAM_SIZE); + s->legacy_address_space = isa_address_space(dev); vga_io_memory = vga_init_io(s); memory_region_add_subregion_overlap(isa_address_space(dev), isa_mem_base + 0x000a0000, diff --git a/hw/virtio.c b/hw/virtio.c index d9bf266492..7011b5b398 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -16,20 +16,12 @@ #include "trace.h" #include "qemu-error.h" #include "virtio.h" +#include "qemu-barrier.h" /* The alignment to use between consumer and producer parts of vring. * x86 pagesize again. */ #define VIRTIO_PCI_VRING_ALIGN 4096 -/* QEMU doesn't strictly need write barriers since everything runs in - * lock-step. We'll leave the calls to wmb() in though to make it obvious for - * KVM or if kqemu gets SMP support. - * In any case, we must prevent the compiler from reordering the code. - * TODO: we likely need some rmb()/mb() as well. - */ - -#define wmb() __asm__ __volatile__("": : :"memory") - typedef struct VRingDesc { uint64_t addr; @@ -264,7 +256,7 @@ void virtqueue_flush(VirtQueue *vq, unsigned int count) { uint16_t old, new; /* Make sure buffer is written before we update index. */ - wmb(); + smp_wmb(); trace_virtqueue_flush(vq, count); old = vring_used_idx(vq); new = old + count; @@ -324,7 +316,7 @@ static unsigned virtqueue_next_desc(target_phys_addr_t desc_pa, /* Check they're not leading us off end of descriptors. */ next = vring_desc_next(desc_pa, i); /* Make sure compiler knows to grab that: we don't want it changing! */ - wmb(); + smp_wmb(); if (next >= max) { error_report("Desc next is %u", next); |