Misc patches for 2016-05-23
Subsystems (2)
The following changes since commit e081c24d30c1e7b29eb4450aa16d6a0da5782797:
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-pull-request' into staging (2016-05-23 10:30:41 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 1453e6627d19a8d6d54480c6980f5cef5dfc6833:
cpus: call the core nmi injection function (2016-05-23 16:53:47 +0200)
----------------------------------------------------------------
* NMI cleanups (Bandan)
* RAMBlock/Memory cleanups and fixes (Dominik, Gonglei, Fam, me)
* first part of linuxboot support for fw_cfg DMA (Richard)
* IOAPIC fix (Peter Xu)
* iSCSI SG_IO fix (Vadim)
* Various infrastructure bug fixes (Zhijian, Peter M., Stefan)
* CVE fixes (Prasad)
----------------------------------------------------------------
Bandan Das (3):
target-i386: add a generic x86 nmi handler
nmi: remove x86 specific nmi handling
cpus: call the core nmi injection function
Dominik Dingel (1):
exec.c: Ensure right alignment also for file backed ram
Fam Zheng (2):
memory: Remove code for mr->may_overlap
memory: Drop FlatRange.romd_mode
Gonglei (2):
memory: drop find_ram_block()
exec: adjust rcu_read_lock requirement
Li Zhijian (1):
vl: change runstate only if new state is different from current state
Paolo Bonzini (3):
target-i386: key sfence availability on CPUID_SSE, not CPUID_SSE2
memory: remove unnecessary masking of MemoryRegion ram_addr
coccinelle: add g_assert_cmp* to macro file
Peter Maydell (2):
cpus.c: Use pthread_sigmask() rather than sigprocmask() Remove config-devices.mak on 'make clean'
Peter Xu (2):
ioapic: keep RO bits for IOAPIC entry
ioapic: clear remote irr bit for edge-triggered interrupts
Pranith Kumar (1):
docs/atomics.txt: Update pointer to linux macro
Prasad J Pandit (3):
i386: kvmvapic: initialise imm32 variable
esp: check command buffer length before write(CVE-2016-4439)
esp: check dma length before reading scsi command(CVE-2016-4441)
Richard W.M. Jones (2):
scripts/signrom.py: Allow option ROM checksum script to write the size header. scripts/signrom.py: Check for magic in option ROMs.
Stefan Weil (1):
configure: Allow builds with extra warnings
Vadim Rozenfeld (1):
iscsi: pass SCSI status back for SG_IO
Makefile | 1 + block/iscsi.c | 1 + configure | 2 +- cpus.c | 16 +--------- docs/atomics.txt | 4 +-- exec.c | 64 +++++++++++---------------------------- hw/core/nmi.c | 24 --------------- hw/i386/kvmvapic.c | 2 +- hw/i386/pc.c | 20 ++++++++++++ hw/intc/ioapic.c | 33 ++++++++++++++++++++ hw/scsi/esp.c | 17 ++++++++--- hw/watchdog/watchdog.c | 2 +- include/exec/cpu-common.h | 4 +-- include/exec/memory.h | 1 - include/exec/ram_addr.h | 2 +- include/hw/i386/ioapic_internal.h | 5 +++ include/hw/nmi.h | 1 - include/qemu/osdep.h | 13 ++++++++ memory.c | 46 ++-------------------------- migration/ram.c | 2 +- migration/savevm.c | 4 +-- scripts/cocci-macro-file.h | 6 ++++ scripts/signrom.py | 28 +++++++++++++++-- target-i386/translate.c | 5 +++ translate-all.c | 3 +- util/oslib-posix.c | 13 -------- vl.c | 4 +++ 27 files changed, 158 insertions(+), 165 deletions(-)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 03/24] i386: kvmvapic: initialise imm32 variable
From: Prasad J Pandit <[email protected]>
When processing Task Priorty Register(TPR) access, it could leak automatic stack variable 'imm32' in patch_instruction(). Initialise the variable to avoid it.
Reported by: Donghai Zdh <[email protected]>
Message-Id: <[email protected]>
--- hw/i386/kvmvapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/kvmvapic.c +1 -1
@@ -397,7 +397,7 @@ static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip)CPUX86State *env = &cpu->env;VAPICHandlers *handlers;uint8_t opcode[2 ]; -uint32_t imm32; +uint32_t imm32 =0 ;target_ulong current_pc =0 ;target_ulong current_cs_base =0 ;uint32_t current_flags =0 ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 06/24] ioapic: keep RO bits for IOAPIC entry
In reply to Paolo BonziniFrom: Peter Xu <[email protected]>
Currently IOAPIC RO bits can be written. To be better aligned with hardware, we should let them read-only.
Message-Id: <[email protected]>
--- hw/intc/ioapic.c | 4 ++++ include/hw/i386/ioapic_internal.h | 5 +++++ 2 files changed, 9 insertions(+)
hw/intc/ioapic.c +4 -0
@@ -281,6 +281,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,default : index = (s->ioregsel -IOAPIC_REG_REDTBL_BASE ) >>1 ;if (index >=0 && index <IOAPIC_NUM_PINS ) { +uint64_t ro_bits = s->ioredtbl[index] &IOAPIC_RO_BITS ;if (s->ioregsel &1 ) { s->ioredtbl[index] &=0xffffffff ; s->ioredtbl[index] |= (uint64_t )val <<32 ;
@@ -288,6 +289,9 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, s->ioredtbl[index] &= ~0xffffffffULL ; s->ioredtbl[index] |= val; } +/* restore RO bits */ + s->ioredtbl[index] &=IOAPIC_RW_BITS ; + s->ioredtbl[index] |= ro_bits;ioapic_service (s); } }
include/hw/i386/ioapic_internal.h +5 -0
@@ -47,6 +47,11 @@#define IOAPIC_LVT_DEST_MODE (1 << IOAPIC_LVT_DEST_MODE_SHIFT)#define IOAPIC_LVT_DELIV_MODE (7 << IOAPIC_LVT_DELIV_MODE_SHIFT) +/* Bits that are read-only for IOAPIC entry */ +#define IOAPIC_RO_BITS (IOAPIC_LVT_REMOTE_IRR | \ + IOAPIC_LVT_DELIV_STATUS) +#define IOAPIC_RW_BITS (~(uint64_t)IOAPIC_RO_BITS) +#define IOAPIC_TRIGGER_EDGE 0#define IOAPIC_TRIGGER_LEVEL 1
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 09/24] memory: drop find_ram_block()
In reply to Paolo BonziniFrom: Gonglei <[email protected]>
On the one hand, we have already qemu_get_ram_block() whose function is similar. On the other hand, we can directly use mr->ram_block but searching RAMblock by ram_addr which is a kind of waste.
Message-Id: <[email protected]>
--- exec.c | 34 +++++++--------------------------- include/exec/cpu-common.h | 4 ++-- include/exec/ram_addr.h | 2 +- memory.c | 2 +- migration/ram.c | 2 +- migration/savevm.c | 4 ++-- 6 files changed, 14 insertions(+), 34 deletions(-)
exec.c +7 -27
@@ -1411,34 +1411,18 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size) } } -/* Called within an RCU critical section, or while the ramlist lock -* is held. -*/ -static RAMBlock *find_ram_block (ram_addr_t addr) -{ -RAMBlock *block; - - QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { -if (block->offset == addr) { -return block; - } - } - -return NULL ; -} -const char *qemu_ram_get_idstr (RAMBlock *rb) {return rb->idstr; }/* Called with iothread lock held. */ -void qemu_ram_set_idstr (ram_addr_t addr,const char *name,DeviceState *dev) +void qemu_ram_set_idstr (RAMBlock *new_block,const char *name,DeviceState *dev) { -RAMBlock *new_block, *block; +RAMBlock *block;rcu_read_lock (); - new_block =find_ram_block (addr); +assert (new_block);assert (!new_block->idstr[0 ]);
@@ -1452,7 +1436,8 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)pstrcat (new_block->idstr,sizeof (new_block->idstr), name); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { -if (block != new_block && !strcmp (block->idstr, new_block->idstr)) { +if (block != new_block && + !strcmp (block->idstr, new_block->idstr)) {fprintf (stderr,"RAMBlock \"%s\" already registered, abort!\n" , new_block->idstr);abort ();
@@ -1462,17 +1447,14 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev) }/* Called with iothread lock held. */ -void qemu_ram_unset_idstr (ram_addr_t addr) +void qemu_ram_unset_idstr (RAMBlock *block) { -RAMBlock *block; -/* FIXME: arch_init.c assumes that this is not called throughout * migration. Ignore the problem since hot-unplug during migration * does not work anyway. */ rcu_read_lock (); - block =find_ram_block (addr);if (block) {memset (block->idstr,0 ,sizeof (block->idstr)); }
@@ -1496,10 +1478,8 @@ static int memory_try_enable_merging(void *addr, size_t len)* resize callback to update device state and/or add assertions to detect * misuse, if necessary. */ -int qemu_ram_resize (ram_addr_t base,ram_addr_t newsize,Error **errp) +int qemu_ram_resize (RAMBlock *block,ram_addr_t newsize,Error **errp) { -RAMBlock *block =find_ram_block (base); -assert (block); newsize =HOST_PAGE_ALIGN (newsize);
include/exec/cpu-common.h +2 -2
@@ -61,8 +61,8 @@ MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);RAMBlock *qemu_ram_block_by_name (const char *name);RAMBlock *qemu_ram_block_from_host (void *ptr,bool round_offset,ram_addr_t *ram_addr,ram_addr_t *offset); -void qemu_ram_set_idstr (ram_addr_t addr,const char *name,DeviceState *dev); -void qemu_ram_unset_idstr (ram_addr_t addr); +void qemu_ram_set_idstr (RAMBlock *block,const char *name,DeviceState *dev); +void qemu_ram_unset_idstr (RAMBlock *block);const char *qemu_ram_get_idstr (RAMBlock *rb); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
include/exec/ram_addr.h +1 -1
@@ -110,7 +110,7 @@ void qemu_set_ram_fd(ram_addr_t addr, int fd);void *qemu_get_ram_block_host_ptr (ram_addr_t addr);void qemu_ram_free (RAMBlock *block); -int qemu_ram_resize (ram_addr_t base,ram_addr_t newsize,Error **errp); +int qemu_ram_resize (RAMBlock *block,ram_addr_t newsize,Error **errp);#define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1)#define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE))
memory.c +1 -1
@@ -1673,7 +1673,7 @@ void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp {assert (mr->ram_block); -qemu_ram_resize (memory_region_get_ram_addr (mr), newsize, errp); +qemu_ram_resize (mr->ram_block, newsize, errp); }static void memory_region_update_coalesced_range_as (MemoryRegion *mr,AddressSpace *as)
migration/ram.c +1 -1
@@ -2478,7 +2478,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)if (length != block->used_length) {Error *local_err =NULL ; - ret =qemu_ram_resize (block->offset, length, + ret =qemu_ram_resize (block, length, &local_err);if (local_err) {error_report_err (local_err);
migration/savevm.c +2 -2
@@ -2229,13 +2229,13 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)void vmstate_register_ram (MemoryRegion *mr,DeviceState *dev) { -qemu_ram_set_idstr (memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK , +qemu_ram_set_idstr (mr->ram_block,memory_region_name (mr), dev); }void vmstate_unregister_ram (MemoryRegion *mr,DeviceState *dev) { -qemu_ram_unset_idstr (memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ); +qemu_ram_unset_idstr (mr->ram_block); }void vmstate_register_ram_global (MemoryRegion *mr)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 05/24] target-i386: key sfence availability on CPUID_SSE, not CPUID_SSE2
In reply to Paolo Bonzinisfence was introduced before lfence and mfence. This fixes Linux 2.4's measurement of checksumming speeds for the pIII_sse algorithm:
md: linear personality registered as nr 1
md: raid0 personality registered as nr 2
md: raid1 personality registered as nr 3
md: raid5 personality registered as nr 4
raid5: measuring checksumming speed
8regs : 384.400 MB/sec
32regs : 259.200 MB/sec
invalid operand: 0000
CPU: 0
EIP: 0010:[<c0240b2a>] Not tainted
EFLAGS: 00000246
eax: c15d8000 ebx: 00000000 ecx: 00000000 edx: c15d5000
esi: 8005003b edi: 00000004 ebp: 00000000 esp: c15bdf50
ds: 0018 es: 0018 ss: 0018
Process swapper (pid: 1, stackpage=c15bd000)
Stack: 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000
00000000 00000206 c0241c6c 00001000 c15d4000 c15d7000 c15d4000
c15d4000
Call Trace: [<c0241c6c>] [<c0105000>] [<c0241db4>] [<c010503b>][<c0105000>]
[<c0107416>] [<c0105030>]
Code: 0f ae f8 0f 10 04 24 0f 10 4c 24 10 0f 10 54 24 20 0f 10 5c <0>Kernel panic: Attempted to kill init!
--- target-i386/translate.c | 5 +++++ 1 file changed, 5 insertions(+)
target-i386/translate.c +5 -0
@@ -8008,6 +8008,11 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, }/* fallthru */ case 0xf9 ... 0xff: /* sfence */ +if (!(s->cpuid_features &CPUID_SSE ) + || (prefixes &PREFIX_LOCK )) { + goto illegal_op; + } +break ; case 0xe8 ... 0xef: /* lfence */ case 0xf0 ... 0xf7: /* mfence */ if (!(s->cpuid_features & CPUID_SSE2)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/24] configure: Allow builds with extra warnings
In reply to Paolo BonziniFrom: Stefan Weil <[email protected]>
The clang compiler supports a useful compiler option -Weverything, and GCC also has other warnings not enabled by -Wall.
If glib header files trigger a warning, however, testing glib with -Werror will always fail. A size mismatch is also detected without -Werror, so simply remove it.
Message-Id: <[email protected]>
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -2985,7 +2985,7 @@ int main(void) { } EOF -if ! compile_prog "-Werror $CFLAGS" "$LIBS" ; then +if ! compile_prog "$CFLAGS" "$LIBS" ; then error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ "You probably need to set PKG_CONFIG_LIBDIR"\ "to point to the right pkg-config files for your"\
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 08/24] vl: change runstate only if new state is different from current state
In reply to Paolo BonziniFrom: Li Zhijian <[email protected]>
Previously, qemu will abort at following scenario:
(qemu) stop
(qemu) system_reset
(qemu) system_reset
(qemu) 2016-04-13T20:54:38.979158Z qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'prelaunch'
Message-Id: <[email protected]>
--- vl.c | 4 ++++ 1 file changed, 4 insertions(+)
vl.c +4 -0
@@ -690,6 +690,10 @@ void runstate_set(RunState new_state) {assert (new_state <RUN_STATE__MAX ); +if (current_run_state == new_state) { +return ; + } +if (!runstate_valid_transitions[current_run_state][new_state]) { error_report("invalid runstate transition: '%s' -> '%s'", RunState_lookup[current_run_state],
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 13/24] memory: remove unnecessary masking of MemoryRegion ram_addr
In reply to Paolo Bonzinimr->ram_block->offset is already aligned to both host and target size (see qemu_ram_alloc_internal). Remove further masking as it is unnecessary.
--- exec.c | 21 +++++++-------------- memory.c | 5 ++--- translate-all.c | 3 +-- 3 files changed, 10 insertions(+), 19 deletions(-)
exec.c +7 -14
@@ -1046,8 +1046,7 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,if (memory_region_is_ram (section->mr)) {/* Normal RAM. */ - iotlb = (memory_region_get_ram_addr (section->mr) &TARGET_PAGE_MASK ) - + xlat; + iotlb =memory_region_get_ram_addr (section->mr) + xlat;if (!section->readonly) { iotlb |=PHYS_SECTION_NOTDIRTY ; }else {
@@ -3079,9 +3078,7 @@ static inline uint32_t address_space_ldl_internal(AddressSpace *as, hwaddr addr, }else {/* RAM case */ ptr =qemu_get_ram_ptr (mr->ram_block, - (memory_region_get_ram_addr (mr) - &TARGET_PAGE_MASK ) - + addr1); +memory_region_get_ram_addr (mr) + addr1);switch (endian) {case DEVICE_LITTLE_ENDIAN : val =ldl_le_p (ptr);
@@ -3175,9 +3172,7 @@ static inline uint64_t address_space_ldq_internal(AddressSpace *as, hwaddr addr, }else {/* RAM case */ ptr =qemu_get_ram_ptr (mr->ram_block, - (memory_region_get_ram_addr (mr) - &TARGET_PAGE_MASK ) - + addr1); +memory_region_get_ram_addr (mr) + addr1);switch (endian) {case DEVICE_LITTLE_ENDIAN : val =ldq_le_p (ptr);
@@ -3291,9 +3286,7 @@ static inline uint32_t address_space_lduw_internal(AddressSpace *as, }else {/* RAM case */ ptr =qemu_get_ram_ptr (mr->ram_block, - (memory_region_get_ram_addr (mr) - &TARGET_PAGE_MASK ) - + addr1); +memory_region_get_ram_addr (mr) + addr1);switch (endian) {case DEVICE_LITTLE_ENDIAN : val =lduw_le_p (ptr);
@@ -3375,7 +3368,7 @@ void address_space_stl_notdirty(AddressSpace *as, hwaddr addr, uint32_t val, r =memory_region_dispatch_write (mr, addr1, val,4 , attrs); }else { - addr1 +=memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ; + addr1 +=memory_region_get_ram_addr (mr); ptr =qemu_get_ram_ptr (mr->ram_block, addr1);stl_p (ptr, val);
@@ -3430,7 +3423,7 @@ static inline void address_space_stl_internal(AddressSpace *as, r =memory_region_dispatch_write (mr, addr1, val,4 , attrs); }else {/* RAM case */ - addr1 +=memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ; + addr1 +=memory_region_get_ram_addr (mr); ptr =qemu_get_ram_ptr (mr->ram_block, addr1);switch (endian) {case DEVICE_LITTLE_ENDIAN :
@@ -3540,7 +3533,7 @@ static inline void address_space_stw_internal(AddressSpace *as, r =memory_region_dispatch_write (mr, addr1, val,2 , attrs); }else {/* RAM case */ - addr1 +=memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ; + addr1 +=memory_region_get_ram_addr (mr); ptr =qemu_get_ram_ptr (mr->ram_block, addr1);switch (endian) {case DEVICE_LITTLE_ENDIAN :
memory.c +2 -3
@@ -1628,7 +1628,7 @@ int memory_region_get_fd(MemoryRegion *mr)assert (mr->ram_block); -return qemu_get_ram_fd (memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ); +return qemu_get_ram_fd (memory_region_get_ram_addr (mr)); }void *memory_region_get_ram_ptr (MemoryRegion *mr)
@@ -1642,8 +1642,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr) mr = mr->alias; }assert (mr->ram_block); - ptr =qemu_get_ram_ptr (mr->ram_block, -memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ); + ptr =qemu_get_ram_ptr (mr->ram_block,memory_region_get_ram_addr (mr));rcu_read_unlock ();return ptr + offset;
translate-all.c +1 -2
@@ -1555,8 +1555,7 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)rcu_read_unlock ();return ; } - ram_addr = (memory_region_get_ram_addr (mr) &TARGET_PAGE_MASK ) - + addr; + ram_addr =memory_region_get_ram_addr (mr) + addr;tb_invalidate_phys_page_range (ram_addr, ram_addr +1 ,0 );rcu_read_unlock (); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 07/24] ioapic: clear remote irr bit for edge-triggered interrupts
In reply to Paolo BonziniFrom: Peter Xu <[email protected]>
This is to better emulate IOAPIC version 0x1X hardware. Linux kernel leveraged this "feature" to do explicit EOI since EOI register is still not introduced at that time. This will also fix the issue that level triggered interrupts failed to work when IR enabled (tested with Linux kernel version 4.5).
Message-Id: <[email protected]>
--- hw/intc/ioapic.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
hw/intc/ioapic.c +29 -0
@@ -255,6 +255,34 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size)return val; } +/* +* This is to satisfy the hack in Linux kernel. One hack of it is to +* simulate clearing the Remote IRR bit of IOAPIC entry using the +* following: +* +* "For IO-APIC's with EOI register, we use that to do an explicit EOI. +* Otherwise, we simulate the EOI message manually by changing the trigger +* mode to edge and then back to level, with RTE being masked during +* this." +* +* (See linux kernel __eoi_ioapic_pin() comment in commit c0205701) +* +* This is based on the assumption that, Remote IRR bit will be +* cleared by IOAPIC hardware when configured as edge-triggered +* interrupts. +* +* Without this, level-triggered interrupts in IR mode might fail to +* work correctly. +*/ +static inline void +ioapic_fix_edge_remote_irr (uint64_t *entry) +{ +if (!(*entry &IOAPIC_LVT_TRIGGER_MODE )) { +/* Edge-triggered interrupts, make sure remote IRR is zero */ + *entry &= ~((uint64_t )IOAPIC_LVT_REMOTE_IRR ); + } +} +static void ioapic_mem_write (void *opaque,hwaddr addr,uint64_t val,unsigned int size)
@@ -292,6 +320,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,/* restore RO bits */ s->ioredtbl[index] &=IOAPIC_RW_BITS ; s->ioredtbl[index] |= ro_bits; +ioapic_fix_edge_remote_irr (&s->ioredtbl[index]);ioapic_service (s); } }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 01/24] exec.c: Ensure right alignment also for file backed ram
In reply to Paolo BonziniFrom: Dominik Dingel <[email protected]>
While in the anonymous ram case we already take care of the right alignment such an alignment gurantee does not exist for file backed ram allocation.
Instead, pagesize is used for alignment. On s390 this is not enough for gmap, as we need to satisfy an alignment up to segments.
Message-Id: <[email protected]>
--- exec.c | 5 +++-- include/qemu/osdep.h | 13 +++++++++++++ util/oslib-posix.c | 13 ------------- 3 files changed, 16 insertions(+), 15 deletions(-)
exec.c +3 -2
@@ -1299,7 +1299,7 @@ static void *file_ram_alloc(RAMBlock *block, } page_size =qemu_fd_getpagesize (fd); - block->mr->align = page_size; + block->mr->align =MAX (page_size,QEMU_VMALLOC_ALIGN );if (memory < page_size) { error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to "
@@ -1320,7 +1320,8 @@ static void *file_ram_alloc(RAMBlock *block,perror ("ftruncate" ); } - area =qemu_ram_mmap (fd, memory, page_size, block->flags &RAM_SHARED ); + area =qemu_ram_mmap (fd, memory, block->mr->align, + block->flags &RAM_SHARED );if (area ==MAP_FAILED ) {error_setg_errno (errp, errno,"unable to map backing store for guest RAM" );
include/qemu/osdep.h +13 -0
@@ -263,6 +263,19 @@ void qemu_anon_ram_free(void *ptr, size_t size);#endif +#if defined(__linux__) && \ + (defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)) +/* Use 2 MiB alignment so transparent hugepages can be used by KVM. +Valgrind does not support alignments larger than 1 MiB, +therefore we need special code which handles running on Valgrind. */ +# define QEMU_VMALLOC_ALIGN (512 * 4096) +#elif defined(__linux__) && defined(__s390x__) +/* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */ +# define QEMU_VMALLOC_ALIGN (256 * 4096) +#else +# define QEMU_VMALLOC_ALIGN getpagesize() +#endif +int qemu_madvise (void *addr,size_t len,int advice);int qemu_open (const char *name,int flags, ...);
util/oslib-posix.c +0 -13
@@ -26,19 +26,6 @@* THE SOFTWARE. */ -#if defined(__linux__) && \ - (defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)) -/* Use 2 MiB alignment so transparent hugepages can be used by KVM. -Valgrind does not support alignments larger than 1 MiB, -therefore we need special code which handles running on Valgrind. */ -# define QEMU_VMALLOC_ALIGN (512 * 4096) -#elif defined(__linux__) && defined(__s390x__) -/* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */ -# define QEMU_VMALLOC_ALIGN (256 * 4096) -#else -# define QEMU_VMALLOC_ALIGN getpagesize() -#endif -#include "qemu/osdep.h" #include <termios.h> #include <termios.h>
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 02/24] docs/atomics.txt: Update pointer to linux macro
In reply to Paolo BonziniFrom: Pranith Kumar <[email protected]>
Add a missing end brace and update doc to point to the latest access macro. ACCESS_ONCE() is deprecated.
Message-Id: <[email protected]>
--- docs/atomics.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
docs/atomics.txt +2 -2
@@ -62,7 +62,7 @@ operations: typeof(*ptr) atomic_fetch_sub(ptr, val) typeof(*ptr) atomic_fetch_and(ptr, val) typeof(*ptr) atomic_fetch_or(ptr, val) - typeof(*ptr) atomic_xchg(ptr, val + typeof(*ptr) atomic_xchg(ptr, val) typeof(*ptr) atomic_cmpxchg(ptr, old, new) all of which return the old value of *ptr. These operations are
@@ -328,7 +328,7 @@ and memory barriers, and the equivalents in QEMU: - atomic_read and atomic_set in Linux give no guarantee at all; atomic_read and atomic_set in QEMU include a compiler barrier - (similar to the ACCESS_ONCE macro in Linux). + (similar to the READ_ONCE/WRITE_ONCE macros in Linux). - most atomic read-modify-write operations in Linux return void; in QEMU, all of them return the old value of the variable.
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 15/24] Remove config-devices.mak on 'make clean'
In reply to Paolo BonziniFrom: Peter Maydell <[email protected]>
Our dependency mechanism works like this:
* on first build there is neither a .o nor a .d
* we create the .d as a side effect of creating the .o
* for rebuilds we know when we need to update the .o, which also updates the .d
This system requires that you're never in a situation where there is a .o file but no .d (because then we will never realise we need to build the .d, and we will not have the dependency information about when to rebuild the .o).
This is working fine for our object files, but we also try to use it for $TARGET/config-devices.mak (where the dependency file is in $TARGET-config-devices.mak.d). Unfortunately "make clean" doesn't remove config-devices.mak, which means that it puts us in the forbidden situation of "object file exists but not its .d file". This in turn means that we will fail to notice when we need to rebuild:
mkdir build/depbug
(cd build/depbug && '../../configure')
make -C build/depbug -j8
make -C build/depbug clean
echo "CONFIG_CANARY = y" >> default-configs/arm-softmmu.mak make -C build/depbug
grep CANARY build/depbug/aarch64-softmmu/config-devices.mak
The CANARY token should show up in config-devices.mak but does not.
Fix this bug by making "make clean" delete the config-devices.mak files. config-all-devices.mak doesn't have the same problem since it has no .d file, but delete it too, since it is created by "make" and logically should be removed by "make clean".
(Note that it is important not to remove config-devices.mak until after we have recursively run 'make clean' in the subdirectories.)
Message-Id: <[email protected]>
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -356,6 +356,7 @@ clean: if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ rm -f $$d/qemu-options.def; \ done + rm -f $(SUBDIR_DEVICES_MAK) config-all-devices.mak VERSION ?= $(shell cat VERSION)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 10/24] exec: adjust rcu_read_lock requirement
In reply to Paolo BonziniFrom: Gonglei <[email protected]>
qemu_ram_unset_idstr() doesn't need rcu lock anymore, meanwhile make the range of rcu lock in qemu_ram_set_idstr() as small as possible.
Message-Id: <[email protected]>
--- exec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
exec.c +1 -5
@@ -1421,8 +1421,6 @@ void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState *dev) {RAMBlock *block; -rcu_read_lock (); -assert (new_block);assert (!new_block->idstr[0 ]);
@@ -1435,6 +1433,7 @@ void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState *dev) }pstrcat (new_block->idstr,sizeof (new_block->idstr), name); +rcu_read_lock (); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {if (block != new_block && !strcmp (block->idstr, new_block->idstr)) {
@@ -1453,12 +1452,9 @@ void qemu_ram_unset_idstr(RAMBlock *block)* migration. Ignore the problem since hot-unplug during migration * does not work anyway. */ - -rcu_read_lock ();if (block) {memset (block->idstr,0 ,sizeof (block->idstr)); } -rcu_read_unlock (); }static int memory_try_enable_merging (void *addr,size_t len)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 18/24] esp: check command buffer length before write(CVE-2016-4439)
In reply to Paolo BonziniFrom: Prasad J Pandit <[email protected]>
The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte FIFO buffer. It is used to handle command and data transfer. While writing to this command buffer 's->cmdbuf[TI_BUFSZ=16]', a check was missing to validate input length. Add check to avoid OOB write access.
Fixes CVE-2016-4439.
Message-Id: <[email protected]>
--- hw/scsi/esp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/scsi/esp.c +5 -1
@@ -448,7 +448,11 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)break ;case ESP_FIFO :if (s->do_cmd) { - s->cmdbuf[s->cmdlen++] = val &0xff ; +if (s->cmdlen <TI_BUFSZ ) { + s->cmdbuf[s->cmdlen++] = val &0xff ; + }else { +trace_esp_error_fifo_overrun (); + } }else if (s->ti_size ==TI_BUFSZ -1 ) {trace_esp_error_fifo_overrun (); }else {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 23/24] nmi: remove x86 specific nmi handling
In reply to Paolo BonziniFrom: Bandan Das <[email protected]>
nmi_monitor_handle is wired to call the x86 nmi handler. So, we can directly use it at call sites.
Message-Id: <[email protected]>
--- hw/core/nmi.c | 24 ------------------------ hw/watchdog/watchdog.c | 2 +- include/hw/nmi.h | 1 - 3 files changed, 1 insertion(+), 26 deletions(-)
hw/core/nmi.c +0 -24
@@ -20,16 +20,11 @@*/ #include "qemu/osdep.h" -#include "qom/cpu.h" #include "hw/nmi.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "monitor/monitor.h" -#if defined(TARGET_I386 ) -#include "cpu.h" -#endif -struct do_nmi_s {int cpu_index;Error *err;
@@ -78,25 +73,6 @@ void nmi_monitor_handle(int cpu_index, Error **errp) } } -void inject_nmi (void ) -{ -#if defined(TARGET_I386 ) -CPUState *cs; - -CPU_FOREACH (cs) { -X86CPU *cpu =X86_CPU (cs); - -if (!cpu->apic_state) { -cpu_interrupt (cs,CPU_INTERRUPT_NMI ); - }else { -apic_deliver_nmi (cpu->apic_state); - } - } -#else -nmi_monitor_handle (0 ,NULL ); -#endif -} -static const TypeInfo nmi_info = { .name =TYPE_NMI , .parent =TYPE_INTERFACE ,
hw/watchdog/watchdog.c +1 -1
@@ -143,7 +143,7 @@ void watchdog_perform_action(void)case WDT_NMI :qapi_event_send_watchdog (WATCHDOG_EXPIRATION_ACTION_INJECT_NMI , &error_abort); -inject_nmi (); +nmi_monitor_handle (0 ,NULL );break ; } }
include/hw/nmi.h +0 -1
@@ -45,6 +45,5 @@ typedef struct NMIClass { } NMIClass;void nmi_monitor_handle (int cpu_index,Error **errp); -void inject_nmi (void );#endif /* NMI_H */
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 12/24] memory: Drop FlatRange.romd_mode
In reply to Paolo BonziniFrom: Fam Zheng <[email protected]>
Its value is alway set to mr->romd_mode, so the removed comparisons are fully superseded by "a->mr == b->mr".
Message-Id: <[email protected]>
--- memory.c | 4 ---- 1 file changed, 4 deletions(-)
memory.c +0 -4
@@ -227,7 +227,6 @@ struct FlatRange {hwaddr offset_in_region;AddrRange addr;uint8_t dirty_log_mask; -bool romd_mode;bool readonly; };
@@ -252,7 +251,6 @@ static bool flatrange_equal(FlatRange *a, FlatRange *b)return a->mr == b->mr &&addrrange_equal (a->addr, b->addr) && a->offset_in_region == b->offset_in_region - && a->romd_mode == b->romd_mode && a->readonly == b->readonly; }
@@ -312,7 +310,6 @@ static bool can_merge(FlatRange *r1, FlatRange *r2) r1->addr.size), int128_make64(r2->offset_in_region)) && r1->dirty_log_mask == r2->dirty_log_mask - && r1->romd_mode == r2->romd_mode && r1->readonly == r2->readonly; }
@@ -666,7 +663,6 @@ static void render_memory_region(FlatView *view, fr.mr = mr; fr.dirty_log_mask =memory_region_get_dirty_log_mask (mr); - fr.romd_mode = mr->romd_mode; fr.readonly = readonly;/* Render the region itself into any gaps left by the current view. */
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 19/24] esp: check dma length before reading scsi command(CVE-2016-4441)
In reply to Paolo BonziniFrom: Prasad J Pandit <[email protected]>
The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte FIFO buffer. It is used to handle command and data transfer. Routine get_cmd() uses DMA to read scsi commands into this buffer. Add check to validate DMA length against buffer size to avoid any overrun.
Fixes CVE-2016-4441.
Message-Id: <[email protected]>
--- hw/scsi/esp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
hw/scsi/esp.c +7 -4
@@ -82,7 +82,7 @@ void esp_request_cancelled(SCSIRequest *req) } } -static uint32_t get_cmd (ESPState *s,uint8_t *buf) +static uint32_t get_cmd (ESPState *s,uint8_t *buf,uint8_t buflen) {uint32_t dmalen;int target;
@@ -92,6 +92,9 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf) dmalen = s->rregs[ESP_TCLO ]; dmalen |= s->rregs[ESP_TCMID ] <<8 ; dmalen |= s->rregs[ESP_TCHI ] <<16 ; +if (dmalen > buflen) { +return 0 ; + } s->dma_memory_read (s->dma_opaque, buf, dmalen); }else { dmalen = s->ti_size;
@@ -166,7 +169,7 @@ static void handle_satn(ESPState *s) s->dma_cb = handle_satn;return ; } - len =get_cmd (s, buf); + len =get_cmd (s, buf,sizeof (buf));if (len)do_cmd (s, buf); }
@@ -180,7 +183,7 @@ static void handle_s_without_atn(ESPState *s) s->dma_cb = handle_s_without_atn;return ; } - len =get_cmd (s, buf); + len =get_cmd (s, buf,sizeof (buf));if (len) {do_busid_cmd (s, buf,0 ); }
@@ -192,7 +195,7 @@ static void handle_satn_stop(ESPState *s) s->dma_cb = handle_satn_stop;return ; } - s->cmdlen =get_cmd (s, s->cmdbuf); + s->cmdlen =get_cmd (s, s->cmdbuf,sizeof (s->cmdbuf));if (s->cmdlen) {trace_esp_handle_satn_stop (s->cmdlen); s->do_cmd =1 ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 14/24] cpus.c: Use pthread_sigmask() rather than sigprocmask()
In reply to Paolo BonziniFrom: Peter Maydell <[email protected]>
On Linux, sigprocmask() and pthread_sigmask() are in practice the same thing (they only set the signal mask for the calling thread), but the documentation states that the behaviour of sigprocmask() in a multithreaded process is undefined. Use pthread_sigmask() instead (which is what we do in almost all places in QEMU that alter the signal mask already).
Message-Id: <[email protected]>
--- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cpus.c +1 -1
@@ -780,7 +780,7 @@ static void sigbus_reraise(void)raise (SIGBUS );sigemptyset (&set);sigaddset (&set,SIGBUS ); -sigprocmask (SIG_UNBLOCK , &set,NULL ); +pthread_sigmask (SIG_UNBLOCK , &set,NULL ); }perror ("Failed to re-raise SIGBUS!\n" );abort ();
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 16/24] scripts/signrom.py: Allow option ROM checksum script to write the size header.
In reply to Paolo BonziniFrom: "Richard W.M. Jones" <[email protected]>
Modify the signrom.py script so that if the size byte in the header is 0 (ie. not set) then the script will set the size. If the size byte is non-zero then we do the same as before, so this doesn't require changes to any existing ROM sourcecode.
Message-Id: <[email protected]>
--- scripts/signrom.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
scripts/signrom.py +22 -3
@@ -18,10 +18,29 @@ fin = open(sys.argv[1], 'rb') fout = open(sys.argv[2], 'wb') fin.seek(2) -size = ord(fin.read(1)) * 512 - 1 - +size_byte = ord(fin.read(1)) fin.seek(0) -data = fin.read(size) + +if size_byte == 0: + # If the caller left the size field blank then we will fill it in, + # also rounding the whole input to a multiple of 512 bytes. + data = fin.read() + # +1 because we need a byte to store the checksum. + size = len(data) + 1 + # Round up to next multiple of 512. + size += 511 + size -= size % 512 + if size >= 65536: + sys.exit("%s: option ROM size too large" % sys.argv[1]) + # size-1 because a final byte is added below to store the checksum. + data = data.ljust(size-1, '\0') + data = data[:2] + chr(size/512) + data[3:] +else: + # Otherwise the input file specifies the size so use it. + # -1 because we overwrite the last byte of the file with the checksum. + size = size_byte * 512 - 1 + data = fin.read(size) + fout.write(data) checksum = 0
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 17/24] scripts/signrom.py: Check for magic in option ROMs.
In reply to Paolo BonziniFrom: "Richard W.M. Jones" <[email protected]>
Because of the risk that compilers might not emit the asm() block at the beginning of the option ROM, check that the ROM contains the required magic signature.
Message-Id: <[email protected]>
--- scripts/signrom.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/signrom.py +4 -1
@@ -17,7 +17,10 @@ if len(sys.argv) < 3: fin = open(sys.argv[1], 'rb') fout = open(sys.argv[2], 'wb') -fin.seek(2) +magic = fin.read(2) +if magic != '\x55\xaa': + sys.exit("%s: option ROM does not begin with magic 55 aa" % sys.argv[1]) + size_byte = ord(fin.read(1)) fin.seek(0)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 11/24] memory: Remove code for mr->may_overlap
In reply to Paolo BonziniFrom: Fam Zheng <[email protected]>
The collision check does nothing and hasn't been used. Remove the variable together with related code.
Message-Id: <[email protected]>
--- include/exec/memory.h | 1 - memory.c | 35 ----------------------------------- 2 files changed, 36 deletions(-)
include/exec/memory.h +0 -1
@@ -187,7 +187,6 @@ struct MemoryRegion {MemoryRegion *alias;hwaddr alias_offset;int32_t priority; -bool may_overlap; QTAILQ_HEAD(subregions, MemoryRegion) subregions;QTAILQ_ENTRY (MemoryRegion) subregions_link; QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced;
memory.c +0 -35
@@ -1057,13 +1057,6 @@ static void memory_region_get_priority(Object *obj, Visitor *v,visit_type_int32 (v, name, &value, errp); } -static bool memory_region_get_may_overlap (Object *obj,Error **errp) -{ -MemoryRegion *mr =MEMORY_REGION (obj); - -return mr->may_overlap; -} -static void memory_region_get_size (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) {
@@ -1101,10 +1094,6 @@ static void memory_region_initfn(Object *obj) memory_region_get_priority,NULL ,/* memory_region_set_priority */ NULL, NULL, &error_abort); -object_property_add_bool (OBJECT (mr),"may-overlap" , - memory_region_get_may_overlap, -NULL ,/* memory_region_set_may_overlap */ - &error_abort); object_property_add(OBJECT(mr), "size", "uint64", memory_region_get_size, NULL, /* memory_region_set_size, */
@@ -1864,7 +1853,6 @@ void memory_region_del_eventfd(MemoryRegion *mr,static void memory_region_update_container_subregions (MemoryRegion *subregion) { -hwaddr offset = subregion->addr;MemoryRegion *mr = subregion->container;MemoryRegion *other;
@@ -1872,27 +1860,6 @@ static void memory_region_update_container_subregions(MemoryRegion *subregion)memory_region_ref (subregion); QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { -if (subregion->may_overlap || other->may_overlap) { -continue ; - } -if (int128_ge (int128_make64 (offset), -int128_add (int128_make64 (other->addr), other->size)) - ||int128_le (int128_add (int128_make64 (offset), subregion->size), -int128_make64 (other->addr))) { -continue ; - } -#if 0 -printf ("warning: subregion collision %llx/%llx (%s) " -"vs %llx/%llx (%s)\n" , - (unsigned long long )offset, - (unsigned long long )int128_get64 (subregion->size), - subregion->name, - (unsigned long long )other->addr, - (unsigned long long )int128_get64 (other->size), - other->name); -#endif - } - QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {if (subregion->priority >= other->priority) {QTAILQ_INSERT_BEFORE (other, subregion, subregions_link); goto done;
@@ -1918,7 +1885,6 @@ void memory_region_add_subregion(MemoryRegion *mr,hwaddr offset, MemoryRegion *subregion) { - subregion->may_overlap = false; subregion->priority = 0;memory_region_add_subregion_common (mr, offset, subregion); }
@@ -1928,7 +1894,6 @@ void memory_region_add_subregion_overlap(MemoryRegion *mr, MemoryRegion *subregion, int priority) { - subregion->may_overlap = true; subregion->priority = priority;memory_region_add_subregion_common (mr, offset, subregion); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 24/24] cpus: call the core nmi injection function
In reply to Paolo BonziniFrom: Bandan Das <[email protected]>
We can call the common function here directly since x86 specific actions will be taken care of by the arch specific nmi handler
Message-Id: <[email protected]>
--- cpus.c | 14 -------------- 1 file changed, 14 deletions(-)
cpus.c +0 -14
@@ -1693,21 +1693,7 @@ exit:void qmp_inject_nmi (Error **errp) { -#if defined(TARGET_I386 ) -CPUState *cs; - -CPU_FOREACH (cs) { -X86CPU *cpu =X86_CPU (cs); - -if (!cpu->apic_state) { -cpu_interrupt (cs,CPU_INTERRUPT_NMI ); - }else { -apic_deliver_nmi (cpu->apic_state); - } - } -#else nmi_monitor_handle (monitor_get_cpu_index (), errp); -#endif }void dump_drift_info (FILE *f,fprintf_function cpu_fprintf)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 22/24] target-i386: add a generic x86 nmi handler
In reply to Paolo BonziniFrom: Bandan Das <[email protected]>
Instead of having x86 ifdefs in core nmi code, this change adds a arch specific handler that the nmi common code can call.
Message-Id: <[email protected]>
--- hw/i386/pc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
hw/i386/pc.c +20 -0
@@ -67,6 +67,7 @@#include "qapi/visitor.h" #include "qapi-visit.h" #include "qom/cpu.h" +#include "hw/nmi.h" /* debug PC/ISA interrupts */ //#define DEBUG_IRQ
@@ -1963,11 +1964,28 @@ static CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *machine)return list; } +static void x86_nmi (NMIState *n,int cpu_index,Error **errp) +{ +/* cpu index isn't used */ +CPUState *cs; + +CPU_FOREACH (cs) { +X86CPU *cpu =X86_CPU (cs); + +if (!cpu->apic_state) { +cpu_interrupt (cs,CPU_INTERRUPT_NMI ); + }else { +apic_deliver_nmi (cpu->apic_state); + } + } +} +static void pc_machine_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);PCMachineClass *pcmc =PC_MACHINE_CLASS (oc);HotplugHandlerClass *hc =HOTPLUG_HANDLER_CLASS (oc); +NMIClass *nc =NMI_CLASS (oc); pcmc->get_hotplug_handler = mc->get_hotplug_handler; pcmc->pci_enabled = true;
@@ -1993,6 +2011,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) hc->plug = pc_machine_device_plug_cb; hc->unplug_request = pc_machine_device_unplug_request_cb; hc->unplug = pc_machine_device_unplug_cb; + nc->nmi_monitor_handler = x86_nmi; }static const TypeInfo pc_machine_info = {
@@ -2005,6 +2024,7 @@ static const TypeInfo pc_machine_info = { .class_init = pc_machine_class_init, .interfaces = (InterfaceInfo []) { {TYPE_HOTPLUG_HANDLER }, + {TYPE_NMI }, { } }, };
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 20/24] iscsi: pass SCSI status back for SG_IO
In reply to Paolo BonziniFrom: Vadim Rozenfeld <[email protected]>
--- block/iscsi.c | 1 + 1 file changed, 1 insertion(+)
block/iscsi.c +1 -0
@@ -761,6 +761,7 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, acb->ioh->driver_status =0 ; acb->ioh->host_status =0 ; acb->ioh->resid =0 ; + acb->ioh->status = status;#define SG_ERR_DRIVER_SENSE 0x08
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 21/24] coccinelle: add g_assert_cmp* to macro file
In reply to Paolo BonziniThis helps applying semantic patches to unit tests.
--- scripts/cocci-macro-file.h | 6 ++++++ 1 file changed, 6 insertions(+)
scripts/cocci-macro-file.h +6 -0
@@ -117,3 +117,9 @@ struct { \type *tqe_next;/* next element */ \type **tqe_prev;/* address of previous next element */ \ } + +/* From glib */ +#define g_assert_cmpint (a, op, b) g_assert(a op b) +#define g_assert_cmpuint (a, op, b) g_assert(a op b) +#define g_assert_cmphex (a, op, b) g_assert(a op b) +#define g_assert_cmpstr (a, op, b) g_assert(strcmp(a, b) op 0)
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 13 lines · Paolo Bonzini
The following changes since commit
e081c24d30c1e7b29eb4450aa16d6a0da5782797:Merge remote-tracking branch 'remotes/ehabkost/tags/machine-pull-request' into staging (2016-05-23 10:30:41 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
1453e6627d19a8d6d54480c6980f5cef5dfc6833:cpus: call the core nmi injection function (2016-05-23 16:53:47 +0200)
Quoted 8 lines
----------------------------------------------------------------
* NMI cleanups (Bandan)
* RAMBlock/Memory cleanups and fixes (Dominik, Gonglei, Fam, me)
* first part of linuxboot support forfw_cfgDMA (Richard)
* IOAPIC fix (Peter Xu)
* iSCSISG_IOfix (Vadim)
* Various infrastructure bug fixes (Zhijian, Peter M., Stefan)
* CVE fixes (Prasad)
Applied, thanks.
-- PMM