trivial patches for 2017-01-24

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABCAAGBQJYh7icAAoJEHAbT2saaT5ZixMH/2qr2TPaAARnTPFzf/mfpHvR
 jYKZary6L//DTCqjrys5zAVzKUg8rCPGwWI2T2FDsos7Ku4MKBBSfDmnabc+iu0P
 7Rkr18dPGi5ozAiHcGzNXivODVrXBqZT3KcJZ1aYo04Bl0xszxO+fWp2B6n9aXIs
 g4HFq98XGXut8Rs7wNcsUOGHTkIupnzxt+TYXFhezRPq/6bRWZj8pPjwiPReZJBP
 w6IhlVkIxsMdW1tpy+Im21aKCWO23mvQYj+ZiS2eb2F/jcSshL9xp1vqlbNU65H1
 w/zQaUE+m0yJhF7sVKM76101vnDJ1DPxiD/45BnF5p/xwiYcUwpS5UG53riFxAA=
 =B6et
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging

trivial patches for 2017-01-24

# gpg: Signature made Tue 24 Jan 2017 20:27:08 GMT
# gpg:                using RSA key 0x701B4F6B1A693E59
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* remotes/mjt/tags/trivial-patches-fetch: (31 commits)
  hw/isa/isa-bus: Set category of the "isabus-bridge" device
  usb: Set category and description of the MTP device
  gdbstub.c: update old error report statements
  gdbstub.c: fix GDB connection segfault caused by empty machines
  scsi-disk: add 'fall through' comment to switch VERIFY cases
  Drop duplicate display option documentation
  hw/display/framebuffer.c: Avoid overflow for framebuffers > 4GB
  win32: use glib gpoll if glib >= 2.50
  util/mmap-alloc: refactor a little bit for readability
  util/mmap-alloc: check parameter before using
  vfio: remove a duplicated word in comments
  docs: sync pci-ids.txt
  disas/cris.c: Fix Coverity warning about unchecked NULL
  lm32: milkymist-tmu2: fix another integer overflow
  hw/i386/kvmvapic: Remove dead code in patch_hypercalls()
  doc/usb2: fix typo
  qga: fix erroneous argument to strerror
  block: remove dead check
  pci-assign: avoid pointless stat
  qemu-img: remove dead check
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-01-25 10:42:26 +00:00
commit ffb5a69c31
43 changed files with 88 additions and 104 deletions

1
README
View File

@ -45,6 +45,7 @@ of other UNIX targets. The simple steps to build QEMU are:
Additional information can also be found online via the QEMU website: Additional information can also be found online via the QEMU website:
http://qemu-project.org/Hosts/Linux http://qemu-project.org/Hosts/Linux
http://qemu-project.org/Hosts/Mac
http://qemu-project.org/Hosts/W32 http://qemu-project.org/Hosts/W32

View File

@ -1851,7 +1851,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
bdrv_refresh_filename(bs); bdrv_refresh_filename(bs);
/* Check if any unknown options were used */ /* Check if any unknown options were used */
if (options && (qdict_size(options) != 0)) { if (qdict_size(options) != 0) {
const QDictEntry *entry = qdict_first(options); const QDictEntry *entry = qdict_first(options);
if (flags & BDRV_O_PROTOCOL) { if (flags & BDRV_O_PROTOCOL) {
error_setg(errp, "Block protocol '%s' doesn't support the option " error_setg(errp, "Block protocol '%s' doesn't support the option "

View File

@ -2490,7 +2490,7 @@ print_with_operands (const struct cris_opcode *opcodep,
const struct cris_spec_reg *sregp const struct cris_spec_reg *sregp
= spec_reg_info ((insn >> 12) & 15, disdata->distype); = spec_reg_info ((insn >> 12) & 15, disdata->distype);
if (sregp->name == NULL) if (sregp == NULL || sregp->name == NULL)
/* Should have been caught as a non-match earlier. */ /* Should have been caught as a non-match earlier. */
*tp++ = '?'; *tp++ = '?';
else else

View File

@ -57,7 +57,10 @@ PCI devices (other than virtio):
1b36:0005 PCI test device (docs/specs/pci-testdev.txt) 1b36:0005 PCI test device (docs/specs/pci-testdev.txt)
1b36:0006 PCI Rocker Ethernet switch device 1b36:0006 PCI Rocker Ethernet switch device
1b36:0007 PCI SD Card Host Controller Interface (SDHCI) 1b36:0007 PCI SD Card Host Controller Interface (SDHCI)
1b36:0008 PCIe host bridge
1b36:0009 PCI Expander Bridge (-device pxb)
1b36:000a PCI-PCI bridge (multiseat) 1b36:000a PCI-PCI bridge (multiseat)
1b36:000b PCIe Expander Bridge (-device pxb-pcie)
All these devices are documented in docs/specs. All these devices are documented in docs/specs.

View File

@ -34,7 +34,7 @@ with tree logical units:
Number three emulates the classic bulk-only transport protocol too. Number three emulates the classic bulk-only transport protocol too.
It's called "usb-bot". It shares most code with "usb-storage", and It's called "usb-bot". It shares most code with "usb-storage", and
the guest will not be able to see the difference. The qemu command the guest will not be able to see the difference. The qemu command
line interface is simliar to usb-uas though, i.e. no automatic scsi line interface is similar to usb-uas though, i.e. no automatic scsi
disk creation. It also features support for up to 16 LUNs. The LUN disk creation. It also features support for up to 16 LUNs. The LUN
numbers must be continuous, i.e. for three devices you must use 0+1+2. numbers must be continuous, i.e. for three devices you must use 0+1+2.
The 0+1+5 numbering from the "usb-uas" example isn't going to work The 0+1+5 numbering from the "usb-uas" example isn't going to work

View File

@ -19,7 +19,7 @@ the controller so the USB 2.0 bus gets a individual name, for example
'-device usb-ehci,id=ehci". This will give you a USB 2.0 bus named '-device usb-ehci,id=ehci". This will give you a USB 2.0 bus named
"ehci.0". "ehci.0".
I strongly recomment to also use -device to attach usb devices because I strongly recommend to also use -device to attach usb devices because
you can specify the bus they should be attached to this way. Here is you can specify the bus they should be attached to this way. Here is
a complete example: a complete example:

View File

@ -18,6 +18,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "cpu.h" #include "cpu.h"
#ifdef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
@ -637,8 +638,8 @@ void gdb_register_coprocessor(CPUState *cpu,
*p = s; *p = s;
if (g_pos) { if (g_pos) {
if (g_pos != s->base_reg) { if (g_pos != s->base_reg) {
fprintf(stderr, "Error: Bad gdb register numbering for '%s'\n" error_report("Error: Bad gdb register numbering for '%s', "
"Expected %d got %d\n", xml, g_pos, s->base_reg); "expected %d got %d", xml, g_pos, s->base_reg);
} else { } else {
cpu->gdb_num_g_regs = cpu->gdb_num_regs; cpu->gdb_num_g_regs = cpu->gdb_num_regs;
} }
@ -890,7 +891,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
} }
case 'k': case 'k':
/* Kill the target */ /* Kill the target */
fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); error_report("QEMU: Terminated via GDBstub");
exit(0); exit(0);
case 'D': case 'D':
/* Detach packet */ /* Detach packet */
@ -1358,7 +1359,7 @@ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va)
break; break;
default: default:
bad_format: bad_format:
fprintf(stderr, "gdbstub: Bad syscall format string '%s'\n", error_report("gdbstub: Bad syscall format string '%s'",
fmt - 1); fmt - 1);
break; break;
} }
@ -1732,6 +1733,12 @@ int gdbserver_start(const char *device)
CharDriverState *mon_chr; CharDriverState *mon_chr;
ChardevCommon common = { 0 }; ChardevCommon common = { 0 };
if (!first_cpu) {
error_report("gdbstub: meaningless to attach gdb to a "
"machine without any CPU.");
return -1;
}
if (!device) if (!device)
return -1; return -1;
if (strcmp(device, "none") != 0) { if (strcmp(device, "none") != 0) {

View File

@ -147,7 +147,7 @@ typedef struct FlashPartInfo {
#define CFG_DUMMY_CLK_LEN 4 #define CFG_DUMMY_CLK_LEN 4
#define NVCFG_DUMMY_CLK_POS 12 #define NVCFG_DUMMY_CLK_POS 12
#define VCFG_DUMMY_CLK_POS 4 #define VCFG_DUMMY_CLK_POS 4
#define EVCFG_OUT_DRIVER_STRENGHT_DEF 7 #define EVCFG_OUT_DRIVER_STRENGTH_DEF 7
#define EVCFG_VPP_ACCELERATOR (1 << 3) #define EVCFG_VPP_ACCELERATOR (1 << 3)
#define EVCFG_RESET_HOLD_ENABLED (1 << 4) #define EVCFG_RESET_HOLD_ENABLED (1 << 4)
#define NVCFG_DUAL_IO_MASK (1 << 2) #define NVCFG_DUAL_IO_MASK (1 << 2)
@ -747,7 +747,7 @@ static void reset_memory(Flash *s)
); );
s->enh_volatile_cfg = 0; s->enh_volatile_cfg = 0;
s->enh_volatile_cfg |= EVCFG_OUT_DRIVER_STRENGHT_DEF; s->enh_volatile_cfg |= EVCFG_OUT_DRIVER_STRENGTH_DEF;
s->enh_volatile_cfg |= EVCFG_VPP_ACCELERATOR; s->enh_volatile_cfg |= EVCFG_VPP_ACCELERATOR;
s->enh_volatile_cfg |= EVCFG_RESET_HOLD_ENABLED; s->enh_volatile_cfg |= EVCFG_RESET_HOLD_ENABLED;
if (s->nonvolatile_cfg & NVCFG_DUAL_IO_MASK) { if (s->nonvolatile_cfg & NVCFG_DUAL_IO_MASK) {

View File

@ -27,7 +27,7 @@
* this it needs a backend to manage the datas, the same as other * this it needs a backend to manage the datas, the same as other
* memory-related devices. In this case as the backend is so trivial we * memory-related devices. In this case as the backend is so trivial we
* have merged it with the frontend instead of creating and maintaining a * have merged it with the frontend instead of creating and maintaining a
* seperate backend. * separate backend.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
@ -79,7 +79,7 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
"loading memory values"); "loading memory values");
return; return;
} else if (!s->data_len) { } else if (!s->data_len) {
/* We cant' check for !data here as a value of 0 is still valid. */ /* We can't check for !data here as a value of 0 is still valid. */
error_setg(errp, "Both data and data-len must be specified"); error_setg(errp, "Both data and data-len must be specified");
return; return;
} else if (s->data_len > 8) { } else if (s->data_len > 8) {

View File

@ -711,7 +711,7 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
/* /*
* Catch "invalid" device reference from vfio-pci and allow the * Catch "invalid" device reference from vfio-pci and allow the
* default buffer representing the non-existant device to be used. * default buffer representing the non-existent device to be used.
*/ */
if (~addr->domain || ~addr->bus || ~addr->slot || ~addr->function) { if (~addr->domain || ~addr->bus || ~addr->slot || ~addr->function) {
rc = snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%0d", rc = snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%0d",

View File

@ -78,7 +78,7 @@ void framebuffer_update_display(
i = *first_row; i = *first_row;
*first_row = -1; *first_row = -1;
src_len = src_width * rows; src_len = (hwaddr)src_width * rows;
mem = mem_section->mr; mem = mem_section->mr;
if (!mem) { if (!mem) {

View File

@ -257,7 +257,7 @@ static void tmu2_start(MilkymistTMU2State *s)
glColor4f(m, m, m, (float)(s->regs[R_ALPHA] + 1) / 64.0f); glColor4f(m, m, m, (float)(s->regs[R_ALPHA] + 1) / 64.0f);
/* Read the QEMU dest. framebuffer into the OpenGL framebuffer */ /* Read the QEMU dest. framebuffer into the OpenGL framebuffer */
fb_len = 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; fb_len = 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 0); fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 0);
if (fb == NULL) { if (fb == NULL) {
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);

View File

@ -555,7 +555,7 @@ static void xlnx_dp_recreate_surface(XlnxDPState *s)
if ((width != 0) && (height != 0)) { if ((width != 0) && (height != 0)) {
/* /*
* As dpy_gfx_replace_surface calls qemu_free_displaysurface on the * As dpy_gfx_replace_surface calls qemu_free_displaysurface on the
* surface we need to be carefull and don't free the surface associated * surface we need to be careful and don't free the surface associated
* to the console or double free will happen. * to the console or double free will happen.
*/ */
if (s->bout_plane.surface != current_console_surface) { if (s->bout_plane.surface != current_console_surface) {
@ -1160,7 +1160,7 @@ static void xlnx_dp_update_display(void *opaque)
*/ */
if (!xlnx_dpdma_start_operation(s->dpdma, 3, false)) { if (!xlnx_dpdma_start_operation(s->dpdma, 3, false)) {
/* /*
* An error occured don't do anything with the data.. * An error occurred don't do anything with the data..
* Trigger an underflow interrupt. * Trigger an underflow interrupt.
*/ */
s->core_registers[DP_INT_STATUS] |= (1 << 21); s->core_registers[DP_INT_STATUS] |= (1 << 21);

View File

@ -535,7 +535,6 @@ static int patch_hypercalls(VAPICROMState *s)
uint8_t alternates[2]; uint8_t alternates[2];
const uint8_t *pattern; const uint8_t *pattern;
const uint8_t *patch; const uint8_t *patch;
int patches = 0;
off_t pos; off_t pos;
uint8_t *rom; uint8_t *rom;
@ -566,11 +565,6 @@ static int patch_hypercalls(VAPICROMState *s)
} }
g_free(rom); g_free(rom);
if (patches != 0 && patches != 2) {
return -1;
}
return 0; return 0;
} }

View File

@ -1777,7 +1777,7 @@ static int pc_apic_cmp(const void *a, const void *b)
/* returns pointer to CPUArchId descriptor that matches CPU's apic_id /* returns pointer to CPUArchId descriptor that matches CPU's apic_id
* in pcms->possible_cpus->cpus, if pcms->possible_cpus->cpus has no * in pcms->possible_cpus->cpus, if pcms->possible_cpus->cpus has no
* entry correponding to CPU's apic_id returns NULL. * entry corresponding to CPU's apic_id returns NULL.
*/ */
static CPUArchId *pc_find_cpu_slot(PCMachineState *pcms, CPUState *cpu, static CPUArchId *pc_find_cpu_slot(PCMachineState *pcms, CPUState *cpu,
int *idx) int *idx)

View File

@ -39,19 +39,19 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner,
"/sys/bus/pci/devices/%04x:%02x:%02x.%01x/rom", "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/rom",
domain, bus, slot, function); domain, bus, slot, function);
if (stat(rom_file, &st)) {
if (errno != ENOENT) {
error_report("pci-assign: Invalid ROM.");
}
return NULL;
}
/* Write "1" to the ROM file to enable it */ /* Write "1" to the ROM file to enable it */
fp = fopen(rom_file, "r+"); fp = fopen(rom_file, "r+");
if (fp == NULL) { if (fp == NULL) {
if (errno != ENOENT) {
error_report("pci-assign: Cannot open %s: %s", rom_file, strerror(errno)); error_report("pci-assign: Cannot open %s: %s", rom_file, strerror(errno));
}
return NULL; return NULL;
} }
if (fstat(fileno(fp), &st) == -1) {
error_report("pci-assign: Cannot stat %s: %s", rom_file, strerror(errno));
goto close_rom;
}
val = 1; val = 1;
if (fwrite(&val, 1, 1, fp) != 1) { if (fwrite(&val, 1, 1, fp) != 1) {
goto close_rom; goto close_rom;

View File

@ -219,6 +219,7 @@ static void isabus_bridge_class_init(ObjectClass *klass, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
dc->fw_name = "isa"; dc->fw_name = "isa";
} }

View File

@ -896,7 +896,7 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
DB_PRINT("config bufsize: %d packet size: %ld\n", rxbufsize, size); DB_PRINT("config bufsize: %d packet size: %ld\n", rxbufsize, size);
/* Find which queue we are targetting */ /* Find which queue we are targeting */
q = get_queue_from_screen(s, rxbuf_ptr, rxbufsize); q = get_queue_from_screen(s, rxbuf_ptr, rxbufsize);
while (bytes_to_copy) { while (bytes_to_copy) {

View File

@ -105,7 +105,7 @@ typedef struct VIOsPAPRVLANDevice {
uint32_t add_buf_ptr, use_buf_ptr, rx_bufs; uint32_t add_buf_ptr, use_buf_ptr, rx_bufs;
hwaddr rxq_ptr; hwaddr rxq_ptr;
QEMUTimer *rxp_timer; QEMUTimer *rxp_timer;
uint32_t compat_flags; /* Compatability flags for migration */ uint32_t compat_flags; /* Compatibility flags for migration */
RxBufPool *rx_pool[RX_MAX_POOLS]; /* Receive buffer descriptor pools */ RxBufPool *rx_pool[RX_MAX_POOLS]; /* Receive buffer descriptor pools */
} VIOsPAPRVLANDevice; } VIOsPAPRVLANDevice;
@ -559,7 +559,7 @@ static target_long spapr_vlan_add_rxbuf_to_pool(VIOsPAPRVLANDevice *dev,
if (pool < 0) { if (pool < 0) {
/* /*
* No matching pool found? Try to use a new one. If the guest used all * No matching pool found? Try to use a new one. If the guest used all
* pools before, but changed the size of one pool inbetween, we might * pools before, but changed the size of one pool in the meantime, we might
* need to recycle that pool here (if it's empty already). Thus scan * need to recycle that pool here (if it's empty already). Thus scan
* all buffer pools now, starting with the last (likely empty) one. * all buffer pools now, starting with the last (likely empty) one.
*/ */

View File

@ -656,7 +656,7 @@ static void pcie_ext_cap_set_next(PCIDevice *dev, uint16_t pos, uint16_t next)
} }
/* /*
* caller must supply valid (offset, size) * such that the range shouldn't * Caller must supply valid (offset, size) such that the range wouldn't
* overlap with other capability or other registers. * overlap with other capability or other registers.
* This function doesn't check it. * This function doesn't check it.
*/ */

View File

@ -59,7 +59,7 @@ static uint32_t set_isolation_state(sPAPRDRConnector *drc,
trace_spapr_drc_set_isolation_state(get_index(drc), state); trace_spapr_drc_set_isolation_state(get_index(drc), state);
if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) { if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) {
/* cannot unisolate a non-existant resource, and, or resources /* cannot unisolate a non-existent resource, and, or resources
* which are in an 'UNUSABLE' allocation state. (PAPR 2.7, 13.5.3.5) * which are in an 'UNUSABLE' allocation state. (PAPR 2.7, 13.5.3.5)
*/ */
if (!drc->dev || if (!drc->dev ||

View File

@ -183,8 +183,8 @@ enum ZpciIoatDtype {
* may enter an error state * may enter an error state
* blocked: ignore all DMA and interrupts; transition back to enabled or from * blocked: ignore all DMA and interrupts; transition back to enabled or from
* error state via mpcifc * error state via mpcifc
* error: an error occured; transition back to enabled via mpcifc * error: an error occurred; transition back to enabled via mpcifc
* permanent error: an unrecoverable error occured; transition to standby via * permanent error: an unrecoverable error occurred; transition to standby via
* sclp deconfigure * sclp deconfigure
*/ */
typedef enum { typedef enum {

View File

@ -2157,6 +2157,7 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf)
DPRINTF("Write %s(sector %" PRId64 ", count %u)\n", DPRINTF("Write %s(sector %" PRId64 ", count %u)\n",
(command & 0xe) == 0xe ? "And Verify " : "", (command & 0xe) == 0xe ? "And Verify " : "",
r->req.cmd.lba, len); r->req.cmd.lba, len);
/* fall through */
case VERIFY_10: case VERIFY_10:
case VERIFY_12: case VERIFY_12:
case VERIFY_16: case VERIFY_16:

View File

@ -1093,7 +1093,7 @@ static MTPData *usb_mtp_get_object_prop_value(MTPState *s, MTPControl *c,
} }
break; break;
case PROP_PERSISTENT_UNIQUE_OBJECT_IDENTIFIER: case PROP_PERSISTENT_UNIQUE_OBJECT_IDENTIFIER:
/* Should be persistant between sessions, /* Should be persistent between sessions,
* but using our objedt ID is "good enough" * but using our objedt ID is "good enough"
* for now */ * for now */
usb_mtp_add_u64(d, 0x0000000000000000); usb_mtp_add_u64(d, 0x0000000000000000);
@ -1580,6 +1580,8 @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data)
uc->handle_reset = usb_mtp_handle_reset; uc->handle_reset = usb_mtp_handle_reset;
uc->handle_control = usb_mtp_handle_control; uc->handle_control = usb_mtp_handle_control;
uc->handle_data = usb_mtp_handle_data; uc->handle_data = usb_mtp_handle_data;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
dc->desc = "USB Media Transfer Protocol device";
dc->fw_name = "mtp"; dc->fw_name = "mtp";
dc->vmsd = &vmstate_usb_mtp; dc->vmsd = &vmstate_usb_mtp;
dc->props = mtp_properties; dc->props = mtp_properties;

View File

@ -1171,7 +1171,7 @@ static int vfio_pci_igd_host_init(VFIOPCIDevice *vdev,
* IGD LPC/ISA bridge support code. The vBIOS needs this, but we can't write * IGD LPC/ISA bridge support code. The vBIOS needs this, but we can't write
* arbitrary values into just any bridge, so we must create our own. We try * arbitrary values into just any bridge, so we must create our own. We try
* to handle if the user has created it for us, which they might want to do * to handle if the user has created it for us, which they might want to do
* to enable multifuction so we don't occupy the whole PCI slot. * to enable multifunction so we don't occupy the whole PCI slot.
*/ */
static void vfio_pci_igd_lpc_bridge_realize(PCIDevice *pdev, Error **errp) static void vfio_pci_igd_lpc_bridge_realize(PCIDevice *pdev, Error **errp)
{ {

View File

@ -1881,8 +1881,8 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
* 0 is reserved for this since absence of capabilities is indicated by * 0 is reserved for this since absence of capabilities is indicated by
* 0 for the ID, version, AND next pointer. However, pcie_add_capability() * 0 for the ID, version, AND next pointer. However, pcie_add_capability()
* uses ID 0 as reserved for list management and will incorrectly match and * uses ID 0 as reserved for list management and will incorrectly match and
* assert if we attempt to pre-load the head of the chain with with this * assert if we attempt to pre-load the head of the chain with this ID.
* ID. Use ID 0xFFFF temporarily since it is also seems to be reserved in * Use ID 0xFFFF temporarily since it is also seems to be reserved in
* part for identifying absence of capabilities in a root complex register * part for identifying absence of capabilities in a root complex register
* block. If the ID still exists after adding capabilities, switch back to * block. If the ID still exists after adding capabilities, switch back to
* zero. We'll mark this entire first dword as emulated for this purpose. * zero. We'll mark this entire first dword as emulated for this purpose.

View File

@ -786,7 +786,7 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
vcrypto->max_queues = MAX(vcrypto->cryptodev->conf.peers.queues, 1); vcrypto->max_queues = MAX(vcrypto->cryptodev->conf.peers.queues, 1);
if (vcrypto->max_queues + 1 > VIRTIO_QUEUE_MAX) { if (vcrypto->max_queues + 1 > VIRTIO_QUEUE_MAX) {
error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " error_setg(errp, "Invalid number of queues (= %" PRIu32 "), "
"must be a postive integer less than %d.", "must be a positive integer less than %d.",
vcrypto->max_queues, VIRTIO_QUEUE_MAX); vcrypto->max_queues, VIRTIO_QUEUE_MAX);
return; return;
} }

View File

@ -39,7 +39,7 @@ static inline gint64 qemu_g_get_monotonic_time(void)
#define g_get_monotonic_time() qemu_g_get_monotonic_time() #define g_get_monotonic_time() qemu_g_get_monotonic_time()
#endif #endif
#ifdef _WIN32 #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0)
/* /*
* g_poll has a problem on Windows when using * g_poll has a problem on Windows when using
* timeouts < 10ms, so use wrapper. * timeouts < 10ms, so use wrapper.

View File

@ -53,7 +53,8 @@ typedef struct XlnxDPDMAState XlnxDPDMAState;
* data to the buffer specified by * data to the buffer specified by
* dpdma_set_host_data_location(). * dpdma_set_host_data_location().
* *
* Returns The number of bytes transfered by the DPDMA or 0 if an error occured. * Returns The number of bytes transferred by the DPDMA
* or 0 if an error occurred.
* *
* @s The DPDMA state. * @s The DPDMA state.
* @channel The channel to start. * @channel The channel to start.

View File

@ -180,7 +180,7 @@ typedef struct Q35PCIHost {
uint64_t mch_mcfg_base(void); uint64_t mch_mcfg_base(void);
/* /*
* Arbitary but unique BNF number for IOAPIC device. * Arbitrary but unique BNF number for IOAPIC device.
* *
* TODO: make sure there would have no conflict with real PCI bus * TODO: make sure there would have no conflict with real PCI bus
*/ */

View File

@ -92,7 +92,7 @@ struct RegisterInfo {
* This structure is used to group all of the individual registers which are * This structure is used to group all of the individual registers which are
* modeled using the RegisterInfo structure. * modeled using the RegisterInfo structure.
* *
* @r is an aray containing of all the relevent RegisterInfo structures. * @r is an array containing of all the relevant RegisterInfo structures.
* *
* @num_elements is the number of elements in the array r * @num_elements is the number of elements in the array r
* *

View File

@ -19,7 +19,7 @@
typedef struct QapiDeallocVisitor QapiDeallocVisitor; typedef struct QapiDeallocVisitor QapiDeallocVisitor;
/* /*
* The dealloc visitor is primarly used only by generated * The dealloc visitor is primarily used only by generated
* qapi_free_FOO() functions, and is the only visitor designed to work * qapi_free_FOO() functions, and is the only visitor designed to work
* correctly in the face of a partially-constructed QAPI tree. * correctly in the face of a partially-constructed QAPI tree.
*/ */

View File

@ -72,7 +72,7 @@ void qht_destroy(struct qht *ht);
* In case of successful operation, smp_wmb() is implied before the pointer is * In case of successful operation, smp_wmb() is implied before the pointer is
* inserted into the hash table. * inserted into the hash table.
* *
* Returns true on sucess. * Returns true on success.
* Returns false if the @p-@hash pair already exists in the hash table. * Returns false if the @p-@hash pair already exists in the hash table.
*/ */
bool qht_insert(struct qht *ht, void *p, uint32_t hash); bool qht_insert(struct qht *ht, void *p, uint32_t hash);

View File

@ -14,7 +14,7 @@
#define QEMU_XATTR_H #define QEMU_XATTR_H
/* /*
* Modern distributions (e.g. Fedora 15, have no libattr.so, place attr.h * Modern distributions (e.g. Fedora 15), have no libattr.so, place attr.h
* in /usr/include/sys, and don't have ENOATTR. * in /usr/include/sys, and don't have ENOATTR.
*/ */

View File

@ -432,7 +432,7 @@ struct Object
* @class_base_init: This function is called for all base classes after all * @class_base_init: This function is called for all base classes after all
* parent class initialization has occurred, but before the class itself * parent class initialization has occurred, but before the class itself
* is initialized. This is the function to use to undo the effects of * is initialized. This is the function to use to undo the effects of
* memcpy from the parent class to the descendents. * memcpy from the parent class to the descendants.
* @class_finalize: This function is called during class destruction and is * @class_finalize: This function is called during class destruction and is
* meant to release and dynamic parameters allocated by @class_init. * meant to release and dynamic parameters allocated by @class_init.
* @class_data: Data to pass to the @class_init, @class_base_init and * @class_data: Data to pass to the @class_init, @class_base_init and
@ -586,18 +586,6 @@ struct InterfaceClass
*/ */
Object *object_new(const char *typename); Object *object_new(const char *typename);
/**
* object_new_with_type:
* @type: The type of the object to instantiate.
*
* This function will initialize a new object using heap allocated memory.
* The returned object has a reference count of 1, and will be freed when
* the last reference is dropped.
*
* Returns: The newly allocated and instantiated object.
*/
Object *object_new_with_type(Type type);
/** /**
* object_new_with_props: * object_new_with_props:
* @typename: The name of the type of the object to instantiate. * @typename: The name of the type of the object to instantiate.
@ -726,18 +714,6 @@ int object_set_propv(Object *obj,
Error **errp, Error **errp,
va_list vargs); va_list vargs);
/**
* object_initialize_with_type:
* @data: A pointer to the memory to be used for the object.
* @size: The maximum size available at @data for the object.
* @type: The type of the object to instantiate.
*
* This function will initialize an object. The memory for the object should
* have already been allocated. The returned object has a reference count of 1,
* and will be finalized when the last reference is dropped.
*/
void object_initialize_with_type(void *data, size_t size, Type type);
/** /**
* object_initialize: * object_initialize:
* @obj: A pointer to the memory to be used for the object. * @obj: A pointer to the memory to be used for the object.

View File

@ -1037,7 +1037,7 @@ qemu-system-i386 -iscsi initiator-name=iqn.qemu.test:my-initiator \
@node disk_images_gluster @node disk_images_gluster
@subsection GlusterFS disk images @subsection GlusterFS disk images
GlusterFS is an user space distributed file system. GlusterFS is a user space distributed file system.
You can boot from the GlusterFS disk image with the command: You can boot from the GlusterFS disk image with the command:
@example @example

View File

@ -3455,14 +3455,12 @@ static int img_amend(int argc, char **argv)
create_opts = qemu_opts_append(create_opts, bs->drv->create_opts); create_opts = qemu_opts_append(create_opts, bs->drv->create_opts);
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
if (options) {
qemu_opts_do_parse(opts, options, NULL, &err); qemu_opts_do_parse(opts, options, NULL, &err);
if (err) { if (err) {
error_report_err(err); error_report_err(err);
ret = -1; ret = -1;
goto out; goto out;
} }
}
/* In case the driver does not call amend_status_cb() */ /* In case the driver does not call amend_status_cb() */
qemu_progress_print(0.f, 0); qemu_progress_print(0.f, 0);

View File

@ -32,7 +32,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
" selects emulated machine ('-machine help' for list)\n" " selects emulated machine ('-machine help' for list)\n"
" property accel=accel1[:accel2[:...]] selects accelerator\n" " property accel=accel1[:accel2[:...]] selects accelerator\n"
" supported accelerators are kvm, xen, tcg (default: tcg)\n" " supported accelerators are kvm, xen, tcg (default: tcg)\n"
" kernel_irqchip=on|off controls accelerated irqchip support\n"
" kernel_irqchip=on|off|split controls accelerated irqchip support (default=off)\n" " kernel_irqchip=on|off|split controls accelerated irqchip support (default=off)\n"
" vmport=on|off|auto controls emulation of vmport (default: auto)\n" " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
" kvm_shadow_mem=size of KVM shadow MMU in bytes\n" " kvm_shadow_mem=size of KVM shadow MMU in bytes\n"
@ -250,7 +249,7 @@ use is discouraged as it may be removed from future versions.
ETEXI ETEXI
DEF("m", HAS_ARG, QEMU_OPTION_m, DEF("m", HAS_ARG, QEMU_OPTION_m,
"-m[emory] [size=]megs[,slots=n,maxmem=size]\n" "-m [size=]megs[,slots=n,maxmem=size]\n"
" configure guest RAM\n" " configure guest RAM\n"
" size: initial amount of guest memory\n" " size: initial amount of guest memory\n"
" slots: number of hotplug slots (default: none)\n" " slots: number of hotplug slots (default: none)\n"
@ -927,7 +926,7 @@ ETEXI
DEF("display", HAS_ARG, QEMU_OPTION_display, DEF("display", HAS_ARG, QEMU_OPTION_display,
"-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]\n" "-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]\n"
" [,window_close=on|off][,gl=on|off]|curses|none|\n" " [,window_close=on|off][,gl=on|off]\n"
"-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n" "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
"-display vnc=<display>[,<optargs>]\n" "-display vnc=<display>[,<optargs>]\n"
"-display curses\n" "-display curses\n"
@ -2589,7 +2588,7 @@ qemu-system-i386 --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine
See also @url{http://http://www.osrg.net/sheepdog/}. See also @url{http://http://www.osrg.net/sheepdog/}.
@item GlusterFS @item GlusterFS
GlusterFS is an user space distributed file system. GlusterFS is a user space distributed file system.
QEMU supports the use of GlusterFS volumes for hosting VM disk images using QEMU supports the use of GlusterFS volumes for hosting VM disk images using
TCP, Unix Domain Sockets and RDMA transport protocols. TCP, Unix Domain Sockets and RDMA transport protocols.

View File

@ -558,8 +558,8 @@ static void process_command(GAState *s, QDict *req)
rsp = qmp_dispatch(QOBJECT(req)); rsp = qmp_dispatch(QOBJECT(req));
if (rsp) { if (rsp) {
ret = send_response(s, rsp); ret = send_response(s, rsp);
if (ret) { if (ret < 0) {
g_warning("error sending response: %s", strerror(ret)); g_warning("error sending response: %s", strerror(-ret));
} }
qobject_decref(rsp); qobject_decref(rsp);
} }

View File

@ -357,7 +357,7 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti)
} }
} }
void object_initialize_with_type(void *data, size_t size, TypeImpl *type) static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
{ {
Object *obj = data; Object *obj = data;
@ -473,7 +473,7 @@ static void object_finalize(void *data)
} }
} }
Object *object_new_with_type(Type type) static Object *object_new_with_type(Type type)
{ {
Object *obj; Object *obj;

View File

@ -12,6 +12,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/mmap-alloc.h" #include "qemu/mmap-alloc.h"
#include "qemu/host-utils.h"
#define HUGETLBFS_MAGIC 0x958458f6 #define HUGETLBFS_MAGIC 0x958458f6
@ -61,18 +62,18 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
#else #else
void *ptr = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); void *ptr = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
#endif #endif
size_t offset = QEMU_ALIGN_UP((uintptr_t)ptr, align) - (uintptr_t)ptr; size_t offset;
void *ptr1; void *ptr1;
if (ptr == MAP_FAILED) { if (ptr == MAP_FAILED) {
return MAP_FAILED; return MAP_FAILED;
} }
/* Make sure align is a power of 2 */ assert(is_power_of_2(align));
assert(!(align & (align - 1)));
/* Always align to host page size */ /* Always align to host page size */
assert(align >= getpagesize()); assert(align >= getpagesize());
offset = QEMU_ALIGN_UP((uintptr_t)ptr, align) - (uintptr_t)ptr;
ptr1 = mmap(ptr + offset, size, PROT_READ | PROT_WRITE, ptr1 = mmap(ptr + offset, size, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_FIXED |
(fd == -1 ? MAP_ANONYMOUS : 0) | (fd == -1 ? MAP_ANONYMOUS : 0) |
@ -83,22 +84,20 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
return MAP_FAILED; return MAP_FAILED;
} }
ptr += offset;
total -= offset;
if (offset > 0) { if (offset > 0) {
munmap(ptr - offset, offset); munmap(ptr, offset);
} }
/* /*
* Leave a single PROT_NONE page allocated after the RAM block, to serve as * Leave a single PROT_NONE page allocated after the RAM block, to serve as
* a guard page guarding against potential buffer overflows. * a guard page guarding against potential buffer overflows.
*/ */
total -= offset;
if (total > size + getpagesize()) { if (total > size + getpagesize()) {
munmap(ptr + size + getpagesize(), total - size - getpagesize()); munmap(ptr1 + size + getpagesize(), total - size - getpagesize());
} }
return ptr; return ptr1;
} }
void qemu_ram_munmap(void *ptr, size_t size) void qemu_ram_munmap(void *ptr, size_t size)

View File

@ -327,6 +327,7 @@ char *qemu_get_exec_dir(void)
return g_strdup(exec_dir); return g_strdup(exec_dir);
} }
#if !GLIB_CHECK_VERSION(2, 50, 0)
/* /*
* The original implementation of g_poll from glib has a problem on Windows * The original implementation of g_poll from glib has a problem on Windows
* when using timeouts < 10 ms. * when using timeouts < 10 ms.
@ -530,6 +531,7 @@ gint g_poll(GPollFD *fds, guint nfds, gint timeout)
return retval; return retval;
} }
#endif
int getpagesize(void) int getpagesize(void)
{ {

View File

@ -342,7 +342,7 @@ rfc3986_parse_port(URI *uri, const char **str)
* @uri: pointer to an URI structure * @uri: pointer to an URI structure
* @str: the string to analyze * @str: the string to analyze
* *
* Parse an user informations part and fills in the appropriate fields * Parse a user information part and fill in the appropriate fields
* of the @uri structure * of the @uri structure
* *
* userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) * userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
@ -508,7 +508,7 @@ rfc3986_parse_authority(URI *uri, const char **str)
cur = *str; cur = *str;
/* /*
* try to parse an userinfo and check for the trailing @ * try to parse a userinfo and check for the trailing @
*/ */
ret = rfc3986_parse_user_info(uri, &cur); ret = rfc3986_parse_user_info(uri, &cur);
if ((ret != 0) || (*cur != '@')) if ((ret != 0) || (*cur != '@'))