Skip to content

Commit 5c983d7

Browse files
author
Andre Beckus
committed
Merge in changes from QEMU v2.1.2 (that happened since v2.1.1).
Merge from master v2.1.2 tag.
2 parents 7d8717f + 562d6b4 commit 5c983d7

File tree

11 files changed

+49
-39
lines changed

11 files changed

+49
-39
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.1
1+
2.1.2

backends/rng-egd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
169169
if (b->opened) {
170170
error_set(errp, QERR_PERMISSION_DENIED);
171171
} else {
172+
g_free(s->chr_name);
172173
s->chr_name = g_strdup(value);
173174
}
174175
}

hw/core/machine.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ static void machine_set_accel(Object *obj, const char *value, Error **errp)
2424
{
2525
MachineState *ms = MACHINE(obj);
2626

27+
g_free(ms->accel);
2728
ms->accel = g_strdup(value);
2829
}
2930

@@ -79,6 +80,7 @@ static void machine_set_kernel(Object *obj, const char *value, Error **errp)
7980
{
8081
MachineState *ms = MACHINE(obj);
8182

83+
g_free(ms->kernel_filename);
8284
ms->kernel_filename = g_strdup(value);
8385
}
8486

@@ -93,6 +95,7 @@ static void machine_set_initrd(Object *obj, const char *value, Error **errp)
9395
{
9496
MachineState *ms = MACHINE(obj);
9597

98+
g_free(ms->initrd_filename);
9699
ms->initrd_filename = g_strdup(value);
97100
}
98101

@@ -107,6 +110,7 @@ static void machine_set_append(Object *obj, const char *value, Error **errp)
107110
{
108111
MachineState *ms = MACHINE(obj);
109112

113+
g_free(ms->kernel_cmdline);
110114
ms->kernel_cmdline = g_strdup(value);
111115
}
112116

@@ -121,6 +125,7 @@ static void machine_set_dtb(Object *obj, const char *value, Error **errp)
121125
{
122126
MachineState *ms = MACHINE(obj);
123127

128+
g_free(ms->dtb);
124129
ms->dtb = g_strdup(value);
125130
}
126131

@@ -135,6 +140,7 @@ static void machine_set_dumpdtb(Object *obj, const char *value, Error **errp)
135140
{
136141
MachineState *ms = MACHINE(obj);
137142

143+
g_free(ms->dumpdtb);
138144
ms->dumpdtb = g_strdup(value);
139145
}
140146

@@ -176,6 +182,7 @@ static void machine_set_dt_compatible(Object *obj, const char *value, Error **er
176182
{
177183
MachineState *ms = MACHINE(obj);
178184

185+
g_free(ms->dt_compatible);
179186
ms->dt_compatible = g_strdup(value);
180187
}
181188

@@ -232,6 +239,7 @@ static void machine_set_firmware(Object *obj, const char *value, Error **errp)
232239
{
233240
MachineState *ms = MACHINE(obj);
234241

242+
g_free(ms->firmware);
235243
ms->firmware = g_strdup(value);
236244
}
237245

hw/i386/pc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@
7272
#define DPRINTF(fmt, ...)
7373
#endif
7474

75-
/* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables. */
76-
unsigned acpi_data_size = 0x20000;
75+
/* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables
76+
* (128K) and other BIOS datastructures (less than 4K reported to be used at
77+
* the moment, 32K should be enough for a while). */
78+
unsigned acpi_data_size = 0x20000 + 0x8000;
7779
void pc_set_legacy_acpi_data_size(void)
7880
{
7981
acpi_data_size = 0x10000;

hw/net/virtio-net.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,6 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
11251125
return num_packets;
11261126
}
11271127

1128-
assert(vdev->vm_running);
1129-
11301128
if (q->async_tx.elem.out_num) {
11311129
virtio_queue_set_notification(q->tx_vq, 0);
11321130
return num_packets;

hw/ppc/spapr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,7 @@ static void ppc_spapr_init(MachineState *machine)
13771377
spapr_create_nvram(spapr);
13781378

13791379
/* Set up PCI */
1380+
spapr_pci_msi_init(spapr, SPAPR_PCI_MSI_WINDOW);
13801381
spapr_pci_rtas_init();
13811382

13821383
phb = spapr_create_phb(spapr, 0);

hw/ppc/spapr_pci.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
341341
}
342342

343343
/* Setup MSI/MSIX vectors in the device (via cfgspace or MSIX BAR) */
344-
spapr_msi_setmsg(pdev, SPAPR_PCI_MSI_WINDOW, ret_intr_type == RTAS_TYPE_MSIX,
344+
spapr_msi_setmsg(pdev, spapr->msi_win_addr, ret_intr_type == RTAS_TYPE_MSIX,
345345
irq, req_num);
346346

347347
/* Add MSI device to cache */
@@ -465,6 +465,34 @@ static const MemoryRegionOps spapr_msi_ops = {
465465
.endianness = DEVICE_LITTLE_ENDIAN
466466
};
467467

468+
void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr)
469+
{
470+
uint64_t window_size = 4096;
471+
472+
/*
473+
* As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors,
474+
* we need to allocate some memory to catch those writes coming
475+
* from msi_notify()/msix_notify().
476+
* As MSIMessage:addr is going to be the same and MSIMessage:data
477+
* is going to be a VIRQ number, 4 bytes of the MSI MR will only
478+
* be used.
479+
*
480+
* For KVM we want to ensure that this memory is a full page so that
481+
* our memory slot is of page size granularity.
482+
*/
483+
#ifdef CONFIG_KVM
484+
if (kvm_enabled()) {
485+
window_size = getpagesize();
486+
}
487+
#endif
488+
489+
spapr->msi_win_addr = addr;
490+
memory_region_init_io(&spapr->msiwindow, NULL, &spapr_msi_ops, spapr,
491+
"msi", window_size);
492+
memory_region_add_subregion(get_system_memory(), spapr->msi_win_addr,
493+
&spapr->msiwindow);
494+
}
495+
468496
/*
469497
* PHB PCI device
470498
*/
@@ -484,7 +512,6 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
484512
char *namebuf;
485513
int i;
486514
PCIBus *bus;
487-
uint64_t msi_window_size = 4096;
488515

489516
if (sphb->index != -1) {
490517
hwaddr windows_base;
@@ -577,28 +604,6 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
577604
address_space_init(&sphb->iommu_as, &sphb->iommu_root,
578605
sphb->dtbusname);
579606

580-
/*
581-
* As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors,
582-
* we need to allocate some memory to catch those writes coming
583-
* from msi_notify()/msix_notify().
584-
* As MSIMessage:addr is going to be the same and MSIMessage:data
585-
* is going to be a VIRQ number, 4 bytes of the MSI MR will only
586-
* be used.
587-
*
588-
* For KVM we want to ensure that this memory is a full page so that
589-
* our memory slot is of page size granularity.
590-
*/
591-
#ifdef CONFIG_KVM
592-
if (kvm_enabled()) {
593-
msi_window_size = getpagesize();
594-
}
595-
#endif
596-
597-
memory_region_init_io(&sphb->msiwindow, NULL, &spapr_msi_ops, spapr,
598-
"msi", msi_window_size);
599-
memory_region_add_subregion(&sphb->iommu_root, SPAPR_PCI_MSI_WINDOW,
600-
&sphb->msiwindow);
601-
602607
pci_setup_iommu(bus, spapr_pci_dma_iommu, sphb);
603608

604609
pci_bus_set_route_irq_fn(bus, spapr_route_intx_pin_to_irq);

hw/virtio/virtio.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
11081108
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
11091109
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
11101110
bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK);
1111-
1112-
if (running) {
1113-
vdev->vm_running = running;
1114-
}
1111+
vdev->vm_running = running;
11151112

11161113
if (backend_run) {
11171114
virtio_set_status(vdev, vdev->status);
@@ -1124,10 +1121,6 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
11241121
if (!backend_run) {
11251122
virtio_set_status(vdev, vdev->status);
11261123
}
1127-
1128-
if (!running) {
1129-
vdev->vm_running = running;
1130-
}
11311124
}
11321125

11331126
void virtio_init(VirtIODevice *vdev, const char *name,

include/hw/pci-host/spapr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct sPAPRPHBState {
7070

7171
MemoryRegion memspace, iospace;
7272
hwaddr mem_win_addr, mem_win_size, io_win_addr, io_win_size;
73-
MemoryRegion memwindow, iowindow, msiwindow;
73+
MemoryRegion memwindow, iowindow;
7474

7575
uint32_t dma_liobn;
7676
AddressSpace iommu_as;

include/hw/ppc/spapr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ struct sPAPRNVRAM;
1313
typedef struct sPAPREnvironment {
1414
struct VIOsPAPRBus *vio_bus;
1515
QLIST_HEAD(, sPAPRPHBState) phbs;
16+
hwaddr msi_win_addr;
17+
MemoryRegion msiwindow;
1618
struct sPAPRNVRAM *nvram;
1719
XICSState *icp;
1820

0 commit comments

Comments
 (0)