Compare commits

..

8 Commits

Author SHA1 Message Date
Anthony Liguori
34aee2552f Update for 0.10.4 release
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-11 13:13:19 -05:00
Kevin Wolf
9fd0e57dc9 Improve block range checks
This patch makes the range checks for block requests more strict: It fixes a
potential integer overflow and checks for negative offsets. Also, it adds the
check for compressed writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 16:04:20 -05:00
Amit Shah
2fd0f93286 e1000: Do not reinit pci config space to 0
pci_register_device already mallocs the pci config space buffer filled
with zeroes.

Doing this again breaks some default config space writes like
setting the subsystem vendor id and subsystem device id.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 15:57:41 -05:00
Alexander Graf
8bd8199f70 AIO deletion race fix
When deleting an fd event there is a chance the object doesn't get
deleted, but only ->deleted set positive and deleted somewhere later.

Now, if we create a handler for the fd again before the actual
deletion occurs, we end up writing data into an object that has
->deleted set, which is obviously wrong.

I see two ways to fix this:

1. Don't return ->deleted objects in the search
2. Unset ->deleted in the search

This patch implements 1. which feels safer to do. It fixes AIO issues
I've seen with curl, as libcurl unsets fd event listeners pretty
frequently.

Signed-off-by: Alexander Graf <alex@csgraf.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 15:57:33 -05:00
Glauber Costa
2da1e39864 reset state for load_linux
The linux loader is just an option rom like any other, just with
some special requirements. Right now, our option rom resetting
mechanism is not being applied to it. As a result, users using
-kernel will not be able to successfully reboot their machines

This patch fixes it by saving all the data we generated in
the load_linux() function, to be used later by the option rom
resetting mechanism.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 15:57:20 -05:00
Glauber Costa
b468f27acd register reset handler for option_roms
Currently, boot options are not preserved across a system reset.
option roms can modify themselves, or can for instance restore the real
int 0x19 vector after they tried to boot from it.

To properly do that, we need a reset handler registered to deal with option
roms. This patch is based on current version on qemu-kvm.git

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 15:55:22 -05:00
Gleb Natapov
8bc2ad6a6a Fix cluster freeing in qcow2
Need to drop QCOW_OFLAG_COPIED from a cluster pointer before freeing it.

Add an explanation how thing meant to work.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 15:54:06 -05:00
Anthony Liguori
f24f1e2a85 Enable power button even generation.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-08 10:20:48 -05:00
10 changed files with 81 additions and 9 deletions

View File

@@ -1,3 +1,11 @@
version 0.10.4:
- Improve block range checks to remove integer overflow (Kevin Wolf)
- e1000: do not re-init PCI config space 0 (Amit Shah)
- fix AIO deletion race (Alex Graf)
- reset option roms on reboot (Glauber Costa)
- fix qcow2 corruption in cluster freeing (Gleb Natapov)
- Enable power button event generation (Gleb Natapov)
version 0.10.3: version 0.10.3:
- fix AIO cancellations (Avi Kivity) - fix AIO cancellations (Avi Kivity)
- fix live migration error path on incoming - fix live migration error path on incoming

View File

@@ -1 +1 @@
0.10.3 0.10.4

3
aio.c
View File

@@ -44,7 +44,8 @@ static AioHandler *find_aio_handler(int fd)
LIST_FOREACH(node, &aio_handlers, node) { LIST_FOREACH(node, &aio_handlers, node) {
if (node->fd == fd) if (node->fd == fd)
return node; if (!node->deleted)
return node;
} }
return NULL; return NULL;

View File

@@ -903,6 +903,12 @@ static int alloc_cluster_link_l2(BlockDriverState *bs, uint64_t cluster_offset,
goto err; goto err;
for (i = 0; i < m->nb_clusters; i++) { for (i = 0; i < m->nb_clusters; i++) {
/* if two concurrent writes happen to the same unallocated cluster
* each write allocates separate cluster and writes data concurrently.
* The first one to complete updates l2 table with pointer to its
* cluster the second one has to do RMW (which is done above by
* copy_sectors()), update l2 table with its cluster pointer and free
* old cluster. This is what this loop does */
if(l2_table[l2_index + i] != 0) if(l2_table[l2_index + i] != 0)
old_cluster[j++] = l2_table[l2_index + i]; old_cluster[j++] = l2_table[l2_index + i];
@@ -916,7 +922,8 @@ static int alloc_cluster_link_l2(BlockDriverState *bs, uint64_t cluster_offset,
goto err; goto err;
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
free_any_clusters(bs, be64_to_cpu(old_cluster[i]), 1); free_any_clusters(bs, be64_to_cpu(old_cluster[i]) & ~QCOW_OFLAG_COPIED,
1);
ret = 0; ret = 0;
err: err:

View File

@@ -533,7 +533,10 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
len = bdrv_getlength(bs); len = bdrv_getlength(bs);
if ((offset + size) > len) if (offset < 0)
return -EIO;
if ((offset > len) || (len - offset < size))
return -EIO; return -EIO;
return 0; return 0;
@@ -1170,6 +1173,8 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
return -ENOMEDIUM; return -ENOMEDIUM;
if (!drv->bdrv_write_compressed) if (!drv->bdrv_write_compressed)
return -ENOTSUP; return -ENOTSUP;
if (bdrv_check_request(bs, sector_num, nb_sectors))
return -EIO;
return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors);
} }

View File

@@ -1067,7 +1067,6 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn)
return NULL; return NULL;
pci_conf = d->dev.config; pci_conf = d->dev.config;
memset(pci_conf, 0, 256);
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, E1000_DEVID); pci_config_set_device_id(pci_conf, E1000_DEVID);

39
hw/pc.c
View File

@@ -63,6 +63,30 @@ static PITState *pit;
static IOAPICState *ioapic; static IOAPICState *ioapic;
static PCIDevice *i440fx_state; static PCIDevice *i440fx_state;
typedef struct rom_reset_data {
uint8_t *data;
target_phys_addr_t addr;
unsigned size;
} RomResetData;
static void option_rom_reset(void *_rrd)
{
RomResetData *rrd = _rrd;
cpu_physical_memory_write_rom(rrd->addr, rrd->data, rrd->size);
}
static void option_rom_setup_reset(target_phys_addr_t addr, unsigned size)
{
RomResetData *rrd = qemu_malloc(sizeof *rrd);
rrd->data = qemu_malloc(size);
cpu_physical_memory_read(addr, rrd->data, size);
rrd->addr = addr;
rrd->size = size;
qemu_register_reset(option_rom_reset, rrd);
}
static void ioport80_write(void *opaque, uint32_t addr, uint32_t data) static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
{ {
} }
@@ -447,7 +471,7 @@ static void bochs_bios_init(void)
/* Generate an initial boot sector which sets state and jump to /* Generate an initial boot sector which sets state and jump to
a specified vector */ a specified vector */
static void generate_bootsect(uint8_t *option_rom, static void generate_bootsect(target_phys_addr_t option_rom,
uint32_t gpr[8], uint16_t segs[6], uint16_t ip) uint32_t gpr[8], uint16_t segs[6], uint16_t ip)
{ {
uint8_t rom[512], *p, *reloc; uint8_t rom[512], *p, *reloc;
@@ -521,7 +545,8 @@ static void generate_bootsect(uint8_t *option_rom,
sum += rom[i]; sum += rom[i];
rom[sizeof(rom) - 1] = -sum; rom[sizeof(rom) - 1] = -sum;
memcpy(option_rom, rom, sizeof(rom)); cpu_physical_memory_write_rom(option_rom, rom, sizeof(rom));
option_rom_setup_reset(option_rom, sizeof (rom));
} }
static long get_file_size(FILE *f) static long get_file_size(FILE *f)
@@ -538,7 +563,7 @@ static long get_file_size(FILE *f)
return size; return size;
} }
static void load_linux(uint8_t *option_rom, static void load_linux(target_phys_addr_t option_rom,
const char *kernel_filename, const char *kernel_filename,
const char *initrd_filename, const char *initrd_filename,
const char *kernel_cmdline) const char *kernel_cmdline)
@@ -689,6 +714,12 @@ static void load_linux(uint8_t *option_rom,
memset(gpr, 0, sizeof gpr); memset(gpr, 0, sizeof gpr);
gpr[4] = cmdline_addr-real_addr-16; /* SP (-16 is paranoia) */ gpr[4] = cmdline_addr-real_addr-16; /* SP (-16 is paranoia) */
option_rom_setup_reset(real_addr, setup_size);
option_rom_setup_reset(prot_addr, kernel_size);
option_rom_setup_reset(cmdline_addr, cmdline_size);
if (initrd_filename)
option_rom_setup_reset(initrd_addr, initrd_size);
generate_bootsect(option_rom, gpr, seg, 0); generate_bootsect(option_rom, gpr, seg, 0);
} }
@@ -896,7 +927,7 @@ vga_bios_error:
offset = 0; offset = 0;
if (linux_boot) { if (linux_boot) {
option_rom_offset = qemu_ram_alloc(TARGET_PAGE_SIZE); option_rom_offset = qemu_ram_alloc(TARGET_PAGE_SIZE);
load_linux(phys_ram_base + option_rom_offset, load_linux(option_rom_offset,
kernel_filename, initrd_filename, kernel_cmdline); kernel_filename, initrd_filename, kernel_cmdline);
cpu_register_physical_memory(0xd0000, TARGET_PAGE_SIZE, cpu_register_physical_memory(0xd0000, TARGET_PAGE_SIZE,
option_rom_offset); option_rom_offset);

View File

@@ -0,0 +1,20 @@
Enable power button event generation.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/bios/rombios32.c b/bios/rombios32.c
index 81e3bad..9986531 100644
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -1767,8 +1767,8 @@ void acpi_bios_init(void)
fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported
fadt->gpe0_blk = cpu_to_le32(0xafe0);
fadt->gpe0_blk_len = 4;
- /* WBINVD + PROC_C1 + PWR_BUTTON + SLP_BUTTON + FIX_RTC */
- fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 6));
+ /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */
+ fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6));
acpi_build_table_header((struct acpi_table_header *)fadt, "FACP",
sizeof(*fadt), 1);

View File

@@ -10,3 +10,4 @@
0010_bios-mark-the-acpi-sci-interrupt-as-connected-to-irq-9.patch 0010_bios-mark-the-acpi-sci-interrupt-as-connected-to-irq-9.patch
0011_read-additional-acpi-tables-from-a-vm.patch 0011_read-additional-acpi-tables-from-a-vm.patch
0013_fix-non-acpi-timer-interrupt-routing.patch 0013_fix-non-acpi-timer-interrupt-routing.patch
0015_enable-power-button-even-generation.patch

Binary file not shown.