mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* serial port fixes (Paolo) * Q35 modeling improvements (Paolo, Vasily) * chardev cleanup improvements (Marc-André) * iscsi bugfix (Peter L.) * cpu_exec patch from multi-arch patches (Peter C.) * pci-assign tweak (Lin Ma) # gpg: Signature made Wed 29 Jun 2016 15:56:30 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (35 commits) socket: unlink unix socket on remove socket: add listen feature char: clean up remaining chardevs when leaving vhost-user: disable chardev handlers on close vhost-user-test: fix g_cond_wait_until compat implementation vl: smp_parse: fix regression ich9: implement SCI_IRQ_SEL register ich9: implement ACPI_EN register serial: reinstate watch after migration serial: remove watch on reset char: change qemu_chr_fe_add_watch to return unsigned serial: separate serial_xmit and serial_watch_cb serial: simplify tsr_retry reset serial: make tsr_retry unsigned iscsi: fix assertion in is_sector_request_lun_aligned target-*: Don't redefine cpu_exec() pci-assign: Move "Invalid ROM" error message to pci-assign-load-rom.c vnc: generalize "VNC server running on ..." message scsi: esp: fix migration MC146818 RTC: add GPIO access to output IRQ ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+3
-2
@@ -417,7 +417,7 @@ static bool is_byte_request_lun_aligned(int64_t offset, int count,
|
||||
static bool is_sector_request_lun_aligned(int64_t sector_num, int nb_sectors,
|
||||
IscsiLun *iscsilun)
|
||||
{
|
||||
assert(nb_sectors < BDRV_REQUEST_MAX_SECTORS);
|
||||
assert(nb_sectors <= BDRV_REQUEST_MAX_SECTORS);
|
||||
return is_byte_request_lun_aligned(sector_num << BDRV_SECTOR_BITS,
|
||||
nb_sectors << BDRV_SECTOR_BITS,
|
||||
iscsilun);
|
||||
@@ -661,7 +661,8 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
|
||||
int64_t ret;
|
||||
int pnum;
|
||||
BlockDriverState *file;
|
||||
ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);
|
||||
ret = iscsi_co_get_block_status(bs, sector_num,
|
||||
BDRV_REQUEST_MAX_SECTORS, &pnum, &file);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
+7
-2
@@ -31,6 +31,7 @@
|
||||
#include "qemu/timer.h"
|
||||
#include "hw/timer/i8254.h"
|
||||
#include "hw/audio/pcspk.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
#define PCSPK_BUF_LEN 1792
|
||||
#define PCSPK_SAMPLE_RATE 32000
|
||||
@@ -169,6 +170,11 @@ static void pcspk_initfn(Object *obj)
|
||||
PCSpkState *s = PC_SPEAKER(obj);
|
||||
|
||||
memory_region_init_io(&s->ioport, OBJECT(s), &pcspk_io_ops, s, "pcspk", 1);
|
||||
|
||||
object_property_add_link(obj, "pit", TYPE_I8254,
|
||||
(Object **)&s->pit,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
0, &error_abort);
|
||||
}
|
||||
|
||||
static void pcspk_realizefn(DeviceState *dev, Error **errp)
|
||||
@@ -183,7 +189,6 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
static Property pcspk_properties[] = {
|
||||
DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, -1),
|
||||
DEFINE_PROP_PTR("pit", PCSpkState, pit),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
@@ -194,7 +199,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data)
|
||||
dc->realize = pcspk_realizefn;
|
||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||
dc->props = pcspk_properties;
|
||||
/* Reason: pointer property "pit", realize sets global pcspk_state */
|
||||
/* Reason: realize sets global pcspk_state */
|
||||
dc->cannot_instantiate_with_device_add_yet = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ do { \
|
||||
#define DPRINTF(fmt, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define TYPE_CFI_PFLASH01 "cfi.pflash01"
|
||||
#define CFI_PFLASH01(obj) OBJECT_CHECK(pflash_t, (obj), TYPE_CFI_PFLASH01)
|
||||
|
||||
#define PFLASH_BE 0
|
||||
|
||||
@@ -57,7 +57,6 @@ do { \
|
||||
|
||||
#define PFLASH_LAZY_ROMD_THRESHOLD 42
|
||||
|
||||
#define TYPE_CFI_PFLASH02 "cfi.pflash02"
|
||||
#define CFI_PFLASH02(obj) OBJECT_CHECK(pflash_t, (obj), TYPE_CFI_PFLASH02)
|
||||
|
||||
struct pflash_t {
|
||||
|
||||
@@ -295,9 +295,12 @@ static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond,
|
||||
}
|
||||
|
||||
if (s->tx_count) {
|
||||
int r = qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
|
||||
cadence_uart_xmit, s);
|
||||
assert(r);
|
||||
guint r = qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
|
||||
cadence_uart_xmit, s);
|
||||
if (!r) {
|
||||
s->tx_count = 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
uart_update_status(s);
|
||||
|
||||
+51
-16
@@ -106,6 +106,7 @@ do {} while (0)
|
||||
#endif
|
||||
|
||||
static void serial_receive1(void *opaque, const uint8_t *buf, int size);
|
||||
static void serial_xmit(SerialState *s);
|
||||
|
||||
static inline void recv_fifo_put(SerialState *s, uint8_t chr)
|
||||
{
|
||||
@@ -223,13 +224,20 @@ static void serial_update_msl(SerialState *s)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
||||
static gboolean serial_watch_cb(GIOChannel *chan, GIOCondition cond,
|
||||
void *opaque)
|
||||
{
|
||||
SerialState *s = opaque;
|
||||
s->watch_tag = 0;
|
||||
serial_xmit(s);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void serial_xmit(SerialState *s)
|
||||
{
|
||||
do {
|
||||
assert(!(s->lsr & UART_LSR_TEMT));
|
||||
if (s->tsr_retry <= 0) {
|
||||
if (s->tsr_retry == 0) {
|
||||
assert(!(s->lsr & UART_LSR_THRE));
|
||||
|
||||
if (s->fcr & UART_FCR_FE) {
|
||||
@@ -251,17 +259,17 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
||||
if (s->mcr & UART_MCR_LOOP) {
|
||||
/* in loopback mode, say that we just received a char */
|
||||
serial_receive1(s, &s->tsr, 1);
|
||||
} else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
|
||||
if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY &&
|
||||
qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
|
||||
serial_xmit, s) > 0) {
|
||||
} else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1 &&
|
||||
s->tsr_retry < MAX_XMIT_RETRY) {
|
||||
assert(s->watch_tag == 0);
|
||||
s->watch_tag = qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
|
||||
serial_watch_cb, s);
|
||||
if (s->watch_tag > 0) {
|
||||
s->tsr_retry++;
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
s->tsr_retry = 0;
|
||||
} else {
|
||||
s->tsr_retry = 0;
|
||||
}
|
||||
s->tsr_retry = 0;
|
||||
|
||||
/* Transmit another byte if it is already available. It is only
|
||||
possible when FIFO is enabled and not empty. */
|
||||
@@ -269,11 +277,8 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
||||
|
||||
s->last_xmit_ts = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
s->lsr |= UART_LSR_TEMT;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Setter for FCR.
|
||||
is_load flag means, that value is set while loading VM state
|
||||
and interrupt should not be invoked */
|
||||
@@ -330,8 +335,8 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
s->lsr &= ~UART_LSR_THRE;
|
||||
s->lsr &= ~UART_LSR_TEMT;
|
||||
serial_update_irq(s);
|
||||
if (s->tsr_retry <= 0) {
|
||||
serial_xmit(NULL, G_IO_OUT, s);
|
||||
if (s->tsr_retry == 0) {
|
||||
serial_xmit(s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -639,6 +644,31 @@ static int serial_post_load(void *opaque, int version_id)
|
||||
if (s->thr_ipending == -1) {
|
||||
s->thr_ipending = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
|
||||
}
|
||||
|
||||
if (s->tsr_retry > 0) {
|
||||
/* tsr_retry > 0 implies LSR.TEMT = 0 (transmitter not empty). */
|
||||
if (s->lsr & UART_LSR_TEMT) {
|
||||
error_report("inconsistent state in serial device "
|
||||
"(tsr empty, tsr_retry=%d", s->tsr_retry);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->tsr_retry > MAX_XMIT_RETRY) {
|
||||
s->tsr_retry = MAX_XMIT_RETRY;
|
||||
}
|
||||
|
||||
assert(s->watch_tag == 0);
|
||||
s->watch_tag = qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
|
||||
serial_watch_cb, s);
|
||||
} else {
|
||||
/* tsr_retry == 0 implies LSR.TEMT = 1 (transmitter empty). */
|
||||
if (!(s->lsr & UART_LSR_TEMT)) {
|
||||
error_report("inconsistent state in serial device "
|
||||
"(tsr not empty, tsr_retry=0");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
s->last_break_enable = (s->lcr >> 6) & 1;
|
||||
/* Initialize fcr via setter to perform essential side-effects */
|
||||
serial_write_fcr(s, s->fcr_vmstate);
|
||||
@@ -685,7 +715,7 @@ static const VMStateDescription vmstate_serial_tsr = {
|
||||
.minimum_version_id = 1,
|
||||
.needed = serial_tsr_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_INT32(tsr_retry, SerialState),
|
||||
VMSTATE_UINT32(tsr_retry, SerialState),
|
||||
VMSTATE_UINT8(thr, SerialState),
|
||||
VMSTATE_UINT8(tsr, SerialState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
@@ -815,6 +845,11 @@ static void serial_reset(void *opaque)
|
||||
{
|
||||
SerialState *s = opaque;
|
||||
|
||||
if (s->watch_tag > 0) {
|
||||
g_source_remove(s->watch_tag);
|
||||
s->watch_tag = 0;
|
||||
}
|
||||
|
||||
s->rbr = 0;
|
||||
s->ier = 0;
|
||||
s->iir = UART_IIR_NO_INT;
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "hw/i386/ich9.h"
|
||||
|
||||
#define TYPE_ICH9_SMB_DEVICE "ICH9 SMB"
|
||||
#define ICH9_SMB_DEVICE(obj) \
|
||||
OBJECT_CHECK(ICH9SMBState, (obj), TYPE_ICH9_SMB_DEVICE)
|
||||
|
||||
|
||||
@@ -1891,8 +1891,4 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)
|
||||
pci_assign_dev_load_option_rom(&dev->dev, OBJECT(dev), &size,
|
||||
dev->host.domain, dev->host.bus,
|
||||
dev->host.slot, dev->host.function);
|
||||
|
||||
if (!size) {
|
||||
error_report("pci-assign: Invalid ROM.");
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -505,7 +505,7 @@ typedef struct Port92State {
|
||||
|
||||
MemoryRegion io;
|
||||
uint8_t outport;
|
||||
qemu_irq *a20_out;
|
||||
qemu_irq a20_out;
|
||||
} Port92State;
|
||||
|
||||
static void port92_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
@@ -516,7 +516,7 @@ static void port92_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
|
||||
DPRINTF("port92: write 0x%02" PRIx64 "\n", val);
|
||||
s->outport = val;
|
||||
qemu_set_irq(*s->a20_out, (val >> 1) & 1);
|
||||
qemu_set_irq(s->a20_out, (val >> 1) & 1);
|
||||
if ((val & 1) && !(oldval & 1)) {
|
||||
qemu_system_reset_request();
|
||||
}
|
||||
@@ -535,9 +535,7 @@ static uint64_t port92_read(void *opaque, hwaddr addr,
|
||||
|
||||
static void port92_init(ISADevice *dev, qemu_irq *a20_out)
|
||||
{
|
||||
Port92State *s = PORT92(dev);
|
||||
|
||||
s->a20_out = a20_out;
|
||||
qdev_connect_gpio_out_named(DEVICE(dev), PORT92_A20_LINE, 0, *a20_out);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_port92_isa = {
|
||||
@@ -574,6 +572,8 @@ static void port92_initfn(Object *obj)
|
||||
memory_region_init_io(&s->io, OBJECT(s), &port92_ops, s, "port92", 1);
|
||||
|
||||
s->outport = 0;
|
||||
|
||||
qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, PORT92_A20_LINE, 1);
|
||||
}
|
||||
|
||||
static void port92_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
+17
-11
@@ -60,6 +60,7 @@ static void pc_q35_init(MachineState *machine)
|
||||
PCIHostState *phb;
|
||||
PCIBus *host_bus;
|
||||
PCIDevice *lpc;
|
||||
DeviceState *lpc_dev;
|
||||
BusState *idebus[MAX_SATA_PORTS];
|
||||
ISADevice *rtc_state;
|
||||
MemoryRegion *system_io = get_system_io();
|
||||
@@ -159,12 +160,18 @@ static void pc_q35_init(MachineState *machine)
|
||||
q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));
|
||||
|
||||
object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL);
|
||||
q35_host->mch.ram_memory = ram_memory;
|
||||
q35_host->mch.pci_address_space = pci_memory;
|
||||
q35_host->mch.system_memory = get_system_memory();
|
||||
q35_host->mch.address_space_io = system_io;
|
||||
q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size;
|
||||
q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size;
|
||||
object_property_set_link(OBJECT(q35_host), OBJECT(ram_memory),
|
||||
MCH_HOST_PROP_RAM_MEM, NULL);
|
||||
object_property_set_link(OBJECT(q35_host), OBJECT(pci_memory),
|
||||
MCH_HOST_PROP_PCI_MEM, NULL);
|
||||
object_property_set_link(OBJECT(q35_host), OBJECT(get_system_memory()),
|
||||
MCH_HOST_PROP_SYSTEM_MEM, NULL);
|
||||
object_property_set_link(OBJECT(q35_host), OBJECT(system_io),
|
||||
MCH_HOST_PROP_IO_MEM, NULL);
|
||||
object_property_set_int(OBJECT(q35_host), pcms->below_4g_mem_size,
|
||||
PCI_HOST_BELOW_4G_MEM_SIZE, NULL);
|
||||
object_property_set_int(OBJECT(q35_host), pcms->above_4g_mem_size,
|
||||
PCI_HOST_ABOVE_4G_MEM_SIZE, NULL);
|
||||
/* pci */
|
||||
qdev_init_nofail(DEVICE(q35_host));
|
||||
phb = PCI_HOST_BRIDGE(q35_host);
|
||||
@@ -184,16 +191,15 @@ static void pc_q35_init(MachineState *machine)
|
||||
PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
|
||||
|
||||
ich9_lpc = ICH9_LPC_DEVICE(lpc);
|
||||
ich9_lpc->pic = gsi;
|
||||
ich9_lpc->ioapic = gsi_state->ioapic_irq;
|
||||
lpc_dev = DEVICE(lpc);
|
||||
for (i = 0; i < GSI_NUM_PINS; i++) {
|
||||
qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, gsi[i]);
|
||||
}
|
||||
pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc,
|
||||
ICH9_LPC_NB_PIRQS);
|
||||
pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
|
||||
isa_bus = ich9_lpc->isa_bus;
|
||||
|
||||
/*end early*/
|
||||
isa_bus_irqs(isa_bus, gsi);
|
||||
|
||||
if (kvm_pic_in_kernel()) {
|
||||
i8259 = kvm_i8259_init(isa_bus);
|
||||
} else if (xen_enabled()) {
|
||||
|
||||
@@ -40,6 +40,9 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner,
|
||||
domain, bus, slot, function);
|
||||
|
||||
if (stat(rom_file, &st)) {
|
||||
if (errno != ENOENT) {
|
||||
error_report("pci-assign: Invalid ROM.");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "internal.h"
|
||||
#include <hw/ide/internal.h>
|
||||
#include <hw/ide/pci.h>
|
||||
#include <hw/ide/ahci.h>
|
||||
|
||||
|
||||
+7
-14
@@ -146,7 +146,7 @@ typedef struct KBDState {
|
||||
|
||||
qemu_irq irq_kbd;
|
||||
qemu_irq irq_mouse;
|
||||
qemu_irq *a20_out;
|
||||
qemu_irq a20_out;
|
||||
hwaddr mask;
|
||||
} KBDState;
|
||||
|
||||
@@ -224,9 +224,7 @@ static void outport_write(KBDState *s, uint32_t val)
|
||||
{
|
||||
DPRINTF("kbd: write outport=0x%02x\n", val);
|
||||
s->outport = val;
|
||||
if (s->a20_out) {
|
||||
qemu_set_irq(*s->a20_out, (val >> 1) & 1);
|
||||
}
|
||||
qemu_set_irq(s->a20_out, (val >> 1) & 1);
|
||||
if (!(val & 1)) {
|
||||
qemu_system_reset_request();
|
||||
}
|
||||
@@ -295,15 +293,11 @@ static void kbd_write_command(void *opaque, hwaddr addr,
|
||||
kbd_queue(s, s->outport, 0);
|
||||
break;
|
||||
case KBD_CCMD_ENABLE_A20:
|
||||
if (s->a20_out) {
|
||||
qemu_irq_raise(*s->a20_out);
|
||||
}
|
||||
qemu_irq_raise(s->a20_out);
|
||||
s->outport |= KBD_OUT_A20;
|
||||
break;
|
||||
case KBD_CCMD_DISABLE_A20:
|
||||
if (s->a20_out) {
|
||||
qemu_irq_lower(*s->a20_out);
|
||||
}
|
||||
qemu_irq_lower(s->a20_out);
|
||||
s->outport &= ~KBD_OUT_A20;
|
||||
break;
|
||||
case KBD_CCMD_RESET:
|
||||
@@ -507,10 +501,7 @@ void i8042_isa_mouse_fake_event(void *opaque)
|
||||
|
||||
void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out)
|
||||
{
|
||||
ISAKBDState *isa = I8042(dev);
|
||||
KBDState *s = &isa->kbd;
|
||||
|
||||
s->a20_out = a20_out;
|
||||
qdev_connect_gpio_out_named(DEVICE(dev), I8042_A20_LINE, 0, *a20_out);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_kbd_isa = {
|
||||
@@ -552,6 +543,8 @@ static void i8042_initfn(Object *obj)
|
||||
"i8042-data", 1);
|
||||
memory_region_init_io(isa_s->io + 1, obj, &i8042_cmd_ops, s,
|
||||
"i8042-cmd", 1);
|
||||
|
||||
qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, I8042_A20_LINE, 1);
|
||||
}
|
||||
|
||||
static void i8042_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
@@ -97,6 +97,13 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
|
||||
dev->nirqs++;
|
||||
}
|
||||
|
||||
void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, int isairq)
|
||||
{
|
||||
qemu_irq irq;
|
||||
isa_init_irq(isadev, &irq, isairq);
|
||||
qdev_connect_gpio_out(DEVICE(isadev), gpioirq, irq);
|
||||
}
|
||||
|
||||
void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16)
|
||||
{
|
||||
assert(bus && dma8 && dma16);
|
||||
|
||||
+51
-38
@@ -49,8 +49,6 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qom/cpu.h"
|
||||
|
||||
static int ich9_lpc_sci_irq(ICH9LPCState *lpc);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ICH9 LPC PCI to ISA bridge */
|
||||
|
||||
@@ -204,41 +202,28 @@ static void ich9_lpc_pic_irq(ICH9LPCState *lpc, int pirq_num,
|
||||
abort();
|
||||
}
|
||||
|
||||
/* pic_irq: i8254 irq 0-15 */
|
||||
static void ich9_lpc_update_pic(ICH9LPCState *lpc, int pic_irq)
|
||||
/* gsi: i8259+ioapic irq 0-15, otherwise assert */
|
||||
static void ich9_lpc_update_pic(ICH9LPCState *lpc, int gsi)
|
||||
{
|
||||
int i, pic_level;
|
||||
|
||||
assert(gsi < ICH9_LPC_PIC_NUM_PINS);
|
||||
|
||||
/* The pic level is the logical OR of all the PCI irqs mapped to it */
|
||||
pic_level = 0;
|
||||
for (i = 0; i < ICH9_LPC_NB_PIRQS; i++) {
|
||||
int tmp_irq;
|
||||
int tmp_dis;
|
||||
ich9_lpc_pic_irq(lpc, i, &tmp_irq, &tmp_dis);
|
||||
if (!tmp_dis && pic_irq == tmp_irq) {
|
||||
if (!tmp_dis && tmp_irq == gsi) {
|
||||
pic_level |= pci_bus_get_irq_level(lpc->d.bus, i);
|
||||
}
|
||||
}
|
||||
if (pic_irq == ich9_lpc_sci_irq(lpc)) {
|
||||
if (gsi == lpc->sci_gsi) {
|
||||
pic_level |= lpc->sci_level;
|
||||
}
|
||||
|
||||
qemu_set_irq(lpc->pic[pic_irq], pic_level);
|
||||
}
|
||||
|
||||
/* pirq: pirq[A-H] 0-7*/
|
||||
static void ich9_lpc_update_by_pirq(ICH9LPCState *lpc, int pirq)
|
||||
{
|
||||
int pic_irq;
|
||||
int pic_dis;
|
||||
|
||||
ich9_lpc_pic_irq(lpc, pirq, &pic_irq, &pic_dis);
|
||||
assert(pic_irq < ICH9_LPC_PIC_NUM_PINS);
|
||||
if (pic_dis) {
|
||||
return;
|
||||
}
|
||||
|
||||
ich9_lpc_update_pic(lpc, pic_irq);
|
||||
qemu_set_irq(lpc->gsi[gsi], pic_level);
|
||||
}
|
||||
|
||||
/* APIC mode: GSIx: PIRQ[A-H] -> GSI 16, ... no pirq shares same APIC pins. */
|
||||
@@ -252,29 +237,32 @@ static int ich9_gsi_to_pirq(int gsi)
|
||||
return gsi - ICH9_LPC_PIC_NUM_PINS;
|
||||
}
|
||||
|
||||
/* gsi: ioapic irq 16-23, otherwise assert */
|
||||
static void ich9_lpc_update_apic(ICH9LPCState *lpc, int gsi)
|
||||
{
|
||||
int level = 0;
|
||||
|
||||
if (gsi >= ICH9_LPC_PIC_NUM_PINS) {
|
||||
level |= pci_bus_get_irq_level(lpc->d.bus, ich9_gsi_to_pirq(gsi));
|
||||
}
|
||||
if (gsi == ich9_lpc_sci_irq(lpc)) {
|
||||
assert(gsi >= ICH9_LPC_PIC_NUM_PINS);
|
||||
|
||||
level |= pci_bus_get_irq_level(lpc->d.bus, ich9_gsi_to_pirq(gsi));
|
||||
if (gsi == lpc->sci_gsi) {
|
||||
level |= lpc->sci_level;
|
||||
}
|
||||
|
||||
qemu_set_irq(lpc->ioapic[gsi], level);
|
||||
qemu_set_irq(lpc->gsi[gsi], level);
|
||||
}
|
||||
|
||||
void ich9_lpc_set_irq(void *opaque, int pirq, int level)
|
||||
{
|
||||
ICH9LPCState *lpc = opaque;
|
||||
int pic_irq, pic_dis;
|
||||
|
||||
assert(0 <= pirq);
|
||||
assert(pirq < ICH9_LPC_NB_PIRQS);
|
||||
|
||||
ich9_lpc_update_apic(lpc, ich9_pirq_to_gsi(pirq));
|
||||
ich9_lpc_update_by_pirq(lpc, pirq);
|
||||
ich9_lpc_pic_irq(lpc, pirq, &pic_irq, &pic_dis);
|
||||
ich9_lpc_update_pic(lpc, pic_irq);
|
||||
}
|
||||
|
||||
/* return the pirq number (PIRQ[A-H]:0-7) corresponding to
|
||||
@@ -360,13 +348,14 @@ static void ich9_set_sci(void *opaque, int irq_num, int level)
|
||||
}
|
||||
lpc->sci_level = level;
|
||||
|
||||
irq = ich9_lpc_sci_irq(lpc);
|
||||
irq = lpc->sci_gsi;
|
||||
if (irq < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ich9_lpc_update_apic(lpc, irq);
|
||||
if (irq < ICH9_LPC_PIC_NUM_PINS) {
|
||||
if (irq >= ICH9_LPC_PIC_NUM_PINS) {
|
||||
ich9_lpc_update_apic(lpc, irq);
|
||||
} else {
|
||||
ich9_lpc_update_pic(lpc, irq);
|
||||
}
|
||||
}
|
||||
@@ -403,12 +392,27 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
|
||||
|
||||
/* config:PMBASE */
|
||||
static void
|
||||
ich9_lpc_pmbase_update(ICH9LPCState *lpc)
|
||||
ich9_lpc_pmbase_sci_update(ICH9LPCState *lpc)
|
||||
{
|
||||
uint32_t pm_io_base = pci_get_long(lpc->d.config + ICH9_LPC_PMBASE);
|
||||
pm_io_base &= ICH9_LPC_PMBASE_BASE_ADDRESS_MASK;
|
||||
uint8_t acpi_cntl = pci_get_long(lpc->d.config + ICH9_LPC_ACPI_CTRL);
|
||||
uint8_t new_gsi;
|
||||
|
||||
if (acpi_cntl & ICH9_LPC_ACPI_CTRL_ACPI_EN) {
|
||||
pm_io_base &= ICH9_LPC_PMBASE_BASE_ADDRESS_MASK;
|
||||
} else {
|
||||
pm_io_base = 0;
|
||||
}
|
||||
|
||||
ich9_pm_iospace_update(&lpc->pm, pm_io_base);
|
||||
|
||||
new_gsi = ich9_lpc_sci_irq(lpc);
|
||||
if (lpc->sci_level && new_gsi != lpc->sci_gsi) {
|
||||
qemu_set_irq(lpc->pm.irq, 0);
|
||||
lpc->sci_gsi = new_gsi;
|
||||
qemu_set_irq(lpc->pm.irq, 1);
|
||||
}
|
||||
lpc->sci_gsi = new_gsi;
|
||||
}
|
||||
|
||||
/* config:RCBA */
|
||||
@@ -445,7 +449,7 @@ static int ich9_lpc_post_load(void *opaque, int version_id)
|
||||
{
|
||||
ICH9LPCState *lpc = opaque;
|
||||
|
||||
ich9_lpc_pmbase_update(lpc);
|
||||
ich9_lpc_pmbase_sci_update(lpc);
|
||||
ich9_lpc_rcba_update(lpc, 0 /* disabled ICH9_LPC_RCBA_EN */);
|
||||
ich9_lpc_pmcon_update(lpc);
|
||||
return 0;
|
||||
@@ -458,8 +462,9 @@ static void ich9_lpc_config_write(PCIDevice *d,
|
||||
uint32_t rcba_old = pci_get_long(d->config + ICH9_LPC_RCBA);
|
||||
|
||||
pci_default_write_config(d, addr, val, len);
|
||||
if (ranges_overlap(addr, len, ICH9_LPC_PMBASE, 4)) {
|
||||
ich9_lpc_pmbase_update(lpc);
|
||||
if (ranges_overlap(addr, len, ICH9_LPC_PMBASE, 4) ||
|
||||
ranges_overlap(addr, len, ICH9_LPC_ACPI_CTRL, 1)) {
|
||||
ich9_lpc_pmbase_sci_update(lpc);
|
||||
}
|
||||
if (ranges_overlap(addr, len, ICH9_LPC_RCBA, 4)) {
|
||||
ich9_lpc_rcba_update(lpc, rcba_old);
|
||||
@@ -497,7 +502,7 @@ static void ich9_lpc_reset(DeviceState *qdev)
|
||||
|
||||
ich9_cc_reset(lpc);
|
||||
|
||||
ich9_lpc_pmbase_update(lpc);
|
||||
ich9_lpc_pmbase_sci_update(lpc);
|
||||
ich9_lpc_rcba_update(lpc, rcba_old);
|
||||
|
||||
lpc->sci_level = 0;
|
||||
@@ -577,7 +582,7 @@ static void ich9_lpc_get_sci_int(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
|
||||
uint32_t value = ich9_lpc_sci_irq(lpc);
|
||||
uint32_t value = lpc->sci_gsi;
|
||||
|
||||
visit_type_uint32(v, name, &value, errp);
|
||||
}
|
||||
@@ -608,6 +613,7 @@ static void ich9_lpc_initfn(Object *obj)
|
||||
static void ich9_lpc_realize(PCIDevice *d, Error **errp)
|
||||
{
|
||||
ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
|
||||
DeviceState *dev = DEVICE(d);
|
||||
ISABus *isa_bus;
|
||||
|
||||
isa_bus = isa_bus_new(DEVICE(d), get_system_memory(), get_system_io(),
|
||||
@@ -618,6 +624,9 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
|
||||
|
||||
pci_set_long(d->wmask + ICH9_LPC_PMBASE,
|
||||
ICH9_LPC_PMBASE_BASE_ADDRESS_MASK);
|
||||
pci_set_byte(d->wmask + ICH9_LPC_PMBASE,
|
||||
ICH9_LPC_ACPI_CTRL_ACPI_EN |
|
||||
ICH9_LPC_ACPI_CTRL_SCI_IRQ_SEL_MASK);
|
||||
|
||||
memory_region_init_io(&lpc->rcrb_mem, OBJECT(d), &rcrb_mmio_ops, lpc,
|
||||
"lpc-rcrb-mmio", ICH9_CC_SIZE);
|
||||
@@ -635,6 +644,10 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
|
||||
memory_region_add_subregion_overlap(pci_address_space_io(d),
|
||||
ICH9_RST_CNT_IOPORT, &lpc->rst_cnt_mem,
|
||||
1);
|
||||
|
||||
qdev_init_gpio_out_named(dev, lpc->gsi, ICH9_GPIO_GSI, GSI_NUM_PINS);
|
||||
|
||||
isa_bus_irqs(isa_bus, lpc->gsi);
|
||||
}
|
||||
|
||||
static bool ich9_rst_cnt_needed(void *opaque)
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#define VMPORT_ENTRIES 0x2c
|
||||
#define VMPORT_MAGIC 0x564D5868
|
||||
|
||||
#define TYPE_VMPORT "vmport"
|
||||
#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
|
||||
|
||||
typedef struct VMPortState
|
||||
|
||||
@@ -127,6 +127,10 @@ static Property mch_props[] = {
|
||||
DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, Q35PCIHost,
|
||||
mch.pci_hole64_size, DEFAULT_PCI_HOLE64_SIZE),
|
||||
DEFINE_PROP_UINT32("short_root_bus", Q35PCIHost, mch.short_root_bus, 0),
|
||||
DEFINE_PROP_SIZE(PCI_HOST_BELOW_4G_MEM_SIZE, Q35PCIHost,
|
||||
mch.below_4g_mem_size, 0),
|
||||
DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, Q35PCIHost,
|
||||
mch.above_4g_mem_size, 0),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
@@ -177,6 +181,22 @@ static void q35_host_initfn(Object *obj)
|
||||
q35_host_get_mmcfg_size,
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
object_property_add_link(obj, MCH_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGION,
|
||||
(Object **) &s->mch.ram_memory,
|
||||
qdev_prop_allow_set_link_before_realize, 0, NULL);
|
||||
|
||||
object_property_add_link(obj, MCH_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGION,
|
||||
(Object **) &s->mch.pci_address_space,
|
||||
qdev_prop_allow_set_link_before_realize, 0, NULL);
|
||||
|
||||
object_property_add_link(obj, MCH_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_REGION,
|
||||
(Object **) &s->mch.system_memory,
|
||||
qdev_prop_allow_set_link_before_realize, 0, NULL);
|
||||
|
||||
object_property_add_link(obj, MCH_HOST_PROP_IO_MEM, TYPE_MEMORY_REGION,
|
||||
(Object **) &s->mch.address_space_io,
|
||||
qdev_prop_allow_set_link_before_realize, 0, NULL);
|
||||
|
||||
/* Leave enough space for the biggest MCFG BAR */
|
||||
/* TODO: this matches current bios behaviour, but
|
||||
* it's not a power of two, which means an MTRR
|
||||
|
||||
+3
-2
@@ -574,7 +574,7 @@ static bool esp_mem_accepts(void *opaque, hwaddr addr,
|
||||
|
||||
const VMStateDescription vmstate_esp = {
|
||||
.name ="esp",
|
||||
.version_id = 3,
|
||||
.version_id = 4,
|
||||
.minimum_version_id = 3,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_BUFFER(rregs, ESPState),
|
||||
@@ -585,7 +585,8 @@ const VMStateDescription vmstate_esp = {
|
||||
VMSTATE_BUFFER(ti_buf, ESPState),
|
||||
VMSTATE_UINT32(status, ESPState),
|
||||
VMSTATE_UINT32(dma, ESPState),
|
||||
VMSTATE_BUFFER(cmdbuf, ESPState),
|
||||
VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16),
|
||||
VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4),
|
||||
VMSTATE_UINT32(cmdlen, ESPState),
|
||||
VMSTATE_UINT32(do_cmd, ESPState),
|
||||
VMSTATE_UINT32(dma_left, ESPState),
|
||||
|
||||
@@ -906,6 +906,8 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
object_property_add_alias(qdev_get_machine(), "rtc-time",
|
||||
OBJECT(s), "date", NULL);
|
||||
|
||||
qdev_init_gpio_out(dev, &s->irq, 1);
|
||||
}
|
||||
|
||||
ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
|
||||
@@ -920,9 +922,9 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
|
||||
qdev_prop_set_int32(dev, "base_year", base_year);
|
||||
qdev_init_nofail(dev);
|
||||
if (intercept_irq) {
|
||||
s->irq = intercept_irq;
|
||||
qdev_connect_gpio_out(dev, 0, intercept_irq);
|
||||
} else {
|
||||
isa_init_irq(isadev, &s->irq, RTC_ISA_IRQ);
|
||||
isa_connect_gpio_out(isadev, 0, RTC_ISA_IRQ);
|
||||
}
|
||||
QLIST_INSERT_HEAD(&rtc_devices, s, link);
|
||||
|
||||
|
||||
@@ -304,4 +304,6 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
uint8_t *buf, int len, int is_write);
|
||||
|
||||
int cpu_exec(CPUState *cpu);
|
||||
|
||||
#endif /* CPU_ALL_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user