Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
pm215 committed Jun 29, 2016
2 parents ef8757f + 74b6ce4 commit 1ec20c2
Show file tree
Hide file tree
Showing 63 changed files with 350 additions and 214 deletions.
5 changes: 3 additions & 2 deletions block/iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
9 changes: 7 additions & 2 deletions hw/audio/pcspk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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(),
};

Expand All @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion hw/block/pflash_cfi01.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion hw/block/pflash_cfi02.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 6 additions & 3 deletions hw/char/cadence_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
67 changes: 51 additions & 16 deletions hw/char/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand All @@ -251,29 +259,26 @@ 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. */
} while (!(s->lsr & UART_LSR_THRE));

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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion hw/i2c/smbus_ich9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 0 additions & 4 deletions hw/i386/kvm/pci-assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}
10 changes: 5 additions & 5 deletions hw/i386/pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
}
Expand All @@ -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 = {
Expand Down Expand Up @@ -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)
Expand Down
28 changes: 17 additions & 11 deletions hw/i386/pc_q35.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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()) {
Expand Down
3 changes: 3 additions & 0 deletions hw/i386/pci-assign-load-rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion hw/ide/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Loading

0 comments on commit 1ec20c2

Please sign in to comment.