Re: [Qemu-devel] [PATCH 0/2] scsi: Simple ALUA support

2017-12-17 Thread no-reply
Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20171214152246.17503-1-h...@suse.de
Subject: [Qemu-devel] [PATCH 0/2] scsi: Simple ALUA support
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]patchew/20171205055200.16305-1-pet...@redhat.com -> 
patchew/20171205055200.16305-1-pet...@redhat.com
 t [tag update]
patchew/20171214143713.3795-1-programmingk...@gmail.com -> 
patchew/20171214143713.3795-1-programmingk...@gmail.com
 * [new tag]   patchew/20171214152246.17503-1-h...@suse.de -> 
patchew/20171214152246.17503-1-h...@suse.de
Switched to a new branch 'test'
01f624a08c scsi: Implement multipath support
a57f951050 block: implement shared block device count

=== OUTPUT BEGIN ===
Checking PATCH 1/2: block: implement shared block device count...
ERROR: braces {} are necessary for all arms of this statement
#27: FILE: block.c:3810:
+if (!bs->filename)
[...]

ERROR: braces {} are necessary for all arms of this statement
#30: FILE: block.c:3813:
+if (tmp_bs == bs)
[...]

total: 2 errors, 0 warnings, 76 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/2: scsi: Implement multipath support...
ERROR: braces {} are necessary for all arms of this statement
#25: FILE: block.c:3844:
+if (!bs->filename || !shared_mask)
[...]

ERROR: do not use C99 // comments
#48: FILE: hw/scsi/scsi-disk.c:680:
+outbuf[buflen++] = 0x61; // SAS / Binary

WARNING: line over 80 characters
#49: FILE: hw/scsi/scsi-disk.c:681:
+outbuf[buflen++] = 0x95; // PIV / Target port / target port 
group

ERROR: do not use C99 // comments
#49: FILE: hw/scsi/scsi-disk.c:681:
+outbuf[buflen++] = 0x95; // PIV / Target port / target port 
group

ERROR: do not use C99 // comments
#50: FILE: hw/scsi/scsi-disk.c:682:
+outbuf[buflen++] = 0; // reserved

ERROR: braces {} are necessary for all arms of this statement
#96: FILE: hw/scsi/scsi-disk.c:1907:
+if (!test_bit(i, &shared_mask))
[...]

total: 5 errors, 1 warnings, 129 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-de...@freelists.org

[Qemu-devel] [PATCH] s390x: Add missing QEMU_NORETURN attribute (CID 1383842)

2017-12-17 Thread Stefan Weil
This should fix the Coverity warning:

** CID 1383842:  Integer handling issues  (DIVIDE_BY_ZERO)
/target/s390x/int_helper.c: 84 in helper_divs64()

Signed-off-by: Stefan Weil 
---
 target/s390x/cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 1a8b6b9ae9..2a6e75d697 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -746,8 +746,8 @@ void s390_io_interrupt(uint16_t subchannel_id, uint16_t 
subchannel_nr,
 /* automatically detect the instruction length */
 #define ILEN_AUTO   0xff
 #define RA_IGNORED  0
-void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen,
-uintptr_t ra);
+void QEMU_NORETURN s390_program_interrupt(CPUS390XState *env, uint32_t code,
+  int ilen, uintptr_t ra);
 /* service interrupts are floating therefore we must not pass an cpustate */
 void s390_sclp_extint(uint32_t parm);
 
-- 
2.11.0




Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Tetsuo Handa
Wei Wang wrote:
> > But passing GFP_NOWAIT means that we can handle allocation failure. There is
> > no need to use preload approach when we can handle allocation failure.
> 
> I think the reason we need xb_preload is because radix tree insertion 
> needs the memory being preallocated already (it couldn't suffer from 
> memory failure during the process of inserting, probably because 
> handling the failure there isn't easy, Matthew may know the backstory of 
> this)

According to https://lwn.net/Articles/175432/ , I think that preloading is 
needed
only when failure to insert an item into a radix tree is a significant problem.
That is, when failure to insert an item into a radix tree is not a problem,
I think that we don't need to use preloading.

> 
> So, I think we can handle the memory failure with xb_preload, which 
> stops going into the radix tree APIs, but shouldn't call radix tree APIs 
> without the related memory preallocated.

It seems to me that virtio-ballon case has no problem without using preloading.



Re: [Qemu-devel] [PATCH] s390x: Add missing QEMU_NORETURN attribute (CID 1383842)

2017-12-17 Thread Stefan Weil
Am 17.12.2017 um 11:25 schrieb no-re...@patchew.org:
> Hi,
> 
> This series failed build test on s390x host. Please find the details below.
[...]
> /var/tmp/patchew-tester-tmp-e2qiwzsb/src/target/s390x/interrupt.c: In 
> function ‘s390_program_interrupt’:
> /var/tmp/patchew-tester-tmp-e2qiwzsb/src/target/s390x/interrupt.c:55:1: 
> error: ‘noreturn’ function does return [-Werror]

Obviously the s390x compiler does more checks than my x86 gcc.

To fix the new warning, QEMU_NORETURN would have to be added to
kvm_s390_program_interrupt and tcg_s390_program_interrupt, too.

I am not sure about kvm_s390_program_interrupt. Is it a function which
will never return? Then the current code (which includes a return
statement in kvm_s390_vcpu_interrupt) is not correct.

We could also move the g_assert_not_reached in s390_program_interrupt to
the end of the function. That should satisfy the compiler as well.

Or we could suppress the s390x compiler warning by using a compiler
pragma. But I don't like that alternative.

Regards
Stefan



Re: [Qemu-devel] [PATCH 11/15] apb: split pci_pbm_map_irq() into separate functions for bus A and bus B

2017-12-17 Thread Mark Cave-Ayland

On 19/11/17 11:06, Mark Cave-Ayland wrote:


On 17/11/17 14:33, Artyom Tarasenko wrote:


On Fri, Nov 17, 2017 at 2:42 PM, Mark Cave-Ayland
 wrote:

After the previous refactoring it is now possible to use separate functions
to improve clarity of the interrupt paths. Similarly by checking the PCI
devnfn to identify busA during apb_pci_bridge_realize() it becomes possible
to completely remove the busA property from the PBMPCIBridge state.

Signed-off-by: Mark Cave-Ayland 
---
  hw/pci-host/apb.c |   54 ++---
  include/hw/pci-host/apb.h |3 ---
  2 files changed, 21 insertions(+), 36 deletions(-)

diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 6c20285..268100e 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -517,32 +517,27 @@ static int pci_apb_map_irq(PCIDevice *pci_dev, int 
irq_num)
  return irq_num;
  }

-static int pci_pbm_map_irq(PCIDevice *pci_dev, int irq_num)
+static int pci_pbmA_map_irq(PCIDevice *pci_dev, int irq_num)
  {
-PBMPCIBridge *br = PBM_PCI_BRIDGE(pci_bridge_get_device(
-   PCI_BUS(qdev_get_parent_bus(DEVICE(pci_dev);
-
-int bus_offset;
-if (br->busA) {
-bus_offset = 0x0;
+/* The on-board devices have fixed (legacy) OBIO intnos */
+switch (PCI_SLOT(pci_dev->devfn)) {
+case 1:
+/* Onboard NIC */
+return 0x21;
+case 3:
+/* Onboard IDE */
+return 0x20;
+default:
+/* Normal intno, fall through */
+break;
+}

-/* The on-board devices have fixed (legacy) OBIO intnos */
-switch (PCI_SLOT(pci_dev->devfn)) {
-case 1:
-/* Onboard NIC */
-return 0x21;
-case 3:
-/* Onboard IDE */
-return 0x20;
+return ((PCI_SLOT(pci_dev->devfn) << 2) + irq_num) & 0x1f;
+}

-default:
-/* Normal intno, fall through */
-break;
-}
-} else {
-bus_offset = 0x10;
-}
-return (bus_offset + (PCI_SLOT(pci_dev->devfn) << 2) + irq_num) & 0x1f;
+static int pci_pbmB_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+return (0x10 + (PCI_SLOT(pci_dev->devfn) << 2) + irq_num) & 0x1f;
  }

  static void pci_apb_set_irq(void *opaque, int irq_num, int level)
@@ -593,7 +588,7 @@ static void apb_pci_bridge_realize(PCIDevice *dev, Error 
**errp)

  /* If initialising busA, ensure that we allow IO transactions so that
 we get the early serial console until OpenBIOS configures the bridge */
-if (br->busA) {
+if (dev->devfn == PCI_DEVFN(1, 1)) {


I think the previous syntax was more explicit here. A comment would be nice.


Yes it's definitely something that isn't immediately obvious, which is
why I left the above comment in place explaining what the if() branch is
doing. Is there something in the comment that isn't particularly clear?

Note one of the reasons for wanting to remove the busA property is that
where possible I'd like to reduce the code in the IRQ path, and while
the existing code works I am still unsure of the additional overhead of
the 2 levels of QOM type checking that the current approach requires for
each IRQ.


Hi Artyom,

Thinking about this a bit more during freeze, this is actually doing the 
opposite of what we want, as it requires the device realise function to 
behave differently depending upon how it is related to the PCI bus.


How about swapping this out for a qdev bool property for APB named 
"enable-early-pci-io-access", setting it just for the PCI_DEVFN(1, 1) 
device containing the ebus and then alter the if() statement above to 
enable PCI IO access if the qdev property is set?



ATB,

Mark.



Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Wang, Wei W


> -Original Message-
> From: Tetsuo Handa [mailto:penguin-ker...@i-love.sakura.ne.jp]
> Sent: Sunday, December 17, 2017 6:22 PM
> To: Wang, Wei W ; wi...@infradead.org
> Cc: virtio-...@lists.oasis-open.org; linux-ker...@vger.kernel.org; qemu-
> de...@nongnu.org; virtualizat...@lists.linux-foundation.org;
> k...@vger.kernel.org; linux...@kvack.org; m...@redhat.com;
> mho...@kernel.org; a...@linux-foundation.org; mawil...@microsoft.com;
> da...@redhat.com; cornelia.h...@de.ibm.com;
> mgor...@techsingularity.net; aarca...@redhat.com;
> amit.s...@redhat.com; pbonz...@redhat.com;
> liliang.opensou...@gmail.com; yang.zhang...@gmail.com;
> quan...@aliyun.com; ni...@redhat.com; r...@redhat.com
> Subject: Re: [PATCH v19 3/7] xbitmap: add more operations
> 
> Wei Wang wrote:
> > > But passing GFP_NOWAIT means that we can handle allocation failure.
> > > There is no need to use preload approach when we can handle allocation
> failure.
> >
> > I think the reason we need xb_preload is because radix tree insertion
> > needs the memory being preallocated already (it couldn't suffer from
> > memory failure during the process of inserting, probably because
> > handling the failure there isn't easy, Matthew may know the backstory
> > of
> > this)
> 
> According to https://lwn.net/Articles/175432/ , I think that preloading is
> needed only when failure to insert an item into a radix tree is a significant
> problem.
> That is, when failure to insert an item into a radix tree is not a problem, I
> think that we don't need to use preloading.

It also mentions that the preload attempts to allocate sufficient memory to 
*guarantee* that the next radix tree insertion cannot fail.

If we check radix_tree_node_alloc(), the comments there says "this assumes that 
the caller has performed appropriate preallocation".

So, I think we would get a risk of triggering some issue without preload().

> >
> > So, I think we can handle the memory failure with xb_preload, which
> > stops going into the radix tree APIs, but shouldn't call radix tree
> > APIs without the related memory preallocated.
> 
> It seems to me that virtio-ballon case has no problem without using
> preloading.

Why is that?

Best,
Wei




[Qemu-devel] [PATCH V2 2/5] mem: add share parameter to memory-backend-ram

2017-12-17 Thread Marcel Apfelbaum
Currently only file backed memory backend can
be created with a "share" flag in order to allow
sharing guest RAM with other processes in the host.

Add the "share" flag also to RAM Memory Backend
in order to allow remapping parts of the guest RAM
to different host virtual addresses. This is needed
by the RDMA devices in order to remap non-contiguous
QEMU virtual addresses to a contiguous virtual address range.

Moved the "share" flag to the Host Memory base class,
modified phys_mem_alloc to include the new parameter
and a new interface memory_region_init_ram_shared_nomigrate.

There are no functional changes if the new flag is not used.

Signed-off-by: Marcel Apfelbaum 
---
 backends/hostmem-file.c  | 25 +
 backends/hostmem-ram.c   |  4 ++--
 backends/hostmem.c   | 21 +
 exec.c   | 26 +++---
 include/exec/memory.h| 23 +++
 include/exec/ram_addr.h  |  3 ++-
 include/qemu/osdep.h |  2 +-
 include/sysemu/hostmem.h |  2 +-
 include/sysemu/kvm.h |  2 +-
 memory.c | 16 +---
 util/oslib-posix.c   |  4 ++--
 util/oslib-win32.c   |  2 +-
 12 files changed, 83 insertions(+), 47 deletions(-)

diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index e44c319915..bc95022a68 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -31,7 +31,6 @@ typedef struct HostMemoryBackendFile HostMemoryBackendFile;
 struct HostMemoryBackendFile {
 HostMemoryBackend parent_obj;
 
-bool share;
 bool discard_data;
 char *mem_path;
 };
@@ -58,7 +57,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error 
**errp)
 path = object_get_canonical_path(OBJECT(backend));
 memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
  path,
- backend->size, fb->share,
+ backend->size, backend->share,
  fb->mem_path, errp);
 g_free(path);
 }
@@ -85,25 +84,6 @@ static void set_mem_path(Object *o, const char *str, Error 
**errp)
 fb->mem_path = g_strdup(str);
 }
 
-static bool file_memory_backend_get_share(Object *o, Error **errp)
-{
-HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
-
-return fb->share;
-}
-
-static void file_memory_backend_set_share(Object *o, bool value, Error **errp)
-{
-HostMemoryBackend *backend = MEMORY_BACKEND(o);
-HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
-
-if (host_memory_backend_mr_inited(backend)) {
-error_setg(errp, "cannot change property value");
-return;
-}
-fb->share = value;
-}
-
 static bool file_memory_backend_get_discard_data(Object *o, Error **errp)
 {
 return MEMORY_BACKEND_FILE(o)->discard_data;
@@ -136,9 +116,6 @@ file_backend_class_init(ObjectClass *oc, void *data)
 bc->alloc = file_backend_memory_alloc;
 oc->unparent = file_backend_unparent;
 
-object_class_property_add_bool(oc, "share",
-file_memory_backend_get_share, file_memory_backend_set_share,
-&error_abort);
 object_class_property_add_bool(oc, "discard-data",
 file_memory_backend_get_discard_data, 
file_memory_backend_set_discard_data,
 &error_abort);
diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
index 38977be73e..7ddd08d370 100644
--- a/backends/hostmem-ram.c
+++ b/backends/hostmem-ram.c
@@ -28,8 +28,8 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error 
**errp)
 }
 
 path = object_get_canonical_path_component(OBJECT(backend));
-memory_region_init_ram_nomigrate(&backend->mr, OBJECT(backend), path,
-   backend->size, errp);
+memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend), 
path,
+   backend->size, backend->share, errp);
 g_free(path);
 }
 
diff --git a/backends/hostmem.c b/backends/hostmem.c
index ee2c2d5bfd..1daf13bd2e 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -369,6 +369,24 @@ static void set_id(Object *o, const char *str, Error 
**errp)
 backend->id = g_strdup(str);
 }
 
+static bool host_memory_backend_get_share(Object *o, Error **errp)
+{
+HostMemoryBackend *backend = MEMORY_BACKEND(o);
+
+return backend->share;
+}
+
+static void host_memory_backend_set_share(Object *o, bool value, Error **errp)
+{
+HostMemoryBackend *backend = MEMORY_BACKEND(o);
+
+if (host_memory_backend_mr_inited(backend)) {
+error_setg(errp, "cannot change property value");
+return;
+}
+backend->share = value;
+}
+
 static void
 host_memory_backend_class_init(ObjectClass *oc, void *data)
 {
@@ -399,6 +417,9 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
 host_memory_backend_get_policy,
 host_memory_backend_set_policy, &error_abort);
 object_class_property_add_str(oc, "id", get_id, set_id, &error_a

[Qemu-devel] [PATCH V2 1/5] pci/shpc: Move function to generic header file

2017-12-17 Thread Marcel Apfelbaum
From: Yuval Shaia 

This function should be declared in generic header file so we can
utilize it.

Signed-off-by: Yuval Shaia 
Signed-off-by: Marcel Apfelbaum 
---
 hw/pci/shpc.c | 11 +--
 include/qemu/cutils.h | 10 ++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index 69fc14b218..3d22424fd2 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/range.h"
 #include "qemu/error-report.h"
 #include "hw/pci/shpc.h"
@@ -122,16 +123,6 @@
 #define SHPC_PCI_TO_IDX(pci_slot) ((pci_slot) - 1)
 #define SHPC_IDX_TO_PHYSICAL(slot) ((slot) + 1)
 
-static int roundup_pow_of_two(int x)
-{
-x |= (x >> 1);
-x |= (x >> 2);
-x |= (x >> 4);
-x |= (x >> 8);
-x |= (x >> 16);
-return x + 1;
-}
-
 static uint16_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk)
 {
 uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot);
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index f0878eaafa..4895334645 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -164,4 +164,14 @@ bool test_buffer_is_zero_next_accel(void);
 int uleb128_encode_small(uint8_t *out, uint32_t n);
 int uleb128_decode_small(const uint8_t *in, uint32_t *n);
 
+static inline int roundup_pow_of_two(int x)
+{
+x |= (x >> 1);
+x |= (x >> 2);
+x |= (x >> 4);
+x |= (x >> 8);
+x |= (x >> 16);
+return x + 1;
+}
+
 #endif
-- 
2.13.5




[Qemu-devel] [PATCH V2 3/5] docs: add pvrdma device documentation

2017-12-17 Thread Marcel Apfelbaum
Signed-off-by: Marcel Apfelbaum 
Signed-off-by: Yuval Shaia 
---
 docs/pvrdma.txt | 145 
 1 file changed, 145 insertions(+)
 create mode 100644 docs/pvrdma.txt

diff --git a/docs/pvrdma.txt b/docs/pvrdma.txt
new file mode 100644
index 00..74c5cf2495
--- /dev/null
+++ b/docs/pvrdma.txt
@@ -0,0 +1,145 @@
+Paravirtualized RDMA Device (PVRDMA)
+
+
+
+1. Description
+===
+PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device.
+It works with its Linux Kernel driver AS IS, no need for any special guest
+modifications.
+
+While it complies with the VMware device, it can also communicate with bare
+metal RDMA-enabled machines and does not require an RDMA HCA in the host, it
+can work with Soft-RoCE (rxe).
+
+It does not require the whole guest RAM to be pinned allowing memory
+over-commit and, even if not implemented yet, migration support will be
+possible with some HW assistance.
+
+A project presentation accompany this document:
+- 
http://events.linuxfoundation.org/sites/events/files/slides/lpc-2017-pvrdma-marcel-apfelbaum-yuval-shaia.pdf
+
+
+
+2. Setup
+
+
+
+2.1 Guest setup
+===
+Fedora 27+ kernels work out of the box, older distributions
+require updating the kernel to 4.14 to include the pvrdma driver.
+
+However the libpvrdma library needed by User Level Software is still
+not available as part of the distributions, so the rdma-core library
+needs to be compiled and optionally installed.
+
+Please follow the instructions at:
+  https://github.com/linux-rdma/rdma-core.git
+
+
+2.2 Host Setup
+==
+The pvrdma backend is an ibdevice interface that can be exposed
+either by a Soft-RoCE(rxe) device on machines with no RDMA device,
+or an HCA SRIOV function(VF/PF).
+Note that ibdevice interfaces can't be shared between pvrdma devices,
+each one requiring a separate instance (rxe or SRIOV VF).
+
+
+2.2.1 Soft-RoCE backend(rxe)
+===
+A stable version of rxe is required, Fedora 27+ or a Linux
+Kernel 4.14+ is preferred.
+
+The rdma_rxe module is part of the Linux Kernel but not loaded by default.
+Install the User Level library (librxe) following the instructions from:
+https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home
+
+Associate an ETH interface with rxe by running:
+   rxe_cfg add eth0
+An rxe0 ibdevice interface will be created and can be used as pvrdma backend.
+
+
+2.2.2 RDMA device Virtual Function backend
+==
+Nothing special is required, the pvrdma device can work not only with
+Ethernet Links, but also Infinibands Links.
+All is needed is an ibdevice with an active port, for Mellanox cards
+will be something like mlx5_6 which can be the backend.
+
+
+2.2.3 QEMU setup
+
+Configure QEMU with --enable-rdma flag, installing
+the required RDMA libraries.
+
+
+3. Usage
+
+Currently the device is working only with memory backed RAM
+and it must be mark as "shared":
+   -m 1G \
+   -object memory-backend-ram,id=mb1,size=1G,share \
+   -numa node,memdev=mb1 \
+
+The pvrdma device is composed of two functions:
+ - Function 0 is a vmxnet Ethernet Device which is redundant in Guest
+   but is required to pass the ibdevice GID using its MAC.
+   Examples:
+ For an rxe backend using eth0 interface it will use its mac:
+   -device vmxnet3,addr=.0,multifunction=on,mac=
+ For an SRIOV VF, we take the Ethernet Interface exposed by it:
+   -device vmxnet3,multifunction=on,mac=
+ - Function 1 is the actual device:
+   -device 
pvrdma,addr=.1,backend-dev=,backend-gid-idx=,backend-port=
+   where the ibdevice can be rxe or RDMA VF (e.g. mlx5_4)
+ Note: Pay special attention that the GID at backend-gid-idx matches vmxnet's 
MAC.
+ The rules of conversion are part of the RoCE spec, but since manual conversion
+ is not required, spotting problems is not hard:
+Example: GID: fe80::::7efe:90ff:fecb:743a
+ MAC: 7c:fe:90:cb:74:3a
+Note the difference between the first byte of the MAC and the GID.
+
+
+4. Implementation details
+=
+The device acts like a proxy between the Guest Driver and the host
+ibdevice interface.
+On configuration path:
+ - For every hardware resource request (PD/QP/CQ/...) the pvrdma will request
+   a resource from the backend interface, maintaining a 1-1 mapping
+   between the guest and host.
+On data path:
+ - Every post_send/receive received from the guest will be converted into
+   a post_send/receive for the backend. The buffers data will not be touched
+   or copied resulting in near bare-metal performance for large enough buffers.
+ - Completions from the backend interface will result in completions for
+   the pvrdma device.
+
+
+
+5. Limitations
+==
+- The device obviously is limited by the Guest Linux Driver features 
implementation
+  of the VMware device API.

[Qemu-devel] [PATCH V2 0/5] hw/pvrdma: PVRDMA device implementation

2017-12-17 Thread Marcel Apfelbaum
RFC -> V2:
 - Full implementation of the pvrdma device
 - Backend is an ibdevice interface, no need for the KDBR module


General description
===
PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device.
It works with its Linux Kernel driver AS IS, no need for any special guest
modifications.

While it complies with the VMware device, it can also communicate with bare
metal RDMA-enabled machines and does not require an RDMA HCA in the host, it
can work with Soft-RoCE (rxe).

It does not require the whole guest RAM to be pinned allowing memory
over-commit and, even if not implemented yet, migration support will be
possible with some HW assistance.


 Design
 ==
 - Follows the behavior of VMware's pvrdma device, however is not tightly
   coupled with it and most of the code can be reused if we decide to
   continue to a Virtio based RDMA device.

 - It exposes 3 BARs:
BAR 0 - MSIX, utilize 3 vectors for command ring, async events and
completions
BAR 1 - Configuration of registers
BAR 2 - UAR, used to pass HW commands from driver.

 - The device performs internal management of the RDMA
   resources (PDs, CQs, QPs, ...), meaning the objects
   are not directly coupled to a physical RDMA device resources.

The pvrdma backend is an ibdevice interface that can be exposed
either by a Soft-RoCE(rxe) device on machines with no RDMA device,
or an HCA SRIOV function(VF/PF).
Note that ibdevice interfaces can't be shared between pvrdma devices,
each one requiring a separate instance (rxe or SRIOV VF).


Tests and performance
=
Tested with SoftRoCE backend (rxe)/Mellanox ConnectX3,
and Mellanox ConnectX4 HCAs with:
  - VMs in the same host
  - VMs in different hosts 
  - VMs to bare metal.

The best performance achieved with ConnectX HCAs and buffer size
bigger than 1MB which was the line rate ~ 50Gb/s.
The conclusion is that using the PVRDMA device there are no
actual performance penalties compared to bare metal for big enough
buffers (which is quite common when using RDMA), while allowing
memory overcommit.

Marcel Apfelbaum (3):
  mem: add share parameter to memory-backend-ram
  docs: add pvrdma device documentation.
  MAINTAINERS: add entry for hw/net/pvrdma

Yuval Shaia (2):
  pci/shpc: Move function to generic header file
  pvrdma: initial implementation

 MAINTAINERS |   7 +
 Makefile.objs   |   1 +
 backends/hostmem-file.c |  25 +-
 backends/hostmem-ram.c  |   4 +-
 backends/hostmem.c  |  21 +
 configure   |   9 +-
 default-configs/arm-softmmu.mak |   2 +
 default-configs/i386-softmmu.mak|   1 +
 default-configs/x86_64-softmmu.mak  |   1 +
 docs/pvrdma.txt | 145 ++
 exec.c  |  26 +-
 hw/net/Makefile.objs|   7 +
 hw/net/pvrdma/pvrdma.h  | 179 +++
 hw/net/pvrdma/pvrdma_backend.c  | 986 
 hw/net/pvrdma/pvrdma_backend.h  |  74 +++
 hw/net/pvrdma/pvrdma_backend_defs.h |  68 +++
 hw/net/pvrdma/pvrdma_cmd.c  | 338 
 hw/net/pvrdma/pvrdma_defs.h | 121 +
 hw/net/pvrdma/pvrdma_dev_api.h  | 580 +
 hw/net/pvrdma/pvrdma_dev_ring.c | 138 +
 hw/net/pvrdma/pvrdma_dev_ring.h |  42 ++
 hw/net/pvrdma/pvrdma_ib_verbs.h | 399 +++
 hw/net/pvrdma/pvrdma_main.c | 664 
 hw/net/pvrdma/pvrdma_qp_ops.c   | 187 +++
 hw/net/pvrdma/pvrdma_qp_ops.h   |  26 +
 hw/net/pvrdma/pvrdma_ring.h | 134 +
 hw/net/pvrdma/pvrdma_rm.c   | 791 +
 hw/net/pvrdma/pvrdma_rm.h   |  54 ++
 hw/net/pvrdma/pvrdma_rm_defs.h  | 111 
 hw/net/pvrdma/pvrdma_types.h|  37 ++
 hw/net/pvrdma/pvrdma_utils.c| 133 +
 hw/net/pvrdma/pvrdma_utils.h|  41 ++
 hw/net/pvrdma/trace-events  |   9 +
 hw/pci/shpc.c   |  11 +-
 include/exec/memory.h   |  23 +
 include/exec/ram_addr.h |   3 +-
 include/hw/pci/pci_ids.h|   3 +
 include/qemu/cutils.h   |  10 +
 include/qemu/osdep.h|   2 +-
 include/sysemu/hostmem.h|   2 +-
 include/sysemu/kvm.h|   2 +-
 memory.c|  16 +-
 util/oslib-posix.c  |   4 +-
 util/oslib-win32.c  |   2 +-
 44 files changed, 5378 insertions(+), 61 deletions(-)
 create mode 100644 docs/pvrdma.txt
 create mode 100644 hw/net/pvrdma/pvrdma.h
 create mode 100644 hw/net/pvrdma/pvrdma_backend.c
 create mode 100644 hw/net/pvrdma/pvrdma_backend.h
 create mode 100644 hw/net/pvrdma/pvrdma_backend_defs.h
 create mode 100644 hw/net/pvrdma/pvrdma_cmd.c
 create mode 100644 hw/net/pvrdma/pvrdma_defs.h
 create mode 100644 hw/net/pvrdma/pvrdma_dev_api.h
 create mode 100644 hw/net

[Qemu-devel] [PATCH V2 5/5] MAINTAINERS: add entry for hw/net/pvrdma

2017-12-17 Thread Marcel Apfelbaum
Signed-off-by: Marcel Apfelbaum 
Signed-off-by: Yuval Shaia 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ffd77b461c..d24401a4d0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1960,6 +1960,13 @@ F: block/replication.c
 F: tests/test-replication.c
 F: docs/block-replication.txt
 
+PVRDMA
+M: Yuval Shaia 
+M: Marcel Apfelbaum 
+S: Maintained
+F: hw/net/pvrdma/*
+F: docs/pvrdma.txt
+
 Build and test automation
 -
 Build and test automation
-- 
2.13.5




Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Wang, Wei W
On Saturday, December 16, 2017 3:22 AM, Matthew Wilcox wrote:
> On Fri, Dec 15, 2017 at 10:49:15AM -0800, Matthew Wilcox wrote:
> > Here's the API I'm looking at right now.  The user need take no lock;
> > the locking (spinlock) is handled internally to the implementation.

Another place I saw your comment " The xb_ API requires you to handle your own 
locking" which seems conflict with the above "the user need take no lock".
Doesn't the caller need a lock to avoid concurrent accesses to the ida bitmap?


> I looked at the API some more and found some flaws:
>  - how does xbit_alloc communicate back which bit it allocated?
>  - What if xbit_find_set() is called on a completely empty array with
>a range of 0, ULONG_MAX -- there's no invalid number to return.

We'll change it to "bool xb_find_set(.., unsigned long *result)", returning 
false indicates no "1" bit is found.


>  - xbit_clear() can't return an error.  Neither can xbit_zero().

I found the current xbit_clear implementation only returns 0, and there isn't 
an error to be returned from this function. In this case, is it better to make 
the function "void"?


>  - Need to add __must_check to various return values to discourage sloppy
>programming
> 
> So I modify the proposed API we compete with thusly:
> 
> bool xbit_test(struct xbitmap *, unsigned long bit); int __must_check
> xbit_set(struct xbitmap *, unsigned long bit, gfp_t); void xbit_clear(struct
> xbitmap *, unsigned long bit); int __must_check xbit_alloc(struct xbitmap *,
> unsigned long *bit, gfp_t);
> 
> int __must_check xbit_fill(struct xbitmap *, unsigned long start,
> unsigned long nbits, gfp_t); void xbit_zero(struct 
> xbitmap *,
> unsigned long start, unsigned long nbits); int __must_check
> xbit_alloc_range(struct xbitmap *, unsigned long *bit,
> unsigned long nbits, gfp_t);
> 
> bool xbit_find_clear(struct xbitmap *, unsigned long *start, unsigned long
> max); bool xbit_find_set(struct xbitmap *, unsigned long *start, unsigned
> long max);
> 
> (I'm a little sceptical about the API accepting 'max' for the find functions 
> and
> 'nbits' in the fill/zero/alloc_range functions, but I think that matches how
> people want to use it, and it matches how bitmap.h works)

Are you suggesting to rename the current xb_ APIs to the above xbit_ names 
(with parameter changes)? 

Why would we need xbit_alloc, which looks like ida_get_new, I think set/clear 
should be adequate to the current usages.

Best,
Wei






Re: [Qemu-devel] [PATCH] scsi: replace hex constants with #defines

2017-12-17 Thread Philippe Mathieu-Daudé
On 12/17/2017 02:29 AM, Paolo Bonzini wrote:
> Sense keys have nice #defines in scsi/constants.h, use them.
> 
> Reported-by: Dr. David Alan Gilbert 
> Signed-off-by: Paolo Bonzini 

Reviewed-by: Philippe Mathieu-Daudé 

> ---
>  scsi/utils.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/scsi/utils.c b/scsi/utils.c
> index 61bc1a8e2b..ddae650a99 100644
> --- a/scsi/utils.c
> +++ b/scsi/utils.c
> @@ -339,16 +339,16 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len,
>  int scsi_sense_to_errno(int key, int asc, int ascq)
>  {
>  switch (key) {
> -case 0x00: /* NO SENSE */
> -case 0x01: /* RECOVERED ERROR */
> -case 0x06: /* UNIT ATTENTION */
> +case NO_SENSE:
> +case RECOVERED_ERROR:
> +case UNIT_ATTENTION:
>  /* These sense keys are not errors */
>  return 0;
> -case 0x0b: /* COMMAND ABORTED */
> +case ABORTED_COMMAND: /* COMMAND ABORTED */
>  return ECANCELED;
> -case 0x02: /* NOT READY */
> -case 0x05: /* ILLEGAL REQUEST */
> -case 0x07: /* DATA PROTECTION */
> +case NOT_READY:
> +case ILLEGAL_REQUEST:
> +case DATA_PROTECT:
>  /* Parse ASCQ */
>  break;
>  default:
> 



Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Tetsuo Handa
Wang, Wei W wrote:
> > Wei Wang wrote:
> > > > But passing GFP_NOWAIT means that we can handle allocation failure.
> > > > There is no need to use preload approach when we can handle allocation 
> > > > failure.
> > >
> > > I think the reason we need xb_preload is because radix tree insertion
> > > needs the memory being preallocated already (it couldn't suffer from
> > > memory failure during the process of inserting, probably because
> > > handling the failure there isn't easy, Matthew may know the backstory
> > > of
> > > this)
> > 
> > According to https://lwn.net/Articles/175432/ , I think that preloading is
> > needed only when failure to insert an item into a radix tree is a 
> > significant
> > problem.
> > That is, when failure to insert an item into a radix tree is not a problem, 
> > I
> > think that we don't need to use preloading.
> 
> It also mentions that the preload attempts to allocate sufficient memory to 
> *guarantee* that the next radix tree insertion cannot fail.
> 
> If we check radix_tree_node_alloc(), the comments there says "this assumes 
> that the caller has performed appropriate preallocation".

If you read what radix_tree_node_alloc() is doing, you will find that
radix_tree_node_alloc() returns NULL when memory allocation failed.

I think that "this assumes that the caller has performed appropriate 
preallocation"
means "The caller has to perform appropriate preallocation if the caller does 
not
want radix_tree_node_alloc() to return NULL".

> 
> So, I think we would get a risk of triggering some issue without preload().
> 
> > >
> > > So, I think we can handle the memory failure with xb_preload, which
> > > stops going into the radix tree APIs, but shouldn't call radix tree
> > > APIs without the related memory preallocated.
> > 
> > It seems to me that virtio-ballon case has no problem without using
> > preloading.
> 
> Why is that?
> 

Because you are saying in PATCH 4/7 that it is OK to fail xb_set_page()
due to -ENOMEM (apart from lack of ability to fallback to !use_sg path
when all xb_set_page() calls failed (i.e. no page will be handled because
there is no "1" bit in the xbitmap)).


+static inline int xb_set_page(struct virtio_balloon *vb,
+  struct page *page,
+  unsigned long *pfn_min,
+  unsigned long *pfn_max)
+{
+   unsigned long pfn = page_to_pfn(page);
+   int ret;
+
+   *pfn_min = min(pfn, *pfn_min);
+   *pfn_max = max(pfn, *pfn_max);
+
+   do {
+   ret = xb_preload_and_set_bit(&vb->page_xb, pfn,
+GFP_NOWAIT | __GFP_NOWARN);
+   } while (unlikely(ret == -EAGAIN));
+
+   return ret;
+}

@@ -173,8 +290,15 @@ static unsigned fill_balloon(struct virtio_balloon *vb, 
size_t num)
 
while ((page = balloon_page_pop(&pages))) {
balloon_page_enqueue(&vb->vb_dev_info, page);
+   if (use_sg) {
+   if (xb_set_page(vb, page, &pfn_min, &pfn_max) < 0) {
+   __free_page(page);
+   continue;
+   }
+   } else {
+   set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
+   }
 

@@ -223,7 +354,14 @@ static unsigned leak_balloon(struct virtio_balloon *vb, 
size_t num)
page = balloon_page_dequeue(vb_dev_info);
if (!page)
break;
-   set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
+   if (use_sg) {
+   if (xb_set_page(vb, page, &pfn_min, &pfn_max) < 0) {
+   balloon_page_enqueue(&vb->vb_dev_info, page);
+   break;
+   }
+   } else {
+   set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
+   }
list_add(&page->lru, &pages);
vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
}



Re: [Qemu-devel] [qemu-s390x] [PATCH] s390x: Add missing QEMU_NORETURN attribute (CID 1383842)

2017-12-17 Thread Thomas Huth
On 17.12.2017 11:58, Stefan Weil wrote:
> Am 17.12.2017 um 11:25 schrieb no-re...@patchew.org:
>> Hi,
>>
>> This series failed build test on s390x host. Please find the details below.
> [...]
>> /var/tmp/patchew-tester-tmp-e2qiwzsb/src/target/s390x/interrupt.c: In 
>> function ‘s390_program_interrupt’:
>> /var/tmp/patchew-tester-tmp-e2qiwzsb/src/target/s390x/interrupt.c:55:1: 
>> error: ‘noreturn’ function does return [-Werror]
> 
> Obviously the s390x compiler does more checks than my x86 gcc.
> 
> To fix the new warning, QEMU_NORETURN would have to be added to
> kvm_s390_program_interrupt and tcg_s390_program_interrupt, too.
> 
> I am not sure about kvm_s390_program_interrupt. Is it a function which
> will never return? Then the current code (which includes a return
> statement in kvm_s390_vcpu_interrupt) is not correct.

kvm_s390_program_interrupt() returns, so adding a QEMU_NORETURN to that
function is not a good idea.

> We could also move the g_assert_not_reached in s390_program_interrupt to
> the end of the function. That should satisfy the compiler as well.

That also does not work since kvm_s390_program_interrupt() returns.

> Or we could suppress the s390x compiler warning by using a compiler
> pragma. But I don't like that alternative.

I think the best solution would be to call tcg_s390_program_interrupt()
directly from helper_divs64() instead of going through the
s390_program_interrupt() wrapper. helper_divs64() is for TCG only, so it
should be fine to directly use the tcg_s390_program_interrupt() function
there.

 Thomas



Re: [Qemu-devel] [PATCH V2 1/5] pci/shpc: Move function to generic header file

2017-12-17 Thread Philippe Mathieu-Daudé
Hi Marcel, Yuval,

On 12/17/2017 09:54 AM, Marcel Apfelbaum wrote:
> From: Yuval Shaia 
> 
> This function should be declared in generic header file so we can
> utilize it.
> 
> Signed-off-by: Yuval Shaia 
> Signed-off-by: Marcel Apfelbaum 
> ---
>  hw/pci/shpc.c | 11 +--
>  include/qemu/cutils.h | 10 ++
>  2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
> index 69fc14b218..3d22424fd2 100644
> --- a/hw/pci/shpc.c
> +++ b/hw/pci/shpc.c
> @@ -1,6 +1,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
> +#include "qemu/cutils.h"
>  #include "qemu/range.h"
>  #include "qemu/error-report.h"
>  #include "hw/pci/shpc.h"
> @@ -122,16 +123,6 @@
>  #define SHPC_PCI_TO_IDX(pci_slot) ((pci_slot) - 1)
>  #define SHPC_IDX_TO_PHYSICAL(slot) ((slot) + 1)
>  
> -static int roundup_pow_of_two(int x)
> -{
> -x |= (x >> 1);
> -x |= (x >> 2);
> -x |= (x >> 4);
> -x |= (x >> 8);
> -x |= (x >> 16);
> -return x + 1;
> -}
> -
>  static uint16_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk)
>  {
>  uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot);
> diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
> index f0878eaafa..4895334645 100644
> --- a/include/qemu/cutils.h
> +++ b/include/qemu/cutils.h

I'd rather move this function below pow2ceil() in "qemu/host-utils.h"
and rename it pow2roundup().

> @@ -164,4 +164,14 @@ bool test_buffer_is_zero_next_accel(void);
>  int uleb128_encode_small(uint8_t *out, uint32_t n);
>  int uleb128_decode_small(const uint8_t *in, uint32_t *n);
>  
> +static inline int roundup_pow_of_two(w x)
> +{
> +x |= (x >> 1);
> +x |= (x >> 2);
> +x |= (x >> 4);
> +x |= (x >> 8);
> +x |= (x >> 16);

So this would be pow2roundup32(uint32_t value)...

Naming it pow2roundup() without specifying the integer size, I'd
directly use a uint64_t argument, and:

   x |= (x >> 32);

> +return x + 1;
> +}
> +
>  #endif

Naming it pow2roundup() in "qemu/host-utils.h" (regardless the arg size):
Reviewed-by: Philippe Mathieu-Daudé 

Regards,

Phil.



Re: [Qemu-devel] [PATCH V2 1/5] pci/shpc: Move function to generic header file

2017-12-17 Thread Yuval Shaia
On Sun, Dec 17, 2017 at 03:16:15PM -0300, Philippe Mathieu-Daudé wrote:
> Hi Marcel, Yuval,
> 
> On 12/17/2017 09:54 AM, Marcel Apfelbaum wrote:
> > From: Yuval Shaia 
> > 
> > This function should be declared in generic header file so we can
> > utilize it.
> > 
> > Signed-off-by: Yuval Shaia 
> > Signed-off-by: Marcel Apfelbaum 
> > ---
> >  hw/pci/shpc.c | 11 +--
> >  include/qemu/cutils.h | 10 ++
> >  2 files changed, 11 insertions(+), 10 deletions(-)
> > 
> > diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
> > index 69fc14b218..3d22424fd2 100644
> > --- a/hw/pci/shpc.c
> > +++ b/hw/pci/shpc.c
> > @@ -1,6 +1,7 @@
> >  #include "qemu/osdep.h"
> >  #include "qapi/error.h"
> >  #include "qemu-common.h"
> > +#include "qemu/cutils.h"
> >  #include "qemu/range.h"
> >  #include "qemu/error-report.h"
> >  #include "hw/pci/shpc.h"
> > @@ -122,16 +123,6 @@
> >  #define SHPC_PCI_TO_IDX(pci_slot) ((pci_slot) - 1)
> >  #define SHPC_IDX_TO_PHYSICAL(slot) ((slot) + 1)
> >  
> > -static int roundup_pow_of_two(int x)
> > -{
> > -x |= (x >> 1);
> > -x |= (x >> 2);
> > -x |= (x >> 4);
> > -x |= (x >> 8);
> > -x |= (x >> 16);
> > -return x + 1;
> > -}
> > -
> >  static uint16_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk)
> >  {
> >  uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot);
> > diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
> > index f0878eaafa..4895334645 100644
> > --- a/include/qemu/cutils.h
> > +++ b/include/qemu/cutils.h
> 
> I'd rather move this function below pow2ceil() in "qemu/host-utils.h"
> and rename it pow2roundup().
> 
> > @@ -164,4 +164,14 @@ bool test_buffer_is_zero_next_accel(void);
> >  int uleb128_encode_small(uint8_t *out, uint32_t n);
> >  int uleb128_decode_small(const uint8_t *in, uint32_t *n);
> >  
> > +static inline int roundup_pow_of_two(w x)
> > +{
> > +x |= (x >> 1);
> > +x |= (x >> 2);
> > +x |= (x >> 4);
> > +x |= (x >> 8);
> > +x |= (x >> 16);
> 
> So this would be pow2roundup32(uint32_t value)...
> 
> Naming it pow2roundup() without specifying the integer size, I'd
> directly use a uint64_t argument, and:
> 
>x |= (x >> 32);

Make sense, will do.

> 
> > +return x + 1;
> > +}
> > +
> >  #endif
> 
> Naming it pow2roundup() in "qemu/host-utils.h" (regardless the arg size):
> Reviewed-by: Philippe Mathieu-Daudé 

Thanks.

> 
> Regards,
> 
> Phil.



[Qemu-devel] [RFC v6 1/2] virtio: introduce `query-virtio' QMP command

2017-12-17 Thread Jan Dakinevich
The command is intended for gathering virtio information such as status,
feature bits, negotiation status. It is convenient and useful for debug
purpose.

The commands returns generic virtio information for virtio such as
common feature names and status bits names and information for all
attached to current machine devices.

To retrieve names of device-specific features `tell_feature_name'
callback in VirtioDeviceClass also was introduced.

Cc: Denis V. Lunev 
Signed-off-by: Jan Dakinevich 
---
 hw/block/virtio-blk.c   |  20 +++
 hw/char/virtio-serial-bus.c |  14 +
 hw/display/virtio-gpu.c |  12 
 hw/net/virtio-net.c |  34 +++
 hw/scsi/virtio-scsi.c   |  15 +
 hw/virtio/Makefile.objs |   3 +
 hw/virtio/virtio-balloon.c  |  14 +
 hw/virtio/virtio-qmp.c  | 134 
 hw/virtio/virtio-stub.c |   9 +++
 hw/virtio/virtio.c  |  41 ++
 include/hw/virtio/virtio.h  |   6 ++
 qapi-schema.json|  70 +++
 12 files changed, 372 insertions(+)
 create mode 100644 hw/virtio/virtio-qmp.c
 create mode 100644 hw/virtio/virtio-stub.c

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 05d1440..2ffd949 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1017,6 +1017,25 @@ static Property virtio_blk_properties[] = {
 DEFINE_PROP_END_OF_LIST(),
 };
 
+static const char *virtio_blk_tell_feature_name(VirtIODevice *vdev,
+unsigned fbit)
+{
+#define FBIT(fbit) case fbit: return #fbit
+switch (fbit) {
+FBIT(VIRTIO_BLK_F_BARRIER);
+FBIT(VIRTIO_BLK_F_SIZE_MAX);
+FBIT(VIRTIO_BLK_F_SEG_MAX);
+FBIT(VIRTIO_BLK_F_RO);
+FBIT(VIRTIO_BLK_F_BLK_SIZE);
+FBIT(VIRTIO_BLK_F_SCSI);
+FBIT(VIRTIO_BLK_F_TOPOLOGY);
+FBIT(VIRTIO_BLK_F_FLUSH);
+FBIT(VIRTIO_BLK_F_MQ);
+}
+#undef FBIT
+return NULL;
+}
+
 static void virtio_blk_class_init(ObjectClass *klass, void *data)
 {
 DeviceClass *dc = DEVICE_CLASS(klass);
@@ -1030,6 +1049,7 @@ static void virtio_blk_class_init(ObjectClass *klass, 
void *data)
 vdc->get_config = virtio_blk_update_config;
 vdc->set_config = virtio_blk_set_config;
 vdc->get_features = virtio_blk_get_features;
+vdc->tell_feature_name = virtio_blk_tell_feature_name;
 vdc->set_status = virtio_blk_set_status;
 vdc->reset = virtio_blk_reset;
 vdc->save = virtio_blk_save_device;
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 9470bd7..1d4678b 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -1156,6 +1156,19 @@ static Property virtio_serial_properties[] = {
 DEFINE_PROP_END_OF_LIST(),
 };
 
+static const char *virtio_serial_tell_feature_name(VirtIODevice *vdev,
+   unsigned fbit)
+{
+#define FBIT(fbit) case fbit: return #fbit
+switch (fbit) {
+FBIT(VIRTIO_CONSOLE_F_SIZE);
+FBIT(VIRTIO_CONSOLE_F_MULTIPORT);
+FBIT(VIRTIO_CONSOLE_F_EMERG_WRITE);
+};
+#undef FBIT
+return NULL;
+}
+
 static void virtio_serial_class_init(ObjectClass *klass, void *data)
 {
 DeviceClass *dc = DEVICE_CLASS(klass);
@@ -1170,6 +1183,7 @@ static void virtio_serial_class_init(ObjectClass *klass, 
void *data)
 vdc->realize = virtio_serial_device_realize;
 vdc->unrealize = virtio_serial_device_unrealize;
 vdc->get_features = get_features;
+vdc->tell_feature_name = virtio_serial_tell_feature_name;
 vdc->get_config = get_config;
 vdc->set_config = set_config;
 vdc->set_status = set_status;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 274e365..1906b68 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1317,6 +1317,17 @@ static Property virtio_gpu_properties[] = {
 DEFINE_PROP_END_OF_LIST(),
 };
 
+static const char *virtio_gpu_tell_feature_name(VirtIODevice *vdev,
+unsigned fbit)
+{
+#define FBIT(fbit) case fbit: return #fbit
+switch (fbit) {
+FBIT(VIRTIO_GPU_F_VIRGL);
+};
+#undef FBIT
+return NULL;
+}
+
 static void virtio_gpu_class_init(ObjectClass *klass, void *data)
 {
 DeviceClass *dc = DEVICE_CLASS(klass);
@@ -1327,6 +1338,7 @@ static void virtio_gpu_class_init(ObjectClass *klass, 
void *data)
 vdc->get_config = virtio_gpu_get_config;
 vdc->set_config = virtio_gpu_set_config;
 vdc->get_features = virtio_gpu_get_features;
+vdc->tell_feature_name = virtio_gpu_tell_feature_name;
 vdc->set_features = virtio_gpu_set_features;
 
 vdc->reset = virtio_gpu_reset;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 38674b0..0fbd055 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2163,6 +2163,39 @@ static Property virtio_net_properties[] = {
 DEFINE_PROP_END_OF_LIST(),
 };
 
+static const char *virtio_net_tell_feature_name(VirtIODevice *vdev,
+   

[Qemu-devel] [RFC v6 2/2] virtio: add `info virtio' HMP command

2017-12-17 Thread Jan Dakinevich
The command prints data from `query-virtio' QMP in human-readable
format.

Cc: Denis V. Lunev 
Signed-off-by: Jan Dakinevich 
---
 hmp-commands-info.hx | 14 ++
 hmp.c| 74 
 hmp.h|  1 +
 3 files changed, 89 insertions(+)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 54c3e5e..292280a 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -868,6 +868,20 @@ enabled) memory in bytes.
 ETEXI
 
 STEXI
+@item info virtio
+@findex virtio
+Display guest and host fetures for all virtio devices.
+ETEXI
+
+{
+.name   = "virtio",
+.args_type  = "path:s?",
+.params = "[path]",
+.help   = "show virtio info",
+.cmd= hmp_info_virtio,
+},
+
+STEXI
 @end table
 ETEXI
 
diff --git a/hmp.c b/hmp.c
index 35a7041..786782b 100644
--- a/hmp.c
+++ b/hmp.c
@@ -43,6 +43,7 @@
 #include "hw/intc/intc.h"
 #include "migration/snapshot.h"
 #include "migration/misc.h"
+#include "hw/virtio/virtio.h"
 
 #ifdef CONFIG_SPICE
 #include 
@@ -2918,3 +2919,76 @@ void hmp_info_memory_size_summary(Monitor *mon, const 
QDict *qdict)
 }
 hmp_handle_error(mon, &err);
 }
+
+#define HMP_INFO_VIRTIO_INDENT 2
+#define HMP_INFO_VIRTIO_FEATURE 40
+
+static void hmp_info_virtio_print(Monitor *mon, VirtioInfo *info)
+{
+Object *obj = object_resolve_path(info->qom_path, NULL);
+char *path = qdev_get_dev_path(DEVICE(obj));
+VirtioFeatureList *feat;
+strList *status;
+
+monitor_printf(mon, "%s at %s\n", object_get_typename(obj), path);
+g_free(path);
+
+monitor_printf(mon, "%*sQOM path: %s\n",
+   HMP_INFO_VIRTIO_INDENT, "", info->qom_path);
+
+/* device status */
+monitor_printf(mon, "%*sstatus: 0x%02"PRIx8"\n",
+   HMP_INFO_VIRTIO_INDENT, "", info->status);
+for (status = info->status_names; status; status = status->next) {
+monitor_printf(mon, "%*s%s\n",
+   HMP_INFO_VIRTIO_INDENT * 2, "", status->value);
+}
+
+
+/* host and guest feature */
+monitor_printf(mon, "%*shost features:  0x%016"PRIx64"\n",
+   HMP_INFO_VIRTIO_INDENT, "", info->host_features);
+monitor_printf(mon, "%*sguest features: 0x%016"PRIx64"\n",
+   HMP_INFO_VIRTIO_INDENT, "", info->guest_features);
+
+/* common features */
+monitor_printf(mon, "%*scommon features:%s\n",
+   HMP_INFO_VIRTIO_INDENT, "",
+   info->common_features_names ? "" : " (none)");
+for (feat = info->common_features_names; feat; feat = feat->next) {
+monitor_printf(mon, "%*s%-*s%s\n",
+   HMP_INFO_VIRTIO_INDENT * 2, "",
+   HMP_INFO_VIRTIO_FEATURE, feat->value->name,
+   feat->value->acked ? " acked" : "");
+}
+
+/* device features */
+monitor_printf(mon, "%*sdevice features:%s\n",
+   HMP_INFO_VIRTIO_INDENT, "",
+   info->device_features_names ? "" : " (none)");
+for (feat = info->device_features_names; feat; feat = feat->next) {
+monitor_printf(mon, "%*s%-*s%s\n",
+   HMP_INFO_VIRTIO_INDENT * 2, "",
+   HMP_INFO_VIRTIO_FEATURE, feat->value->name,
+   feat->value->acked ? " acked" : "");
+}
+}
+
+void hmp_info_virtio(Monitor *mon, const QDict *qdict)
+{
+const char *path = qdict_get_try_str(qdict, "path");
+Error *err = NULL;
+VirtioInfoList *head, *info;
+
+
+head = qmp_query_virtio(!!path, path, &err);
+if (err) {
+return;
+}
+
+for (info = head; info; info = info->next) {
+hmp_info_virtio_print(mon, info->value);
+}
+
+qapi_free_VirtioInfoList(head);
+}
diff --git a/hmp.h b/hmp.h
index a6f56b1..156293e 100644
--- a/hmp.h
+++ b/hmp.h
@@ -147,5 +147,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
 void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
 void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
+void hmp_info_virtio(Monitor *mon, const QDict *qdict);
 
 #endif
-- 
2.1.4




[Qemu-devel] [RFC v6 0/2] virtio: introduce `info virtio' hmp command

2017-12-17 Thread Jan Dakinevich
From: Jan Dakinevich 

After some discussion, I am going to suggest reworked QMP/HMP for
gathering virtio info. It would provide the following monitor output.

(qemu) info virtio
virtio-blk-device at :00:02.0
  QOM path: /machine/peripheral-anon/device[0]/virtio-backend
  status: 0x0f
VIRTIO_CONFIG_S_ACKNOWLEDGE
VIRTIO_CONFIG_S_DRIVER
VIRTIO_CONFIG_S_DRIVER_OK
VIRTIO_CONFIG_S_FEATURES_OK
  host features:  0x000179000e54
  guest features: 0x00013e54
  common features:
VIRTIO_F_NOTIFY_ON_EMPTY
VIRTIO_F_ANY_LAYOUT
VIRTIO_RING_F_INDIRECT_DESC  acked
VIRTIO_RING_F_EVENT_IDX  acked
VIRTIO_F_BAD_FEATURE
VIRTIO_F_VERSION_1   acked
  device features:
VIRTIO_BLK_F_SEG_MAX acked
VIRTIO_BLK_F_BLK_SIZEacked
VIRTIO_BLK_F_FLUSH   acked
VIRTIO_BLK_F_TOPOLOGYacked

v5: http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg05667.html
v4: http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg00393.html
v3: http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07565.html
v2: http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07527.html
v1: http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07247.html

Jan Dakinevich (2):
  virtio: introduce `query-virtio' QMP command
  virtio: add `info virtio' HMP command

 hmp-commands-info.hx|  14 +
 hmp.c   |  74 
 hmp.h   |   1 +
 hw/block/virtio-blk.c   |  20 +++
 hw/char/virtio-serial-bus.c |  14 +
 hw/display/virtio-gpu.c |  12 
 hw/net/virtio-net.c |  34 +++
 hw/scsi/virtio-scsi.c   |  15 +
 hw/virtio/Makefile.objs |   3 +
 hw/virtio/virtio-balloon.c  |  14 +
 hw/virtio/virtio-qmp.c  | 134 
 hw/virtio/virtio-stub.c |   9 +++
 hw/virtio/virtio.c  |  41 ++
 include/hw/virtio/virtio.h  |   6 ++
 qapi-schema.json|  70 +++
 15 files changed, 461 insertions(+)
 create mode 100644 hw/virtio/virtio-qmp.c
 create mode 100644 hw/virtio/virtio-stub.c

--
2.1.4




[Qemu-devel] [PATCH 0/4] QOM'ify PCIDevices

2017-12-17 Thread Philippe Mathieu-Daudé
Hi,

In this series we QOM'ify the last few PCI devices still using
PCIDeviceClass->init() by converting this init() to realize(),

Then we finally remove the then PCIDeviceClass->init() method for good.

Regards,

Phil.

Philippe Mathieu-Daudé (4):
  hw/block/nvme: QOM'ify PCI NVME
  hw/pci-host/piix: QOM'ify the IGD Passthrough host bridge
  hw/pci-host/xilinx: QOM'ify the AXI-PCIe host bridge
  hw/pci: remove obsolete PCIDevice->init()

 include/hw/pci/pci.h  |  1 -
 hw/block/nvme.c   | 32 +---
 hw/pci-host/piix.c| 31 +++
 hw/pci-host/xilinx-pcie.c | 19 +--
 hw/pci/pci.c  | 14 --
 5 files changed, 41 insertions(+), 56 deletions(-)

-- 
2.15.1




[Qemu-devel] [PATCH 1/4] hw/block/nvme: QOM'ify PCI NVME

2017-12-17 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/block/nvme.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 441e21ed1f..9c5f898da0 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -920,9 +920,9 @@ static const MemoryRegionOps nvme_cmb_ops = {
 },
 };
 
-static int nvme_init(PCIDevice *pci_dev)
+static void nvme_realize(PCIDevice *pci, Error **errp)
 {
-NvmeCtrl *n = NVME(pci_dev);
+NvmeCtrl *n = NVME(pci);
 NvmeIdCtrl *id = &n->id_ctrl;
 
 int i;
@@ -931,30 +931,33 @@ static int nvme_init(PCIDevice *pci_dev)
 Error *local_err = NULL;
 
 if (!n->conf.blk) {
-return -1;
+error_setg(errp, "Block device missing");
+return;
 }
 
 bs_size = blk_getlength(n->conf.blk);
 if (bs_size < 0) {
-return -1;
+error_setg_errno(errp, -bs_size, "Could not get length of device");
+return;
 }
 
 blkconf_serial(&n->conf, &n->serial);
 if (!n->serial) {
-return -1;
+error_setg(errp, "Could not get device serial number");
+return;
 }
 blkconf_blocksizes(&n->conf);
 blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk),
   false, &local_err);
 if (local_err) {
-error_report_err(local_err);
-return -1;
+error_propagate(errp, local_err);
+return;
 }
 
-pci_conf = pci_dev->config;
+pci_conf = pci->config;
 pci_conf[PCI_INTERRUPT_PIN] = 1;
-pci_config_set_prog_interface(pci_dev->config, 0x2);
-pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS);
+pci_config_set_prog_interface(pci->config, 0x2);
+pci_config_set_class(pci->config, PCI_CLASS_STORAGE_EXPRESS);
 pcie_endpoint_cap_init(&n->parent_obj, 0x80);
 
 n->num_namespaces = 1;
@@ -1046,12 +1049,11 @@ static int nvme_init(PCIDevice *pci_dev)
 cpu_to_le64(n->ns_size >>
 id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds);
 }
-return 0;
 }
 
-static void nvme_exit(PCIDevice *pci_dev)
+static void nvme_exit(PCIDevice *pci)
 {
-NvmeCtrl *n = NVME(pci_dev);
+NvmeCtrl *n = NVME(pci);
 
 nvme_clear_ctrl(n);
 g_free(n->namespaces);
@@ -1061,7 +1063,7 @@ static void nvme_exit(PCIDevice *pci_dev)
 memory_region_unref(&n->ctrl_mem);
 }
 
-msix_uninit_exclusive_bar(pci_dev);
+msix_uninit_exclusive_bar(pci);
 }
 
 static Property nvme_props[] = {
@@ -1081,7 +1083,7 @@ static void nvme_class_init(ObjectClass *oc, void *data)
 DeviceClass *dc = DEVICE_CLASS(oc);
 PCIDeviceClass *pc = PCI_DEVICE_CLASS(oc);
 
-pc->init = nvme_init;
+pc->realize = nvme_realize;
 pc->exit = nvme_exit;
 pc->class_id = PCI_CLASS_STORAGE_EXPRESS;
 pc->vendor_id = PCI_VENDOR_ID_INTEL;
-- 
2.15.1




[Qemu-devel] [PATCH 4/4] hw/pci: remove obsolete PCIDevice->init()

2017-12-17 Thread Philippe Mathieu-Daudé
All PCI devices are now QOM'ified.

Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/pci/pci.h |  1 -
 hw/pci/pci.c | 14 --
 2 files changed, 15 deletions(-)

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 8d02a0a383..0f1ed64c2f 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -217,7 +217,6 @@ typedef struct PCIDeviceClass {
 DeviceClass parent_class;
 
 void (*realize)(PCIDevice *dev, Error **errp);
-int (*init)(PCIDevice *dev);/* TODO convert to realize() and remove */
 PCIUnregisterFunc *exit;
 PCIConfigReadFunc *config_read;
 PCIConfigWriteFunc *config_write;
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index b2d139bd9a..cd25ab6f6b 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2054,18 +2054,6 @@ static void pci_qdev_realize(DeviceState *qdev, Error 
**errp)
 }
 }
 
-static void pci_default_realize(PCIDevice *dev, Error **errp)
-{
-PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
-
-if (pc->init) {
-if (pc->init(dev) < 0) {
-error_setg(errp, "Device initialization failed");
-return;
-}
-}
-}
-
 PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
 const char *name)
 {
@@ -2538,13 +2526,11 @@ MemoryRegion *pci_address_space_io(PCIDevice *dev)
 static void pci_device_class_init(ObjectClass *klass, void *data)
 {
 DeviceClass *k = DEVICE_CLASS(klass);
-PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass);
 
 k->realize = pci_qdev_realize;
 k->unrealize = pci_qdev_unrealize;
 k->bus_type = TYPE_PCI_BUS;
 k->props = pci_props;
-pc->realize = pci_default_realize;
 }
 
 static void pci_device_class_base_init(ObjectClass *klass, void *data)
-- 
2.15.1




[Qemu-devel] [PATCH 2/4] hw/pci-host/piix: QOM'ify the IGD Passthrough host bridge

2017-12-17 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/pci-host/piix.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index a684a7cca9..0153f32a32 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -804,7 +804,7 @@ static const IGDHostInfo igd_host_bridge_infos[] = {
 {0xa8, 4},  /* SNB: base of GTT stolen memory */
 };
 
-static int host_pci_config_read(int pos, int len, uint32_t *val)
+static void host_pci_config_read(int pos, int len, uint32_t *val, Error **errp)
 {
 char path[PATH_MAX];
 int config_fd;
@@ -812,19 +812,19 @@ static int host_pci_config_read(int pos, int len, 
uint32_t *val)
 /* Access real host bridge. */
 int rc = snprintf(path, size, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s",
   0, 0, 0, 0, "config");
-int ret = 0;
 
 if (rc >= size || rc < 0) {
-return -ENODEV;
+error_setg(&error_abort, "Invalid PCI device");
 }
 
 config_fd = open(path, O_RDWR);
 if (config_fd < 0) {
-return -ENODEV;
+error_setg_errno(errp, errno, "Failed to open: %s", path);
+return;
 }
 
 if (lseek(config_fd, pos, SEEK_SET) != pos) {
-ret = -errno;
+error_setg_errno(errp, errno, "Failed to seek: %s", path);
 goto out;
 }
 
@@ -832,32 +832,31 @@ static int host_pci_config_read(int pos, int len, 
uint32_t *val)
 rc = read(config_fd, (uint8_t *)val, len);
 } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
 if (rc != len) {
-ret = -errno;
+error_setg_errno(errp, errno, "Failed to read: %s", path);
 }
 
 out:
 close(config_fd);
-return ret;
 }
 
-static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev)
+static void igd_pt_i440fx_realize(PCIDevice *pci, Error **errp)
 {
 uint32_t val = 0;
-int rc, i, num;
+int i, num;
 int pos, len;
+Error *local_err = NULL;
 
 num = ARRAY_SIZE(igd_host_bridge_infos);
 for (i = 0; i < num; i++) {
 pos = igd_host_bridge_infos[i].offset;
 len = igd_host_bridge_infos[i].len;
-rc = host_pci_config_read(pos, len, &val);
-if (rc) {
-return -ENODEV;
+host_pci_config_read(pos, len, &val, &local_err);
+if (local_err) {
+error_propagate(errp, local_err);
+return;
 }
-pci_default_write_config(pci_dev, pos, val, len);
+pci_default_write_config(pci, pos, val, len);
 }
-
-return 0;
 }
 
 static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
@@ -865,7 +864,7 @@ static void igd_passthrough_i440fx_class_init(ObjectClass 
*klass, void *data)
 DeviceClass *dc = DEVICE_CLASS(klass);
 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-k->init = igd_pt_i440fx_initfn;
+k->realize = igd_pt_i440fx_realize;
 dc->desc = "IGD Passthrough Host bridge";
 }
 
-- 
2.15.1




[Qemu-devel] [PATCH 3/4] hw/pci-host/xilinx: QOM'ify the AXI-PCIe host bridge

2017-12-17 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/pci-host/xilinx-pcie.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c
index 7659253090..756db39fd5 100644
--- a/hw/pci-host/xilinx-pcie.c
+++ b/hw/pci-host/xilinx-pcie.c
@@ -267,24 +267,23 @@ static void xilinx_pcie_root_config_write(PCIDevice *d, 
uint32_t address,
 }
 }
 
-static int xilinx_pcie_root_init(PCIDevice *dev)
+static void xilinx_pcie_root_realize(PCIDevice *pci, Error **errp)
 {
-BusState *bus = qdev_get_parent_bus(DEVICE(dev));
+DeviceState *dev = DEVICE(pci);
+BusState *bus = qdev_get_parent_bus(dev);
 XilinxPCIEHost *s = XILINX_PCIE_HOST(bus->parent);
 
-pci_set_word(dev->config + PCI_COMMAND,
+pci_set_word(pci->config + PCI_COMMAND,
  PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
-pci_set_word(dev->config + PCI_MEMORY_BASE, s->mmio_base >> 16);
-pci_set_word(dev->config + PCI_MEMORY_LIMIT,
+pci_set_word(pci->config + PCI_MEMORY_BASE, s->mmio_base >> 16);
+pci_set_word(pci->config + PCI_MEMORY_LIMIT,
  ((s->mmio_base + s->mmio_size - 1) >> 16) & 0xfff0);
 
-pci_bridge_initfn(dev, TYPE_PCI_BUS);
+pci_bridge_initfn(pci, TYPE_PCI_BUS);
 
-if (pcie_endpoint_cap_v1_init(dev, 0x80) < 0) {
+if (pcie_endpoint_cap_v1_init(pci, 0x80) < 0) {
 hw_error("Failed to initialize PCIe capability");
 }
-
-return 0;
 }
 
 static void xilinx_pcie_root_class_init(ObjectClass *klass, void *data)
@@ -300,7 +299,7 @@ static void xilinx_pcie_root_class_init(ObjectClass *klass, 
void *data)
 k->class_id = PCI_CLASS_BRIDGE_HOST;
 k->is_express = true;
 k->is_bridge = true;
-k->init = xilinx_pcie_root_init;
+k->realize = xilinx_pcie_root_realize;
 k->exit = pci_bridge_exitfn;
 dc->reset = pci_bridge_reset;
 k->config_read = xilinx_pcie_root_config_read;
-- 
2.15.1




[Qemu-devel] [PULL 05/61] qht: fix kernel-doc markup in qht.h

2017-12-17 Thread Michael Tokarev
From: "Emilio G. Cota" 

While at it, s/stuct/struct/.

Signed-off-by: Emilio G. Cota 
Signed-off-by: Michael Tokarev 
---
 include/qemu/qht.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/qemu/qht.h b/include/qemu/qht.h
index 56c2c7784c..531aa95325 100644
--- a/include/qemu/qht.h
+++ b/include/qemu/qht.h
@@ -166,7 +166,7 @@ void qht_iter(struct qht *ht, qht_iter_func_t func, void 
*userp);
 /**
  * qht_statistics_init - Gather statistics from a QHT
  * @ht: QHT to gather statistics from
- * @stats: pointer to a struct qht_stats to be filled in
+ * @stats: pointer to a &struct qht_stats to be filled in
  *
  * Does NOT need to be called under an RCU read-critical section,
  * since it does not dereference any pointers stored in the hash table.
@@ -177,8 +177,8 @@ void qht_iter(struct qht *ht, qht_iter_func_t func, void 
*userp);
 void qht_statistics_init(struct qht *ht, struct qht_stats *stats);
 
 /**
- * qht_statistics_destroy - Destroy a struct qht_stats
- * @stats: stuct qht_stats to be destroyed
+ * qht_statistics_destroy - Destroy a &struct qht_stats
+ * @stats: &struct qht_stats to be destroyed
  *
  * See also: qht_statistics_init().
  */
-- 
2.11.0




[Qemu-devel] [PULL 00/61] Trivial patches for 2017-12-18

2017-12-17 Thread Michael Tokarev
Here's a large pull request for trivial-patches queue.
It's been quite a whie since the last request, and many
changes has been accumulated.

Also there's a large patchset by Philippe Mathieu-Daudé
named "remove i386/pc dependency from non-PC world (part 1)"
consisting of 42 patches which makes good portion of this
pull request.

Please consider applying.

Thanks,

/mjt

The following changes since commit 38d1b31e0501f938db39c5b2e508328530410246:

  Merge remote-tracking branch 'remotes/berrange/tags/pull-qio-201712151' into 
staging (2017-12-15 17:05:26 +)

are available in the git repository at:

  git://git.corpit.ru/qemu.git tags/trivial-patches-fetch

for you to fetch changes up to 709d44f79b86d03a12fa69d7a6da6901765a2989:

  misc: drop old i386 dependency (2017-12-18 00:11:51 +0300)


trivial patches for 2017-12-18


Daniel Henrique Barboza (1):
  configure: check $CC available before verifying host CPU

Emilio G. Cota (3):
  disas/arm: fix 'instuction' typo in comment
  translate-all: fix 'consisits' typo in comment
  qht: fix kernel-doc markup in qht.h

Ladi Prosek (1):
  Remove empty statements

Marc-André Lureau (2):
  .gitignore: remove vscclient
  memory: remove unused memory_region_set_global_locking()

Michael McConville (1):
  mmap(2) returns MAP_FAILED, not NULL, on failure

Mike Frysinger (1):
  build: fix typo in error message

Peter Maydell (1):
  accel/tcg/cpu-exec-common.c: Remove unnecessary include of 
memory-internal.h

Philippe Mathieu-Daudé (49):
  hw/alpha/typhoon: simplify using the "unimplemented" sysbus device
  Makefile: use $(MAKE) variable
  Makefile: add more targets to the UNCHECKED_GOALS rule
  MAINTAINERS: add "hw/registerfields.h" in Register API entry
  hw/registerfields: fix a typo in the FIELD() documentation
  hw/registerfields: add 64-bit extract/deposit macros
  hw/registerfields: add missing include
  MAINTAINERS: add entries for i2c/ppc4xx
  MAINTAINERS: add an entry for the i82374 (southbridge)
  MAINTAINERS: add an entry for the i8257 (DMA controller)
  MAINTAINERS: add an entry for the i82378 (superio)
  MAINTAINERS: add an entry for watchdog/wdt_ib700
  MAINTAINERS: add an entry for input/pckbd.c
  MAINTAINERS: add entries for timer/m48t59
  MAINTAINERS: add missing entry for include/hw/net/
  hw: use "qemu/osdep.h" as first #include in source files
  hw: remove "qemu/osdep.h" from header files
  block: remove "qemu/osdep.h" from header file
  misc: remove headers implicitly included
  misc: remove duplicated includes
  ppc: remove duplicated includes
  i386/hax: remove duplicated includes
  i386/hax: remove duplicated include
  nios2: remove duplicated includes (in code commented out)
  misc: avoid "include/" in include path
  numa: remove unused #include
  hw/input/vmmouse: remove unused #include
  hw/misc/pvpanic: remove unused #include
  hw/ssi/aspeed_smc: remove unused #include
  amd_iommu: avoid needless includes in header file
  misc: remove old i386 dependency
  hw/ide: remove old i386 dependency
  hw/ipmi: remove old i386 dependency
  hw/i2c: remove old i386 dependency
  hw/tpm: remove old i386 dependency
  hw/virtio-balloon: remove old i386 dependency
  hw/unicore32: restrict hw addr defines to source file
  hw/timer/i8254: rename pit_init() -> i8254_pit_init()
  hw/timer/mc146818: rename rtc_init() -> mc146818_rtc_init()
  hw/acpi: ACPI_PM_* defines are not restricted to i386 arch
  hw/acpi/ich9: extract ACPI_PM_PROP_TCO_ENABLED from i386/pc
  hw/display/vga: "vga.h" only contains registers defs, rename it 
"vga_regs.h"
  hw/display/vga: "vga_int.h" requires "ui/console.h"
  hw/display/vga: extract public API from i386/pc to "hw/display/vga.h"
  hw/net/ne2000: extract ne2k-isa code from i386/pc to ne2000-isa.c
  hw/misc/pvpanic: extract public API from i386/pc to "hw/misc/pvpanic.h"
  i386/pc: move vmport.c to hw/i386/
  i386/pc: move vmmouse.c to hw/i386/
  misc: drop old i386 dependency

Tao Wu (1):
  hw/input/hid: Add support for several keys.

Vicente Jimenez Aguilar (1):
  Document pretty parameter for mon option

 .gitignore  |  1 -
 MAINTAINERS | 14 ++-
 Makefile| 11 +
 accel/tcg/cpu-exec-common.c |  1 -
 accel/tcg/translate-all.c   |  3 +--
 block/dmg.h |  1 -
 bsd-user/main.c |  1 -
 chardev/wctablet.c  |  4 
 configure   | 25 ++-
 disas/arm.c |  2 +-
 disas/nios2.c   |  3 ---
 exec.c  |  3

[Qemu-devel] [PULL 15/61] MAINTAINERS: add "hw/registerfields.h" in Register API entry

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Orphan since afb3141c660

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Darren Kenny 
Reviewed-by: Alistair Francis 
Reviewed-by: Edgar E. Iglesias 
Signed-off-by: Michael Tokarev 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 45e2e2009b..55e403833f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1538,6 +1538,7 @@ M: Alistair Francis 
 S: Maintained
 F: hw/core/register.c
 F: include/hw/register.h
+F: include/hw/registerfields.h
 
 SLIRP
 M: Samuel Thibault 
-- 
2.11.0




[Qemu-devel] [PULL 52/61] hw/acpi: ACPI_PM_* defines are not restricted to i386 arch

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

this allows to remove the old i386/pc dependency on acpi/core.

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Igor Mammedov 
---
 hw/acpi/core.c |  1 -
 include/hw/acpi/acpi.h | 11 +++
 include/hw/i386/pc.h   | 11 ---
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index cd0a1d357b..eb9b76f70b 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -21,7 +21,6 @@
 #include "qemu/osdep.h"
 #include "sysemu/sysemu.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/acpi/acpi.h"
 #include "hw/nvram/fw_cfg.h"
 #include "qemu/config-file.h"
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index 7b3d93cf0d..39ff512129 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -39,6 +39,17 @@
 #define ACPI_PM2_REGISTER_WIDTH 8
 #define ACPI_PM_TIMER_WIDTH 32
 
+/* PC-style peripherals (also used by other machines).  */
+#define ACPI_PM_PROP_S3_DISABLED "disable_s3"
+#define ACPI_PM_PROP_S4_DISABLED "disable_s4"
+#define ACPI_PM_PROP_S4_VAL "s4_val"
+#define ACPI_PM_PROP_SCI_INT "sci_int"
+#define ACPI_PM_PROP_ACPI_ENABLE_CMD "acpi_enable_cmd"
+#define ACPI_PM_PROP_ACPI_DISABLE_CMD "acpi_disable_cmd"
+#define ACPI_PM_PROP_PM_IO_BASE "pm_io_base"
+#define ACPI_PM_PROP_GPE0_BLK "gpe0_blk"
+#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len"
+
 /* PM Timer ticks per second (HZ) */
 #define PM_TIMER_FREQUENCY  3579545
 
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index ef438bd765..252526e600 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -151,17 +151,6 @@ struct PCMachineClass {
 #define PC_MACHINE_CLASS(klass) \
 OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
 
-/* PC-style peripherals (also used by other machines).  */
-
-#define ACPI_PM_PROP_S3_DISABLED "disable_s3"
-#define ACPI_PM_PROP_S4_DISABLED "disable_s4"
-#define ACPI_PM_PROP_S4_VAL "s4_val"
-#define ACPI_PM_PROP_SCI_INT "sci_int"
-#define ACPI_PM_PROP_ACPI_ENABLE_CMD "acpi_enable_cmd"
-#define ACPI_PM_PROP_ACPI_DISABLE_CMD "acpi_disable_cmd"
-#define ACPI_PM_PROP_PM_IO_BASE "pm_io_base"
-#define ACPI_PM_PROP_GPE0_BLK "gpe0_blk"
-#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len"
 #define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
 
 /* parallel.c */
-- 
2.11.0




[Qemu-devel] [PULL 55/61] hw/display/vga: "vga_int.h" requires "ui/console.h"

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

since The VGACommonState struct has a GraphicHwOps *hw_ops member,
then remove the now unnecessary includes.

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/display/cirrus_vga.c | 1 -
 hw/display/qxl.h| 1 -
 hw/display/vga-isa-mm.c | 1 -
 hw/display/vga-isa.c| 1 -
 hw/display/vga-pci.c| 1 -
 hw/display/vga.c| 1 -
 hw/display/vga_int.h| 3 ++-
 hw/display/virtio-vga.c | 1 -
 hw/display/vmware_vga.c | 1 -
 9 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index bc32bf1e39..138ae961b9 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -31,7 +31,6 @@
 #include "trace.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
-#include "ui/console.h"
 #include "ui/pixel_ops.h"
 #include "vga_int.h"
 #include "hw/loader.h"
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index f6556adb73..8668a8e05a 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -3,7 +3,6 @@
 
 #include "qemu-common.h"
 
-#include "ui/console.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
 #include "vga_int.h"
diff --git a/hw/display/vga-isa-mm.c b/hw/display/vga-isa-mm.c
index 51ccbccc41..68c4d6e23e 100644
--- a/hw/display/vga-isa-mm.c
+++ b/hw/display/vga-isa-mm.c
@@ -23,7 +23,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "ui/console.h"
 #include "hw/i386/pc.h"
 #include "vga_int.h"
 #include "ui/pixel_ops.h"
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
index 1af95562f2..26f69fd40a 100644
--- a/hw/display/vga-isa.c
+++ b/hw/display/vga-isa.c
@@ -25,7 +25,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "ui/console.h"
 #include "hw/i386/pc.h"
 #include "vga_int.h"
 #include "ui/pixel_ops.h"
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 7adb89fcb4..1674bd3581 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -25,7 +25,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "ui/console.h"
 #include "hw/pci/pci.h"
 #include "vga_int.h"
 #include "ui/pixel_ops.h"
diff --git a/hw/display/vga.c b/hw/display/vga.c
index ce95b40e5c..4163b532e0 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -24,7 +24,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "ui/console.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "vga_int.h"
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index ad34a1f048..fe23b81442 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -25,8 +25,9 @@
 #ifndef HW_VGA_INT_H
 #define HW_VGA_INT_H
 
-#include "hw/hw.h"
+#include "exec/ioport.h"
 #include "exec/memory.h"
+#include "ui/console.h"
 
 #define ST01_V_RETRACE  0x08
 #define ST01_DISP_ENABLE0x01
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index f9b017d86b..baa74ba82c 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -1,7 +1,6 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
-#include "ui/console.h"
 #include "vga_int.h"
 #include "hw/virtio/virtio-pci.h"
 #include "qapi/error.h"
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 0e6673a911..bd3e8b3586 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -26,7 +26,6 @@
 #include "hw/hw.h"
 #include "hw/loader.h"
 #include "trace.h"
-#include "ui/console.h"
 #include "ui/vnc.h"
 #include "hw/pci/pci.h"
 
-- 
2.11.0




[Qemu-devel] [PULL 01/61] Remove empty statements

2017-12-17 Thread Michael Tokarev
From: Ladi Prosek 

Thanks to Laszlo Ersek for spotting the double semicolon in target/i386/kvm.c

I have trivially grepped the tree for ';;' in C files.

Suggested-by: Laszlo Ersek 
Signed-off-by: Ladi Prosek 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Cornelia Huck 
Reviewed-by: Laurent Vivier 
Signed-off-by: Michael Tokarev 
---
 hw/misc/imx6_ccm.c | 2 +-
 hw/s390x/virtio-ccw.c  | 2 +-
 linux-user/signal.c| 2 +-
 migration/block.c  | 2 +-
 target/i386/cpu.c  | 2 +-
 target/i386/kvm.c  | 2 +-
 target/sh4/translate.c | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
index 1b421013a3..4fa94835fe 100644
--- a/hw/misc/imx6_ccm.c
+++ b/hw/misc/imx6_ccm.c
@@ -335,7 +335,7 @@ static uint64_t imx6_ccm_get_ipg_clk(IMX6CCMState *dev)
 uint64_t freq = 0;
 
 freq = imx6_ccm_get_ahb_clk(dev)
-   / (1 + EXTRACT(dev->ccm[CCM_CBCDR], IPG_PODF));;
+   / (1 + EXTRACT(dev->ccm[CCM_CBCDR], IPG_PODF));
 
 DPRINTF("freq = %d\n", (uint32_t)freq);
 
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 3dd902a664..38f6a8afc9 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -486,7 +486,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
 } else {
 address_space_stb(&address_space_memory, ccw.cda, vdev->status,
 MEMTXATTRS_UNSPECIFIED, NULL);
-sch->curr_status.scsw.count = ccw.count - sizeof(vdev->status);;
+sch->curr_status.scsw.count = ccw.count - sizeof(vdev->status);
 ret = 0;
 }
 break;
diff --git a/linux-user/signal.c b/linux-user/signal.c
index cf35473671..dae14d4a89 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -6530,7 +6530,7 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
 haddr = dest;
 }
 env->iaoq_f = haddr;
-env->iaoq_b = haddr + 4;;
+env->iaoq_b = haddr + 4;
 return;
 
  give_sigsegv:
diff --git a/migration/block.c b/migration/block.c
index 7147171bb7..e68e090c6f 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -897,7 +897,7 @@ static int block_load(QEMUFile *f, void *opaque, int 
version_id)
 int len, flags;
 char device_name[256];
 int64_t addr;
-BlockBackend *blk, *blk_prev = NULL;;
+BlockBackend *blk, *blk_prev = NULL;
 Error *local_err = NULL;
 uint8_t *buf;
 int64_t total_sectors = 0;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 045d66191f..82603e3130 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2220,7 +2220,7 @@ static void 
x86_cpu_class_check_missing_features(X86CPUClass *xcc,
 
 if (xcc->kvm_required && !kvm_enabled()) {
 strList *new = g_new0(strList, 1);
-new->value = g_strdup("kvm");;
+new->value = g_strdup("kvm");
 *missing_feats = new;
 return;
 }
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index b1e32e95d3..d4b2ce2e94 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1122,7 +1122,7 @@ static int kvm_get_supported_msrs(KVMState *s)
 break;
 case MSR_IA32_XSS:
 has_msr_xss = true;
-break;;
+break;
 case HV_X64_MSR_CRASH_CTL:
 has_msr_hv_crash = true;
 break;
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 703020fe87..8569179883 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -668,7 +668,7 @@ static void _decode_opc(DisasContext * ctx)
return;
 case 0x6008:   /* swap.b Rm,Rn */
{
-TCGv low = tcg_temp_new();;
+TCGv low = tcg_temp_new();
tcg_gen_ext16u_i32(low, REG(B7_4));
tcg_gen_bswap16_i32(low, low);
 tcg_gen_deposit_i32(REG(B11_8), REG(B7_4), low, 0, 16);
-- 
2.11.0




[Qemu-devel] [PULL 59/61] i386/pc: move vmport.c to hw/i386/

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

It's a x86-only device, so it does not make sense to keep it
in the shared misc folder.

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/i386/Makefile.objs  |  1 +
 hw/{misc => i386}/vmport.c | 17 +
 hw/misc/Makefile.objs  |  2 --
 3 files changed, 10 insertions(+), 10 deletions(-)
 rename hw/{misc => i386}/vmport.c (95%)

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 2e5e1299ad..1548ad1ad0 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -5,6 +5,7 @@ obj-y += pc_sysfw.o
 obj-y += x86-iommu.o intel_iommu.o
 obj-y += amd_iommu.o
 obj-$(CONFIG_XEN) += ../xenpv/ xen/
+obj-$(CONFIG_VMPORT) += vmport.o
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
diff --git a/hw/misc/vmport.c b/hw/i386/vmport.c
similarity index 95%
rename from hw/misc/vmport.c
rename to hw/i386/vmport.c
index 165500223f..eb880c6def 100644
--- a/hw/misc/vmport.c
+++ b/hw/i386/vmport.c
@@ -28,7 +28,7 @@
 #include "sysemu/hw_accel.h"
 #include "hw/qdev.h"
 
-//#define VMPORT_DEBUG
+/* #define VMPORT_DEBUG */
 
 #define VMPORT_CMD_GETVERSION 0x0a
 #define VMPORT_CMD_GETRAMSIZE 0x14
@@ -38,8 +38,7 @@
 
 #define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
 
-typedef struct VMPortState
-{
+typedef struct VMPortState {
 ISADevice parent_obj;
 
 MemoryRegion io;
@@ -51,8 +50,9 @@ static VMPortState *port_state;
 
 void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque)
 {
-if (command >= VMPORT_ENTRIES)
+if (command >= VMPORT_ENTRIES) {
 return;
+}
 
 port_state->func[command] = func;
 port_state->opaque[command] = opaque;
@@ -71,14 +71,15 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr 
addr,
 cpu_synchronize_state(cs);
 
 eax = env->regs[R_EAX];
-if (eax != VMPORT_MAGIC)
+if (eax != VMPORT_MAGIC) {
 return eax;
+}
 
 command = env->regs[R_ECX];
-if (command >= VMPORT_ENTRIES)
+if (command >= VMPORT_ENTRIES) {
 return eax;
-if (!s->func[command])
-{
+}
+if (!s->func[command]) {
 #ifdef VMPORT_DEBUG
 fprintf(stderr, "vmport: unknown command %x\n", command);
 #endif
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 10c88a84b4..d517f83e81 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -11,8 +11,6 @@ common-obj-$(CONFIG_EDU) += edu.o
 common-obj-y += unimp.o
 common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.o
 
-obj-$(CONFIG_VMPORT) += vmport.o
-
 # ARM devices
 common-obj-$(CONFIG_PL310) += arm_l2x0.o
 common-obj-$(CONFIG_INTEGRATOR_DEBUG) += arm_integrator_debug.o
-- 
2.11.0




[Qemu-devel] [PULL 39/61] hw/input/vmmouse: remove unused #include

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/input/vmmouse.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/input/vmmouse.c b/hw/input/vmmouse.c
index b6d22086f4..65ef55329e 100644
--- a/hw/input/vmmouse.c
+++ b/hw/input/vmmouse.c
@@ -24,7 +24,6 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "ui/console.h"
-#include "hw/input/ps2.h"
 #include "hw/i386/pc.h"
 #include "hw/qdev.h"
 
-- 
2.11.0




[Qemu-devel] [PULL 13/61] accel/tcg/cpu-exec-common.c: Remove unnecessary include of memory-internal.h

2017-12-17 Thread Michael Tokarev
From: Peter Maydell 

The cpu-exec-common.c file includes memory-internal.h, but it doesn't
actually use anything from that header. Remove the unnecessary include.

Signed-off-by: Peter Maydell 
Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Richard Henderson 
Signed-off-by: Michael Tokarev 
---
 accel/tcg/cpu-exec-common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c
index 5b4ae54a4d..dac5aac477 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -21,7 +21,6 @@
 #include "cpu.h"
 #include "sysemu/cpus.h"
 #include "exec/exec-all.h"
-#include "exec/memory-internal.h"
 
 bool tcg_allowed;
 
-- 
2.11.0




[Qemu-devel] [PULL 30/61] block: remove "qemu/osdep.h" from header file

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
---
 block/dmg.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/dmg.h b/block/dmg.h
index b592d6fa8b..2ecf239ba5 100644
--- a/block/dmg.h
+++ b/block/dmg.h
@@ -26,7 +26,6 @@
 #ifndef BLOCK_DMG_H
 #define BLOCK_DMG_H
 
-#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "block/block_int.h"
 #include 
-- 
2.11.0




[Qemu-devel] [PULL 02/61] hw/alpha/typhoon: simplify using the "unimplemented" sysbus device

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Richard Henderson 
Signed-off-by: Michael Tokarev 
---
 hw/alpha/alpha_sys.h |  1 -
 hw/alpha/pci.c   | 26 --
 hw/alpha/typhoon.c   |  6 ++
 3 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index b6d8369ed7..9e67f78c60 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -15,7 +15,6 @@ PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, 
AlphaCPU *[4],
  pci_map_irq_fn);
 
 /* alpha_pci.c.  */
-extern const MemoryRegionOps alpha_pci_ignore_ops;
 extern const MemoryRegionOps alpha_pci_conf1_ops;
 extern const MemoryRegionOps alpha_pci_iack_ops;
 
diff --git a/hw/alpha/pci.c b/hw/alpha/pci.c
index 8dde637bfe..e0bcde9f70 100644
--- a/hw/alpha/pci.c
+++ b/hw/alpha/pci.c
@@ -14,32 +14,6 @@
 #include "trace.h"
 
 
-/* Fallback for unassigned PCI I/O operations.  Avoids MCHK.  */
-
-static uint64_t ignore_read(void *opaque, hwaddr addr, unsigned size)
-{
-return 0;
-}
-
-static void ignore_write(void *opaque, hwaddr addr, uint64_t v, unsigned size)
-{
-}
-
-const MemoryRegionOps alpha_pci_ignore_ops = {
-.read = ignore_read,
-.write = ignore_write,
-.endianness = DEVICE_LITTLE_ENDIAN,
-.valid = {
-.min_access_size = 1,
-.max_access_size = 8,
-},
-.impl = {
-.min_access_size = 1,
-.max_access_size = 8,
-},
-};
-
-
 /* PCI config space reads/writes, to byte-word addressable memory.  */
 static uint64_t bw_conf1_read(void *opaque, hwaddr addr,
   unsigned size)
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index ae11e012c7..d8e2cac3f3 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -11,6 +11,7 @@
 #include "cpu.h"
 #include "hw/hw.h"
 #include "hw/devices.h"
+#include "hw/misc/unimp.h"
 #include "sysemu/sysemu.h"
 #include "alpha_sys.h"
 #include "exec/address-spaces.h"
@@ -876,10 +877,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
 &s->pchip.reg_mem);
 
 /* Pchip0 PCI I/O, 0x801.FC00., 32MB.  */
-memory_region_init_io(&s->pchip.reg_io, OBJECT(s), &alpha_pci_ignore_ops,
-  NULL, "pci0-io", 32*MB);
-memory_region_add_subregion(addr_space, 0x801fc00ULL,
-&s->pchip.reg_io);
+create_unimplemented_device("pci0-io", 0x801fc00ULL, 32 * MB);
 
 b = pci_register_bus(dev, "pci",
  typhoon_set_irq, sys_map_irq, s,
-- 
2.11.0




Re: [Qemu-devel] [PULL v1 00/32] Merge tpm 2017/12/15

2017-12-17 Thread Peter Maydell
On 16 December 2017 at 17:41, Stefan Berger  wrote:
> The following patch series refactors the TPM TIS and backend drivers for
> easier addition of new front-end devices. Further, the TPM buffer sizes
> are read from the backend and the backend's buffer size can be adjusted
> by the frontend, if necessary.
>
>
> The following changes since commit 0ef0583d5adceb9138bdb47494dabd1549ac5b6d:
>
>   Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20171214' into 
> staging (2017-12-14 15:32:32 +)
>
> are available in the git repository at:
>
>   git://github.com/stefanberger/qemu-tpm.git tags/pull-tpm-2017-12-15-1
>
> for you to fetch changes up to 683c4b775355cc7acd301e8efe7d4c1c9acdafd8:
>
>   tpm: tpm_passthrough: Fail startup if FE buffer size < BE buffer size 
> (2017-12-14 23:39:15 -0500)
>
> 
> Merge tpm 2017/12/15 v1

Applied, thanks.

-- PMM



[Qemu-devel] [PULL 07/61] mmap(2) returns MAP_FAILED, not NULL, on failure

2017-12-17 Thread Michael Tokarev
From: Michael McConville 

Signed-off-by: Michael McConville 
Reviewed-by: John Snow 
Signed-off-by: Michael Tokarev 
---
 hw/i386/xen/xen-mapcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
index baab93b614..efa35dc6e0 100644
--- a/hw/i386/xen/xen-mapcache.c
+++ b/hw/i386/xen/xen-mapcache.c
@@ -199,7 +199,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
  */
 vaddr_base = mmap(vaddr, size, PROT_READ | PROT_WRITE,
   MAP_ANON | MAP_SHARED, -1, 0);
-if (vaddr_base == NULL) {
+if (vaddr_base == MAP_FAILED) {
 perror("mmap");
 exit(-1);
 }
-- 
2.11.0




[Qemu-devel] [PULL 36/61] nios2: remove duplicated includes (in code commented out)

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
---
 disas/nios2.c| 3 ---
 hw/nios2/boot.c  | 1 -
 target/nios2/cpu.h   | 1 -
 target/nios2/helper.c| 5 +
 target/nios2/op_helper.c | 1 +
 target/nios2/translate.c | 1 +
 6 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/disas/nios2.c b/disas/nios2.c
index b342936d21..de11f04cc4 100644
--- a/disas/nios2.c
+++ b/disas/nios2.c
@@ -1756,7 +1756,6 @@ extern const int nios2_num_r2_reg_range_mappings;
 #endif /* _NIOS2_H */
 
 /*#include "sysdep.h"
-#include 
 #include "opcode/nios2.h"
 */
 /* Register string table */
@@ -2521,8 +2520,6 @@ const int nios2_num_r2_reg_range_mappings = 8;
 #include "dis-asm.h"
 #include "opcode/nios2.h"
 #include "libiberty.h"
-#include 
-#include 
 */
 /* No symbol table is available when this code runs out in an embedded
system as when it is used for disassembler support in a monitor.  */
diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c
index 2b31f5b844..94f436e7fb 100644
--- a/hw/nios2/boot.c
+++ b/hw/nios2/boot.c
@@ -34,7 +34,6 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "qemu-common.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 9119eee587..88823a6d4d 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -20,7 +20,6 @@
 #ifndef CPU_NIOS2_H
 #define CPU_NIOS2_H
 
-#include "qemu/osdep.h"
 #include "qemu-common.h"
 
 #define TARGET_LONG_BITS 32
diff --git a/target/nios2/helper.c b/target/nios2/helper.c
index ef9ee05798..9f741a8f19 100644
--- a/target/nios2/helper.c
+++ b/target/nios2/helper.c
@@ -18,12 +18,9 @@
  * 
  */
 
-#include 
-#include 
-#include 
+#include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "qemu/osdep.h"
 #include "qemu/host-utils.h"
 #include "qapi/error.h"
 #include "exec/exec-all.h"
diff --git a/target/nios2/op_helper.c b/target/nios2/op_helper.c
index efb1c489c9..c853aeae02 100644
--- a/target/nios2/op_helper.c
+++ b/target/nios2/op_helper.c
@@ -18,6 +18,7 @@
  * 
  */
 
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/cpu_ldst.h"
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 72329002ac..51a54ff760 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -21,6 +21,7 @@
  * 
  */
 
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "tcg-op.h"
 #include "exec/exec-all.h"
-- 
2.11.0




[Qemu-devel] [PULL 08/61] .gitignore: remove vscclient

2017-12-17 Thread Michael Tokarev
From: Marc-André Lureau 

It was removed with libcacard, since:

commit 7b02f5447c64d1854468f758398c9f6fe9e5721f
Author: Marc-André Lureau 
Date:   Sun Aug 30 11:48:40 2015 +0200

libcacard: use the standalone project

Signed-off-by: Marc-André Lureau 
Signed-off-by: Michael Tokarev 
---
 .gitignore | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 588769b250..433f64f429 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,7 +53,6 @@
 /qemu-version.h.tmp
 /module_block.h
 /scsi/qemu-pr-helper
-/vscclient
 /vhost-user-scsi
 /fsdev/virtfs-proxy-helper
 *.tmp
-- 
2.11.0




[Qemu-devel] [PULL 47/61] hw/tpm: remove old i386 dependency

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Stefan Berger 
---
 hw/tpm/tpm_passthrough.c | 1 -
 hw/tpm/tpm_tis.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index c440aff4b2..d904d8e33f 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -29,7 +29,6 @@
 #include "sysemu/tpm_backend.h"
 #include "tpm_int.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "qapi/clone-visitor.h"
 #include "tpm_util.h"
 
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 42d647d363..3c38fd8b2c 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -29,7 +29,6 @@
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/pci/pci_ids.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-- 
2.11.0




[Qemu-devel] [PULL 04/61] translate-all: fix 'consisits' typo in comment

2017-12-17 Thread Michael Tokarev
From: "Emilio G. Cota" 

Signed-off-by: Emilio G. Cota 
Signed-off-by: Michael Tokarev 
---
 accel/tcg/translate-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index e7f0329a52..02dfa361bb 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -257,7 +257,7 @@ static target_long decode_sleb128(uint8_t **pp)
 /* Encode the data collected about the instructions while compiling TB.
Place the data at BLOCK, and return the number of bytes consumed.
 
-   The logical table consisits of TARGET_INSN_START_WORDS target_ulong's,
+   The logical table consists of TARGET_INSN_START_WORDS target_ulong's,
which come from the target's insn_start data, followed by a uintptr_t
which comes from the host pc of the end of the code implementing the insn.
 
-- 
2.11.0




[Qemu-devel] [PULL 34/61] i386/hax: remove duplicated includes

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
---
 include/sysemu/hax.h  | 1 -
 target/i386/hax-darwin.c  | 6 +-
 target/i386/hax-darwin.h  | 3 ---
 target/i386/hax-windows.h | 2 --
 4 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/include/sysemu/hax.h b/include/sysemu/hax.h
index 232a68ab1b..f252399623 100644
--- a/include/sysemu/hax.h
+++ b/include/sysemu/hax.h
@@ -22,7 +22,6 @@
 #ifndef QEMU_HAX_H
 #define QEMU_HAX_H
 
-#include "config-host.h"
 #include "qemu-common.h"
 
 int hax_sync_vcpus(void);
diff --git a/target/i386/hax-darwin.c b/target/i386/hax-darwin.c
index 1c5bbd0a2d..ee9417454c 100644
--- a/target/i386/hax-darwin.c
+++ b/target/i386/hax-darwin.c
@@ -11,13 +11,9 @@
  */
 
 /* HAX module interface - darwin version */
-#include 
-#include 
-#include 
-#include 
+#include "qemu/osdep.h"
 #include 
 
-#include "qemu/osdep.h"
 #include "target/i386/hax-i386.h"
 
 hax_fd hax_mod_open(void)
diff --git a/target/i386/hax-darwin.h b/target/i386/hax-darwin.h
index 0c0968b77d..fb8e25a096 100644
--- a/target/i386/hax-darwin.h
+++ b/target/i386/hax-darwin.h
@@ -15,10 +15,7 @@
 #ifndef TARGET_I386_HAX_DARWIN_H
 #define TARGET_I386_HAX_DARWIN_H
 
-#include 
 #include 
-#include 
-#include 
 
 #define HAX_INVALID_FD  (-1)
 static inline int hax_invalid_fd(hax_fd fd)
diff --git a/target/i386/hax-windows.h b/target/i386/hax-windows.h
index 1d8f68de91..f7c3e99246 100644
--- a/target/i386/hax-windows.h
+++ b/target/i386/hax-windows.h
@@ -24,8 +24,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 
 #define HAX_INVALID_FD INVALID_HANDLE_VALUE
-- 
2.11.0




[Qemu-devel] [PULL 40/61] hw/misc/pvpanic: remove unused #include

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/misc/pvpanic.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 2b1e9a6450..3a0e4ba828 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -13,14 +13,11 @@
  */
 
 #include "qemu/osdep.h"
-#include "qapi/qmp/qobject.h"
-#include "qapi/qmp/qjson.h"
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
 
 #include "hw/nvram/fw_cfg.h"
 #include "hw/i386/pc.h"
-#include "qapi-event.h"
 
 /* The bit of supported pv event */
 #define PVPANIC_F_PANICKED  0
-- 
2.11.0




[Qemu-devel] [PULL 41/61] hw/ssi/aspeed_smc: remove unused #include

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
---
 hw/ssi/aspeed_smc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 992617fd3a..5059396bc6 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -27,7 +27,6 @@
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
 #include "qemu/error-report.h"
-#include "exec/address-spaces.h"
 
 #include "hw/ssi/aspeed_smc.h"
 
-- 
2.11.0




[Qemu-devel] [PULL 23/61] MAINTAINERS: add an entry for the i82378 (superio)

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Hervé Poussineau 
Reviewed-by: Thomas Huth 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b48065aad6..1a379edc80 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -732,6 +732,7 @@ F: hw/ppc/prep.c
 F: hw/ppc/prep_systemio.c
 F: hw/ppc/rs6000_mc.c
 F: hw/pci-host/prep.[hc]
+F: hw/isa/i82378.c
 F: hw/isa/pc87312.[hc]
 F: hw/dma/i82374.c
 F: pc-bios/ppc_rom.bin
-- 
2.11.0




[Qemu-devel] [PULL 33/61] ppc: remove duplicated includes

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

applied using ./scripts/clean-includes

not needed since 7ebaf795560

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
Acked-by: David Gibson 
---
 hw/ppc/spapr_hcall.c | 1 -
 target/ppc/kvm.c | 3 ---
 2 files changed, 4 deletions(-)

diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index be22a6b289..51eba52e86 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -13,7 +13,6 @@
 #include "trace.h"
 #include "kvm_ppc.h"
 #include "hw/ppc/spapr_ovec.h"
-#include "qemu/error-report.h"
 #include "mmu-book3s-v3.h"
 
 struct SPRSyncState {
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 9d57debf0e..4664a3ce9d 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -47,9 +47,6 @@
 #include "sysemu/hostmem.h"
 #include "qemu/cutils.h"
 #include "qemu/mmap-alloc.h"
-#if defined(TARGET_PPC64)
-#include "hw/ppc/spapr_cpu_core.h"
-#endif
 #include "elf.h"
 #include "sysemu/kvm_int.h"
 
-- 
2.11.0




[Qemu-devel] [PULL 35/61] i386/hax: remove duplicated include

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

this file in include in "target/i386/hax-i386.h":

#ifdef CONFIG_WIN32
#include "target/i386/hax-windows.h"
#endif

which guaranties that sysemu/os-win32.h is previously included (CONFIG_WIN32)

Suggested-by: Peter Maydell 
Signed-off-by: Philippe Mathieu-Daudé 
---
 target/i386/hax-windows.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/i386/hax-windows.h b/target/i386/hax-windows.h
index f7c3e99246..004f867694 100644
--- a/target/i386/hax-windows.h
+++ b/target/i386/hax-windows.h
@@ -20,7 +20,6 @@
 #ifndef TARGET_I386_HAX_WINDOWS_H
 #define TARGET_I386_HAX_WINDOWS_H
 
-#include 
 #include 
 #include 
 #include 
-- 
2.11.0




[Qemu-devel] [PULL 10/61] Document pretty parameter for mon option

2017-12-17 Thread Michael Tokarev
From: Vicente Jimenez Aguilar 

Documentation: document pretty parameter for mon option
that turns on JSON pretty printing

Signed-off-by: Vicente Jimenez Aguilar 
Signed-off-by: Michael Tokarev 
---
 qemu-options.hx | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index fe0c29271f..32d9378172 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3487,11 +3487,12 @@ Like -qmp but uses pretty JSON formatting.
 ETEXI
 
 DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
-"-mon [chardev=]name[,mode=readline|control]\n", QEMU_ARCH_ALL)
+"-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", 
QEMU_ARCH_ALL)
 STEXI
-@item -mon [chardev=]name[,mode=readline|control]
+@item -mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]
 @findex -mon
-Setup monitor on chardev @var{name}.
+Setup monitor on chardev @var{name}. @code{pretty} turns on JSON pretty 
printing
+easing human reading and debugging.
 ETEXI
 
 DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
-- 
2.11.0




[Qemu-devel] [PULL 06/61] configure: check $CC available before verifying host CPU

2017-12-17 Thread Michael Tokarev
From: Daniel Henrique Barboza 

When executing 'configure' in a fresh QEMU clone, in a fresh
OS install running in a ppc64le host, this is the error
shown:

-

../configure --enable-trace-backend=simple --enable-debug
--target-list=ppc64-softmmu

ERROR: Unsupported CPU = ppc64le, try --enable-tcg-interpreter

-

This isn't true, ppc64le host CPU is supported. This happens because,
in a fresh install, we don't have a C compiler to autodetect
the $cpu variable to "ppc64".

This patch moves the CC available check up a bit, just before verifying
the host CPU. This ensures that we bail out with a $CC not available
error instead of unsupported CPU (the host CPU detection without
the compiler wouldn't work properly anyway). It also allows --help to
keep working without a C compiler. With this patch, in the same ppc64le
host without gcc:

$ ../configure --enable-trace-backend=simple --enable-debug
--target-list=ppc64-softmmu

ERROR: "cc" either does not exist or does not work

$ ../configure --help

Usage: configure [options]
Options: [defaults in brackets after descriptions]

Standard options:
  --help   print this message
  --prefix=PREFIX  install in PREFIX [/usr/local]
  --interp-prefix=PREFIX   where to find shared libraries, etc.
(...)

Signed-off-by: Daniel Henrique Barboza 
Reviewed-by: Peter Maydell 
Signed-off-by: Michael Tokarev 
---
 configure | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 0c6e7572db..9c8aa5a98b 100755
--- a/configure
+++ b/configure
@@ -1582,6 +1582,20 @@ fi
 # Suppress writing compiled files
 python="$python -B"
 
+# Check that the C compiler works. Doing this here before testing
+# the host CPU ensures that we had a valid CC to autodetect the
+# $cpu var (and we should bail right here if that's not the case).
+# It also allows the help message to be printed without a CC.
+write_c_skeleton;
+if compile_object ; then
+  : C compiler works ok
+else
+error_exit "\"$cc\" either does not exist or does not work"
+fi
+if ! compile_prog ; then
+error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
+fi
+
 # Now we have handled --enable-tcg-interpreter and know we're not just
 # printing the help message, bail out if the host CPU isn't supported.
 if test "$ARCH" = "unknown"; then
@@ -1603,17 +1617,6 @@ if test -z "$werror" ; then
 fi
 fi
 
-# check that the C compiler works.
-write_c_skeleton;
-if compile_object ; then
-  : C compiler works ok
-else
-error_exit "\"$cc\" either does not exist or does not work"
-fi
-if ! compile_prog ; then
-error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
-fi
-
 if test "$bogus_os" = "yes"; then
 # Now that we know that we're not printing the help and that
 # the compiler works (so the results of the check_defines we used
-- 
2.11.0




[Qemu-devel] [PULL v2 00/61] Trivial patches for 2017-12-18

2017-12-17 Thread Michael Tokarev
> Here's a large pull request for trivial-patches queue.
> It's been quite a whie since the last request, and many
> changes has been accumulated.
> 
> Also there's a large patchset by Philippe Mathieu-Daudé
> named "remove i386/pc dependency from non-PC world (part 1)"
> consisting of 42 patches which makes good portion of this
> pull request.

I forgot to add my S-o-b lines to the large series by
Philippe Mathieu-Daudé. So here's a re-send of just the
cover letter (not all the other patches). The only difference
is the addition of 42 of my "S-o-b" line.

Thanks,

/mjt

The following changes since commit 38d1b31e0501f938db39c5b2e508328530410246:

  Merge remote-tracking branch 'remotes/berrange/tags/pull-qio-201712151' into 
staging (2017-12-15 17:05:26 +)

are available in the git repository at:

  git://git.corpit.ru/qemu.git tags/trivial-patches-fetch

for you to fetch changes up to f4c56de4342e50b9c5a96b579a0cc44a48836536:

  misc: drop old i386 dependency (2017-12-18 01:01:55 +0300)


trivial patches for 2017-12-18


Daniel Henrique Barboza (1):
  configure: check $CC available before verifying host CPU

Emilio G. Cota (3):
  disas/arm: fix 'instuction' typo in comment
  translate-all: fix 'consisits' typo in comment
  qht: fix kernel-doc markup in qht.h

Ladi Prosek (1):
  Remove empty statements

Marc-André Lureau (2):
  .gitignore: remove vscclient
  memory: remove unused memory_region_set_global_locking()

Michael McConville (1):
  mmap(2) returns MAP_FAILED, not NULL, on failure

Mike Frysinger (1):
  build: fix typo in error message

Peter Maydell (1):
  accel/tcg/cpu-exec-common.c: Remove unnecessary include of 
memory-internal.h

Philippe Mathieu-Daudé (49):
  hw/alpha/typhoon: simplify using the "unimplemented" sysbus device
  Makefile: use $(MAKE) variable
  Makefile: add more targets to the UNCHECKED_GOALS rule
  MAINTAINERS: add "hw/registerfields.h" in Register API entry
  hw/registerfields: fix a typo in the FIELD() documentation
  hw/registerfields: add 64-bit extract/deposit macros
  hw/registerfields: add missing include
  MAINTAINERS: add entries for i2c/ppc4xx
  MAINTAINERS: add an entry for the i82374 (southbridge)
  MAINTAINERS: add an entry for the i8257 (DMA controller)
  MAINTAINERS: add an entry for the i82378 (superio)
  MAINTAINERS: add an entry for watchdog/wdt_ib700
  MAINTAINERS: add an entry for input/pckbd.c
  MAINTAINERS: add entries for timer/m48t59
  MAINTAINERS: add missing entry for include/hw/net/
  hw: use "qemu/osdep.h" as first #include in source files
  hw: remove "qemu/osdep.h" from header files
  block: remove "qemu/osdep.h" from header file
  misc: remove headers implicitly included
  misc: remove duplicated includes
  ppc: remove duplicated includes
  i386/hax: remove duplicated includes
  i386/hax: remove duplicated include
  nios2: remove duplicated includes (in code commented out)
  misc: avoid "include/" in include path
  numa: remove unused #include
  hw/input/vmmouse: remove unused #include
  hw/misc/pvpanic: remove unused #include
  hw/ssi/aspeed_smc: remove unused #include
  amd_iommu: avoid needless includes in header file
  misc: remove old i386 dependency
  hw/ide: remove old i386 dependency
  hw/ipmi: remove old i386 dependency
  hw/i2c: remove old i386 dependency
  hw/tpm: remove old i386 dependency
  hw/virtio-balloon: remove old i386 dependency
  hw/unicore32: restrict hw addr defines to source file
  hw/timer/i8254: rename pit_init() -> i8254_pit_init()
  hw/timer/mc146818: rename rtc_init() -> mc146818_rtc_init()
  hw/acpi: ACPI_PM_* defines are not restricted to i386 arch
  hw/acpi/ich9: extract ACPI_PM_PROP_TCO_ENABLED from i386/pc
  hw/display/vga: "vga.h" only contains registers defs, rename it 
"vga_regs.h"
  hw/display/vga: "vga_int.h" requires "ui/console.h"
  hw/display/vga: extract public API from i386/pc to "hw/display/vga.h"
  hw/net/ne2000: extract ne2k-isa code from i386/pc to ne2000-isa.c
  hw/misc/pvpanic: extract public API from i386/pc to "hw/misc/pvpanic.h"
  i386/pc: move vmport.c to hw/i386/
  i386/pc: move vmmouse.c to hw/i386/
  misc: drop old i386 dependency

Tao Wu (1):
  hw/input/hid: Add support for several keys.

Vicente Jimenez Aguilar (1):
  Document pretty parameter for mon option

 .gitignore  |  1 -
 MAINTAINERS | 14 ++-
 Makefile| 11 +
 accel/tcg/cpu-exec-common.c |  1 -
 accel/tcg/translate-all.c   |  3 +--
 block/dmg.h |  1 -
 bsd-user/main.c |  1 -
 chardev/wctablet.c  

Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Matthew Wilcox
On Sun, Dec 17, 2017 at 01:47:21PM +, Wang, Wei W wrote:
> On Saturday, December 16, 2017 3:22 AM, Matthew Wilcox wrote:
> > On Fri, Dec 15, 2017 at 10:49:15AM -0800, Matthew Wilcox wrote:
> > > Here's the API I'm looking at right now.  The user need take no lock;
> > > the locking (spinlock) is handled internally to the implementation.
> 
> Another place I saw your comment " The xb_ API requires you to handle your 
> own locking" which seems conflict with the above "the user need take no lock".
> Doesn't the caller need a lock to avoid concurrent accesses to the ida bitmap?

Yes, the xb_ implementation requires you to handle your own locking.
The xbit_ API that I'm proposing will take care of the locking for you.
There's also no preallocation in the API.

> We'll change it to "bool xb_find_set(.., unsigned long *result)", returning 
> false indicates no "1" bit is found.

I put a replacement proposal in the next paragraph:
bool xbit_find_set(struct xbitmap *, unsigned long *start, unsigned long max);

Maybe 'start' is the wrong name for that parameter.  Let's call it 'bit'.
It's both "where to start" and "first bit found".

> >  - xbit_clear() can't return an error.  Neither can xbit_zero().
> 
> I found the current xbit_clear implementation only returns 0, and there isn't 
> an error to be returned from this function. In this case, is it better to 
> make the function "void"?

Yes, I think so.

My only qualm is that I've been considering optimising the memory
consumption when an entire 1024-bit chunk is full; instead of keeping a
pointer to a 128-byte entry full of ones, store a special value in the
radix tree which means "every bit is set".

The downside is that we then have to pass GFP flags to xbit_clear() and
xbit_zero(), and they can fail.  It's not clear to me whether that's a
good tradeoff.

> Are you suggesting to rename the current xb_ APIs to the above xbit_ names 
> (with parameter changes)? 
> 
> Why would we need xbit_alloc, which looks like ida_get_new, I think set/clear 
> should be adequate to the current usages.

I'm intending on replacing the xb_ and ida_ implementations with this one.
It removes the preload API which makes it easier to use, and it handles
the locking for you.

But I need to get the XArray (which replaces the radix tree) finished first.



[Qemu-devel] [PULL 48/61] hw/virtio-balloon: remove old i386 dependency

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/virtio/virtio-balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 37cde38982..14e08d20d0 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -18,7 +18,7 @@
 #include "qemu/timer.h"
 #include "qemu-common.h"
 #include "hw/virtio/virtio.h"
-#include "hw/i386/pc.h"
+#include "hw/mem/pc-dimm.h"
 #include "sysemu/balloon.h"
 #include "hw/virtio/virtio-balloon.h"
 #include "sysemu/kvm.h"
-- 
2.11.0




[Qemu-devel] [PULL 51/61] hw/timer/mc146818: rename rtc_init() -> mc146818_rtc_init()

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Hervé Poussineau 
Reviewed-by: David Gibson 
---
 hw/alpha/dp264.c   | 2 +-
 hw/i386/pc.c   | 2 +-
 hw/isa/i82378.c| 3 ++-
 hw/mips/mips_fulong2e.c| 2 +-
 hw/mips/mips_jazz.c| 2 +-
 hw/mips/mips_malta.c   | 2 +-
 hw/mips/mips_r4k.c | 2 +-
 hw/ppc/pnv.c   | 2 +-
 hw/timer/mc146818rtc.c | 2 +-
 include/hw/timer/mc146818rtc.h | 3 ++-
 10 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 887a7401f1..766373eec7 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -78,7 +78,7 @@ static void clipper_init(MachineState *machine)
clipper_pci_map_irq);
 
 /* Since we have an SRM-compatible PALcode, use the SRM epoch.  */
-rtc_init(isa_bus, 1900, rtc_irq);
+mc146818_rtc_init(isa_bus, 1900, rtc_irq);
 
 i8254_pit_init(isa_bus, 0x40, 0, NULL);
 isa_create_simple(isa_bus, "i8042");
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 6a6041573f..fe5e8b53bb 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1565,7 +1565,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
 rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT);
 }
 }
-*rtc_state = rtc_init(isa_bus, 2000, rtc_irq);
+*rtc_state = mc146818_rtc_init(isa_bus, 2000, rtc_irq);
 
 qemu_register_boot_set(pc_boot_set, *rtc_state);
 
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index a9c15f858d..a5d67bc6d7 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -21,6 +21,7 @@
 #include "hw/pci/pci.h"
 #include "hw/i386/pc.h"
 #include "hw/timer/i8254.h"
+#include "hw/timer/mc146818rtc.h"
 #include "hw/audio/pcspk.h"
 
 #define TYPE_I82378 "i82378"
@@ -106,7 +107,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
 isa = isa_create_simple(isabus, "i82374");
 
 /* timer */
-isa_create_simple(isabus, "mc146818rtc");
+isa_create_simple(isabus, TYPE_MC146818_RTC);
 }
 
 static void i82378_init(Object *obj)
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 2a2a09c9de..725e25a134 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -365,7 +365,7 @@ static void mips_fulong2e_init(MachineState *machine)
 /* Super I/O */
 isa_create_simple(isa_bus, "i8042");
 
-rtc_init(isa_bus, 2000, NULL);
+mc146818_rtc_init(isa_bus, 2000, NULL);
 
 serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
 parallel_hds_isa_init(isa_bus, 1);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 995419344d..22a3d5169c 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -288,7 +288,7 @@ static void mips_jazz_init(MachineState *machine,
 fdctrl_init_sysbus(qdev_get_gpio_in(rc4030, 1), -1, 0x80003000, fds);
 
 /* Real time clock */
-rtc_init(isa_bus, 1980, NULL);
+mc146818_rtc_init(isa_bus, 1980, NULL);
 memory_region_init_io(rtc, NULL, &rtc_ops, NULL, "rtc", 0x1000);
 memory_region_add_subregion(address_space, 0x80004000, rtc);
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 88b4733743..37f19428d6 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1214,7 +1214,7 @@ void mips_malta_init(MachineState *machine)
 /* Super I/O */
 isa_create_simple(isa_bus, "i8042");
 
-rtc_init(isa_bus, 2000, NULL);
+mc146818_rtc_init(isa_bus, 2000, NULL);
 serial_hds_isa_init(isa_bus, 0, 2);
 parallel_hds_isa_init(isa_bus, 1);
 
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 58d7bac18b..9884ee7e9f 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -270,7 +270,7 @@ void mips_r4k_init(MachineState *machine)
 i8259 = i8259_init(isa_bus, env->irq[2]);
 isa_bus_irqs(isa_bus, i8259);
 
-rtc_init(isa_bus, 2000, NULL);
+mc146818_rtc_init(isa_bus, 2000, NULL);
 
 pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index c35c439d81..94ffc8e137 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -655,7 +655,7 @@ static void ppc_powernv_init(MachineState *machine)
 serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS);
 
 /* Create an RTC ISA device too */
-rtc_init(pnv->isa_bus, 2000, NULL);
+mc146818_rtc_init(pnv->isa_bus, 2000, NULL);
 
 /* OpenPOWER systems use a IPMI SEL Event message to notify the
  * host to powerdown */
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 7764be25ec..35a05a64cc 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -999,7 +999,7 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
 qdev_init_gpio_out(dev, &s->irq, 1);
 }
 
-ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
+ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq 
intercept_irq)
 {
 DeviceState *dev;
 ISADevice *isadev;
diff --git a/include/hw/

[Qemu-devel] [PULL 17/61] hw/registerfields: add 64-bit extract/deposit macros

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Darren Kenny 
Reviewed-by: Alistair Francis 
Reviewed-by: Edgar E. Iglesias 
Signed-off-by: Michael Tokarev 
---
 include/hw/registerfields.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/hw/registerfields.h b/include/hw/registerfields.h
index ad9d7a82a3..f59e7f47bd 100644
--- a/include/hw/registerfields.h
+++ b/include/hw/registerfields.h
@@ -35,6 +35,9 @@
 #define FIELD_EX32(storage, reg, field)   \
 extract32((storage), R_ ## reg ## _ ## field ## _SHIFT,   \
   R_ ## reg ## _ ## field ## _LENGTH)
+#define FIELD_EX64(storage, reg, field)   \
+extract64((storage), R_ ## reg ## _ ## field ## _SHIFT,   \
+  R_ ## reg ## _ ## field ## _LENGTH)
 
 /* Extract a field from an array of registers */
 #define ARRAY_FIELD_EX32(regs, reg, field)\
@@ -52,6 +55,14 @@
 d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT,   \
   R_ ## reg ## _ ## field ## _LENGTH, v.v);   \
 d; })
+#define FIELD_DP64(storage, reg, field, val) ({   \
+struct {  \
+unsigned int v:R_ ## reg ## _ ## field ## _LENGTH;\
+} v = { .v = val };   \
+uint64_t d;   \
+d = deposit64((storage), R_ ## reg ## _ ## field ## _SHIFT,   \
+  R_ ## reg ## _ ## field ## _LENGTH, v.v);   \
+d; })
 
 /* Deposit a field to array of registers.  */
 #define ARRAY_FIELD_DP32(regs, reg, field, val)   \
-- 
2.11.0




[Qemu-devel] [PULL 14/61] Makefile: add more targets to the UNCHECKED_GOALS rule

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

These targets don't need a full build of git submodules.
(See b8e535ae8af and eaa2ddbb767).

Signed-off-by: Philippe Mathieu-Daudé 
Signed-off-by: Michael Tokarev 
---
 Makefile | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1f93515677..d86ecd2dd4 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,10 @@ BUILD_DIR=$(CURDIR)
 # Before including a proper config-host.mak, assume we are in the source tree
 SRC_PATH=.
 
-UNCHECKED_GOALS := %clean TAGS cscope ctags docker docker-% help
+UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
+html info pdf txt \
+help check-help \
+docker docker-% vm-test vm-build-%
 
 # All following code might depend on configuration variables
 ifneq ($(wildcard config-host.mak),)
-- 
2.11.0




[Qemu-devel] [PULL 38/61] numa: remove unused #include

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
---
 numa.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/numa.c b/numa.c
index 98fa9a4bcf..7b9c33ad12 100644
--- a/numa.c
+++ b/numa.c
@@ -29,7 +29,6 @@
 #include "qemu/bitmap.h"
 #include "qom/cpu.h"
 #include "qemu/error-report.h"
-#include "include/exec/cpu-common.h" /* for RAM_ADDR_FMT */
 #include "qapi-visit.h"
 #include "qapi/opts-visitor.h"
 #include "hw/boards.h"
-- 
2.11.0




[Qemu-devel] [PULL 49/61] hw/unicore32: restrict hw addr defines to source file

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

and drop unused #includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/unicore32/puv3.c | 15 ++-
 include/hw/unicore32/puv3.h | 10 --
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index 1b39cc035b..db26959a1d 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -11,16 +11,11 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "cpu.h"
 #include "ui/console.h"
-#include "elf.h"
-#include "exec/address-spaces.h"
-#include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "hw/i386/pc.h"
-#include "qemu/error-report.h"
 #include "sysemu/qtest.h"
 
 #undef DEBUG_PUV3
@@ -29,6 +24,16 @@
 #define KERNEL_LOAD_ADDR0x0300
 #define KERNEL_MAX_SIZE 0x0080 /* Just a guess */
 
+/* PKUnity System bus (AHB): 0xc000 - 0xedff (640MB) */
+#define PUV3_DMA_BASE   (0xc020) /* AHB-4 */
+
+/* PKUnity Peripheral bus (APB): 0xee00 - 0xefff (128MB) */
+#define PUV3_GPIO_BASE  (0xee50) /* APB-5 */
+#define PUV3_INTC_BASE  (0xee60) /* APB-6 */
+#define PUV3_OST_BASE   (0xee80) /* APB-8 */
+#define PUV3_PM_BASE(0xeea0) /* APB-10 */
+#define PUV3_PS2_BASE   (0xeeb0) /* APB-11 */
+
 static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
 {
 UniCore32CPU *cpu = opaque;
diff --git a/include/hw/unicore32/puv3.h b/include/hw/unicore32/puv3.h
index 5a4839f8df..f587a1f622 100644
--- a/include/hw/unicore32/puv3.h
+++ b/include/hw/unicore32/puv3.h
@@ -14,16 +14,6 @@
 
 #define PUV3_REGS_OFFSET(0x1000) /* 4K is reasonable */
 
-/* PKUnity System bus (AHB): 0xc000 - 0xedff (640MB) */
-#define PUV3_DMA_BASE   (0xc020) /* AHB-4 */
-
-/* PKUnity Peripheral bus (APB): 0xee00 - 0xefff (128MB) */
-#define PUV3_GPIO_BASE  (0xee50) /* APB-5 */
-#define PUV3_INTC_BASE  (0xee60) /* APB-6 */
-#define PUV3_OST_BASE   (0xee80) /* APB-8 */
-#define PUV3_PM_BASE(0xeea0) /* APB-10 */
-#define PUV3_PS2_BASE   (0xeeb0) /* APB-11 */
-
 /* Hardware interrupts */
 #define PUV3_IRQS_NR(32)
 
-- 
2.11.0




Re: [Qemu-devel] [PULL v2 00/61] Trivial patches for 2017-12-18

2017-12-17 Thread Peter Maydell
On 17 December 2017 at 22:07, Michael Tokarev  wrote:
>> Here's a large pull request for trivial-patches queue.
>> It's been quite a whie since the last request, and many
>> changes has been accumulated.
>>
>> Also there's a large patchset by Philippe Mathieu-Daudé
>> named "remove i386/pc dependency from non-PC world (part 1)"
>> consisting of 42 patches which makes good portion of this
>> pull request.
>
> I forgot to add my S-o-b lines to the large series by
> Philippe Mathieu-Daudé. So here's a re-send of just the
> cover letter (not all the other patches). The only difference
> is the addition of 42 of my "S-o-b" line.

I'm afraid this fails 'make check'. (I only tested the
first pullreq but if you only changed signoffs then
it'll still be the same):

TEST: tests/qom-test... (pid=12208)
  /alpha/qom/clipper:
Broken pipe
FAIL
GTester: last random seed: R02S26a31a16d967b2664ad714c1c7f8e7f1
(pid=12214)
  /alpha/qom/none: OK
FAIL: tests/qom-test
TEST: tests/test-hmp... (pid=12219)
  /alpha/hmp/clipper:
Broken pipe
FAIL
GTester: last random seed: R02S0c5a0f7de3fc6e9885b740c77c86eef2
(pid=12225)
  /alpha/hmp/none: OK
  /alpha/hmp/none+2MB: OK
FAIL: tests/test-hmp

This is because qemu-system-alpha segfaults on startup:

Thread 1 "qemu-system-alp" received signal SIGSEGV, Segmentation fault.
0x557db414 in memory_region_update_container_subregions
(subregion=0x56ad6330)
at /home/petmay01/linaro/qemu-for-merges/memory.c:2290
2290QTAILQ_INSERT_TAIL(&mr->subregions, subregion, subregions_link);
(gdb) bt
#0  0x557db414 in memory_region_update_container_subregions
(subregion=0x56ad6330)
at /home/petmay01/linaro/qemu-for-merges/memory.c:2290
#1  0x557db4da in memory_region_add_subregion_common
(mr=0x569e2140, offset=32, subregion=0x56ad6330)
at /home/petmay01/linaro/qemu-for-merges/memory.c:2303
#2  0x557db516 in memory_region_add_subregion
(mr=0x569e2140, offset=32, subregion=0x56ad6330)
at /home/petmay01/linaro/qemu-for-merges/memory.c:2311
#3  0x5594e8bd in isa_register_ioport (dev=0x56ad6270,
io=0x56ad6330, start=32)
at /home/petmay01/linaro/qemu-for-merges/hw/isa/isa-bus.c:130
#4  0x5594b844 in pic_common_realize (dev=0x56ad6270,
errp=0x7fffdaf0)
at /home/petmay01/linaro/qemu-for-merges/hw/intc/i8259_common.c:77
#5  0x5594c744 in pic_realize (dev=0x56ad6270, errp=0x7fffdaf0)
at /home/petmay01/linaro/qemu-for-merges/hw/intc/i8259.c:461
#6  0x558f3d60 in device_set_realized (obj=0x56ad6270,
value=true, errp=0x7fffdc90)
at /home/petmay01/linaro/qemu-for-merges/hw/core/qdev.c:914
#7  0x55ac188c in property_set_bool (obj=0x56ad6270, v=
0x56ad6f20, name=0x55d2271b "realized",
opaque=0x56ad66a0, errp=0x7fffdc90)
at /home/petmay01/linaro/qemu-for-merges/qom/object.c:1906
#8  0x55abfc01 in object_property_set (obj=0x56ad6270, v=
0x56ad6f20, name=0x55d2271b "realized",
errp=0x7fffdc90) at
/home/petmay01/linaro/qemu-for-merges/qom/object.c:1102
#9  0x55ac2bc9 in object_property_set_qobject
(obj=0x56ad6270, value=0x56ad6520, name=0x55d2271b
"realized", errp=0x7fffdc90) at
/home/petmay01/linaro/qemu-for-merges/qom/qom-qobject.c:27
#10 0x55abfe96 in object_property_set_bool
(obj=0x56ad6270, value=true, name=0x55d2271b "realized",
errp=0x7fffdc90) at
/home/petmay01/linaro/qemu-for-merges/qom/object.c:1171
#11 0x558f27a9 in qdev_init_nofail (dev=0x56ad6270) at
/home/petmay01/linaro/qemu-for-merges/hw/core/qdev.c:338
#12 0x5594b984 in i8259_init_chip (name=0x55d2c08c
"isa-i8259", bus=0x56ad5550, master=true)
at /home/petmay01/linaro/qemu-for-merges/hw/intc/i8259_common.c:96
#13 0x5594c783 in i8259_init (bus=0x56ad5550,
parent_irq=0x56ad6050)
at /home/petmay01/linaro/qemu-for-merges/hw/intc/i8259.c:473
#14 0x55851873 in typhoon_init (ram_size=134217728,
isa_bus=0x7fffde08, p_rtc_irq=0x7fffde10, cpus=0x7fffdea0,
sys_map_irq=0x5584f22a ) at
/home/petmay01/linaro/qemu-for-merges/hw/alpha/typhoon.c:925
#15 0x5584f3dd in clipper_init (machine=0x5697b390) at
/home/petmay01/linaro/qemu-for-merges/hw/alpha/dp264.c:77
#16 0x558fba0a in machine_run_board_init (machine=0x5697b390)
at /home/petmay01/linaro/qemu-for-merges/hw/core/machine.c:792
#17 0x5587ac3d in main (argc=1, argv=0x7fffe338,
envp=0x7fffe348) at
/home/petmay01/linaro/qemu-for-merges/vl.c:4708


There was also a minor merge conflict with the tpm pullreq
(both pulls change the #includes in hw/tpm/tpm_tis.c) which
you might fix when you respin.

thanks
-- PMM



[Qemu-devel] [PULL 46/61] hw/i2c: remove old i386 dependency

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/i2c/pm_smbus.c   | 1 -
 hw/i2c/smbus_ich9.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index 6fc3923f56..a044dd1b27 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -19,7 +19,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/i2c/pm_smbus.h"
 #include "hw/i2c/smbus.h"
 
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index e47556c9d8..007cb6701d 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -26,7 +26,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/i2c/pm_smbus.h"
 #include "hw/pci/pci.h"
 #include "sysemu/sysemu.h"
-- 
2.11.0




[Qemu-devel] [PULL 12/61] build: fix typo in error message

2017-12-17 Thread Michael Tokarev
From: Mike Frysinger 

Signed-off-by: Mike Frysinger 
Reviewed-by: John Snow 
Reviewed-by: Eric Blake 
Signed-off-by: Michael Tokarev 
---
 scripts/git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh
index 030617b4ac..bc7224a27f 100755
--- a/scripts/git-submodule.sh
+++ b/scripts/git-submodule.sh
@@ -24,7 +24,7 @@ error() {
 echo "Alternatively you may disable automatic GIT submodule checkout"
 echo "with:"
 echo
-echo " $ ./configure --disable-git-update'"
+echo " $ ./configure --disable-git-update"
 echo
 echo "and then manually update submodules prior to running make, with:"
 echo
-- 
2.11.0




[Qemu-devel] [PULL 18/61] hw/registerfields: add missing include

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

This allows to use this header in qtests.

This fixes:
CC  tests/test.o
  include/hw/registerfields.h:32:41: error: implicit declaration of function 
‘MAKE_64BIT_MASK’ [-Werror=implicit-function-declaration]
  MAKE_64BIT_MASK(shift, length)};
  ^
  include/hw/registerfields.h:39:5: error: implicit declaration of function 
‘extract64’; [-Werror=implicit-function-declaration]
   extract64((storage), R_ ## reg ## _ ## field ## _SHIFT,
   ^

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Darren Kenny 
Reviewed-by: Alistair Francis 
Reviewed-by: Edgar E. Iglesias 
Signed-off-by: Michael Tokarev 
---
 include/hw/registerfields.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/hw/registerfields.h b/include/hw/registerfields.h
index f59e7f47bd..44e0b94edf 100644
--- a/include/hw/registerfields.h
+++ b/include/hw/registerfields.h
@@ -11,6 +11,8 @@
 #ifndef REGISTERFIELDS_H
 #define REGISTERFIELDS_H
 
+#include 
+
 /* Define constants for a 32 bit register */
 
 /* This macro will define A_FOO, for the byte address of a register
-- 
2.11.0




[Qemu-devel] [PULL 37/61] misc: avoid "include/" in include path

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
---
 hw/input/adb.c  | 2 +-
 hw/ssi/aspeed_smc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index fcca3a8eb9..924a3f9fd5 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -24,8 +24,8 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/input/adb.h"
+#include "hw/input/adb-keys.h"
 #include "ui/console.h"
-#include "include/hw/input/adb-keys.h"
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index cb515730c5..992617fd3a 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -26,7 +26,7 @@
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
-#include "include/qemu/error-report.h"
+#include "qemu/error-report.h"
 #include "exec/address-spaces.h"
 
 #include "hw/ssi/aspeed_smc.h"
-- 
2.11.0




[Qemu-devel] [PULL 19/61] hw/input/hid: Add support for several keys.

2017-12-17 Thread Michael Tokarev
From: Tao Wu 

Add support for these keys: audiomute volumedown volumeup power.
Tested with "sendkey" command in monitor and verify the behavior
in guest OS.

Signed-off-by: Tao Wu 
Signed-off-by: Michael Tokarev 
---
 hw/input/hid.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/input/hid.c b/hw/input/hid.c
index 0d049ff61c..aa4fb826fd 100644
--- a/hw/input/hid.c
+++ b/hw/input/hid.c
@@ -57,14 +57,14 @@ static const uint8_t hid_usage_keys[0x100] = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x58, 0xe4, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x46,
+0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00,
+0x80, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x46,
 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x4a,
 0x52, 0x4b, 0x00, 0x50, 0x00, 0x4f, 0x00, 0x4d,
 0x51, 0x4e, 0x49, 0x4c, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65, 0x66, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 
2.11.0




[Qemu-devel] [PULL 31/61] misc: remove headers implicitly included

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
Reviewed-by: Stefan Hajnoczi 
Reviewed-by: Ben Warren 
---
 bsd-user/main.c  | 1 -
 chardev/wctablet.c   | 4 
 hw/audio/fmopl.h | 1 -
 hw/scsi/vhost-user-scsi.c| 1 -
 linux-user/main.c| 1 -
 net/colo-compare.c   | 1 -
 tests/test-aio-multithread.c | 1 -
 tests/test-clone-visitor.c   | 1 -
 tests/vmgenid-test.c | 3 ---
 9 files changed, 14 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index f1b244b59b..efef5ff8c5 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -32,7 +32,6 @@
 #include "qemu/envlist.h"
 #include "exec/log.h"
 #include "trace/control.h"
-#include "glib-compat.h"
 
 int singlestep;
 unsigned long mmap_min_addr;
diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index 6c13c2c58a..969d014574 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -25,10 +25,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include 
-#include 
-#include 
-#include 
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index f4065f425c..e7e578a48e 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -1,7 +1,6 @@
 #ifndef FMOPL_H
 #define FMOPL_H
 
-#include 
 
 typedef void (*OPL_TIMERHANDLER)(void *param, int channel, double 
interval_Sec);
 
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index f7561e23fa..9389ed48e0 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -18,7 +18,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
-#include "qemu/typedefs.h"
 #include "qom/object.h"
 #include "hw/fw-path-provider.h"
 #include "hw/qdev-core.h"
diff --git a/linux-user/main.c b/linux-user/main.c
index 6286661bd3..2fd2a143ed 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -35,7 +35,6 @@
 #include "elf.h"
 #include "exec/log.h"
 #include "trace/control.h"
-#include "glib-compat.h"
 
 char *exec_path;
 
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 1ce195f877..0ebdec936c 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -23,7 +23,6 @@
 #include "qom/object_interfaces.h"
 #include "qemu/iov.h"
 #include "qom/object.h"
-#include "qemu/typedefs.h"
 #include "net/queue.h"
 #include "chardev/char-fe.h"
 #include "qemu/sockets.h"
diff --git a/tests/test-aio-multithread.c b/tests/test-aio-multithread.c
index d396185972..c8bec81520 100644
--- a/tests/test-aio-multithread.c
+++ b/tests/test-aio-multithread.c
@@ -11,7 +11,6 @@
  */
 
 #include "qemu/osdep.h"
-#include 
 #include "block/aio.h"
 #include "qapi/error.h"
 #include "qemu/coroutine.h"
diff --git a/tests/test-clone-visitor.c b/tests/test-clone-visitor.c
index 96982163e4..ac6afc562e 100644
--- a/tests/test-clone-visitor.c
+++ b/tests/test-clone-visitor.c
@@ -8,7 +8,6 @@
  */
 
 #include "qemu/osdep.h"
-#include 
 
 #include "qemu-common.h"
 #include "qapi/clone-visitor.h"
diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c
index 5a86b40775..68ff954578 100644
--- a/tests/vmgenid-test.c
+++ b/tests/vmgenid-test.c
@@ -8,9 +8,6 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include 
-#include 
-#include 
 #include "qemu/osdep.h"
 #include "qemu/bitmap.h"
 #include "qemu/uuid.h"
-- 
2.11.0




Re: [Qemu-devel] [Qemu-trivial] [PULL v2 00/61] Trivial patches for 2017-12-18

2017-12-17 Thread Philippe Mathieu-Daudé
Hi Peter,

On 12/17/2017 08:14 PM, Peter Maydell wrote:
> On 17 December 2017 at 22:07, Michael Tokarev  wrote:
>>> Here's a large pull request for trivial-patches queue.
>>> It's been quite a whie since the last request, and many
>>> changes has been accumulated.
>>>
>>> Also there's a large patchset by Philippe Mathieu-Daudé
>>> named "remove i386/pc dependency from non-PC world (part 1)"
>>> consisting of 42 patches which makes good portion of this
>>> pull request.
>>
>> I forgot to add my S-o-b lines to the large series by
>> Philippe Mathieu-Daudé. So here's a re-send of just the
>> cover letter (not all the other patches). The only difference
>> is the addition of 42 of my "S-o-b" line.
> 
> I'm afraid this fails 'make check'. (I only tested the
> first pullreq but if you only changed signoffs then
> it'll still be the same):
> 
> TEST: tests/qom-test... (pid=12208)
>   /alpha/qom/clipper:
> Broken pipe
> FAIL
> GTester: last random seed: R02S26a31a16d967b2664ad714c1c7f8e7f1
> (pid=12214)

Oops

>   /alpha/qom/none: OK
> FAIL: tests/qom-test
> TEST: tests/test-hmp... (pid=12219)
>   /alpha/hmp/clipper:
> Broken pipe
> FAIL
> GTester: last random seed: R02S0c5a0f7de3fc6e9885b740c77c86eef2
> (pid=12225)
>   /alpha/hmp/none: OK
>   /alpha/hmp/none+2MB: OK
> FAIL: tests/test-hmp
> 
> This is because qemu-system-alpha segfaults on startup:

My bad...

eede06dd70f72da489b8f968abbb7cb5445ef834 is the first bad commit
Author: Philippe Mathieu-Daudé 

hw/alpha/typhoon: simplify using the "unimplemented" sysbus device

I'm pretty sure I run the qtests, but this was 2 months ago...
I'll have a look.

[...]
> There was also a minor merge conflict with the tpm pullreq
> (both pulls change the #includes in hw/tpm/tpm_tis.c) which
> you might fix when you respin.

Yes, I rebased the 42 patches on /master yesterday but I see you merged
the TPM tree in your /staging, so I'll rebase there and resend the
offending patches fixed to Michael.

Regards,

Phil.



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v2 03/19] spapr: introduce the XIVE interrupt sources

2017-12-17 Thread Benjamin Herrenschmidt
On Thu, 2017-12-14 at 16:24 +0100, Cédric Le Goater wrote:
> The API between the source and the IVRE is extremely simple :
> 
>   static void spapr_xive_irq(sPAPRXive *xive, int lisn)
> 
> The IVRE then scans its IVT, finds the EQ, and moves on to the 
> presenter.

In HW it's an MMIO store between the two units (from the source to the
IVRE notification port). I wonder in the long run if we should model
that the same way...

> So, we can keep the IVRE engine (sPAPRXive) attached directly to 
> the machine like we have today, this is good, and introduce multiple 
> XIVE source objects. The sPAPR machine would have : 
> 
>  - one for the IPIs [ 0 - nr_servers ]
>  - one generic for the devices [ 4096 -  ]
>  - one for each phb ? 
> 
> The source address in the overall ESB MMIO region would be calculated 
> from the offset of the source IRQ numbers in the IRQ number space. 
> The offset could very well be hardcoded for each device. I don't see 
> any XICS compatibility problems as we are sharing correctly the IRQ 
> number space already.
> 
> 
> I am starting this discussion because the support for XIVE in the 
> QEMU PowerNV machine will need multiple sources, just like for 
> POWER8. PnvXive will be a bit different because the IVRE tables 
> (IVT and EQDT) are in the virtual machine memory. Most of the settings 
> are done in the VM. The QEMU PowerNV machine will still have to 
> implement the triggering and the routing logic using the guest tables. 



[Qemu-devel] [PULL 22/61] MAINTAINERS: add an entry for the i8257 (DMA controller)

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 10079f4a21..b48065aad6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -877,6 +877,7 @@ F: hw/timer/hpet*
 F: hw/timer/i8254*
 F: hw/timer/mc146818rtc*
 F: include/hw/i2c/pm_smbus.h
+F: include/hw/isa/i8257.h
 F: include/hw/timer/hpet.h
 F: include/hw/timer/i8254*
 F: include/hw/timer/mc146818rtc*
-- 
2.11.0




[Qemu-devel] [PULL 16/61] hw/registerfields: fix a typo in the FIELD() documentation

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Darren Kenny 
Reviewed-by: Alistair Francis 
Reviewed-by: Edgar E. Iglesias 
Signed-off-by: Michael Tokarev 
---
 include/hw/registerfields.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/registerfields.h b/include/hw/registerfields.h
index af101d5ae6..ad9d7a82a3 100644
--- a/include/hw/registerfields.h
+++ b/include/hw/registerfields.h
@@ -22,7 +22,7 @@
 
 /* Define SHIFT, LENGTH and MASK constants for a field within a register */
 
-/* This macro will define FOO_BAR_MASK, FOO_BAR_SHIFT and FOO_BAR_LENGTH 
+/* This macro will define R_FOO_BAR_MASK, R_FOO_BAR_SHIFT and R_FOO_BAR_LENGTH
  * constants for field BAR in register FOO.
  */
 #define FIELD(reg, field, shift, length)  \
-- 
2.11.0




[Qemu-devel] [PULL 60/61] i386/pc: move vmmouse.c to hw/i386/

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

It's a x86-only device, so it does not make sense to keep it
in the shared misc folder.

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/i386/Makefile.objs| 1 +
 hw/{input => i386}/vmmouse.c | 0
 hw/input/Makefile.objs   | 1 -
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename hw/{input => i386}/vmmouse.c (100%)

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 1548ad1ad0..fd279e7584 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -6,6 +6,7 @@ obj-y += x86-iommu.o intel_iommu.o
 obj-y += amd_iommu.o
 obj-$(CONFIG_XEN) += ../xenpv/ xen/
 obj-$(CONFIG_VMPORT) += vmport.o
+obj-$(CONFIG_VMMOUSE) += vmmouse.o
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
diff --git a/hw/input/vmmouse.c b/hw/i386/vmmouse.c
similarity index 100%
rename from hw/input/vmmouse.c
rename to hw/i386/vmmouse.c
diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs
index 7715d7230d..636f794b6b 100644
--- a/hw/input/Makefile.objs
+++ b/hw/input/Makefile.objs
@@ -6,7 +6,6 @@ common-obj-$(CONFIG_PL050) += pl050.o
 common-obj-y += ps2.o
 common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
 common-obj-$(CONFIG_TSC2005) += tsc2005.o
-common-obj-$(CONFIG_VMMOUSE) += vmmouse.o
 
 common-obj-$(CONFIG_VIRTIO) += virtio-input.o
 common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
-- 
2.11.0




[Qemu-devel] [PULL 50/61] hw/timer/i8254: rename pit_init() -> i8254_pit_init()

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

and remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Hervé Poussineau 
---
 hw/alpha/dp264.c  | 2 +-
 hw/i386/pc.c  | 2 +-
 hw/isa/i82378.c   | 2 +-
 hw/mips/mips_fulong2e.c   | 2 +-
 hw/mips/mips_jazz.c   | 2 +-
 hw/mips/mips_malta.c  | 2 +-
 hw/mips/mips_r4k.c| 2 +-
 hw/timer/i8254.c  | 1 -
 hw/timer/i8254_common.c   | 1 -
 include/hw/timer/i8254.h  | 5 +++--
 include/hw/timer/i8254_internal.h | 2 +-
 11 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index babd6ea514..887a7401f1 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -80,7 +80,7 @@ static void clipper_init(MachineState *machine)
 /* Since we have an SRM-compatible PALcode, use the SRM epoch.  */
 rtc_init(isa_bus, 1900, rtc_irq);
 
-pit_init(isa_bus, 0x40, 0, NULL);
+i8254_pit_init(isa_bus, 0x40, 0, NULL);
 isa_create_simple(isa_bus, "i8042");
 
 /* VGA setup.  Don't bother loading the bios.  */
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 186545d2a4..6a6041573f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1573,7 +1573,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
 if (kvm_pit_in_kernel()) {
 pit = kvm_pit_init(isa_bus, 0x40);
 } else {
-pit = pit_init(isa_bus, 0x40, pit_isa_irq, pit_alt_irq);
+pit = i8254_pit_init(isa_bus, 0x40, pit_isa_irq, pit_alt_irq);
 }
 if (hpet) {
 /* connect PIT to output control line of the HPET */
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index d20ea4c2ee..a9c15f858d 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -97,7 +97,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
 isa_bus_irqs(isabus, s->i8259);
 
 /* 1 82C54 (pit) */
-isa = pit_init(isabus, 0x40, 0, NULL);
+isa = i8254_pit_init(isabus, 0x40, 0, NULL);
 
 /* speaker */
 pcspk_init(isabus, isa);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 146cf0fccd..2a2a09c9de 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -359,7 +359,7 @@ static void mips_fulong2e_init(MachineState *machine)
 smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd));
 
 /* init other devices */
-pit = pit_init(isa_bus, 0x40, 0, NULL);
+pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 DMA_init(isa_bus, 0);
 
 /* Super I/O */
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index fe4f17389f..995419344d 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -218,7 +218,7 @@ static void mips_jazz_init(MachineState *machine,
 i8259 = i8259_init(isa_bus, env->irq[4]);
 isa_bus_irqs(isa_bus, i8259);
 DMA_init(isa_bus, 0);
-pit = pit_init(isa_bus, 0x40, 0, NULL);
+pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 pcspk_init(isa_bus, pit);
 
 /* Video card */
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index ec6af4a277..88b4733743 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1208,7 +1208,7 @@ void mips_malta_init(MachineState *machine)
   isa_get_irq(NULL, 9), NULL, 0, NULL);
 smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
 g_free(smbus_eeprom_buf);
-pit = pit_init(isa_bus, 0x40, 0, NULL);
+pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 DMA_init(isa_bus, 0);
 
 /* Super I/O */
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 3bbb1827e1..58d7bac18b 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -272,7 +272,7 @@ void mips_r4k_init(MachineState *machine)
 
 rtc_init(isa_bus, 2000, NULL);
 
-pit = pit_init(isa_bus, 0x40, 0, NULL);
+pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 
 serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
 
diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
index 5e61ad50a8..dbc4a0baec 100644
--- a/hw/timer/i8254.c
+++ b/hw/timer/i8254.c
@@ -23,7 +23,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "qemu/timer.h"
 #include "hw/timer/i8254.h"
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
index b623c96198..6190b6fc5d 100644
--- a/hw/timer/i8254_common.c
+++ b/hw/timer/i8254_common.c
@@ -24,7 +24,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "qemu/timer.h"
 #include "hw/timer/i8254.h"
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 5adae9fa44..5b12eb918e 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -26,6 +26,7 @@
 #define HW_I8254_H
 
 #include "hw/hw.h"
+#include "hw/qdev.h"
 #include "hw/isa/isa.h"
 
 #define PIT_FREQ 1193182
@@ -48,8 +49,8 @@ typedef struct PITChannelInfo {
 #define TYPE_I8254 "isa-pit"
 #define

[Qemu-devel] [PULL 20/61] MAINTAINERS: add entries for i2c/ppc4xx

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
Reviewed-by: Corey Minyard 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 55e403833f..331c2efeaf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -976,7 +976,9 @@ M: Alexander Graf 
 L: qemu-...@nongnu.org
 S: Odd Fixes
 F: hw/ppc/ppc4*.c
+F: hw/i2c/ppc4xx_i2c.c
 F: include/hw/ppc/ppc4xx.h
+F: include/hw/i2c/ppc4xx_i2c.h
 
 ppce500
 M: Alexander Graf 
-- 
2.11.0




[Qemu-devel] [PULL 24/61] MAINTAINERS: add an entry for watchdog/wdt_ib700

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1a379edc80..2122a2a024 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -877,6 +877,7 @@ F: hw/misc/pc-testdev.c
 F: hw/timer/hpet*
 F: hw/timer/i8254*
 F: hw/timer/mc146818rtc*
+F: hw/watchdog/wdt_ib700.c
 F: include/hw/i2c/pm_smbus.h
 F: include/hw/isa/i8257.h
 F: include/hw/timer/hpet.h
-- 
2.11.0




Re: [Qemu-devel] [PATCH] docs/devel/migration.txt: keep functions consistent with the code

2017-12-17 Thread Zhoujian (jay)
> -Original Message-
> From: Dr. David Alan Gilbert [mailto:dgilb...@redhat.com]
> Sent: Friday, December 15, 2017 11:15 PM
> To: Daniel P. Berrange 
> Cc: Zhoujian (jay) ; qemu-devel@nongnu.org;
> quint...@redhat.com; Huangweidong (C) ; wangxin
> (U) 
> Subject: Re: [PATCH] docs/devel/migration.txt: keep functions consistent
> with the code
> 
> * Daniel P. Berrange (berra...@redhat.com) wrote:
> > On Tue, Dec 05, 2017 at 07:58:16PM +, Dr. David Alan Gilbert wrote:
> > > * Jay Zhou (jianjay.z...@huawei.com) wrote:
> > > > Since the commit 11808bb0c422134bf09119f4aa22c59b0ce84bf3 removed
> > > > the put_buffer callback and using an iovec based write handler
> > > > instead, the docs should be sync with the code too.
> > > >
> > > > Signed-off-by: Jay Zhou 
> > >
> > > Lets check with Dan (added to cc) since he wrote 11808bb; it might
> > > be best just to rever to migration/qemu-file.h for an explanation of
> > > each function.
> >
> > The updates look ok, but I tend to think this entire section of
> > migrate.txt should be deleted, in favour of the inline APIs
> > docs in mijgration/qemu-file.h   As a developer the header file
> > is where I would look for this kind of API description. The
> > migration.txt can just point epople to the header file for API docs.

Yes, agreed.

> 
> OK, I'll do that on top of my rework to rst.
> 

It's OK for me. :)

Regards,
Jay



Re: [Qemu-devel] [Qemu-trivial] [PULL v2 00/61] Trivial patches for 2017-12-18

2017-12-17 Thread Philippe Mathieu-Daudé
>> I'm afraid this fails 'make check'. (I only tested the
>> first pullreq but if you only changed signoffs then
>> it'll still be the same):
>>
>> TEST: tests/qom-test... (pid=12208)
>>   /alpha/qom/clipper:
>> Broken pipe
>> FAIL
>> GTester: last random seed: R02S26a31a16d967b2664ad714c1c7f8e7f1
>> (pid=12214)
> 
> Oops
> 
>>   /alpha/qom/none: OK
>> FAIL: tests/qom-test
>> TEST: tests/test-hmp... (pid=12219)
>>   /alpha/hmp/clipper:
>> Broken pipe
>> FAIL
>> GTester: last random seed: R02S0c5a0f7de3fc6e9885b740c77c86eef2
>> (pid=12225)
>>   /alpha/hmp/none: OK
>>   /alpha/hmp/none+2MB: OK
>> FAIL: tests/test-hmp
>>
>> This is because qemu-system-alpha segfaults on startup:
> 
> My bad...
> 
> eede06dd70f72da489b8f968abbb7cb5445ef834 is the first bad commit
> Author: Philippe Mathieu-Daudé 
> 
> hw/alpha/typhoon: simplify using the "unimplemented" sysbus device
> 
> I'm pretty sure I run the qtests, but this was 2 months ago...
> I'll have a look.

This patch is not _trivial_ :| Let's drop it from this tree, I'll have
to rework it.

> [...]
>> There was also a minor merge conflict with the tpm pullreq
>> (both pulls change the #includes in hw/tpm/tpm_tis.c) which
>> you might fix when you respin.
> 
> Yes, I rebased the 42 patches on /master yesterday but I see you merged
> the TPM tree in your /staging, so I'll rebase there and resend the
> offending patches fixed to Michael.

Michael, I removed the "hw/alpha/typhoon" patch, and updated the
"hw/tpm: remove old i386 dependency" one: no need to modify
hw/tpm/tpm_tis.c, Marc-André Lureau already cleaned it, I did however
clean the newly added hw/tpm/tpm_emulator.c file.

The fixed tree is now available signed in the Git repository at:

  github.com:philmd/qemu.git tags/trivial-patches-2017-12-18

If this is OK to you I'll only resend the "hw/tpm: remove old i386
dependency" on the list, but if you/Peter prefer I can still resend the
whole enchilada (which is unchanged except this unique patch).

Regards,

Phil.



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH] hw/tpm: remove old i386 dependency

2017-12-17 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Stefan Berger 
---
Based-on: 1513446109-9013-33-git-send-email-stef...@linux.vnet.ibm.com
---
 hw/tpm/tpm_emulator.c| 1 -
 hw/tpm/tpm_passthrough.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
index 3ae8bf6c5a..38b6f175a1 100644
--- a/hw/tpm/tpm_emulator.c
+++ b/hw/tpm/tpm_emulator.c
@@ -33,7 +33,6 @@
 #include "sysemu/tpm_backend.h"
 #include "tpm_int.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "tpm_util.h"
 #include "tpm_ioctl.h"
 #include "migration/blocker.h"
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index 487aae2043..149fae63e6 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -29,7 +29,6 @@
 #include "sysemu/tpm_backend.h"
 #include "tpm_int.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "qapi/clone-visitor.h"
 #include "tpm_util.h"
 
-- 
2.15.1




[Qemu-devel] [PULL 42/61] amd_iommu: avoid needless includes in header file

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

instead move them to the source file

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/i386/amd_iommu.c | 5 -
 hw/i386/amd_iommu.h | 5 -
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index ad8155ca4c..eeaf0e0aa8 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -20,7 +20,10 @@
  * Cache implementation inspired by hw/i386/intel_iommu.c
  */
 #include "qemu/osdep.h"
-#include "hw/i386/amd_iommu.h"
+#include "hw/i386/pc.h"
+#include "hw/pci/msi.h"
+#include "hw/pci/pci_bus.h"
+#include "amd_iommu.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "trace.h"
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index d370ae3549..aeef802364 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -23,11 +23,6 @@
 
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/msi.h"
-#include "hw/sysbus.h"
-#include "sysemu/dma.h"
-#include "hw/i386/pc.h"
-#include "hw/pci/pci_bus.h"
 #include "hw/i386/x86-iommu.h"
 
 /* Capability registers */
-- 
2.11.0




[Qemu-devel] [PULL 09/61] memory: remove unused memory_region_set_global_locking()

2017-12-17 Thread Michael Tokarev
From: Marc-André Lureau 

This was never used since its introduction in commit
196ea13104f8 ("memory: Add global-locking property to memory
regions").

Signed-off-by: Marc-André Lureau 
Signed-off-by: Michael Tokarev 
---
 include/exec/memory.h | 12 
 memory.c  |  5 -
 2 files changed, 17 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 5ed4042f87..a4cabdf44c 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1241,18 +1241,6 @@ void memory_region_set_flush_coalesced(MemoryRegion *mr);
 void memory_region_clear_flush_coalesced(MemoryRegion *mr);
 
 /**
- * memory_region_set_global_locking: Declares the access processing requires
- *   QEMU's global lock.
- *
- * When this is invoked, accesses to the memory region will be processed while
- * holding the global lock of QEMU. This is the default behavior of memory
- * regions.
- *
- * @mr: the memory region to be updated.
- */
-void memory_region_set_global_locking(MemoryRegion *mr);
-
-/**
  * memory_region_clear_global_locking: Declares that access processing does
  * not depend on the QEMU global lock.
  *
diff --git a/memory.c b/memory.c
index e26e5a3b1d..4b41fb837b 100644
--- a/memory.c
+++ b/memory.c
@@ -2189,11 +2189,6 @@ void memory_region_clear_flush_coalesced(MemoryRegion 
*mr)
 }
 }
 
-void memory_region_set_global_locking(MemoryRegion *mr)
-{
-mr->global_locking = true;
-}
-
 void memory_region_clear_global_locking(MemoryRegion *mr)
 {
 mr->global_locking = false;
-- 
2.11.0




[Qemu-devel] [PULL 27/61] MAINTAINERS: add missing entry for include/hw/net/

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Hervé Poussineau 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 33cd4f6bed..acbff2f1bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1004,6 +1004,7 @@ Network devices
 M: Jason Wang 
 S: Odd Fixes
 F: hw/net/
+F: include/hw/net/
 F: tests/virtio-net-test.c
 T: git git://github.com/jasowang/qemu.git net
 
-- 
2.11.0




[Qemu-devel] [PULL 29/61] hw: remove "qemu/osdep.h" from header files

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
Reviewed-by: Corey Minyard 
Tested-by: Corey Minyard 
---
 include/hw/acpi/ipmi.h  | 1 -
 include/hw/cpu/core.h   | 1 -
 include/hw/i2c/ppc4xx_i2c.h | 1 -
 3 files changed, 3 deletions(-)

diff --git a/include/hw/acpi/ipmi.h b/include/hw/acpi/ipmi.h
index ab2bb29048..c38483565c 100644
--- a/include/hw/acpi/ipmi.h
+++ b/include/hw/acpi/ipmi.h
@@ -9,7 +9,6 @@
 #ifndef HW_ACPI_IPMI_H
 #define HW_ACPI_IPMI_H
 
-#include "qemu/osdep.h"
 #include "hw/acpi/aml-build.h"
 
 /*
diff --git a/include/hw/cpu/core.h b/include/hw/cpu/core.h
index 79ac79c29c..b7470644d8 100644
--- a/include/hw/cpu/core.h
+++ b/include/hw/cpu/core.h
@@ -9,7 +9,6 @@
 #ifndef HW_CPU_CORE_H
 #define HW_CPU_CORE_H
 
-#include "qemu/osdep.h"
 #include "hw/qdev.h"
 
 #define TYPE_CPU_CORE "cpu-core"
diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
index e53042f6d4..3450bda577 100644
--- a/include/hw/i2c/ppc4xx_i2c.h
+++ b/include/hw/i2c/ppc4xx_i2c.h
@@ -25,7 +25,6 @@
 #ifndef PPC4XX_I2C_H
 #define PPC4XX_I2C_H
 
-#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "hw/sysbus.h"
 #include "hw/i2c/i2c.h"
-- 
2.11.0




[Qemu-devel] [PULL 45/61] hw/ipmi: remove old i386 dependency

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Corey Minyard 
Tested-by: Corey Minyard 
---
 hw/ipmi/isa_ipmi_bt.c  | 1 -
 hw/ipmi/isa_ipmi_kcs.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c
index 2fcc3d2e7c..e098fd5206 100644
--- a/hw/ipmi/isa_ipmi_bt.c
+++ b/hw/ipmi/isa_ipmi_bt.c
@@ -26,7 +26,6 @@
 #include "hw/hw.h"
 #include "hw/ipmi/ipmi.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 /* Control register */
 #define IPMI_BT_CLR_WR_BIT 0
diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c
index 80444977a0..689587b65d 100644
--- a/hw/ipmi/isa_ipmi_kcs.c
+++ b/hw/ipmi/isa_ipmi_kcs.c
@@ -26,7 +26,6 @@
 #include "hw/hw.h"
 #include "hw/ipmi/ipmi.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 #define IPMI_KCS_OBF_BIT0
 #define IPMI_KCS_IBF_BIT1
-- 
2.11.0




[Qemu-devel] [PULL 53/61] hw/acpi/ich9: extract ACPI_PM_PROP_TCO_ENABLED from i386/pc

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

enable_tco is specific to i386/pc.

Suggested-by: Paolo Bonzini 
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Igor Mammedov 
---
 include/hw/acpi/ich9.h | 2 ++
 include/hw/i386/pc.h   | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index a352c94fde..59aeb06393 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -63,6 +63,8 @@ typedef struct ICH9LPCPMRegs {
 TCOIORegs tco_regs;
 } ICH9LPCPMRegs;
 
+#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
+
 void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
   bool smm_enabled,
   qemu_irq sci_irq);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 252526e600..3794473108 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -151,8 +151,6 @@ struct PCMachineClass {
 #define PC_MACHINE_CLASS(klass) \
 OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
 
-#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
-
 /* parallel.c */
 
 void parallel_hds_isa_init(ISABus *bus, int n);
-- 
2.11.0




[Qemu-devel] [GIT PULL for qemu-pseries] pseries: Update SLOF firmware image to qemu-slof-20171214

2017-12-17 Thread Alexey Kardashevskiy
The following changes since commit 6b092cf3141ec02fa5f533ecdcd24264febfcd76:

  pseries: Update SLOF firmware image to qemu-slof-20171214 (2017-12-18 
13:16:40 +1100)

are available in the git repository at:

  g...@github.com:aik/qemu.git tags/qemu-slof-20171214

for you to fetch changes up to 6b092cf3141ec02fa5f533ecdcd24264febfcd76:

  pseries: Update SLOF firmware image to qemu-slof-20171214 (2017-12-18 
13:16:40 +1100)




*** Note: this is not for master, this is for pseries



Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Wei Wang

On 12/18/2017 06:18 AM, Matthew Wilcox wrote:

On Sun, Dec 17, 2017 at 01:47:21PM +, Wang, Wei W wrote:

On Saturday, December 16, 2017 3:22 AM, Matthew Wilcox wrote:

On Fri, Dec 15, 2017 at 10:49:15AM -0800, Matthew Wilcox wrote:
  - xbit_clear() can't return an error.  Neither can xbit_zero().

I found the current xbit_clear implementation only returns 0, and there isn't an error to 
be returned from this function. In this case, is it better to make the function 
"void"?

Yes, I think so.

My only qualm is that I've been considering optimising the memory
consumption when an entire 1024-bit chunk is full; instead of keeping a
pointer to a 128-byte entry full of ones, store a special value in the
radix tree which means "every bit is set".

The downside is that we then have to pass GFP flags to xbit_clear() and
xbit_zero(), and they can fail.  It's not clear to me whether that's a
good tradeoff.


Yes, this will sacrifice performance. In many usages, users may set bits 
one by one, and each time when a bit is set, it needs to scan the whole 
ida_bitmap to see if all other bits are set, if so, it can free the 
ida_bitmap. I think this extra scanning of the ida_bitmap would add a 
lot overhead.






Are you suggesting to rename the current xb_ APIs to the above xbit_ names 
(with parameter changes)?

Why would we need xbit_alloc, which looks like ida_get_new, I think set/clear 
should be adequate to the current usages.

I'm intending on replacing the xb_ and ida_ implementations with this one.
It removes the preload API which makes it easier to use, and it handles
the locking for you.

But I need to get the XArray (which replaces the radix tree) finished first.


OK. It seems the new implementation wouldn't be done shortly.
Other parts of this patch series are close to the end of review, and we 
hope to make some progress soon. Would it be acceptable that we continue 
with the basic xb_ implementation (e.g. as xbitmap 1.0) for this patch 
series? and xbit_ implementation can come as xbitmap 2.0 in the future?


Best,
Wei






Re: [Qemu-devel] [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Matthew Wilcox
On Mon, Dec 18, 2017 at 10:33:00AM +0800, Wei Wang wrote:
> > My only qualm is that I've been considering optimising the memory
> > consumption when an entire 1024-bit chunk is full; instead of keeping a
> > pointer to a 128-byte entry full of ones, store a special value in the
> > radix tree which means "every bit is set".
> > 
> > The downside is that we then have to pass GFP flags to xbit_clear() and
> > xbit_zero(), and they can fail.  It's not clear to me whether that's a
> > good tradeoff.
> 
> Yes, this will sacrifice performance. In many usages, users may set bits one
> by one, and each time when a bit is set, it needs to scan the whole
> ida_bitmap to see if all other bits are set, if so, it can free the
> ida_bitmap. I think this extra scanning of the ida_bitmap would add a lot
> overhead.

Not a huge amount of overhead.  An ida_bitmap is only two cachelines,
and the loop is simply 'check each word against ~0ul', so up to 16
load/test/loop instructions.  Plus we have to do that anyway to maintain
the free tag for IDAs.

> > But I need to get the XArray (which replaces the radix tree) finished first.
> 
> OK. It seems the new implementation wouldn't be done shortly.
> Other parts of this patch series are close to the end of review, and we hope
> to make some progress soon. Would it be acceptable that we continue with the
> basic xb_ implementation (e.g. as xbitmap 1.0) for this patch series? and
> xbit_ implementation can come as xbitmap 2.0 in the future?

Yes, absolutely, I don't want to hold you up behind the XArray.



[Qemu-devel] [Bug 1735653] Re: qemu aarch64 cannot boot linux kernel v4.6+

2017-12-17 Thread Joey Jiao
Thanks Peter,
I repeat the step again and it indeed succeed for v4.9 kernel, So I think the 
./aarch64-softmmu/qemu-system-aarch64 should be the issue. The case can be 
closed now.

Thanks again.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1735653

Title:
  qemu aarch64 cannot boot linux kernel v4.6+

Status in QEMU:
  New

Bug description:
  Hi,
  I tested the latest qemu-system-aarch64 cannot boot linux mainline kernel 
since v4.6 from 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git.

  Environment info:
  # host
   ubuntu 16.04
  # qemu
   Master branch from git://git.qemu.org/qemu.git, and now the HEAD is 
c11d61271b9e6e7a1f0479ef1ca8fb55fa457a62.
  # build command
   ./configure --target-list=aarch64-softmmu
   make
  # qemu commmand
   qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -smp 4 
-m 1024 -nographic -s -kernel ~/workspace/linux/arch/arm64/boot/Image -device 
e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::-:22

  Error info:
   No error prompted, actually no any log which means I couldn't see the 
usually kernel boot message.

  Debug info:
   I did a git bisect on linux, and found with this kernel commit, qemu failed 
to boot. Parent of 406e308770a92bd33995b2e5b681e86358328bb0 can boot.
   commit 406e308770a92bd33995b2e5b681e86358328bb0
  Author: James Morse 
  Date:   Fri Feb 5 14:58:47 2016 +

  arm64: add ARMv8.2 id_aa64mmfr2 boiler plate

  ARMv8.2 adds a new feature register id_aa64mmfr2. This patch adds the
  cpu feature boiler plate used by the actual features in later patches.

  Signed-off-by: James Morse 
  Reviewed-by: Suzuki K Poulose 
  Signed-off-by: Catalin Marinas 
   The main change in the patch is to add reg_id_aa64mmfr2 in to 
arch/arm64/include/asm/cpu.h, so might it be any struct change not included in 
qemu?

  Can you please help check how to fix it?

  Thanks

  - Joey

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1735653/+subscriptions



[Qemu-devel] [PULL 11/61] Makefile: use $(MAKE) variable

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

For some systems (i.e. FreeBSD) the default 'make' is not compatible with the
GNU extensions used by QEMU makefiles.

Calling the GNU make (gmake) works, however the help displayed refers to the
host 'make' and copy/paste leads to lot of unobvious errors:

  $ gmake check-help
  [...]
   make checkRun all tests

  $ make check
  make: "Makefile" line 28: Missing dependency operator
  make: "Makefile" line 37: Need an operator
  make: "Makefile" line 41: warning: duplicate script for target 
"git-submodule-update" ignored
  make: "rules.mak" line 70: warning: duplicate script for target "%.o" ignored
  make: Unknown modifier ' '
  make: Unclosed substitution for eval modules (= missing)
  make: "tests/Makefile.include" line 24: Variable/Value missing from "export"
  make: "tests/" line 1: warning: Zero byte read from file, skipping rest of 
line.
  make: "tests/" line 1: Need an operator
  make: "Makefile" line 660: warning: duplicate script for target "ifneq" 
ignored
  make: "Makefile" line 78: warning: using previous script for "ifneq" defined 
here
  make: Fatal errors encountered -- cannot continue

Using the $(MAKE) variable, the help displayed is consistent with the 'make'
program used.

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Eric Blake 
Signed-off-by: Michael Tokarev 
---
 Makefile   |  6 +++---
 tests/Makefile.include | 20 ++--
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index 0331c182ed..1f93515677 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@ ifneq ($(realpath $(SRC_PATH)),$(realpath .))
 ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
 $(error This is an out of tree build but your source tree ($(SRC_PATH)) \
 seems to have been used for an in-tree build. You can fix this by running \
-"make distclean && rm -rf *-linux-user *-softmmu" in your source tree)
+"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
 endif
 endif
 
@@ -304,7 +304,7 @@ endif
else \
  echo "WARNING: $@ out of date.";\
fi; \
-   echo "Run \"make defconfig\" to regenerate."; \
+   echo "Run \"$(MAKE) defconfig\" to regenerate."; \
rm $@.tmp; \
  fi; \
 else \
@@ -934,4 +934,4 @@ ifdef QEMU_GA_MSI_ENABLED
 endif
@echo  ''
 endif
-   @echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose 
build'
+   @echo  '  $(MAKE) V=0|1 [targets] 0 => quiet build (default), 1 => 
verbose build'
diff --git a/tests/Makefile.include b/tests/Makefile.include
index c002352134..b4bcc872f2 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -3,21 +3,21 @@
 check-help:
@echo "Regression testing targets:"
@echo
-   @echo " make checkRun all tests"
-   @echo " make check-qtest-TARGET   Run qtest tests for given target"
-   @echo " make check-qtest  Run qtest tests"
-   @echo " make check-unit   Run qobject tests"
-   @echo " make check-speed  Run qobject speed tests"
-   @echo " make check-qapi-schemaRun QAPI schema tests"
-   @echo " make check-block  Run block tests"
-   @echo " make check-report.htmlGenerates an HTML test report"
-   @echo " make check-clean  Clean the tests"
+   @echo " $(MAKE) checkRun all tests"
+   @echo " $(MAKE) check-qtest-TARGET   Run qtest tests for given target"
+   @echo " $(MAKE) check-qtest  Run qtest tests"
+   @echo " $(MAKE) check-unit   Run qobject tests"
+   @echo " $(MAKE) check-speed  Run qobject speed tests"
+   @echo " $(MAKE) check-qapi-schemaRun QAPI schema tests"
+   @echo " $(MAKE) check-block  Run block tests"
+   @echo " $(MAKE) check-report.htmlGenerates an HTML test report"
+   @echo " $(MAKE) check-clean  Clean the tests"
@echo
@echo "Please note that HTML reports do not regenerate if the unit 
tests"
@echo "has not changed."
@echo
@echo "The variable SPEED can be set to control the gtester speed 
setting."
-   @echo "Default options are -k and (for make V=1) --verbose; they can be"
+   @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can 
be"
@echo "changed with variable GTESTER_OPTIONS."
 
 ifneq ($(wildcard config-host.mak),)
-- 
2.11.0




[Qemu-devel] [PULL 54/61] hw/display/vga: "vga.h" only contains registers defs, rename it "vga_regs.h"

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/display/vga.c | 2 +-
 hw/display/{vga.h => vga_regs.h} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename hw/display/{vga.h => vga_regs.h} (100%)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index a64a0942da..ce95b40e5c 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -24,11 +24,11 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "vga.h"
 #include "ui/console.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "vga_int.h"
+#include "vga_regs.h"
 #include "ui/pixel_ops.h"
 #include "qemu/timer.h"
 #include "hw/xen/xen.h"
diff --git a/hw/display/vga.h b/hw/display/vga_regs.h
similarity index 100%
rename from hw/display/vga.h
rename to hw/display/vga_regs.h
-- 
2.11.0




[Qemu-devel] [PULL 61/61] misc: drop old i386 dependency

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 hw/char/debugcon.c  | 1 -
 hw/intc/lm32_pic.c  | 1 -
 hw/moxie/moxiesim.c | 1 -
 hw/sparc/sun4m.c| 1 -
 hw/watchdog/wdt_ib700.c | 1 -
 5 files changed, 5 deletions(-)

diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
index 95ccec6f8b..e2abc61b04 100644
--- a/hw/char/debugcon.c
+++ b/hw/char/debugcon.c
@@ -29,7 +29,6 @@
 #include "hw/hw.h"
 #include "chardev/char-fe.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon"
 #define ISA_DEBUGCON_DEVICE(obj) \
diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c
index 09e15115fb..db6c7afc2f 100644
--- a/hw/intc/lm32_pic.c
+++ b/hw/intc/lm32_pic.c
@@ -20,7 +20,6 @@
 #include "qemu/osdep.h"
 
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "monitor/monitor.h"
 #include "hw/sysbus.h"
 #include "trace.h"
diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 3ba58481d0..3c3ba9d8c5 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -30,7 +30,6 @@
 #include "cpu.h"
 #include "hw/sysbus.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 24c2b8a555..e71648404c 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -36,7 +36,6 @@
 #include "net/net.h"
 #include "hw/boards.h"
 #include "hw/scsi/esp.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "hw/nvram/sun_nvram.h"
 #include "hw/nvram/chrp_nvram.h"
diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
index 532afe89e7..d045032bf4 100644
--- a/hw/watchdog/wdt_ib700.c
+++ b/hw/watchdog/wdt_ib700.c
@@ -25,7 +25,6 @@
 #include "sysemu/watchdog.h"
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 /*#define IB700_DEBUG 1*/
 
-- 
2.11.0




[Qemu-devel] [PULL 32/61] misc: remove duplicated includes

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

exec: housekeeping (funny since 02d0e095031)

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Peter Maydell 
Acked-by: Cornelia Huck 
Reviewed-by: Anthony PERARD 
---
 accel/tcg/translate-all.c  | 1 -
 exec.c | 3 ---
 hw/arm/spitz.c | 1 -
 hw/char/xen_console.c  | 1 -
 hw/core/machine.c  | 1 -
 hw/s390x/css.c | 1 -
 target/openrisc/exception_helper.c | 1 -
 tests/vhost-user-test.c| 1 -
 util/qemu-sockets.c| 1 -
 vl.c   | 1 -
 10 files changed, 12 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 02dfa361bb..7736257085 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -31,7 +31,6 @@
 #include "tcg.h"
 #if defined(CONFIG_USER_ONLY)
 #include "qemu.h"
-#include "exec/exec-all.h"
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include 
 #if __FreeBSD_version >= 700104
diff --git a/exec.c b/exec.c
index 03238a3449..3e7c57e914 100644
--- a/exec.c
+++ b/exec.c
@@ -18,8 +18,6 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#ifndef _WIN32
-#endif
 
 #include "qemu/cutils.h"
 #include "cpu.h"
@@ -51,7 +49,6 @@
 #include "trace-root.h"
 
 #ifdef CONFIG_FALLOCATE_PUNCH_HOLE
-#include 
 #include 
 #endif
 
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index feccdb00d3..ac1e15cbbc 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -29,7 +29,6 @@
 #include "sysemu/block-backend.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
-#include "sysemu/sysemu.h"
 #include "cpu.h"
 
 #undef REG_FMT
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index 3643dfe067..5e68326c19 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -27,7 +27,6 @@
 #include "hw/hw.h"
 #include "chardev/char-fe.h"
 #include "hw/xen/xen_backend.h"
-#include "qapi/error.h"
 
 #include 
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 36c2fb069c..c857f3f934 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -20,7 +20,6 @@
 #include "sysemu/numa.h"
 #include "qemu/error-report.h"
 #include "qemu/cutils.h"
-#include "sysemu/numa.h"
 #include "sysemu/qtest.h"
 
 static char *machine_get_accel(Object *obj, Error **errp)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index f071e1394b..1c526fd7e2 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -13,7 +13,6 @@
 #include "qapi/error.h"
 #include "qapi/visitor.h"
 #include "hw/qdev.h"
-#include "qemu/error-report.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
 #include "exec/address-spaces.h"
diff --git a/target/openrisc/exception_helper.c 
b/target/openrisc/exception_helper.c
index a8a5f69b05..6073a5b21c 100644
--- a/target/openrisc/exception_helper.c
+++ b/target/openrisc/exception_helper.c
@@ -21,7 +21,6 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
-#include "exec/exec-all.h"
 #include "exception.h"
 
 void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 4b98018478..e2c89ed376 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -21,7 +21,6 @@
 #include "libqos/libqos.h"
 #include "libqos/pci-pc.h"
 #include "libqos/virtio-pci.h"
-#include "qapi/error.h"
 
 #include "libqos/malloc-pc.h"
 #include "hw/virtio/virtio-net.h"
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index a1cf47e625..af4f01211a 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -26,7 +26,6 @@
 #include "qapi/error.h"
 #include "qemu/sockets.h"
 #include "qemu/main-loop.h"
-#include "qapi/clone-visitor.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/qobject-output-visitor.h"
 #include "qapi-visit.h"
diff --git a/vl.c b/vl.c
index fc8bd9372f..c1ba52306a 100644
--- a/vl.c
+++ b/vl.c
@@ -95,7 +95,6 @@ int main(int argc, char **argv)
 #include "sysemu/kvm.h"
 #include "sysemu/hax.h"
 #include "qapi/qobject-input-visitor.h"
-#include "qapi/qobject-input-visitor.h"
 #include "qapi-visit.h"
 #include "qapi/qmp/qjson.h"
 #include "qemu/option.h"
-- 
2.11.0




Re: [Qemu-devel] [PATCH] target-ppc: optimize cmp translation

2017-12-17 Thread David Gibson
On Sun, Dec 17, 2017 at 06:49:53AM +0100, Paolo Bonzini wrote:
> We know that only one bit (in addition to SO) is going to be set in
> the condition register, so do two movconds instead of three setconds,
> three shifts and two ORs.
> 
> For ppc64-linux-user, the code size reduction is around 5% and the
> performance improvement slightly less than 10%.  For softmmu, the
> improvement is around 5%.
> 
> Signed-off-by: Paolo Bonzini 

Applied to ppc-for-2.12, thanks.


> ---
>  target/ppc/translate.c | 29 -
>  1 file changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 998fbed848..0e9e6823a3 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -605,27 +605,22 @@ static opc_handler_t invalid_handler = {
>  static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf)
>  {
>  TCGv t0 = tcg_temp_new();
> -TCGv_i32 t1 = tcg_temp_new_i32();
> -
> -tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so);
> -
> -tcg_gen_setcond_tl((s ? TCG_COND_LT: TCG_COND_LTU), t0, arg0, arg1);
> -tcg_gen_trunc_tl_i32(t1, t0);
> -tcg_gen_shli_i32(t1, t1, CRF_LT_BIT);
> -tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t1);
> +TCGv t1 = tcg_temp_new();
> +TCGv_i32 t = tcg_temp_new_i32();
>  
> -tcg_gen_setcond_tl((s ? TCG_COND_GT: TCG_COND_GTU), t0, arg0, arg1);
> -tcg_gen_trunc_tl_i32(t1, t0);
> -tcg_gen_shli_i32(t1, t1, CRF_GT_BIT);
> -tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t1);
> +tcg_gen_movi_tl(t0, CRF_EQ);
> +tcg_gen_movi_tl(t1, CRF_LT);
> +tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU), t0, arg0, arg1, t1, 
> t0);
> +tcg_gen_movi_tl(t1, CRF_GT);
> +tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU), t0, arg0, arg1, t1, 
> t0);
>  
> -tcg_gen_setcond_tl(TCG_COND_EQ, t0, arg0, arg1);
> -tcg_gen_trunc_tl_i32(t1, t0);
> -tcg_gen_shli_i32(t1, t1, CRF_EQ_BIT);
> -tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t1);
> +tcg_gen_trunc_tl_i32(t, t0);
> +tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so);
> +tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t);
>  
>  tcg_temp_free(t0);
> -tcg_temp_free_i32(t1);
> +tcg_temp_free(t1);
> +tcg_temp_free_i32(t);
>  }
>  
>  static inline void gen_op_cmpi(TCGv arg0, target_ulong arg1, int s, int crf)

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


[Qemu-devel] [PULL 58/61] hw/misc/pvpanic: extract public API from i386/pc to "hw/misc/pvpanic.h"

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

and remove the old i386/pc dependency.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/i386/acpi-build.c  |  2 +-
 hw/misc/pvpanic.c |  9 -
 include/hw/i386/pc.h  |  3 ---
 include/hw/misc/pvpanic.h | 21 +
 4 files changed, 26 insertions(+), 9 deletions(-)
 create mode 100644 include/hw/misc/pvpanic.h

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 73519ab3ac..63bbc610eb 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -28,8 +28,8 @@
 #include "qemu/error-report.h"
 #include "hw/pci/pci.h"
 #include "qom/cpu.h"
-#include "hw/i386/pc.h"
 #include "target/i386/cpu.h"
+#include "hw/misc/pvpanic.h"
 #include "hw/timer/hpet.h"
 #include "hw/acpi/acpi-defs.h"
 #include "hw/acpi/acpi.h"
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 3a0e4ba828..b26250dec9 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -17,7 +17,7 @@
 #include "qemu/log.h"
 
 #include "hw/nvram/fw_cfg.h"
-#include "hw/i386/pc.h"
+#include "hw/misc/pvpanic.h"
 
 /* The bit of supported pv event */
 #define PVPANIC_F_PANICKED  0
@@ -25,9 +25,8 @@
 /* The pv event value */
 #define PVPANIC_PANICKED(1 << PVPANIC_F_PANICKED)
 
-#define TYPE_ISA_PVPANIC_DEVICE"pvpanic"
 #define ISA_PVPANIC_DEVICE(obj)\
-OBJECT_CHECK(PVPanicState, (obj), TYPE_ISA_PVPANIC_DEVICE)
+OBJECT_CHECK(PVPanicState, (obj), TYPE_PVPANIC)
 
 static void handle_event(int event)
 {
@@ -104,7 +103,7 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error 
**errp)
 
 uint16_t pvpanic_port(void)
 {
-Object *o = object_resolve_path_type("", TYPE_ISA_PVPANIC_DEVICE, NULL);
+Object *o = object_resolve_path_type("", TYPE_PVPANIC, NULL);
 if (!o) {
 return 0;
 }
@@ -126,7 +125,7 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void 
*data)
 }
 
 static TypeInfo pvpanic_isa_info = {
-.name  = TYPE_ISA_PVPANIC_DEVICE,
+.name  = TYPE_PVPANIC,
 .parent= TYPE_ISA_DEVICE,
 .instance_size = sizeof(PVPanicState),
 .instance_init = pvpanic_isa_initfn,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index ab84e31cce..6f77eb0665 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -306,9 +306,6 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
 void pc_system_firmware_init(MemoryRegion *rom_memory,
  bool isapc_ram_fw);
 
-/* pvpanic.c */
-uint16_t pvpanic_port(void);
-
 /* acpi-build.c */
 void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
const CPUArchIdList *apic_ids, GArray *entry);
diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h
new file mode 100644
index 00..36a54e270c
--- /dev/null
+++ b/include/hw/misc/pvpanic.h
@@ -0,0 +1,21 @@
+/*
+ * QEMU simulated pvpanic device.
+ *
+ * Copyright Fujitsu, Corp. 2013
+ *
+ * Authors:
+ * Wen Congyang 
+ * Hu Tao 
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#ifndef HW_MISC_PVPANIC_H
+#define HW_MISC_PVPANIC_H
+
+#define TYPE_PVPANIC "pvpanic"
+
+uint16_t pvpanic_port(void);
+
+#endif
-- 
2.11.0




[Qemu-devel] [PULL 43/61] misc: remove old i386 dependency

2017-12-17 Thread Michael Tokarev
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
Reviewed-by: Anthony PERARD 
---
 hw/audio/pcspk.c| 1 -
 hw/i386/xen/xen_platform.c  | 1 -
 hw/isa/vt82c686.c   | 1 -
 hw/misc/ivshmem.c   | 1 -
 hw/misc/sga.c   | 1 -
 hw/pci-bridge/pci_expander_bridge.c | 1 -
 monitor.c   | 1 -
 7 files changed, 7 deletions(-)

diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index 0206f7399b..908696d483 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -24,7 +24,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "hw/audio/soundhw.h"
 #include "audio/audio.h"
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 056b87de0b..fc8623c90b 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -26,7 +26,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/ide.h"
 #include "hw/pci/pci.h"
 #include "hw/irq.h"
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index c129985e2a..4084b32be9 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -12,7 +12,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/vt82c686.h"
 #include "hw/i2c/i2c.h"
 #include "hw/i2c/smbus.h"
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index a5a46827fe..4919011f38 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -20,7 +20,6 @@
 #include "qapi/error.h"
 #include "qemu/cutils.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
diff --git a/hw/misc/sga.c b/hw/misc/sga.c
index 03b006d6f0..97fd63f176 100644
--- a/hw/misc/sga.c
+++ b/hw/misc/sga.c
@@ -26,7 +26,6 @@
  */
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
-#include "hw/i386/pc.h"
 #include "hw/loader.h"
 #include "sysemu/sysemu.h"
 
diff --git a/hw/pci-bridge/pci_expander_bridge.c 
b/hw/pci-bridge/pci_expander_bridge.c
index 8c8ac737ad..9e799dc10f 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -16,7 +16,6 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "hw/pci/pci_bridge.h"
-#include "hw/i386/pc.h"
 #include "qemu/range.h"
 #include "qemu/error-report.h"
 #include "sysemu/numa.h"
diff --git a/monitor.c b/monitor.c
index e36fb5308d..d682eee2d8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -28,7 +28,6 @@
 #include "hw/hw.h"
 #include "monitor/qdev.h"
 #include "hw/usb.h"
-#include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "sysemu/watchdog.h"
 #include "hw/loader.h"
-- 
2.11.0




Re: [Qemu-devel] [RFC v5 07/26] monitor: unify global init

2017-12-17 Thread Peter Xu
On Sat, Dec 16, 2017 at 09:01:12AM +, Stefan Hajnoczi wrote:
> On Sat, Dec 16, 2017 at 11:52:28AM +0800, Peter Xu wrote:
> > On Fri, Dec 15, 2017 at 12:47:11PM +, Stefan Hajnoczi wrote:
> > > On Fri, Dec 15, 2017 at 04:11:41PM +0800, Peter Xu wrote:
> > > > On Wed, Dec 13, 2017 at 03:48:06PM +, Stefan Hajnoczi wrote:
> > > > > On Tue, Dec 05, 2017 at 01:51:41PM +0800, Peter Xu wrote:
> > > > > > diff --git a/vl.c b/vl.c
> > > > > > index 1ad1c04637..1ec995a6ae 100644
> > > > > > --- a/vl.c
> > > > > > +++ b/vl.c
> > > > > > @@ -3144,7 +3144,6 @@ int main(int argc, char **argv, char **envp)
> > > > > >  qemu_init_exec_dir(argv[0]);
> > > > > >  
> > > > > >  module_call_init(MODULE_INIT_QOM);
> > > > > > -monitor_init_qmp_commands();
> > > > > >  
> > > > > >  qemu_add_opts(&qemu_drive_opts);
> > > > > >  qemu_add_drive_opts(&qemu_legacy_drive_opts);
> > > > > > @@ -4690,6 +4689,8 @@ int main(int argc, char **argv, char **envp)
> > > > > >  default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
> > > > > >  default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
> > > > > >  
> > > > > > +monitor_init_globals();
> > > > > 
> > > > > Why did you move monitor_init_qmp_commands() down here?
> > > > > 
> > > > > There are many function calls between the old position and the new
> > > > > position.  Did you check all of them to make sure they don't touch the
> > > > > monitor which is now totally uninitialized?
> > > > 
> > > > Yeh, this patch is a bit hairy, but I really think we should do it.
> > > > Because there are too many places (as you have seen) that we inited
> > > > monitor stuff in different places.
> > > 
> > > But why did you move it down here?  Can you replace the
> > > monitor_init_qmp_commands() call instead?
> > 
> > I just moved it closer to (actually, right above) initializations of
> > monitors to be clear that these globals will never be touched until
> > this point.  Or do you want me to move this call exactly back to the
> > place where monitor_init_qmp_commands() was called before?  Thanks,
> 
> Hmm...now that we're discussing this patch in detail I found an ordering
> dependency:
> 
> qtest_enabled() only works after configure_accelerator(current_machine),
> so the monitor_qapi_event_init() cannot be moved to the
> monitor_init_qmp_commands() location.
> 
> Everything else has no dependencies.  I would be best to remove the
> self-contained init from vl.c:main() so we don't have to worry about
> dependencies again.  How about:
> 
> -static void __attribute__((constructor)) monitor_lock_init(void)
> +static void __attribute__((constructor)) monitor_init_ctr(void)

(Curious: why name it "ctr"?)

>  {
>  qemu_mutex_init(&monitor_lock);
> +monitor_init_qmp_commands();
> +monitor_qapi_event_init();
> +sortcmdlist();

Though I still need to init monitor iothreads, I'm not sure whether it
can be put into a constructor function since I think IOThead has not
yet been initialized now (it's done until module_call_init() in
main()).

>  }
> 
> Now vl.c:main() doesn't need to initialize the monitor.
> 
> We still need to handle the qtest_enabled() dependency:
> 
> -static QEMUClockType event_clock_type = QEMU_CLOCK_REALTIME;
> +static inline QEMUClockType event_clock_type(void)
> +{
> +return qtest_enabled() ? QEMU_CLOCK_VIRTUAL : QEMU_CLOCK_REALTIME;
> +}
> 
> This way the qtest_enabled() call is deferred until later when the
> accelerators have been initialized.

Or... to be much simpler... How about we just use my patch?  IMHO it
calls monitor_init_globals() after configure_accelerator() so
monitor_qapi_event_init() and everything else would just work as
expected?

Thanks,

-- 
Peter Xu



Re: [Qemu-devel] [GIT PULL for qemu-pseries] pseries: Update SLOF firmware image to qemu-slof-20171214

2017-12-17 Thread David Gibson
On Mon, Dec 18, 2017 at 01:26:05PM +1100, Alexey Kardashevskiy wrote:
> The following changes since commit 6b092cf3141ec02fa5f533ecdcd24264febfcd76:
> 
>   pseries: Update SLOF firmware image to qemu-slof-20171214 (2017-12-18 
> 13:16:40 +1100)
> 
> are available in the git repository at:
> 
>   g...@github.com:aik/qemu.git tags/qemu-slof-20171214
> 
> for you to fetch changes up to 6b092cf3141ec02fa5f533ecdcd24264febfcd76:
> 
>   pseries: Update SLOF firmware image to qemu-slof-20171214
>   (2017-12-18 13:16:40 +1100)

Merged, thanks.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 0/2] More SM501 improvements

2017-12-17 Thread David Gibson
On Sat, Dec 16, 2017 at 11:57:46PM +0100, BALATON Zoltan wrote:
> Two simple patches to add some more registers that were found to be
> accessed by some guests.
> 
> BALATON Zoltan (3):
>   sm501: Add panel hardware cursor registers also to read function
>   sm501: Add some more unimplemented registers
> 

Applied to ppc-for-2.12, with Philippe's suggested addition to the
commit message.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH qemu] RFC: vfio-pci: Allow mmap of MSIX BAR

2017-12-17 Thread David Gibson
On Fri, Dec 15, 2017 at 09:04:28AM -0700, Alex Williamson wrote:
> On Fri, 15 Dec 2017 15:07:31 +1100
> David Gibson  wrote:
> 
> > On Tue, Dec 12, 2017 at 04:21:31PM +1100, Alexey Kardashevskiy wrote:
> > > This makes use of a new VFIO_REGION_INFO_CAP_MSIX_MAPPABLE capability
> > > which tells that a region with MSIX data can be mapped entirely, i.e.
> > > the VFIO PCI driver won't prevent MSIX vectors area from being mapped.
> > > 
> > > This adds a "msix-no-mmap" property to the vfio-pci device, it is "true"
> > > by default and "false" for pseries-2.12+ machines.
> > > 
> > > This requites kernel's "vfio-pci: Allow mapping MSIX BAR"
> > > https://www.spinics.net/lists/kvm/msg160282.html
> > > 
> > > Signed-off-by: Alexey Kardashevskiy 
> > > ---
> > > 
> > > This is an RFC as it requires kernel headers update which is not there 
> > > yet.
> > > 
> > > I'd like to make it "msix-mmap" (without "no") but could not find a way
> > > of enabling a device property for machine versions newer than some value.
> > > 
> > > I changed 2.11 machine just for the demonstration purpose.  
> > 
> > As Alex says, the mmap()ability of the MSI-X BAR isn't really the
> > point.  The point is whether we need to intercept guest MMIOs to the
> > MSI-X region.  Still, the logic's basically right, just rename your
> > property to, say, "intercept_msix_mmio".  It would be true by default,
> > set to false by the pseries machine type.
> > 
> > I don't think you actually need to make it vary depending on the
> > version of the pseries machine type: whether the BAR is mmap()ed or
> > qemu emulated shouldn't be a guest visible change.  No PAPR guest
> > should have been directly poking the MSI-X region (ever), so we
> > shouldn't need to intercept the region even for old versions.
> 
> I have to ask, is the vfio-pci driver really the right point in the VM
> to be understanding whether the platform requires MSI-X MMIO
> emulation?  vfio-pci is only unique here in that enabling that
> emulation harms performance, but AIUI it's unused on any device and
> there may eventually be other devices affected in the same way as
> vfio-pci.  So should there be some post-realize platform code that
> disables MSI-X MemoryRegions or should the MSI-X code call out to some
> platform hook to determine whether to enable emulation?  Seems like a
> case where the impact might be unique to vfio, but the root of the
> problem is not.  Thanks,

That's a good point.  If we can reasonably do it at the level of a
generic PCI device, that would be preferable.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH v2] hw/ide: Emulate SiI3112 SATA controller

2017-12-17 Thread David Gibson
On Sat, Dec 16, 2017 at 11:42:39PM +0100, BALATON Zoltan wrote:
> This is a common generic PCI SATA controller that is also used in PCs
> but more importantly guests running on the Sam460ex board prefer this
> card and have a driver for it (unlike for other SATA controllers
> already emulated).
> 
> Signed-off-by: BALATON Zoltan 

I don't know enough about IDE to give this any more than a quick check
for anything obviously bogus looking.  So,

Reviewed-by: David Gibson 

John, can you take this through your tree, or should I take it through
the ppc tree?

> ---
> v2: Addressed review comments:
> - Replaced debug printf with trace
> - Added comments about BAR mappings and reference to data sheet
> - Maintained with the sam460ex PPC machine and not with rest of hw/ide
> 
>  MAINTAINERS|   6 +
>  default-configs/ppcemb-softmmu.mak |   1 +
>  hw/ide/Makefile.objs   |   1 +
>  hw/ide/sii3112.c   | 368 
> +
>  hw/ide/trace-events|   5 +
>  5 files changed, 381 insertions(+)
>  create mode 100644 hw/ide/sii3112.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 45e2e20..2ec47db 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -761,6 +761,12 @@ L: qemu-...@nongnu.org
>  S: Odd Fixes
>  F: hw/ppc/virtex_ml507.c
>  
> +sam460ex
> +M: BALATON Zoltan 
> +L: qemu-...@nongnu.org
> +S: Maintained
> +F: hw/ide/sii3112.c
> +
>  SH4 Machines
>  
>  R2D
> diff --git a/default-configs/ppcemb-softmmu.mak 
> b/default-configs/ppcemb-softmmu.mak
> index 13917fb..5db4618 100644
> --- a/default-configs/ppcemb-softmmu.mak
> +++ b/default-configs/ppcemb-softmmu.mak
> @@ -16,3 +16,4 @@ CONFIG_I8259=y
>  CONFIG_XILINX=y
>  CONFIG_XILINX_ETHLITE=y
>  CONFIG_SM501=y
> +CONFIG_IDE_SII3112=y
> diff --git a/hw/ide/Makefile.objs b/hw/ide/Makefile.objs
> index f0edca3..fc328ff 100644
> --- a/hw/ide/Makefile.objs
> +++ b/hw/ide/Makefile.objs
> @@ -11,3 +11,4 @@ common-obj-$(CONFIG_MICRODRIVE) += microdrive.o
>  common-obj-$(CONFIG_AHCI) += ahci.o
>  common-obj-$(CONFIG_AHCI) += ich.o
>  common-obj-$(CONFIG_ALLWINNER_A10) += ahci-allwinner.o
> +common-obj-$(CONFIG_IDE_SII3112) += sii3112.o
> diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
> new file mode 100644
> index 000..e2f5562
> --- /dev/null
> +++ b/hw/ide/sii3112.c
> @@ -0,0 +1,368 @@
> +/*
> + * QEMU SiI3112A PCI to Serial ATA Controller Emulation
> + *
> + * Copyright (C) 2017 BALATON Zoltan 
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +
> +/* For documentation on this and similar cards see:
> + * http://wiki.osdev.org/User:Quok/Silicon_Image_Datasheets
> + */
> +
> +#include 
> +#include 
> +#include "trace.h"
> +
> +#define TYPE_SII3112_PCI "sii3112"
> +#define SII3112_PCI(obj) OBJECT_CHECK(SiI3112PCIState, (obj), \
> + TYPE_SII3112_PCI)
> +
> +typedef struct SiI3112Regs {
> +uint32_t confstat;
> +uint32_t scontrol;
> +uint16_t sien;
> +uint8_t swdata;
> +} SiI3112Regs;
> +
> +typedef struct SiI3112PCIState {
> +PCIIDEState i;
> +MemoryRegion mmio;
> +SiI3112Regs regs[2];
> +} SiI3112PCIState;
> +
> +/* The sii3112_reg_read and sii3112_reg_write functions implement the
> + * Internal Register Space - BAR5 (section 6.7 of the data sheet).
> + */
> +
> +static uint64_t sii3112_reg_read(void *opaque, hwaddr addr,
> +unsigned int size)
> +{
> +SiI3112PCIState *d = opaque;
> +uint64_t val = 0;
> +
> +switch (addr) {
> +case 0x00:
> +val = d->i.bmdma[0].cmd;
> +break;
> +case 0x01:
> +val = d->regs[0].swdata;
> +break;
> +case 0x02:
> +val = d->i.bmdma[0].status;
> +break;
> +case 0x03:
> +val = 0;
> +break;
> +case 0x04 ... 0x07:
> +val = bmdma_addr_ioport_ops.read(&d->i.bmdma[0], addr - 4, size);
> +break;
> +case 0x08:
> +val = d->i.bmdma[1].cmd;
> +break;
> +case 0x09:
> +val = d->regs[1].swdata;
> +break;
> +case 0x0a:
> +val = d->i.bmdma[1].status;
> +break;
> +case 0x0b:
> +val = 0;
> +break;
> +case 0x0c ... 0x0f:
> +val = bmdma_addr_ioport_ops.read(&d->i.bmdma[1], addr - 12, size);
> +break;
> +case 0x10:
> +val = d->i.bmdma[0].cmd;
> +val |= (d->regs[0].confstat & (1UL << 11) ? (1 << 4) : 0); 
> /*SATAINT0*/
> +val |= (d->regs[1].confstat & (1UL << 11) ? (1 << 6) : 0); 
> /*SATAINT1*/
> +val |= (d->i.bmdma[1].status & BM_STATUS_INT ? (1 << 14) : 0);
> +val |= d->i.bmdma[0].status << 16;
> +val |= d->i.bmdma[1].status << 24;
> +break;
> +case 0x18:
> +val = d->i.bmdma[1].cmd;
> +val |= (d->regs[1].confstat & (1UL << 11) ? (1 << 4) : 0);
> +val |= d->i.bmdma[1].status <

Re: [Qemu-devel] [PATCH v2] ppc4xx_i2c: Implement basic I2C functions

2017-12-17 Thread David Gibson
On Sat, Dec 16, 2017 at 11:42:14PM +0100, BALATON Zoltan wrote:
> Enough to please U-Boot and make it able to detect SDRAM SPD EEPROMs
> 
> Signed-off-by: François Revol 
> Signed-off-by: BALATON Zoltan 
> Reviewed-by: David Gibson 

Applied to ppc-for-2.12, thanks.

> ---
> v2:
> - Removed DPRINTFs, no other change
> - R-b from: 
> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00193.html
> 
>  hw/i2c/ppc4xx_i2c.c | 198 
> +---
>  include/hw/i2c/ppc4xx_i2c.h |   3 +
>  2 files changed, 171 insertions(+), 30 deletions(-)
> 
> diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c
> index 5a6bde9..e873a44 100644
> --- a/hw/i2c/ppc4xx_i2c.c
> +++ b/hw/i2c/ppc4xx_i2c.c
> @@ -2,6 +2,8 @@
>   * PPC4xx I2C controller emulation
>   *
>   * Copyright (c) 2007 Jocelyn Mayer
> + * Copyright (c) 2012 François Revol
> + * Copyright (c) 2016 BALATON Zoltan
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a 
> copy
>   * of this software and associated documentation files (the "Software"), to 
> deal
> @@ -25,26 +27,118 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
> +#include "qemu/log.h"
>  #include "cpu.h"
>  #include "hw/hw.h"
>  #include "hw/i2c/ppc4xx_i2c.h"
>  
> -/*#define DEBUG_I2C*/
> +#define PPC4xx_I2C_MEM_SIZE 0x12
>  
> -#define PPC4xx_I2C_MEM_SIZE 0x11
> +#define IIC_CNTL_PT (1 << 0)
> +#define IIC_CNTL_READ   (1 << 1)
> +#define IIC_CNTL_CHT(1 << 2)
> +#define IIC_CNTL_RPST   (1 << 3)
> +
> +#define IIC_STS_PT  (1 << 0)
> +#define IIC_STS_ERR (1 << 2)
> +#define IIC_STS_MDBS(1 << 5)
> +
> +#define IIC_EXTSTS_XFRA (1 << 0)
> +
> +#define IIC_XTCNTLSS_SRST   (1 << 0)
> +
> +static void ppc4xx_i2c_reset(DeviceState *s)
> +{
> +PPC4xxI2CState *i2c = PPC4xx_I2C(s);
> +
> +/* FIXME: Should also reset bus?
> + *if (s->address != ADDR_RESET) {
> + *i2c_end_transfer(s->bus);
> + *}
> + */
> +
> +i2c->mdata = 0;
> +i2c->lmadr = 0;
> +i2c->hmadr = 0;
> +i2c->cntl = 0;
> +i2c->mdcntl = 0;
> +i2c->sts = 0;
> +i2c->extsts = 0x8f;
> +i2c->sdata = 0;
> +i2c->lsadr = 0;
> +i2c->hsadr = 0;
> +i2c->clkdiv = 0;
> +i2c->intrmsk = 0;
> +i2c->xfrcnt = 0;
> +i2c->xtcntlss = 0;
> +i2c->directcntl = 0x0f;
> +i2c->intr = 0;
> +}
> +
> +static inline bool ppc4xx_i2c_is_master(PPC4xxI2CState *i2c)
> +{
> +return true;
> +}
>  
>  static uint64_t ppc4xx_i2c_readb(void *opaque, hwaddr addr, unsigned int 
> size)
>  {
>  PPC4xxI2CState *i2c = PPC4xx_I2C(opaque);
>  uint64_t ret;
>  
> -#ifdef DEBUG_I2C
> -printf("%s: addr " TARGET_FMT_plx "\n", __func__, addr);
> -#endif
>  switch (addr) {
>  case 0x00:
> -/*i2c_readbyte(&i2c->mdata);*/
>  ret = i2c->mdata;
> +if (ppc4xx_i2c_is_master(i2c)) {
> +ret = 0xff;
> +
> +if (!(i2c->sts & IIC_STS_MDBS)) {
> +qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Trying to read "
> +  "without starting transfer\n",
> +  TYPE_PPC4xx_I2C, __func__);
> +} else {
> +int pending = (i2c->cntl >> 4) & 3;
> +
> +/* get the next byte */
> +int byte = i2c_recv(i2c->bus);
> +
> +if (byte < 0) {
> +qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: read failed "
> +  "for device 0x%02x\n", TYPE_PPC4xx_I2C,
> +  __func__, i2c->lmadr);
> +ret = 0xff;
> +} else {
> +ret = byte;
> +/* Raise interrupt if enabled */
> +/*ppc4xx_i2c_raise_interrupt(i2c)*/;
> +}
> +
> +if (!pending) {
> +i2c->sts &= ~IIC_STS_MDBS;
> +/*i2c_end_transfer(i2c->bus);*/
> +/*} else if (i2c->cntl & (IIC_CNTL_RPST | IIC_CNTL_CHT)) {*/
> +} else if (pending) {
> +/* current smbus implementation doesn't like
> +   multibyte xfer repeated start */
> +i2c_end_transfer(i2c->bus);
> +if (i2c_start_transfer(i2c->bus, i2c->lmadr >> 1, 1)) {
> +/* if non zero is returned, the adress is not valid 
> */
> +i2c->sts &= ~IIC_STS_PT;
> +i2c->sts |= IIC_STS_ERR;
> +i2c->extsts |= IIC_EXTSTS_XFRA;
> +} else {
> +/*i2c->sts |= IIC_STS_PT;*/
> +i2c->sts |= IIC_STS_MDBS;
> +i2c->sts &= ~IIC_STS_ERR;
> +i2c->extsts = 0;
> +}
> +}
> +pending--;
> +i2c->cntl = (i2c->cn

[Qemu-devel] [Bug 1738691] [NEW] Guest kernel crashes with kvm_pr on POWER8

2017-12-17 Thread Timothy Pearson
Public bug reported:

When attempting to use the kvm_pr module with QEMU 2.10 on a POWER8
host, Debian and Ubuntu guests hang and show crashes.

Host kernel is 4.14.  Issue is observed with host kernels 4.9 and 4.13
as well; no other host kernels were tested.

Is this the correct place to report a kvm_pr bug?

Output from Ubuntu 17.10 guest:

Quiescing Open Firmware ...
Booting Linux via __start() @ 0x0200 ...
[0.00] Page sizes from device-tree:
[0.00] base_shift=12: shift=12, sllp=0x, avpnm=0x, 
tlbiel=1, penc=0
[0.00] base_shift=16: shift=16, sllp=0x0110, avpnm=0x, 
tlbiel=1, penc=1
[0.00] base_shift=24: shift=24, sllp=0x0100, avpnm=0x0001, 
tlbiel=0, penc=0
[0.00] Using 1TB segments
[0.00] Initializing hash mmu with SLB
[0.00] Linux version 4.13.0-16-generic (buildd@bos01-ppc64el-029) (gcc 
version 7.2.0 (Ubuntu 7.2.0-8ubuntu2)) #19-Ubuntu SMP Wed Oct 11 18:37:02 UTC 
2017 (Ubuntu 4.13.0-16.19-generic 4.13.4)
[0.00] Found initrd at 0xc3b0:0xc48cf68b
[0.00] Using pSeries machine description
[0.00] bootconsole [udbg0] enabled
[0.00] Partition configured for 2 cpus.
[0.00] CPU maps initialized for 1 thread per core
 -> smp_release_cpus()
spinning_secondaries = 1
 <- smp_release_cpus()
[0.00] -
[0.00] ppc64_pft_size= 0x19
[0.00] phys_mem_size = 0x1
[0.00] dcache_bsize  = 0x80
[0.00] icache_bsize  = 0x80
[0.00] cpu_features  = 0x077c7a6c18500249
[0.00]   possible= 0x5fff18500649
[0.00]   always  = 0x18100040
[0.00] cpu_user_features = 0xdc0065c2 0xae00
[0.00] mmu_features  = 0x7c006001
[0.00] firmware_features = 0x415a445f
[0.00] htab_hash_mask= 0x3
[0.00] -
[0.00] numa:   NODE_DATA [mem 0xfffd7c80-0xfffe3fff]
[0.00] PCI host bridge /pci@8002000  ranges:
[0.00]   IO 0x2000..0x2000 -> 0x
[0.00]  MEM 0x20008000..0x2000 -> 0x8000
[0.00]  MEM 0x2100..0x21ff -> 0x2100
[0.00] PPC64 nvram contains 65536 bytes
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x]
[0.00]   DMA32empty
[0.00]   Normal   empty
[0.00]   Device   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x]
[0.00] Initmem setup node 0 [mem 0x-0x]
[0.00] percpu: Embedded 4 pages/cpu @c000ffe0 s162840 r0 d99304 
u524288
[0.00] Built 1 zonelists in Node order, mobility grouping on.  Total 
pages: 65472
[0.00] Policy zone: DMA
[0.00] Kernel command line: BOOT_IMAGE=/install/vmlinux 
file=/cdrom/preseed/ubuntu-server.seed no_timer_check printk.time=1 ---
[0.00] PID hash table entries: 4096 (order: -1, 32768 bytes)
[0.00] Memory: 4070016K/4194304K available (12800K kernel code, 2048K 
rwdata, 3456K rodata, 4608K init, 3021K bss, 124288K reserved, 0K cma-reserved)
[0.00] random: get_random_u64 called from 
cache_random_seq_create+0x80/0x180 with crng_init=0
[0.00] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[0.00] ftrace: allocating 33631 entries in 13 pages
[0.00] Hierarchical RCU implementation.
[0.00]  RCU restricting CPUs from NR_CPUS=2048 to nr_cpu_ids=2.
[0.00]  Tasks RCU enabled.
[0.00] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[0.00] NR_IRQS: 512, nr_irqs: 512, preallocated irqs: 16
[0.06] clocksource: timebase: mask: 0x max_cycles: 
0x761537d007, max_idle_ns: 440795202126 ns
[0.000696] clocksource: timebase mult[1f4] shift[24] registered
[0.001189] Console: colour dummy device 80x25
[0.001500] console [hvc0] enabled
[0.001500] console [hvc0] enabled
[0.001751] bootconsole [udbg0] disabled
[0.001751] bootconsole [udbg0] disabled
[0.002142] pid_max: default: 32768 minimum: 301
[0.002358] Security Framework initialized
[0.002377] Yama: becoming mindful.
[0.002466] AppArmor: AppArmor initialized
[0.007008] Dentry cache hash table entries: 524288 (order: 6, 4194304 bytes)
[0.009037] Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
[0.009144] Mount-cache hash table entries: 8192 (order: 0, 65536 bytes)
[0.009282] Mountpoint-cache hash table entries: 8192 (order: 0, 65536 bytes)
[0.011066] EEH: pSeries platform initialized
[0.011137] POWER8 performance monitor hardware support regis

  1   2   >