Re: [Qemu-devel] [PATCH] opencores_eth: flush queue whenever can_receive can go from false to true

2014-02-03 Thread Paolo Bonzini

Il 03/02/2014 05:20, Max Filippov ha scritto:

The following registers control whether MAC can receive frames:
- MODER.RXEN bit that enables/disables receiver;
- TX_BD_NUM register that specifies number of RX descriptors.
Notify QEMU networking core when the MAC is ready to receive frames.
Discard frame and raise BUSY interrupt when the frame arrives but the
current RX descriptor is not empty.

Signed-off-by: Max Filippov jcmvb...@gmail.com
---
 hw/net/opencores_eth.c | 33 +++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 4118d54..4a44304 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -169,6 +169,7 @@ enum {
 };

 enum {
+INT_SOURCE_BUSY = 0x10,
 INT_SOURCE_RXB = 0x4,
 INT_SOURCE_TXB = 0x1,
 };
@@ -351,8 +352,7 @@ static int open_eth_can_receive(NetClientState *nc)
 OpenEthState *s = qemu_get_nic_opaque(nc);

 return GET_REGBIT(s, MODER, RXEN) 
-(s-regs[TX_BD_NUM]  0x80) 
-(rx_desc(s)-len_flags  RXD_E);
+(s-regs[TX_BD_NUM]  0x80);
 }

 static ssize_t open_eth_receive(NetClientState *nc,
@@ -402,6 +402,12 @@ static ssize_t open_eth_receive(NetClientState *nc,
 desc *desc = rx_desc(s);
 size_t copy_size = GET_REGBIT(s, MODER, HUGEN) ? 65536 : maxfl;

+if (!(desc-len_flags  RXD_E)) {
+open_eth_int_source_write(s,
+s-regs[INT_SOURCE] | INT_SOURCE_BUSY);
+return size;
+}
+
 desc-len_flags = ~(RXD_CF | RXD_M | RXD_OR |
 RXD_IS | RXD_DN | RXD_TL | RXD_SF | RXD_CRC | RXD_LC);

@@ -551,6 +557,15 @@ static uint64_t open_eth_reg_read(void *opaque,
 return v;
 }

+static void open_eth_notify_can_receive(OpenEthState *s)
+{
+NetClientState *nc = qemu_get_queue(s-nic);
+
+if (open_eth_can_receive(nc)) {
+qemu_flush_queued_packets(nc);
+}
+}
+
 static void open_eth_ro(OpenEthState *s, uint32_t val)
 {
 }
@@ -567,6 +582,7 @@ static void open_eth_moder_host_write(OpenEthState *s, 
uint32_t val)

 if (set  MODER_RXEN) {
 s-rx_desc = s-regs[TX_BD_NUM];
+open_eth_notify_can_receive(s);
 }
 if (set  MODER_TXEN) {
 s-tx_desc = 0;
@@ -592,6 +608,18 @@ static void open_eth_int_mask_host_write(OpenEthState *s, 
uint32_t val)
 s-regs[INT_SOURCE]  s-regs[INT_MASK]);
 }

+static void open_eth_tx_bd_num_host_write(OpenEthState *s, uint32_t val)
+{
+if (val  0x80) {
+bool enable = s-regs[TX_BD_NUM] == 0x80;
+
+s-regs[TX_BD_NUM] = val;
+if (enable) {
+open_eth_notify_can_receive(s);
+}
+}
+}
+
 static void open_eth_mii_command_host_write(OpenEthState *s, uint32_t val)
 {
 unsigned fiad = GET_REGFIELD(s, MIIADDRESS, FIAD);
@@ -630,6 +658,7 @@ static void open_eth_reg_write(void *opaque,
 [MODER] = open_eth_moder_host_write,
 [INT_SOURCE] = open_eth_int_source_host_write,
 [INT_MASK] = open_eth_int_mask_host_write,
+[TX_BD_NUM] = open_eth_tx_bd_num_host_write,
 [MIICOMMAND] = open_eth_mii_command_host_write,
 [MIITX_DATA] = open_eth_mii_tx_host_write,
 [MIISTATUS] = open_eth_ro,



Reviewed-by: Paolo Bonzini pbonz...@redhat.com



Re: [Qemu-devel] [PULL v4 05/12] milkymist-vgafb: swap pixel data in source buffer

2014-02-03 Thread Paolo Bonzini

Il 01/02/2014 18:57, Peter Maydell ha scritto:

 In commit fc97bb5ba3e7239c0b6d24095df6784868dfebbf the lduw_raw() call was
 eliminated. But we are reading from the target buffer a 16-bit value, which
 is in big-endian format. Therefore, swap the bytes if we are building for a
 little-endian host.

Paolo, can you remember why you included this change in that commit?
It purports to just be moving the display devices around but it seems to
have included the introduction of this bug, and also a removal of a lduw_raw()
call from (what is now) hw/display/blizzard_template.h which I suspect is
also wrong...



Most likely it was an incorrectly squashed patch.

Paolo



Re: [Qemu-devel] [PATCH 0/2] Use g_new() friends where that makes obvious sense

2014-02-03 Thread Markus Armbruster
Peter Maydell peter.mayd...@linaro.org writes:

 On 31 January 2014 15:53, Markus Armbruster arm...@redhat.com wrote:
 PATCH 1/2 fixes a bug found by compiling the original PATCH 2/2.
 Evidence for my claim that PATCH 2/2 lets the compiler catch more type
 errors :)

 Markus Armbruster (2):
   qga: Fix memory allocation pasto
   Use g_new()  friends where that makes obvious sense

  186 files changed, 376 insertions(+), 415 deletions(-)

 No objection in principle, but I think this is going to be
 hideous merge pain since it touches a huge range of files.
 Could you split it up into separate patches that could
 reasonably go in via the appropriate submaintainer trees?

No merge pain at all if you simply rerun the included Coccinelle patch!

Splitting the patch may shift some pain from the choke point (you) to
submaintainers and me.  I don't mind the splitting pain.  I do mind the
chase the nominal maintainer of obscure corner pain.

If you really want it split: what about splitting off just the busy
and/or well-maintained subsystems?



[Qemu-devel] qemu-iotest 077 does not terminate with VMDK

2014-02-03 Thread Peter Lieven

Hi,

has anyone tried iotest 77 (RMW) with VMDK?

for me it does not terminate.

Peter




Re: [Qemu-devel] [PATCH 2/2] Use g_new() friends where that makes obvious sense

2014-02-03 Thread Markus Armbruster
Eric Blake ebl...@redhat.com writes:

 On 01/31/2014 08:53 AM, Markus Armbruster wrote:
 g_new(T, n) is safer than g_malloc(sizeof(T) * n) for two reasons.
 One, it catches multiplication overflowing size_t.  Two, it returns
 T * rather than void *, which lets the compiler catch more type
 errors.
 
 Patch created with the following Coccinelle patch, with two hunks
 dropped from the result:
 

 Looks like a reasonable formula for replacement.

 
 Signed-off-by: Markus Armbruster arm...@redhat.com
 ---

  186 files changed, 375 insertions(+), 414 deletions(-)

 Is there any easy way to enforce that this style does not creep back
 into the code base?  In other words, can you do a followup patch to
 checkpatch.pl that flags use of g_malloc[0]?

There are many, many uses of g_malloc(), g_malloc0() and g_realloc()
left.  The ones with a size argument of the form sizeof(E) * N could be
rewritten, too.  But there are plenty of others.

For the sizeof(E) * N cases, rewriting may not be an improvement.  The
pattern p = malloc(sizeof(*p)) is pretty idiomatic.

Having checkpatch.pl match the unwanted patterns sizeof(T), sizeof(T)*N,
and their variations seems infeasible to me, because deciding whether T
is a type is beyond its capabilities.

Ideas?

 @@ -658,7 +658,7 @@ int qcow2_snapshot_list(BlockDriverState *bs, 
 QEMUSnapshotInfo **psn_tab)
  return s-nb_snapshots;
  }
  
 -sn_tab = g_malloc0(s-nb_snapshots * sizeof(QEMUSnapshotInfo));
 +sn_tab = g_new0(QEMUSnapshotInfo, s-nb_snapshots);
  for(i = 0; i  s-nb_snapshots; i++) {

 Should checkpatch.pl care about the spacing after 'for'?  Then again,
 it's unrelated to your conversion, so omitting a whitespace cleanup from
 this patch doesn't hurt.

It already does as far as I can tell, but as Richard said, it only
complains about style violations in changed lines.

 +++ b/hw/char/virtio-serial-bus.c
 @@ -921,10 +921,8 @@ static void
 virtio_serial_device_realize(DeviceState *dev, Error **errp)
  QTAILQ_INIT(vser-ports);
  
  vser-bus.max_nr_ports = vser-serial.max_virtserial_ports;
 -vser-ivqs = g_malloc(vser-serial.max_virtserial_ports
 -  * sizeof(VirtQueue *));
 -vser-ovqs = g_malloc(vser-serial.max_virtserial_ports
 -  * sizeof(VirtQueue *));
 +vser-ivqs = g_new(VirtQueue *, vser-serial.max_virtserial_ports);
 +vser-ovqs = g_new(VirtQueue *, vser-serial.max_virtserial_ports);

 I'm impressed at what Coccinelle can rewrite!

Yup.  It's quite capable, but its language is weird, and its error
messages can compete with C++ is mysteriousness (thankfully not in
length).

 +++ b/ui/keymaps.c
 @@ -107,7 +107,7 @@ static kbd_layout_t *parse_keyboard_layout(const
 name2keysym_t *table,
  }
  
  if (!k)
 -k = g_malloc0(sizeof(kbd_layout_t));
 +k = g_new0(kbd_layout_t, 1);
  
  for(;;) {

 Fixing tab damage while you are at it - nice.  And just noticed this is
 another instance of no space after 'for', but not worth fixing in this
 patch if checkpatch.pl is happy.

 I'm trusting coccinelle, and only glanced through random spots of the
 patch; but where I looked, I didn't find any problems in the conversion.

 I don't know if that means we should add:
 Reviewed-by: Eric Blake ebl...@redhat.com

Thank you!



[Qemu-devel] GDB info registers vs. monitor info registers

2014-02-03 Thread Sebastian Huber

Hello,

I have some trouble to implement a proper system reset for SPARC/LEON.  It 
seems that a Qemu system reset doesn't propagate the state change thoroughly.


(gdb) monitor system_reset
(gdb) info registers
g0 0x0  0
g1 0x40001fa8   1073749928
g2 0x40054f20   1074089760
g3 0x6  6
g4 0x6  6
g5 0x0  0
g6 0x0  0
g7 0x4005d800   1074124800
o0 0x0  0
o1 0x4002c614   1073923604
o2 0x1  1
o3 0x0  0
o4 0x8  8
o5 0x4004c37c   1074054012
sp 0x4005aad8   0x4005aad8
o7 0x4004f6bc   1074067132
l0 0xf3c3   -218103613
l1 0x40013490   1073820816
l2 0x40013494   1073820820
l3 0x80 128
l4 0xf3c3   -218103613
l5 0xf3c3   -218103613
l6 0x3e 62
l7 0x3f 63
i0 0x40054f20   1074089760
i1 0x43fffda8   1140850088
i2 0x1  1
i3 0x0  0
i4 0x55493120   1430860064
i5 0x100256
fp 0x4005abc0   0x4005abc0
i7 0x4003a11c   1073979676
y  0x0  0
psr0xf34000e3   [ #0 #1 ET PS S #22 #24 #25 #28 #29 #30 #31 ]
wim0x20 32
tbr0x4060   1073741920
pc 0x40001fb0   0x40001fb0 Init(rtems_task_argument)+8
npc0x40001fb4   0x40001fb4 Init(rtems_task_argument)+12
fsr0x0  [ ]
csr0x0  0
(gdb) monitor info registers
pc: 4000  npc: 4004
%g0-7:        
%o0-7:  0001 0002 0003 0004 0005 0006 0007
%l0-7: 0008 0009 000a 000b 000c 000d 000e 000f
%i0-7: 0010 0011 0012 0013 0014 0015 0016 0017
%f00:     
%f08:     
%f16:     
%f24:     
psr: f3c0 (icc:  SPE: SP-) wim: 0001
fsr:  y: 

A monitor system_reset triggers a call to main_cpu_reset 
(hw/sparc/leon3.c:51) and the CPUSPARCState is set up correctly, but via GDB I 
see no state change and the program executes as if nothing happened.


Does this work as intended?

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



Re: [Qemu-devel] [PATCH 0/2] qtest: don't leak pid files and UNIX domain sockets

2014-02-03 Thread Gerd Hoffmann
  Hi,

  ERROR:/home/petmay01/linaro/qemu-for-merges/tests/libqtest.c:71:init_socket:
  assertion failed (ret != -1): (-1 != -1)
  FAIL
  GTester: last random seed: R02S79ea313790bc9a8b21d9af5ed55c2fff
  (pid=5080)
/i386/qom/pc:OK
/i386/qom/isapc: OK
/i386/qom/q35:   OK
  FAIL: tests/qom-test
 
  but this patch series doesn't actually say that's what it's for,
  so does it fix that kind of error?
 
 I might help but I'm not sure.  The assertion failure you posted
 happened on Gerd's buildslaves, I haven't reproduced it myself and
 don't really understand what's wrong there.

It seems to have stopped happening on the buildslaves,
not sure whenever this is just luck or whenever it was
fixed by some patch.

 However, I noticed that my /tmp is getting cluttered with pid files
 and UNIX domain sockets from qtest.  I also noticed that QEMU
 processes are left running (this is not fixed by my series) when tests
 fail.
 
 So this series at least stops us from cluttering /tmp.

Removing the clutter from /tmp unbroke the buildslaves, so not
cluttering tmp certainly is a good thing.

cheers,
  Gerd





Re: [Qemu-devel] [PATCH 0/2] Use g_new() friends where that makes obvious sense

2014-02-03 Thread Peter Maydell
On 3 February 2014 08:40, Markus Armbruster arm...@redhat.com wrote:
 Peter Maydell peter.mayd...@linaro.org writes:
 On 31 January 2014 15:53, Markus Armbruster arm...@redhat.com wrote:
  186 files changed, 376 insertions(+), 415 deletions(-)

 No objection in principle, but I think this is going to be
 hideous merge pain since it touches a huge range of files.
 Could you split it up into separate patches that could
 reasonably go in via the appropriate submaintainer trees?

 No merge pain at all if you simply rerun the included Coccinelle patch!

Yes, but that requires me to find, install, learn about and use
Coccinelle.

 Splitting the patch may shift some pain from the choke point (you) to
 submaintainers and me.  I don't mind the splitting pain.  I do mind the
 chase the nominal maintainer of obscure corner pain.

 If you really want it split: what about splitting off just the busy
 and/or well-maintained subsystems?

Yes, that's fine. You can put the miscellaneous leftovers parts
through trivial if you like. I just dislike single touches-entire-world
patches if they're not absolutely necessary.

thanks
-- PMM



[Qemu-devel] [PATCH] sparc/leon3: Initialize stack pointer

2014-02-03 Thread Sebastian Huber
A lot of real world LEON3 systems are shipped with the GRMON boot
loader.  This boot loader initializes the stack pointer with the end of
RAM address.  The application can use this to detect the RAM size of a
particular board variant.

Signed-off-by: Sebastian Huber sebastian.hu...@embedded-brains.de
---
 hw/sparc/leon3.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index c583c3d..c16e9e4 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -45,6 +45,7 @@
 typedef struct ResetData {
 SPARCCPU *cpu;
 uint32_t  entry;/* save kernel entry in case of reset */
+target_ulong sp;/* initial stack pointer */
 } ResetData;
 
 static void main_cpu_reset(void *opaque)
@@ -58,6 +59,7 @@ static void main_cpu_reset(void *opaque)
 cpu-halted = 0;
 env-pc = s-entry;
 env-npc= s-entry + 4;
+env-regbase[6] = s-sp;
 }
 
 void leon3_irq_ack(void *irq_manager, int intno)
@@ -133,6 +135,7 @@ static void leon3_generic_hw_init(QEMUMachineInitArgs *args)
 /* Reset data */
 reset_info= g_malloc0(sizeof(ResetData));
 reset_info-cpu   = cpu;
+reset_info-sp= 0x4000 + ram_size;
 qemu_register_reset(main_cpu_reset, reset_info);
 
 /* Allocate IRQ manager */
-- 
1.7.7




[Qemu-devel] [PATCHv9 2/5] qemu-iotests: change _supported_proto to file for various tests

2014-02-03 Thread Peter Lieven
all these tests do anything of the following and thus fail with any
protocol other than file:
 - the tests use rm, cp or mv shell commands which only work on file
 - the tests use qcow2.py
 - the images construct new filenames (e.g. backing file names) and
   the logic is broken for anything else than file

Signed-off-by: Peter Lieven p...@kamp.de
---
 tests/qemu-iotests/013 |2 +-
 tests/qemu-iotests/014 |2 +-
 tests/qemu-iotests/018 |2 +-
 tests/qemu-iotests/019 |2 +-
 tests/qemu-iotests/023 |2 +-
 tests/qemu-iotests/024 |2 +-
 tests/qemu-iotests/026 |2 +-
 tests/qemu-iotests/028 |2 +-
 tests/qemu-iotests/031 |2 +-
 tests/qemu-iotests/034 |2 +-
 tests/qemu-iotests/036 |2 +-
 tests/qemu-iotests/037 |2 +-
 tests/qemu-iotests/038 |2 +-
 tests/qemu-iotests/039 |2 +-
 tests/qemu-iotests/043 |2 +-
 tests/qemu-iotests/046 |2 +-
 tests/qemu-iotests/052 |2 +-
 tests/qemu-iotests/054 |2 +-
 tests/qemu-iotests/059 |2 +-
 tests/qemu-iotests/060 |2 +-
 tests/qemu-iotests/061 |2 +-
 tests/qemu-iotests/063 |2 +-
 tests/qemu-iotests/069 |2 +-
 tests/qemu-iotests/071 |2 +-
 tests/qemu-iotests/072 |2 +-
 25 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/tests/qemu-iotests/013 b/tests/qemu-iotests/013
index 389f4b8..ea3cab9 100755
--- a/tests/qemu-iotests/013
+++ b/tests/qemu-iotests/013
@@ -41,7 +41,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # much of this could be generic for any format supporting compression.
 _supported_fmt qcow qcow2
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 
 TEST_OFFSETS=0 4294967296
diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014
index 0edeb4b..b23c2db 100755
--- a/tests/qemu-iotests/014
+++ b/tests/qemu-iotests/014
@@ -43,7 +43,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # much of this could be generic for any format supporting snapshots
 _supported_fmt qcow2
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 
 TEST_OFFSETS=0 4294967296
diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018
index 6f7f054..d8a7d43 100755
--- a/tests/qemu-iotests/018
+++ b/tests/qemu-iotests/018
@@ -41,7 +41,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # Any format supporting backing files
 _supported_fmt qcow qcow2 vmdk qed
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 _unsupported_imgopts subformat=monolithicFlat subformat=twoGbMaxExtentFlat
 
diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index b43e70f..e67445c 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -45,7 +45,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # Any format supporting backing files
 _supported_fmt qcow qcow2 vmdk qed
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 _unsupported_imgopts subformat=monolithicFlat \
  subformat=twoGbMaxExtentFlat \
diff --git a/tests/qemu-iotests/023 b/tests/qemu-iotests/023
index 090ed23..9ad06b9 100755
--- a/tests/qemu-iotests/023
+++ b/tests/qemu-iotests/023
@@ -41,7 +41,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # much of this could be generic for any format supporting compression.
 _supported_fmt qcow qcow2
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 
 TEST_OFFSETS=0 4294967296
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
index be974f0..9bf99e1 100755
--- a/tests/qemu-iotests/024
+++ b/tests/qemu-iotests/024
@@ -43,7 +43,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # Currently only qcow2 and qed support rebasing
 _supported_fmt qcow2 qed
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 
 CLUSTER_SIZE=65536
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index c9c5f83..df2884b 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -42,7 +42,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # Currently only qcow2 supports rebasing
 _supported_fmt qcow2
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 _default_cache_mode writethrough
 _supported_cache_modes writethrough none
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 93a9fa6..a99e4fa 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -45,7 +45,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 # Any format supporting backing files except vmdk and qcow which do not support
 # smaller backing files.
 _supported_fmt qcow2 qed
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 
 # Choose a size that is not necessarily a cluster size multiple for image
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index c9070b0..1d920ea 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -41,7 +41,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 
 # This tests qcow2-specific low-level functionality
 _supported_fmt qcow2
-_supported_proto generic
+_supported_proto file
 _supported_os Linux
 
 

[Qemu-devel] [PATCHv9 1/5] block: add native support for NFS

2014-02-03 Thread Peter Lieven
This patch adds native support for accessing images on NFS
shares without the requirement to actually mount the entire
NFS share on the host.

NFS Images can simply be specified by an url of the form:
nfs://host/export/filename[?param=value[param2=value2[...]]]

For example:
qemu-img create -f qcow2 nfs://10.0.0.1/qemu-images/test.qcow2

You need LibNFS from Ronnie Sahlberg available at:
   git://github.com/sahlberg/libnfs.git
for this to work.

During configure it is automatically probed for libnfs and support
is enabled on-the-fly. You can forbid or enforce libnfs support
with --disable-libnfs or --enable-libnfs respectively.

Due to NFS restrictions you might need to execute your binaries
as root, allow them to open priviledged ports (1024) or specify
insecure option on the NFS server.

For additional information on ROOT vs. non-ROOT operation and URL
format + parameters see:
   https://raw.github.com/sahlberg/libnfs/master/README

Supported by qemu are the uid, gid and tcp-syncnt URL parameters.

LibNFS currently support NFS version 3 only.

Signed-off-by: Peter Lieven p...@kamp.de
---
 MAINTAINERS |5 +
 block/Makefile.objs |1 +
 block/nfs.c |  439 +++
 configure   |   26 +++
 qapi-schema.json|1 +
 5 files changed, 472 insertions(+)
 create mode 100644 block/nfs.c

diff --git a/MAINTAINERS b/MAINTAINERS
index fb53242..f8411f9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -936,6 +936,11 @@ M: Peter Lieven p...@kamp.de
 S: Supported
 F: block/iscsi.c
 
+NFS
+M: Peter Lieven p...@kamp.de
+S: Maintained
+F: block/nfs.c
+
 SSH
 M: Richard W.M. Jones rjo...@redhat.com
 S: Supported
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 4e8c91e..e254a21 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -12,6 +12,7 @@ block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
 ifeq ($(CONFIG_POSIX),y)
 block-obj-y += nbd.o nbd-client.o sheepdog.o
 block-obj-$(CONFIG_LIBISCSI) += iscsi.o
+block-obj-$(CONFIG_LIBNFS) += nfs.o
 block-obj-$(CONFIG_CURL) += curl.o
 block-obj-$(CONFIG_RBD) += rbd.o
 block-obj-$(CONFIG_GLUSTERFS) += gluster.o
diff --git a/block/nfs.c b/block/nfs.c
new file mode 100644
index 000..ef731f0
--- /dev/null
+++ b/block/nfs.c
@@ -0,0 +1,439 @@
+/*
+ * QEMU Block driver for native access to files on NFS shares
+ *
+ * Copyright (c) 2014 Peter Lieven p...@kamp.de
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include config-host.h
+
+#include poll.h
+#include qemu-common.h
+#include qemu/config-file.h
+#include qemu/error-report.h
+#include block/block_int.h
+#include trace.h
+#include qemu/iov.h
+#include qemu/uri.h
+#include sysemu/sysemu.h
+#include nfsc/libnfs.h
+
+typedef struct NFSClient {
+struct nfs_context *context;
+struct nfsfh *fh;
+int events;
+bool has_zero_init;
+} NFSClient;
+
+typedef struct NFSRPC {
+int ret;
+int complete;
+QEMUIOVector *iov;
+struct stat *st;
+Coroutine *co;
+QEMUBH *bh;
+} NFSRPC;
+
+static void nfs_process_read(void *arg);
+static void nfs_process_write(void *arg);
+
+static void nfs_set_events(NFSClient *client)
+{
+int ev = nfs_which_events(client-context);
+if (ev != client-events) {
+qemu_aio_set_fd_handler(nfs_get_fd(client-context),
+  (ev  POLLIN) ? nfs_process_read : NULL,
+  (ev  POLLOUT) ? nfs_process_write : NULL,
+  client);
+
+}
+client-events = ev;
+}
+
+static void nfs_process_read(void *arg)
+{
+NFSClient *client = arg;
+nfs_service(client-context, POLLIN);
+nfs_set_events(client);
+}
+
+static void nfs_process_write(void *arg)
+{
+NFSClient *client = arg;
+nfs_service(client-context, POLLOUT);
+nfs_set_events(client);
+}
+
+static void nfs_co_init_task(NFSClient *client, NFSRPC *task)
+{
+*task = (NFSRPC) {
+.co = qemu_coroutine_self(),
+};
+}

[Qemu-devel] [PATCHv9 0/5] block: add native support for NFS

2014-02-03 Thread Peter Lieven
This adds v9 of the NFS protocol driver + qemu-iotest adjustments.

v8-v9:
 - change _supported_proto for qemu-iotests 071  072 from generic to file

v7-v8:
 - bump libnfs requirement to 1.9.2
 - renamed NFSRPC-status to NFSRPC-ret [Benoit]
 - avoid double invocation of nfs_client_close in nfs_file_create [Benoit]
 - fixed error propagation in nfs_file_open [Benoit]

v6-v7:
 - removed unsused and partially non-existing libnfs header file includes 
[Stefan]
 - adjusted usage of qemu_opts_create_nofail [Stefan]
 - removed patch to fix output of qemu-iotest 067
 - only blacklist qemu-iotest 020 for NFS do not change proto from generic to 
file [Fam]

v5-v6:
 - use internal qemu function to parse the NFS url [Kevin]
 - zero pad short reads [Kevin, Paolo]
 - added qemu-iotests patches for basic nfs protocol support

v4-v5:
 - disussed with Ronnie and decided to move URL + Paramter parsing to LibNFS.
   This allows for URL parameter processing directly in LibNFS without altering
   the qemu NFS block driver. This bumps the version requirement for LibNFS
   to 1.9.0 though.
 - added a pointer to the LibNFS readme where additional information about
   ROOT privilidge requirements can be found as this raised a few concerns.
 - removed a trailing dot in an error statement [Fam].

v3-v4:
 - finally added full implementation of bdrv_get_allocated_file_size [Stefan]
 - removed trailing \n from error statements [Stefan]

v2-v3:
 - rebased the stefanha/block
 - use pkg_config to check for libnfs (ignoring cflags which are broken in 
1.8.0) [Stefan]
 - fixed NFSClient declaration [Stefan]
 - renamed Task variables to task [Stefan]
 - renamed NFSTask to NFSRPC [Ronnie]
 - do not update bs-total_sectors in nfs_co_writev [Stefan]
 - return -ENOMEM on all async call failures [Stefan,Ronnie]
 - fully implement ftruncate
 - use util/uri.c for URL parsing [Stefan]
 - reworked nfs_file_open_common to nfs_client_open which works on NFSClient 
[Stefan]
 - added a comment ot the connect message that libnfs support NFSv3 only at the 
moment.
 - DID NOT add full implementation of bdrv_get_allocated_file_size because
   we are not in a coroutine context and I cannot do an async call here.
   I could do a sync call if there would be a guarantee that no requests
   are in flight. [Stefan]

v1-v2:
 - fixed block/Makefile.objs [Ronnie]
 - do not always register a read handler [Ronnie]
 - add support for reading beyond EOF [Fam]
 - fixed struct and paramter naming [Fam]
 - fixed overlong lines and whitespace errors [Fam]
 - return return status from libnfs whereever possible [Fam]
 - added comment why we set allocated_file_size to -ENOTSUP after write [Fam]
 - avoid segfault when parsing filname [Fam]
 - remove unused close_bh from NFSClient [Fam]
 - avoid dividing and mutliplying total_size by BDRV_SECTOR_SIZE in 
nfs_file_create [Fam] 

Peter Lieven (5):
  block: add native support for NFS
  qemu-iotests: change _supported_proto to file for various tests
  qemu-iotests: blacklist test 020 for NFS protocol
  qemu-iotests: enable test 016 and 025 to work with NFS protocol
  qemu-iotests: enable support for NFS protocol

 MAINTAINERS  |5 +
 block/Makefile.objs  |1 +
 block/nfs.c  |  439 ++
 configure|   26 +++
 qapi-schema.json |1 +
 tests/qemu-iotests/013   |2 +-
 tests/qemu-iotests/014   |2 +-
 tests/qemu-iotests/016   |2 +-
 tests/qemu-iotests/018   |2 +-
 tests/qemu-iotests/019   |2 +-
 tests/qemu-iotests/020   |5 +
 tests/qemu-iotests/023   |2 +-
 tests/qemu-iotests/024   |2 +-
 tests/qemu-iotests/025   |2 +-
 tests/qemu-iotests/026   |2 +-
 tests/qemu-iotests/028   |2 +-
 tests/qemu-iotests/031   |2 +-
 tests/qemu-iotests/034   |2 +-
 tests/qemu-iotests/036   |2 +-
 tests/qemu-iotests/037   |2 +-
 tests/qemu-iotests/038   |2 +-
 tests/qemu-iotests/039   |2 +-
 tests/qemu-iotests/043   |2 +-
 tests/qemu-iotests/046   |2 +-
 tests/qemu-iotests/052   |2 +-
 tests/qemu-iotests/054   |2 +-
 tests/qemu-iotests/059   |2 +-
 tests/qemu-iotests/060   |2 +-
 tests/qemu-iotests/061   |2 +-
 tests/qemu-iotests/063   |2 +-
 tests/qemu-iotests/069   |2 +-
 tests/qemu-iotests/071   |2 +-
 tests/qemu-iotests/072   |2 +-
 tests/qemu-iotests/common|   22 ++-
 tests/qemu-iotests/common.rc |3 +
 35 files changed, 526 insertions(+), 30 deletions(-)
 create mode 100644 block/nfs.c

-- 
1.7.9.5




[Qemu-devel] [PATCHv9 4/5] qemu-iotests: enable test 016 and 025 to work with NFS protocol

2014-02-03 Thread Peter Lieven
Signed-off-by: Peter Lieven p...@kamp.de
---
 tests/qemu-iotests/016 |2 +-
 tests/qemu-iotests/025 |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/016 b/tests/qemu-iotests/016
index b87a32b..7ea9e94 100755
--- a/tests/qemu-iotests/016
+++ b/tests/qemu-iotests/016
@@ -39,7 +39,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.filter
 
 _supported_fmt raw
-_supported_proto file sheepdog
+_supported_proto file sheepdog nfs
 _supported_os Linux
 
 
diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025
index 9426c93..a5f45b4 100755
--- a/tests/qemu-iotests/025
+++ b/tests/qemu-iotests/025
@@ -40,7 +40,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.pattern
 
 _supported_fmt raw qcow2 qed
-_supported_proto file sheepdog rbd
+_supported_proto file sheepdog rbd nfs
 _supported_os Linux
 
 echo === Creating image
-- 
1.7.9.5




Re: [Qemu-devel] [PATCHv4 0/6] ui/vnc: update optimizations

2014-02-03 Thread Peter Lieven

On 08.01.2014 10:08, Peter Lieven wrote:

this series includes several optimizations for the ui/vnc guest to server and 
server to client
update cycles. comments/reviews appreciated.

v3-v4: - patch 1,4,6 unchanged
 - patch 2: fix 2 missing changes from 16 - VNC_DIRTY_PIXELS_PER_BIT 
[Wenchao]
 - patch 3: fixed missing roundup of width in vnc_dpy_switch [Wenchao]
 - patch 3: fixed x offset calculation in vnc_refresh_server_surface
 - patch 5: fixed missing roundup of width in vnc_dpy_update, cleaned 
up function
v2-v3: - fixed checkpatch warnings [Stefan]
 - fixed an old coding style violation [Stefan]
v1-v2: - new patches 2,4,5
 - patch3: added performance test [Anthony]
 - patch3: further optimized the vnc_update_client by searching for the 
next zero bit
   with find_next_zero_bit.
 - patch3: further optimized vnc_dpy_switch by using bitmap_set to mask 
bits dirty.

Peter Lieven (6):
   ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro
   ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT
   ui/vnc: optimize dirty bitmap tracking
   ui/vnc: optimize clearing in find_and_clear_dirty_height()
   ui/vnc: optimize setting in vnc_dpy_update()
   ui/vnc: disable adaptive update calculations if not needed

  ui/vnc.c |  206 +++---
  ui/vnc.h |   10 ++-
  2 files changed, 127 insertions(+), 89 deletions(-)



PingV2 ;-)

Peter




[Qemu-devel] [PATCHv9 5/5] qemu-iotests: enable support for NFS protocol

2014-02-03 Thread Peter Lieven
Signed-off-by: Peter Lieven p...@kamp.de
---
 tests/qemu-iotests/common|   22 +++---
 tests/qemu-iotests/common.rc |3 +++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 8b4e22c..5795358 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -144,10 +144,12 @@ check options
 -vpctest vpc
 -vhdx   test vhdx
 -vmdk   test vmdk
+-file   test file (default)
 -rbdtest rbd
 -sheepdog   test sheepdog
 -nbdtest nbd
 -sshtest ssh
+-nfstest nfs
 -xdiff  graphical mode diff
 -nocacheuse O_DIRECT on backing file
 -misalign   misalign memory allocations
@@ -211,22 +213,36 @@ testlist options
 xpand=false
 ;;
 
+-file)
+IMGPROTO=file
+xpand=false
+;;
+
 -rbd)
 IMGPROTO=rbd
 xpand=false
 ;;
+
 -sheepdog)
 IMGPROTO=sheepdog
 xpand=false
 ;;
+
 -nbd)
 IMGPROTO=nbd
 xpand=false
 ;;
+
 -ssh)
 IMGPROTO=ssh
 xpand=false
 ;;
+
+-nfs)
+IMGPROTO=nfs
+xpand=false
+;;
+
 -nocache)
 CACHEMODE=none
 CACHEMODE_IS_DEFAULT=false
@@ -238,10 +254,10 @@ testlist options
 xpand=false
 ;;
 
--valgrind)
-valgrind=true
+-valgrind)
+valgrind=true
 xpand=false
-;;
+;;
 
 -g)# -g group ... pick from group file
 group=true
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 0f68156..71e9a74 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -61,6 +61,9 @@ elif [ $IMGPROTO = nbd ]; then
 elif [ $IMGPROTO = ssh ]; then
 TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
 TEST_IMG=ssh://127.0.0.1$TEST_IMG_FILE
+elif [ $IMGPROTO = nfs ]; then
+TEST_DIR=nfs://127.0.0.1/$TEST_DIR
+TEST_IMG=$TEST_DIR/t.$IMGFMT
 else
 TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
 fi
-- 
1.7.9.5




[Qemu-devel] [PATCHv9 3/5] qemu-iotests: blacklist test 020 for NFS protocol

2014-02-03 Thread Peter Lieven
reopening is currently not supported.

Signed-off-by: Peter Lieven p...@kamp.de
---
 tests/qemu-iotests/020 |5 +
 1 file changed, 5 insertions(+)

diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index 73a0429..2f258dc 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -49,6 +49,11 @@ _unsupported_imgopts subformat=monolithicFlat \
  subformat=twoGbMaxExtentFlat \
  subformat=twoGbMaxExtentSparse
 
+# NFS does not support bdrv_reopen_prepare thus qemu-img commit fails.
+if [ $IMGPROTO = nfs ]; then
+_notrun image protocol $IMGPROTO does not support bdrv_commit
+fi
+
 TEST_OFFSETS=0 4294967296
 
 _make_test_img 6G
-- 
1.7.9.5




Re: [Qemu-devel] 9pfs troubles (was Re: [PATCH 1/4] hw/9pfs: fix error handing in local_ioc_getversion())

2014-02-03 Thread Aneesh Kumar K.V
Michael S. Tsirkin m...@redhat.com writes:

 Haven't used 9pfs in a while.
 I thought these patches are a good time to play with it some more.
 I have encountered two issues.

 What I'm doing:
 host: qemu a75143eda2ddf581b51e96c000974bcdfe2cbd10.

 /scm/qemu/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 1g -cpu kvm64
 -smp 2  f20-x64.qcow2  -netdev user,id=foo -redir tcp:8022::22 -device
 virtio-net,netdev=foo  -serial stdio -fsdev
 local,security_model=none,id=fsdev0,path=/lib/modules/ -device
 virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=libmodulesshare -fsdev
 local,security_model=none,id=fsdev1,path=/boot -device
 virtio-9p-pci,id=fs1,fsdev=fsdev0,mount_tag=bootshare -no-reboot
 -snapshot

 guest: Fedora 20

 added this in /etc/fstab:

 bootshare   /share/boot 9p  trans=virtio,version=9p2000.L 0 0
 libmodulesshare /share/lib/modules  9p trans=virtio,version=9p2000.L 0 0


 I have encountered two issues:

 1. mount failure on boot
 If I try to mount on boot through fstab, I get:
 [2.270157] 9pnet: Could not find request transport: virtio
 [2.270158] 9pnet: Could not find request transport: virtio


Missing 9pnet_virtio.ko module ? 


 If I then re-try mount, it succeeds immediately!

 Some kind of dependency issue?

 2. files immediately in the mounted directory aren't visible on the
 guest under /share/boot.
 For example, files under /boot on host are not visible
 on guest, files under child directories seem visible.


can you share more details on this ? /boot permissions. ls -al output on
host etc.

-aneesh




Re: [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support

2014-02-03 Thread Gerd Hoffmann
  Hi,

  +switch (graphic_rotate) {
  +case 90:
  +if (evt-abs-axis == INPUT_AXIS_X) {
  +evt-abs-axis = INPUT_AXIS_Y;
  +}
  +if (evt-abs-axis == INPUT_AXIS_Y) {
 
 Need else here, same for case 270.

Why?

  +evt-abs-axis = INPUT_AXIS_X;
  +evt-abs-axis = INPUT_EVENT_ABS_SIZE - 1 - evt-abs-axis;
 
 -value here, not -axis.

Oops, indeed.

 It looks like doing it right for relative is easy:

But what is the point when this isn't used anyway?

 
  if (graphic_rotate == 0) {
  return;
  }
  if (move-axis != INPUT_AXIS_X  move-axis != INPUT_AXIS_Y) {
  return;
  }
  if ((graphic_rotate = 180  move-axis == INPUT_AXIS_X) ||
  (graphic_rotate = 180  move-axis == INPUT_AXIS_Y)) {
   if (kind == INPUT_EVENT_KIND_ABS) {
   move-value = INPUT_EVENT_ABS_SIZE - 1 - move-value;
   } else {
   move-value = -move-value;
   }
  }
  if (graphic_rotate == 90 || graphic_rotate == 270) {
  move-axis ^= INPUT_AXIS_X ^ INPUT_AXIS_Y;
  }

Saves a few lines but it's a bit harder to figure what is going on ...

cheers,
  Gerd





Re: [Qemu-devel] [PATCH 06/42] input: qapi: define event types

2014-02-03 Thread Gerd Hoffmann
  Hi,

 s/alot/a lot/

 s/splitted/split/

Applied.

  +##
  +# @InputBtnEvent
 
 Should we spell this out?  I'm okay with the abbreviation if it makes it
 easier to fit 80 columns, but Button is nicer to read than Btn.

I'm sort-of following linux input layer convention here,
which uses btn for the buttons too.

cheers,
  Gerd





Re: [Qemu-devel] [PATCH V6 8/8] block: Use graph node name as reference in bdrv_file_open().

2014-02-03 Thread Kevin Wolf
Am 31.01.2014 um 22:37 hat Benoît Canet geschrieben:
 Le Friday 31 Jan 2014 à 21:32:34 (+0100), Max Reitz a écrit :
  On 28.01.2014 01:04, Benoît Canet wrote:
  Le Monday 27 Jan 2014 à 20:11:59 (+0100), Max Reitz a écrit :
  On 27.01.2014 15:36, Benoît Canet wrote:
  Le Friday 24 Jan 2014 à 15:54:39 (+0100), Max Reitz a écrit :
  On 24.01.2014 15:48, Kevin Wolf wrote:
  Am 24.01.2014 um 14:37 hat Max Reitz geschrieben:
  On 24.01.2014 14:26, Kevin Wolf wrote:
  Am 23.01.2014 um 21:31 hat Benoît Canet geschrieben:
  Signed-off-by: Benoit Canet ben...@irqsave.net
  ---
block.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
  I'm not going to merge this one yet. It breaks qemu-iotests case 071,
  which would have to be adapted.
  
  However, first of all I'd like to hear the opinions of at least Eric 
  and
  Max on what BlockRef should really refer to. I think node names make
  most sense, but perhaps it's a bit inconvenient and the command line
  should default to node-name = id when id is set, but node-name isn't?
  The QAPI schema is pretty clear about this: “references the ID of an
  existing block device.”
  Sure, that's because I wrote that text before we had a node name.
  
  However, in 1.7 references didn't work yet, so we still have all 
  freedom
  to change the interface as we like.
  Yes, that's right.
  
  However, if the ID cannot be found, I think
  we should interpret it as a reference to the node name.
  
  Therefore, I'd first try bdrv_find() and if that returns NULL, try
  again with bdrv_find_node().
  I think I would prefer to avoid such ambiguities. Otherwise a 
  management
  tool that wants to use the node name needs to check first if it's not
  already used as a device name somewhere else and would therefore 
  operate
  on the wrong device.
  
  On the other hand, a management tool using the same names for devices
  and nodes just gets what it deserves.
  
  Perhaps we should use a common namespace for both, i.e. you get an 
  error
  if you try to assign a node name that is already a device name and vice
  versa?
  This is what I would go for. However, then I don't really know why
  we should separate the ID and the node name in the first place
  (although that's probably because I haven't followed the discussion
  around node names).
  
  Max
  Ping,
  
  I still want to make quorum merge.
  What should be done for the references ?
  
  Best regards
  
  Benoît
  My only problem is that I don't really know what IDs are for, then. ;-)
  
   From the understanding I have ID are for block backend top level bds and
  node-name naming all the bds burried in the graph.
  
  So my personal opinion would be to relax the constraint on bdrv_lookup_bs
  and use it for references.
  
  Kevin  Max: what do you think of this scheme ?
  
  I agree. For example, we could change the constraint to report an
  error only if both ID and node name are actually valid (and point to
  different devices), that is, bdrv_find() and bdrv_find_node() return
  different non-NULL values.
 
 Ok I will write patch doing this on top of quorum patches.

Yes, I think allowing bdrv_lookup_bs() to find both node names and
device names makes sense.

I would still use a common namespace and forbid using the same name for
a device and a node.

Kevin



[Qemu-devel] [PATCH v4 01/22] exec: Make tb_invalidate_phys_addr input an AS

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

No functional change.

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c| 3 ++-
 include/exec/exec-all.h   | 2 +-
 target-xtensa/op_helper.c | 3 ++-
 translate-all.c   | 4 ++--
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index 9ad0a4b..fc8ae65 100644
--- a/exec.c
+++ b/exec.c
@@ -488,7 +488,8 @@ static void breakpoint_invalidate(CPUState *cpu, 
target_ulong pc)
 {
 hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
 if (phys != -1) {
-tb_invalidate_phys_addr(phys | (pc  ~TARGET_PAGE_MASK));
+tb_invalidate_phys_addr(address_space_memory,
+phys | (pc  ~TARGET_PAGE_MASK));
 }
 }
 #endif
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 3b03cbf..9d6c36b 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -102,7 +102,7 @@ void tlb_flush(CPUArchState *env, int flush_global);
 void tlb_set_page(CPUArchState *env, target_ulong vaddr,
   hwaddr paddr, int prot,
   int mmu_idx, target_ulong size);
-void tb_invalidate_phys_addr(hwaddr addr);
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
 #else
 static inline void tlb_flush_page(CPUArchState *env, target_ulong addr)
 {
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index cf97025..89a72b5 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -29,6 +29,7 @@
 #include helper.h
 #include qemu/host-utils.h
 #include exec/softmmu_exec.h
+#include exec/address-spaces.h
 
 static void do_unaligned_access(CPUXtensaState *env,
 target_ulong addr, int is_write, int is_user, uintptr_t retaddr);
@@ -90,7 +91,7 @@ static void tb_invalidate_virtual_addr(CPUXtensaState *env, 
uint32_t vaddr)
 int ret = xtensa_get_physical_addr(env, false, vaddr, 2, 0,
 paddr, page_size, access);
 if (ret == 0) {
-tb_invalidate_phys_addr(paddr);
+tb_invalidate_phys_addr(address_space_memory, paddr);
 }
 }
 
diff --git a/translate-all.c b/translate-all.c
index 543e1ff..1ac0246 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1357,13 +1357,13 @@ static TranslationBlock *tb_find_pc(uintptr_t tc_ptr)
 }
 
 #if defined(TARGET_HAS_ICE)  !defined(CONFIG_USER_ONLY)
-void tb_invalidate_phys_addr(hwaddr addr)
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
 {
 ram_addr_t ram_addr;
 MemoryRegion *mr;
 hwaddr l = 1;
 
-mr = address_space_translate(address_space_memory, addr, addr, l, 
false);
+mr = address_space_translate(as, addr, addr, l, false);
 if (!(memory_region_is_ram(mr)
   || memory_region_is_romd(mr))) {
 return;
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 03/22] exec: Always initialize MemorySection address spaces

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/exec.c b/exec.c
index 8a90867..3814a7e 100644
--- a/exec.c
+++ b/exec.c
@@ -877,6 +877,7 @@ static void register_subpage(AddressSpaceDispatch *d, 
MemoryRegionSection *secti
 
 if (!(existing-mr-subpage)) {
 subpage = subpage_init(d-as, base);
+subsection.address_space = d-as;
 subsection.mr = subpage-iomem;
 phys_page_set(d, base  TARGET_PAGE_BITS, 1,
   phys_section_add(d-map, subsection));
@@ -1722,6 +1723,7 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr 
base)
 static uint16_t dummy_section(PhysPageMap *map, MemoryRegion *mr)
 {
 MemoryRegionSection section = {
+.address_space = address_space_memory,
 .mr = mr,
 .offset_within_address_space = 0,
 .offset_within_region = 0,
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 02/22] exec: Make iotlb_to_region input an AS

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 cputlb.c| 2 +-
 exec.c  | 5 ++---
 include/exec/exec-all.h | 2 +-
 include/exec/softmmu_template.h | 5 +++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cputlb.c b/cputlb.c
index b533f3f..71cf64f 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -313,7 +313,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, 
target_ulong addr)
 cpu_ldub_code(env1, addr);
 }
 pd = env1-iotlb[mmu_idx][page_index]  ~TARGET_PAGE_MASK;
-mr = iotlb_to_region(pd);
+mr = iotlb_to_region(address_space_memory, pd);
 if (memory_region_is_unassigned(mr)) {
 CPUState *cpu = ENV_GET_CPU(env1);
 CPUClass *cc = CPU_GET_CLASS(cpu);
diff --git a/exec.c b/exec.c
index fc8ae65..8a90867 100644
--- a/exec.c
+++ b/exec.c
@@ -1731,10 +1731,9 @@ static uint16_t dummy_section(PhysPageMap *map, 
MemoryRegion *mr)
 return phys_section_add(map, section);
 }
 
-MemoryRegion *iotlb_to_region(hwaddr index)
+MemoryRegion *iotlb_to_region(AddressSpace *as, hwaddr index)
 {
-return address_space_memory.dispatch-map.sections[
-   index  ~TARGET_PAGE_MASK].mr;
+return as-dispatch-map.sections[index  ~TARGET_PAGE_MASK].mr;
 }
 
 static void io_mem_init(void)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 9d6c36b..75fd1da 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -325,7 +325,7 @@ extern uintptr_t tci_tb_ptr;
 
 void phys_mem_set_alloc(void *(*alloc)(size_t));
 
-struct MemoryRegion *iotlb_to_region(hwaddr index);
+struct MemoryRegion *iotlb_to_region(AddressSpace *as, hwaddr index);
 bool io_mem_read(struct MemoryRegion *mr, hwaddr addr,
  uint64_t *pvalue, unsigned size);
 bool io_mem_write(struct MemoryRegion *mr, hwaddr addr,
diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h
index c6a5440..69d856a 100644
--- a/include/exec/softmmu_template.h
+++ b/include/exec/softmmu_template.h
@@ -22,6 +22,7 @@
  * License along with this library; if not, see http://www.gnu.org/licenses/.
  */
 #include qemu/timer.h
+#include exec/address-spaces.h
 #include exec/memory.h
 
 #define DATA_SIZE (1  SHIFT)
@@ -118,7 +119,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState 
*env,
   uintptr_t retaddr)
 {
 uint64_t val;
-MemoryRegion *mr = iotlb_to_region(physaddr);
+MemoryRegion *mr = iotlb_to_region(address_space_memory, physaddr);
 
 physaddr = (physaddr  TARGET_PAGE_MASK) + addr;
 env-mem_io_pc = retaddr;
@@ -324,7 +325,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env,
   target_ulong addr,
   uintptr_t retaddr)
 {
-MemoryRegion *mr = iotlb_to_region(physaddr);
+MemoryRegion *mr = iotlb_to_region(address_space_memory, physaddr);
 
 physaddr = (physaddr  TARGET_PAGE_MASK) + addr;
 if (mr != io_mem_rom  mr != io_mem_notdirty  !can_do_io(env)) {
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 04/22] exec: Make memory_region_section_get_iotlb use section AS

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 3814a7e..d8cfe52 100644
--- a/exec.c
+++ b/exec.c
@@ -781,7 +781,7 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,
 iotlb |= PHYS_SECTION_ROM;
 }
 } else {
-iotlb = section - address_space_memory.dispatch-map.sections;
+iotlb = section - section-address_space-dispatch-map.sections;
 iotlb += xlat;
 }
 
-- 
1.8.1.2




Re: [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support

2014-02-03 Thread Paolo Bonzini

Il 03/02/2014 10:42, Gerd Hoffmann ha scritto:

  Hi,


+switch (graphic_rotate) {
+case 90:
+if (evt-abs-axis == INPUT_AXIS_X) {
+evt-abs-axis = INPUT_AXIS_Y;
+}
+if (evt-abs-axis == INPUT_AXIS_Y) {


Need else here, same for case 270.


Why?


Because otherwise both axes become X.  When the first if triggers the 
axis changes to Y, and then it becomes X again. :)



+evt-abs-axis = INPUT_AXIS_X;
+evt-abs-axis = INPUT_EVENT_ABS_SIZE - 1 - evt-abs-axis;


-value here, not -axis.


Oops, indeed.


It looks like doing it right for relative is easy:


But what is the point when this isn't used anyway?


In what sense it is not used?  Because you do not have e.g. a USB 
controller in the only machines that support graphic_rotate?


Paolo



 if (graphic_rotate == 0) {
 return;
 }
 if (move-axis != INPUT_AXIS_X  move-axis != INPUT_AXIS_Y) {
 return;
 }
 if ((graphic_rotate = 180  move-axis == INPUT_AXIS_X) ||
 (graphic_rotate = 180  move-axis == INPUT_AXIS_Y)) {
  if (kind == INPUT_EVENT_KIND_ABS) {
  move-value = INPUT_EVENT_ABS_SIZE - 1 - move-value;
  } else {
  move-value = -move-value;
  }
 }
 if (graphic_rotate == 90 || graphic_rotate == 270) {
 move-axis ^= INPUT_AXIS_X ^ INPUT_AXIS_Y;
 }


Saves a few lines but it's a bit harder to figure what is going on ...

cheers,
  Gerd







[Qemu-devel] [PATCH v4 00/22] Steps towards per CPU address-spaces

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Hi,

I'm looking at modeling systems where multiple CPUs co-exist with
different views of their attached buses/devs.

With this series I'm trying to take some steps towards having
an address-space per CPU. It's not complete but good enough for
making it possible to model (to some extent) CPU local memories
for MicroBlaze systems in emulation mode (TCG). I'm updating the
petalogix-ml605 here and will follow-up later with the petalogix-s3adsp.

The per-cpu address space is added into the CPUState. I tried to
measure performance diff with having it in the CPUState-env.
For normal and even for IO heavy workloads on linux kernels,
the diff is not measurable. I also tested with a tight guest loop
that continuously does I/O accesses and there I can see a 2.5% drop in perf.
I dont think the runtime type check involved when casting from env to CS
will be much of a problem.

I've reordered the series and moved the AS props to the end, hoping
we can get through the bulk of the series with less controversy and
get it commited soon.
I've kept the interface with properties to set AddressSpace pointers
which I think is the more flexible approach but we can explore other
ideas if there are.

There is lots of future work needed, for example to transform more of
the cpu_* bus accessing functions. To add more usage of AddressSpace
properties to pass on address spaces to DMA models. Qtest mechanisms
to target specific address spaces, etc...

Cheers,
Edgar

v3 - v4:
Rebase, Use error_abort.

v2 - v3:
Move CPU address-space prop into CPUState level.

v1 - v2:
Add braces in cpu_memory_rw_debug.
Avoid mixing var/code declarations in tcg_commit.
Move per-cpu address space into CPUState.
Reorder patch series to add the AS properties last.

Edgar E. Iglesias (22):
  exec: Make tb_invalidate_phys_addr input an AS
  exec: Make iotlb_to_region input an AS
  exec: Always initialize MemorySection address spaces
  exec: Make memory_region_section_get_iotlb use section AS
  memory: Add MemoryListener to typedefs.h
  cpu: Add per-cpu address space
  exec: On AS changes, only flush affected CPU TLBs
  exec: Make ldl_*_phys input an AddressSpace
  exec: Make ldq/ldub_*_phys input an AddressSpace
  exec: Make lduw_*_phys input an AddressSpace
  exec: Make stq_*_phys input an AddressSpace
  exec: Make stl_*_phys input an AddressSpace
  exec: Make stl_phys_notdirty input an AddressSpace
  exec: Make stw_*_phys input an AddressSpace
  exec: Make stb_phys input an AddressSpace
  exec: Make cpu_physical_memory_write_rom input an AS
  exec: Make cpu_memory_rw_debug use the CPUs AS
  memory: Add address_space_find_by_name()
  qdev: Add qdev property type for AddressSpaces
  cpu: Add address-space property
  petalogix-ml605: Create the CPU with object_new()
  petalogix-ml605: Make the LMB visible only to the CPU

 cpu-exec.c  |   5 +-
 cpus.c  |   2 +
 cputlb.c|   7 +-
 exec.c  | 183 --
 hw/alpha/dp264.c|   5 +-
 hw/alpha/typhoon.c  |   2 +-
 hw/arm/boot.c   |   5 +-
 hw/arm/highbank.c   |   6 +-
 hw/core/loader.c|   3 +-
 hw/core/qdev-properties-system.c|   8 +
 hw/core/qdev-properties.c   |  54 +++
 hw/display/sm501.c  |   1 +
 hw/display/sm501_template.h |   2 +-
 hw/dma/pl080.c  |   9 +-
 hw/dma/sun4m_iommu.c|   3 +-
 hw/intc/apic.c  |   3 +-
 hw/microblaze/petalogix_ml605_mmu.c |  24 ++-
 hw/net/vmware_utils.h   |  16 +-
 hw/pci/msi.c|   2 +-
 hw/pci/msix.c   |   2 +-
 hw/ppc/ppc405_uc.c  |  45 +++---
 hw/ppc/spapr_hcall.c|  50 +++---
 hw/s390x/css.c  |  11 +-
 hw/s390x/s390-virtio-bus.c  |  36 +++--
 hw/s390x/s390-virtio.c  |   2 +-
 hw/s390x/virtio-ccw.c   |  40 +++--
 hw/scsi/megasas.c   |  22 ++-
 hw/scsi/vmw_pvscsi.c|   6 +-
 hw/sh4/r2d.c|   4 +-
 hw/sparc/sun4m.c|   3 +-
 hw/timer/hpet.c |   3 +-
 hw/virtio/virtio.c  |  31 ++--
 include/exec/cpu-common.h   |  44 +++---
 include/exec/exec-all.h |   5 +-
 include/exec/memory.h   |  11 +-
 include/exec/softmmu_template.h |   7 +-
 include/hw/ppc/spapr.h  |   4 +-
 include/hw/qdev-properties.h|   5 +
 include/qemu/typedefs.h |   1 +
 include/qom/cpu.h   |   3 +
 memory.c|  12 ++
 monitor.c   |   2 +-
 qom/cpu.c   |   7 +
 stubs/Makefile.objs |   1 +
 stubs/memory.c  |   6 +
 

[Qemu-devel] [PATCH v4 05/22] memory: Add MemoryListener to typedefs.h

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 include/exec/memory.h   | 2 --
 include/qemu/typedefs.h | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 296d6ab..9101fc3 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -163,8 +163,6 @@ struct MemoryRegion {
 NotifierList iommu_notify;
 };
 
-typedef struct MemoryListener MemoryListener;
-
 /**
  * MemoryListener: callbacks structure for updates to the physical memory map
  *
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 4524496..5b4e333 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -26,6 +26,7 @@ typedef struct BusClass BusClass;
 typedef struct AddressSpace AddressSpace;
 typedef struct MemoryRegion MemoryRegion;
 typedef struct MemoryRegionSection MemoryRegionSection;
+typedef struct MemoryListener MemoryListener;
 
 typedef struct MemoryMappingList MemoryMappingList;
 
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 07/22] exec: On AS changes, only flush affected CPU TLBs

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/exec.c b/exec.c
index f299d06..a1d8bbe 100644
--- a/exec.c
+++ b/exec.c
@@ -1813,6 +1813,11 @@ static void tcg_commit(MemoryListener *listener)
 CPU_FOREACH(cpu) {
 CPUArchState *env = cpu-env_ptr;
 
+/* FIXME: Disentangle the cpu.h circular files deps so we can
+   directly get the right CPU from listener.  */
+if (cpu-tcg_as_listener != listener) {
+continue;
+}
 tlb_flush(env, 1);
 }
 }
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 10/22] exec: Make lduw_*_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c | 18 +-
 hw/net/vmware_utils.h  |  2 +-
 hw/ppc/spapr_hcall.c   |  6 +++---
 hw/s390x/css.c |  3 ++-
 hw/s390x/virtio-ccw.c  |  8 +---
 hw/virtio/virtio.c | 16 
 include/exec/cpu-common.h  |  6 +++---
 target-i386/smm_helper.c   | 12 ++--
 target-i386/svm_helper.c   | 15 ---
 target-sparc/ldst_helper.c |  6 +++---
 10 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/exec.c b/exec.c
index 3bc4497..11abe89 100644
--- a/exec.c
+++ b/exec.c
@@ -1598,7 +1598,7 @@ static uint64_t watch_mem_read(void *opaque, hwaddr addr,
 check_watchpoint(addr  ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_READ);
 switch (size) {
 case 1: return ldub_phys(address_space_memory, addr);
-case 2: return lduw_phys(addr);
+case 2: return lduw_phys(address_space_memory, addr);
 case 4: return ldl_phys(address_space_memory, addr);
 default: abort();
 }
@@ -2470,7 +2470,7 @@ uint32_t ldub_phys(AddressSpace *as, hwaddr addr)
 }
 
 /* warning: addr must be aligned */
-static inline uint32_t lduw_phys_internal(hwaddr addr,
+static inline uint32_t lduw_phys_internal(AddressSpace *as, hwaddr addr,
   enum device_endian endian)
 {
 uint8_t *ptr;
@@ -2479,7 +2479,7 @@ static inline uint32_t lduw_phys_internal(hwaddr addr,
 hwaddr l = 2;
 hwaddr addr1;
 
-mr = address_space_translate(address_space_memory, addr, addr1, l,
+mr = address_space_translate(as, addr, addr1, l,
  false);
 if (l  2 || !memory_access_is_direct(mr, false)) {
 /* I/O case */
@@ -2513,19 +2513,19 @@ static inline uint32_t lduw_phys_internal(hwaddr addr,
 return val;
 }
 
-uint32_t lduw_phys(hwaddr addr)
+uint32_t lduw_phys(AddressSpace *as, hwaddr addr)
 {
-return lduw_phys_internal(addr, DEVICE_NATIVE_ENDIAN);
+return lduw_phys_internal(as, addr, DEVICE_NATIVE_ENDIAN);
 }
 
-uint32_t lduw_le_phys(hwaddr addr)
+uint32_t lduw_le_phys(AddressSpace *as, hwaddr addr)
 {
-return lduw_phys_internal(addr, DEVICE_LITTLE_ENDIAN);
+return lduw_phys_internal(as, addr, DEVICE_LITTLE_ENDIAN);
 }
 
-uint32_t lduw_be_phys(hwaddr addr)
+uint32_t lduw_be_phys(AddressSpace *as, hwaddr addr)
 {
-return lduw_phys_internal(addr, DEVICE_BIG_ENDIAN);
+return lduw_phys_internal(as, addr, DEVICE_BIG_ENDIAN);
 }
 
 /* warning: addr must be aligned. The ram page is not masked as dirty
diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h
index eb98d2a..7877cb6 100644
--- a/hw/net/vmware_utils.h
+++ b/hw/net/vmware_utils.h
@@ -80,7 +80,7 @@ vmw_shmem_st8(hwaddr addr, uint8_t value)
 static inline uint32_t
 vmw_shmem_ld16(hwaddr addr)
 {
-uint16_t res = lduw_le_phys(addr);
+uint16_t res = lduw_le_phys(address_space_memory, addr);
 VMW_SHPRN(SHMEM load16: % PRIx64  (value 0x%X), addr, res);
 return res;
 }
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 6e61a91..a2893ad 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -355,7 +355,7 @@ static target_ulong register_vpa(CPUPPCState *env, 
target_ulong vpa)
 }
 /* FIXME: bounds check the address */
 
-size = lduw_be_phys(vpa + 0x4);
+size = lduw_be_phys(cs-as, vpa + 0x4);
 
 if (size  VPA_MIN_SIZE) {
 return H_PARAMETER;
@@ -544,7 +544,7 @@ static target_ulong h_logical_load(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 args[0] = ldub_phys(cs-as, addr);
 return H_SUCCESS;
 case 2:
-args[0] = lduw_phys(addr);
+args[0] = lduw_phys(cs-as, addr);
 return H_SUCCESS;
 case 4:
 args[0] = ldl_phys(cs-as, addr);
@@ -614,7 +614,7 @@ static target_ulong h_logical_memop(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 tmp = ldub_phys(cs-as, src);
 break;
 case 1:
-tmp = lduw_phys(src);
+tmp = lduw_phys(cs-as, src);
 break;
 case 2:
 tmp = ldl_phys(cs-as, src);
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 41b1903..d42d7ec 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -677,7 +677,8 @@ static void css_update_chnmon(SubchDev *sch)
 uint16_t count;
 
 offset = sch-curr_status.pmcw.mbi  5;
-count = lduw_phys(channel_subsys-chnmon_area + offset);
+count = lduw_phys(address_space_memory,
+  channel_subsys-chnmon_area + offset);
 count++;
 stw_phys(channel_subsys-chnmon_area + offset, count);
 }
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index d301f00..50d852a 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -265,9 +265,11 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
 info.queue = ldq_phys(address_space_memory, ccw.cda);
 

[Qemu-devel] [PATCH v4 06/22] cpu: Add per-cpu address space

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 cpus.c  |  2 ++
 cputlb.c|  7 ---
 exec.c  | 27 +++
 include/exec/exec-all.h |  1 +
 include/exec/softmmu_template.h |  6 --
 include/qom/cpu.h   |  3 +++
 6 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/cpus.c b/cpus.c
index ca4c59f..945d85b 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1119,6 +1119,8 @@ void resume_all_vcpus(void)
 
 static void qemu_tcg_init_vcpu(CPUState *cpu)
 {
+tcg_cpu_address_space_init(cpu, cpu-as);
+
 /* share a single thread for all cpus with TCG */
 if (!tcg_cpu_thread) {
 cpu-thread = g_malloc0(sizeof(QemuThread));
diff --git a/cputlb.c b/cputlb.c
index 71cf64f..0fbaa39 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -232,6 +232,7 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr,
 uintptr_t addend;
 CPUTLBEntry *te;
 hwaddr iotlb, xlat, sz;
+CPUState *cpu = ENV_GET_CPU(env);
 
 assert(size = TARGET_PAGE_SIZE);
 if (size != TARGET_PAGE_SIZE) {
@@ -239,7 +240,7 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr,
 }
 
 sz = size;
-section = address_space_translate_for_iotlb(address_space_memory, paddr,
+section = address_space_translate_for_iotlb(cpu-as, paddr,
 xlat, sz);
 assert(sz = TARGET_PAGE_SIZE);
 
@@ -305,6 +306,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, 
target_ulong addr)
 int mmu_idx, page_index, pd;
 void *p;
 MemoryRegion *mr;
+CPUState *cpu = ENV_GET_CPU(env1);
 
 page_index = (addr  TARGET_PAGE_BITS)  (CPU_TLB_SIZE - 1);
 mmu_idx = cpu_mmu_index(env1);
@@ -313,9 +315,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, 
target_ulong addr)
 cpu_ldub_code(env1, addr);
 }
 pd = env1-iotlb[mmu_idx][page_index]  ~TARGET_PAGE_MASK;
-mr = iotlb_to_region(address_space_memory, pd);
+mr = iotlb_to_region(cpu-as, pd);
 if (memory_region_is_unassigned(mr)) {
-CPUState *cpu = ENV_GET_CPU(env1);
 CPUClass *cc = CPU_GET_CLASS(cpu);
 
 if (cc-do_unassigned_access) {
diff --git a/exec.c b/exec.c
index d8cfe52..f299d06 100644
--- a/exec.c
+++ b/exec.c
@@ -138,6 +138,7 @@ typedef struct subpage_t {
 
 static void io_mem_init(void);
 static void memory_map_init(void);
+static void tcg_commit(MemoryListener *listener);
 
 static MemoryRegion io_mem_watch;
 #endif
@@ -438,6 +439,22 @@ CPUState *qemu_get_cpu(int index)
 return NULL;
 }
 
+#if !defined(CONFIG_USER_ONLY)
+void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as)
+{
+/* We only support one address space per cpu at the moment.  */
+assert(cpu-as == as);
+
+if (cpu-tcg_as_listener) {
+memory_listener_unregister(cpu-tcg_as_listener);
+} else {
+cpu-tcg_as_listener = g_new0(MemoryListener, 1);
+}
+cpu-tcg_as_listener-commit = tcg_commit;
+memory_listener_register(cpu-tcg_as_listener, as);
+}
+#endif
+
 void cpu_exec_init(CPUArchState *env)
 {
 CPUState *cpu = ENV_GET_CPU(env);
@@ -457,6 +474,7 @@ void cpu_exec_init(CPUArchState *env)
 QTAILQ_INIT(env-breakpoints);
 QTAILQ_INIT(env-watchpoints);
 #ifndef CONFIG_USER_ONLY
+cpu-as = address_space_memory;
 cpu-thread_id = qemu_get_thread_id();
 #endif
 QTAILQ_INSERT_TAIL(cpus, cpu, node);
@@ -488,7 +506,7 @@ static void breakpoint_invalidate(CPUState *cpu, 
target_ulong pc)
 {
 hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
 if (phys != -1) {
-tb_invalidate_phys_addr(address_space_memory,
+tb_invalidate_phys_addr(cpu-as,
 phys | (pc  ~TARGET_PAGE_MASK));
 }
 }
@@ -1815,10 +1833,6 @@ static MemoryListener core_memory_listener = {
 .priority = 1,
 };
 
-static MemoryListener tcg_memory_listener = {
-.commit = tcg_commit,
-};
-
 void address_space_init_dispatch(AddressSpace *as)
 {
 as-dispatch = NULL;
@@ -1854,9 +1868,6 @@ static void memory_map_init(void)
 address_space_init(address_space_io, system_io, I/O);
 
 memory_listener_register(core_memory_listener, address_space_memory);
-if (tcg_enabled()) {
-memory_listener_register(tcg_memory_listener, address_space_memory);
-}
 }
 
 MemoryRegion *get_system_memory(void)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 75fd1da..a387922 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -96,6 +96,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, 
tb_page_addr_t end,
 void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
   int is_cpu_write_access);
 #if !defined(CONFIG_USER_ONLY)
+void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
 /* cputlb.c */
 void tlb_flush_page(CPUArchState *env, 

[Qemu-devel] [PATCH v4 08/22] exec: Make ldl_*_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 cpu-exec.c|   5 +-
 exec.c|  19 ---
 hw/dma/pl080.c|   9 ++--
 hw/dma/sun4m_iommu.c  |   3 +-
 hw/net/vmware_utils.h |   2 +-
 hw/ppc/spapr_hcall.c  |  13 +++--
 hw/s390x/css.c|   3 +-
 hw/s390x/s390-virtio-bus.c|   2 +-
 hw/s390x/virtio-ccw.c |   5 +-
 hw/scsi/megasas.c |   4 +-
 hw/scsi/vmw_pvscsi.c  |   3 +-
 hw/virtio/virtio.c|   3 +-
 include/exec/cpu-common.h |   6 +--
 include/hw/ppc/spapr.h|   2 +-
 target-alpha/helper.h |   2 +-
 target-alpha/mem_helper.c |  11 ++--
 target-alpha/translate.c  |   2 +-
 target-arm/helper.c   |  15 +++---
 target-i386/arch_memory_mapping.c |  36 ++---
 target-i386/helper.c  |   9 ++--
 target-i386/seg_helper.c  |   6 ++-
 target-i386/smm_helper.c  | 103 --
 target-i386/svm_helper.c  |  28 ++-
 target-ppc/excp_helper.c  |   4 +-
 target-ppc/mmu-hash32.h   |   6 ++-
 target-s390x/cpu.c|   2 +-
 target-sparc/ldst_helper.c|   8 +--
 target-sparc/mmu_helper.c |  20 
 target-unicore32/softmmu.c|   5 +-
 target-xtensa/helper.c|   3 +-
 30 files changed, 190 insertions(+), 149 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index a6c01f4..8943493 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -395,7 +395,10 @@ int cpu_exec(CPUArchState *env)
 /* FIXME: this should respect TPR */
 cpu_svm_check_intercept_param(env, SVM_EXIT_VINTR,
   0);
-intno = ldl_phys(env-vm_vmcb + offsetof(struct 
vmcb, control.int_vector));
+intno = ldl_phys(cpu-as,
+ env-vm_vmcb
+ + offsetof(struct vmcb,
+control.int_vector));
 qemu_log_mask(CPU_LOG_TB_IN_ASM, Servicing 
virtual hardware INT=0x%02x\n, intno);
 do_interrupt_x86_hardirq(env, intno, 1);
 cpu-interrupt_request = ~CPU_INTERRUPT_VIRQ;
diff --git a/exec.c b/exec.c
index a1d8bbe..aa208be 100644
--- a/exec.c
+++ b/exec.c
@@ -1599,7 +1599,7 @@ static uint64_t watch_mem_read(void *opaque, hwaddr addr,
 switch (size) {
 case 1: return ldub_phys(addr);
 case 2: return lduw_phys(addr);
-case 4: return ldl_phys(addr);
+case 4: return ldl_phys(address_space_memory, addr);
 default: abort();
 }
 }
@@ -2345,7 +2345,7 @@ void cpu_physical_memory_unmap(void *buffer, hwaddr len,
 }
 
 /* warning: addr must be aligned */
-static inline uint32_t ldl_phys_internal(hwaddr addr,
+static inline uint32_t ldl_phys_internal(AddressSpace *as, hwaddr addr,
  enum device_endian endian)
 {
 uint8_t *ptr;
@@ -2354,8 +2354,7 @@ static inline uint32_t ldl_phys_internal(hwaddr addr,
 hwaddr l = 4;
 hwaddr addr1;
 
-mr = address_space_translate(address_space_memory, addr, addr1, l,
- false);
+mr = address_space_translate(as, addr, addr1, l, false);
 if (l  4 || !memory_access_is_direct(mr, false)) {
 /* I/O case */
 io_mem_read(mr, addr1, val, 4);
@@ -2388,19 +2387,19 @@ static inline uint32_t ldl_phys_internal(hwaddr addr,
 return val;
 }
 
-uint32_t ldl_phys(hwaddr addr)
+uint32_t ldl_phys(AddressSpace *as, hwaddr addr)
 {
-return ldl_phys_internal(addr, DEVICE_NATIVE_ENDIAN);
+return ldl_phys_internal(as, addr, DEVICE_NATIVE_ENDIAN);
 }
 
-uint32_t ldl_le_phys(hwaddr addr)
+uint32_t ldl_le_phys(AddressSpace *as, hwaddr addr)
 {
-return ldl_phys_internal(addr, DEVICE_LITTLE_ENDIAN);
+return ldl_phys_internal(as, addr, DEVICE_LITTLE_ENDIAN);
 }
 
-uint32_t ldl_be_phys(hwaddr addr)
+uint32_t ldl_be_phys(AddressSpace *as, hwaddr addr)
 {
-return ldl_phys_internal(addr, DEVICE_BIG_ENDIAN);
+return ldl_phys_internal(as, addr, DEVICE_BIG_ENDIAN);
 }
 
 /* warning: addr must be aligned */
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
index cb7bda9..741dd20 100644
--- a/hw/dma/pl080.c
+++ b/hw/dma/pl080.c
@@ -8,6 +8,7 @@
  */
 
 #include hw/sysbus.h
+#include exec/address-spaces.h
 
 #define PL080_MAX_CHANNELS 8
 #define PL080_CONF_E0x1
@@ -204,10 +205,10 @@ again:
 if (size == 0) {
 /* Transfer complete.  */
 if (ch-lli) {
-ch-src = ldl_le_phys(ch-lli);
-ch-dest = ldl_le_phys(ch-lli + 4);
-

[Qemu-devel] [PATCH v4 12/22] exec: Make stl_*_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c |  19 +
 hw/net/vmware_utils.h  |   2 +-
 hw/pci/msi.c   |   2 +-
 hw/pci/msix.c  |   2 +-
 hw/ppc/ppc405_uc.c |  33 +++
 hw/ppc/spapr_hcall.c   |   4 +-
 hw/s390x/css.c |   2 +-
 hw/s390x/s390-virtio-bus.c |   2 +-
 hw/s390x/virtio-ccw.c  |   2 +-
 hw/scsi/megasas.c  |   6 ++-
 hw/scsi/vmw_pvscsi.c   |   3 +-
 hw/sh4/r2d.c   |   2 +-
 hw/timer/hpet.c|   3 +-
 hw/virtio/virtio.c |   4 +-
 include/exec/cpu-common.h  |   6 +--
 include/hw/ppc/spapr.h |   2 +-
 target-alpha/helper.h  |   2 +-
 target-alpha/mem_helper.c  |   7 ++--
 target-alpha/translate.c   |   2 +-
 target-arm/helper.c|   3 +-
 target-i386/seg_helper.c   |   8 ++--
 target-i386/smm_helper.c   | 100 ++---
 target-i386/svm_helper.c   |  28 -
 target-ppc/mmu-hash32.h|   6 ++-
 target-sparc/ldst_helper.c |   6 +--
 25 files changed, 137 insertions(+), 119 deletions(-)

diff --git a/exec.c b/exec.c
index f8be6da..a1f720c 100644
--- a/exec.c
+++ b/exec.c
@@ -1616,7 +1616,7 @@ static void watch_mem_write(void *opaque, hwaddr addr,
 stw_phys(addr, val);
 break;
 case 4:
-stl_phys(addr, val);
+stl_phys(address_space_memory, addr, val);
 break;
 default: abort();
 }
@@ -2561,7 +2561,8 @@ void stl_phys_notdirty(hwaddr addr, uint32_t val)
 }
 
 /* warning: addr must be aligned */
-static inline void stl_phys_internal(hwaddr addr, uint32_t val,
+static inline void stl_phys_internal(AddressSpace *as,
+ hwaddr addr, uint32_t val,
  enum device_endian endian)
 {
 uint8_t *ptr;
@@ -2569,7 +2570,7 @@ static inline void stl_phys_internal(hwaddr addr, 
uint32_t val,
 hwaddr l = 4;
 hwaddr addr1;
 
-mr = address_space_translate(address_space_memory, addr, addr1, l,
+mr = address_space_translate(as, addr, addr1, l,
  true);
 if (l  4 || !memory_access_is_direct(mr, true)) {
 #if defined(TARGET_WORDS_BIGENDIAN)
@@ -2601,19 +2602,19 @@ static inline void stl_phys_internal(hwaddr addr, 
uint32_t val,
 }
 }
 
-void stl_phys(hwaddr addr, uint32_t val)
+void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
-stl_phys_internal(addr, val, DEVICE_NATIVE_ENDIAN);
+stl_phys_internal(as, addr, val, DEVICE_NATIVE_ENDIAN);
 }
 
-void stl_le_phys(hwaddr addr, uint32_t val)
+void stl_le_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
-stl_phys_internal(addr, val, DEVICE_LITTLE_ENDIAN);
+stl_phys_internal(as, addr, val, DEVICE_LITTLE_ENDIAN);
 }
 
-void stl_be_phys(hwaddr addr, uint32_t val)
+void stl_be_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
-stl_phys_internal(addr, val, DEVICE_BIG_ENDIAN);
+stl_phys_internal(as, addr, val, DEVICE_BIG_ENDIAN);
 }
 
 /* XXX: optimize */
diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h
index 4cf0e79..2ed73af 100644
--- a/hw/net/vmware_utils.h
+++ b/hw/net/vmware_utils.h
@@ -104,7 +104,7 @@ static inline void
 vmw_shmem_st32(hwaddr addr, uint32_t value)
 {
 VMW_SHPRN(SHMEM store32: % PRIx64  (value 0x%X), addr, value);
-stl_le_phys(addr, value);
+stl_le_phys(address_space_memory, addr, value);
 }
 
 static inline uint64_t
diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index 2a04d18..a4a3040 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -291,7 +291,7 @@ void msi_notify(PCIDevice *dev, unsigned int vector)
notify vector 0x%x
 address: 0x%PRIx64 data: 0x%PRIx32\n,
vector, msg.address, msg.data);
-stl_le_phys(msg.address, msg.data);
+stl_le_phys(address_space_memory, msg.address, msg.data);
 }
 
 /* Normally called by pci_default_write_config(). */
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 3430770..5c49bfc 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -439,7 +439,7 @@ void msix_notify(PCIDevice *dev, unsigned vector)
 
 msg = msix_get_message(dev, vector);
 
-stl_le_phys(msg.address, msg.data);
+stl_le_phys(address_space_memory, msg.address, msg.data);
 }
 
 void msix_reset(PCIDevice *dev)
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index 8109f92..47a4242 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -44,6 +44,7 @@
 ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4xx_bd_info_t *bd,
 uint32_t flags)
 {
+CPUState *cs = ENV_GET_CPU(env);
 ram_addr_t bdloc;
 int i, n;
 
@@ -52,30 +53,30 @@ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, 
ppc4xx_bd_info_t *bd,
 bdloc = 0x0100UL - sizeof(struct ppc4xx_bd_info_t);
 else
 bdloc = bd-bi_memsize - sizeof(struct ppc4xx_bd_info_t);
-

Re: [Qemu-devel] [PATCH 01/10] block: Change BDS parameter of bdrv_open() to **

2014-02-03 Thread Kevin Wolf
Am 31.01.2014 um 21:07 hat Max Reitz geschrieben:
 So in summary, it looks technically correct, but I'm not sure about
 maintainability. If the problems are only for this intermediate state,
 I'm okay with leaving them as they are, but otherwise we should try and
 figure out something.
 
 You're right in that bdrv_open should always create a new BDS and
 new BDS should always be created through bdrv_open; but right now,
 there are some places in the code (such as blockdev_init()) which I
 was just afraid of touching as they seemed to heavily rely on being
 able to separate those two steps.

Sure, there's a good reason why we work in incremental steps. This is a
huge conversion of infrastructure and trying to change it all at once
never worked out. We shouldn't worry too much about ugly intermediate
states as long as we're sure that they are really just intermediate.

Kevin



[Qemu-devel] [PATCH v4 11/22] exec: Make stq_*_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c |  12 +++---
 hw/alpha/dp264.c   |   5 ++-
 hw/net/vmware_utils.h  |   2 +-
 hw/ppc/spapr_hcall.c   |   6 ++-
 hw/s390x/s390-virtio-bus.c |   3 +-
 hw/s390x/virtio-ccw.c  |   4 +-
 hw/scsi/megasas.c  |   3 +-
 include/exec/cpu-common.h  |   6 +--
 target-alpha/helper.h  |   2 +-
 target-alpha/mem_helper.c  |   7 +--
 target-alpha/translate.c   |   2 +-
 target-i386/helper.c   |   3 +-
 target-i386/smm_helper.c   |  33 ---
 target-i386/svm_helper.c   | 103 +++--
 target-ppc/mmu-hash64.h|   7 ++-
 target-s390x/helper.c  |   8 +++-
 target-s390x/mem_helper.c  |   3 +-
 target-sparc/ldst_helper.c |  15 ---
 18 files changed, 132 insertions(+), 92 deletions(-)

diff --git a/exec.c b/exec.c
index 11abe89..f8be6da 100644
--- a/exec.c
+++ b/exec.c
@@ -2680,22 +2680,22 @@ void stw_be_phys(hwaddr addr, uint32_t val)
 }
 
 /* XXX: optimize */
-void stq_phys(hwaddr addr, uint64_t val)
+void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val)
 {
 val = tswap64(val);
-cpu_physical_memory_write(addr, val, 8);
+address_space_rw(as, addr, (void *) val, 8, 1);
 }
 
-void stq_le_phys(hwaddr addr, uint64_t val)
+void stq_le_phys(AddressSpace *as, hwaddr addr, uint64_t val)
 {
 val = cpu_to_le64(val);
-cpu_physical_memory_write(addr, val, 8);
+address_space_rw(as, addr, (void *) val, 8, 1);
 }
 
-void stq_be_phys(hwaddr addr, uint64_t val)
+void stq_be_phys(AddressSpace *as, hwaddr addr, uint64_t val)
 {
 val = cpu_to_be64(val);
-cpu_physical_memory_write(addr, val, 8);
+address_space_rw(as, addr, (void *) val, 8, 1);
 }
 
 /* virtual memory access for debug (includes writing to ROM) */
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 20795ac..1351ba5 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -161,8 +161,9 @@ static void clipper_init(QEMUMachineInitArgs *args)
 load_image_targphys(initrd_filename, initrd_base,
 ram_size - initrd_base);
 
-stq_phys(param_offset + 0x100, initrd_base + 
0xfc00ULL);
-stq_phys(param_offset + 0x108, initrd_size);
+stq_phys(address_space_memory,
+ param_offset + 0x100, initrd_base + 
0xfc00ULL);
+stq_phys(address_space_memory, param_offset + 0x108, initrd_size);
 }
 }
 }
diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h
index 7877cb6..4cf0e79 100644
--- a/hw/net/vmware_utils.h
+++ b/hw/net/vmware_utils.h
@@ -119,7 +119,7 @@ static inline void
 vmw_shmem_st64(hwaddr addr, uint64_t value)
 {
 VMW_SHPRN(SHMEM store64: % PRIx64  (value % PRIx64 ), addr, value);
-stq_le_phys(addr, value);
+stq_le_phys(address_space_memory, addr, value);
 }
 
 /* Macros for simplification of operations on array-style registers */
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index a2893ad..5ce43ab 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -559,6 +559,8 @@ static target_ulong h_logical_load(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 static target_ulong h_logical_store(PowerPCCPU *cpu, sPAPREnvironment *spapr,
 target_ulong opcode, target_ulong *args)
 {
+CPUState *cs = CPU(cpu);
+
 target_ulong size = args[0];
 target_ulong addr = args[1];
 target_ulong val  = args[2];
@@ -574,7 +576,7 @@ static target_ulong h_logical_store(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 stl_phys(addr, val);
 return H_SUCCESS;
 case 8:
-stq_phys(addr, val);
+stq_phys(cs-as, addr, val);
 return H_SUCCESS;
 }
 return H_PARAMETER;
@@ -639,7 +641,7 @@ static target_ulong h_logical_memop(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 stl_phys(dst, tmp);
 break;
 case 3:
-stq_phys(dst, tmp);
+stq_phys(cs-as, dst, tmp);
 break;
 }
 dst = dst + step;
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index 83e7287..87a1591 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -378,7 +378,8 @@ void s390_virtio_device_sync(VirtIOS390Device *dev)
 vring = s390_virtio_next_ring(bus);
 virtio_queue_set_addr(dev-vdev, i, vring);
 virtio_queue_set_vector(dev-vdev, i, i);
-stq_be_phys(vq + VIRTIO_VQCONFIG_OFFS_ADDRESS, vring);
+stq_be_phys(address_space_memory,
+vq + VIRTIO_VQCONFIG_OFFS_ADDRESS, vring);
 stw_be_phys(vq + VIRTIO_VQCONFIG_OFFS_NUM, 
virtio_queue_get_num(dev-vdev, i));
 }
 
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 50d852a..20ad77e 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -873,7 +873,7 @@ static void 

Re: [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support

2014-02-03 Thread Gerd Hoffmann
  Hi,

  It looks like doing it right for relative is easy:
 
  But what is the point when this isn't used anyway?
 
 In what sense it is not used?

Old code is obviously broken for the relative case.

Seems to be used by hw/arm/spitz.c, which probably
emulates a absolute pointing device.  Machine type
name contains 'PDA', so I guess a touch screen ...

cheers,
  Gerd






[Qemu-devel] [PATCH v4 09/22] exec: Make ldq/ldub_*_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c|  22 +++
 hw/alpha/typhoon.c|   2 +-
 hw/display/sm501.c|   1 +
 hw/display/sm501_template.h   |   2 +-
 hw/net/vmware_utils.h |   4 +-
 hw/ppc/spapr_hcall.c  |  11 ++--
 hw/s390x/s390-virtio-bus.c|   5 +-
 hw/s390x/virtio-ccw.c |  18 +++---
 hw/scsi/megasas.c |   3 +-
 hw/virtio/virtio.c|   2 +-
 include/exec/cpu-common.h |   8 +--
 monitor.c |   2 +-
 target-alpha/helper.c |   7 ++-
 target-alpha/helper.h |   2 +-
 target-alpha/mem_helper.c |  11 ++--
 target-alpha/translate.c  |   2 +-
 target-arm/helper.c   |   3 +-
 target-i386/arch_memory_mapping.c |  10 ++--
 target-i386/helper.c  |  20 +++
 target-i386/smm_helper.c  |  32 +--
 target-i386/svm_helper.c  | 117 +++---
 target-ppc/mmu-hash64.h   |   7 ++-
 target-s390x/helper.c |   3 +-
 target-s390x/mem_helper.c |   3 +-
 target-sparc/ldst_helper.c|  25 
 25 files changed, 185 insertions(+), 137 deletions(-)

diff --git a/exec.c b/exec.c
index aa208be..3bc4497 100644
--- a/exec.c
+++ b/exec.c
@@ -1597,7 +1597,7 @@ static uint64_t watch_mem_read(void *opaque, hwaddr addr,
 {
 check_watchpoint(addr  ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_READ);
 switch (size) {
-case 1: return ldub_phys(addr);
+case 1: return ldub_phys(address_space_memory, addr);
 case 2: return lduw_phys(addr);
 case 4: return ldl_phys(address_space_memory, addr);
 default: abort();
@@ -2403,7 +2403,7 @@ uint32_t ldl_be_phys(AddressSpace *as, hwaddr addr)
 }
 
 /* warning: addr must be aligned */
-static inline uint64_t ldq_phys_internal(hwaddr addr,
+static inline uint64_t ldq_phys_internal(AddressSpace *as, hwaddr addr,
  enum device_endian endian)
 {
 uint8_t *ptr;
@@ -2412,7 +2412,7 @@ static inline uint64_t ldq_phys_internal(hwaddr addr,
 hwaddr l = 8;
 hwaddr addr1;
 
-mr = address_space_translate(address_space_memory, addr, addr1, l,
+mr = address_space_translate(as, addr, addr1, l,
  false);
 if (l  8 || !memory_access_is_direct(mr, false)) {
 /* I/O case */
@@ -2446,26 +2446,26 @@ static inline uint64_t ldq_phys_internal(hwaddr addr,
 return val;
 }
 
-uint64_t ldq_phys(hwaddr addr)
+uint64_t ldq_phys(AddressSpace *as, hwaddr addr)
 {
-return ldq_phys_internal(addr, DEVICE_NATIVE_ENDIAN);
+return ldq_phys_internal(as, addr, DEVICE_NATIVE_ENDIAN);
 }
 
-uint64_t ldq_le_phys(hwaddr addr)
+uint64_t ldq_le_phys(AddressSpace *as, hwaddr addr)
 {
-return ldq_phys_internal(addr, DEVICE_LITTLE_ENDIAN);
+return ldq_phys_internal(as, addr, DEVICE_LITTLE_ENDIAN);
 }
 
-uint64_t ldq_be_phys(hwaddr addr)
+uint64_t ldq_be_phys(AddressSpace *as, hwaddr addr)
 {
-return ldq_phys_internal(addr, DEVICE_BIG_ENDIAN);
+return ldq_phys_internal(as, addr, DEVICE_BIG_ENDIAN);
 }
 
 /* XXX: optimize */
-uint32_t ldub_phys(hwaddr addr)
+uint32_t ldub_phys(AddressSpace *as, hwaddr addr)
 {
 uint8_t val;
-cpu_physical_memory_read(addr, val, 1);
+address_space_rw(as, addr, val, 1, 0);
 return val;
 }
 
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index 71a5a37..67a1070 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -613,7 +613,7 @@ static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, 
IOMMUTLBEntry *ret)
translation, given the address of the PTE.  */
 static bool pte_translate(hwaddr pte_addr, IOMMUTLBEntry *ret)
 {
-uint64_t pte = ldq_phys(pte_addr);
+uint64_t pte = ldq_phys(address_space_memory, pte_addr);
 
 /* Check valid bit.  */
 if ((pte  1) == 0) {
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index c75d6ac..0b5f993 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -30,6 +30,7 @@
 #include hw/sysbus.h
 #include qemu/range.h
 #include ui/pixel_ops.h
+#include exec/address-spaces.h
 
 /*
  * Status: 2010/05/07
diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
index 2d4a3d8..d4cea9e 100644
--- a/hw/display/sm501_template.h
+++ b/hw/display/sm501_template.h
@@ -120,7 +120,7 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(SM501State * 
s, int crt,
 
 /* get pixel value */
 if (i % 4 == 0) {
-bitset = ldub_phys(cursor_addr);
+bitset = ldub_phys(address_space_memory, cursor_addr);
 cursor_addr++;
 }
 v = bitset  3;
diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h
index b465eb6..eb98d2a 100644
--- a/hw/net/vmware_utils.h
+++ b/hw/net/vmware_utils.h
@@ -65,7 +65,7 @@ vmw_shmem_set(hwaddr addr, uint8 val, int len)
 

[Qemu-devel] [PATCH v4 17/22] exec: Make cpu_memory_rw_debug use the CPUs AS

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index 7045f76..8c05087 100644
--- a/exec.c
+++ b/exec.c
@@ -2717,11 +2717,11 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong 
addr,
 if (l  len)
 l = len;
 phys_addr += (addr  ~TARGET_PAGE_MASK);
-if (is_write)
-cpu_physical_memory_write_rom(address_space_memory,
-  phys_addr, buf, l);
-else
-cpu_physical_memory_rw(phys_addr, buf, l, is_write);
+if (is_write) {
+cpu_physical_memory_write_rom(cpu-as, phys_addr, buf, l);
+} else {
+address_space_rw(cpu-as, phys_addr, buf, l, 0);
+}
 len -= l;
 buf += l;
 addr += l;
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 18/22] memory: Add address_space_find_by_name()

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 include/exec/memory.h |  9 +
 memory.c  | 12 
 translate-all.c   | 10 --
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 9101fc3..8465d5b 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1054,4 +1054,13 @@ void address_space_unmap(AddressSpace *as, void *buffer, 
hwaddr len,
 
 #endif
 
+/**
+ * address_space_find_by_name: Find an AddressSpace * by name
+ *
+ * Returns an AddressSpace * if found.
+ *
+ * @name: name of an address space too look for.
+ */
+AddressSpace *address_space_find_by_name(const char *name);
+
 #endif
diff --git a/memory.c b/memory.c
index 59ecc28..22fbe16 100644
--- a/memory.c
+++ b/memory.c
@@ -1720,6 +1720,18 @@ void address_space_init(AddressSpace *as, MemoryRegion 
*root, const char *name)
 memory_region_transaction_commit();
 }
 
+AddressSpace *address_space_find_by_name(const char *name)
+{
+AddressSpace *as;
+
+QTAILQ_FOREACH(as, address_spaces, address_spaces_link) {
+if (strcmp(as-name, name) == 0) {
+return as;
+}
+}
+return NULL;
+}
+
 void address_space_destroy(AddressSpace *as)
 {
 /* Flush out anything from MemoryListeners listening in on this */
diff --git a/translate-all.c b/translate-all.c
index 1ac0246..9950c3b 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -52,9 +52,8 @@
 #include libutil.h
 #endif
 #endif
-#else
-#include exec/address-spaces.h
 #endif
+#include exec/address-spaces.h
 
 #include exec/cputlb.h
 #include translate-all.h
@@ -1565,6 +1564,13 @@ void cpu_interrupt(CPUState *cpu, int mask)
 cpu-tcg_exit_req = 1;
 }
 
+/* Find an address space by name in user emulation.  */
+AddressSpace *address_space_find_by_name(const char *name)
+{
+/* Unsupported.  */
+return NULL;
+}
+
 /*
  * Walks guest process memory regions one by one
  * and calls callback function 'fn' for each region.
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 13/22] exec: Make stl_phys_notdirty input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c|  4 ++--
 hw/arm/boot.c |  5 +++--
 hw/arm/highbank.c |  6 +++---
 include/exec/cpu-common.h |  2 +-
 target-i386/helper.c  | 16 
 target-sparc/mmu_helper.c |  2 +-
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/exec.c b/exec.c
index a1f720c..9d4a4e0 100644
--- a/exec.c
+++ b/exec.c
@@ -2531,14 +2531,14 @@ uint32_t lduw_be_phys(AddressSpace *as, hwaddr addr)
 /* warning: addr must be aligned. The ram page is not masked as dirty
and the code inside is not invalidated. It is useful if the dirty
bits are used to track modified PTEs */
-void stl_phys_notdirty(hwaddr addr, uint32_t val)
+void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val)
 {
 uint8_t *ptr;
 MemoryRegion *mr;
 hwaddr l = 4;
 hwaddr addr1;
 
-mr = address_space_translate(address_space_memory, addr, addr1, l,
+mr = address_space_translate(as, addr, addr1, l,
  true);
 if (l  4 || !memory_access_is_direct(mr, true)) {
 io_mem_write(mr, addr1, val, 4);
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 4036262..dc62918 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -16,6 +16,7 @@
 #include elf.h
 #include sysemu/device_tree.h
 #include qemu/config-file.h
+#include exec/address-spaces.h
 
 /* Kernel boot protocol is specified in the kernel docs
  * Documentation/arm/Booting and Documentation/arm64/booting.txt
@@ -169,7 +170,7 @@ static void default_reset_secondary(ARMCPU *cpu,
 {
 CPUARMState *env = cpu-env;
 
-stl_phys_notdirty(info-smp_bootreg_addr, 0);
+stl_phys_notdirty(address_space_memory, info-smp_bootreg_addr, 0);
 env-regs[15] = info-smp_loader_start;
 }
 
@@ -179,7 +180,7 @@ static inline bool have_dtb(const struct arm_boot_info 
*info)
 }
 
 #define WRITE_WORD(p, value) do { \
-stl_phys_notdirty(p, value);  \
+stl_phys_notdirty(address_space_memory, p, value);  \
 p += 4;   \
 } while (0)
 
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index d76a1d1..f66d57b 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -69,11 +69,11 @@ static void hb_reset_secondary(ARMCPU *cpu, const struct 
arm_boot_info *info)
 
 switch (info-nb_cpus) {
 case 4:
-stl_phys_notdirty(SMP_BOOT_REG + 0x30, 0);
+stl_phys_notdirty(address_space_memory, SMP_BOOT_REG + 0x30, 0);
 case 3:
-stl_phys_notdirty(SMP_BOOT_REG + 0x20, 0);
+stl_phys_notdirty(address_space_memory, SMP_BOOT_REG + 0x20, 0);
 case 2:
-stl_phys_notdirty(SMP_BOOT_REG + 0x10, 0);
+stl_phys_notdirty(address_space_memory, SMP_BOOT_REG + 0x10, 0);
 env-regs[15] = SMP_BOOT_ADDR;
 break;
 default:
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index d005c98..525fb62 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -102,7 +102,7 @@ void stq_be_phys(AddressSpace *as, hwaddr addr, uint64_t 
val);
 uint32_t lduw_phys(AddressSpace *as, hwaddr addr);
 uint32_t ldl_phys(AddressSpace *as, hwaddr addr);
 uint64_t ldq_phys(AddressSpace *as, hwaddr addr);
-void stl_phys_notdirty(hwaddr addr, uint32_t val);
+void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val);
 void stw_phys(hwaddr addr, uint32_t val);
 void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val);
 void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val);
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 0606908..55c0457 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -574,7 +574,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong 
addr,
 }
 if (!(pml4e  PG_ACCESSED_MASK)) {
 pml4e |= PG_ACCESSED_MASK;
-stl_phys_notdirty(pml4e_addr, pml4e);
+stl_phys_notdirty(cs-as, pml4e_addr, pml4e);
 }
 ptep = pml4e ^ PG_NX_MASK;
 pdpe_addr = ((pml4e  PHYS_ADDR_MASK) + (((addr  30)  0x1ff)  
3)) 
@@ -591,7 +591,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong 
addr,
 ptep = pdpe ^ PG_NX_MASK;
 if (!(pdpe  PG_ACCESSED_MASK)) {
 pdpe |= PG_ACCESSED_MASK;
-stl_phys_notdirty(pdpe_addr, pdpe);
+stl_phys_notdirty(cs-as, pdpe_addr, pdpe);
 }
 } else
 #endif
@@ -661,7 +661,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong 
addr,
 pde |= PG_ACCESSED_MASK;
 if (is_dirty)
 pde |= PG_DIRTY_MASK;
-stl_phys_notdirty(pde_addr, pde);
+stl_phys_notdirty(cs-as, pde_addr, pde);
 }
 /* align to page_size */
 pte = pde  ((PHYS_ADDR_MASK  ~(page_size - 1)) | 0xfff);
@@ -670,7 +670,7 @@ int 

[Qemu-devel] [PATCH v4 20/22] cpu: Add address-space property

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 qom/cpu.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/qom/cpu.c b/qom/cpu.c
index 9d62479..fc6dbff 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -24,6 +24,7 @@
 #include qemu/notify.h
 #include qemu/log.h
 #include sysemu/sysemu.h
+#include hw/qdev-properties.h
 
 bool cpu_exists(int64_t id)
 {
@@ -237,6 +238,11 @@ static int64_t cpu_common_get_arch_id(CPUState *cpu)
 return cpu-cpu_index;
 }
 
+static Property cpu_properties[] = {
+DEFINE_PROP_ADDRESS_SPACE(address-space, CPUState, as),
+DEFINE_PROP_END_OF_LIST(),
+};
+
 static void cpu_class_init(ObjectClass *klass, void *data)
 {
 DeviceClass *dc = DEVICE_CLASS(klass);
@@ -253,6 +259,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
 k-write_elf64_note = cpu_common_write_elf64_note;
 k-gdb_read_register = cpu_common_gdb_read_register;
 k-gdb_write_register = cpu_common_gdb_write_register;
+dc-props = cpu_properties;
 dc-realize = cpu_common_realizefn;
 /*
  * Reason: CPUs still need special care by board code: wiring up
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 21/22] petalogix-ml605: Create the CPU with object_new()

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

This is to allow future patches to set properties before cpu::realize().

Reviewed-by: Andreas Färber afaer...@suse.de
Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 hw/microblaze/petalogix_ml605_mmu.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/microblaze/petalogix_ml605_mmu.c 
b/hw/microblaze/petalogix_ml605_mmu.c
index 1a87756..37cbbfd 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -75,7 +75,6 @@ static void
 petalogix_ml605_init(QEMUMachineInitArgs *args)
 {
 ram_addr_t ram_size = args-ram_size;
-const char *cpu_model = args-cpu_model;
 MemoryRegion *address_space_mem = get_system_memory();
 DeviceState *dev, *dma, *eth0;
 Object *ds, *cs;
@@ -89,10 +88,8 @@ petalogix_ml605_init(QEMUMachineInitArgs *args)
 qemu_irq irq[32];
 
 /* init CPUs */
-if (cpu_model == NULL) {
-cpu_model = microblaze;
-}
-cpu = cpu_mb_init(cpu_model);
+cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+object_property_set_bool(OBJECT(cpu), true, realized, error_abort);
 
 /* Attach emulated BRAM through the LMB.  */
 memory_region_init_ram(phys_lmb_bram, NULL, petalogix_ml605.lmb_bram,
-- 
1.8.1.2




[Qemu-devel] [PATCH v4 14/22] exec: Make stw_*_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c | 20 ++--
 hw/net/vmware_utils.h  |  2 +-
 hw/ppc/ppc405_uc.c |  2 +-
 hw/ppc/spapr_hcall.c   |  4 ++--
 hw/s390x/css.c |  3 ++-
 hw/s390x/s390-virtio-bus.c |  8 +---
 hw/s390x/virtio-ccw.c  |  3 ++-
 hw/sh4/r2d.c   |  2 +-
 hw/virtio/virtio.c | 10 ++
 include/exec/cpu-common.h  |  6 +++---
 target-i386/smm_helper.c   | 12 ++--
 target-i386/svm_helper.c   |  4 ++--
 target-s390x/mem_helper.c  |  3 ++-
 target-sparc/ldst_helper.c |  6 +++---
 14 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/exec.c b/exec.c
index 9d4a4e0..3389b90 100644
--- a/exec.c
+++ b/exec.c
@@ -1613,7 +1613,7 @@ static void watch_mem_write(void *opaque, hwaddr addr,
 stb_phys(addr, val);
 break;
 case 2:
-stw_phys(addr, val);
+stw_phys(address_space_memory, addr, val);
 break;
 case 4:
 stl_phys(address_space_memory, addr, val);
@@ -2625,7 +2625,8 @@ void stb_phys(hwaddr addr, uint32_t val)
 }
 
 /* warning: addr must be aligned */
-static inline void stw_phys_internal(hwaddr addr, uint32_t val,
+static inline void stw_phys_internal(AddressSpace *as,
+ hwaddr addr, uint32_t val,
  enum device_endian endian)
 {
 uint8_t *ptr;
@@ -2633,8 +2634,7 @@ static inline void stw_phys_internal(hwaddr addr, 
uint32_t val,
 hwaddr l = 2;
 hwaddr addr1;
 
-mr = address_space_translate(address_space_memory, addr, addr1, l,
- true);
+mr = address_space_translate(as, addr, addr1, l, true);
 if (l  2 || !memory_access_is_direct(mr, true)) {
 #if defined(TARGET_WORDS_BIGENDIAN)
 if (endian == DEVICE_LITTLE_ENDIAN) {
@@ -2665,19 +2665,19 @@ static inline void stw_phys_internal(hwaddr addr, 
uint32_t val,
 }
 }
 
-void stw_phys(hwaddr addr, uint32_t val)
+void stw_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
-stw_phys_internal(addr, val, DEVICE_NATIVE_ENDIAN);
+stw_phys_internal(as, addr, val, DEVICE_NATIVE_ENDIAN);
 }
 
-void stw_le_phys(hwaddr addr, uint32_t val)
+void stw_le_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
-stw_phys_internal(addr, val, DEVICE_LITTLE_ENDIAN);
+stw_phys_internal(as, addr, val, DEVICE_LITTLE_ENDIAN);
 }
 
-void stw_be_phys(hwaddr addr, uint32_t val)
+void stw_be_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
-stw_phys_internal(addr, val, DEVICE_BIG_ENDIAN);
+stw_phys_internal(as, addr, val, DEVICE_BIG_ENDIAN);
 }
 
 /* XXX: optimize */
diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h
index 2ed73af..d8f734f 100644
--- a/hw/net/vmware_utils.h
+++ b/hw/net/vmware_utils.h
@@ -89,7 +89,7 @@ static inline void
 vmw_shmem_st16(hwaddr addr, uint16_t value)
 {
 VMW_SHPRN(SHMEM store16: % PRIx64  (value 0x%X), addr, value);
-stw_le_phys(addr, value);
+stw_le_phys(address_space_memory, addr, value);
 }
 
 static inline uint32_t
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index 47a4242..b0a59c3 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -65,7 +65,7 @@ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, 
ppc4xx_bd_info_t *bd,
 for (i = 0; i  6; i++) {
 stb_phys(bdloc + 0x24 + i, bd-bi_enetaddr[i]);
 }
-stw_be_phys(bdloc + 0x2A, bd-bi_ethspeed);
+stw_be_phys(cs-as, bdloc + 0x2A, bd-bi_ethspeed);
 stl_be_phys(cs-as, bdloc + 0x2C, bd-bi_intfreq);
 stl_be_phys(cs-as, bdloc + 0x30, bd-bi_busfreq);
 stl_be_phys(cs-as, bdloc + 0x34, bd-bi_baudrate);
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index f47c3ec..ebf09e9 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -570,7 +570,7 @@ static target_ulong h_logical_store(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 stb_phys(addr, val);
 return H_SUCCESS;
 case 2:
-stw_phys(addr, val);
+stw_phys(cs-as, addr, val);
 return H_SUCCESS;
 case 4:
 stl_phys(cs-as, addr, val);
@@ -635,7 +635,7 @@ static target_ulong h_logical_memop(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 stb_phys(dst, tmp);
 break;
 case 1:
-stw_phys(dst, tmp);
+stw_phys(cs-as, dst, tmp);
 break;
 case 2:
 stl_phys(cs-as, dst, tmp);
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index cfa8a9b..75b04b4 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -680,7 +680,8 @@ static void css_update_chnmon(SubchDev *sch)
 count = lduw_phys(address_space_memory,
   channel_subsys-chnmon_area + offset);
 count++;
-stw_phys(channel_subsys-chnmon_area + offset, count);
+stw_phys(address_space_memory,
+ channel_subsys-chnmon_area + offset, count);
 }
 

[Qemu-devel] [PATCH v4 15/22] exec: Make stb_phys input an AddressSpace

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c |  6 +++---
 hw/net/vmware_utils.h  |  2 +-
 hw/ppc/ppc405_uc.c | 10 +-
 hw/ppc/spapr_hcall.c   |  6 +++---
 hw/s390x/s390-virtio-bus.c | 16 +++-
 hw/s390x/s390-virtio.c |  2 +-
 hw/scsi/megasas.c  |  6 --
 include/exec/cpu-common.h  |  2 +-
 target-i386/svm_helper.c   |  2 +-
 target-s390x/mem_helper.c  |  2 +-
 target-sparc/ldst_helper.c |  6 +++---
 11 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/exec.c b/exec.c
index 3389b90..248b824 100644
--- a/exec.c
+++ b/exec.c
@@ -1610,7 +1610,7 @@ static void watch_mem_write(void *opaque, hwaddr addr,
 check_watchpoint(addr  ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_WRITE);
 switch (size) {
 case 1:
-stb_phys(addr, val);
+stb_phys(address_space_memory, addr, val);
 break;
 case 2:
 stw_phys(address_space_memory, addr, val);
@@ -2618,10 +2618,10 @@ void stl_be_phys(AddressSpace *as, hwaddr addr, 
uint32_t val)
 }
 
 /* XXX: optimize */
-void stb_phys(hwaddr addr, uint32_t val)
+void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val)
 {
 uint8_t v = val;
-cpu_physical_memory_write(addr, v, 1);
+address_space_rw(as, addr, v, 1, 1);
 }
 
 /* warning: addr must be aligned */
diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h
index d8f734f..1099df6 100644
--- a/hw/net/vmware_utils.h
+++ b/hw/net/vmware_utils.h
@@ -74,7 +74,7 @@ static inline void
 vmw_shmem_st8(hwaddr addr, uint8_t value)
 {
 VMW_SHPRN(SHMEM store8: % PRIx64  (value 0x%X), addr, value);
-stb_phys(addr, value);
+stb_phys(address_space_memory, addr, value);
 }
 
 static inline uint32_t
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index b0a59c3..ca520e8 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -63,27 +63,27 @@ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, 
ppc4xx_bd_info_t *bd,
 stl_be_phys(cs-as, bdloc + 0x1C, bd-bi_bootflags);
 stl_be_phys(cs-as, bdloc + 0x20, bd-bi_ipaddr);
 for (i = 0; i  6; i++) {
-stb_phys(bdloc + 0x24 + i, bd-bi_enetaddr[i]);
+stb_phys(cs-as, bdloc + 0x24 + i, bd-bi_enetaddr[i]);
 }
 stw_be_phys(cs-as, bdloc + 0x2A, bd-bi_ethspeed);
 stl_be_phys(cs-as, bdloc + 0x2C, bd-bi_intfreq);
 stl_be_phys(cs-as, bdloc + 0x30, bd-bi_busfreq);
 stl_be_phys(cs-as, bdloc + 0x34, bd-bi_baudrate);
 for (i = 0; i  4; i++) {
-stb_phys(bdloc + 0x38 + i, bd-bi_s_version[i]);
+stb_phys(cs-as, bdloc + 0x38 + i, bd-bi_s_version[i]);
 }
 for (i = 0; i  32; i++) {
-stb_phys(bdloc + 0x3C + i, bd-bi_r_version[i]);
+stb_phys(cs-as, bdloc + 0x3C + i, bd-bi_r_version[i]);
 }
 stl_be_phys(cs-as, bdloc + 0x5C, bd-bi_plb_busfreq);
 stl_be_phys(cs-as, bdloc + 0x60, bd-bi_pci_busfreq);
 for (i = 0; i  6; i++) {
-stb_phys(bdloc + 0x64 + i, bd-bi_pci_enetaddr[i]);
+stb_phys(cs-as, bdloc + 0x64 + i, bd-bi_pci_enetaddr[i]);
 }
 n = 0x6A;
 if (flags  0x0001) {
 for (i = 0; i  6; i++)
-stb_phys(bdloc + n++, bd-bi_pci_enetaddr2[i]);
+stb_phys(cs-as, bdloc + n++, bd-bi_pci_enetaddr2[i]);
 }
 stl_be_phys(cs-as, bdloc + n, bd-bi_opbfreq);
 n += 4;
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index ebf09e9..3ffcc65 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -370,7 +370,7 @@ static target_ulong register_vpa(CPUPPCState *env, 
target_ulong vpa)
 
 tmp = ldub_phys(cs-as, env-vpa_addr + VPA_SHARED_PROC_OFFSET);
 tmp |= VPA_SHARED_PROC_VAL;
-stb_phys(env-vpa_addr + VPA_SHARED_PROC_OFFSET, tmp);
+stb_phys(cs-as, env-vpa_addr + VPA_SHARED_PROC_OFFSET, tmp);
 
 return H_SUCCESS;
 }
@@ -567,7 +567,7 @@ static target_ulong h_logical_store(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 
 switch (size) {
 case 1:
-stb_phys(addr, val);
+stb_phys(cs-as, addr, val);
 return H_SUCCESS;
 case 2:
 stw_phys(cs-as, addr, val);
@@ -632,7 +632,7 @@ static target_ulong h_logical_memop(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
 }
 switch (esize) {
 case 0:
-stb_phys(dst, tmp);
+stb_phys(cs-as, dst, tmp);
 break;
 case 1:
 stw_phys(cs-as, dst, tmp);
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index 68f3e5a..e4fc353 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -359,15 +359,21 @@ void s390_virtio_device_sync(VirtIOS390Device *dev)
 virtio_reset(dev-vdev);
 
 /* Sync dev space */
-stb_phys(dev-dev_offs + VIRTIO_DEV_OFFS_TYPE, dev-vdev-device_id);
+stb_phys(address_space_memory,
+ dev-dev_offs + VIRTIO_DEV_OFFS_TYPE, dev-vdev-device_id);
 
-stb_phys(dev-dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, 

[Qemu-devel] [PATCH] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()

2014-02-03 Thread Chen Gang
We can not assume 'path' + 'ctx-fs_root' must be less than MAX_PATH,
so need use snprintf() instead of sprintf().

And also recommend to use ARRAY_SIZE instead of hard code macro for an
array size in snprintf().


Signed-off-by: Chen Gang gang.chen.5...@gmail.com
---
 hw/9pfs/virtio-9p-local.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
index fc93e9e..44a0380 100644
--- a/hw/9pfs/virtio-9p-local.c
+++ b/hw/9pfs/virtio-9p-local.c
@@ -159,7 +159,7 @@ static int local_create_mapped_attr_dir(FsContext *ctx, 
const char *path)
 char attr_dir[PATH_MAX];
 char *tmp_path = g_strdup(path);
-snprintf(attr_dir, PATH_MAX, %s/%s/%s,
+snprintf(attr_dir, ARRAY_SIZE(attr_dir), %s/%s/%s,
  ctx-fs_root, dirname(tmp_path), VIRTFS_META_DIR);
  err = mkdir(attr_dir, 0700);
@@ -898,7 +898,8 @@ static int local_remove(FsContext *ctx, const char *path)
  * directory
  */
 if (S_ISDIR(stbuf.st_mode)) {
-sprintf(buffer, %s/%s/%s, ctx-fs_root, path, VIRTFS_META_DIR);
+snprintf(buffer, ARRAY_SIZE(buffer), %s/%s/%s,
+ ctx-fs_root, path, VIRTFS_META_DIR);
 err = remove(buffer);
 if (err  0  errno != ENOENT) {
 /*
@@ -1033,8 +1034,8 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
  * If directory remove .virtfs_metadata contained in the
  * directory
  */
-sprintf(buffer, %s/%s/%s, ctx-fs_root,
-fullname.data, VIRTFS_META_DIR);
+snprintf(buffer, ARRAY_SIZE(buffer), %s/%s/%s, ctx-fs_root,
+ fullname.data, VIRTFS_META_DIR);
 ret = remove(buffer);
 if (ret  0  errno != ENOENT) {
 /*
-- 
1.7.11.7



[Qemu-devel] [PATCH v4 19/22] qdev: Add qdev property type for AddressSpaces

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 hw/core/qdev-properties-system.c |  8 ++
 hw/core/qdev-properties.c| 54 
 include/hw/qdev-properties.h |  5 
 stubs/Makefile.objs  |  1 +
 stubs/memory.c   |  6 +
 5 files changed, 74 insertions(+)
 create mode 100644 stubs/memory.c

diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 3f29b49..27c2899 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -365,6 +365,14 @@ void qdev_prop_set_netdev(DeviceState *dev, const char 
*name,
 value ? value-name : , name, error_abort);
 }
 
+void qdev_prop_set_address_space(DeviceState *dev, const char *name,
+ AddressSpace *value)
+{
+assert(!value || value-name);
+object_property_set_str(OBJECT(dev),
+value ? value-name : , name, error_abort);
+}
+
 void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
 {
 qdev_prop_set_macaddr(dev, mac, nd-macaddr.a);
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index b949f0e..68e09e2 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1176,3 +1176,57 @@ PropertyInfo qdev_prop_size = {
 .get = get_size,
 .set = set_size,
 };
+
+/* --- AddressSpace --- */
+
+static int parse_address_space(DeviceState *dev, const char *name,
+   AddressSpace **ptr)
+{
+AddressSpace *as = address_space_find_by_name(name);
+if (as == NULL) {
+return -ENOENT;
+}
+*ptr = as;
+return 0;
+}
+
+static void get_address_space(Object *obj, Visitor *v, void *opaque,
+   const char *name, Error **errp)
+{
+AddressSpace *as = qdev_get_prop_ptr(DEVICE(obj), opaque);
+char *p = (char *) (as ? as-name : );
+
+visit_type_str(v, p, name, errp);
+}
+
+static void set_address_space(Object *obj, Visitor *v, void *opaque,
+   const char *name, Error **errp)
+{
+DeviceState *dev = DEVICE(obj);
+Property *prop = opaque;
+Error *local_err = NULL;
+AddressSpace **as = qdev_get_prop_ptr(dev, prop);
+char *str;
+int ret;
+
+if (dev-realized) {
+qdev_prop_set_after_realize(dev, name, errp);
+return;
+}
+
+visit_type_str(v, str, name, local_err);
+if (local_err) {
+error_propagate(errp, local_err);
+return;
+}
+
+ret = parse_address_space(dev, str, as);
+error_set_from_qdev_prop_error(errp, ret, dev, prop, str);
+g_free(str);
+}
+
+PropertyInfo qdev_prop_address_space = {
+.name  = address_space,
+.get   = get_address_space,
+.set   = set_address_space,
+};
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 77c6f7c..020439f 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -19,6 +19,7 @@ extern PropertyInfo qdev_prop_size;
 extern PropertyInfo qdev_prop_string;
 extern PropertyInfo qdev_prop_chr;
 extern PropertyInfo qdev_prop_ptr;
+extern PropertyInfo qdev_prop_address_space;
 extern PropertyInfo qdev_prop_macaddr;
 extern PropertyInfo qdev_prop_losttickpolicy;
 extern PropertyInfo qdev_prop_bios_chs_trans;
@@ -141,6 +142,8 @@ extern PropertyInfo qdev_prop_arraylen;
 #define DEFINE_PROP_PTR(_n, _s, _f) \
 DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*)
 
+#define DEFINE_PROP_ADDRESS_SPACE(_n, _s, _f) \
+DEFINE_PROP(_n, _s, _f, qdev_prop_address_space, AddressSpace*)
 #define DEFINE_PROP_CHR(_n, _s, _f) \
 DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharDriverState*)
 #define DEFINE_PROP_STRING(_n, _s, _f) \
@@ -177,6 +180,8 @@ void qdev_prop_set_uint32(DeviceState *dev, const char 
*name, uint32_t value);
 void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value);
 void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
 void qdev_prop_set_string(DeviceState *dev, const char *name, const char 
*value);
+void qdev_prop_set_address_space(DeviceState *dev, const char *name,
+ AddressSpace *value);
 void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState 
*value);
 void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientState 
*value);
 int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState 
*value) QEMU_WARN_UNUSED_RESULT;
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index df92fe5..9e1e5da 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -26,4 +26,5 @@ stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
 stub-obj-$(CONFIG_WIN32) += fd-register.o
+stub-obj-y += memory.o
 stub-obj-y += cpus.o
diff --git a/stubs/memory.c b/stubs/memory.c
new file mode 100644
index 

[Qemu-devel] [PATCH v4 22/22] petalogix-ml605: Make the LMB visible only to the CPU

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 hw/microblaze/petalogix_ml605_mmu.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/microblaze/petalogix_ml605_mmu.c 
b/hw/microblaze/petalogix_ml605_mmu.c
index 37cbbfd..d1acbff 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -86,16 +86,31 @@ petalogix_ml605_init(QEMUMachineInitArgs *args)
 MemoryRegion *phys_lmb_bram = g_new(MemoryRegion, 1);
 MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
 qemu_irq irq[32];
+MemoryRegion *sysmem_alias = g_new(MemoryRegion, 1);
+MemoryRegion *mr_cpu_root = g_new(MemoryRegion, 1);
+AddressSpace *as_cpu = g_malloc0(sizeof(*as_cpu));
+
+/* Setup the CPU specific address-space.  */
+memory_region_init(mr_cpu_root, NULL, as-cpu-root, INT64_MAX);
+address_space_init(as_cpu, mr_cpu_root, as/cpu);
 
 /* init CPUs */
 cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+qdev_prop_set_address_space(DEVICE(cpu), address-space, as_cpu);
 object_property_set_bool(OBJECT(cpu), true, realized, error_abort);
 
+/* Populate the CPU AS with the LMB only visible to the CPU.  */
+memory_region_init_alias(sysmem_alias, NULL, sysmem_alias,
+ address_space_mem, 0,
+ memory_region_size(address_space_mem));
+memory_region_add_subregion(mr_cpu_root, 0x, sysmem_alias);
+
 /* Attach emulated BRAM through the LMB.  */
 memory_region_init_ram(phys_lmb_bram, NULL, petalogix_ml605.lmb_bram,
LMB_BRAM_SIZE);
 vmstate_register_ram_global(phys_lmb_bram);
-memory_region_add_subregion(address_space_mem, 0x, phys_lmb_bram);
+memory_region_add_subregion_overlap(mr_cpu_root, 0x,
+phys_lmb_bram, 2);
 
 memory_region_init_ram(phys_ram, NULL, petalogix_ml605.ram, ram_size);
 vmstate_register_ram_global(phys_ram);
-- 
1.8.1.2




Re: [Qemu-devel] [PATCH 03/10] block: Make bdrv_file_open() static

2014-02-03 Thread Kevin Wolf
Am 31.01.2014 um 21:20 hat Max Reitz geschrieben:
 On 29.01.2014 14:26, Kevin Wolf wrote:
 Am 26.01.2014 um 20:02 hat Max Reitz geschrieben:
 Add the bdrv_open() option BDRV_O_PROTOCOL which results in passing the
 call to bdrv_file_open(). Additionally, make bdrv_file_open() static and
 therefore bdrv_open() the only way to call it.
 
 Consequently, all existing calls to bdrv_file_open() have to be adjusted
 to use bdrv_open() with the BDRV_O_PROTOCOL flag instead.
 
 Signed-off-by: Max Reitz mre...@redhat.com
 ---
   block.c   | 17 -
   block/cow.c   |  6 +++---
   block/qcow.c  |  6 +++---
   block/qcow2.c |  5 +++--
   block/qed.c   |  5 +++--
   block/sheepdog.c  |  8 +---
   block/vhdx.c  |  5 +++--
   block/vmdk.c  | 11 +++
   include/block/block.h |  5 ++---
   qemu-io.c |  4 +++-
   10 files changed, 44 insertions(+), 28 deletions(-)

 diff --git a/include/block/block.h b/include/block/block.h
 index a421041..396f9ed 100644
 --- a/include/block/block.h
 +++ b/include/block/block.h
 @@ -102,6 +102,8 @@ typedef enum {
   #define BDRV_O_CHECK   0x1000  /* open solely for consistency check */
   #define BDRV_O_ALLOW_RDWR  0x2000  /* allow reopen to change from r/o to 
  r/w */
   #define BDRV_O_UNMAP   0x4000  /* execute guest UNMAP/TRIM operations 
  */
 +#define BDRV_O_PROTOCOL0x8000  /* open the file using a protocol 
 instead of
 +  a block driver */
 Protocol drivers are a subset of block drivers, so this description
 doesn't make sense.
 
 Hm, technically they probably are but it always seemed to me that
 bdrv_open() would never directly use a protocol, instead using raw
 as the format if no format was found.

Except if you explicitly specify something like format=file.

 More importantly, it is actually possible to use a non-protocol
 block driver with BDRV_O_PROTOCOL; it just needs to be explicitly
 specified.

Yes, I think with explicit specification of the driver you get mostly
the same results with bdrv_open() and bdrv_file_open().

 I guess we need to list the differences between bdrv_open() and
 bdrv_file_open() in order to define what this flag really changes. I
 think this includes:
 
 - Disables format probing
 - BDRV_O_SNAPSHOT is ignored
 - No backing files are opened
 - Probably a few more
 
 So, to me, the main difference is that bdrv_open() always uses some
 non-protocol block driver, whereas bdrv_file_open() only probes for
 protocol block drivers (if a non-protocol driver should be used, it
 has to be explicitly specified).
 
 The current comment for bdrv_file_open() doesn't help much, either:
 “Opens a file using a protocol”. Therefore, the easiest way would
 just be to state “behaves like the old bdrv_file_open()”, but that
 would not be very helpful. Perhaps we could formulate it like “Opens
 a single file (no backing chain, etc.) using only a protocol driver
 deduced from the filename, if not explicitly specified otherwise.”

Perhaps we should really specify it as the difference in probing:
- bdrv_open() adds a probed format layer on top of bs
- bdrv_file_open() probes protocols for bs

All other differences can probably go away without breaking anything:
BDRV_O_SNAPSHOT can be hopefully be moved to drive_init() (the tricky one
here is qmp_change_blockdev), and supporting backing files in
bdrv_file_open() by moving their handling to common code shouldn't hurt.

Any other differences that need to be eliminated? Once we know
what the differences should be, I guess we can greatly simplify the
implementation.

Kevin



Re: [Qemu-devel] [PATCH 0/2] qtest: don't leak pid files and UNIX domain sockets

2014-02-03 Thread Stefan Hajnoczi
On Fri, Jan 31, 2014 at 12:07:34AM +, Peter Maydell wrote:
 On 21 November 2013 11:03, Stefan Hajnoczi stefa...@redhat.com wrote:
  GLib uses abort(3) to exit failed test cases.  As a result, the pid file and
  UNIX domain sockets for a running test are leaked upon failure.
 
  Since abort(3) does not call atexit(3) handler functions, we could set up a
  SIGABRT handler that performs cleanup.  But there are other conditions where
  processes die, like SIGSEGV or SIGBUS.
 
  Let's unlink pid files and UNIX domain sockets as soon as the QEMU process 
  has
  initialized and connections have been made.  This eliminates the 
  possibility of
  leaking these files.
 
 So looking back through mailing list history suggests that these patches
 are supposed to avoid intermittent make check failures like:
 
 TEST: tests/qom-test... (pid=5078)
   /i386/qom/none:  **
 ERROR:/home/petmay01/linaro/qemu-for-merges/tests/libqtest.c:71:init_socket:
 assertion failed (ret != -1): (-1 != -1)
 FAIL
 GTester: last random seed: R02S79ea313790bc9a8b21d9af5ed55c2fff
 (pid=5080)
   /i386/qom/pc:OK
   /i386/qom/isapc: OK
   /i386/qom/q35:   OK
 FAIL: tests/qom-test
 
 but this patch series doesn't actually say that's what it's for,
 so does it fix that kind of error?

I still think we should merge these patches :).  Are you happy to merge
them?

Stefan



[Qemu-devel] [PATCH v4 16/22] exec: Make cpu_physical_memory_write_rom input an AS

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---
 exec.c| 15 ---
 hw/core/loader.c  |  3 ++-
 hw/intc/apic.c|  3 ++-
 hw/sparc/sun4m.c  |  3 ++-
 include/exec/cpu-common.h |  2 +-
 5 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/exec.c b/exec.c
index 248b824..7045f76 100644
--- a/exec.c
+++ b/exec.c
@@ -2099,7 +2099,7 @@ enum write_rom_type {
 FLUSH_CACHE,
 };
 
-static inline void cpu_physical_memory_write_rom_internal(
+static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as,
 hwaddr addr, const uint8_t *buf, int len, enum write_rom_type type)
 {
 hwaddr l;
@@ -2109,8 +2109,7 @@ static inline void cpu_physical_memory_write_rom_internal(
 
 while (len  0) {
 l = len;
-mr = address_space_translate(address_space_memory,
- addr, addr1, l, true);
+mr = address_space_translate(as, addr, addr1, l, true);
 
 if (!(memory_region_is_ram(mr) ||
   memory_region_is_romd(mr))) {
@@ -2136,10 +2135,10 @@ static inline void 
cpu_physical_memory_write_rom_internal(
 }
 
 /* used for ROM loading : can write in RAM and ROM */
-void cpu_physical_memory_write_rom(hwaddr addr,
+void cpu_physical_memory_write_rom(AddressSpace *as, hwaddr addr,
const uint8_t *buf, int len)
 {
-cpu_physical_memory_write_rom_internal(addr, buf, len, WRITE_DATA);
+cpu_physical_memory_write_rom_internal(as, addr, buf, len, WRITE_DATA);
 }
 
 void cpu_flush_icache_range(hwaddr start, int len)
@@ -2154,7 +2153,8 @@ void cpu_flush_icache_range(hwaddr start, int len)
 return;
 }
 
-cpu_physical_memory_write_rom_internal(start, NULL, len, FLUSH_CACHE);
+cpu_physical_memory_write_rom_internal(address_space_memory,
+   start, NULL, len, FLUSH_CACHE);
 }
 
 typedef struct {
@@ -2718,7 +2718,8 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
 l = len;
 phys_addr += (addr  ~TARGET_PAGE_MASK);
 if (is_write)
-cpu_physical_memory_write_rom(phys_addr, buf, l);
+cpu_physical_memory_write_rom(address_space_memory,
+  phys_addr, buf, l);
 else
 cpu_physical_memory_rw(phys_addr, buf, l, is_write);
 len -= l;
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 0634bee..e1c3f3a 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -778,7 +778,8 @@ static void rom_reset(void *unused)
 void *host = memory_region_get_ram_ptr(rom-mr);
 memcpy(host, rom-data, rom-datasize);
 } else {
-cpu_physical_memory_write_rom(rom-addr, rom-data, rom-datasize);
+cpu_physical_memory_write_rom(address_space_memory,
+  rom-addr, rom-data, rom-datasize);
 }
 if (rom-isrom) {
 /* rom needs to be written only once */
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 3d3deb6..361ae90 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -129,7 +129,8 @@ static void apic_sync_vapic(APICCommonState *s, int 
sync_type)
 }
 vapic_state.irr = vector  0xff;
 
-cpu_physical_memory_write_rom(s-vapic_paddr + start,
+cpu_physical_memory_write_rom(address_space_memory,
+  s-vapic_paddr + start,
   ((void *)vapic_state) + start, length);
 }
 }
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 94f7950..2957d90 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -577,7 +577,8 @@ static void idreg_init(hwaddr addr)
 s = SYS_BUS_DEVICE(dev);
 
 sysbus_mmio_map(s, 0, addr);
-cpu_physical_memory_write_rom(addr, idreg_data, sizeof(idreg_data));
+cpu_physical_memory_write_rom(address_space_memory,
+  addr, idreg_data, sizeof(idreg_data));
 }
 
 #define MACIO_ID_REGISTER(obj) \
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index d0fe123..a21b65a 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -108,7 +108,7 @@ void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val);
 void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val);
 #endif
 
-void cpu_physical_memory_write_rom(hwaddr addr,
+void cpu_physical_memory_write_rom(AddressSpace *as, hwaddr addr,
const uint8_t *buf, int len);
 void cpu_flush_icache_range(hwaddr start, int len);
 
-- 
1.8.1.2




Re: [Qemu-devel] [PATCH] opencores_eth: flush queue whenever can_receive can go from false to true

2014-02-03 Thread Stefan Hajnoczi
On Mon, Feb 03, 2014 at 08:20:02AM +0400, Max Filippov wrote:
 The following registers control whether MAC can receive frames:
 - MODER.RXEN bit that enables/disables receiver;
 - TX_BD_NUM register that specifies number of RX descriptors.
 Notify QEMU networking core when the MAC is ready to receive frames.
 Discard frame and raise BUSY interrupt when the frame arrives but the
 current RX descriptor is not empty.
 
 Signed-off-by: Max Filippov jcmvb...@gmail.com
 ---
  hw/net/opencores_eth.c | 33 +++--
  1 file changed, 31 insertions(+), 2 deletions(-)

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan



Re: [Qemu-devel] [PATCH] configure: use glib in glib pkg-config check.

2014-02-03 Thread Daniel P. Berrange
On Mon, Feb 03, 2014 at 03:26:15PM +1100, Chris Johns wrote:
 Building against with a recent glib in a custom prefix fails because
 the gthread cflags in the pkg-config file do not have the correct path
 while the glib pc file does.
 
 Signed-off-by: Chris Johns chr...@rtems.org
 ---
  configure | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/configure b/configure
 index b472694..12f730f 100755
 --- a/configure
 +++ b/configure
 @@ -2343,9 +2343,9 @@ if test $mingw32 = yes; then
  else
  glib_req_ver=2.12
  fi
 -if $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
 -glib_cflags=`$pkg_config --cflags gthread-2.0`
 -glib_libs=`$pkg_config --libs gthread-2.0`
 +if $pkg_config --atleast-version=$glib_req_ver glib-2.0; then
 +glib_cflags=`$pkg_config --cflags glib-2.0`
 +glib_libs=`$pkg_config --libs glib-2.0`
  LIBS=$glib_libs $LIBS
  libs_qga=$glib_libs $libs_qga
  else

This change will cause  -pthread linker + compiler flag to be lost.


What glib version are you seeing a problem with ? It seems we should
really fix glib, since this will affect countless 1000's of apps using
it, not try to workaround in all downstream apps.

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|



Re: [Qemu-devel] [PATCH 0/2] qtest: don't leak pid files and UNIX domain sockets

2014-02-03 Thread Peter Maydell
On 3 February 2014 09:54, Stefan Hajnoczi stefa...@redhat.com wrote:
 I still think we should merge these patches :).  Are you happy to merge
 them?

They look like they're fixing a bug to me, so yes. You could
make my life easier by arranging for them to appear in a pull
request...

thanks
-- PMM



Re: [Qemu-devel] qemu-iotest 077 does not terminate with VMDK

2014-02-03 Thread Kevin Wolf
Am 03.02.2014 um 09:44 hat Peter Lieven geschrieben:
 Hi,
 
 has anyone tried iotest 77 (RMW) with VMDK?
 
 for me it does not terminate.

I have a patch for that (077 should be raw-only), but apparently I
forgot to send it out. I'll do that now.

Kevin



[Qemu-devel] [PATCH] qemu-iotest: Make 077 raw-only

2014-02-03 Thread Kevin Wolf
The qemu-io command sequences make the assumption that an unaligned
request on the format layer will be unaligned on the blkdebug layer as
well. This doesn't necessarily hold true for drivers other than raw.

Signed-off-by: Kevin Wolf kw...@redhat.com
---
 tests/qemu-iotests/077 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/077 b/tests/qemu-iotests/077
index bbf7b51..4dd1bdd 100755
--- a/tests/qemu-iotests/077
+++ b/tests/qemu-iotests/077
@@ -38,7 +38,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.rc
 . ./common.filter
 
-_supported_fmt generic
+_supported_fmt raw
 _supported_proto generic
 _supported_os Linux
 
-- 
1.8.1.4




Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()

2014-02-03 Thread Daniel P. Berrange
On Mon, Feb 03, 2014 at 06:00:42PM +0800, Chen Gang wrote:
 We can not assume 'path' + 'ctx-fs_root' must be less than MAX_PATH,
 so need use snprintf() instead of sprintf().
 
 And also recommend to use ARRAY_SIZE instead of hard code macro for an
 array size in snprintf().

In the event that there is overflow this will cause the data to be
truncated, potentially causing QEMU to access the wrong file on the
host. Both snprintf and sprintf are really bad because of their
use of fixed buffers. Better to change it to g_strdup_printf which
dynamically allocates buffers.

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|



Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()

2014-02-03 Thread Chen Gang
On 02/03/2014 06:34 PM, Daniel P. Berrange wrote:
 On Mon, Feb 03, 2014 at 06:00:42PM +0800, Chen Gang wrote:
 We can not assume 'path' + 'ctx-fs_root' must be less than MAX_PATH,
 so need use snprintf() instead of sprintf().

 And also recommend to use ARRAY_SIZE instead of hard code macro for an
 array size in snprintf().
 
 In the event that there is overflow this will cause the data to be
 truncated, potentially causing QEMU to access the wrong file on the
 host. Both snprintf and sprintf are really bad because of their
 use of fixed buffers. Better to change it to g_strdup_printf which
 dynamically allocates buffers.
 

That sounds reasonable to me, I will send patch v2 for it.


Thanks.
-- 
Chen Gang

Open, share and attitude like air, water and life which God blessed



Re: [Qemu-devel] [PATCH 6/6] linux-user: Fix trampoline code for CRIS

2014-02-03 Thread Riku Voipio
On Sun, Feb 02, 2014 at 03:04:52AM +, edgar.igles...@gmail.com wrote:
 From: Stefan Weil s...@weilnetz.de
 
 __put_user can write bytes, words (2 bytes) or longwords (4 bytes).
 Here obviously words should have been written, but bytes were written,
 so values like 0x9c5f were truncated to 0x5f.
 
 Fix this by changing retcode from uint8_t to to uint16_t in
 target_signal_frame and also in the unused rt_signal_frame.
 
 This problem was reported by static code analysis (smatch).

Acked-by: Riku Voipio riku.voi...@linaro.org

 Cc: qemu-sta...@nongnu.org
 Signed-off-by: Stefan Weil s...@weilnetz.de
 Reviewed-by: Peter Maydell peter.mayd...@linaro.org
 Tested-by: Edgar E. Iglesias edgar.igles...@xilinx.com
 Reviewed-by: Edgar E. Iglesias edgar.igles...@xilinx.com
 Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
 ---
  linux-user/signal.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/linux-user/signal.c b/linux-user/signal.c
 index 01d7c39..82e8592 100644
 --- a/linux-user/signal.c
 +++ b/linux-user/signal.c
 @@ -3659,7 +3659,7 @@ struct target_sigcontext {
  struct target_signal_frame {
  struct target_sigcontext sc;
  uint32_t extramask[TARGET_NSIG_WORDS - 1];
 -uint8_t retcode[8];   /* Trampoline code. */
 +uint16_t retcode[4];  /* Trampoline code. */
  };
  
  struct rt_signal_frame {
 @@ -3667,7 +3667,7 @@ struct rt_signal_frame {
  void *puc;
  siginfo_t info;
  struct ucontext uc;
 -uint8_t retcode[8];   /* Trampoline code. */
 +uint16_t retcode[4];  /* Trampoline code. */
  };
  
  static void setup_sigcontext(struct target_sigcontext *sc, CPUCRISState *env)
 @@ -3745,8 +3745,8 @@ static void setup_frame(int sig, struct 
 target_sigaction *ka,
*/
   err |= __put_user(0x9c5f, frame-retcode+0);
   err |= __put_user(TARGET_NR_sigreturn, 
 -   frame-retcode+2);
 - err |= __put_user(0xe93d, frame-retcode+4);
 +   frame-retcode + 1);
 + err |= __put_user(0xe93d, frame-retcode + 2);
  
   /* Save the mask.  */
   err |= __put_user(set-sig[0], frame-sc.oldmask);
 -- 
 1.8.3.2
 



[Qemu-devel] [PATCH v4 2/5] pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR

2014-02-03 Thread Igor Mammedov
... removes dependency of mmio handler on PCI_HOTPLUG_ADDR.
It will be needed in case of Q35 where base could be different.

Signed-off-by: Igor Mammedov imamm...@redhat.com
---
 hw/acpi/pcihp.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 464739a..64c8cf2 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -48,11 +48,11 @@
 
 #define PCI_HOTPLUG_ADDR 0xae00
 #define PCI_HOTPLUG_SIZE 0x0014
-#define PCI_UP_BASE 0xae00
-#define PCI_DOWN_BASE 0xae04
-#define PCI_EJ_BASE 0xae08
-#define PCI_RMV_BASE 0xae0c
-#define PCI_SEL_BASE 0xae10
+#define PCI_UP_BASE 0x
+#define PCI_DOWN_BASE 0x0004
+#define PCI_EJ_BASE 0x0008
+#define PCI_RMV_BASE 0x000c
+#define PCI_SEL_BASE 0x0010
 
 typedef struct AcpiPciHpFind {
 int bsel;
@@ -213,24 +213,24 @@ static uint64_t pci_read(void *opaque, hwaddr addr, 
unsigned int size)
 }
 
 switch (addr) {
-case PCI_UP_BASE - PCI_HOTPLUG_ADDR:
+case PCI_UP_BASE:
 val = s-acpi_pcihp_pci_status[bsel].up;
 s-acpi_pcihp_pci_status[bsel].up = 0;
 ACPI_PCIHP_DPRINTF(pci_up_read % PRIu32 \n, val);
 break;
-case PCI_DOWN_BASE - PCI_HOTPLUG_ADDR:
+case PCI_DOWN_BASE:
 val = s-acpi_pcihp_pci_status[bsel].down;
 ACPI_PCIHP_DPRINTF(pci_down_read % PRIu32 \n, val);
 break;
-case PCI_EJ_BASE - PCI_HOTPLUG_ADDR:
+case PCI_EJ_BASE:
 /* No feature defined yet */
 ACPI_PCIHP_DPRINTF(pci_features_read % PRIu32 \n, val);
 break;
-case PCI_RMV_BASE - PCI_HOTPLUG_ADDR:
+case PCI_RMV_BASE:
 val = s-acpi_pcihp_pci_status[bsel].hotplug_enable;
 ACPI_PCIHP_DPRINTF(pci_rmv_read % PRIu32 \n, val);
 break;
-case PCI_SEL_BASE - PCI_HOTPLUG_ADDR:
+case PCI_SEL_BASE:
 val = s-hotplug_select;
 ACPI_PCIHP_DPRINTF(pci_sel_read % PRIu32 \n, val);
 default:
@@ -245,7 +245,7 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t 
data,
 {
 AcpiPciHpState *s = opaque;
 switch (addr) {
-case PCI_EJ_BASE - PCI_HOTPLUG_ADDR:
+case PCI_EJ_BASE:
 if (s-hotplug_select = ACPI_PCIHP_MAX_HOTPLUG_BUS) {
 break;
 }
@@ -253,7 +253,7 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t 
data,
 ACPI_PCIHP_DPRINTF(pciej write % HWADDR_PRIx  == % PRIu64 \n,
   addr, data);
 break;
-case PCI_SEL_BASE - PCI_HOTPLUG_ADDR:
+case PCI_SEL_BASE:
 s-hotplug_select = data;
 ACPI_PCIHP_DPRINTF(pcisel write % HWADDR_PRIx  == % PRIu64 \n,
   addr, data);
-- 
1.7.1




[Qemu-devel] [PATCH v4 1/5] pcihp: replace enable|disable_device() with oneliners

2014-02-03 Thread Igor Mammedov
enable_device() and disable_device() functions aren't reused anywere,
so replace them with respective oneliners at call sites.

Signed-off-by: Igor Mammedov imamm...@redhat.com
---
 hw/acpi/pcihp.c |   14 ++
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 4345f5d..464739a 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -177,16 +177,6 @@ void acpi_pcihp_reset(AcpiPciHpState *s)
 acpi_pcihp_update(s);
 }
 
-static void enable_device(AcpiPciHpState *s, unsigned bsel, int slot)
-{
-s-acpi_pcihp_pci_status[bsel].up |= (1U  slot);
-}
-
-static void disable_device(AcpiPciHpState *s, unsigned bsel, int slot)
-{
-s-acpi_pcihp_pci_status[bsel].down |= (1U  slot);
-}
-
 int acpi_pcihp_device_hotplug(AcpiPciHpState *s, PCIDevice *dev,
   PCIHotplugState state)
 {
@@ -204,9 +194,9 @@ int acpi_pcihp_device_hotplug(AcpiPciHpState *s, PCIDevice 
*dev,
 }
 
 if (state == PCI_HOTPLUG_ENABLED) {
-enable_device(s, bsel, slot);
+s-acpi_pcihp_pci_status[bsel].up |= (1U  slot);
 } else {
-disable_device(s, bsel, slot);
+s-acpi_pcihp_pci_status[bsel].down |= (1U  slot);
 }
 
 return 0;
-- 
1.7.1




[Qemu-devel] [PATCH v4 3/5] pcihp: make pci_read() mmio calback compatible with legacy ACPI hotplug

2014-02-03 Thread Igor Mammedov
due to recent change introduced by:
pcihp: reduce number of device check events

'up' field is cleared right after it's read.
This is incompatible with legacy BIOS ACPI code
where PCNF ACPI method reads this field 32 times.

To make pci_read mmio callback compatible with legacy
'up' behavior, pcihp code will need to know in which
mode it runs add 'legacy_piix' field to AcpiPciHpState
structure and alter register behavior accordingly.

Signed-off-by: Igor Mammedov imamm...@redhat.com
---
v2:
  - keep acpi-pci-hotplug-with-bridge-support property
and tweek pcihp init API to initialize .legacy_piix field
---
 hw/acpi/pcihp.c |7 +--
 hw/acpi/piix4.c |3 ++-
 include/hw/acpi/pcihp.h |3 ++-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 64c8cf2..974f01c 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -215,7 +215,9 @@ static uint64_t pci_read(void *opaque, hwaddr addr, 
unsigned int size)
 switch (addr) {
 case PCI_UP_BASE:
 val = s-acpi_pcihp_pci_status[bsel].up;
-s-acpi_pcihp_pci_status[bsel].up = 0;
+if (!s-legacy_piix) {
+s-acpi_pcihp_pci_status[bsel].up = 0;
+}
 ACPI_PCIHP_DPRINTF(pci_up_read % PRIu32 \n, val);
 break;
 case PCI_DOWN_BASE:
@@ -273,9 +275,10 @@ static const MemoryRegionOps acpi_pcihp_io_ops = {
 };
 
 void acpi_pcihp_init(AcpiPciHpState *s, PCIBus *root_bus,
- MemoryRegion *address_space_io)
+ MemoryRegion *address_space_io, bool bridges_enabled)
 {
 s-root= root_bus;
+s-legacy_piix = !bridges_enabled;
 memory_region_init_io(s-io, NULL, acpi_pcihp_io_ops, s,
   acpi-pci-hotplug,
   PCI_HOTPLUG_SIZE);
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 5d55a3c..2aedfe5 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -695,7 +695,8 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion 
*parent,
 memory_region_add_subregion(parent, GPE_BASE, s-io_gpe);
 
 if (s-use_acpi_pci_hotplug) {
-acpi_pcihp_init(s-acpi_pci_hotplug, bus, parent);
+acpi_pcihp_init(s-acpi_pci_hotplug, bus, parent,
+s-use_acpi_pci_hotplug);
 } else {
 memory_region_init_io(s-io_pci, OBJECT(s), piix4_pci_ops, s,
   acpi-pci-hotplug, PCI_HOTPLUG_SIZE);
diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h
index aa297c2..02d3ce3 100644
--- a/include/hw/acpi/pcihp.h
+++ b/include/hw/acpi/pcihp.h
@@ -46,10 +46,11 @@ typedef struct AcpiPciHpState {
 uint32_t hotplug_select;
 PCIBus *root;
 MemoryRegion io;
+bool legacy_piix;
 } AcpiPciHpState;
 
 void acpi_pcihp_init(AcpiPciHpState *, PCIBus *root,
- MemoryRegion *address_space_io);
+ MemoryRegion *address_space_io, bool bridges_enabled);
 
 /* Invoke on device hotplug */
 int acpi_pcihp_device_hotplug(AcpiPciHpState *, PCIDevice *,
-- 
1.7.1




[Qemu-devel] [PATCH v4 0/5] pc: make ACPI pcihp more reusable

2014-02-03 Thread Igor Mammedov
changes since v3:
 - keep acpi-pci-hotplug-with-bridge-support property
   and pass its value to acpi_pcihp_init() to init internal
   .legacy_piix field.
changes since v2:
 - rename 'use_acpi_pci_hotplug' field to 'legacy_piix'
   and corresponding properties 
 - drop excessive checks for legacy mode
 - rework legacy vmstate handling to use AcpiPciHpPciStatus[0] structure
   which reduced acpi/piix4.c by another 50 LOC
 - move legacy initialization to pcihp.c
changes since v1:
 - add BSEL property to root bus when in compatibility mode
 as result dropped hw:acpi:pcihp: assume root PCI bus if bus has no 
ACPI_PCIHP_PROP_BSEL property
 - rebasing on top of pcihp: reduce number of device check events
   added patch 3/4.

Reuses new pcihp code for handling legacy PCI hotplug in
acpi/piix4_pm, which significantly reduces code duplication
between piix4_pm and pcihp reducing codebase by ~200 LOC.

It also allows cleaner rebase of generic hotplug refactoring,
by not increasing code duplication since it will need to be
done only for pcihp.

Git tree for testing based on mst's PCI tree:
https://github.com/imammedo/qemu/commits/pcihp_cleanup_v4



Igor Mammedov (5):
  pcihp: replace enable|disable_device() with oneliners
  pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR
  pcihp: make pci_read() mmio calback compatible with legacy ACPI
hotplug
  pcihp: remove unused AcpiPciHpPciStatus.device_present field
  hw:piix4:acpi: reuse pcihp code for legacy PCI hotplug

 hw/acpi/pcihp.c |   68 ---
 hw/acpi/piix4.c |  210 ---
 include/hw/acpi/pcihp.h |5 +-
 3 files changed, 55 insertions(+), 228 deletions(-)




[Qemu-devel] [PATCH v4 5/5] hw:piix4:acpi: reuse pcihp code for legacy PCI hotplug

2014-02-03 Thread Igor Mammedov
reduces acpi PCI hotplug code duplication by ~200LOC

Signed-off-by: Igor Mammedov imamm...@redhat.com
---
v3:
 - remove exessive checks for compat mode
 - replace up/down fields of pci_status with corresponding fields
   form AcpiPciHpPciStatus in vmstate wich allow to remove extra
   50 LOC of legacy code
 - move legacy initialization logic to pcihp.c
v2:
 - replace obsolete 'device_present' with 'up' field
 - add/set ACPI_PCIHP_PROP_BSEL to 0 when running in compatibility
   mode with old machine types.
---
 hw/acpi/pcihp.c |   23 -
 hw/acpi/piix4.c |  211 ---
 include/hw/acpi/pcihp.h |1 +
 3 files changed, 34 insertions(+), 201 deletions(-)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 974f01c..1ce6fc2 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -46,8 +46,9 @@
 # define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
 #endif
 
-#define PCI_HOTPLUG_ADDR 0xae00
-#define PCI_HOTPLUG_SIZE 0x0014
+#define ACPI_PCIHP_ADDR 0xae00
+#define ACPI_PCIHP_SIZE 0x0014
+#define ACPI_PCIHP_LEGACY_SIZE 0x000f
 #define PCI_UP_BASE 0x
 #define PCI_DOWN_BASE 0x0004
 #define PCI_EJ_BASE 0x0008
@@ -277,12 +278,24 @@ static const MemoryRegionOps acpi_pcihp_io_ops = {
 void acpi_pcihp_init(AcpiPciHpState *s, PCIBus *root_bus,
  MemoryRegion *address_space_io, bool bridges_enabled)
 {
+uint16_t io_size = ACPI_PCIHP_SIZE;
+
 s-root= root_bus;
 s-legacy_piix = !bridges_enabled;
+
+if (s-legacy_piix) {
+unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);
+
+io_size = ACPI_PCIHP_LEGACY_SIZE;
+
+*bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;
+object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,
+   bus_bsel, NULL);
+}
+
 memory_region_init_io(s-io, NULL, acpi_pcihp_io_ops, s,
-  acpi-pci-hotplug,
-  PCI_HOTPLUG_SIZE);
-memory_region_add_subregion(address_space_io, PCI_HOTPLUG_ADDR, s-io);
+  acpi-pci-hotplug, io_size);
+memory_region_add_subregion(address_space_io, ACPI_PCIHP_ADDR, s-io);
 }
 
 const VMStateDescription vmstate_acpi_pcihp_pci_status = {
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 2aedfe5..7a0efcb 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -44,13 +44,6 @@
 #define GPE_BASE 0xafe0
 #define GPE_LEN 4
 
-#define PCI_HOTPLUG_ADDR 0xae00
-#define PCI_HOTPLUG_SIZE 0x000f
-#define PCI_UP_BASE 0xae00
-#define PCI_DOWN_BASE 0xae04
-#define PCI_EJ_BASE 0xae08
-#define PCI_RMV_BASE 0xae0c
-
 #define PIIX4_PCI_HOTPLUG_STATUS 2
 
 struct pci_status {
@@ -80,13 +73,6 @@ typedef struct PIIX4PMState {
 Notifier machine_ready;
 Notifier powerdown_notifier;
 
-/* for legacy pci hotplug (compatible with qemu 1.6 and older) */
-MemoryRegion io_pci;
-struct pci_status pci0_status;
-uint32_t pci0_hotplug_enable;
-uint32_t pci0_slot_device_present;
-
-/* for new pci hotplug (with PCI2PCI bridge support) */
 AcpiPciHpState acpi_pci_hotplug;
 bool use_acpi_pci_hotplug;
 
@@ -170,17 +156,6 @@ static void pm_write_config(PCIDevice *d,
 }
 }
 
-static void vmstate_pci_status_pre_save(void *opaque)
-{
-struct pci_status *pci0_status = opaque;
-PIIX4PMState *s = container_of(pci0_status, PIIX4PMState, pci0_status);
-
-/* We no longer track up, so build a safe value for migrating
- * to a version that still does... of course these might get lost
- * by an old buggy implementation, but we try. */
-pci0_status-up = s-pci0_slot_device_present  s-pci0_hotplug_enable;
-}
-
 static int vmstate_acpi_post_load(void *opaque, int version_id)
 {
 PIIX4PMState *s = opaque;
@@ -216,10 +191,9 @@ static const VMStateDescription vmstate_pci_status = {
 .version_id = 1,
 .minimum_version_id = 1,
 .minimum_version_id_old = 1,
-.pre_save = vmstate_pci_status_pre_save,
 .fields  = (VMStateField []) {
-VMSTATE_UINT32(up, struct pci_status),
-VMSTATE_UINT32(down, struct pci_status),
+VMSTATE_UINT32(up, struct AcpiPciHpPciStatus),
+VMSTATE_UINT32(down, struct AcpiPciHpPciStatus),
 VMSTATE_END_OF_LIST()
 }
 };
@@ -256,7 +230,8 @@ static int acpi_load_old(QEMUFile *f, void *opaque, int 
version_id)
 qemu_get_be16s(f, temp);
 }
 
-ret = vmstate_load_state(f, vmstate_pci_status, s-pci0_status, 1);
+ret = vmstate_load_state(f, vmstate_pci_status,
+s-acpi_pci_hotplug.acpi_pcihp_pci_status[ACPI_PCIHP_BSEL_DEFAULT], 
1);
 return ret;
 }
 
@@ -294,70 +269,18 @@ static const VMStateDescription vmstate_acpi = {
 VMSTATE_TIMER(ar.tmr.timer, PIIX4PMState),
 VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState),
 VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE),
-VMSTATE_STRUCT_TEST(pci0_status, PIIX4PMState,
-

[Qemu-devel] [PATCH v4 4/5] pcihp: remove unused AcpiPciHpPciStatus.device_present field

2014-02-03 Thread Igor Mammedov
Remove now unused 'device_present' field wich was obsoleted by
patch pcihp: reduce number of device check events

Signed-off-by: Igor Mammedov imamm...@redhat.com
---
 include/hw/acpi/pcihp.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h
index 02d3ce3..1fd90e1 100644
--- a/include/hw/acpi/pcihp.h
+++ b/include/hw/acpi/pcihp.h
@@ -35,7 +35,6 @@ typedef struct AcpiPciHpPciStatus {
 uint32_t up;
 uint32_t down;
 uint32_t hotplug_enable;
-uint32_t device_present;
 } AcpiPciHpPciStatus;
 
 #define ACPI_PCIHP_PROP_BSEL acpi-pcihp-bsel
-- 
1.7.1




Re: [Qemu-devel] 9pfs troubles (was Re: [PATCH 1/4] hw/9pfs: fix error handing in local_ioc_getversion())

2014-02-03 Thread Michael S. Tsirkin
On Mon, Feb 03, 2014 at 03:05:10PM +0530, Aneesh Kumar K.V wrote:
 Michael S. Tsirkin m...@redhat.com writes:
 
  Haven't used 9pfs in a while.
  I thought these patches are a good time to play with it some more.
  I have encountered two issues.
 
  What I'm doing:
  host: qemu a75143eda2ddf581b51e96c000974bcdfe2cbd10.
 
  /scm/qemu/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 1g -cpu kvm64
  -smp 2  f20-x64.qcow2  -netdev user,id=foo -redir tcp:8022::22 -device
  virtio-net,netdev=foo  -serial stdio -fsdev
  local,security_model=none,id=fsdev0,path=/lib/modules/ -device
  virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=libmodulesshare -fsdev
  local,security_model=none,id=fsdev1,path=/boot -device
  virtio-9p-pci,id=fs1,fsdev=fsdev0,mount_tag=bootshare -no-reboot
  -snapshot
 
  guest: Fedora 20
 
  added this in /etc/fstab:
 
  bootshare   /share/boot 9p  trans=virtio,version=9p2000.L 0 0
  libmodulesshare /share/lib/modules  9p trans=virtio,version=9p2000.L 0 0
 
 
  I have encountered two issues:
 
  1. mount failure on boot
  If I try to mount on boot through fstab, I get:
  [2.270157] 9pnet: Could not find request transport: virtio
  [2.270158] 9pnet: Could not find request transport: virtio
 
 
 Missing 9pnet_virtio.ko module ? 

Maybe it's loaded too late. But when I get to plymouth prompt
it's loaded fine.

 
  If I then re-try mount, it succeeds immediately!
 
  Some kind of dependency issue?
 
  2. files immediately in the mounted directory aren't visible on the
  guest under /share/boot.
  For example, files under /boot on host are not visible
  on guest, files under child directories seem visible.
 
 
 can you share more details on this ? /boot permissions. ls -al output on
 host etc.
 
 -aneesh

for /boot:
dr-xr-xr-x. 7 root root 12288 Feb  2 23:41 /boot/

$ ls -la
total 739740
dr-xr-xr-x.  7 root root12288 Feb  2 23:41 .
dr-xr-xr-x. 22 root root 4096 Feb  2 19:16 ..
-rw-r--r--.  1 root root   138741 Dec 23 19:19 config-3.12.6-200.fc19.i686
-rw-r--r--.  1 root root   138724 Jan 10 18:06 config-3.12.7-200.fc19.i686
-rw-r--r--.  1 root root   138724 Jan 16 06:43 config-3.12.8-200.fc19.i686
drwxr-xr-x.  3 root root 4096 May 22  2012 efi
-rw-r--r--.  1 root root   178176 Sep 16 13:14 elf-memtest86+-4.20
drwxr-xr-x.  2 root root 4096 Sep  8 14:40 extlinux
drwxr-xr-x.  2 root root 4096 Jan 24  2013 grub
drwxr-xr-x.  6 root root 4096 Feb  2 23:41 grub2
-rw---.  1 root root 25541989 Sep  8 16:12 
initramfs-0-rescue-2b6e810f801e4f458fa97f9a3b9c8a3e.img
-rw---.  1 root root  7633329 Jul 11  2013 initramfs-3.10.0-mst.img
-rw---.  1 root root  7745838 May 30  2013 initramfs-3.10.0-rc3-mst.img
-rw---.  1 root root  7629376 Jul  4  2013 initramfs-3.10.0-rc6-mst.img
-rw---.  1 root root  7481618 Sep 22 17:21 initramfs-3.11.0-mst.img
-rw---.  1 root root  7657392 Aug  7 16:39 initramfs-3.11.0-rc3-mst.img
-rw---.  1 root root  7659204 Aug 18 13:21 initramfs-3.11.0-rc5-mst.img
-rw---.  1 root root  7658165 Aug 26 11:47 initramfs-3.11.0-rc7-mst.img
-rw---.  1 root root  7510290 Nov 20 15:38 initramfs-3.12.0-mst.img
-rw---.  1 root root  7277585 Sep 29 15:14 initramfs-3.12.0-rc2-mst.img
-rw---.  1 root root  7277729 Oct 31 07:48 initramfs-3.12.0-rc5-mst.img
-rw---.  1 root root  8118663 Jan  6 12:31 
initramfs-3.12.6-200.fc19.i686.img
-rw---.  1 root root  7273738 Jan 18 19:14 
initramfs-3.12.7-200.fc19.i686.img
-rw---.  1 root root  7272946 Jan 26 16:54 
initramfs-3.12.8-200.fc19.i686.img
-rw-r--r--.  1 root root  7334316 Feb  2 23:41 initramfs-3.13.0-mst.img
-rw-r--r--.  1 root root 13623844 Jul 19  2012 initramfs-3.4.0-test.img
-rw-r--r--.  1 root root 14134095 Jun 17  2012 initramfs-3.5.0-rc2.img
-rw-r--r--.  1 root root  6195273 Jun 18  2012 initramfs-3.5.0-rc2-mst.img
-rw-r--r--.  1 root root 14137528 Jun 25  2012 initramfs-3.5.0-rc4-mst.img
-rw-r--r--.  1 root root 14145675 Jul 19  2012 initramfs-3.5.0-rc7-mst.img
-rw-r--r--.  1 root root 14219388 Aug 14  2012 initramfs-3.6.0-rc1-mst.img
-rw-r--r--.  1 root root 14230447 Sep  5  2012 initramfs-3.6.0-rc3-mst.img
-rw-r--r--.  1 root root 14229895 Sep 25  2012 initramfs-3.6.0-rc5-mst.img
-rw---.  1 root root 14431655 Nov  1  2012 initramfs-3.7.0-rc1-mst.img
-rw---.  1 root root 14432680 Oct 29  2012 initramfs-3.7.0-rc2-mst.img
-rw---.  1 root root 14436612 Dec  5  2012 initramfs-3.7.0-rc7-mst.img
-rw---.  1 root root  7485502 Feb 28  2013 initramfs-3.8.0-mst.img
-rw---.  1 root root 14549268 Jan  7  2013 initramfs-3.8.0-rc2-mst.img
-rw---.  1 root root 14544287 Jan 16  2013 initramfs-3.8.0-rc3-mst.img
-rw---.  1 root root  7549459 Jan 24  2013 initramfs-3.8.0-rc4-mst.img
-rw---.  1 root root  7434071 Feb  7  2013 initramfs-3.8.0-rc5-mst.img
-rw---.  1 root root  7433015 Feb  5  2013 initramfs-3.8.0-rc6-mst.img
-rw---.  1 root root  7533783 Apr  4  2013 initramfs-3.9.0-rc5-mst.img
-rw---.  1 root root  7551614 

Re: [Qemu-devel] [PATCH 1/6] cris: Add a CRISv32 default any CPU for user mode emulation

2014-02-03 Thread Riku Voipio
On Sun, Feb 02, 2014 at 03:04:47AM +, edgar.igles...@gmail.com wrote:
 From: Edgar E. Iglesias edgar.igles...@xilinx.com

This is not a regression, but my static busybox sample I have fails to
run with -cpu crisv32. -cpu crisv11 works a little better, but most
syscalls will blow up. Now it is entirely possible my cris busybox binary is
broken, as I have no hw to test it...

./cris-linux-user/qemu-cris -cpu crisv32 
/home/voipio/linaro/qemu-smoke/cris/busybox echo hi

PC=80138 CCS=e8 btaken=1 btarget=80138
cc_op=8 cc_src=4 cc_dest=-150999004 cc_result=f6fff020 cc_mask=f
$r0=001dca60 $r1= $r2= $r3= 
$r4= $r5= $r6= $r7= 
$r8= $r9=0012dc50 $r10=000806a6 $r11=0003 
$r12=f6fff02c $r13=1966 $sp=f6fff020 $acr=f6fff01c 

special regs:
$bz= $vr=0020 $pid= $srs= 
$wz= $exs= $eda=001dca60 $mof= 
$dz= $ebp= $erp= $srp= 
$nrp= $ccs=00e8 $usp= $spc= 

support function regs bank 0:
s00= s01= s02= s03= 
s04= s05= s06= s07= 
s08= s09= s10= s11= 
s12= s13= s14= s15= 


 Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
 ---
  target-cris/cpu.c | 7 +++
  1 file changed, 7 insertions(+)
 
 diff --git a/target-cris/cpu.c b/target-cris/cpu.c
 index 44301a4..21f1860 100644
 --- a/target-cris/cpu.c
 +++ b/target-cris/cpu.c
 @@ -239,7 +239,14 @@ static const TypeInfo cris_cpu_model_type_infos[] = {
  .name = TYPE(crisv32),
  .parent = TYPE_CRIS_CPU,
  .class_init = crisv32_cpu_class_init,
 +},
 +#if defined(CONFIG_USER_ONLY)
 +{
 +.name = TYPE(any),
 +.parent = TYPE_CRIS_CPU,
 +.class_init = crisv32_cpu_class_init,
  }
 +#endif
  };
  
  #undef TYPE
 -- 
 1.8.3.2
 



Re: [Qemu-devel] [PATCH 0/2] qtest: don't leak pid files and UNIX domain sockets

2014-02-03 Thread Andreas Färber
Am 03.02.2014 10:54, schrieb Stefan Hajnoczi:
 On Fri, Jan 31, 2014 at 12:07:34AM +, Peter Maydell wrote:
 On 21 November 2013 11:03, Stefan Hajnoczi stefa...@redhat.com wrote:
 GLib uses abort(3) to exit failed test cases.  As a result, the pid file and
 UNIX domain sockets for a running test are leaked upon failure.

 Since abort(3) does not call atexit(3) handler functions, we could set up a
 SIGABRT handler that performs cleanup.  But there are other conditions where
 processes die, like SIGSEGV or SIGBUS.

 Let's unlink pid files and UNIX domain sockets as soon as the QEMU process 
 has
 initialized and connections have been made.  This eliminates the 
 possibility of
 leaking these files.

 So looking back through mailing list history suggests that these patches
 are supposed to avoid intermittent make check failures like:

 TEST: tests/qom-test... (pid=5078)
   /i386/qom/none:  **
 ERROR:/home/petmay01/linaro/qemu-for-merges/tests/libqtest.c:71:init_socket:
 assertion failed (ret != -1): (-1 != -1)
 FAIL
 GTester: last random seed: R02S79ea313790bc9a8b21d9af5ed55c2fff
 (pid=5080)
   /i386/qom/pc:OK
   /i386/qom/isapc: OK
   /i386/qom/q35:   OK
 FAIL: tests/qom-test

 but this patch series doesn't actually say that's what it's for,
 so does it fix that kind of error?
 
 I still think we should merge these patches :).

+1

As an explanation, the temporary files contain the PID. When they remain
behind due to test failure *and* the PID wraps around and file names
thus happen to match, the error was triggered, and thereby not on each
run but seemingly sometimes.

I am not 100% familiar with the unlinking and code ordering here, but it
had looked sane to me back when I looked at it, I just didn't feel
confident enough for a Reviewed-by. I could give it a spin and add a
Tested-by if that reassures PMM.

Andreas

  Are you happy to merge
 them?
 
 Stefan
 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH 0/2] qtest: don't leak pid files and UNIX domain sockets

2014-02-03 Thread Peter Maydell
On 3 February 2014 11:10, Andreas Färber afaer...@suse.de wrote:
 As an explanation, the temporary files contain the PID. When they remain
 behind due to test failure *and* the PID wraps around and file names
 thus happen to match, the error was triggered, and thereby not on each
 run but seemingly sometimes.

Yeah, that's what it looks like to me too.

 I am not 100% familiar with the unlinking and code ordering here, but it
 had looked sane to me back when I looked at it, I just didn't feel
 confident enough for a Reviewed-by. I could give it a spin and add a
 Tested-by if that reassures PMM.

I'm happy the code is good, I'm just being lazy about directly
applying patches to master, especially since Anthony's patches
db is currently stalled and not updating :-) (I guess I need to
deal with that some time, though, since we don't have a mechanism
for handling patches that fall through the cracks between
subsystems beyond somebody with commit access applies them...)

thanks
-- PMM



Re: [Qemu-devel] [PATCH 1/6] cris: Add a CRISv32 default any CPU for user mode emulation

2014-02-03 Thread Andreas Färber
Hi,

Am 02.02.2014 04:04, schrieb edgar.igles...@gmail.com:
 From: Edgar E. Iglesias edgar.igles...@xilinx.com
 
 Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
 ---
  target-cris/cpu.c | 7 +++
  1 file changed, 7 insertions(+)
 
 diff --git a/target-cris/cpu.c b/target-cris/cpu.c
 index 44301a4..21f1860 100644
 --- a/target-cris/cpu.c
 +++ b/target-cris/cpu.c
 @@ -239,7 +239,14 @@ static const TypeInfo cris_cpu_model_type_infos[] = {
  .name = TYPE(crisv32),
  .parent = TYPE_CRIS_CPU,
  .class_init = crisv32_cpu_class_init,
 +},
 +#if defined(CONFIG_USER_ONLY)
 +{
 +.name = TYPE(any),
 +.parent = TYPE_CRIS_CPU,
 +.class_init = crisv32_cpu_class_init,
  }

If this model is supposed to be exactly the same as crisv32, I would
recommend to make this an alias handled in CRISCPU::class_by_name()
rather than a distinct QOM type.

Regards,
Andreas

 +#endif
  };
  
  #undef TYPE

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH V10 06/13] quorum: Add quorum mechanism.

2014-02-03 Thread Benoît Canet
Le Saturday 01 Feb 2014 à 00:04:01 (+0100), Max Reitz a écrit :
 On 28.01.2014 17:52, Benoît Canet wrote:
 From: Benoît Canet ben...@irqsave.net
 
 Use gnutls's SHA-256 to compare versions.
 
 Signed-off-by: Benoit Canet ben...@irqsave.net
 ---
   block/Makefile.objs   |   2 +-
   block/quorum.c| 333 
  +-
   configure |  36 +
   docs/qmp/qmp-events.txt   |  33 +
   include/monitor/monitor.h |   2 +
   monitor.c |   2 +
   6 files changed, 406 insertions(+), 2 deletions(-)
 
 diff --git a/block/Makefile.objs b/block/Makefile.objs
 index a2650b9..4ca9d43 100644
 --- a/block/Makefile.objs
 +++ b/block/Makefile.objs
 @@ -3,7 +3,7 @@ block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o 
 qcow2-snapshot.o qcow2-c
   block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
   block-obj-y += qed-check.o
   block-obj-$(CONFIG_VHDX) += vhdx.o vhdx-endian.o vhdx-log.o
 -block-obj-y += quorum.o
 +block-obj-$(CONFIG_QUORUM) += quorum.o
   block-obj-y += parallels.o blkdebug.o blkverify.o
   block-obj-y += snapshot.o qapi.o
   block-obj-$(CONFIG_WIN32) += raw-win32.o win32-aio.o
 diff --git a/block/quorum.c b/block/quorum.c
 index 5bf37b3..c319719 100644
 --- a/block/quorum.c
 +++ b/block/quorum.c
 @@ -13,7 +13,43 @@
* See the COPYING file in the top-level directory.
*/
 +#include gnutls/gnutls.h
 +#include gnutls/crypto.h
   #include block/block_int.h
 +#include qapi/qmp/qjson.h
 +
 +#define HASH_LENGTH 32
 +
 +/* This union holds a vote hash value */
 +typedef union QuorumVoteValue {
 +char h[HASH_LENGTH];   /* SHA-256 hash */
 +int64_t l; /* simpler 64 bits hash */
 +} QuorumVoteValue;
 +
 +/* A vote item */
 +typedef struct QuorumVoteItem {
 +int index;
 +QLIST_ENTRY(QuorumVoteItem) next;
 +} QuorumVoteItem;
 +
 +/* this structure is a vote version. A version is the set of votes sharing 
 the
 + * same vote value.
 + * The set of votes will be tracked with the items field and its 
 cardinality is
 + * vote_count.
 + */
 +typedef struct QuorumVoteVersion {
 +QuorumVoteValue value;
 +int index;
 +int vote_count;
 +QLIST_HEAD(, QuorumVoteItem) items;
 +QLIST_ENTRY(QuorumVoteVersion) next;
 +} QuorumVoteVersion;
 +
 +/* this structure holds a group of vote versions together */
 +typedef struct QuorumVotes {
 +QLIST_HEAD(, QuorumVoteVersion) vote_list;
 +int (*compare)(QuorumVoteValue *a, QuorumVoteValue *b);
 +} QuorumVotes;
   /* the following structure holds the state of one quorum instance */
   typedef struct {
 @@ -60,10 +96,14 @@ struct QuorumAIOCB {
   int success_count;  /* number of successfully completed AIOCB 
  */
   bool *finished; /* completion signal for cancel */
 +QuorumVotes votes;
 +
   bool is_read;
   int vote_ret;
   };
 +static void quorum_vote(QuorumAIOCB *acb);
 +
   static void quorum_aio_cancel(BlockDriverAIOCB *blockacb)
   {
   QuorumAIOCB *acb = container_of(blockacb, QuorumAIOCB, common);
 @@ -111,6 +151,10 @@ static void quorum_aio_finalize(QuorumAIOCB *acb)
   acb-aios[i].ret = 0;
   }
 +if (acb-vote_ret) {
 +ret = acb-vote_ret;
 +}
 
 Hm, this makes the vote_ret take precedence over other errors
 returned by the children. If they differ (and both are not 0), we
 can choose between returning either (vote_ret or “real” errors
 reported by the child devices). Both are errors, so I don't see any
 natural precedence. However, generally, vote_ret will contain a more
 generic error code (i.e., -EIO), thus I could imagine the other
 error code reported by the child device to be more appropriate, as
 it might contain more useful information.
 
 But, well, on the other had, Quorum is designed for hiding errors
 reported by a minority of child devices; therefore, hiding such
 errors in this case as well is probably just consequent.

Yes the general idea of quorum is to hide errors as long as the majority is 
reached.
For the case where too many children errors occured to be able to do a vote
there is:
ret = s-threshold = acb-success_count ? 0 : quorum_get_first_error(acb); 
Kevin asked me do return the first error instead of -EIO.

 
 I'll leave this up to you; I'm fine with it as it is and I'd be fine
 if (for whatever reason) you were to change it. :-)
 
 +
   acb-common.cb(acb-common.opaque, ret);
   if (acb-finished) {
   *acb-finished = true;
 @@ -122,6 +166,11 @@ static void quorum_aio_finalize(QuorumAIOCB *acb)
   qemu_aio_release(acb);
   }
 +static int quorum_sha256_compare(QuorumVoteValue *a, QuorumVoteValue *b)
 +{
 +return memcmp(a-h, b-h, HASH_LENGTH);
 +}
 +
   static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s,
  BlockDriverState *bs,
  QEMUIOVector *qiov,
 @@ -141,6 +190,7 @@ static QuorumAIOCB 

Re: [Qemu-devel] [PATCH V10 09/13] quorum: Add quorum_co_get_block_status.

2014-02-03 Thread Benoît Canet
Le Sunday 02 Feb 2014 à 22:44:07 (+0100), Max Reitz a écrit :
 On 28.01.2014 17:52, Benoît Canet wrote:
 From: Benoît Canet ben...@irqsave.net
 
 Signed-off-by: Benoit Canet ben...@irqsave.net
 ---
   block/quorum.c | 67 
  ++
   1 file changed, 67 insertions(+)
 
 diff --git a/block/quorum.c b/block/quorum.c
 index a47cd33..9b0718b 100644
 --- a/block/quorum.c
 +++ b/block/quorum.c
 @@ -171,6 +171,22 @@ static int quorum_sha256_compare(QuorumVoteValue *a, 
 QuorumVoteValue *b)
   return memcmp(a-h, b-h, HASH_LENGTH);
   }
 +static int quorum_64bits_compare(QuorumVoteValue *a, QuorumVoteValue *b)
 +{
 +int64_t i = a-l;
 +int64_t j = b-l;
 +
 +if (i  j) {
 +return -1;
 +}
 +
 +if (i  j) {
 +return 1;
 +}
 +
 +return 0;
 +}
 +
   static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s,
  BlockDriverState *bs,
  QEMUIOVector *qiov,
 @@ -587,6 +603,56 @@ static void quorum_invalidate_cache(BlockDriverState 
 *bs)
   }
   }
 +static int64_t coroutine_fn quorum_co_get_block_status(BlockDriverState *bs,
 +   int64_t sector_num,
 +   int nb_sectors,
 +   int *pnum)
 +{
 +BDRVQuorumState *s = bs-opaque;
 +QuorumVoteVersion *winner = NULL;
 +QuorumVotes result_votes, num_votes;
 +QuorumVoteValue result_value, num_value;
 +int i, num;
 +int64_t result = 0;
 +
 +QLIST_INIT(result_votes.vote_list);
 +QLIST_INIT(num_votes.vote_list);
 +result_votes.compare = quorum_64bits_compare;
 +num_votes.compare = quorum_64bits_compare;
 +
 +for (i = 0; i  s-total; i++) {
 +result = bdrv_get_block_status(s-bs[i], sector_num, nb_sectors, 
 num);
 +/* skip failed requests */
 +if (result  0) {
 +continue;
 +}
 +result_value.l = result  BDRV_BLOCK_DATA;
 +num_value.l = num;
 +quorum_count_vote(result_votes, result_value, i);
 +quorum_count_vote(num_votes, num_value, i);
 +}
 +
 +winner = quorum_get_vote_winner(result_votes);
 +result = winner-value.l;
 
 Below, you're reading the winning value after checking whether it's
 corresponding votes exceeded the threshold. It doesn't matter in the
 end, but for the sake of uniformity, I'd do it the same way here
 (i.e., move this statement below the if block).
 
 +if (winner-vote_count  s-threshold) {
 +result = -ERANGE;
 
 Is there any specific reason why you're returning -ERANGE here and
 -EIO everywhere else (even in quorum_getlength())?

I probably though It's a comparison so it return -ERANGE.
A bad reason so :(

 
 Max
 
 +goto free_exit;
 +}
 +
 +winner = quorum_get_vote_winner(num_votes);
 +if (winner-vote_count  s-threshold) {
 +result = -ERANGE;
 +goto free_exit;
 +}
 +*pnum = winner-value.l;
 +
 +free_exit:
 +quorum_free_vote_list(result_votes);
 +quorum_free_vote_list(num_votes);
 +
 +return result;
 +}
 +
   static BlockDriver bdrv_quorum = {
   .format_name= quorum,
   .protocol_name  = quorum,
 @@ -598,6 +664,7 @@ static BlockDriver bdrv_quorum = {
   .bdrv_aio_readv = quorum_aio_readv,
   .bdrv_aio_writev= quorum_aio_writev,
   .bdrv_invalidate_cache = quorum_invalidate_cache,
 +.bdrv_co_get_block_status = quorum_co_get_block_status,
   };
   static void bdrv_quorum_init(void)
 
 



Re: [Qemu-devel] [PATCH] hw/xtensa: add support for ML605 and KC705 FPGA board

2014-02-03 Thread Andreas Färber
Am 02.02.2014 03:31, schrieb Max Filippov:
 Signed-off-by: Max Filippov jcmvb...@gmail.com
 ---
  hw/xtensa/xtensa_lx60.c | 51 
 +
  1 file changed, 47 insertions(+), 4 deletions(-)

While I can't check the new numbers, the refactoring looks sane,

Reviewed-by: Andreas Färber afaer...@suse.de

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH V10 10/13] quorum: Add quorum_co_flush().

2014-02-03 Thread Benoît Canet
Le Sunday 02 Feb 2014 à 23:02:57 (+0100), Max Reitz a écrit :
 On 28.01.2014 17:52, Benoît Canet wrote:
 From: Benoît Canet ben...@irqsave.net
 
 Makes a vote to select error if any.
 
 Signed-off-by: Benoit Canet ben...@irqsave.net
 ---
   block/quorum.c | 34 ++
   1 file changed, 34 insertions(+)
 
 diff --git a/block/quorum.c b/block/quorum.c
 index 9b0718b..1b84b07 100644
 --- a/block/quorum.c
 +++ b/block/quorum.c
 @@ -653,12 +653,46 @@ free_exit:
   return result;
   }
 +static coroutine_fn int quorum_co_flush(BlockDriverState *bs)
 +{
 +BDRVQuorumState *s = bs-opaque;
 +QuorumVoteVersion *winner = NULL;
 +QuorumVotes error_votes;
 +QuorumVoteValue result_value;
 +int i;
 +int result = 0;
 +bool error = false;
 +
 +QLIST_INIT(error_votes.vote_list);
 +error_votes.compare = quorum_64bits_compare;
 +
 +for (i = 0; i  s-total; i++) {
 +result = bdrv_co_flush(s-bs[i]);
 +if (result) {
 +error = true;
 +result_value.l = result;
 +quorum_count_vote(error_votes, result_value, i);
 +}
 +}
 +
 +if (error) {
 +winner = quorum_get_vote_winner(error_votes);
 +result = winner-value.l;
 +}
 +
 +quorum_free_vote_list(error_votes);
 +
 +return result;
 +}
 +
   static BlockDriver bdrv_quorum = {
   .format_name= quorum,
   .protocol_name  = quorum,
   .instance_size  = sizeof(BDRVQuorumState),
 +.bdrv_co_flush_to_disk = quorum_co_flush,
 +
   .bdrv_getlength = quorum_getlength,
   .bdrv_aio_readv = quorum_aio_readv,
 
 So, my general opinion on this patch (for reads/writes we don't vote
 on the error code either; so why here?) hasn't changed, but well, I
 definitely don't oppose it.
For the reads/writes Kevin asked me to return the first error.
For the flush function someone else (probably Eric) asked me to do voting.

 
 Another problem, however: If any error occurs, this function will
 return an error as well. Is that intended? If an error on a
 read/write operation occurs but there are still enough successful
 reads/writes to reach quorum, no error is returned. Is there a
 reason why this should be different for flush?
If an error occurs multiple times and is able to establish quorum this winning
error will be returned.
Else 0 will be returned due to the vote result if the error is in minority.
So the behavior is similar as long quorum is reached.

 
 Max



Re: [Qemu-devel] [BUGFIX][PATCH v2] configure: Disable libtool if -fPIE does not work with it (bug #1257099)

2014-02-03 Thread Stefano Stabellini
On Wed, 15 Jan 2014, Paolo Bonzini wrote:
 Il 03/01/2014 03:12, Don Slutz ha scritto:
  Adjust TMPO and added TMPB, TMPL, and TMPA.  libtool needs the names
  to be fixed (TMPB).
  
  Add new functions do_libtool and libtool_prog.
  
  Add check for broken gcc and libtool.
  
  Signed-off-by: Don Slutz dsl...@verizon.com
  ---
  Was posted as an attachment.
  
  https://lists.gnu.org/archive/html/qemu-devel/2013-12/msg02678.html
  
   configure | 63 
  ++-
   1 file changed, 62 insertions(+), 1 deletion(-)
  
  diff --git a/configure b/configure
  index edfea95..852d021 100755
  --- a/configure
  +++ b/configure
  @@ -12,7 +12,10 @@ else
   fi
   
   TMPC=${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c
  -TMPO=${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o
  +TMPB=qemu-conf-${RANDOM}-$$-${RANDOM}
  +TMPO=${TMPDIR1}/${TMPB}.o
  +TMPL=${TMPDIR1}/${TMPB}.lo
  +TMPA=${TMPDIR1}/lib${TMPB}.la
   TMPE=${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe
   
   # NB: do not call exit in the trap handler; this is buggy with some 
  shells;
  @@ -86,6 +89,38 @@ compile_prog() {
 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
   }
   
  +do_libtool() {
  +local mode=$1
  +shift
  +# Run the compiler, capturing its output to the log.
  +echo $libtool $mode --tag=CC $cc $@  config.log
  +$libtool $mode --tag=CC $cc $@  config.log 21 || return $?
  +# Test passed. If this is an --enable-werror build, rerun
  +# the test with -Werror and bail out if it fails. This
  +# makes warning-generating-errors in configure test code
  +# obvious to developers.
  +if test $werror != yes; then
  +return 0
  +fi
  +# Don't bother rerunning the compile if we were already using -Werror
  +case $* in
  +*-Werror*)
  +   return 0
  +;;
  +esac
  +echo $libtool $mode --tag=CC $cc -Werror $@  config.log
  +$libtool $mode --tag=CC $cc -Werror $@  config.log 21  return 
  $?
  +error_exit configure test passed without -Werror but failed with 
  -Werror. \
  +This is probably a bug in the configure script. The failing 
  command \
  +will be at the bottom of config.log. \
  +You can run configure with --disable-werror to bypass this check.
  +}
  +
  +libtool_prog() {
  +do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC 
  || return $?
  +do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
  +}
  +
   # symbolically link $1 to $2.  Portable version of ln -sf.
   symlink() {
 rm -rf $2
  @@ -1367,6 +1402,32 @@ EOF
 fi
   fi
   
  +# check for broken gcc and libtool in RHEL5
  +if test -n $libtool -a $pie != no ; then
  +  cat  $TMPC EOF
  +
  +void *f(unsigned char *buf, int len);
  +void *g(unsigned char *buf, int len);
  +
  +void *
  +f(unsigned char *buf, int len)
  +{
  +return (void*)0L;
  +}
  +
  +void *
  +g(unsigned char *buf, int len)
  +{
  +return f(buf, len);
  +}
  +
  +EOF
  +  if ! libtool_prog; then
  +echo Disabling libtool due to broken toolchain support
  +libtool=
  +  fi
  +fi
  +
   ##
   # __sync_fetch_and_and requires at least -march=i486. Many toolchains
   # use i686 as default anyway, but for those that don't, an explicit
  
 
 I'm applying this to a configure branch on my github repository.  Thanks!

Paolo, did this patch ever make it upstream? If so, do you have a commit
id?



Re: [Qemu-devel] [PATCH 1/6] cris: Add a CRISv32 default any CPU for user mode emulation

2014-02-03 Thread Edgar E. Iglesias
On Mon, Feb 03, 2014 at 01:02:34PM +0200, Riku Voipio wrote:
 On Sun, Feb 02, 2014 at 03:04:47AM +, edgar.igles...@gmail.com wrote:
  From: Edgar E. Iglesias edgar.igles...@xilinx.com
 
 This is not a regression, but my static busybox sample I have fails to
 run with -cpu crisv32. -cpu crisv11 works a little better, but most
 syscalls will blow up. Now it is entirely possible my cris busybox binary is
 broken, as I have no hw to test it...

Hi Riku,

The CRISv10 class of CPUs (8, 9, 10, 11) are very different from the
CRISv32. There is some binary compatibility and more ASM compat but
they should really be seen as different archs.

Not sure what kind of binary you have but if you want I can provide
busybox for both v10 and v32. 

Cheers,
Edgar


 
 ./cris-linux-user/qemu-cris -cpu crisv32 
 /home/voipio/linaro/qemu-smoke/cris/busybox echo hi
 
 PC=80138 CCS=e8 btaken=1 btarget=80138
 cc_op=8 cc_src=4 cc_dest=-150999004 cc_result=f6fff020 cc_mask=f
 $r0=001dca60 $r1= $r2= $r3= 
 $r4= $r5= $r6= $r7= 
 $r8= $r9=0012dc50 $r10=000806a6 $r11=0003 
 $r12=f6fff02c $r13=1966 $sp=f6fff020 $acr=f6fff01c 
 
 special regs:
 $bz= $vr=0020 $pid= $srs= 
 $wz= $exs= $eda=001dca60 $mof= 
 $dz= $ebp= $erp= $srp= 
 $nrp= $ccs=00e8 $usp= $spc= 
 
 support function regs bank 0:
 s00= s01= s02= s03= 
 s04= s05= s06= s07= 
 s08= s09= s10= s11= 
 s12= s13= s14= s15= 
 
 
  Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
  ---
   target-cris/cpu.c | 7 +++
   1 file changed, 7 insertions(+)
  
  diff --git a/target-cris/cpu.c b/target-cris/cpu.c
  index 44301a4..21f1860 100644
  --- a/target-cris/cpu.c
  +++ b/target-cris/cpu.c
  @@ -239,7 +239,14 @@ static const TypeInfo cris_cpu_model_type_infos[] = {
   .name = TYPE(crisv32),
   .parent = TYPE_CRIS_CPU,
   .class_init = crisv32_cpu_class_init,
  +},
  +#if defined(CONFIG_USER_ONLY)
  +{
  +.name = TYPE(any),
  +.parent = TYPE_CRIS_CPU,
  +.class_init = crisv32_cpu_class_init,
   }
  +#endif
   };
   
   #undef TYPE
  -- 
  1.8.3.2
  



Re: [Qemu-devel] [PATCH V10 12/13] quorum: Add quorum_open() and quorum_close().

2014-02-03 Thread Benoît Canet
Le Monday 03 Feb 2014 à 00:09:28 (+0100), Max Reitz a écrit :
 On 28.01.2014 17:52, Benoît Canet wrote:
 From: Benoît Canet ben...@irqsave.net
 
 Example of command line:
 -drive if=virtio,file.driver=quorum,\
 file.children.0.file.filename=1.raw,\
 file.children.0.node-name=1.raw,\
 file.children.0.driver=raw,\
 file.children.1.file.filename=2.raw,\
 file.children.1.node-name=2.raw,\
 file.children.1.driver=raw,\
 file.children.2.file.filename=3.raw,\
 file.children.2.node-name=3.raw,\
 file.children.2.driver=raw,\
 file.vote_threshold=2
 
 file.blkverify=on with file.vote_threshold=2 and two files can be passed to
 emulated blkverify.
 
 Signed-off-by: Benoit Canet ben...@irqsave.net
 ---
   block/quorum.c   | 308 
  +++
   qapi-schema.json |  21 +++-
   2 files changed, 328 insertions(+), 1 deletion(-)
 
 diff --git a/block/quorum.c b/block/quorum.c
 index e7b2090..0c0d630 100644
 --- a/block/quorum.c
 +++ b/block/quorum.c
 @@ -17,8 +17,12 @@
   #include gnutls/crypto.h
   #include block/block_int.h
   #include qapi/qmp/qjson.h
 +#include qapi/qmp/types.h
 +#include qemu-common.h
   #define HASH_LENGTH 32
 +#define KEY_PREFIX children.
 +#define KEY_FILENAME_SUFFIX .file.filename
   /* This union holds a vote hash value */
   typedef union QuorumVoteValue {
 @@ -702,12 +706,316 @@ static bool 
 quorum_recurse_is_first_non_filter(BlockDriverState *bs,
   return false;
   }
 
 Perhaps you could make use of qdict_extract_subqdict() and
 qdict_array_split() functions here...? That is,
 qdict_extract_subqdict(..., children.) and then
 qdict_array_split() on the result?
 
 +static int quorum_match_key(const char *key,
 +char **key_prefix)
 +{
 +const char *start;
 +char *next;
 +unsigned long long idx;
 +int ret;
 +
 +*key_prefix = NULL;
 +
 +/* the following code is a translation of the following pseudo code:
 + *   match = key.match('(^children\.(\d+)\.)$suffix)
 + *   if not match:
 + *   return -1;
 + *   key_prefix = match.outer_match()
 + *   idx = match.inner_match()
 + *
 + * note: we also match the .file suffix to avoid futher checkings
 + */
 +
 +/* this key is not a child */
 +if (strncmp(key, KEY_PREFIX, strlen(KEY_PREFIX))) {
 +return -1;
 +}
 +
 +/* take first char after prefix */
 +start = key + strlen(KEY_PREFIX);
 +
 +/* if the string end here - scan fail */
 +if (start[0] == '\0') {
 +return -1;
 +}
 +
 +/* try to retrieve the index */
 +ret = parse_uint(start, idx, next, 10);
 +
 +/* no int found - scan fail */
 +if (ret  0) {
 +return -1;
 +}
 +
 +/* we are taking a reference via QMP */
 +if (next - key == strlen(key)) {
 
 if (!*next) would probably accomplish the same (or if next[0] ==
 '\0') to keep your coding style) without having to call strlen().
 
 +*key_prefix = g_strdup(key);
 +return idx;
 +}
 +
 +/* match the suffix to avoid matching the same idx
 + * multiple times and be required to do more checks later
 + */
 +if (strncmp(next, KEY_FILENAME_SUFFIX, strlen(KEY_FILENAME_SUFFIX))) {
 
 As stated in my review from October, you may use sizeof() to avoid strlen().
 
 +return -1;
 +}
 +
 +/* do not include '.' */
 +int len = next - key;
 +*key_prefix = g_strndup(key, len);
 +
 +return idx;
 +}
 +
 +static QDict *quorum_get_children_idx(const QDict *options)
 +{
 +const QDictEntry *ent;
 +QDict *result;
 +char *key_prefix;
 +int idx;
 +
 +result = qdict_new();
 +
 +for (ent = qdict_first(options); ent; ent = qdict_next(options, ent)) {
 +const char *key = qdict_entry_key(ent);
 +idx = quorum_match_key(key,
 +   key_prefix);
 +
 +/* if the result zero or positive we got a key */
 +if (idx  0) {
 +continue;
 +}
 +
 +qdict_put(result, key_prefix, qint_from_int(idx));
 +}
 +
 +return result;
 +}
 +
 +static int quorum_fill_validation_array(bool *array,
 +const QDict *dict,
 +int total,
 +Error **errp)
 +{
 +const QDictEntry *ent;
 +
 +/* fill the checking array with children indexes */
 +for (ent = qdict_first(dict); ent; ent = qdict_next(dict, ent)) {
 +const char *key = qdict_entry_key(ent);
 +int idx = qdict_get_int(dict, key);
 +
 +if (idx  0 || idx = total) {
 +error_setg(errp,
 +Children index must be between 0 and children count -1);
 
 Quote from October: I'd prefer - 1 instead of -1 (or even Child
 index must be an unsigned integer smaller than the children count).
 
 +return -ERANGE;
 +}
 +
 +array[idx] = true;
 +}
 +
 +return 0;
 +}
 +

Re: [Qemu-devel] [PATCH 1/2] qom-test: Run for all available machines

2014-02-03 Thread Markus Armbruster
Andreas Färber afaer...@suse.de writes:

 Am 10.01.2014 14:31, schrieb arm...@redhat.com:
 From: Markus Armbruster arm...@redhat.com
 
 Get available machines via QMP instead of hardcoding a list that's
 perpetually out of date.
 
 A few machines don't work out of the box:
 
 * Several ppcemb machines can't initialize their CPU.
 
 * Xen machines can work only when running under the Xen hypervisor.
 
 Blacklist them.
 
 Signed-off-by: Markus Armbruster arm...@redhat.com

 I've rebased this, queing it without the ppcemb blacklist (and adjusted
 commit message) while waiting for Alex' ppc pull.

Your rebase is fine.  Thanks!



Re: [Qemu-devel] [PATCH V10 12/13] quorum: Add quorum_open() and quorum_close().

2014-02-03 Thread Benoît Canet
Le Monday 03 Feb 2014 à 00:09:28 (+0100), Max Reitz a écrit :
 On 28.01.2014 17:52, Benoît Canet wrote:
 From: Benoît Canet ben...@irqsave.net
 
 Example of command line:
 -drive if=virtio,file.driver=quorum,\
 file.children.0.file.filename=1.raw,\
 file.children.0.node-name=1.raw,\
 file.children.0.driver=raw,\
 file.children.1.file.filename=2.raw,\
 file.children.1.node-name=2.raw,\
 file.children.1.driver=raw,\
 file.children.2.file.filename=3.raw,\
 file.children.2.node-name=3.raw,\
 file.children.2.driver=raw,\
 file.vote_threshold=2
 
 file.blkverify=on with file.vote_threshold=2 and two files can be passed to
 emulated blkverify.
 
 Signed-off-by: Benoit Canet ben...@irqsave.net
 ---
   block/quorum.c   | 308 
  +++
   qapi-schema.json |  21 +++-
   2 files changed, 328 insertions(+), 1 deletion(-)
 
 diff --git a/block/quorum.c b/block/quorum.c
 index e7b2090..0c0d630 100644
 --- a/block/quorum.c
 +++ b/block/quorum.c
 @@ -17,8 +17,12 @@
   #include gnutls/crypto.h
   #include block/block_int.h
   #include qapi/qmp/qjson.h
 +#include qapi/qmp/types.h
 +#include qemu-common.h
   #define HASH_LENGTH 32
 +#define KEY_PREFIX children.
 +#define KEY_FILENAME_SUFFIX .file.filename
   /* This union holds a vote hash value */
   typedef union QuorumVoteValue {
 @@ -702,12 +706,316 @@ static bool 
 quorum_recurse_is_first_non_filter(BlockDriverState *bs,
   return false;
   }
 

As a general stance sorry to have missed this mail of review from october.
It was not done on purpose.

Best regards

Benoît

 Perhaps you could make use of qdict_extract_subqdict() and
 qdict_array_split() functions here...? That is,
 qdict_extract_subqdict(..., children.) and then
 qdict_array_split() on the result?
 
 +static int quorum_match_key(const char *key,
 +char **key_prefix)
 +{
 +const char *start;
 +char *next;
 +unsigned long long idx;
 +int ret;
 +
 +*key_prefix = NULL;
 +
 +/* the following code is a translation of the following pseudo code:
 + *   match = key.match('(^children\.(\d+)\.)$suffix)
 + *   if not match:
 + *   return -1;
 + *   key_prefix = match.outer_match()
 + *   idx = match.inner_match()
 + *
 + * note: we also match the .file suffix to avoid futher checkings
 + */
 +
 +/* this key is not a child */
 +if (strncmp(key, KEY_PREFIX, strlen(KEY_PREFIX))) {
 +return -1;
 +}
 +
 +/* take first char after prefix */
 +start = key + strlen(KEY_PREFIX);
 +
 +/* if the string end here - scan fail */
 +if (start[0] == '\0') {
 +return -1;
 +}
 +
 +/* try to retrieve the index */
 +ret = parse_uint(start, idx, next, 10);
 +
 +/* no int found - scan fail */
 +if (ret  0) {
 +return -1;
 +}
 +
 +/* we are taking a reference via QMP */
 +if (next - key == strlen(key)) {
 
 if (!*next) would probably accomplish the same (or if next[0] ==
 '\0') to keep your coding style) without having to call strlen().
 
 +*key_prefix = g_strdup(key);
 +return idx;
 +}
 +
 +/* match the suffix to avoid matching the same idx
 + * multiple times and be required to do more checks later
 + */
 +if (strncmp(next, KEY_FILENAME_SUFFIX, strlen(KEY_FILENAME_SUFFIX))) {
 
 As stated in my review from October, you may use sizeof() to avoid strlen().
 
 +return -1;
 +}
 +
 +/* do not include '.' */
 +int len = next - key;
 +*key_prefix = g_strndup(key, len);
 +
 +return idx;
 +}
 +
 +static QDict *quorum_get_children_idx(const QDict *options)
 +{
 +const QDictEntry *ent;
 +QDict *result;
 +char *key_prefix;
 +int idx;
 +
 +result = qdict_new();
 +
 +for (ent = qdict_first(options); ent; ent = qdict_next(options, ent)) {
 +const char *key = qdict_entry_key(ent);
 +idx = quorum_match_key(key,
 +   key_prefix);
 +
 +/* if the result zero or positive we got a key */
 +if (idx  0) {
 +continue;
 +}
 +
 +qdict_put(result, key_prefix, qint_from_int(idx));
 +}
 +
 +return result;
 +}
 +
 +static int quorum_fill_validation_array(bool *array,
 +const QDict *dict,
 +int total,
 +Error **errp)
 +{
 +const QDictEntry *ent;
 +
 +/* fill the checking array with children indexes */
 +for (ent = qdict_first(dict); ent; ent = qdict_next(dict, ent)) {
 +const char *key = qdict_entry_key(ent);
 +int idx = qdict_get_int(dict, key);
 +
 +if (idx  0 || idx = total) {
 +error_setg(errp,
 +Children index must be between 0 and children count -1);
 
 Quote from October: I'd prefer - 1 instead of -1 (or even Child
 index must be an unsigned integer smaller than the 

[Qemu-devel] Improving patch tracking - something like gerrit?

2014-02-03 Thread Mark Cave-Ayland

Hi all,

It should be fairly evident to most people that the volume of patches 
flowing through the qemu-devel mailing list is continually increasing, 
and it is becoming increasingly difficult to track which patches have 
been applied over time. This is particularly a problem where patchsets 
have dependencies on other patchsets which haven't yet been applied to 
git master, which can then cause merge conflicts due to length of time 
taken for the final series to be merged.


Is it time for QEMU to start looking at tools such as gerrit to help 
manage this process? There seems to be an increasing number of ping 
requests for outstanding patches (including my own) which don't get 
applied for weeks, and often even months because they target less 
popular platforms/subsystems and so don't always get the attention of 
the committers.


What I would like to see from such a tool would be something that would 
enable me to see which patches are being considered for each release, so 
that I can see if a particular patch I have submitted is being ignored, 
rejected or deferred to a future release.


Note that I think that one of the biggest benefits of such a tool would 
be during feature freeze, whereby the mailing list contains an avalanche 
of future and current PULL requests which have to be manually filtered 
by committers. This would help both developers and committers see what 
patches are definitely scheduled for the next release as opposed to 
patches being rejected at the last minute because the PULL request 
failed just before the release deadline.


Does anyone else have any thoughts/ideas as to how to better manage this 
process, particularly for a project like QEMU where the number of 
patches is considerably greater than the number of reviewers/committers?



ATB,

Mark.



Re: [Qemu-devel] [PATCH V10 12/13] quorum: Add quorum_open() and quorum_close().

2014-02-03 Thread Benoît Canet
Le Monday 03 Feb 2014 à 13:21:18 (+0100), Benoît Canet a écrit :
 Le Monday 03 Feb 2014 à 00:09:28 (+0100), Max Reitz a écrit :
  On 28.01.2014 17:52, Benoît Canet wrote:
  From: Benoît Canet ben...@irqsave.net
  
  Example of command line:
  -drive if=virtio,file.driver=quorum,\
  file.children.0.file.filename=1.raw,\
  file.children.0.node-name=1.raw,\
  file.children.0.driver=raw,\
  file.children.1.file.filename=2.raw,\
  file.children.1.node-name=2.raw,\
  file.children.1.driver=raw,\
  file.children.2.file.filename=3.raw,\
  file.children.2.node-name=3.raw,\
  file.children.2.driver=raw,\
  file.vote_threshold=2
  
  file.blkverify=on with file.vote_threshold=2 and two files can be passed to
  emulated blkverify.
  
  Signed-off-by: Benoit Canet ben...@irqsave.net
  ---
block/quorum.c   | 308 
   +++
qapi-schema.json |  21 +++-
2 files changed, 328 insertions(+), 1 deletion(-)
  
  diff --git a/block/quorum.c b/block/quorum.c
  index e7b2090..0c0d630 100644
  --- a/block/quorum.c
  +++ b/block/quorum.c
  @@ -17,8 +17,12 @@
#include gnutls/crypto.h
#include block/block_int.h
#include qapi/qmp/qjson.h
  +#include qapi/qmp/types.h
  +#include qemu-common.h
#define HASH_LENGTH 32
  +#define KEY_PREFIX children.
  +#define KEY_FILENAME_SUFFIX .file.filename
/* This union holds a vote hash value */
typedef union QuorumVoteValue {
  @@ -702,12 +706,316 @@ static bool 
  quorum_recurse_is_first_non_filter(BlockDriverState *bs,
return false;
}
  
  Perhaps you could make use of qdict_extract_subqdict() and
  qdict_array_split() functions here...? That is,
  qdict_extract_subqdict(..., children.) and then
  qdict_array_split() on the result?
  
  +static int quorum_match_key(const char *key,
  +char **key_prefix)
  +{
  +const char *start;
  +char *next;
  +unsigned long long idx;
  +int ret;
  +
  +*key_prefix = NULL;
  +
  +/* the following code is a translation of the following pseudo code:
  + *   match = key.match('(^children\.(\d+)\.)$suffix)
  + *   if not match:
  + *   return -1;
  + *   key_prefix = match.outer_match()
  + *   idx = match.inner_match()
  + *
  + * note: we also match the .file suffix to avoid futher checkings
  + */
  +
  +/* this key is not a child */
  +if (strncmp(key, KEY_PREFIX, strlen(KEY_PREFIX))) {
  +return -1;
  +}
  +
  +/* take first char after prefix */
  +start = key + strlen(KEY_PREFIX);
  +
  +/* if the string end here - scan fail */
  +if (start[0] == '\0') {
  +return -1;
  +}
  +
  +/* try to retrieve the index */
  +ret = parse_uint(start, idx, next, 10);
  +
  +/* no int found - scan fail */
  +if (ret  0) {
  +return -1;
  +}
  +
  +/* we are taking a reference via QMP */
  +if (next - key == strlen(key)) {
  
  if (!*next) would probably accomplish the same (or if next[0] ==
  '\0') to keep your coding style) without having to call strlen().
  
  +*key_prefix = g_strdup(key);
  +return idx;
  +}
  +
  +/* match the suffix to avoid matching the same idx
  + * multiple times and be required to do more checks later
  + */
  +if (strncmp(next, KEY_FILENAME_SUFFIX, strlen(KEY_FILENAME_SUFFIX))) {
  
  As stated in my review from October, you may use sizeof() to avoid strlen().
  
  +return -1;
  +}
  +
  +/* do not include '.' */
  +int len = next - key;
  +*key_prefix = g_strndup(key, len);
  +
  +return idx;
  +}
  +
  +static QDict *quorum_get_children_idx(const QDict *options)
  +{
  +const QDictEntry *ent;
  +QDict *result;
  +char *key_prefix;
  +int idx;
  +
  +result = qdict_new();
  +
  +for (ent = qdict_first(options); ent; ent = qdict_next(options, ent)) 
  {
  +const char *key = qdict_entry_key(ent);
  +idx = quorum_match_key(key,
  +   key_prefix);
  +
  +/* if the result zero or positive we got a key */
  +if (idx  0) {
  +continue;
  +}
  +
  +qdict_put(result, key_prefix, qint_from_int(idx));
  +}
  +
  +return result;
  +}
  +
  +static int quorum_fill_validation_array(bool *array,
  +const QDict *dict,
  +int total,
  +Error **errp)
  +{
  +const QDictEntry *ent;
  +
  +/* fill the checking array with children indexes */
  +for (ent = qdict_first(dict); ent; ent = qdict_next(dict, ent)) {
  +const char *key = qdict_entry_key(ent);
  +int idx = qdict_get_int(dict, key);
  +
  +if (idx  0 || idx = total) {
  +error_setg(errp,
  +Children index must be between 0 and children count -1);
  
  Quote from 

[Qemu-devel] KVM call agenda for 2014-02-04

2014-02-03 Thread Juan Quintela
Hi

Please, send any topic that you are interested in covering.

* Should we change anything to get more people to sign for the call?
  There hasn't been a call in quite a long time.  Ideas?

Thanks, Juan.

Call details:

09:00 AM to 10:00 AM EDT
Every two weeks

If you need phone number details,  contact me privately



[Qemu-devel] Query regarding Iotrhead

2014-02-03 Thread Ayaz Akram
While debugging using gdb, I found that the interrupt related flow is not
handled in io thread i.e. on using info thread, I found: Thread 2(iothread)
is at __lll_lock_wait() while Thread 1 is at qemu_set_irq(in irq.c)..
Initially I thought that this interrupt related
code(kbd_update_irq---qemu_Set_irq..) should be handled through
iothread(event loop).. Can u help me regarding this


[Qemu-devel] [PULL 00/01] seccomp: adding new syscalls to the whitelist

2014-02-03 Thread Eduardo Otubo
The following changes since commit 2f61120c10da9128357510debc8e66880cd2bfdc:

  Merge remote-tracking branch 'qmp-unstable/queue/qmp' into staging 
(2014-02-01 23:32:31 +)

are available in the git repository at:

  git://github.com/otubo/qemu.git seccomp

Felix Geyer (1):
  seccomp: add timerfd_create and timerfd_settime to the whitelist

 qemu-seccomp.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)




[Qemu-devel] [PULL 01/01] seccomp: add kill() to the syscall whitelist

2014-02-03 Thread Eduardo Otubo
From: Paul Moore pmo...@redhat.com

The kill() syscall is triggered with the following command:

 # qemu -sandbox on -monitor stdio \
-device intel-hda -device hda-duplex -vnc :0

The resulting syslog/audit message:

 # ausearch -m SECCOMP
 
 time-Wed Nov 20 09:52:08 2013
 type=SECCOMP msg=audit(1384912328.482:6656): auid=0 uid=0 gid=0 ses=854
  subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12087
  comm=qemu-kvm sig=31 syscall=62 compat=0 ip=0x7f7a1d2abc67 code=0x0
 # scmp_sys_resolver 62
 kill

Reported-by: CongLi c...@redhat.com
Tested-by: CongLi c...@redhat.com
Signed-off-by: Paul Moore pmo...@redhat.com
Acked-by: Eduardo Otubo ot...@linux.vnet.ibm.com
---
 qemu-seccomp.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/qemu-seccomp.c b/qemu-seccomp.c
index 69cee44..cf07869 100644
--- a/qemu-seccomp.c
+++ b/qemu-seccomp.c
@@ -114,6 +114,7 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] 
= {
 { SCMP_SYS(write), 244 },
 { SCMP_SYS(fcntl), 243 },
 { SCMP_SYS(tgkill), 242 },
+{ SCMP_SYS(kill), 242 },
 { SCMP_SYS(rt_sigaction), 242 },
 { SCMP_SYS(pipe2), 242 },
 { SCMP_SYS(munmap), 242 },
-- 
1.7.1




Re: [Qemu-devel] Improving patch tracking - something like gerrit?

2014-02-03 Thread Peter Maydell
On 3 February 2014 12:45, Mark Cave-Ayland
mark.cave-ayl...@ilande.co.uk wrote:
 It should be fairly evident to most people that the volume of patches
 flowing through the qemu-devel mailing list is continually increasing, and
 it is becoming increasingly difficult to track which patches have been
 applied over time. This is particularly a problem where patchsets have
 dependencies on other patchsets which haven't yet been applied to git
 master, which can then cause merge conflicts due to length of time taken for
 the final series to be merged.

 Is it time for QEMU to start looking at tools such as gerrit to help manage
 this process? There seems to be an increasing number of ping requests for
 outstanding patches (including my own) which don't get applied for weeks,
 and often even months because they target less popular platforms/subsystems
 and so don't always get the attention of the committers.

So in general I would be happy to see better tooling for this
(currently I use a combination of gmail folders to track things
I ought to be reviewing or pulling plus Anthony's patches tool
to do the work of actually applying things).

The difficulty is coming up with one of:
 (a) a system that works even if some maintainers/submaintainers
 aren't using it
 (b) a system good enough that we can force everybody to use it

(Also (c) somebody needs to put in the work to set the system up
on some server, maintain it, explain how it works, etc.)

 What I would like to see from such a tool would be something that would
 enable me to see which patches are being considered for each release, so
 that I can see if a particular patch I have submitted is being ignored,
 rejected or deferred to a future release.

Typically I think submaintainers will reply to patches when they
apply them to trees. I suspect your actual problem is there are
areas of the code base where patches do just get ignored because
of a lack of maintainers for them. You can generally tell the
difference between ignored/rejected/deferred with our current system:
it's whether there's a reply from somebody with negative review, or
saying 'ok but won't go in this release' or no email reply at all.

 Note that I think that one of the biggest benefits of such a tool would be
 during feature freeze, whereby the mailing list contains an avalanche of
 future and current PULL requests which have to be manually filtered by
 committers. This would help both developers and committers see what patches
 are definitely scheduled for the next release as opposed to patches being
 rejected at the last minute because the PULL request failed just before the
 release deadline.

Get pull requests (and patches for the release) in early, please.
The closer you get to the release deadline the more likely you are
to find that yes, some patches don't make it under the wire.

thanks
-- PMM



Re: [Qemu-devel] [PATCHv9 1/5] block: add native support for NFS

2014-02-03 Thread Kevin Wolf
Am 03.02.2014 um 10:26 hat Peter Lieven geschrieben:
 This patch adds native support for accessing images on NFS
 shares without the requirement to actually mount the entire
 NFS share on the host.
 
 NFS Images can simply be specified by an url of the form:
 nfs://host/export/filename[?param=value[param2=value2[...]]]
 
 For example:
 qemu-img create -f qcow2 nfs://10.0.0.1/qemu-images/test.qcow2
 
 You need LibNFS from Ronnie Sahlberg available at:
git://github.com/sahlberg/libnfs.git
 for this to work.
 
 During configure it is automatically probed for libnfs and support
 is enabled on-the-fly. You can forbid or enforce libnfs support
 with --disable-libnfs or --enable-libnfs respectively.
 
 Due to NFS restrictions you might need to execute your binaries
 as root, allow them to open priviledged ports (1024) or specify
 insecure option on the NFS server.
 
 For additional information on ROOT vs. non-ROOT operation and URL
 format + parameters see:
https://raw.github.com/sahlberg/libnfs/master/README
 
 Supported by qemu are the uid, gid and tcp-syncnt URL parameters.
 
 LibNFS currently support NFS version 3 only.
 
 Signed-off-by: Peter Lieven p...@kamp.de

Some minor comments in case you need to respin for another reason:

  MAINTAINERS |5 +
  block/Makefile.objs |1 +
  block/nfs.c |  439 
 +++
  configure   |   26 +++
  qapi-schema.json|1 +
  5 files changed, 472 insertions(+)
  create mode 100644 block/nfs.c

 +typedef struct NFSRPC {
 +int ret;
 +int complete;

Should be bool.

 +QEMUIOVector *iov;
 +struct stat *st;
 +Coroutine *co;
 +QEMUBH *bh;
 +} NFSRPC;

 +static BlockDriver bdrv_nfs = {
 +.format_name = nfs,
 +.protocol_name   = nfs,
 +
 +.instance_size   = sizeof(NFSClient),
 +.bdrv_needs_filename = true,
 +.bdrv_has_zero_init = nfs_has_zero_init,
 +.bdrv_get_allocated_file_size = nfs_get_allocated_file_size,
 +.bdrv_truncate = nfs_file_truncate,

This group of options could have used alignment for = as well. :-)

 +.bdrv_file_open  = nfs_file_open,
 +.bdrv_close  = nfs_file_close,
 +.bdrv_create = nfs_file_create,
 +
 +.bdrv_co_readv = nfs_co_readv,
 +.bdrv_co_writev= nfs_co_writev,
 +.bdrv_co_flush_to_disk = nfs_co_flush,
 +};

Kevin



Re: [Qemu-devel] [PATCH 1/6] cris: Add a CRISv32 default any CPU for user mode emulation

2014-02-03 Thread Edgar E. Iglesias
On Mon, Feb 03, 2014 at 12:44:03PM +0100, Andreas Färber wrote:
 Hi,
 
 Am 02.02.2014 04:04, schrieb edgar.igles...@gmail.com:
  From: Edgar E. Iglesias edgar.igles...@xilinx.com
  
  Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
  ---
   target-cris/cpu.c | 7 +++
   1 file changed, 7 insertions(+)
  
  diff --git a/target-cris/cpu.c b/target-cris/cpu.c
  index 44301a4..21f1860 100644
  --- a/target-cris/cpu.c
  +++ b/target-cris/cpu.c
  @@ -239,7 +239,14 @@ static const TypeInfo cris_cpu_model_type_infos[] = {
   .name = TYPE(crisv32),
   .parent = TYPE_CRIS_CPU,
   .class_init = crisv32_cpu_class_init,
  +},
  +#if defined(CONFIG_USER_ONLY)
  +{
  +.name = TYPE(any),
  +.parent = TYPE_CRIS_CPU,
  +.class_init = crisv32_cpu_class_init,
   }
 
 If this model is supposed to be exactly the same as crisv32, I would
 recommend to make this an alias handled in CRISCPU::class_by_name()
 rather than a distinct QOM type.
 

Sounds good, I'll send a v2 of this one.

Cheers,
Edgar



[Qemu-devel] [PATCH v2] cris: Add any as alias for crisv32 in user emulation

2014-02-03 Thread Edgar E. Iglesias
From: Edgar E. Iglesias edgar.igles...@xilinx.com

Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
---

Notes (cl):
v1 - v2:
Implement as an alias rather than as QOM type. (AF)

 target-cris/cpu.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index 44301a4..acb5688 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -66,6 +66,12 @@ static ObjectClass *cris_cpu_class_by_name(const char 
*cpu_model)
 return NULL;
 }
 
+#if defined(CONFIG_USER_ONLY)
+if (strcasecmp(cpu_model, any) == 0) {
+return object_class_by_name(crisv32- TYPE_CRIS_CPU);
+}
+#endif
+
 typename = g_strdup_printf(%s- TYPE_CRIS_CPU, cpu_model);
 oc = object_class_by_name(typename);
 g_free(typename);
-- 
1.8.3.2




Re: [Qemu-devel] [PATCHv9 0/5] block: add native support for NFS

2014-02-03 Thread Kevin Wolf
Am 03.02.2014 um 10:26 hat Peter Lieven geschrieben:
 This adds v9 of the NFS protocol driver + qemu-iotest adjustments.

Thanks, applied to the block branch.

Kevin



Re: [Qemu-devel] Improving patch tracking - something like gerrit?

2014-02-03 Thread Daniel P. Berrange
On Mon, Feb 03, 2014 at 12:45:31PM +, Mark Cave-Ayland wrote:
 Hi all,
 
 It should be fairly evident to most people that the volume of
 patches flowing through the qemu-devel mailing list is continually
 increasing, and it is becoming increasingly difficult to track which
 patches have been applied over time. This is particularly a problem
 where patchsets have dependencies on other patchsets which haven't
 yet been applied to git master, which can then cause merge conflicts
 due to length of time taken for the final series to be merged.
 
 Is it time for QEMU to start looking at tools such as gerrit to help
 manage this process? There seems to be an increasing number of ping
 requests for outstanding patches (including my own) which don't get
 applied for weeks, and often even months because they target less
 popular platforms/subsystems and so don't always get the attention
 of the committers.

Having had to use Gerrit for a long time on OpenStack, I'd never
willingly use it on a project I was in charge of for a number
of reasons

 - No practical integration with email based workflows for people
   who don't want to use web UIs to comment. You can download patches
   from tool using to view the code outside the UI, but to actually
   comment you need to use the RSI-inducing, pointy-clicky web UI.

 - Poor handling of patch series - it shows dependancies between
   patches but that is basically all it does, and even that has
   poor UI. People frequently review 1 single patch never noticing
   that its part of a patch series. There's no way to get a view of
   all patches in a series ordered correctly. If you tag them with
   a topic, you can view all patches in the topic, but it randomly
   re-orders the patches, making it basically useless.

 - Poor UI for browsing through historical comments on previous
   versions of the patch. The comments are split between multiple
   web page views so you again have pointy-clicky hell trying to
   read through historical comments.

 - Poor UI for browsing/querying pending patches. Reviewers typically
   find themselves having to write external/command line tools to
   query gerrit in order to workaround its limited UI.


So sure, gerrit can track every single patch submitted and tell you
if it is applied or not, but having used it, I can't say that it is
a net win overall, particularly if your development process is heavily
using large patch series.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|



[Qemu-devel] [PATCH 1/3] glib: move g_poll() replacement into glib-compat.h

2014-02-03 Thread Stefan Hajnoczi
We have a dedicated header file for wrappers to smooth over glib version
differences.  Move the g_poll() definition into glib-compat.h for
consistency.

Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
 include/glib-compat.h | 12 
 include/qemu-common.h | 12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8aa77af..8d25900 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -24,4 +24,16 @@ static inline guint g_timeout_add_seconds(guint interval, 
GSourceFunc function,
 }
 #endif
 
+#if !GLIB_CHECK_VERSION(2, 20, 0)
+/*
+ * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
+ * on older systems.
+ */
+static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
+{
+GMainContext *ctx = g_main_context_default();
+return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
+}
+#endif
+
 #endif
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 5054836..e0e03cc 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -124,18 +124,6 @@ int qemu_main(int argc, char **argv, char **envp);
 void qemu_get_timedate(struct tm *tm, int offset);
 int qemu_timedate_diff(struct tm *tm);
 
-#if !GLIB_CHECK_VERSION(2, 20, 0)
-/*
- * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
- * on older systems.
- */
-static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
-{
-GMainContext *ctx = g_main_context_default();
-return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
-}
-#endif
-
 /**
  * is_help_option:
  * @s: string to test
-- 
1.8.5.3




[Qemu-devel] [PATCH 0/3] glib: move compat functions into glib-compat.h

2014-02-03 Thread Stefan Hajnoczi
glib has deprecated APIs like GStaticMutex, g_thread_create(), and others.  In
QEMU support both old and new APIs since using deprecated APIs would flood us
with warnings but legacy distros must continue to build the QEMU source code.

This patch series reduces ifdefs by moving glib compat functions into
glib-compat.h, where they can be reused.

There are two strategies for compat functions:

1. Implement the new API using the deprecated API.  This compat function is
   used when building on a legacy host.  Sometimes the API semantics are so
   different that this option is not feasible.

2. Add a new wrapper API that maps to the deprecated API.  The wrapper is not
   marked deprecated so it works as a drop-in replacement but is implemented
   using the new API where possible.

Stefan Hajnoczi (3):
  glib: move g_poll() replacement into glib-compat.h
  glib: add g_thread_new() compat function
  glib: add compat wrapper for GStaticMutex

 coroutine-gthread.c   | 26 ++
 include/glib-compat.h | 44 
 include/qemu-common.h | 12 
 trace/simple.c| 31 ++-
 4 files changed, 64 insertions(+), 49 deletions(-)

-- 
1.8.5.3




[Qemu-devel] [PATCH 3/3] glib: add compat wrapper for GStaticMutex

2014-02-03 Thread Stefan Hajnoczi
Avoid duplicating ifdefs for the deprecated GStaticMutex API by
introducing compat_g_static_mutex_*() in glib-compat.h.

GStaticMutex users should use the compat API to avoid dealing with
deprecation.

Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
 coroutine-gthread.c   | 13 +++--
 include/glib-compat.h | 19 +++
 trace/simple.c| 26 +-
 3 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/coroutine-gthread.c b/coroutine-gthread.c
index 695c113..28272f8 100644
--- a/coroutine-gthread.c
+++ b/coroutine-gthread.c
@@ -30,7 +30,7 @@ typedef struct {
 CoroutineAction action;
 } CoroutineGThread;
 
-static GStaticMutex coroutine_lock = G_STATIC_MUTEX_INIT;
+DEFINE_COMPAT_G_STATIC_MUTEX(coroutine_lock);
 
 /* GLib 2.31 and beyond deprecated various parts of the thread API,
  * but the new interfaces are not available in older GLib versions
@@ -123,15 +123,16 @@ static void __attribute__((constructor)) 
coroutine_init(void)
 static void coroutine_wait_runnable_locked(CoroutineGThread *co)
 {
 while (!co-runnable) {
-g_cond_wait(coroutine_cond, g_static_mutex_get_mutex(coroutine_lock));
+g_cond_wait(coroutine_cond,
+compat_g_static_mutex_get_mutex(coroutine_lock));
 }
 }
 
 static void coroutine_wait_runnable(CoroutineGThread *co)
 {
-g_static_mutex_lock(coroutine_lock);
+compat_g_static_mutex_lock(coroutine_lock);
 coroutine_wait_runnable_locked(co);
-g_static_mutex_unlock(coroutine_lock);
+compat_g_static_mutex_unlock(coroutine_lock);
 }
 
 static gpointer coroutine_thread(gpointer opaque)
@@ -173,7 +174,7 @@ CoroutineAction qemu_coroutine_switch(Coroutine *from_,
 CoroutineGThread *from = DO_UPCAST(CoroutineGThread, base, from_);
 CoroutineGThread *to = DO_UPCAST(CoroutineGThread, base, to_);
 
-g_static_mutex_lock(coroutine_lock);
+compat_g_static_mutex_lock(coroutine_lock);
 from-runnable = false;
 from-action = action;
 to-runnable = true;
@@ -183,7 +184,7 @@ CoroutineAction qemu_coroutine_switch(Coroutine *from_,
 if (action != COROUTINE_TERMINATE) {
 coroutine_wait_runnable_locked(from);
 }
-g_static_mutex_unlock(coroutine_lock);
+compat_g_static_mutex_unlock(coroutine_lock);
 return from-action;
 }
 
diff --git a/include/glib-compat.h b/include/glib-compat.h
index ea965df..48fa95c 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -49,4 +49,23 @@ static inline GThread *g_thread_new(const gchar *unused,
 }
 #endif
 
+/* GStaticMutex was deprecated in 2.32.0.  Use the compat_g_static_mutex_*()
+ * wrappers to hide the GStaticMutex/GMutex distinction.
+ */
+#if GLIB_CHECK_VERSION(2, 32, 0)
+#define DEFINE_COMPAT_G_STATIC_MUTEX(name) \
+static GMutex name
+
+#define compat_g_static_mutex_lock(m) g_mutex_lock(m)
+#define compat_g_static_mutex_unlock(m) g_mutex_unlock(m)
+#define compat_g_static_mutex_get_mutex(m) (m)
+#else
+#define DEFINE_COMPAT_G_STATIC_MUTEX(name) \
+static GStaticMutex name = G_STATIC_MUTEX_INIT
+
+#define compat_g_static_mutex_lock(m) g_static_mutex_lock(m)
+#define compat_g_static_mutex_unlock(m) g_static_mutex_unlock(m)
+#define compat_g_static_mutex_get_mutex(m) g_static_mutex_get_mutex(m)
+#endif
+
 #endif
diff --git a/trace/simple.c b/trace/simple.c
index 8e83e59..dc58afe 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -41,17 +41,7 @@
  * Trace records are written out by a dedicated thread.  The thread waits for
  * records to become available, writes them out, and then waits again.
  */
-#if GLIB_CHECK_VERSION(2, 32, 0)
-static GMutex trace_lock;
-#define lock_trace_lock() g_mutex_lock(trace_lock)
-#define unlock_trace_lock() g_mutex_unlock(trace_lock)
-#define get_trace_lock_mutex() (trace_lock)
-#else
-static GStaticMutex trace_lock = G_STATIC_MUTEX_INIT;
-#define lock_trace_lock() g_static_mutex_lock(trace_lock)
-#define unlock_trace_lock() g_static_mutex_unlock(trace_lock)
-#define get_trace_lock_mutex() g_static_mutex_get_mutex(trace_lock)
-#endif
+DEFINE_COMPAT_G_STATIC_MUTEX(trace_lock);
 
 /* g_cond_new() was deprecated in glib 2.31 but we still need to support it */
 #if GLIB_CHECK_VERSION(2, 31, 0)
@@ -151,26 +141,28 @@ static bool get_trace_record(unsigned int idx, 
TraceRecord **recordptr)
  */
 static void flush_trace_file(bool wait)
 {
-lock_trace_lock();
+compat_g_static_mutex_lock(trace_lock);
 trace_available = true;
 g_cond_signal(trace_available_cond);
 
 if (wait) {
-g_cond_wait(trace_empty_cond, get_trace_lock_mutex());
+g_cond_wait(trace_empty_cond,
+compat_g_static_mutex_get_mutex(trace_lock));
 }
 
-unlock_trace_lock();
+compat_g_static_mutex_unlock(trace_lock);
 }
 
 static void wait_for_trace_records_available(void)
 {
-lock_trace_lock();
+compat_g_static_mutex_lock(trace_lock);
 while (!(trace_available  trace_writeout_enabled)) {
 

[Qemu-devel] [PATCH 2/3] glib: add g_thread_new() compat function

2014-02-03 Thread Stefan Hajnoczi
Implement g_thread_new() in terms of the deprecated g_thread_create().
The API was changed in glib 2.31.0.

The compat function allows us to write modern code and avoid ifdefs.

Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
 coroutine-gthread.c   | 13 +++--
 include/glib-compat.h | 13 +
 trace/simple.c|  5 +
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/coroutine-gthread.c b/coroutine-gthread.c
index d3e5b99..695c113 100644
--- a/coroutine-gthread.c
+++ b/coroutine-gthread.c
@@ -76,11 +76,6 @@ static inline void set_coroutine_key(CoroutineGThread *co,
 g_private_replace(coroutine_key, co);
 }
 
-static inline GThread *create_thread(GThreadFunc func, gpointer data)
-{
-return g_thread_new(coroutine, func, data);
-}
-
 #else
 
 /* Handle older GLib versions */
@@ -104,15 +99,13 @@ static inline void set_coroutine_key(CoroutineGThread *co,
  free_on_thread_exit ? (GDestroyNotify)g_free : NULL);
 }
 
+#endif
+
 static inline GThread *create_thread(GThreadFunc func, gpointer data)
 {
-return g_thread_create_full(func, data, 0, TRUE, TRUE,
-G_THREAD_PRIORITY_NORMAL, NULL);
+return g_thread_new(coroutine, func, data);
 }
 
-#endif
-
-
 static void __attribute__((constructor)) coroutine_init(void)
 {
 if (!g_thread_supported()) {
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8d25900..ea965df 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -36,4 +36,17 @@ static inline gint g_poll(GPollFD *fds, guint nfds, gint 
timeout)
 }
 #endif
 
+#if !GLIB_CHECK_VERSION(2, 31, 0)
+static inline GThread *g_thread_new(const gchar *unused,
+GThreadFunc func,
+gpointer data)
+{
+GThread *thread = g_thread_create(func, data, TRUE, NULL);
+if (!thread) {
+g_error(g_thread_create failed);
+}
+return thread;
+}
+#endif
+
 #endif
diff --git a/trace/simple.c b/trace/simple.c
index 57572c4..8e83e59 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -17,6 +17,7 @@
 #include pthread.h
 #endif
 #include qemu/timer.h
+#include glib-compat.h
 #include trace.h
 #include trace/control.h
 #include trace/simple.h
@@ -397,11 +398,7 @@ static GThread *trace_thread_create(GThreadFunc fn)
 pthread_sigmask(SIG_SETMASK, set, oldset);
 #endif
 
-#if GLIB_CHECK_VERSION(2, 31, 0)
 thread = g_thread_new(trace-thread, fn, NULL);
-#else
-thread = g_thread_create(fn, NULL, FALSE, NULL);
-#endif
 
 #ifndef _WIN32
 pthread_sigmask(SIG_SETMASK, oldset, NULL);
-- 
1.8.5.3




Re: [Qemu-devel] [PATCH v4 0/5] pc: make ACPI pcihp more reusable

2014-02-03 Thread Michael S. Tsirkin
On Mon, Feb 03, 2014 at 11:44:56AM +0100, Igor Mammedov wrote:
 changes since v3:
  - keep acpi-pci-hotplug-with-bridge-support property
and pass its value to acpi_pcihp_init() to init internal
.legacy_piix field.
 changes since v2:
  - rename 'use_acpi_pci_hotplug' field to 'legacy_piix'
and corresponding properties 
  - drop excessive checks for legacy mode
  - rework legacy vmstate handling to use AcpiPciHpPciStatus[0] structure
which reduced acpi/piix4.c by another 50 LOC
  - move legacy initialization to pcihp.c
 changes since v1:
  - add BSEL property to root bus when in compatibility mode
  as result dropped hw:acpi:pcihp: assume root PCI bus if bus has no 
 ACPI_PCIHP_PROP_BSEL property
  - rebasing on top of pcihp: reduce number of device check events
added patch 3/4.

Looks good to me.
Applied, thanks a lot.


 Reuses new pcihp code for handling legacy PCI hotplug in
 acpi/piix4_pm, which significantly reduces code duplication
 between piix4_pm and pcihp reducing codebase by ~200 LOC.
 
 It also allows cleaner rebase of generic hotplug refactoring,
 by not increasing code duplication since it will need to be
 done only for pcihp.
 
 Git tree for testing based on mst's PCI tree:
 https://github.com/imammedo/qemu/commits/pcihp_cleanup_v4
 
 
 
 Igor Mammedov (5):
   pcihp: replace enable|disable_device() with oneliners
   pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR
   pcihp: make pci_read() mmio calback compatible with legacy ACPI
 hotplug
   pcihp: remove unused AcpiPciHpPciStatus.device_present field
   hw:piix4:acpi: reuse pcihp code for legacy PCI hotplug
 
  hw/acpi/pcihp.c |   68 ---
  hw/acpi/piix4.c |  210 
 ---
  include/hw/acpi/pcihp.h |5 +-
  3 files changed, 55 insertions(+), 228 deletions(-)



[Qemu-devel] [PATCH] block: Fail gracefully with missing filename

2014-02-03 Thread Kevin Wolf
This fixes a regression introduced in commit 2a05cbe42 ('block: Allow
block devices without files'):

$ qemu-system-x86_64 -drive driver=file
qemu-system-x86_64: block.c:892: bdrv_open_common: Assertion
`!drv-bdrv_needs_filename || filename != ((void *)0)' failed.

Now the respective check must be performed not only in bdrv_file_open(),
but also in bdrv_open().

Signed-off-by: Kevin Wolf kw...@redhat.com
---
 block.c| 11 ++-
 tests/qemu-iotests/051 | 12 
 tests/qemu-iotests/051.out | 24 
 3 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/block.c b/block.c
index cb21a5f..ac0ccac 100644
--- a/block.c
+++ b/block.c
@@ -832,6 +832,12 @@ static int bdrv_open_common(BlockDriverState *bs, 
BlockDriverState *file,
 filename = qdict_get_try_str(options, filename);
 }
 
+if (drv-bdrv_needs_filename  !filename) {
+error_setg(errp, The '%s' block driver requires a file name,
+   drv-format_name);
+return -EINVAL;
+}
+
 trace_bdrv_open_common(bs, filename ?: , flags, drv-format_name);
 
 node_name = qdict_get_try_str(options, node-name);
@@ -1031,11 +1037,6 @@ int bdrv_file_open(BlockDriverState **pbs, const char 
*filename,
 goto fail;
 }
 qdict_del(options, filename);
-} else if (drv-bdrv_needs_filename  !filename) {
-error_setg(errp, The '%s' block driver requires a file name,
-   drv-format_name);
-ret = -EINVAL;
-goto fail;
 }
 
 if (!drv-bdrv_file_open) {
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index b23d91b..46345fb 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -172,6 +172,18 @@ run_qemu -drive file=$TEST_IMG,file.driver=file
 run_qemu -drive file=$TEST_IMG,file.driver=qcow2
 
 echo
+echo === Leaving out required options ===
+echo
+
+run_qemu -drive driver=file
+run_qemu -drive driver=nbd
+run_qemu -drive driver=raw
+run_qemu -drive file.driver=file
+run_qemu -drive file.driver=nbd
+run_qemu -drive file.driver=raw
+run_qemu -drive foo=bar
+
+echo
 echo === Parsing protocol from file name ===
 echo
 
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index d0c5173..30e2dbd 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -225,6 +225,30 @@ Testing: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2
 QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: could not open disk 
image TEST_DIR/t.qcow2: Block format 'qcow2' used by device '' doesn't support 
the option 'filename'
 
 
+=== Leaving out required options ===
+
+Testing: -drive driver=file
+QEMU_PROG: -drive driver=file: could not open disk image ide0-hd0: The 'file' 
block driver requires a file name
+
+Testing: -drive driver=nbd
+QEMU_PROG: -drive driver=nbd: could not open disk image ide0-hd0: Could not 
open image: Invalid argument
+
+Testing: -drive driver=raw
+QEMU_PROG: -drive driver=raw: could not open disk image ide0-hd0: Can't use 
'raw' as a block driver for the protocol level
+
+Testing: -drive file.driver=file
+QEMU_PROG: -drive file.driver=file: could not open disk image ide0-hd0: The 
'file' block driver requires a file name
+
+Testing: -drive file.driver=nbd
+QEMU_PROG: -drive file.driver=nbd: could not open disk image ide0-hd0: Could 
not open image: Invalid argument
+
+Testing: -drive file.driver=raw
+QEMU_PROG: -drive file.driver=raw: could not open disk image ide0-hd0: Can't 
use 'raw' as a block driver for the protocol level
+
+Testing: -drive foo=bar
+QEMU_PROG: -drive foo=bar: could not open disk image ide0-hd0: Must specify 
either driver or file
+
+
 === Parsing protocol from file name ===
 
 Testing: -hda foo:bar
-- 
1.8.1.4




Re: [Qemu-devel] [PATCH v2] cris: Add any as alias for crisv32 in user emulation

2014-02-03 Thread Andreas Färber
Am 03.02.2014 14:23, schrieb Edgar E. Iglesias:
 From: Edgar E. Iglesias edgar.igles...@xilinx.com
 
 Signed-off-by: Edgar E. Iglesias edgar.igles...@xilinx.com
 ---
 
 Notes (cl):
 v1 - v2:
 Implement as an alias rather than as QOM type. (AF)

Reviewed-by: Andreas Färber afaer...@suse.de

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH 7/8] roms: update vgabios binaries

2014-02-03 Thread Paolo Bonzini

Il 05/01/2014 12:45, Jan Kiszka ha scritto:

On 2014-01-05 12:26, Paolo Bonzini wrote:

Il 05/01/2014 10:35, Jan Kiszka ha scritto:

On 2013-12-06 10:35, Gerd Hoffmann wrote:

This also switches from lgplvgabios to seavgabios.

Signed-off-by: Gerd Hoffmann kra...@redhat.com ---
pc-bios/vgabios-cirrus.bin | Bin 35840 - 36864 bytes
pc-bios/vgabios-qxl.bin| Bin 40448 - 37376 bytes
pc-bios/vgabios-stdvga.bin | Bin 40448 - 37376 bytes
pc-bios/vgabios-vmware.bin | Bin 40448 - 37376 bytes
pc-bios/vgabios.bin| Bin 40448 - 36864 bytes 5
files changed, 0 insertions(+), 0 deletions(-)




This update breaks a 64-bit win7 guest for me. It now spins
infinitely in the Starting Windows screen. I'm using stdvga.
Is this a known issue?


Yes, and IIRC it's fixed in seabios.git.


(Hmm, cd roms; make seavgabios doesn't work with out-of-tree
builds)

Confirmed, win7 boots fine again with current seabios.git master.
So please update qemu.


Ping?

Paolo




Re: [Qemu-devel] [PATCH 7/8] roms: update vgabios binaries

2014-02-03 Thread Gerd Hoffmann

  Hi,

  Confirmed, win7 boots fine again with current seabios.git master.
  So please update qemu.
 
 Ping?

Oops, totally forgot that.  I'll send out a pull req in a moment.

cheers,
  Gerd






Re: [Qemu-devel] [PATCH 00/12] trace: [tcg] Allow tracing guest events in TCG-generated code

2014-02-03 Thread Stefan Hajnoczi
On Fri, Jan 31, 2014 at 05:09:03PM +0100, Lluís Vilanova wrote:
 Adds the base ability to specify which events in the trace-events file may 
 be
 used to trace guest activity in the TCG code (using the tcg event propery).
 
 Such events generate an extra set of tracing functions that can be called 
 during
 TCG code generation and will automatically redirect a call to the appropriate
 backend-dependent tracing functions when the guest code is executed.

I've never worked on TCG but this seems like a good idea: a way to plant
trace events in TCG-generated code.

CCing TCG folks to check they are happy with the approach

Once any high-level discussion is done I'll review the tracing changes.

Stefan



[Qemu-devel] [PULL 0/3] Update seabios to 1.7.4

2014-02-03 Thread Gerd Hoffmann
  Hi,

Sorry for the delay folks, totally forgot that one.
Here is the seabios update to 1.7.4 final.

please pull,
  Gerd

The following changes since commit 2f61120c10da9128357510debc8e66880cd2bfdc:

  Merge remote-tracking branch 'qmp-unstable/queue/qmp' into staging 
(2014-02-01 23:32:31 +)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-roms-1

for you to fetch changes up to 41419b0f11d125ad792660638eb452c767eddc28:

  Update seabios binaries to 1.7.4 (2014-02-03 15:40:01 +0100)


Update seabios to 1.7.4


Bruce Rogers (1):
  roms: remove explicit MAKEFLAGS from recursive make invocations

Gerd Hoffmann (2):
  Update seabios submodule to 1.7.4
  Update seabios binaries to 1.7.4

 pc-bios/bios-256k.bin  | Bin 262144 - 262144 bytes
 pc-bios/bios.bin   | Bin 131072 - 131072 bytes
 pc-bios/vgabios-cirrus.bin | Bin 36864 - 36864 bytes
 pc-bios/vgabios-qxl.bin| Bin 37376 - 37376 bytes
 pc-bios/vgabios-stdvga.bin | Bin 37376 - 37376 bytes
 pc-bios/vgabios-vmware.bin | Bin 37376 - 37376 bytes
 pc-bios/vgabios.bin| Bin 36864 - 36864 bytes
 roms/Makefile  |  22 +++---
 roms/seabios   |   2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)



  1   2   3   4   >