mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging
trivial patches for 2018-05-20 # gpg: Signature made Sun 20 May 2018 07:13:20 BST # gpg: using RSA key 701B4F6B1A693E59 # 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: (22 commits) acpi: fix a comment about aml_call0() qapi/net.json: Fix the version number of the "vlan" removal gdbstub: Handle errors in gdb_accept() gdbstub: Use qemu_set_cloexec() replace functions which are only available in glib-2.24 typedefs: Remove PcGuestInfo from qemu/typedefs.h qemu-options: Allow -no-user-config again hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINTF format strings Remove unnecessary variables for function return value trivial: Do not include pci.h if it is not necessary tests: fix tpm-crb tpm-tis tests race hw/ide/ahci: Keep ALLWINNER_AHCI() macro internal qemu-img-cmds.hx: add passive-aggressive note qemu-img: Make documentation between .texi and .hx consistent qemu-img: remove references to GEN_DOCS qemu-img.texi: fix command ordering qemu-img-commands.hx: argument ordering fixups HACKING: document preference for g_new instead of g_malloc qemu-option-trace: -trace enable= is a pattern, not a file slirp/debug: Print IP addresses in human readable form ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -118,6 +118,15 @@ Please note that g_malloc will exit on allocation failure, so there
|
||||
is no need to test for failure (as you would have to with malloc).
|
||||
Calling g_malloc with a zero size is valid and will return NULL.
|
||||
|
||||
Prefer g_new(T, n) instead of g_malloc(sizeof(T) * n) for the following
|
||||
reasons:
|
||||
|
||||
a. It catches multiplication overflowing size_t;
|
||||
b. It returns T * instead of void *, letting compiler catch more type
|
||||
errors.
|
||||
|
||||
Declarations like T *v = g_malloc(sizeof(*v)) are acceptable, though.
|
||||
|
||||
Memory allocated by qemu_memalign or qemu_blockalign must be freed with
|
||||
qemu_vfree, since breaking this will cause problems on Win32.
|
||||
|
||||
|
||||
@@ -644,11 +644,8 @@ static inline void *alloc_code_gen_buffer(void)
|
||||
static inline void *alloc_code_gen_buffer(void)
|
||||
{
|
||||
size_t size = tcg_ctx->code_gen_buffer_size;
|
||||
void *buf;
|
||||
|
||||
buf = VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
|
||||
return VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
return buf;
|
||||
}
|
||||
#else
|
||||
static inline void *alloc_code_gen_buffer(void)
|
||||
|
||||
+2
-4
@@ -613,7 +613,7 @@ static void read_quorum_children_entry(void *opaque)
|
||||
static int read_quorum_children(QuorumAIOCB *acb)
|
||||
{
|
||||
BDRVQuorumState *s = acb->bs->opaque;
|
||||
int i, ret;
|
||||
int i;
|
||||
|
||||
acb->children_read = s->num_children;
|
||||
for (i = 0; i < s->num_children; i++) {
|
||||
@@ -648,9 +648,7 @@ static int read_quorum_children(QuorumAIOCB *acb)
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
ret = acb->vote_ret;
|
||||
|
||||
return ret;
|
||||
return acb->vote_ret;
|
||||
}
|
||||
|
||||
static int read_fifo_child(QuorumAIOCB *acb)
|
||||
|
||||
@@ -1814,7 +1814,7 @@ void gdb_signalled(CPUArchState *env, int sig)
|
||||
put_packet(s, buf);
|
||||
}
|
||||
|
||||
static void gdb_accept(void)
|
||||
static bool gdb_accept(void)
|
||||
{
|
||||
GDBState *s;
|
||||
struct sockaddr_in sockaddr;
|
||||
@@ -1826,17 +1826,18 @@ static void gdb_accept(void)
|
||||
fd = accept(gdbserver_fd, (struct sockaddr *)&sockaddr, &len);
|
||||
if (fd < 0 && errno != EINTR) {
|
||||
perror("accept");
|
||||
return;
|
||||
return false;
|
||||
} else if (fd >= 0) {
|
||||
#ifndef _WIN32
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
qemu_set_cloexec(fd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* set short latency */
|
||||
socket_set_nodelay(fd);
|
||||
if (socket_set_nodelay(fd)) {
|
||||
perror("setsockopt");
|
||||
return false;
|
||||
}
|
||||
|
||||
s = g_malloc0(sizeof(GDBState));
|
||||
s->c_cpu = first_cpu;
|
||||
@@ -1845,6 +1846,7 @@ static void gdb_accept(void)
|
||||
gdb_has_xml = false;
|
||||
|
||||
gdbserver_state = s;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int gdbserver_open(int port)
|
||||
@@ -1857,9 +1859,7 @@ static int gdbserver_open(int port)
|
||||
perror("socket");
|
||||
return -1;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
qemu_set_cloexec(fd);
|
||||
|
||||
socket_set_fast_reuse(fd);
|
||||
|
||||
@@ -1887,7 +1887,11 @@ int gdbserver_start(int port)
|
||||
if (gdbserver_fd < 0)
|
||||
return -1;
|
||||
/* accept connections */
|
||||
gdb_accept();
|
||||
if (!gdb_accept()) {
|
||||
close(gdbserver_fd);
|
||||
gdbserver_fd = -1;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -627,7 +627,7 @@ Aml *aml_notify(Aml *arg1, Aml *arg2)
|
||||
return var;
|
||||
}
|
||||
|
||||
/* helper to call method with 1 argument */
|
||||
/* helper to call method without argument */
|
||||
Aml *aml_call0(const char *method)
|
||||
{
|
||||
Aml *var = aml_alloc();
|
||||
|
||||
+1
-5
@@ -156,12 +156,8 @@ void exynos4210_write_secondary(ARMCPU *cpu,
|
||||
|
||||
static uint64_t exynos4210_calc_affinity(int cpu)
|
||||
{
|
||||
uint64_t mp_affinity;
|
||||
|
||||
/* Exynos4210 has 0x9 as cluster ID */
|
||||
mp_affinity = (0x9 << ARM_AFF1_SHIFT) | cpu;
|
||||
|
||||
return mp_affinity;
|
||||
return (0x9 << ARM_AFF1_SHIFT) | cpu;
|
||||
}
|
||||
|
||||
Exynos4210State *exynos4210_init(MemoryRegion *system_mem)
|
||||
|
||||
@@ -196,7 +196,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
|
||||
Error **errp)
|
||||
{
|
||||
VHostUserBlk *s = VHOST_USER_BLK(vdev);
|
||||
uint64_t get_features;
|
||||
|
||||
/* Turn on pre-defined features */
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
|
||||
@@ -215,9 +214,7 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_MQ);
|
||||
}
|
||||
|
||||
get_features = vhost_get_features(&s->dev, user_feature_bits, features);
|
||||
|
||||
return get_features;
|
||||
return vhost_get_features(&s->dev, user_feature_bits, features);
|
||||
}
|
||||
|
||||
static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
|
||||
|
||||
+1
-4
@@ -403,13 +403,10 @@ static void dino_set_irq(void *opaque, int irq, int level)
|
||||
static int dino_pci_map_irq(PCIDevice *d, int irq_num)
|
||||
{
|
||||
int slot = d->devfn >> 3;
|
||||
int local_irq;
|
||||
|
||||
assert(irq_num >= 0 && irq_num <= 3);
|
||||
|
||||
local_irq = slot & 0x03;
|
||||
|
||||
return local_irq;
|
||||
return slot & 0x03;
|
||||
}
|
||||
|
||||
static void dino_set_timer_irq(void *opaque, int irq, int level)
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
#define ALLWINNER_AHCI(obj) \
|
||||
OBJECT_CHECK(AllwinnerAHCIState, (obj), TYPE_ALLWINNER_AHCI)
|
||||
|
||||
#define ALLWINNER_AHCI_BISTAFR ((0xa0 - ALLWINNER_AHCI_MMIO_OFF) / 4)
|
||||
#define ALLWINNER_AHCI_BISTCR ((0xa4 - ALLWINNER_AHCI_MMIO_OFF) / 4)
|
||||
#define ALLWINNER_AHCI_BISTFCTR ((0xa8 - ALLWINNER_AHCI_MMIO_OFF) / 4)
|
||||
|
||||
@@ -375,7 +375,4 @@ void ahci_reset(AHCIState *s);
|
||||
|
||||
#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
|
||||
|
||||
#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
|
||||
TYPE_ALLWINNER_AHCI)
|
||||
|
||||
#endif /* HW_IDE_AHCI_H */
|
||||
|
||||
+2
-2
@@ -108,8 +108,8 @@ ahci_dma_prepare_buf_fail(void *s, int port) "ahci(%p)[%d]: sglist population fa
|
||||
ahci_dma_rw_buf(void *s, int port, int l) "ahci(%p)[%d] len=0x%x"
|
||||
ahci_cmd_done(void *s, int port) "ahci(%p)[%d]: cmd done"
|
||||
ahci_reset(void *s) "ahci(%p): HBA reset"
|
||||
allwinner_ahci_mem_read(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): read a=%p addr=0x%"HWADDR_PRIx" val=0x%"PRIx64", size=%d"
|
||||
allwinner_ahci_mem_write(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): write a=%p addr=0x%"HWADDR_PRIx" val=0x%"PRIx64", size=%d"
|
||||
allwinner_ahci_mem_read(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): read a=%p addr=0x%"PRIx64" val=0x%"PRIx64", size=%d"
|
||||
allwinner_ahci_mem_write(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): write a=%p addr=0x%"PRIx64" val=0x%"PRIx64", size=%d"
|
||||
|
||||
# Warning: Verbose
|
||||
handle_reg_h2d_fis_dump(void *s, int port, const char *fis) "ahci(%p)[%d]: %s"
|
||||
|
||||
+2
-6
@@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)
|
||||
|
||||
static uint64_t mos6522_get_counter_value(MOS6522State *s, MOS6522Timer *ti)
|
||||
{
|
||||
uint64_t d;
|
||||
|
||||
d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
|
||||
ti->frequency, NANOSECONDS_PER_SECOND);
|
||||
|
||||
return d;
|
||||
return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
|
||||
ti->frequency, NANOSECONDS_PER_SECOND);
|
||||
}
|
||||
|
||||
static uint64_t mos6522_get_load_time(MOS6522State *s, MOS6522Timer *ti)
|
||||
|
||||
@@ -69,13 +69,13 @@ mps2_fpgaio_reset(void) "MPS2 FPGAIO: reset"
|
||||
mps2_fpgaio_leds(char led1, char led0) "MPS2 FPGAIO LEDs: %c%c"
|
||||
|
||||
# hw/misc/msf2-sysreg.c
|
||||
msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev) "msf2-sysreg write: addr 0x%08" HWADDR_PRIx " data 0x%" PRIx32 " prev 0x%" PRIx32
|
||||
msf2_sysreg_read(uint64_t offset, uint32_t val) "msf2-sysreg read: addr 0x%08" HWADDR_PRIx " data 0x%08" PRIx32
|
||||
msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev) "msf2-sysreg write: addr 0x%08" PRIx64 " data 0x%" PRIx32 " prev 0x%" PRIx32
|
||||
msf2_sysreg_read(uint64_t offset, uint32_t val) "msf2-sysreg read: addr 0x%08" PRIx64 " data 0x%08" PRIx32
|
||||
msf2_sysreg_write_pll_status(void) "Invalid write to read only PLL status register"
|
||||
|
||||
#hw/misc/imx7_gpr.c
|
||||
imx7_gpr_read(uint64_t offset) "addr 0x%08" HWADDR_PRIx
|
||||
imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" HWADDR_PRIx "value 0x%08" HWADDR_PRIx
|
||||
imx7_gpr_read(uint64_t offset) "addr 0x%08" PRIx64
|
||||
imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" PRIx64 "value 0x%08" PRIx64
|
||||
|
||||
# hw/misc/mos6522.c
|
||||
mos6522_set_counter(int index, unsigned int val) "T%d.counter=%d"
|
||||
|
||||
+1
-4
@@ -511,7 +511,6 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
|
||||
|
||||
uint32_t cnt = 1024 * FTGMAC100_APTC_RXPOLL_CNT(s->aptcr);
|
||||
uint32_t speed = (s->maccr & FTGMAC100_MACCR_FAST_MODE) ? 1 : 0;
|
||||
uint32_t period;
|
||||
|
||||
if (s->aptcr & FTGMAC100_APTC_RXPOLL_TIME_SEL) {
|
||||
cnt <<= 4;
|
||||
@@ -521,9 +520,7 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
|
||||
speed = 2;
|
||||
}
|
||||
|
||||
period = cnt / div[speed];
|
||||
|
||||
return period;
|
||||
return cnt / div[speed];
|
||||
}
|
||||
|
||||
static void ftgmac100_reset(DeviceState *d)
|
||||
|
||||
+4
-12
@@ -125,25 +125,17 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)
|
||||
static bool opb_read(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
|
||||
int sz)
|
||||
{
|
||||
bool success;
|
||||
|
||||
/* XXX Handle access size limits and FW read caching here */
|
||||
success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
data, sz, false);
|
||||
|
||||
return success;
|
||||
return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
data, sz, false);
|
||||
}
|
||||
|
||||
static bool opb_write(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
|
||||
int sz)
|
||||
{
|
||||
bool success;
|
||||
|
||||
/* XXX Handle access size limits here */
|
||||
success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
data, sz, true);
|
||||
|
||||
return success;
|
||||
return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
data, sz, true);
|
||||
}
|
||||
|
||||
#define ECCB_CTL_READ PPC_BIT(15)
|
||||
|
||||
@@ -25,13 +25,10 @@
|
||||
#ifndef HW_M48T59_INTERNAL_H
|
||||
#define HW_M48T59_INTERNAL_H 1
|
||||
|
||||
//#define DEBUG_NVRAM
|
||||
#define M48T59_DEBUG 0
|
||||
|
||||
#if defined(DEBUG_NVRAM)
|
||||
#define NVRAM_PRINTF(fmt, ...) do { printf(fmt , ## __VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define NVRAM_PRINTF(fmt, ...) do { } while (0)
|
||||
#endif
|
||||
#define NVRAM_PRINTF(fmt, ...) do { \
|
||||
if (M48T59_DEBUG) { printf(fmt , ## __VA_ARGS__); } } while (0)
|
||||
|
||||
/*
|
||||
* The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
|
||||
|
||||
+2
-2
@@ -456,7 +456,7 @@ static void NVRAM_writeb(void *opaque, hwaddr addr, uint64_t val,
|
||||
{
|
||||
M48t59State *NVRAM = opaque;
|
||||
|
||||
NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
|
||||
NVRAM_PRINTF("%s: 0x%"HWADDR_PRIx" => 0x%"PRIx64"\n", __func__, addr, val);
|
||||
switch (addr) {
|
||||
case 0:
|
||||
NVRAM->addr &= ~0x00FF;
|
||||
@@ -488,7 +488,7 @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr, unsigned size)
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);
|
||||
NVRAM_PRINTF("%s: 0x%"HWADDR_PRIx" <= 0x%08x\n", __func__, addr, retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#ifndef PPC4XX_H
|
||||
#define PPC4XX_H
|
||||
|
||||
#include "hw/pci/pci.h"
|
||||
|
||||
/* PowerPC 4xx core initialization */
|
||||
PowerPCCPU *ppc4xx_init(const char *cpu_model,
|
||||
clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "standard-headers/linux/virtio_balloon.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/pci/pci.h"
|
||||
|
||||
#define TYPE_VIRTIO_BALLOON "virtio-balloon-device"
|
||||
#define VIRTIO_BALLOON(obj) \
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "ui/qemu-pixman.h"
|
||||
#include "ui/console.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "qemu/log.h"
|
||||
|
||||
#include "standard-headers/linux/virtio_gpu.h"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user